LDMX Software
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.
 
virtual void process (Event &event) final
 Processing an event for an Analyzer is calling analyze.
 
virtual void beforeNewRun (ldmx::RunHeader &run_header) final
 Don't allow Analyzers to add parameters to the run header.
 
- Public Member Functions inherited from framework::EventProcessor
 DECLARE_FACTORY (EventProcessor, EventProcessor *, const std::string &, Process &)
 declare that we have a factory for this class
 
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()=default
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &run_header)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &event_file)
 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 input_col_
 
std::string input_pass_name_ {""}
 
int n_channels_ {16}
 
TH2F * h_n3_n2_
 
TH2F * h_n3_n1_
 
TH2F * h_n2_n1_
 
TH1F * h_n_clusters_
 
TH1F * h_n_hits_
 
TH1F * h_pe_in_hits_ [16]
 
TH1F * h_pe_in_clusters_ [16]
 
TH1F * h_delta_centroids_
 
TH2F * h_delta_vs_seed_
 

Additional Inherited Members

- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramPool histograms_
 helper object for making and filling histograms
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 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) {}
virtual void process(Event &event) final
Processing an event for an Analyzer is calling analyze.
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(input_col_, input_pass_name_)) {
36 ldmx_log(info) << "No cluster collection " << input_col_ << "_"
37 << input_pass_name_ << " found. Skipping analysis of event";
38 return;
39 }
40
41 const auto clusters{event.getCollection<ldmx::TrigScintCluster>(
42 input_col_, input_pass_name_)};
43
44 int n1hit = 0;
45 int n2hit = 0;
46 int n3hit = 0;
47
48 int n_clusters = clusters.size();
49 int idx = 0;
50 for (auto cluster : clusters) {
51 int seed = cluster.getSeed();
52 int n_hits = cluster.getNHits();
53 if (n_hits == 3)
54 n3hit++;
55 else if (n_hits == 2)
56 n2hit++;
57 else if (n_hits == 1)
58 n1hit++;
59
60 float pe = cluster.getPE();
61
62 h_pe_in_clusters_[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 h_pe_in_hits_[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 h_delta_centroids_->Fill(
76 fabs(clusters[idx].getCentroid() - clusters[idx - 1].getCentroid()));
77 h_delta_vs_seed_->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 h_n3_n2_->Fill(n2hit, n3hit);
94 h_n3_n1_->Fill(n1hit, n3hit);
95 h_n2_n1_->Fill(n1hit, n2hit);
96
97 h_n_clusters_->Fill(n_clusters);
98 // todo: get hit collection to fill Nhits later?
99 h_n_hits_->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.

References framework::Event::exists().

◆ 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 input_col_ = parameters.get<std::string>("inputCollection");
19 input_pass_name_ = parameters.get<std::string>("inputPassName");
20 // wide_input_col_ =
21 // parameters.get<std::string>("3hitInputCollection");
22 // wide_input_pass_name_ =
23 // parameters.get<std::string>("3hitInputPassName");
24
25 ldmx_log(trace) << "In configure(), got parameters "
26 << "\n\t inputCollection = " << input_col_
27 << "\n\t inputPassName = " << input_pass_name_;
28 // << "\n\t 3hitInputCollection = " << wide_input_col_
29 // << "\n\t 3hitInputPassName = " << wide_input_pass_name_
30
31 return;
32}
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78

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

◆ 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 161 of file TestBeamClusterAnalyzer.cxx.

161{ 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 ldmx_log(trace)
106 << "\n\n Process starts! My analyzer should do something -- like "
107 "print this";
108
110
111 int p_emax = 600;
112 int n_p_ebins = 0.25 * p_emax;
113 // float Qmax = PEmax / (6250. / 4.e6);
114 // float Qmin = -10;
115 // int nQbins = (Qmax - Qmin) / 4;
116
117 for (int i_b = 0; i_b < n_channels_; i_b++) {
118 h_pe_in_hits_[i_b] =
119 new TH1F(Form("hPE_chan%i", i_b), Form(";PE, chan%i", i_b), n_p_ebins,
120 0, p_emax);
121 h_pe_in_clusters_[i_b] =
122 new TH1F(Form("h_pe_in_clusters_chan%i", i_b), Form(";PE, chan%i", i_b),
123 n_p_ebins, 0, p_emax);
124 }
125
126 h_delta_vs_seed_ = new TH2F(
127 "h_delta_vs_speed", ";bar_id_{seed};#delta_{centroid}", n_channels_ + 1,
128 -0.5, n_channels_ - 0.5, 5 * n_channels_, 0, n_channels_);
129
130 h_delta_centroids_ = new TH1F("h_delta_centroids", ";#delta_{centroid}",
131 5 * n_channels_, -0.5, n_channels_ - 0.5);
132
133 h_n_hits_ = new TH1F(
134 "hNHits", "Number of hits in the event; n_{hits}; Events", 10, 0, 10);
135 h_n_clusters_ = new TH1F(
136 "h_n_clusters", "Number of clusters in the event; n_{clusters}; Events",
137 10, 0, 10);
138
139 /*
140 hN3N2 = new TH1F("hN3N2", "Ratio of 3-hit to 2-hit clusters;
141 n_{3-hit}/n_{2-hit}; Events", 10, 0, 4); hN3N1 = new TH1F("hN3N1", "Ratio of
142 3-hit to 1-hit clusters; n_{3-hit}/n_{1-hit}; Events", 10, 0, 4); hN2N1 = new
143 TH1F("hN2N1", "Ratio of 2-hit to 1-hit clusters; n_{2-hit}/n_{1-hit}; Events",
144 10, 0, 4);
145 */
146 int n_cl = 6;
147
148 h_n3_n2_ = new TH2F(
149 "hN3N2", "Number of 3-hit vs 2-hit clusters; n_{2-hit};n_{3-hit}; Events",
150 n_cl, -0.5, n_cl - 0.5, n_cl, -0.5, n_cl - 0.5);
151 h_n3_n1_ = new TH2F(
152 "hN3N1", "Number of 3-hit vs 1-hit clusters; n_{1-hit};n_{3-hit}; Events",
153 n_cl, -0.5, n_cl - 0.5, n_cl, -0.5, n_cl - 0.5);
154 h_n2_n1_ = new TH2F(
155 "hN2N1", "Number of 2-hit vs 1-hit clusters; n_{1-hit};n_{2-hit}; Events",
156 n_cl, -0.5, n_cl - 0.5, n_cl, -0.5, n_cl - 0.5);
157
158 return;
159}
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...

Member Data Documentation

◆ h_delta_centroids_

TH1F* trigscint::TestBeamClusterAnalyzer::h_delta_centroids_
private

Definition at line 55 of file TestBeamClusterAnalyzer.h.

◆ h_delta_vs_seed_

TH2F* trigscint::TestBeamClusterAnalyzer::h_delta_vs_seed_
private

Definition at line 56 of file TestBeamClusterAnalyzer.h.

◆ h_n2_n1_

TH2F* trigscint::TestBeamClusterAnalyzer::h_n2_n1_
private

Definition at line 49 of file TestBeamClusterAnalyzer.h.

◆ h_n3_n1_

TH2F* trigscint::TestBeamClusterAnalyzer::h_n3_n1_
private

Definition at line 48 of file TestBeamClusterAnalyzer.h.

◆ h_n3_n2_

TH2F* trigscint::TestBeamClusterAnalyzer::h_n3_n2_
private

Definition at line 47 of file TestBeamClusterAnalyzer.h.

◆ h_n_clusters_

TH1F* trigscint::TestBeamClusterAnalyzer::h_n_clusters_
private

Definition at line 50 of file TestBeamClusterAnalyzer.h.

◆ h_n_hits_

TH1F* trigscint::TestBeamClusterAnalyzer::h_n_hits_
private

Definition at line 51 of file TestBeamClusterAnalyzer.h.

◆ h_pe_in_clusters_

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

Definition at line 54 of file TestBeamClusterAnalyzer.h.

◆ h_pe_in_hits_

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

Definition at line 53 of file TestBeamClusterAnalyzer.h.

◆ input_col_

std::string trigscint::TestBeamClusterAnalyzer::input_col_
private

Definition at line 39 of file TestBeamClusterAnalyzer.h.

◆ input_pass_name_

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

Definition at line 40 of file TestBeamClusterAnalyzer.h.

40{""};

◆ n_channels_

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

Definition at line 45 of file TestBeamClusterAnalyzer.h.

45{16};

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