17TestBeamHitProducer::TestBeamHitProducer(
const std::string& name,
19 : Producer(name, process) {}
22 input_col_ = parameters.
get<std::string>(
"input_collection");
23 output_collection_ = parameters.
get<std::string>(
"output_collection");
24 input_pass_name_ = parameters.
get<std::string>(
"input_pass_name");
25 mip_response_ = parameters.
get<std::vector<double> >(
"MIPresponse");
26 peds_ = parameters.
get<std::vector<double> >(
"pedestals");
27 gain_ = parameters.
get<std::vector<double> >(
"gain");
29 start_sample_ = parameters.
get<
int>(
"start_sample");
30 pulse_width_ = parameters.
get<
int>(
"pulse_width");
31 pulse_width_lyso_ = parameters.
get<
int>(
"pulse_width_lyso");
32 n_instrumented_channels_ = parameters.
get<
int>(
"n_instrumented_channels");
33 do_clean_hits_ = parameters.
get<
bool>(
"do_clean_hits");
35 std::cout <<
" [ TestBeamHitProducer ] In configure(), got parameters "
36 <<
"\n\t inputCollection = " << input_col_
37 <<
"\n\t inputPassName = " << input_pass_name_
38 <<
"\n\t outputCollection = " << output_collection_
39 <<
"\n\t startSample = " << start_sample_
40 <<
"\n\t pulseWidth = " << pulse_width_
41 <<
"\n\t pulseWidthLYSO = " << pulse_width_lyso_
42 <<
"\n\t gain[0] = " << gain_[0]
43 <<
"\n\t nInstrumentedChannels = " << n_instrumented_channels_
44 <<
"\n\t doCleanHits = " << do_clean_hits_
45 <<
"\n\t pedestals[0] = " << peds_[0]
46 <<
"\n\t MIPresponse[0] = " << mip_response_[0] <<
"\t."
94 float mev_per_mip = 0.3;
95 float pe_per_mip = 100;
98 input_col_, input_pass_name_)};
100 int ev_nb =
event.getEventNumber();
101 std::vector<trigscint::TestBeamHit> hits;
102 for (
auto chan : channels) {
104 int bar = chan.getChanID();
106 if (bar >= n_instrumented_channels_)
continue;
107 int width = pulse_width_;
109 width = pulse_width_lyso_;
113 float ped = peds_.at(bar);
114 float early_ped = chan.getEarlyPedestal();
118 float threshold = fabs(ped);
119 if (do_clean_hits_) threshold = 7 * fabs(ped);
121 int start_t = start_sample_ + chan.getTimeOffset();
123 int n_samp_above_ped = 0;
124 int n_samp_above_thr = 0;
125 float tot_subtr_q = 0;
126 std::vector<float> q = chan.getQ();
128 for (
int i_t = start_t; i_t < q.size(); i_t++) {
129 ldmx_log(debug) <<
"in event " << ev_nb <<
"; channel " << bar
130 <<
", got charge[" << i_t <<
"] = " << q.at(i_t);
133 float sub_q = q.at(i_t) -
138 if (sub_q > 0) n_samp_above_ped++;
139 if (sub_q > threshold) n_samp_above_thr++;
140 if (i_t - start_t < width) {
146 }
else if (sub_q < 0 ||
155 uint flag = chan.getQualityFlag();
156 if (do_clean_hits_) {
163 flag += 4 * is_long_pulse;
164 if (max_q > 2e5 && n_samp_above_thr < 3 &&
168 if (flag == 0) is_clean = 1;
171 float pe = tot_subtr_q * 6250. / gain_[bar];
173 pe *= mip_response_[bar];
178 hit.
setQ(tot_subtr_q);
197 event.add(output_collection_, hits);
#define DECLARE_PRODUCER(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Class that stores full reconstructed (linearized) readout QIE sample from the TS.
Class that builds recHits.
Class that stores full reconstructed (linearized) readout QIE sample from the TS.
Implements an event buffer system for storing event data.
Class which represents the process under execution.
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
void setTime(float time)
Set the time of the hit [ns].
void setAmplitude(float amplitude)
Set the amplitude of the hit, which is proportional to the signal in the calorimeter cell without sam...
void setEnergy(float energy)
Set the calorimetric energy of the hit, corrected for sampling factors [MeV].
void setPE(const float PE)
Set hit pe.
void setBarID(const int barID)
Set hit bar ID.
void setBeamEfrac(const float beamEfrac)
Set beam energy fraction of hit.
float getPE() const
Get the hit pe.
void setModuleID(const int moduleID)
Set hit module ID.
This class represents the linearised QIE output from the trigger scintillator, in charge (fC).
Organizes digis into TrigScintHits, based on linearized full event readout from test beam/test stand.
This class represents the linearised QIE output from the trigger scintillator, in charge (fC).
void setQualityFlag(const uint flag)
Set hit data quality flag.
void setHitQuality(const int isClean)
Set whether hit has been checked for and passed quality criteria.
void setSampAbovePed(const int sampAbovePed)
Set number of samples above pedestal in pulse/hit.
void setQ(const float q)
Store total charge.
void setSampAboveThr(const int sampAboveThr)
Set number of samples above threshold in pulse/hit.
void setPulseWidth(const int pulseWidth)
Set width used to integrate pulse/hit (in time samples)
void setPedestal(const float pedestal)
Set channel (linearized.
void setEarlyPedestal(const float earlyPed)
Set channel (linearized.
void setStartSample(const int startSample)
Store total charge.