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

Detailed Description

Definition at line 23 of file TestBeamHitAnalyzer.h.

Constructor & Destructor Documentation

◆ TestBeamHitAnalyzer()

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

Definition at line 12 of file TestBeamHitAnalyzer.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::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 31 of file TestBeamHitAnalyzer.cxx.

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

16 {
17 input_col_ = parameters.get<std::string>("inputCollection");
18 input_pass_name_ = parameters.get<std::string>("inputPassName");
19 peds_ = parameters.get<std::vector<double> >("pedestals");
20 start_sample_ = parameters.get<int>("startSample");
21
22 std::cout << " [ TestBeamHitAnalyzer ] In configure(), got parameters "
23 << "\n\t inputCollection = " << input_col_
24 << "\n\t inputPassName = " << input_pass_name_
25 << "\n\t startSample = " << start_sample_
26 << "\n\t pedestals[0] = " << peds_[0] << "\t." << std::endl;
27
28 return;
29}
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::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 170 of file TestBeamHitAnalyzer.cxx.

170{ 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 103 of file TestBeamHitAnalyzer.cxx.

103 {
104 std::cout << "\n\n Process starts! My analyzer should do something -- like "
105 "print this \n\n"
106 << std::endl;
107
109
110 int n_time_samp = 7;
111 int p_emax = 400;
112 int n_p_ebins = 2 * 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_[i_b] = new TH1F(Form("h_pe_chan%i", i_b), Form(";PE, chan%i", i_b),
119 n_p_ebins, 0, p_emax);
120 h_pe_in_clusters_[i_b] =
121 new TH1F(Form("h_pe_in_clusters_chan%i", i_b), Form(";PE, chan%i", i_b),
122 n_p_ebins, 0, p_emax);
123 h_pe_vs_delta_[i_b] = new TH2F(
124 Form("h_pe_vs_delta_chan%i", i_b),
125 Form(";#delta_{barID};PE, chan%i has max PE", i_b), n_channels_ + 1,
126 -n_channels_ / 2 - 0.5, n_channels_ / 2 + 0.5, n_p_ebins, 0, p_emax);
127 h_delta_pe_vs_delta_[i_b] =
128 new TH2F(Form("h_delta_pe_vs_delta_chan%i", i_b),
129 Form(";#delta_{barID};#Delta_PE, chan%i has max PE", i_b),
130 n_channels_ + 1, -n_channels_ / 2 - 0.5, n_channels_ / 2 + 0.5,
131 n_p_ebins, 0, p_emax);
132 }
133
134 // make event displays for events where there are channels with weird event
135 // hit PE counts
136 for (int i_e = 0; i_e < n_ev_; i_e++) {
137 for (int i_b = 0; i_b < n_channels_; i_b++) {
138 h_out_[i_e][i_b] =
139 new TH1F(Form("hCharge_chan%i_ev%i", i_b, i_e),
140 Form(";time sample; Q, chan %i, ev %i [fC]", i_b, i_e),
141 n_time_samp, -0.5, n_time_samp - 0.5);
142 }
143 }
144
145 h_pe_max_vs_delta_ =
146 new TH2F("h_pe_max_vs_delta_", ";#delta_{barID};PE, max hit", n_channels_,
147 -n_channels_ / 2, n_channels_ / 2, n_p_ebins, 0, p_emax);
148 h_ev_disp_ =
149 new TH2F(Form("h_ev_disp_ev%i", n_ev_), ";Event number; Bar ID; PE",
150 n_ev_, 0.5, n_ev_ + 0.5, n_channels_, -0.5, n_channels_ - 0.5);
151 h_ev_disp_pe_ =
152 new TH2F("h_ev_disp_pe_cut", ";Event number; Bar ID; PE", n_ev_, 0.5,
153 n_ev_ + 0.5, n_channels_, -0.5, n_channels_ - 0.5);
154
155 fill_nb_ = 0;
156
157 for (int i_btag = 0; i_btag < n_channels_; i_btag++) {
158 for (int i_bprobe = i_btag; i_bprobe < n_channels_; i_bprobe++) {
159 // use one side of diagonal
160 h_cross_talk_[i_btag][i_bprobe] =
161 new TH2F(Form("h_pe_chan%i_vs_chan%i", i_bprobe, i_btag),
162 Form(";PE, channel %i; PE, channel %i", i_bprobe, i_btag),
163 n_p_ebins, 0, p_emax, n_p_ebins, 0, p_emax);
164 }
165 }
166
167 return;
168}
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 53 of file TestBeamHitAnalyzer.h.

53{0};

◆ h_cross_talk_

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

Definition at line 63 of file TestBeamHitAnalyzer.h.

◆ h_delta_pe_vs_delta_

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

Definition at line 61 of file TestBeamHitAnalyzer.h.

◆ h_ev_disp_

TH2F* trigscint::TestBeamHitAnalyzer::h_ev_disp_
private

Definition at line 50 of file TestBeamHitAnalyzer.h.

◆ h_ev_disp_pe_

TH2F* trigscint::TestBeamHitAnalyzer::h_ev_disp_pe_
private

Definition at line 51 of file TestBeamHitAnalyzer.h.

◆ h_out_

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

Definition at line 56 of file TestBeamHitAnalyzer.h.

◆ h_pe_

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

Definition at line 58 of file TestBeamHitAnalyzer.h.

◆ h_pe_in_clusters_

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

Definition at line 59 of file TestBeamHitAnalyzer.h.

◆ h_pe_max_vs_delta_

TH2F* trigscint::TestBeamHitAnalyzer::h_pe_max_vs_delta_
private

Definition at line 62 of file TestBeamHitAnalyzer.h.

◆ h_pe_vs_delta_

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

Definition at line 60 of file TestBeamHitAnalyzer.h.

◆ input_col_

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

Definition at line 41 of file TestBeamHitAnalyzer.h.

◆ input_pass_name_

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

Definition at line 42 of file TestBeamHitAnalyzer.h.

42{""};

◆ n_channels_

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

Definition at line 48 of file TestBeamHitAnalyzer.h.

48{16};

◆ n_ev_

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

Definition at line 47 of file TestBeamHitAnalyzer.h.

47{200};

◆ peds_

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

Definition at line 43 of file TestBeamHitAnalyzer.h.

◆ start_sample_

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

Definition at line 44 of file TestBeamHitAnalyzer.h.

44{0};

◆ v_charge_vs_time_

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

Definition at line 38 of file TestBeamHitAnalyzer.h.


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