LDMX Software
trigscint::TestBeamHitAnalyzer Class Reference

Public Member Functions

 TestBeamHitAnalyzer (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::vector< std::vector< TH1F * > > v_charge_vs_time_
 
std::string input_col_
 
std::string input_pass_name_ {""}
 
std::vector< double > peds_
 
int start_sample_ {0}
 
int n_ev_ {200}
 
int n_channels_ {16}
 
TH2F * h_ev_disp_
 
TH2F * h_ev_disp_pe_
 
int fill_nb_ {0}
 
TH1F * h_out_ [200][16]
 
TH1F * h_pe_ [16]
 
TH1F * h_pe_in_clusters_ [16]
 
TH2F * h_pe_vs_delta_ [16]
 
TH2F * h_delta_pe_vs_delta_ [16]
 
TH2F * h_pe_max_vs_delta_
 
TH2F * h_cross_talk_ [16][16]
 

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
 
NtupleManager & ntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 The logger for this EventProcessor.
 

Detailed Description

Definition at line 22 of file TestBeamHitAnalyzer.h.

Constructor & Destructor Documentation

◆ TestBeamHitAnalyzer()

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

Definition at line 14 of file TestBeamHitAnalyzer.cxx.

16 : 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::TestBeamHitAnalyzer::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 33 of file TestBeamHitAnalyzer.cxx.

33 {
34 const auto channels{event.getCollection<trigscint::TestBeamHit>(
35 input_col_, input_pass_name_)};
36
37 int ev_nb = event.getEventNumber();
38 // int nChan = channels.size();
39 int lead_bar = -1;
40 int sublead_bar = -1;
41 float pe_lead = -1;
42 float pe_sublead = -1;
43 bool exists_intermediate_pe = false;
44
45 for (auto chan : channels) {
46 int bar = chan.getBarID();
47 float pe = chan.getPE();
48 if (ev_nb < n_ev_ && bar < n_channels_) {
49 // stick within the predefined histogram array
50 h_ev_disp_->Fill(ev_nb, bar, pe);
51 } // if within event display range
52 if (pe > pe_lead) {
53 pe_sublead = pe_lead;
54 sublead_bar = lead_bar;
55 pe_lead = pe;
56 lead_bar = bar;
57 } else if (pe >
58 pe_sublead) { // need a specific check, bars not sorted in
59 // PE so leadPE might be found before or after
60 pe_sublead = pe;
61 sublead_bar = bar;
62 }
63 h_pe_[bar]->Fill(pe);
64 if (chan.getQualityFlag() == 0 && bar < 12 && 15 < pe && pe < 40)
65 exists_intermediate_pe = true;
66
67 // cross talk/correlations
68 for (auto chan_probe : channels) {
69 int bar_probe = chan_probe.getBarID();
70 if (bar_probe >= bar) // we don't define the lower diagonal of the matrix
71 // of histograms
72 h_cross_talk_[bar][bar_probe]->Fill(pe, chan_probe.getPE());
73 }
74
75 } // over channels
76
77 if (exists_intermediate_pe && fill_nb_ < n_ev_) {
78 for (auto chan : channels) {
79 int bar = chan.getBarID();
80 if (bar < 12) { // stick within the predefined histogram array
81 float pe = chan.getPE();
82 h_ev_disp_pe_->Fill(fill_nb_, bar, pe);
83 }
84 } // if within event display range
85 fill_nb_++;
86 } // if PE range triggers writing these event displays
87
88 if (sublead_bar == -1) {
89 sublead_bar = lead_bar;
90 pe_sublead = pe_lead;
91 }
92 h_pe_vs_delta_[lead_bar]->Fill(lead_bar - sublead_bar, pe_lead);
93 h_delta_pe_vs_delta_[lead_bar]->Fill(lead_bar - sublead_bar,
94 pe_lead - pe_sublead);
95
96 // if ( (subleadBar%2) == (leadBar%2) ) // in same layer (or even, hit).
97 // skip if we're not seeing a max across layers
98 // return; -- on the other hand this is evident from the plot: delta is even
99
100 h_pe_max_vs_delta_->Fill(lead_bar - sublead_bar, pe_lead);
101
102 return;
103}
This class represents the linearised QIE output from the trigger scintillator, in charge (fC).
Definition TestBeamHit.h:24

◆ configure()

void trigscint::TestBeamHitAnalyzer::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 class_name equal to the EventProcessor class name.

For an example, look at MyProcessor.

Parameters
parametersParameters for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 18 of file TestBeamHitAnalyzer.cxx.

18 {
19 input_col_ = parameters.get<std::string>("input_collection");
20 input_pass_name_ = parameters.get<std::string>("input_pass_name");
21 peds_ = parameters.get<std::vector<double> >("pedestals");
22 start_sample_ = parameters.get<int>("start_sample");
23
24 std::cout << " [ TestBeamHitAnalyzer ] In configure(), got parameters "
25 << "\n\t inputCollection = " << input_col_
26 << "\n\t inputPassName = " << input_pass_name_
27 << "\n\t startSample = " << start_sample_
28 << "\n\t pedestals[0] = " << peds_[0] << "\t." << std::endl;
29
30 return;
31}
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:75

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

◆ onProcessEnd()

void trigscint::TestBeamHitAnalyzer::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 172 of file TestBeamHitAnalyzer.cxx.

172{ return; }

◆ onProcessStart()

void trigscint::TestBeamHitAnalyzer::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 105 of file TestBeamHitAnalyzer.cxx.

105 {
106 std::cout << "\n\n Process starts! My analyzer should do something -- like "
107 "print this \n\n"
108 << std::endl;
109
111
112 int n_time_samp = 7;
113 int p_emax = 400;
114 int n_p_ebins = 2 * p_emax;
115 // float Qmax = PEmax / (6250. / 4.e6);
116 // float Qmin = -10;
117 // int nQbins = (Qmax - Qmin) / 4;
118
119 for (int i_b = 0; i_b < n_channels_; i_b++) {
120 h_pe_[i_b] = new TH1F(Form("h_pe_chan%i", i_b), Form(";PE, chan%i", i_b),
121 n_p_ebins, 0, p_emax);
122 h_pe_in_clusters_[i_b] =
123 new TH1F(Form("h_pe_in_clusters_chan%i", i_b), Form(";PE, chan%i", i_b),
124 n_p_ebins, 0, p_emax);
125 h_pe_vs_delta_[i_b] = new TH2F(
126 Form("h_pe_vs_delta_chan%i", i_b),
127 Form(";#delta_{barID};PE, chan%i has max PE", i_b), n_channels_ + 1,
128 -n_channels_ / 2 - 0.5, n_channels_ / 2 + 0.5, n_p_ebins, 0, p_emax);
129 h_delta_pe_vs_delta_[i_b] =
130 new TH2F(Form("h_delta_pe_vs_delta_chan%i", i_b),
131 Form(";#delta_{barID};#Delta_PE, chan%i has max PE", i_b),
132 n_channels_ + 1, -n_channels_ / 2 - 0.5, n_channels_ / 2 + 0.5,
133 n_p_ebins, 0, p_emax);
134 }
135
136 // make event displays for events where there are channels with weird event
137 // hit PE counts
138 for (int i_e = 0; i_e < n_ev_; i_e++) {
139 for (int i_b = 0; i_b < n_channels_; i_b++) {
140 h_out_[i_e][i_b] =
141 new TH1F(Form("hCharge_chan%i_ev%i", i_b, i_e),
142 Form(";time sample; Q, chan %i, ev %i [fC]", i_b, i_e),
143 n_time_samp, -0.5, n_time_samp - 0.5);
144 }
145 }
146
147 h_pe_max_vs_delta_ =
148 new TH2F("h_pe_max_vs_delta_", ";#delta_{barID};PE, max hit", n_channels_,
149 -n_channels_ / 2, n_channels_ / 2, n_p_ebins, 0, p_emax);
150 h_ev_disp_ =
151 new TH2F(Form("h_ev_disp_ev%i", n_ev_), ";Event number; Bar ID; PE",
152 n_ev_, 0.5, n_ev_ + 0.5, n_channels_, -0.5, n_channels_ - 0.5);
153 h_ev_disp_pe_ =
154 new TH2F("h_ev_disp_pe_cut", ";Event number; Bar ID; PE", n_ev_, 0.5,
155 n_ev_ + 0.5, n_channels_, -0.5, n_channels_ - 0.5);
156
157 fill_nb_ = 0;
158
159 for (int i_btag = 0; i_btag < n_channels_; i_btag++) {
160 for (int i_bprobe = i_btag; i_bprobe < n_channels_; i_bprobe++) {
161 // use one side of diagonal
162 h_cross_talk_[i_btag][i_bprobe] =
163 new TH2F(Form("h_pe_chan%i_vs_chan%i", i_bprobe, i_btag),
164 Form(";PE, channel %i; PE, channel %i", i_bprobe, i_btag),
165 n_p_ebins, 0, p_emax, n_p_ebins, 0, p_emax);
166 }
167 }
168
169 return;
170}
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...

Member Data Documentation

◆ fill_nb_

int trigscint::TestBeamHitAnalyzer::fill_nb_ {0}
private

Definition at line 52 of file TestBeamHitAnalyzer.h.

52{0};

◆ h_cross_talk_

TH2F* trigscint::TestBeamHitAnalyzer::h_cross_talk_[16][16]
private

Definition at line 62 of file TestBeamHitAnalyzer.h.

◆ h_delta_pe_vs_delta_

TH2F* trigscint::TestBeamHitAnalyzer::h_delta_pe_vs_delta_[16]
private

Definition at line 60 of file TestBeamHitAnalyzer.h.

◆ h_ev_disp_

TH2F* trigscint::TestBeamHitAnalyzer::h_ev_disp_
private

Definition at line 49 of file TestBeamHitAnalyzer.h.

◆ h_ev_disp_pe_

TH2F* trigscint::TestBeamHitAnalyzer::h_ev_disp_pe_
private

Definition at line 50 of file TestBeamHitAnalyzer.h.

◆ h_out_

TH1F* trigscint::TestBeamHitAnalyzer::h_out_[200][16]
private

Definition at line 55 of file TestBeamHitAnalyzer.h.

◆ h_pe_

TH1F* trigscint::TestBeamHitAnalyzer::h_pe_[16]
private

Definition at line 57 of file TestBeamHitAnalyzer.h.

◆ h_pe_in_clusters_

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

Definition at line 58 of file TestBeamHitAnalyzer.h.

◆ h_pe_max_vs_delta_

TH2F* trigscint::TestBeamHitAnalyzer::h_pe_max_vs_delta_
private

Definition at line 61 of file TestBeamHitAnalyzer.h.

◆ h_pe_vs_delta_

TH2F* trigscint::TestBeamHitAnalyzer::h_pe_vs_delta_[16]
private

Definition at line 59 of file TestBeamHitAnalyzer.h.

◆ input_col_

std::string trigscint::TestBeamHitAnalyzer::input_col_
private

Definition at line 40 of file TestBeamHitAnalyzer.h.

◆ input_pass_name_

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

Definition at line 41 of file TestBeamHitAnalyzer.h.

41{""};

◆ n_channels_

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

Definition at line 47 of file TestBeamHitAnalyzer.h.

47{16};

◆ n_ev_

int trigscint::TestBeamHitAnalyzer::n_ev_ {200}
private

Definition at line 46 of file TestBeamHitAnalyzer.h.

46{200};

◆ peds_

std::vector<double> trigscint::TestBeamHitAnalyzer::peds_
private

Definition at line 42 of file TestBeamHitAnalyzer.h.

◆ start_sample_

int trigscint::TestBeamHitAnalyzer::start_sample_ {0}
private

Definition at line 43 of file TestBeamHitAnalyzer.h.

43{0};

◆ v_charge_vs_time_

std::vector<std::vector<TH1F*> > trigscint::TestBeamHitAnalyzer::v_charge_vs_time_
private

Definition at line 37 of file TestBeamHitAnalyzer.h.


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