RAD: Reaction Aware Dataframes

Modern Particle & Nuclear Physics Data Analysis with ROOT RDataFrame

Core Concepts

Reaction Configuration

RAD is built around the idea of configuring a physics reaction as a ConfigReaction object.

  • Simplifies code for complex final states (e.g. e p -> e' K+ X).
  • Handles multiple data types (HepMC, Podio, Flat Trees) uniformly.
  • Master/Clone Architecture: Analyze multiple hypotheses (Rec/Truth, Detected/Missing) in a single pass.

Modular Utilities

RAD provides a suite of utility classes:

  • ParticleCreator: Define particles and calculate Sums/Diffs.
  • KinematicsProcessor: The execution engine for physics loops.
  • KineCalculation: Wrap custom C++ physics functions.

Example Usage


// Setup for MC generator data (HepMC3)
#include "HepMCElectro.h"
#include "KinematicsProcElectro.h"

void ProcessHepMCZCombi() {
  // 1. Create interface to the ROOT file
  rad::HepMCElectro hepmc{"hepmc3_tree", "data_file.root"};
  hepmc.SetupMC(); 

  // 2. Define Topology (Candidates & Roles)
  hepmc.SetBeamElectronIndex(0); // Beam is Index 0
  
  // Define "ele" as any track with PID 11
  hepmc.SetParticleCandidates("ele", 2 /*Role*/, rad::index::FilterIndices(11), {"pid"});
  hepmc.SetParticleCandidates("pos", 3 /*Role*/, rad::index::FilterIndices(-11), {"pid"});
  
  // 3. Initialize Kinematics Processor
  rad::KinematicsProcElectro kine(&hepmc, "rec_");
  
  // Define Composite Particles (J/psi -> e+ e-)
  kine.Creator().Sum("Jpsi", {{"ele", "pos"}});
  
  // 4. Calculate Physics
  kine.Init(); // Triggers Combinatorial Sort
  kine.Q2(); 
  kine.Mass("M_Jpsi", {"Jpsi"}); 

  // 5. Snapshot results
  hepmc.Snapshot("output.root");
}
        

Standard workflow for combinatorial analysis.