LDMX Software
Public Member Functions | Private Attributes | List of all members
trigscint::TestBeamHitProducer Class Reference

Organizes digis into TrigScintHits, based on linearized full event readout from test beam/test stand. More...

#include <TestBeamHitProducer.h>

Public Member Functions

 TestBeamHitProducer (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &parameters) override
 Callback for the processor to configure itself from the given set of parameters.
 
void produce (framework::Event &event) override
 Process the event and put new data products into it.
 
- Public Member Functions inherited from framework::Producer
 Producer (const std::string &name, Process &process)
 Class constructor.
 
virtual void beforeNewRun (ldmx::RunHeader &header)
 Handle allowing producers to modify run headers before the run begins.
 
- Public Member Functions inherited from framework::EventProcessor
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &runHeader)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
virtual void onProcessStart ()
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
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::string inputCol_
 Set the local verbosity level.
 
std::string inputPassName_
 Name of the pass that the input collection is on (empty string means take any pass)
 
std::string outputCollection_
 Name of the output collection that will be used to stored the trigger scintillator hits.
 
std::vector< double > gain_
 SiPM gain, per channel (all initialized to 2e6 in default config)
 
std::vector< double > peds_
 channel pedestals [fC]
 
std::vector< double > MIPresponse_
 channel MIP response for intercalibration
 
int startSample_ {10}
 start sample for pulse integration (not including any fiber offsets)
 
int pulseWidth_ {5}
 Total number of samples used in pulse integration.
 
int pulseWidthLYSO_ {8}
 Total number of samples used in pulse integration for LYSO (long decay, might need wider window)
 
int nInstrumentedChannels_ {12}
 Number of instrumented channels in module.
 
bool doCleanHits_ {false}
 boolean indicating whether we want to apply quality criteria in hit reconstruction
 

Additional Inherited Members

- Static Public Member Functions inherited from framework::EventProcessor
static void declare (const std::string &classname, int classtype, EventProcessorMaker *)
 Internal function which is part of the PluginFactory machinery.
 
- Static Public Attributes inherited from framework::Producer
static const int CLASSTYPE {1}
 Constant used to track EventProcessor types by the PluginFactory.
 
- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramHelper histograms_
 Interface class for making and filling histograms.
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger theLog_
 The logger for this EventProcessor.
 

Detailed Description

Organizes digis into TrigScintHits, based on linearized full event readout from test beam/test stand.

Definition at line 31 of file TestBeamHitProducer.h.

Constructor & Destructor Documentation

◆ TestBeamHitProducer()

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

Definition at line 12 of file TestBeamHitProducer.cxx.

14 : Producer(name, process) {}
Producer(const std::string &name, Process &process)
Class constructor.

Member Function Documentation

◆ configure()

void trigscint::TestBeamHitProducer::configure ( framework::config::Parameters parameters)
overridevirtual

Callback for the processor to configure itself from the given set of parameters.

Parameters
parametersParameterSet for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 16 of file TestBeamHitProducer.cxx.

16 {
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");
22 gain_ =
23 parameters.getParameter<std::vector<double> >("gain"); // to do: vector
24 startSample_ = parameters.getParameter<int>("startSample");
25 pulseWidth_ = parameters.getParameter<int>("pulseWidth");
26 pulseWidthLYSO_ = parameters.getParameter<int>("pulseWidthLYSO");
28 parameters.getParameter<int>("nInstrumentedChannels");
29 doCleanHits_ = parameters.getParameter<bool>("doCleanHits");
30
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."
43 << std::endl;
44
45 return;
46}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
std::vector< double > MIPresponse_
channel MIP response for intercalibration
std::string outputCollection_
Name of the output collection that will be used to stored the trigger scintillator hits.
int startSample_
start sample for pulse integration (not including any fiber offsets)
int nInstrumentedChannels_
Number of instrumented channels in module.
int pulseWidth_
Total number of samples used in pulse integration.
int pulseWidthLYSO_
Total number of samples used in pulse integration for LYSO (long decay, might need wider window)
std::vector< double > gain_
SiPM gain, per channel (all initialized to 2e6 in default config)
bool doCleanHits_
boolean indicating whether we want to apply quality criteria in hit reconstruction
std::string inputCol_
Set the local verbosity level.
std::string inputPassName_
Name of the pass that the input collection is on (empty string means take any pass)
std::vector< double > peds_
channel pedestals [fC]

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

◆ produce()

void trigscint::TestBeamHitProducer::produce ( framework::Event event)
overridevirtual

Process the event and put new data products into it.

Parameters
eventThe Event to process.

Implements framework::Producer.

Definition at line 48 of file TestBeamHitProducer.cxx.

48 {
49 /*
50 hit producer.
51 sum up all charge within a certain time window. could work two ways:
52 - find a time sample above a threshold or where TDC is 0-50 (0-2)
53 * this could allow for finding several pulses per event, just
54 keep sliding along in time
55 -- in that case, record nPulses, startsample, pulsewidth
56 for each hit
57 - use a fixed start sample, and keep summing from there until
58 nSamples is reached or all time samples used
59
60 specifics:
61 - each channel has its own pedestal to subtract. also try using the
62 first 5 samples to establish a threshold in the event. store both
63 - store hit Q and hit PE conversion
64 - for now use the same reconstruction paradigm for LYSO and plastic.
65 two notes though
66 1. LYSO pulse looks wider, and might need wider window. plastic is
67 fine with 5. start by 8 for LYSO (even if for large pulses, sometimes 10
68 seem to be needed). could probe this by correlating plastic and LYSO, and
69 checking if at some amplitude (in plastic), we start cutting off charge in
70 LYSO
71 2. there is a time offset between fibers. need to have a
72 parameter fiber2offset to use for elecID >= 8
73 -- added this as a variable in EventReadout, along with fiber
74 number. so this class doesn't need any detailed knowledge
75
76 variables to write out:
77 - start sample
78 - pulse width
79 - n samples above threshold
80 - nPulses
81 - early pedestal (from first 5)
82 - assumed/average channel pedestal
83 - total Q
84 - ped subtracted total Q
85 - PE value
86 - max amplitude in pulse
87 - store material assumption? isLYSO?
88 */
89
90 float mevPerMip = 0.3;
91 float pePerMip = 100;
92
93 const auto channels{
94 event.getCollection<trigscint::EventReadout>(inputCol_, inputPassName_)};
95
96 int evNb = event.getEventNumber();
97 std::vector<trigscint::TestBeamHit> hits;
98 for (auto chan : channels) {
100 int bar = chan.getChanID();
101 if (bar >=
102 nInstrumentedChannels_) // don't run hit reconstruction on junk signal
103 continue;
104 int width = pulseWidth_;
105 if (bar % 2 == 0) { // LYSO channel: allow for wider pulses
106 width = pulseWidthLYSO_; // avoid hardwiring
107 }
108 hit.setPulseWidth(width);
110 float ped = peds_.at(bar); // chan.getPedestal() ;
111 float earlyPed = chan.getEarlyPedestal();
112 hit.setPedestal(ped);
113 hit.setEarlyPedestal(earlyPed);
114 int isClean = 0; // false;
115 float threshold = fabs(ped); // 2*fabs(peds_[ bar ]); // or sth
116 if (doCleanHits_) threshold = 7 * fabs(ped); // stricter cut
117
118 int startT = startSample_ + chan.getTimeOffset();
119 float maxQ = -999.;
120 int nSampAbovePed = 0;
121 int nSampAboveThr = 0;
122 float totSubtrQ = 0;
123 std::vector<float> q = chan.getQ();
124 // go to the start sample defined for this channel.
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);
128 // for the defined number of samples, subtract pedestal. if > 0, increment
129 // sample counter.
130 float subQ =
131 q.at(iT) - ped; // this might be addition, if ped is negative. should
132 // see this as channel dependence in nSampAbove
133 // once beyond nSamples, want to see how long positive threshold
134 // subtracted tail is --> increment sample counter in any case.
135 if (subQ > 0) nSampAbovePed++;
136 if (subQ > threshold) nSampAboveThr++;
137 if (iT - startT < width) { // we're in the pulse integration window
138 if (subQ > maxQ) // keep track of max Q. this is the pulse amplitude
139 maxQ = subQ; // q.at(iT);
140 if (subQ > 0)
141 totSubtrQ +=
142 subQ; // add positive subtracted Q to total pulse charge.
143 } else if (subQ < 0 ||
144 q.at(iT) < 0) // if after the full pulse width, subQ <
145 // pedestal, break. special case to break at q=0
146 // for cases where ped < 0
147 break;
148 // done
149 } // over time samples
150
151 // first check that hit passes any quality cuts
152 uint flag = chan.getQualityFlag();
153 if (doCleanHits_) {
154 // int isLongPulse=(nSampAboveThr < 2 || nSampAboveThr >
155 // width + 2);
156 int isLongPulse =
157 (nSampAboveThr >
158 width); // the short ones we'll have to single out otherwise (like
159 // spike flag or low Q) or live with
160 flag += 4 * isLongPulse;
161 if (maxQ > 2e5 && nSampAboveThr < 3 &&
162 flag % 2 == 0) // this was not flagged as a spike but is eerily
163 // narrow and with high Q; flag it as a spike.
164 flag += 1;
165 if (flag == 0) isClean = 1;
166 }
167
168 float PE = totSubtrQ * 6250. / gain_[bar];
169 if (PE > 20) // dont't want to intercalibrate the shot noise
170 PE *= MIPresponse_[bar];
171
172 // set pulse properties like PE and amplitude
173 hit.setSampAbovePed(nSampAbovePed);
174 hit.setSampAboveThr(nSampAboveThr);
175 hit.setQ(totSubtrQ);
176 hit.setAmplitude(maxQ);
177 hit.setPE(PE);
178 hit.setHitQuality(isClean);
179 hit.setQualityFlag(flag);
180 // set bar id. set moduleNB = 0
181 hit.setBarID(bar);
182 hit.setModuleID(0); // test beam
183 // the rest are a little ill-defined for now (PE-energy conversion not
184 // known/different between LYSO and plastic)
185 hit.setTime(-999); // maybe?
186 hit.setBeamEfrac(-1.);
187 hit.setEnergy(hit.getPE() * mevPerMip / pePerMip);
188
189 // add hit
190 hits.push_back(hit);
191 } // over channels
192
193 // at end of event, write the collection of trigger scintillator hits.
194 event.add(outputCollection_, hits);
195
196 return;
197}
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).
Definition TestBeamHit.h:24
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.
Definition TestBeamHit.h:73
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.
Definition TestBeamHit.h:51
void setEarlyPedestal(const float earlyPed)
Set channel (linearized.
Definition TestBeamHit.h:63
void setStartSample(const int startSample)
Store total charge.
Definition TestBeamHit.h:96

References ldmx::TrigScintHit::getPE(), ldmx::CalorimeterHit::setAmplitude(), ldmx::TrigScintHit::setBarID(), ldmx::TrigScintHit::setBeamEfrac(), trigscint::TestBeamHit::setEarlyPedestal(), ldmx::CalorimeterHit::setEnergy(), trigscint::TestBeamHit::setHitQuality(), ldmx::TrigScintHit::setModuleID(), ldmx::TrigScintHit::setPE(), trigscint::TestBeamHit::setPedestal(), trigscint::TestBeamHit::setPulseWidth(), trigscint::TestBeamHit::setQ(), trigscint::TestBeamHit::setQualityFlag(), trigscint::TestBeamHit::setSampAbovePed(), trigscint::TestBeamHit::setSampAboveThr(), trigscint::TestBeamHit::setStartSample(), and ldmx::CalorimeterHit::setTime().

Member Data Documentation

◆ doCleanHits_

bool trigscint::TestBeamHitProducer::doCleanHits_ {false}
private

boolean indicating whether we want to apply quality criteria in hit reconstruction

Definition at line 85 of file TestBeamHitProducer.h.

85{false};

◆ gain_

std::vector<double> trigscint::TestBeamHitProducer::gain_
private

SiPM gain, per channel (all initialized to 2e6 in default config)

Definition at line 62 of file TestBeamHitProducer.h.

◆ inputCol_

std::string trigscint::TestBeamHitProducer::inputCol_
private

Set the local verbosity level.

Name of the input collection containing the event readout samples

Definition at line 51 of file TestBeamHitProducer.h.

◆ inputPassName_

std::string trigscint::TestBeamHitProducer::inputPassName_
private

Name of the pass that the input collection is on (empty string means take any pass)

Definition at line 55 of file TestBeamHitProducer.h.

◆ MIPresponse_

std::vector<double> trigscint::TestBeamHitProducer::MIPresponse_
private

channel MIP response for intercalibration

Definition at line 68 of file TestBeamHitProducer.h.

◆ nInstrumentedChannels_

int trigscint::TestBeamHitProducer::nInstrumentedChannels_ {12}
private

Number of instrumented channels in module.

Definition at line 81 of file TestBeamHitProducer.h.

81{12};

◆ outputCollection_

std::string trigscint::TestBeamHitProducer::outputCollection_
private

Name of the output collection that will be used to stored the trigger scintillator hits.

Definition at line 59 of file TestBeamHitProducer.h.

◆ peds_

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

channel pedestals [fC]

Definition at line 65 of file TestBeamHitProducer.h.

◆ pulseWidth_

int trigscint::TestBeamHitProducer::pulseWidth_ {5}
private

Total number of samples used in pulse integration.

Definition at line 74 of file TestBeamHitProducer.h.

74{5};

◆ pulseWidthLYSO_

int trigscint::TestBeamHitProducer::pulseWidthLYSO_ {8}
private

Total number of samples used in pulse integration for LYSO (long decay, might need wider window)

Definition at line 78 of file TestBeamHitProducer.h.

78{8};

◆ startSample_

int trigscint::TestBeamHitProducer::startSample_ {10}
private

start sample for pulse integration (not including any fiber offsets)

Definition at line 71 of file TestBeamHitProducer.h.

71{10};

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