CHeT Library
Loading...
Searching...
No Matches
CHeTReader.hh
Go to the documentation of this file.
1#ifndef CHETREADER_HH
2#define CHETREADER_HH
3
4#include <algorithm>
5#include <iostream>
6#include <limits>
7#include <map>
8#include <string>
9#include <vector>
10
11#include <ROOT/RDataFrame.hxx>
12#include <ROOT/RVec.hxx>
13
15
16namespace CHeT
17{
23namespace Data
24{
25
37class Reader
38{
39 public:
45 Reader(const std::string &filename, const std::string &treeName = "auto");
46
47 // Disable copy (RDataFrame has unique pointers)
48 Reader(const Reader &) = delete;
49 Reader &operator=(const Reader &) = delete;
50
59 void SetCuts(double toaMin, double toaMax, unsigned int totMin, unsigned int totMax);
60
66 void SetSingleEntry(long entry);
67
73 void SetEventByID(int eventID);
74
80 void SetEnabledBoards(const std::vector<int> &boards);
81
87 void SetEnabledCylinders(const std::vector<int> &cylinders);
88
94 void SetEnabledLayers(const std::vector<int> &layers);
95
101 void SetEnabledGeometries(const std::vector<std::pair<int, int>> &geometries);
102
106 ROOT::RDF::RNode GetRaw();
107
113 void SaveToTree(const std::string &filename, const std::string &treeName = "chet");
114
124 ROOT::RDF::RNode GetCHeTTree();
125
126 private:
127 std::string fFilename;
128 std::string fTreeName;
129 ROOT::RDataFrame fDF;
130 ROOT::RDF::RNode fHeadNode; // The active head node (potentially filtered)
131
132 // Cut parameters (default: open)
133 double fToaMin = -1e9;
134 double fToaMax = 1e9;
135 unsigned int fTotMin = 0;
136 unsigned int fTotMax = 99999;
137
138 // Filters
139 std::vector<int> fEnabledBoards;
140 std::vector<int> fEnabledCylinders;
141 std::vector<int> fEnabledLayers;
142 std::vector<std::pair<int, int>> fEnabledGeometries;
143};
144
145} // namespace Data
146} // namespace CHeT
147
148#endif
Reads CHeT data from ROOT files and processes it into high-level objects.
Definition CHeTReader.hh:38
void SetEnabledCylinders(const std::vector< int > &cylinders)
Restricts the analysis to specific cylinders. Only hits belonging to these cylinders will be included...
Definition CHeTReader.cc:75
ROOT::RDF::RNode fHeadNode
std::string fFilename
void SetEnabledLayers(const std::vector< int > &layers)
Restricts the analysis to specific layers. Only hits belonging to these layers will be included in th...
Definition CHeTReader.cc:80
void SetSingleEntry(long entry)
Restricts the analysis to a single entry index. Replaces any previous range or filter on the entry in...
Definition CHeTReader.cc:60
ROOT::RDataFrame fDF
void SetEventByID(int eventID)
Restricts the analysis to a specific EventID. Filters the dataset where the EventID branch matches th...
Definition CHeTReader.cc:65
std::vector< int > fEnabledLayers
std::vector< int > fEnabledBoards
ROOT::RDF::RNode GetCHeTTree()
Returns the node with calculated high-level variables.
Definition CHeTReader.cc:95
std::vector< int > fEnabledCylinders
void SaveToTree(const std::string &filename, const std::string &treeName="chet")
Saves the processed high-level data to a new ROOT file.
unsigned int fTotMin
ROOT::RDF::RNode GetRaw()
Returns the Raw node (the original tree).
Definition CHeTReader.cc:90
void SetEnabledGeometries(const std::vector< std::pair< int, int > > &geometries)
Restricts the analysis to specific (cylinder, layer) combinations. Only hits matching one of the prov...
Definition CHeTReader.cc:85
Reader(const Reader &)=delete
Reader & operator=(const Reader &)=delete
void SetEnabledBoards(const std::vector< int > &boards)
Restricts the analysis to specific boards. Only hits from these boards will be processed.
Definition CHeTReader.cc:70
unsigned int fTotMax
void SetCuts(double toaMin, double toaMax, unsigned int totMin, unsigned int totMax)
Set cuts for hit selection. Must be called before GetCHeTTree().
Definition CHeTReader.cc:52
std::string fTreeName
std::vector< std::pair< int, int > > fEnabledGeometries
Root namespace for the Cylindrical Helix Tracker (CHeT) project.