LDMX Software
trigscint::TrigScintClusterProducer Class Reference

Public Member Functions

 TrigScintClusterProducer (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &ps) override
 Callback for the EventProcessor 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.
 
virtual void addHit (uint idx, ldmx::TrigScintHit hit)
 add a hit at index idx to a cluster
 
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::Producer
 Producer (const std::string &name, Process &process)
 Class constructor.
 
virtual void process (Event &event) final
 Processing an event for a Producer is calling produce.
 
- 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 beforeNewRun (ldmx::RunHeader &run_header)
 Callback for Producers to add parameters to the run header before conditions are initialized.
 
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< ldmx::TrigScintClusterclusters_
 
double seed_ {0.}
 
double min_thr_ {0.}
 
int max_width_ {2}
 
bool ampl_weighting_ {true}
 
int verbose_ {0}
 
double pad_time_ {0.}
 
double time_tolerance_ {0.}
 
std::string input_collection_
 
std::string output_collection_
 
std::string pass_name_ {""}
 
int vert_bar_start_idx_ {52}
 
float centroid_ {0.}
 
float centroid_x_ {-1}
 
float centroid_y_ {-1}
 
float val_ {0.}
 
float val_e_ {0.}
 
float sumw_ {0.}
 
std::vector< unsigned int > v_added_indices_
 
std::vector< unsigned int > v_used_indices_
 
float beam_e_ {0.}
 
float time_ {0.}
 
std::map< int, int > hit_channel_map_
 

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 26 of file TrigScintClusterProducer.h.

Constructor & Destructor Documentation

◆ TrigScintClusterProducer()

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

Definition at line 28 of file TrigScintClusterProducer.h.

29 : Producer(name, process) {}
Producer(const std::string &name, Process &process)
Class constructor.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.

Member Function Documentation

◆ addHit()

void trigscint::TrigScintClusterProducer::addHit ( uint idx,
ldmx::TrigScintHit hit )
virtual

add a hit at index idx to a cluster

Definition at line 482 of file TrigScintClusterProducer.cxx.

482 {
483 float ampl = hit.getPE();
484 float w = 1;
485 if (ampl_weighting_) { // if choosing to PE-weight centroid positions
486 w = ampl;
487 }
488
489 float energy = hit.getEnergy();
490 val_e_ += energy;
491
492 val_ += ampl;
493 centroid_ += (idx + 1) * w; // need non-zero weight of channel 0. shifting
494 // centroid back by 1 in the end
495 // this number gets divided by val at the end
496
497 sumw_ += w;
498
499 v_added_indices_.push_back(idx);
500
501 beam_e_ += hit.getBeamEfrac() * energy;
502 if (hit.getTime() > -990.) {
503 time_ += hit.getTime() * ampl;
504 }
505
506 v_used_indices_.push_back(idx);
507 /* // not working properly, but i'd prefer this type of solution
508 hit_channel_map_.erase( idx ) ;
509 if (verbose_ > 1 ) {
510 ldmx_log(debug) << "Removed used hit " << idx << " from list";
511 }
512 if ( hit_channel_map_.find( idx) != hit_channel_map_.end() )
513 std::cerr << "----- WARNING! Hit still present in map after removal!! ";
514 */
515 if (verbose_ > 1) {
516 ldmx_log(debug) << " In addHit, adding hit at " << idx
517 << " with amplitude " << ampl
518 << ", updating cluster to current centroid "
519 << centroid_ / val_ - 1 << " and energy " << val_
520 << ". index vector now ends with "
521 << v_added_indices_.back();
522 }
523
524 return;
525}
float getEnergy() const
Get the calorimetric energy of the hit, corrected for sampling factors [MeV].
float getTime() const
Get the time of the hit [ns].
float getPE() const
Get the hit pe.
float getBeamEfrac() const
Get the beam energy fraction.

References ldmx::TrigScintHit::getBeamEfrac(), ldmx::CalorimeterHit::getEnergy(), ldmx::TrigScintHit::getPE(), and ldmx::CalorimeterHit::getTime().

Referenced by produce().

◆ configure()

void trigscint::TrigScintClusterProducer::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 class_name equal to the EventProcessor class name.

For an example, look at MyProcessor.

Parameters
parametersParameters for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 9 of file TrigScintClusterProducer.cxx.

9 {
10 seed_ = ps.get<double>("seed_threshold");
11 min_thr_ = ps.get<double>("clustering_threshold");
12 max_width_ = ps.get<int>("max_cluster_width");
13 ampl_weighting_ = ps.get<bool>("ampl_weighting");
14 input_collection_ = ps.get<std::string>("input_collection");
15 pass_name_ = ps.get<std::string>("input_pass_name");
16 output_collection_ = ps.get<std::string>("output_collection");
17 verbose_ = ps.get<int>("verbosity");
18 vert_bar_start_idx_ = ps.get<int>("vertical_bar_start_index");
19 time_tolerance_ = ps.get<double>("time_tolerance");
20 pad_time_ = ps.get<double>("pad_time");
21 if (verbose_) {
22 ldmx_log(info) << "In TrigScintClusterProducer: configure done!";
23 ldmx_log(info) << "Got parameters: \nSeed threshold: " << seed_
24 << "\nClustering threshold: " << min_thr_
25 << "\nMax cluster width: " << max_width_
26 << "\nAmplitude weighting: " << ampl_weighting_
27 << "\nExpected pad hit time: " << pad_time_
28 << "\nMax hit time delay: " << time_tolerance_
29 << "\nVertical bar start index: " << vert_bar_start_idx_
30 << "\nInput collection: " << input_collection_
31 << "\nInput pass name: " << pass_name_
32 << "\nOutput collection: " << output_collection_
33 << "\nVerbosity: " << verbose_;
34 }
35
36 return;
37}

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

◆ onProcessEnd()

void trigscint::TrigScintClusterProducer::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 533 of file TrigScintClusterProducer.cxx.

533 {
534 ldmx_log(debug) << "Process ends!";
535
536 return;
537}

◆ onProcessStart()

void trigscint::TrigScintClusterProducer::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 527 of file TrigScintClusterProducer.cxx.

527 {
528 ldmx_log(debug) << "Process starts!";
529
530 return;
531}

◆ produce()

void trigscint::TrigScintClusterProducer::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 39 of file TrigScintClusterProducer.cxx.

39 {
40 // parameters.
41 // a cluster seeding threshold
42 // a clustering threshold -- a lower boundary for being added at all (zero
43 // suppression)
44 // a maximum cluster width
45 //
46 // steps.
47 // 1. get an input collection of digi hits. at most one entry per channel.
48 // 2. access them by channel number
49 // 3. clustering:
50 // a. add first hit > seedThr to cluster(ling) . store content as
51 // localMax. track size of cluster (1) b. if not in beginning of array:
52 // add cell before while content < add next hit first hit > seedThr to
53 // cluster(ling) b. while content < add next hit first hit > seedThr to
54 // cluster(ling)
55
56 /*
57
58 The trigger pad geometry considered for this clustering algorithm is:
59
60
61 | | | | | |
62 | 0 | 2 | 4 | 6 | 8 | ... | 48|
63
64 | 1 | 3 | 5 | 7 | 9 | ... | 49|
65 | | | | | |
66
67 with hits in channels after digi looking something like this
68
69
70 ampl: _ _ _
71 | |_ | | | |
72 ----| | |---------------| |-----------------| |------- cluster seed
73 threshold | | |_ | |_ _ | |_
74 _| | | | _| | | | _| | | _
75 | | | | | vs | | | | | vs | | | | | |
76
77
78 | | |
79 split | seeds keep | disregard keep! | just move on
80 | next cl. | (later seed | (no explicit splitting)
81 might pick
82 it up)
83
84
85 The idea being that while there could be good reasons for an electron to
86 touch three pads in a row, there is no good reason for it to cross four.
87 This is noise, or, the start of an adjacent cluster. In any case, 4 is not a
88 healthy cluster. Proximity to a seed governs which below-seed channels to
89 include. By always starting in one end but going back (at most two
90 channels), this algo guarantees symmetric treatment on both sides of the
91 seed.
92
93
94 //Procedure: keep going until there is a seed. walk back at most 2 steps
95 // add all the hits. clusters of up to 3 is fine.
96 // if the cluster is > 3, then we need to do something.
97 // if it's == 4, we'd want to split in the middle if there are two potential
98 seeds. retain only the first half, cases are (seed = s, n - no/noise)
99 // nsns , nssn, snsn, ssnn. nnss won't happen (max 1 step back from s,
100 unless there is nothing in front)
101 // all these are ok to split like this bcs even if ssnn--> ss and some small
102 nPE is lost, that's probably pretty negligible wrt the centroid position,
103 with two seeds in one cluster
104
105 // if it's > 4, cases are
106 // nsnsn, nsnss, nssnn, nssns, snsnn, snsns, ssnnn, ssnns.
107 // these are also all ok to just truncate after 2. and then the same check
108 outlined above will happen to the next chunk.
109
110 // so in short we can
111 // 1. seed --> addHit
112 // 2. walk back once --> addHit
113 // 3. check next: if seed+1 exists && seed +2 exists,
114 // 3a. if seed-1 is in already, stop here.
115 // 3b. else if seed+3 exists, stop here.
116 // 3c. else addHit(seed+1), addHit(seed+2)
117 // 4. if seed+1 and !seed+2 --> addHit(seed+1)
118 // 5. at this point, if clusterSize is 2 hits and seed+1 didn't exist, we
119 can afford to walk back one more step and add whatever junk was there (we
120 know it's not a seed)
121
122
123 */
124
125 if (verbose_) {
126 ldmx_log(debug)
127 << "TrigScintClusterProducer: produce() starts! Event number: "
128 << event.getEventHeader().getEventNumber();
129 }
130
131 // looper over digi hits and aggregate energy depositions for each detID
132
133 const auto digis{
134 event.getCollection<ldmx::TrigScintHit>(input_collection_, pass_name_)};
135
136 if (verbose_) {
137 ldmx_log(debug) << "Got digi collection " << input_collection_ << "_"
138 << pass_name_ << " with " << digis.size() << " entries ";
139 }
140
141 // TODO remove this once verified that the noise overlap bug is gone
142 bool do_duplicate = true;
143
144 // 1. store all the channel digi content in channel order
145 auto i_digi{0};
146 for (const auto &digi : digis) {
147 // these are unordered hits, and this collection is zero-suppressed
148 // map the index of the digi to the channel index
149
150 if (digi.getPE() >
151 min_thr_) { // cut on a min threshold (for a non-seeding hit to be
152 // added to seeded clusters) already here
153
154 int id = digi.getBarID();
155
156 // first check if there is a (pure) noise hit at this channel, and
157 // replace it in that case. this is a protection against a problem that
158 // shouldn't be there in the first place.
159 if (do_duplicate &&
160 hit_channel_map_.find((id)) != hit_channel_map_.end()) {
161 int idx = id;
162 std::map<int, int>::iterator itr = hit_channel_map_.find(idx);
163 double old_val = digis.at(itr->second).getPE();
164 if (verbose_) {
165 ldmx_log(debug) << "Got duplicate digis for channel " << idx
166 << ", with already inserted value " << old_val
167 << " and new " << digi.getPE();
168 }
169 if (digi.getPE() > old_val) {
170 hit_channel_map_.erase(itr->first);
171 if (verbose_) {
172 ldmx_log(debug)
173 << "Skipped duplicate digi with smaller value for channel "
174 << idx;
175 }
176 }
177 }
178
179 // don't add in late hits
180 if (digi.getTime() > pad_time_ + time_tolerance_) {
181 i_digi++;
182 continue;
183 }
184
185 hit_channel_map_.insert(std::pair<int, int>(id, i_digi));
186 // the channel number is the key, the digi list index is the value
187
188 if (verbose_) {
189 ldmx_log(debug) << "Mapping digi hit nb " << i_digi
190 << " with energy = " << digi.getEnergy()
191 << " MeV, nPE = " << digi.getPE() << " > " << min_thr_
192 << " to key/channel " << id;
193 }
194 }
195 i_digi++;
196 }
197
198 // 2. now step through all the channels in the map and cluster the hits
199
200 std::map<int, int>::iterator itr;
201
202 // Create the container to hold the digitized trigger scintillator hits.
203 std::vector<ldmx::TrigScintCluster> trig_scint_clusters;
204
205 // loop over channels
206 for (itr = hit_channel_map_.begin(); itr != hit_channel_map_.end(); ++itr) {
207 // this hit may have disappeared
208 if (hit_channel_map_.find(itr->first) == hit_channel_map_.end()) {
209 if (verbose_ > 1) {
210 ldmx_log(debug) << "Attempting to use removed hit at channel "
211 << itr->first << "; skipping.";
212 }
213 continue;
214 }
215
216 // i don't like this but for now, erasing elements in the map leads, as it
217 // turns out, to edge cases where i miss out on hits or run into
218 // non-existing indices. so while what i do below means that i don't need to
219 // erase hits, i'd rather find a way to do that and skip this book keeping:
220 bool has_used = false;
221 for (const auto &index : v_used_indices_) {
222 if (index == itr->first) {
223 if (verbose_ > 1) {
224 ldmx_log(warn) << "Attempting to re-use hit at channel " << itr->first
225 << "; skipping.";
226 }
227 has_used = true;
228 }
229 }
230 if (has_used) continue;
231 if (verbose_ > 1) {
232 ldmx_log(debug) << "\t At hit with channel nb " << itr->first << ".";
233 }
234
235 if (hit_channel_map_.size() ==
236 0) // we removed them all..? shouldn't ever happen
237 {
238 if (verbose_)
239 ldmx_log(warn) << "Time flies, and all clusters have already been "
240 "removed! Unclear how we even got here; interfering "
241 "here to get out of the loop. ";
242 break;
243 }
244
245 ldmx::TrigScintHit digi = (ldmx::TrigScintHit)digis.at(itr->second);
246
247 // skip all until hit a seed
248 if (digi.getPE() >= seed_) {
249 if (verbose_ > 1) {
250 ldmx_log(debug) << "Seeding cluster with channel " << itr->first
251 << "; content " << digi.getPE();
252 }
253
254 // 1. add seeding hit to cluster
255
256 addHit(itr->first, digi);
257
258 if (verbose_ > 1) {
259 ldmx_log(debug) << "\t itr is pointing at hit with channel nb "
260 << itr->first << ".";
261 }
262
263 // ----- first look back one step
264
265 // we have added the hit from the neighbouring channel to the list only if
266 // it's above clustering threshold so no check needed now
267 std::map<int, int>::iterator itr_back =
268 hit_channel_map_.find(itr->first - 1);
269
270 bool has_backed = false;
271
272 if (itr_back !=
273 hit_channel_map_
274 .end()) { // there is an entry for the previous
275 // channel, so it had content above threshold
276 // but it wasn't enough to seed a cluster. so, unambiguous that it
277 // should be added here because it's its only chance to get in.
278
279 // need to check again for backwards hits
280 has_used = false;
281 for (const auto &index : v_used_indices_) {
282 if (index == itr_back->first) {
283 if (verbose_ > 1) {
284 ldmx_log(warn) << "Attempting to re-use hit at channel "
285 << itr_back->first << "; skipping.";
286 }
287 has_used = true;
288 }
289 }
290 if (!has_used) {
291 digi = (ldmx::TrigScintHit)digis.at(itr_back->second);
292
293 // 2. add seed-1 to cluster
294 addHit(itr_back->first, digi);
295 has_backed = true;
296
297 if (verbose_ > 1) {
298 ldmx_log(debug) << "Added -1 channel " << itr_back->first
299 << " to cluster; content " << digi.getPE();
300 ldmx_log(debug) << "\t itr is pointing at hit with channel nb "
301 << itr->first << ".";
302 }
303
304 } // if seed-1 wasn't used already
305 } // there exists a lower, unused neighbour
306
307 // 3. check next: if seed+1 exists && seed +2 exists,
308 // 3a. if seed-1 is in already, this is a case for a split, at seed. go
309 // directly to check on seed-2, don't add more here. 3b. else. addHit
310 // (seed+1) 3c. if seed+3 exists, this is a split, at seed+1. don't add
311 // more here. 3d. else addHit(seed+2)
312 // 4. if seed+1 and !seed+2 --> go to addHit(seed+1)
313
314 // --- now, step 3, 4: look ahead 1 step from seed
315
316 if (v_added_indices_.size() < max_width_) {
317 // (in principle these don't need to be different iterators, but it
318 // makes the logic easier to follow)
319 std::map<int, int>::iterator itr_neighb =
320 hit_channel_map_.find(itr->first + 1);
321 if (itr_neighb !=
322 hit_channel_map_
323 .end()) { // there is an entry for the next channel,
324 // so it had content above threshold
325 // seed+1 exists
326 // check if there is sth in position seed+2
327 if (hit_channel_map_.find(itr_neighb->first + 1) !=
328 hit_channel_map_.end()) { // a hit with that key exists, so
329 // seed+1 and seed+2 exist
330 if (!has_backed) { // there is no seed-1 in the cluster. room for
331 // at least seed+1, and for seed+2 only if there
332 // is no seed+3
333 // 3b
334 digi = (ldmx::TrigScintHit)digis.at(itr_neighb->second);
335 addHit(itr_neighb->first, digi);
336
337 if (verbose_ > 1) {
338 ldmx_log(debug)
339 << "No -1 hit. Added +1 channel " << itr_neighb->first
340 << " to cluster; content " << digi.getPE();
341 ldmx_log(debug) << "\t itr is pointing at hit with channel nb "
342 << itr->first << ".";
343 }
344
345 if (v_added_indices_.size() < max_width_) {
346 if (hit_channel_map_.find(itr_neighb->first + 2) ==
347 hit_channel_map_
348 .end()) { // no seed+3. also no seed-1. so add seed+2
349 // 3d. add seed+2 to the cluster
350 itr_neighb = hit_channel_map_.find(itr->first + 2);
351 digi = (ldmx::TrigScintHit)digis.at(itr_neighb->second);
352 addHit(itr_neighb->first, digi);
353 if (verbose_ > 1) {
354 ldmx_log(debug)
355 << "No +3 hit. Added +2 channel " << itr_neighb->first
356 << " to cluster; content " << digi.getPE();
357 ldmx_log(debug)
358 << "\t itr is pointing at hit with channel nb "
359 << itr->first << ".";
360 }
361 }
362
363 } // if no seed+3 --> added seed+2
364 } // if seed-1 wasn't added
365 } // if seed+2 exists. then already added seed+1.
366 else { // so: if not, then we need to add seed+1 here. (step 4)
367 digi = (ldmx::TrigScintHit)digis.at(
368 itr_neighb->second); // itrNeighb hasn't moved since there was
369 // no seed+2
370 addHit(itr_neighb->first, digi);
371
372 if (verbose_ > 1) {
373 ldmx_log(debug)
374 << "Added +1 channel " << itr_neighb->first
375 << " as last channel to cluster; content " << digi.getPE();
376 ldmx_log(debug) << "\t itr is pointing at hit with channel nb "
377 << itr->first << ".";
378 }
379 }
380 } // if seed+1 exists
381 // 5. at this point, if clusterSize is 2 hits and seed+1 didn't exist,
382 // we can afford to walk back one more step and add whatever junk was
383 // there (we know it's not a seed)
384 else if (has_backed &&
385 hit_channel_map_.find(itr_back->first - 1) !=
386 hit_channel_map_
387 .end()) { // seed-1 has been added, but not seed+1,
388 // and there is a hit in seed-2
389 itr_back = hit_channel_map_.find(itr->first - 2);
390 digi = (ldmx::TrigScintHit)digis.at(itr_back->second);
391 addHit(itr_back->first, digi);
392
393 if (verbose_ > 1) {
394 ldmx_log(debug) << "Added -2 channel " << itr_back->first
395 << " to cluster; content " << digi.getPE();
396 }
397 if (verbose_ > 1) {
398 ldmx_log(debug) << "\t itr is pointing at hit with channel nb "
399 << itr->first << ".";
400 }
401
402 } // check if add in seed -2
403
404 } // if adding another hit, going forward, was allowed
405
406 // done adding hits to cluster. calculate centroid
407 centroid_ /=
408 sumw_; // final weighting step: divide by total amplitude sum
409
410 centroid_ -= 1; // shift back to actual channel center
411
413
414 if (verbose_ > 1) {
415 ldmx_log(debug) << "Now have " << v_added_indices_.size()
416 << " hits in the cluster ";
417 }
418 cluster.setSeed(v_added_indices_.at(0));
419 cluster.setIDs(v_added_indices_);
420 cluster.setNHits(v_added_indices_.size());
421 cluster.setCentroid(centroid_);
422 float cx;
423 float cy = centroid_;
424 float cz = -99999; // set to nonsense for now. could be set to module nb
425 // then in horizontal bars --> we don't know X
426 if (centroid_ < vert_bar_start_idx_) {
427 // set to nonsense in barID space. could translate to x=0 mm
428 cx = -1;
429 }
430
431 else {
432 cx = (int)((centroid_ - vert_bar_start_idx_) / 4); // start at 0
433 cy = (int)centroid_ % 4;
434 }
435 cluster.setCentroidXYZ(cx, cy, cz);
436 cluster.setEnergy(val_e_);
437 cluster.setPE(val_);
438 cluster.setTime(time_ / val_);
439 cluster.setBeamEfrac(beam_e_ / val_e_);
440
441 trig_scint_clusters.push_back(cluster);
442
443 ldmx_log(trace) << cluster;
444
445 centroid_ = 0;
446 centroid_x_ = -1;
447 centroid_y_ = -1;
448 val_ = 0;
449 val_e_ = 0;
450 beam_e_ = 0;
451 time_ = 0;
452 sumw_ = 0;
453 // book keep which channels have already been added to a cluster
454 v_added_indices_.resize(0);
455
456 if (verbose_ > 1) {
457 ldmx_log(debug)
458 << "\t Finished processing of seeding hit with channel nb "
459 << itr->first << ".";
460 }
461
462 } // if content enough to seed a cluster
463
464 if (hit_channel_map_.begin() == hit_channel_map_.end()) {
465 if (verbose_)
466 ldmx_log(warn) << "Time flies, and all clusters have already been "
467 "removed! Interfering here to get out of the loop. ";
468 break;
469 }
470 } // over channels
471
472 if (trig_scint_clusters.size() > 0)
473 event.add(output_collection_, trig_scint_clusters);
474
475 hit_channel_map_.clear();
476 // book keep which channels have already been added to a cluster
477 v_used_indices_.resize(0);
478
479 return;
480}
Stores cluster information from the trigger scintillator pads.
void setIDs(std::vector< unsigned int > &hitIDs)
The channel numbers of hits forming the cluster.
void setNHits(int nHits)
The number of hits forming the cluster.
void setCentroidXYZ(double x, double y, double z)
The cluster centroid in x,y,z.
void setEnergy(double energy)
Set the cluster energy.
void setCentroid(double centroid)
void setPE(float PE)
Set the cluster photoelectron count (PE)
void setBeamEfrac(float e)
Set beam energy fraction of hit.
void setTime(float t)
Set time of hit.
virtual void addHit(uint idx, ldmx::TrigScintHit hit)
add a hit at index idx to a cluster

References addHit(), ldmx::TrigScintHit::getPE(), ldmx::TrigScintCluster::setBeamEfrac(), ldmx::TrigScintCluster::setCentroid(), ldmx::TrigScintCluster::setCentroidXYZ(), ldmx::TrigScintCluster::setEnergy(), ldmx::TrigScintCluster::setIDs(), ldmx::TrigScintCluster::setNHits(), ldmx::TrigScintCluster::setPE(), ldmx::TrigScintCluster::setSeed(), and ldmx::TrigScintCluster::setTime().

Member Data Documentation

◆ ampl_weighting_

bool trigscint::TrigScintClusterProducer::ampl_weighting_ {true}
private

Definition at line 58 of file TrigScintClusterProducer.h.

58{true};

◆ beam_e_

float trigscint::TrigScintClusterProducer::beam_e_ {0.}
private

Definition at line 107 of file TrigScintClusterProducer.h.

107{0.};

◆ centroid_

float trigscint::TrigScintClusterProducer::centroid_ {0.}
private

Definition at line 82 of file TrigScintClusterProducer.h.

82{0.};

◆ centroid_x_

float trigscint::TrigScintClusterProducer::centroid_x_ {-1}
private

Definition at line 85 of file TrigScintClusterProducer.h.

85{-1};

◆ centroid_y_

float trigscint::TrigScintClusterProducer::centroid_y_ {-1}
private

Definition at line 88 of file TrigScintClusterProducer.h.

88{-1};

◆ clusters_

std::vector<ldmx::TrigScintCluster> trigscint::TrigScintClusterProducer::clusters_
private

Definition at line 46 of file TrigScintClusterProducer.h.

◆ hit_channel_map_

std::map<int, int> trigscint::TrigScintClusterProducer::hit_channel_map_
private

Definition at line 113 of file TrigScintClusterProducer.h.

◆ input_collection_

std::string trigscint::TrigScintClusterProducer::input_collection_
private

Definition at line 70 of file TrigScintClusterProducer.h.

◆ max_width_

int trigscint::TrigScintClusterProducer::max_width_ {2}
private

Definition at line 55 of file TrigScintClusterProducer.h.

55{2};

◆ min_thr_

double trigscint::TrigScintClusterProducer::min_thr_ {0.}
private

Definition at line 52 of file TrigScintClusterProducer.h.

52{0.};

◆ output_collection_

std::string trigscint::TrigScintClusterProducer::output_collection_
private

Definition at line 73 of file TrigScintClusterProducer.h.

◆ pad_time_

double trigscint::TrigScintClusterProducer::pad_time_ {0.}
private

Definition at line 64 of file TrigScintClusterProducer.h.

64{0.};

◆ pass_name_

std::string trigscint::TrigScintClusterProducer::pass_name_ {""}
private

Definition at line 76 of file TrigScintClusterProducer.h.

76{""};

◆ seed_

double trigscint::TrigScintClusterProducer::seed_ {0.}
private

Definition at line 49 of file TrigScintClusterProducer.h.

49{0.};

◆ sumw_

float trigscint::TrigScintClusterProducer::sumw_ {0.}
private

Definition at line 97 of file TrigScintClusterProducer.h.

97{0.};

◆ time_

float trigscint::TrigScintClusterProducer::time_ {0.}
private

Definition at line 110 of file TrigScintClusterProducer.h.

110{0.};

◆ time_tolerance_

double trigscint::TrigScintClusterProducer::time_tolerance_ {0.}
private

Definition at line 67 of file TrigScintClusterProducer.h.

67{0.};

◆ v_added_indices_

std::vector<unsigned int> trigscint::TrigScintClusterProducer::v_added_indices_
private

Definition at line 100 of file TrigScintClusterProducer.h.

◆ v_used_indices_

std::vector<unsigned int> trigscint::TrigScintClusterProducer::v_used_indices_
private

Definition at line 103 of file TrigScintClusterProducer.h.

◆ val_

float trigscint::TrigScintClusterProducer::val_ {0.}
private

Definition at line 91 of file TrigScintClusterProducer.h.

91{0.};

◆ val_e_

float trigscint::TrigScintClusterProducer::val_e_ {0.}
private

Definition at line 94 of file TrigScintClusterProducer.h.

94{0.};

◆ verbose_

int trigscint::TrigScintClusterProducer::verbose_ {0}
private

Definition at line 61 of file TrigScintClusterProducer.h.

61{0};

◆ vert_bar_start_idx_

int trigscint::TrigScintClusterProducer::vert_bar_start_idx_ {52}
private

Definition at line 79 of file TrigScintClusterProducer.h.

79{52};

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