CHeT Library
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
CHeT::Data::Reader Class Reference

Reads CHeT data from ROOT files and processes it into high-level objects. More...

#include <CHeTReader.hh>

Public Member Functions

 Reader (const std::string &filename, const std::string &treeName="auto")
 Constructor.
 
 Reader (const Reader &)=delete
 
Readeroperator= (const Reader &)=delete
 
void SetCuts (double toaMin, double toaMax, unsigned int totMin, unsigned int totMax)
 Set cuts for hit selection. Must be called before GetCHeTTree().
 
void SetSingleEntry (long entry)
 Restricts the analysis to a single entry index. Replaces any previous range or filter on the entry index.
 
void SetEventByID (int eventID)
 Restricts the analysis to a specific EventID. Filters the dataset where the EventID branch matches the given ID.
 
void SetEnabledBoards (const std::vector< int > &boards)
 Restricts the analysis to specific boards. Only hits from these boards will be processed.
 
void SetEnabledCylinders (const std::vector< int > &cylinders)
 Restricts the analysis to specific cylinders. Only hits belonging to these cylinders will be included in the output.
 
void SetEnabledLayers (const std::vector< int > &layers)
 Restricts the analysis to specific layers. Only hits belonging to these layers will be included in the output.
 
void SetEnabledGeometries (const std::vector< std::pair< int, int > > &geometries)
 Restricts the analysis to specific (cylinder, layer) combinations. Only hits matching one of the provided pairs will be included.
 
ROOT::RDF::RNode GetRaw ()
 Returns the Raw node (the original tree).
 
void SaveToTree (const std::string &filename, const std::string &treeName="chet")
 Saves the processed high-level data to a new ROOT file.
 
ROOT::RDF::RNode GetCHeTTree ()
 Returns the node with calculated high-level variables.
 

Private Attributes

std::string fFilename
 
std::string fTreeName
 
ROOT::RDataFrame fDF
 
ROOT::RDF::RNode fHeadNode
 
double fToaMin = -1e9
 
double fToaMax = 1e9
 
unsigned int fTotMin = 0
 
unsigned int fTotMax = 99999
 
std::vector< int > fEnabledBoards
 
std::vector< int > fEnabledCylinders
 
std::vector< int > fEnabledLayers
 
std::vector< std::pair< int, int > > fEnabledGeometries
 

Detailed Description

Reads CHeT data from ROOT files and processes it into high-level objects.

The Reader class wraps RDataFrame to provide a convenient interface for:

Definition at line 37 of file CHeTReader.hh.

Constructor & Destructor Documentation

◆ Reader() [1/2]

CHeT::Data::Reader::Reader ( const std::string &  filename,
const std::string &  treeName = "auto" 
)

Constructor.

Parameters
filenamePath to the ROOT file (or glob pattern).
treeNameName of the tree (default: "auto").

Definition at line 43 of file CHeTReader.cc.

◆ Reader() [2/2]

CHeT::Data::Reader::Reader ( const Reader )
delete

Member Function Documentation

◆ GetCHeTTree()

ROOT::RDF::RNode CHeT::Data::Reader::GetCHeTTree ( )

Returns the node with calculated high-level variables.

Performs:

  1. Time correction (ToA alignment w.r.t. board 0).
  2. Hit filtering based on cuts (ToA/ToT).
  3. Geometric mapping (Channel ID -> Global Bundle ID -> Layer/Cylinder).
  4. Aggregation of all hits into unique vectors (All_Bundle, All_Lay...).

Definition at line 95 of file CHeTReader.cc.

◆ GetRaw()

ROOT::RDF::RNode CHeT::Data::Reader::GetRaw ( )

Returns the Raw node (the original tree).

Definition at line 90 of file CHeTReader.cc.

◆ operator=()

Reader & CHeT::Data::Reader::operator= ( const Reader )
delete

◆ SaveToTree()

void CHeT::Data::Reader::SaveToTree ( const std::string &  filename,
const std::string &  treeName = "chet" 
)

Saves the processed high-level data to a new ROOT file.

Parameters
filenameOutput ROOT file name.
treeNameOutput tree name (default: "chet").

Definition at line 446 of file CHeTReader.cc.

◆ SetCuts()

void CHeT::Data::Reader::SetCuts ( double  toaMin,
double  toaMax,
unsigned int  totMin,
unsigned int  totMax 
)

Set cuts for hit selection. Must be called before GetCHeTTree().

Parameters
toaMinMinimum Time of Arrival [ns]
toaMaxMaximum Time of Arrival [ns]
totMinMinimum Time over Threshold [LSB]
totMaxMaximum Time over Threshold [LSB]

Definition at line 52 of file CHeTReader.cc.

◆ SetEnabledBoards()

void CHeT::Data::Reader::SetEnabledBoards ( const std::vector< int > &  boards)

Restricts the analysis to specific boards. Only hits from these boards will be processed.

Parameters
boardsVector of board IDs (0, 1, 2, 3).

Definition at line 70 of file CHeTReader.cc.

◆ SetEnabledCylinders()

void CHeT::Data::Reader::SetEnabledCylinders ( const std::vector< int > &  cylinders)

Restricts the analysis to specific cylinders. Only hits belonging to these cylinders will be included in the output.

Parameters
cylindersVector of cylinder IDs.

Definition at line 75 of file CHeTReader.cc.

◆ SetEnabledGeometries()

void CHeT::Data::Reader::SetEnabledGeometries ( const std::vector< std::pair< int, int > > &  geometries)

Restricts the analysis to specific (cylinder, layer) combinations. Only hits matching one of the provided pairs will be included.

Parameters
geometriesVector of pairs {cylinderId, layerId}.

Definition at line 85 of file CHeTReader.cc.

◆ SetEnabledLayers()

void CHeT::Data::Reader::SetEnabledLayers ( const std::vector< int > &  layers)

Restricts the analysis to specific layers. Only hits belonging to these layers will be included in the output.

Parameters
layersVector of layer IDs.

Definition at line 80 of file CHeTReader.cc.

◆ SetEventByID()

void CHeT::Data::Reader::SetEventByID ( int  eventID)

Restricts the analysis to a specific EventID. Filters the dataset where the EventID branch matches the given ID.

Parameters
eventIDThe EventID to process.

Definition at line 65 of file CHeTReader.cc.

◆ SetSingleEntry()

void CHeT::Data::Reader::SetSingleEntry ( long  entry)

Restricts the analysis to a single entry index. Replaces any previous range or filter on the entry index.

Parameters
entryThe row index in the TTree.

Definition at line 60 of file CHeTReader.cc.

Member Data Documentation

◆ fDF

ROOT::RDataFrame CHeT::Data::Reader::fDF
private

Definition at line 129 of file CHeTReader.hh.

◆ fEnabledBoards

std::vector<int> CHeT::Data::Reader::fEnabledBoards
private

Definition at line 139 of file CHeTReader.hh.

◆ fEnabledCylinders

std::vector<int> CHeT::Data::Reader::fEnabledCylinders
private

Definition at line 140 of file CHeTReader.hh.

◆ fEnabledGeometries

std::vector<std::pair<int, int> > CHeT::Data::Reader::fEnabledGeometries
private

Definition at line 142 of file CHeTReader.hh.

◆ fEnabledLayers

std::vector<int> CHeT::Data::Reader::fEnabledLayers
private

Definition at line 141 of file CHeTReader.hh.

◆ fFilename

std::string CHeT::Data::Reader::fFilename
private

Definition at line 127 of file CHeTReader.hh.

◆ fHeadNode

ROOT::RDF::RNode CHeT::Data::Reader::fHeadNode
private

Definition at line 130 of file CHeTReader.hh.

◆ fToaMax

double CHeT::Data::Reader::fToaMax = 1e9
private

Definition at line 134 of file CHeTReader.hh.

◆ fToaMin

double CHeT::Data::Reader::fToaMin = -1e9
private

Definition at line 133 of file CHeTReader.hh.

◆ fTotMax

unsigned int CHeT::Data::Reader::fTotMax = 99999
private

Definition at line 136 of file CHeTReader.hh.

◆ fTotMin

unsigned int CHeT::Data::Reader::fTotMin = 0
private

Definition at line 135 of file CHeTReader.hh.

◆ fTreeName

std::string CHeT::Data::Reader::fTreeName
private

Definition at line 128 of file CHeTReader.hh.


The documentation for this class was generated from the following files: