12TestBeamHitProducer::TestBeamHitProducer(
const std::string& name,
14 : Producer(name, process) {}
17 inputCol_ = parameters.
getParameter<std::string>(
"inputCollection");
18 outputCollection_ = parameters.
getParameter<std::string>(
"outputCollection");
19 inputPassName_ = parameters.
getParameter<std::string>(
"inputPassName");
20 MIPresponse_ = parameters.
getParameter<std::vector<double> >(
"MIPresponse");
21 peds_ = parameters.
getParameter<std::vector<double> >(
"pedestals");
24 startSample_ = parameters.
getParameter<
int>(
"startSample");
25 pulseWidth_ = parameters.
getParameter<
int>(
"pulseWidth");
26 pulseWidthLYSO_ = parameters.
getParameter<
int>(
"pulseWidthLYSO");
27 nInstrumentedChannels_ =
29 doCleanHits_ = parameters.
getParameter<
bool>(
"doCleanHits");
31 std::cout <<
" [ TestBeamHitProducer ] In configure(), got parameters "
32 <<
"\n\t inputCollection = " << inputCol_
33 <<
"\n\t inputPassName = " << inputPassName_
34 <<
"\n\t outputCollection = " << outputCollection_
35 <<
"\n\t startSample = " << startSample_
36 <<
"\n\t pulseWidth = " << pulseWidth_
37 <<
"\n\t pulseWidthLYSO = " << pulseWidthLYSO_
38 <<
"\n\t gain[0] = " << gain_[0]
39 <<
"\n\t nInstrumentedChannels = " << nInstrumentedChannels_
40 <<
"\n\t doCleanHits = " << doCleanHits_
41 <<
"\n\t pedestals[0] = " << peds_[0]
42 <<
"\n\t MIPresponse[0] = " << MIPresponse_[0] <<
"\t."
90 float mevPerMip = 0.3;
96 int evNb =
event.getEventNumber();
97 std::vector<trigscint::TestBeamHit> hits;
98 for (
auto chan : channels) {
100 int bar = chan.getChanID();
102 nInstrumentedChannels_)
104 int width = pulseWidth_;
106 width = pulseWidthLYSO_;
110 float ped = peds_.at(bar);
111 float earlyPed = chan.getEarlyPedestal();
115 float threshold = fabs(ped);
116 if (doCleanHits_) threshold = 7 * fabs(ped);
118 int startT = startSample_ + chan.getTimeOffset();
120 int nSampAbovePed = 0;
121 int nSampAboveThr = 0;
123 std::vector<float> q = chan.getQ();
125 for (
int iT = startT; iT < q.size(); iT++) {
126 ldmx_log(debug) <<
"in event " << evNb <<
"; channel " << bar
127 <<
", got charge[" << iT <<
"] = " << q.at(iT);
135 if (subQ > 0) nSampAbovePed++;
136 if (subQ > threshold) nSampAboveThr++;
137 if (iT - startT < width) {
143 }
else if (subQ < 0 ||
152 uint flag = chan.getQualityFlag();
160 flag += 4 * isLongPulse;
161 if (maxQ > 2e5 && nSampAboveThr < 3 &&
165 if (flag == 0) isClean = 1;
168 float PE = totSubtrQ * 6250. / gain_[bar];
170 PE *= MIPresponse_[bar];
194 event.add(outputCollection_, hits);
#define DECLARE_PRODUCER_NS(NS, 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.
T getParameter(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).
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.