LDMX Software
Public Member Functions | Private Attributes | List of all members
trigscint::TestBeamClusterAnalyzer Class Reference

Public Member Functions

 TestBeamClusterAnalyzer (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &parameters) override
 Callback for the EventProcessor to configure itself from the given set of parameters.
 
void analyze (const framework::Event &event) override
 Process the event and make histograms or summaries.
 
void onProcessStart () override
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
void onProcessEnd () override
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
- Public Member Functions inherited from framework::Analyzer
 Analyzer (const std::string &name, Process &process)
 Class constructor.
 
- Public Member Functions inherited from framework::EventProcessor
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &runHeader)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Private Attributes

std::string inputCol_
 
std::string inputPassName_ {""}
 
int nChannels {16}
 
TH2F * hN3N2
 
TH2F * hN3N1
 
TH2F * hN2N1
 
TH1F * hNClusters
 
TH1F * hNHits
 
TH1F * hPEinHits [16]
 
TH1F * hPEinClusters [16]
 
TH1F * hDeltaCentroids
 
TH2F * hDeltaVsSeed
 

Additional Inherited Members

- Static Public Member Functions inherited from framework::EventProcessor
static void declare (const std::string &classname, int classtype, EventProcessorMaker *)
 Internal function which is part of the PluginFactory machinery.
 
- Static Public Attributes inherited from framework::Analyzer
static const int CLASSTYPE {2}
 Constant used to track EventProcessor types by the PluginFactory.
 
- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramHelper histograms_
 Interface class for making and filling histograms.
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger theLog_
 The logger for this EventProcessor.
 

Detailed Description

Definition at line 23 of file TestBeamClusterAnalyzer.h.

Constructor & Destructor Documentation

◆ TestBeamClusterAnalyzer()

trigscint::TestBeamClusterAnalyzer::TestBeamClusterAnalyzer ( const std::string &  name,
framework::Process process 
)

Definition at line 12 of file TestBeamClusterAnalyzer.cxx.

14 : Analyzer(name, process) {}
Analyzer(const std::string &name, Process &process)
Class constructor.

Member Function Documentation

◆ analyze()

void trigscint::TestBeamClusterAnalyzer::analyze ( const framework::Event event)
overridevirtual

Process the event and make histograms or summaries.

Parameters
eventThe Event to analyze

Implements framework::Analyzer.

Definition at line 34 of file TestBeamClusterAnalyzer.cxx.

34 {
35 if (!event.exists(inputCol_, inputPassName_)) {
36 ldmx_log(info) << "No cluster collection " << inputCol_ << "_"
37 << inputPassName_ << " found. Skipping analysis of event";
38 return;
39 }
40
41 const auto clusters{
42 event.getCollection<ldmx::TrigScintCluster>(inputCol_, inputPassName_)};
43
44 int n1hit = 0;
45 int n2hit = 0;
46 int n3hit = 0;
47
48 int nClusters = clusters.size();
49 int idx = 0;
50 for (auto cluster : clusters) {
51 int seed = cluster.getSeed();
52 int nHits = cluster.getNHits();
53 if (nHits == 3)
54 n3hit++;
55 else if (nHits == 2)
56 n2hit++;
57 else if (nHits == 1)
58 n1hit++;
59
60 float PE = cluster.getPE();
61
62 hPEinClusters[seed]->Fill(PE);
63
64 /* // this requires different implementation. use getHitIDs and use the
65 indices in there
66 // in a loop over hits in the event to extract the PEs
67 // -- later.
68 for (auto hits : cluster.getConstituents() )
69 hPEinHits[seed]->Fill(PE);
70 */
71 // instead of always checking distance between the first two, instead, fill
72 // with distance from current to previous this should give us a better idea
73 // about if we're dominated by close-by activity in secondaries
74 if (idx > 0) { // look back at the previous cluster when more than one
75 hDeltaCentroids->Fill(
76 fabs(clusters[idx].getCentroid() - clusters[idx - 1].getCentroid()));
77 hDeltaVsSeed->Fill(
78 clusters[idx - 1].getSeed(),
79 fabs(clusters[idx].getCentroid() - clusters[idx - 1].getCentroid()));
80 }
81 idx++; // increment afterwards
82 } // over clusters
83
84 /*
85
86 if (n2hit)
87 hN3N2->Fill((float)n3hit/n2hit);
88 if (n1hit) {
89 hN3N1->Fill((float)n3hit/n1hit);
90 hN2N1->Fill((float)n2hit/n1hit);
91 }
92 */
93 hN3N2->Fill(n2hit, n3hit);
94 hN3N1->Fill(n1hit, n3hit);
95 hN2N1->Fill(n1hit, n2hit);
96
97 hNClusters->Fill(nClusters);
98 // todo: get hit collection to fill Nhits later?
99 hNHits->Fill(3 * n3hit + 2 * n2hit + n1hit);
100
101 return;
102}
bool exists(const std::string &name, const std::string &passName="", bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.
Definition Event.cxx:92
Stores cluster information from the trigger scintillator pads.
int getSeed() const
Get cluster seed channel nb.

References framework::Event::exists(), and ldmx::TrigScintCluster::getSeed().

◆ configure()

void trigscint::TestBeamClusterAnalyzer::configure ( framework::config::Parameters parameters)
overridevirtual

Callback for the EventProcessor to configure itself from the given set of parameters.

The parameters a processor has access to are the member variables of the python class in the sequence that has className equal to the EventProcessor class name.

For an example, look at MyProcessor.

Parameters
parametersParameters for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 16 of file TestBeamClusterAnalyzer.cxx.

17 {
18 inputCol_ = parameters.getParameter<std::string>("inputCollection");
19 inputPassName_ = parameters.getParameter<std::string>("inputPassName");
20 // wideInputCol_ =
21 // parameters.getParameter<std::string>("3hitInputCollection");
22 // wideInputPassName_ =
23 // parameters.getParameter<std::string>("3hitInputPassName");
24
25 std::cout << " [ TestBeamClusterAnalyzer ] In configure(), got parameters "
26 << "\n\t inputCollection = " << inputCol_
27 << "\n\t inputPassName = " << inputPassName_ << std::endl;
28 // << "\n\t 3hitInputCollection = " << wideInputCol_
29 // << "\n\t 3hitInputPassName = " << wideInputPassName_
30
31 return;
32}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89

References framework::config::Parameters::getParameter().

◆ onProcessEnd()

void trigscint::TestBeamClusterAnalyzer::onProcessEnd ( )
overridevirtual

Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.

Reimplemented from framework::EventProcessor.

Definition at line 159 of file TestBeamClusterAnalyzer.cxx.

159{ return; }

◆ onProcessStart()

void trigscint::TestBeamClusterAnalyzer::onProcessStart ( )
overridevirtual

Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.

Reimplemented from framework::EventProcessor.

Definition at line 104 of file TestBeamClusterAnalyzer.cxx.

104 {
105 std::cout << "\n\n Process starts! My analyzer should do something -- like "
106 "print this \n\n"
107 << std::endl;
108
110
111 int PEmax = 600;
112 int nPEbins = 0.25 * PEmax;
113 // float Qmax = PEmax / (6250. / 4.e6);
114 // float Qmin = -10;
115 // int nQbins = (Qmax - Qmin) / 4;
116
117 for (int iB = 0; iB < nChannels; iB++) {
118 hPEinHits[iB] = new TH1F(Form("hPE_chan%i", iB), Form(";PE, chan%i", iB),
119 nPEbins, 0, PEmax);
120 hPEinClusters[iB] = new TH1F(Form("hPEinClusters_chan%i", iB),
121 Form(";PE, chan%i", iB), nPEbins, 0, PEmax);
122 }
123
124 hDeltaVsSeed =
125 new TH2F("hDeltaVsSeed", ";BarID_{seed};#Delta_{centroid}", nChannels + 1,
126 -0.5, nChannels - 0.5, 5 * nChannels, 0, nChannels);
127
128 hDeltaCentroids = new TH1F("hDeltaCentroids", ";#Delta_{centroid}",
129 5 * nChannels, -0.5, nChannels - 0.5);
130
131 hNHits = new TH1F("hNHits", "Number of hits in the event; N_{hits}; Events",
132 10, 0, 10);
133 hNClusters = new TH1F("hNClusters",
134 "Number of clusters in the event; N_{clusters}; Events",
135 10, 0, 10);
136
137 /*
138 hN3N2 = new TH1F("hN3N2", "Ratio of 3-hit to 2-hit clusters;
139 N_{3-hit}/N_{2-hit}; Events", 10, 0, 4); hN3N1 = new TH1F("hN3N1", "Ratio of
140 3-hit to 1-hit clusters; N_{3-hit}/N_{1-hit}; Events", 10, 0, 4); hN2N1 = new
141 TH1F("hN2N1", "Ratio of 2-hit to 1-hit clusters; N_{2-hit}/N_{1-hit}; Events",
142 10, 0, 4);
143 */
144 int nCl = 6;
145
146 hN3N2 = new TH2F(
147 "hN3N2", "Number of 3-hit vs 2-hit clusters; N_{2-hit};N_{3-hit}; Events",
148 nCl, -0.5, nCl - 0.5, nCl, -0.5, nCl - 0.5);
149 hN3N1 = new TH2F(
150 "hN3N1", "Number of 3-hit vs 1-hit clusters; N_{1-hit};N_{3-hit}; Events",
151 nCl, -0.5, nCl - 0.5, nCl, -0.5, nCl - 0.5);
152 hN2N1 = new TH2F(
153 "hN2N1", "Number of 2-hit vs 1-hit clusters; N_{1-hit};N_{2-hit}; Events",
154 nCl, -0.5, nCl - 0.5, nCl, -0.5, nCl - 0.5);
155
156 return;
157}
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...

Member Data Documentation

◆ hDeltaCentroids

TH1F* trigscint::TestBeamClusterAnalyzer::hDeltaCentroids
private

Definition at line 55 of file TestBeamClusterAnalyzer.h.

◆ hDeltaVsSeed

TH2F* trigscint::TestBeamClusterAnalyzer::hDeltaVsSeed
private

Definition at line 56 of file TestBeamClusterAnalyzer.h.

◆ hN2N1

TH2F* trigscint::TestBeamClusterAnalyzer::hN2N1
private

Definition at line 49 of file TestBeamClusterAnalyzer.h.

◆ hN3N1

TH2F* trigscint::TestBeamClusterAnalyzer::hN3N1
private

Definition at line 48 of file TestBeamClusterAnalyzer.h.

◆ hN3N2

TH2F* trigscint::TestBeamClusterAnalyzer::hN3N2
private

Definition at line 47 of file TestBeamClusterAnalyzer.h.

◆ hNClusters

TH1F* trigscint::TestBeamClusterAnalyzer::hNClusters
private

Definition at line 50 of file TestBeamClusterAnalyzer.h.

◆ hNHits

TH1F* trigscint::TestBeamClusterAnalyzer::hNHits
private

Definition at line 51 of file TestBeamClusterAnalyzer.h.

◆ hPEinClusters

TH1F* trigscint::TestBeamClusterAnalyzer::hPEinClusters[16]
private

Definition at line 54 of file TestBeamClusterAnalyzer.h.

◆ hPEinHits

TH1F* trigscint::TestBeamClusterAnalyzer::hPEinHits[16]
private

Definition at line 53 of file TestBeamClusterAnalyzer.h.

◆ inputCol_

std::string trigscint::TestBeamClusterAnalyzer::inputCol_
private

Definition at line 39 of file TestBeamClusterAnalyzer.h.

◆ inputPassName_

std::string trigscint::TestBeamClusterAnalyzer::inputPassName_ {""}
private

Definition at line 40 of file TestBeamClusterAnalyzer.h.

40{""};

◆ nChannels

int trigscint::TestBeamClusterAnalyzer::nChannels {16}
private

Definition at line 45 of file TestBeamClusterAnalyzer.h.

45{16};

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