12TestBeamHitProducer::TestBeamHitProducer(
const std::string& name,
14 : Producer(name, process) {}
17 input_col_ = parameters.
get<std::string>(
"inputCollection");
18 output_collection_ = parameters.
get<std::string>(
"outputCollection");
19 input_pass_name_ = parameters.
get<std::string>(
"inputPassName");
20 mip_response_ = parameters.
get<std::vector<double> >(
"MIPresponse");
21 peds_ = parameters.
get<std::vector<double> >(
"pedestals");
22 gain_ = parameters.
get<std::vector<double> >(
"gain");
24 start_sample_ = parameters.
get<
int>(
"startSample");
25 pulse_width_ = parameters.
get<
int>(
"pulseWidth");
26 pulse_width_lyso_ = parameters.
get<
int>(
"pulseWidthLYSO");
27 n_instrumented_channels_ = parameters.
get<
int>(
"nInstrumentedChannels");
28 do_clean_hits_ = parameters.
get<
bool>(
"doCleanHits");
30 std::cout <<
" [ TestBeamHitProducer ] In configure(), got parameters "
31 <<
"\n\t inputCollection = " << input_col_
32 <<
"\n\t inputPassName = " << input_pass_name_
33 <<
"\n\t outputCollection = " << output_collection_
34 <<
"\n\t startSample = " << start_sample_
35 <<
"\n\t pulseWidth = " << pulse_width_
36 <<
"\n\t pulseWidthLYSO = " << pulse_width_lyso_
37 <<
"\n\t gain[0] = " << gain_[0]
38 <<
"\n\t nInstrumentedChannels = " << n_instrumented_channels_
39 <<
"\n\t doCleanHits = " << do_clean_hits_
40 <<
"\n\t pedestals[0] = " << peds_[0]
41 <<
"\n\t MIPresponse[0] = " << mip_response_[0] <<
"\t."
89 float mev_per_mip = 0.3;
90 float pe_per_mip = 100;
93 input_col_, input_pass_name_)};
95 int ev_nb =
event.getEventNumber();
96 std::vector<trigscint::TestBeamHit> hits;
97 for (
auto chan : channels) {
99 int bar = chan.getChanID();
101 if (bar >= n_instrumented_channels_)
continue;
102 int width = pulse_width_;
104 width = pulse_width_lyso_;
108 float ped = peds_.at(bar);
109 float early_ped = chan.getEarlyPedestal();
113 float threshold = fabs(ped);
114 if (do_clean_hits_) threshold = 7 * fabs(ped);
116 int start_t = start_sample_ + chan.getTimeOffset();
118 int n_samp_above_ped = 0;
119 int n_samp_above_thr = 0;
120 float tot_subtr_q = 0;
121 std::vector<float> q = chan.getQ();
123 for (
int i_t = start_t; i_t < q.size(); i_t++) {
124 ldmx_log(debug) <<
"in event " << ev_nb <<
"; channel " << bar
125 <<
", got charge[" << i_t <<
"] = " << q.at(i_t);
128 float sub_q = q.at(i_t) -
133 if (sub_q > 0) n_samp_above_ped++;
134 if (sub_q > threshold) n_samp_above_thr++;
135 if (i_t - start_t < width) {
141 }
else if (sub_q < 0 ||
150 uint flag = chan.getQualityFlag();
151 if (do_clean_hits_) {
158 flag += 4 * is_long_pulse;
159 if (max_q > 2e5 && n_samp_above_thr < 3 &&
163 if (flag == 0) is_clean = 1;
166 float pe = tot_subtr_q * 6250. / gain_[bar];
168 pe *= mip_response_[bar];
173 hit.
setQ(tot_subtr_q);
192 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 builds recHits.
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.