ATLAS Offline Software
TileHitVecToCntTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //************************************************************
6 // FileName : TileHitVecToCntTool.cxx
7 // Author : Vishnu Zutshi
8 // Created : Dec. 2009
9 //************************************************************
10 
11 // Tile includes
17 
18 // Calo includes
19 #include "CaloIdentifier/TileID.h"
21 
22 // Athena includes
24 #include "StoreGate/WriteHandle.h"
26 
27 // Trigger time
30 // For the Athena-based random numbers.
33 
34 #include "CLHEP/Random/Randomize.h"
35 #include "CLHEP/Random/RandomEngine.h"
36 
37 #include <algorithm>
38 
39 using CLHEP::RandFlat;
40 using CLHEP::RandGaussQ; // FIXME CLHEP::RandGaussZiggurat is faster and more accurate.
41 using CLHEP::RandPoissonT;
42 using CLHEP::RandGeneral;
43 
45  const std::string& name,
46  const IInterface* parent)
48 {
49 }
50 
52 
53  ATH_MSG_DEBUG("TileHitVecToCntTool initialization started");
54 
55  bool error = false;
56 
57  ATH_CHECK(m_rndmSvc.retrieve());
58 
59  // retrieve TileID helper from det store
61 
63 
65 
67 
68  ATH_CHECK(m_cablingSvc.retrieve());
69  m_cabling = m_cablingSvc->cablingService();
70 
73 
74  if (!m_usePhotoStatistics) {
75  ATH_MSG_INFO("No photostatistics effect will be simulated");
76  }
77 
78  if (m_rndmEvtOverlay) {
79  m_pileUp = false;
80  ATH_MSG_INFO("Zero-luminosity pile-up selected");
81  ATH_MSG_INFO("Taking hits from original event only");
82  }
83 
84  if (m_pileUp || m_rndmEvtOverlay) {
85  ATH_MSG_INFO("take events from PileUp service");
86 
88  ATH_CHECK(m_mergeSvc.retrieve());
89  }
90 
91  if (m_useTriggerTime) {
92  ATH_MSG_INFO(" In case of pileup, the trigger time subtraction is done in PileUpSvc");
93  ATH_MSG_INFO(" => TileHitVecToCnt will not apply Trigger Time ");
94  m_useTriggerTime = false;
95  }
96  m_timeFlag = 0;
97 
98  if (m_pileUp) {
99  // prepare vector with all hits
101  if (m_run2){
104  } else {
107  }
108 
109  Identifier hit_id;
110  IdContext pmt_context = m_tileID->pmt_context();
111  for (int i = 0; i < m_mbtsOffset; ++i) {
112  m_tileID->get_id((IdentifierHash) i, hit_id, &pmt_context);
113  TileHit * pHit = new TileHit(hit_id, 0., 0.);
114  pHit->reserve(71); // reserve max possible size for pileup
115  m_allHits[i] = pHit;
116  if(m_doDigiTruth){
117  TileHit * pHit_DigiHSTruth = new TileHit(hit_id, 0., 0.);
118  pHit_DigiHSTruth->reserve(71); // reserve max possible size for pileup
119  m_allHits_DigiHSTruth[i] = pHit_DigiHSTruth;
120  }
121  }
122  for (int side = 0; side < N_SIDE; ++side) {
123  for (int phi = 0; phi < N_PHI; ++phi) {
124  for (int eta = 0; eta < N_ETA; ++eta) {
125  hit_id = m_tileTBID->channel_id((side > 0) ? 1 : -1, phi, eta);
126  TileHit * pHit = new TileHit(hit_id, 0., 0.);
127  pHit->reserve(71); // reserve max possible size for pileup
128  m_allHits[mbts_index(side, phi, eta)] = pHit;
129  if(m_doDigiTruth){
130  TileHit * pHit_DigiHSTruth = new TileHit(hit_id, 0., 0.);
131  pHit_DigiHSTruth->reserve(71); // reserve max possible size for pileup
132  m_allHits_DigiHSTruth[mbts_index(side, phi, eta)] = pHit_DigiHSTruth;
133  }
134  }
135  }
136  }
137  if (m_run2) {
138  for (int phi = 0; phi < E4_N_PHI; ++phi) {
139  hit_id = m_tileTBID->channel_id(E4_SIDE, phi, E4_ETA);
140  TileHit * pHit = new TileHit(hit_id, 0., 0.);
141  pHit->reserve(71); // reserve max possible size for pileup
142  m_allHits[e4pr_index(phi)] = pHit;
143  if(m_doDigiTruth){
144  TileHit * pHit_DigiHSTruth = new TileHit(hit_id, 0., 0.);
145  pHit_DigiHSTruth->reserve(71); // reserve max possible size for pileup
146  m_allHits_DigiHSTruth[e4pr_index(phi)] = pHit_DigiHSTruth;
147  }
148  }
149  }
150  }
151 
152  } else {
153 
154  ATH_MSG_INFO("no pile up");
155 
156  if (m_useTriggerTime) {
157 
158  m_timeFlag = 2;
159 
160  if (!m_triggerTimeTool.empty()) {
161  ATH_MSG_INFO( "Trigger time is taken from external tool '" << m_triggerTimeTool.name()
162  << "'; therefore set HitTimeFlag to 2");
163  if (m_triggerTimeTool.retrieve().isFailure()) {
164  error = true;
165  ATH_MSG_ERROR("Unable to find tool for " << m_triggerTimeTool.name());
166  ATH_MSG_ERROR("Take average time from all hits in event as trigger time");
167  m_useTriggerTime = false;
168  m_triggerTimeTool.setTypeAndName("");
169  }
170  }
171  }
172 
173  switch (m_timeFlag) {
174  case 2:
175  if (m_triggerTimeTool.empty()) {
176  if (m_triggerTime > 0.0) {
177  m_useTriggerTime = true;
178  ATH_MSG_INFO("Fixed trigger time of " << m_triggerTime << " ns will be used");
179  } else if (m_triggerTime < 0.0) {
180  m_useTriggerTime = false;
181  ATH_MSG_INFO( "Minimal hit time will be used as trigger time"
182  << " with random additional shift between 0 and " << -m_triggerTime << " ns");
183  } else {
184  m_useTriggerTime = false;
185  ATH_MSG_INFO("Average time will be calculated in every event");
186  }
187  }
188  break;
189  case 1:
190  ATH_MSG_INFO("Time of all hits will be reset to zero");
191  break;
192  default:
193  ATH_MSG_INFO("Time of all hits will be preserved during copy");
194  m_timeFlag = 0;
195  break;
196  }
197  }
198 
199  if (m_run2plus) {
201 
204 
205  for (int ros = 3; ros < 5; ++ros) {
206  for (int drawer = 0; drawer < 64; ++drawer) {
207  int frag_id = m_tileHWID->frag(ros, drawer);
208  IdentifierHash frag_hash = m_fragHashFunc(frag_id);
209  m_E1merged[frag_hash] = (m_cabling->E1_merged_with_run2plus(ros, drawer) != 0);
211  }
212  }
213  ATH_MSG_INFO("Number of E1 cell to be merged: " << std::count (m_E1merged.begin(), m_E1merged.end(), true));
214  ATH_MSG_INFO("Number of MBTS cell to be merged: " << std::count (m_MBTSmerged.begin(), m_MBTSmerged.end(), true));
215  }
216 
218  m_hitVectorNames = m_inputKeys.value();
219  }
220  else {
221  ATH_CHECK(m_hitVectorKeys.assign(m_inputKeys.value()));
222  }
223  ATH_MSG_DEBUG("Input objects in these containers : '" << m_hitVectorNames << "'");
224 
225  // Initialize ReadHandleKey
227 
230 
231  ATH_MSG_DEBUG("TileHitVecToCntTool initialization completed");
232 
233  if (error)
234  return StatusCode::RECOVERABLE;
235  else
236  return StatusCode::SUCCESS;
237 }
238 
240 
241  ATH_MSG_VERBOSE("TileHitVecToCntTool createContainers started");
242 
243  if (m_pileUp) {
244  m_hits = std::make_unique<TileHitNonConstContainer>(SG::VIEW_ELEMENTS);
247  for (; iHit != lastHit; ++iHit) {
248  TileHit *pHit = (*iHit);
249  pHit->setZero();
250  }
251 
252  if(m_doDigiTruth){
253  m_hits_DigiHSTruth = std::make_unique<TileHitNonConstContainer>(SG::OWN_ELEMENTS);
254  iHit = m_allHits_DigiHSTruth.begin();
255  lastHit = m_allHits_DigiHSTruth.end();
256  for (; iHit != lastHit; ++iHit) {
257  TileHit *pHit = (*iHit);
258  if(pHit == nullptr) continue;
259  pHit->setZero();
260 
261  }
262  }
263  } else {
264  m_hits = std::make_unique<TileHitNonConstContainer>(SG::OWN_ELEMENTS);
265  if(m_doDigiTruth) m_hits_DigiHSTruth = std::make_unique<TileHitNonConstContainer>(SG::OWN_ELEMENTS);
266 
267  }
268 
269  ATH_MSG_VERBOSE("TileHitVecToCntTool createContainers finished");
270 
271  return StatusCode::SUCCESS;
272 
273 }
274 
275 StatusCode TileHitVecToCntTool::prepareEvent(const EventContext& ctx, unsigned int /*nInputEvents*/) {
276 
277  ATH_MSG_DEBUG("TileHitVecToCntTool prepareEvent initialization started");
278 
279  CHECK(this->createContainers());
280 
281  ATH_MSG_DEBUG("TileHitVecToCntTool prepareEvent finished");
282 
283  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, m_randomStreamName);
284  rngWrapper->setSeed( m_randomStreamName, ctx );
285 
286  return StatusCode::SUCCESS;
287 }
288 
289 void TileHitVecToCntTool::processHitVectorForOverlay(const TileHitVector* inputHits, int& nHit, double& eHitTot) {
290 
291  TileHitVecConstIterator inpItr = inputHits->begin();
292  TileHitVecConstIterator end = inputHits->end();
293 
294  for (; inpItr != end; ++inpItr) {
295 
296  const TileHit * cinp = &(*inpItr);
297 
298  eHitTot += cinp->energy(); // not really correct if TileHit contains vector of energies
299  // but eHitTot is needed for debug purposes only
300  TileHit * pHit = new TileHit(*cinp);
301  m_hits->push_back(pHit);
302  ++nHit;
303 
304  if (msgLvl(MSG::VERBOSE)) {
305  int hitsize = cinp->size();
306  double eHit = 0.0;
307  double tHit = 0.0;
308  for (int i = 0; i < hitsize; ++i) {
309  eHit += cinp->energy(i);
310  tHit += cinp->time(i) * cinp->energy(i);
311  }
312  if (eHit > 0.0)
313  tHit /= eHit;
314  else
315  tHit = cinp->time();
316 
317  eHitTot += eHit - cinp->energy(); // put total energy instead of first hit energy
318 
319  msg(MSG::VERBOSE) << " nHit=" << nHit
320  << " id=" << m_tileID->to_string(cinp->identify(), -1)
321  << " eHit=" << eHit
322  << " tHit=" << tHit
323  << " Copy hit: ener=";
324  for (int i = 0; i < hitsize; ++i)
325  msg(MSG::VERBOSE) << cinp->energy(i) << " ";
326  msg(MSG::VERBOSE) << "time=";
327  for (int i = 0; i < hitsize; ++i)
328  msg(MSG::VERBOSE) << cinp->time(i) << " ";
329  msg(MSG::VERBOSE) << endmsg;
330  }
331  }
332  return;
333 }
334 
335 void TileHitVecToCntTool::processHitVectorForPileUp(const TileHitVector* inputHits, double SubEvtTimOffset, int& nHit,
336  double& eHitTot, bool isSignal) {
337 
338  IdContext pmt_context = m_tileID->pmt_context();
339  IdContext tbchannel_context = m_tileTBID->channel_context();
340  IdentifierHash hit_idhash;
341 
342  const bool inTimeEvent(fabs(SubEvtTimOffset) < m_deltaT);
343  // Loop over hits in this HitVector
344  TileHitVecConstIterator inpItr = inputHits->begin();
345  TileHitVecConstIterator end = inputHits->end();
346 
347  for (; inpItr != end; ++inpItr) {
348 
349  const TileHit * cinp = &(*inpItr);
350  Identifier hit_id = cinp->identify();
351 
352  if (m_tileTBID->is_tiletb(hit_id)) {
353  int side = std::max(0, m_tileTBID->type(hit_id));
354  int phi = m_tileTBID->module(hit_id);
355  int eta = m_tileTBID->channel(hit_id);
356  if (eta < 2)
357  hit_idhash = mbts_index(side, phi, eta);
358  else
359  hit_idhash = e4pr_index(phi);
360  } else {
361  m_tileID->get_hash(hit_id, hit_idhash, &pmt_context);
362  }
363 
364  if (hit_idhash >= m_allHits.size()) {
365  // Seems to be E4pr or MBTS hit in minimum bias while geometry is used without them => skipping
366  continue;
367  }
368 
369  double ener = cinp->energy();
370  double time = cinp->time() + SubEvtTimOffset;
371 
372  ++nHit;
373  eHitTot += ener;
374 
375  TileHit * pHit = m_allHits[hit_idhash];
376  TileHit * pHit_DigiHSTruth(nullptr);
377  if(m_doDigiTruth) pHit_DigiHSTruth = m_allHits_DigiHSTruth[hit_idhash];
378 
379  if (0 == pHit) {
380 
381  // keep this "if" just in case there is a bug somewhere ... ( will be removed soon)
382  ATH_MSG_ERROR(" new hit AND MEMORY LEAK HERE!!!");
383 
384  if (inTimeEvent) {
385  pHit = new TileHit(hit_id, ener, time, m_deltaT);
386  if(m_doDigiTruth && isSignal) pHit_DigiHSTruth = new TileHit(hit_id, ener, time, m_deltaT);
387  else if(m_doDigiTruth) pHit_DigiHSTruth = new TileHit(hit_id, 0.0, 0.0);
388  } else {
389  pHit = new TileHit(hit_id, 0.0, 0.0); // create in-time hit with zero energy
390  pHit->add(ener, time, m_deltaT);
391  if(m_doDigiTruth){
392  pHit_DigiHSTruth = new TileHit(hit_id, 0.0, 0.0); // create in-time hit with zero energy
393  pHit_DigiHSTruth->add(ener, time, m_deltaT);
394  }
395  }
396  m_allHits[hit_idhash] = pHit;
397  if(m_doDigiTruth) m_allHits_DigiHSTruth[hit_idhash] = pHit_DigiHSTruth;
398 
399  if (msgLvl(MSG::VERBOSE)) {
400  HWIdentifier channel_id = pHit->pmt_HWID();
401  msg(MSG::VERBOSE) << " nH=" << nHit
402  << " id=" << m_tileID->to_string(hit_id, -1)
403  << " HWid=" << m_tileID->to_string(channel_id)
404  << " e=" << ener
405  << " time=" << time
406  << " offs=" << SubEvtTimOffset
407  << " new hit" << endmsg;
408  }
409 
410  } else {
411 
412  if (time < m_maxHitTime){
413  pHit->add(ener, time, m_deltaT);
414  if(m_doDigiTruth){
415  if(isSignal) {
416  pHit_DigiHSTruth->add(ener, time, m_deltaT);
417  } else {
418  pHit_DigiHSTruth->add(0,time, m_deltaT);
419  }
420  }
421  }
422 
423  if (msgLvl(MSG::VERBOSE)) {
424  if (pHit->size() > 1 || pHit->energy() != 0.0)
425  msg(MSG::VERBOSE) << " nHit=" << nHit
426  << " id=" << m_tileID->to_string(hit_id, -1)
427  << " ener=" << ener
428  << " time=" << time
429  << " offs=" << SubEvtTimOffset
430  << " double hit" << endmsg;
431  else
432  msg(MSG::VERBOSE) << " nH=" << nHit
433  << " id=" << m_tileID->to_string(hit_id, -1)
434  << " HWid=" << m_tileID->to_string(pHit->pmt_HWID())
435  << " e=" << ener
436  << " time=" << time
437  << " offs=" << SubEvtTimOffset
438  << " new hit" << endmsg;
439  }
440  }
441 
442  int hitsize = cinp->size();
443  for (int ind = 1; ind < hitsize; ++ind) { // if we have double hits in original hit
444  ener = cinp->energy(ind); // merge all of them with appropriate time
445  time = cinp->time(ind) + SubEvtTimOffset;
446 
447  ++nHit;
448  eHitTot += ener;
449 
450  if (time < m_maxHitTime){
451  pHit->add(ener, time, m_deltaT);
452  if(m_doDigiTruth){
453  if(isSignal)
454  pHit_DigiHSTruth->add(ener, time, m_deltaT);
455  else
456  pHit_DigiHSTruth->add(0, time, m_deltaT);
457  }
458  }
459 
460  if (msgLvl(MSG::VERBOSE))
461  msg(MSG::VERBOSE) << " nHit=" << nHit
462  << " id=" << m_tileID->to_string(hit_id, -1)
463  << " ener=" << ener
464  << " time=" << time
465  << " double hit from single hit" << endmsg;
466  }
467  } // loop over hits in one vector
468  return;
469 }
470 
471 void TileHitVecToCntTool::processHitVectorWithoutPileUp(const TileHitVector* inputHits, int& nHit, double& eHitTot, TileHitNonConstContainer* hitCont, CLHEP::HepRandomEngine * engine) {
472 
473  TileHitVecConstIterator inpItr = inputHits->begin();
474  TileHitVecConstIterator end = inputHits->end();
475 
476  //**
477  //* Iterate over hits, creating new TileHits
478  //* Add each TileHit to the TileHitContainer.
479  //**
480 
481  switch (m_timeFlag) {
482 
483  case 0: {
484  for (; inpItr != end; ++inpItr) {
485  const TileHit * cinp = &(*inpItr);
486  eHitTot += cinp->energy(); // not really correct if TileHit contains vector of energies
487  // but eHitTot is needed for debug purposes only
488  TileHit * pHit = new TileHit(*cinp);
489  hitCont->push_back(pHit);
490  ++nHit;
491 
492  if (msgLvl(MSG::VERBOSE)) {
493  int hitsize = cinp->size();
494  double eHit = 0.0;
495  double tHit = 0.0;
496  for (int i = 0; i < hitsize; ++i) {
497  eHit += cinp->energy(i);
498  tHit += cinp->time(i) * cinp->energy(i);
499  }
500  if (eHit > 0.0)
501  tHit /= eHit;
502  else
503  tHit = cinp->time();
504 
505  eHitTot += eHit - cinp->energy(); // put total energy instead of first hit energy
506 
507  msg(MSG::VERBOSE) << " nHit=" << nHit
508  << " id=" << m_tileID->to_string(cinp->identify(), -1)
509  << " eHit=" << eHit
510  << " tHit=" << tHit
511  << " Copy hit: ener=";
512  for (int i = 0; i < hitsize; ++i)
513  msg(MSG::VERBOSE) << cinp->energy(i) << " ";
514  msg(MSG::VERBOSE) << "time=";
515  for (int i = 0; i < hitsize; ++i)
516  msg(MSG::VERBOSE) << cinp->time(i) << " ";
517  msg(MSG::VERBOSE) << endmsg;
518  }
519  }
520  break;
521  }
522 
523  case 1: {
524 
525  for (; inpItr != end; ++inpItr) {
526  const TileHit * cinp = &(*inpItr);
527  int size = cinp->size();
528  double eHit = 0.0;
529  for (int i = 0; i < size; ++i) {
530  eHit += cinp->energy(i);
531  }
532  eHitTot += eHit;
533 
534  // create hit with total energy at time=0 instead of original one
535  Identifier pmID = cinp->pmt_ID();
536  TileHit * pHit = new TileHit(pmID, eHit, 0.);
537 
538  hitCont->push_back(pHit);
539  ++nHit;
540 
541  if (msgLvl(MSG::VERBOSE)) {
542  int hitsize = cinp->size();
543  msg(MSG::VERBOSE) << " nHit=" << nHit
544  << " id=" << m_tileID->to_string(cinp->identify(), -1)
545  << " eHit=" << eHit
546  << " tHit=0.0"
547  << " Input hit: ener=";
548  for (int i = 0; i < hitsize; ++i)
549  msg(MSG::VERBOSE) << cinp->energy(i) << " ";
550  msg(MSG::VERBOSE) << "time=";
551  for (int i = 0; i < hitsize; ++i)
552  msg(MSG::VERBOSE) << cinp->time(i) << " ";
553  msg(MSG::VERBOSE) << endmsg;
554  }
555  }
556  break;
557 
558  }
559 
560  case 2: {
561 
562  double avtime = 0.0;
563 
564  if (m_useTriggerTime) {
565 
566  if (m_triggerTimeTool.empty()) {
567  avtime = m_triggerTime;
568  } else {
569  avtime = m_triggerTimeTool->time();
570  }
571  ATH_MSG_DEBUG("Trigger time used : " << avtime);
572 
573  } else {
574 
575  if (m_triggerTime < 0.0) {
576 
577  avtime = 1.0e20;
578 
579  // loop to find minimal time
580  for (; inpItr != end; ++inpItr) {
581  const TileHit * cinp = &(*inpItr);
582  int size = cinp->size();
583  for (int i = 0; i < size; ++i) {
584  if (cinp->time(i) < avtime) avtime = cinp->time(i);
585  }
586  }
587  ATH_MSG_DEBUG("Minimal time in input event " << avtime);
588  double shift = RandFlat::shoot(engine, m_triggerTime, 0.0);
589  ATH_MSG_DEBUG("Minimal time after random shift " << shift);
590  avtime -= shift; // subtracting negative shift value here
591 
592  } else {
593 
594  double weight = 0.0;
595 
596  // loop to calculate average time
597  for (; inpItr != end; ++inpItr) {
598  const TileHit * cinp = &(*inpItr);
599  int size = cinp->size();
600  for (int i = 0; i < size; ++i) {
601  avtime += cinp->time(i) * cinp->energy(i);
602  weight += cinp->energy(i);
603  }
604  }
605  if (weight > 0.0)
606  avtime /= weight;
607  else
608  avtime = 0.0;
609 
610  ATH_MSG_DEBUG("Average time used : " << avtime);
611  }
612 
613  // reset iterator to the first hit
614  inpItr = inputHits->begin();
615  }
616 
617  for (; inpItr != end; ++inpItr) {
618  const TileHit * cinp = &(*inpItr);
619  TileHit * pHit = new TileHit(*cinp);
620  // subract average time from all time bins in the hit
621  int size = pHit->size();
622  for (int i = 0; i < size; ++i) {
623  pHit->setTime(pHit->time(i) - avtime, i);
624  eHitTot += cinp->energy(i);
625  }
626 
627  hitCont->push_back(pHit);
628  ++nHit;
629 
630  if (msgLvl(MSG::VERBOSE)) {
631  int hitsize = pHit->size();
632  double eHit = 0.0;
633  double tHit = 0.0;
634  for (int i = 0; i < hitsize; ++i) {
635  eHit += pHit->energy(i);
636  tHit += pHit->time(i) * cinp->energy(i);
637  }
638  if (eHit > 0.0)
639  tHit /= eHit;
640  else
641  tHit = cinp->time(); // just first time
642 
643  msg(MSG::VERBOSE) << " nHit=" << nHit
644  << " id=" << m_tileID->to_string(pHit->identify(), -1)
645  << " eHit=" << eHit
646  << " tHit=" << tHit
647  << " Output hit: ener=";
648  for (int i = 0; i < hitsize; ++i)
649  msg(MSG::VERBOSE) << pHit->energy(i) << " ";
650  msg(MSG::VERBOSE) << "time=";
651  for (int i = 0; i < hitsize; ++i)
652  msg(MSG::VERBOSE) << pHit->time(i) << " ";
653  msg(MSG::VERBOSE) << endmsg;
654  }
655  }
656  break;
657  }
658 
659  default:
660  ATH_MSG_ERROR("unexpected value m_timeFlag=" << m_timeFlag);
661  break;
662  }
663 
664  return;
665 }
666 
668  , SubEventIterator bSubEvents
669  , SubEventIterator eSubEvents)
670 {
671 
672  ATH_MSG_DEBUG("Inside TileHitVecToCntTool processBunchXing" << bunchXing);
673  // setFilterPassed(true);
674 
675  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, m_randomStreamName);
676  CLHEP::HepRandomEngine * engine = rngWrapper->getEngine(Gaudi::Hive::currentContext());
677 
678  SubEventIterator iEvt(bSubEvents);
679  if (m_rndmEvtOverlay && bunchXing != 0) iEvt = eSubEvents; // in overlay skip all events except BC=0
680 
681  while (iEvt != eSubEvents) {
682  /* zero all counters and sums */
683  int nHit(0);
684  double eHitTot(0.0);
685 
686  std::vector<std::string>::const_iterator hitVecNamesItr = m_hitVectorNames.begin();
687  std::vector<std::string>::const_iterator hitVecNamesEnd = m_hitVectorNames.end();
688  for (; hitVecNamesItr != hitVecNamesEnd; ++hitVecNamesItr) {
689 
690  const std::string hitVectorName(*hitVecNamesItr);
691 
692  if (m_pileUp || m_rndmEvtOverlay) {
693 
694  const TileHitVector* inputHits;
695  if (!(m_mergeSvc->retrieveSingleSubEvtData(hitVectorName, inputHits, bunchXing, iEvt))){
696  ATH_MSG_ERROR(" Tile Hit container not found for event key " << hitVectorName);
697  }
698 
699  const double SubEvtTimOffset(iEvt->time());
700 
701  if (m_rndmEvtOverlay) { // overlay code
702  if (fabs(SubEvtTimOffset) > 0.1) {
703  ATH_MSG_ERROR("Wrong time for in-time event: " << SubEvtTimOffset << " Ignoring all hits ");
704  } else {
705  ATH_MSG_DEBUG(" New HitCont. TimeOffset=" << SubEvtTimOffset << ", size =" << inputHits->size());
706  this->processHitVectorForOverlay(inputHits, nHit, eHitTot);
707  //if( m_doDigiTruth && iEvt == bSubEvents) this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_signalHits, engine);
708  }
709  } else if (m_pileUp) { // pileup code
710  bool isSignal = false;
711  if(iEvt == bSubEvents) isSignal = true;
712  this->processHitVectorForPileUp(inputHits, SubEvtTimOffset, nHit, eHitTot, isSignal);
713  }
714  } else { // no PileUp
715  //**
716  //* Get TileHits from TileHitVector
717  //**
718  const TileHitVector * inputHits = nullptr;
719  if (!(m_mergeSvc->retrieveSingleSubEvtData(hitVectorName, inputHits, bunchXing, iEvt))){
720  ATH_MSG_ERROR(" Tile Hit container not found for event key " << hitVectorName);
721  }
722 
723  this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits.get(), engine);
724  if(m_doDigiTruth) this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits_DigiHSTruth.get(), engine);
725  } // to pile-up or not
726 
727  } // end of the loop over different input hitVectorNames (normal hits and MBTS hits)
728 
729  ++iEvt;
730  if (m_rndmEvtOverlay) iEvt = eSubEvents; // in overlay skip all events except fisrt one
731  } // subEvent loop
732 
733  ATH_MSG_DEBUG("Exiting processBunchXing in TileHitVecToCntTool");
734 
735  return StatusCode::SUCCESS;
736 }
737 
739 
740  ATH_MSG_DEBUG("TileHitVecToCntTool processAllSubEvents started");
741  typedef PileUpMergeSvc::TimedList<TileHitVector>::type TimedHitContList;
742 
743  ATH_CHECK(this->createContainers());
744 
745  /* zero all counters and sums */
746  int nHit(0);
747  double eHitTot(0.0);
748 
749  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, m_randomStreamName);
750  rngWrapper->setSeed( name(), ctx );
751  CLHEP::HepRandomEngine * engine = rngWrapper->getEngine(ctx);
752 
754  auto hitVectorHandles = m_hitVectorKeys.makeHandles(ctx);
755  for (auto & inputHits : hitVectorHandles) {
756  if (!inputHits.isValid()) {
757  ATH_MSG_ERROR("Input Tile hit container is missing!");
758  return StatusCode::FAILURE;
759  }
760  const double SubEvtTimeOffset(0.0);
761  // get HitVector for this subevent
762  ATH_MSG_DEBUG(" New HitCont. TimeOffset=" << SubEvtTimeOffset << ", size =" << inputHits->size());
763  this->processHitVectorForOverlay(inputHits.cptr(), nHit, eHitTot);
764  if(m_doDigiTruth) this->processHitVectorWithoutPileUp(inputHits.cptr(), nHit, eHitTot, m_hits_DigiHSTruth.get(), engine);
765  }
766  ATH_CHECK(this->mergeEvent(ctx));
767  return StatusCode::SUCCESS;
768  }
769 
770  for (const auto& hitVectorName : m_hitVectorNames) {
771 
772  if (m_pileUp || m_rndmEvtOverlay) {
773  TimedHitContList hitContList;
774  // retrive list of pairs (time,container) from PileUp service
775  if (!(m_mergeSvc->retrieveSubEvtsData(hitVectorName, hitContList).isSuccess()) || hitContList.size() == 0) {
776  ATH_MSG_WARNING("Could not fill TimedHitContList for hit vector " << hitVectorName);
777  continue; // continue to the next hit vector
778  }
779 
780  // loop over this list
781  TimedHitContList::iterator iCont(hitContList.begin());
782  TimedHitContList::iterator iEndCont(hitContList.end());
783 
784  if (m_rndmEvtOverlay) { // overlay code
785  if (iCont != iEndCont) { // use only hits from first container
786  // get time for this subevent
787  const double SubEvtTimeOffset(iCont->first.time());
788  if (fabs(SubEvtTimeOffset) > 0.1) {
789  ATH_MSG_ERROR("Wrong time for in-time event: " << SubEvtTimeOffset << " Ignoring all hits ");
790  } else {
791  // get HitVector for this subevent
792  const TileHitVector* inputHits = &(*(iCont->second));
793  ATH_MSG_DEBUG(" New HitCont. TimeOffset=" << SubEvtTimeOffset << ", size =" << inputHits->size());
794  this->processHitVectorForOverlay(inputHits, nHit, eHitTot);
795  if(m_doDigiTruth) this->processHitVectorWithoutPileUp(inputHits, nHit, eHitTot, m_hits_DigiHSTruth.get(), engine);
796  }
797  }
798  } else if (m_pileUp) { // pileup code
799 
800  for (; iCont != iEndCont; ++iCont) {
801  // get time for this subevent
802  const double SubEvtTimeOffset(iCont->first.time());
803  // get HitVector for this subevent
804  const TileHitVector* inputHits = &(*(iCont->second));
805  ATH_MSG_VERBOSE(" New HitCont. TimeOffset=" << SubEvtTimeOffset << ", size =" << inputHits->size());
806  bool isSignal = false;
807  if(iCont == hitContList.begin() ) isSignal = true;
808  this->processHitVectorForPileUp(inputHits, SubEvtTimeOffset, nHit, eHitTot, isSignal);
809  }
810  } // loop over subevent list
811  } else { // no PileUp
812 
813  //**
814  //* Get TileHits from TileHitVector
815  //**
816  SG::ReadHandle<TileHitVector> inputHits(hitVectorName);
817  if (!inputHits.isValid()) {
818  ATH_MSG_WARNING("Hit Vector "<< hitVectorName << " not found in StoreGate");
819  continue; // continue to the next hit vector
820  }
821  this->processHitVectorWithoutPileUp(inputHits.cptr(), nHit, eHitTot, m_hits.get(), engine);
822  if(m_doDigiTruth) this->processHitVectorWithoutPileUp(inputHits.cptr(), nHit, eHitTot, m_hits_DigiHSTruth.get(), engine);
823  }
824 
825  } // end of the loop over different input hitVectorNames (normal hits and MBTS hits)
826 
827  ATH_CHECK(this->mergeEvent(ctx));
828 
829  return StatusCode::SUCCESS;
830 }
831 
832 StatusCode TileHitVecToCntTool::mergeEvent(const EventContext& ctx) {
833 
834  ATH_MSG_DEBUG("Entering mergeEvent in TileHitVecToCntTool");
835 
836  if (m_pileUp) {
837 
840  std::vector<TileHit *>::iterator iHit_DigiHSTruth = m_allHits_DigiHSTruth.begin();
841 
842  int nHitUni = 0;
843  double eHitInTime = 0.0;
844 
845  ATH_MSG_DEBUG("Hits being stored in container");
846 
847  for (; iHit != lastHit; ++iHit) {
848  TileHit *pHit = (*iHit);
849  std::unique_ptr<TileHit> pHit_DigiHSTruth;
850  if(m_doDigiTruth) pHit_DigiHSTruth = std::make_unique<TileHit>(**iHit_DigiHSTruth);
851  if (pHit->size() > 1 || pHit->energy() != 0.0) { // hit exists
852  m_hits->push_back(pHit); // store hit in container
853  if(m_doDigiTruth){
854  m_hits_DigiHSTruth->push_back(pHit_DigiHSTruth.release()); // store hit in container
855  }
856  ++nHitUni;
857  eHitInTime += pHit->energy();
858  }
859  if(m_doDigiTruth) ++iHit_DigiHSTruth;
860  }
861 
862 
863  ATH_MSG_DEBUG(" nHitUni=" << nHitUni << " eHitInTime="<< eHitInTime);
864  } else {
867  if (m_doDigiTruth) {
869  }
870  }
871  }
872 
873  if (m_run2plus) {
874  // Merge MBTS and E1 where it is needed.
875 
876  for (std::unique_ptr<TileHitCollection>& coll : *m_hits ) {
877  int frag_id = coll->identify();
878  IdentifierHash frag_hash = m_fragHashFunc(frag_id);
879  if (m_E1merged[frag_hash])
880  findAndMergeE1(coll.get(), frag_id, m_hits.get());
881  else if (m_MBTSmerged[frag_hash]) findAndMergeMBTS(coll.get(), frag_id, m_hits.get());
882  }
883  if(m_doDigiTruth){
886 
887  for (; collIt != endcollIt; ++collIt) {
888  int frag_id = (*collIt)->identify();
889  IdentifierHash frag_hash = m_fragHashFunc(frag_id);
890  if (m_E1merged[frag_hash]) findAndMergeE1((*collIt).get(), frag_id, m_hits_DigiHSTruth.get());
891  else if (m_MBTSmerged[frag_hash]) findAndMergeMBTS((*collIt).get(), frag_id, m_hits_DigiHSTruth.get());
892  }
893  }
894  }
895 
896  //photoelectron statistics.
897  //loop over all hits in TileHitContainer and take energy deposited in certain period of time
898  //std::vector<std::string>::const_iterator hitVecNamesEnd = m_hitVectorNames.end();
899 
900  ATHRNG::RNGWrapper* rngWrapper = m_rndmSvc->getEngine(this, m_randomStreamName);
901  CLHEP::HepRandomEngine * engine = rngWrapper->getEngine(ctx);
902 
904  ATH_CHECK( samplingFraction.isValid() );
905 
906  TileHitNonConstContainer::iterator collIt_DigiHSTruth;
907  TileHitNonConstContainer::iterator endColl_DigiHSTruth;
908  if(m_doDigiTruth) {
909  collIt_DigiHSTruth = m_hits_DigiHSTruth->begin();
910  endColl_DigiHSTruth = m_hits_DigiHSTruth->end();
911  }
912 
913  for (std::unique_ptr<TileHitCollection>& coll : *m_hits ) {
914  TileHitCollection* coll_DigiHSTruth;
915  TileHitCollection::iterator hitItr_DigiHSTruth;
916  TileHitCollection::iterator hitEnd_DigiHSTruth;
917  if(m_doDigiTruth) {
918  coll_DigiHSTruth = (*collIt_DigiHSTruth).get();
919  hitItr_DigiHSTruth = coll_DigiHSTruth->begin();
920  hitEnd_DigiHSTruth = coll_DigiHSTruth->end();
921  }
922 
923  HWIdentifier drawer_id = m_tileHWID->drawer_id(coll->identify());
924  int ros = m_tileHWID->ros(drawer_id);
925  int drawer = m_tileHWID->drawer(drawer_id);
926  int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
927 
928  for (TileHit* pHit : *coll) {
929  double ehit = 0.0;
930  int hitsize = pHit->size();
931  for (int i = 0; i < hitsize; ++i) {
932  double thit = pHit->time(i);
933  if (fabs(thit) < m_photoStatisticsWindow) ehit += pHit->energy(i);
934  }
935 
936  Identifier pmt_id = pHit->pmt_ID();
937  //HWIdentifier channel_id = (*hitItr)->pmt_HWID();
938  // for gap/crack scintillators
939  if (m_tileID->sample(pmt_id) == 3) {
940  pmt_id = m_tileID->pmt_id(m_tileID->cell_id(pmt_id), 0);
941  //channel_id = m_cabling->s2h_channel_id(pmt_id);
942  }
943 
944  double scaleFactor = 1.0;
945  if (m_usePhotoStatistics) {
946  scaleFactor = applyPhotoStatistics(ehit, pmt_id, engine, *samplingFraction, drawerIdx);
947  pHit->scale(scaleFactor);
948  }
949 
950  if(m_doDigiTruth){
951  TileHit *pHit_DigiHSTruth = (*hitItr_DigiHSTruth);
952  pHit_DigiHSTruth->scale(scaleFactor);
953 
954  ++hitItr_DigiHSTruth;
955  }
956  }
957 
958  if(m_doDigiTruth) ++collIt_DigiHSTruth;
959  }
960 
961 
962 
963  /* Register the set of TileHits to the event store. */
964  auto hits = std::make_unique<TileHitContainer>
966  size_t hashId = 0;
967  for (std::unique_ptr<TileHitCollection>& coll : *m_hits ) {
968  CHECK(hits->addCollection (coll.release(), hashId++));
969  }
970 
972  ATH_CHECK( hitContainer.record(std::move(hits)) );
973 
974  ATH_MSG_DEBUG("TileHit container registered to the TES with name" << m_hitContainerKey.key());
975 
976  // if (m_skipNoHit && nHit==0) {
977  // setFilterPassed(false);
978  // ATH_MSG_DEBUG ( " No hits, skip this event " );
979  // }
980 
981  if(m_doDigiTruth){
982  auto hits_DigiHSTruth = std::make_unique<TileHitContainer>
984  size_t hashId_DigiHSTruth = 0;
985  for (std::unique_ptr<TileHitCollection>& coll : *m_hits_DigiHSTruth ) {
986  ATH_CHECK(hits_DigiHSTruth->addCollection (coll.release(), hashId_DigiHSTruth++));
987  }
988 
990  ATH_CHECK( hitContainer_DigiHSTruth.record(std::move(hits_DigiHSTruth)) );
991  }
992 
993  ATH_MSG_DEBUG("Exiting mergeEvent in TileHitVecToCntTool");
994  return StatusCode::SUCCESS;
995 }
996 
998 
999  ATH_MSG_DEBUG("Finalizing TileHitVecToCntTool");
1000 
1001  if (m_pileUp) {
1004  for (; iHit != lastHit; ++iHit) {
1005  delete (*iHit);
1006  }
1007  if(m_doDigiTruth){
1008  iHit = m_allHits_DigiHSTruth.begin();
1009  lastHit = m_allHits_DigiHSTruth.end();
1010  for (; iHit != lastHit; ++iHit) {
1011  delete (*iHit);
1012  }
1013  }
1014  }
1015 
1016  ATH_MSG_DEBUG("TileHitVecToCntTool finalized");
1017 
1018  return StatusCode::SUCCESS;
1019 
1020 }
1021 
1022 double TileHitVecToCntTool::applyPhotoStatistics(double energy, Identifier pmt_id, CLHEP::HepRandomEngine* engine,
1023  const TileSamplingFraction* samplingFraction, int drawerIdx) {
1024 
1026  // take number of photoelectrons per GeV divide by 1000 to go to MeV
1027  // and multiply by inverted sampling fraction (about 36, depends on G4 version, sampling and eta)
1028  // to get number of photoelectrons per 1 MeV energy in scintillator
1029  float nPhotoElectrons = samplingFraction->getNumberOfPhotoElectrons(drawerIdx, channel)
1030  / (Gaudi::Units::GeV / Gaudi::Units::MeV) * samplingFraction->getSamplingFraction(drawerIdx, channel);
1031 
1032  nPhotoElectrons = std::round(nPhotoElectrons * 1000) / 1000;
1033 
1034  double pe = energy * nPhotoElectrons;
1035  double pe_scale = 1., RndmPois = 1.;
1036 
1037  switch (m_photoElectronStatistics) {
1038  case 2:
1039  if (pe > 20.0) {
1040  RndmPois = std::max(0.0, RandGaussQ::shoot(engine, pe, sqrt(pe))); // FIXME CLHEP::RandGaussZiggurat is faster and more accurate.
1041  pe_scale = RndmPois / pe;
1042  } else { // pe<=20
1043 
1044  if (pe > 0.) {
1045  double singleMEAN = 1.0; //Parameterization of monoelectron spectra
1046  double singleSIGMA = 1.0;
1047  RndmPois = RandPoissonT::shoot(engine, pe);
1048 
1049  if (RndmPois > 0) {
1050  pe_scale = 0;
1051  for (int i = 0; i < RndmPois; i++)
1052  pe_scale += 1 / (1.08332) * std::max(0., RandGaussQ::shoot(engine, singleMEAN, singleSIGMA)); // FIXME CLHEP::RandGaussZiggurat is faster and more accurate.
1053 
1054  pe_scale /= RndmPois;
1055  } else
1056  pe_scale = 0; //RndmPois==0
1057  }
1058  }
1059  break;
1060 
1061  case 0:
1062  if (pe > 0.0) {
1063  RndmPois = RandPoissonT::shoot(engine, pe);
1064  pe_scale = RndmPois / pe;
1065  }
1066  break;
1067 
1068  case 1:
1069  if (pe > 0.0) {
1070  if (pe > 10.0) {
1071  RndmPois = std::max(0.0, RandGaussQ::shoot(engine, pe, sqrt(pe))); // FIXME CLHEP::RandGaussZiggurat is faster and more accurate.
1072  } else {
1073  int nn = std::max(10, (int) (pe * 10.0));
1074  double * ProbFunc = new double[nn];
1075  ProbFunc[0] = exp(-pe);
1076  for (int i = 1; i < nn; ++i) {
1077  ProbFunc[i] = ProbFunc[i - 1] * pe / i;
1078  }
1079  RandGeneral* RandG = new RandGeneral(ProbFunc, nn, 0);
1080  RndmPois = RandG->shoot(engine) * nn;
1081  //here RndmPois is continuously distributed random value obtained from Poisson
1082  //distribution by approximation.
1083  delete RandG;
1084  delete[] ProbFunc;
1085  }
1086  pe_scale = RndmPois / pe;
1087  }
1088  break;
1089  } //end switch(m_PhElStat)
1090 
1091  ATH_MSG_VERBOSE( "PhotoElec: id=" << m_tileID->to_string(pmt_id,-1)
1092  << " totEne=" << energy
1093  << ", numPhElec=" << nPhotoElectrons
1094  << ", pe=" << pe
1095  << ", rndmPoisson=" << RndmPois
1096  << ", pe_scale=" << pe_scale);
1097 
1098  return pe_scale;
1099 }
1100 
1101 
1103  int module = frag_id & 0x3F;
1104 
1105  TileHitCollection::iterator hitIt = coll->begin();
1106  TileHitCollection::iterator endHitIt = coll->end();
1107 
1108  TileHitCollection::iterator fromHitIt = coll->end();
1109  TileHit* toHit(0);
1110 
1111  for (; hitIt != endHitIt; ++hitIt) {
1112  Identifier pmt_id = (*hitIt)->pmt_ID();
1113  if (m_tileID->tower(pmt_id) == E1_TOWER && m_tileID->sample(pmt_id) == TileID::SAMP_E) {
1114  if (module == m_tileID->module(pmt_id)) {
1115  toHit = *hitIt;
1116  } else {
1117  fromHitIt = hitIt; // need iterator to delete this hit later.
1118  }
1119  }
1120  }
1121 
1122  if (fromHitIt != coll->end()) {
1123  ATH_MSG_VERBOSE("Found TileHit (E1 cell) for merging [" << m_tileID->to_string((*fromHitIt)->pmt_ID(), -1)
1124  << "] in module: " << module);
1125  bool isToHitNew = false;
1126  if (toHit == 0) {
1127  int side = m_tileID->side((*fromHitIt)->pmt_ID());
1129  toHit = new TileHit(to_pmt_id);
1130  isToHitNew = true;
1131  ATH_MSG_VERBOSE("New TileHit (E1 cell) for merging added Id: " << m_tileID->to_string(toHit->pmt_ID(), -1) );
1132  } else {
1133  ATH_MSG_VERBOSE("Found TileHit (E1 cell) for merging Id: " << m_tileID->to_string(toHit->pmt_ID(), -1) );
1134  }
1135 
1136  ATH_MSG_DEBUG( "TileHit (E1 cell) Id: " << m_tileID->to_string((*fromHitIt)->pmt_ID(), -1)
1137  << " will be merged to " << m_tileID->to_string(toHit->pmt_ID(), -1) );
1138 
1139  if (msgLvl(MSG::VERBOSE)) {
1140  msg(MSG::VERBOSE) << "Before merging (E1 cell) => " << (std::string) (**fromHitIt) << endmsg;
1141  msg(MSG::VERBOSE) << "Before merging (E1 cell) => " << (std::string) (*toHit) << endmsg;
1142  }
1143 
1144  toHit->add(*fromHitIt, 0.1);
1145 
1146  if (msgLvl(MSG::VERBOSE)) {
1147  msg(MSG::VERBOSE) << "After merging (E1 cell) => " << (std::string) (*toHit) << endmsg;
1148  msg(MSG::VERBOSE) << "TileHit to be deleted Id (E1 cell): " << m_tileID->to_string((*fromHitIt)->pmt_ID(), -1) << endmsg;
1149  }
1150 
1151  coll->erase(fromHitIt);
1152 
1153  if (isToHitNew) {
1154  hitCont->push_back(toHit);
1155  }
1156  }
1157 }
1158 
1159 
1161  int module = frag_id & 0x3F;
1162 
1163  TileHitCollection::iterator hitIt = coll->begin();
1164  TileHitCollection::iterator endHitIt = coll->end();
1165 
1166  TileHitCollection::iterator fromHitIt = coll->end();
1167  TileHit* toHit(0);
1168 
1169  for (; hitIt != endHitIt; ++hitIt) {
1170  Identifier pmt_id = (*hitIt)->pmt_ID();
1171  if (m_tileTBID->is_tiletb(pmt_id)) {
1172  if (m_tileTBID->phi(pmt_id) % 2 == 0) {
1173  toHit = *hitIt;
1174  } else {
1175  fromHitIt = hitIt; // need iterator to delete this hit later.
1176  }
1177  }
1178  }
1179 
1180  if (fromHitIt != coll->end()) {
1181  ATH_MSG_VERBOSE("Found TileHit (MBTS) for merging [" << m_tileTBID->to_string((*fromHitIt)->pmt_ID(), 0)
1182  << "] in module: " << module);
1183  bool isToHitNew = false;
1184  if (toHit == 0) {
1185  int side = m_tileTBID->side((*fromHitIt)->pmt_ID());
1186  int phi = m_tileTBID->phi((*fromHitIt)->pmt_ID()) - 1;
1187  Identifier to_pmt_id = m_tileTBID->channel_id(side, phi, 1);
1188  toHit = new TileHit(to_pmt_id);
1189  isToHitNew = true;
1190  ATH_MSG_VERBOSE("New TileHit (MBTS) for merging added Id: " << m_tileTBID->to_string(toHit->pmt_ID(), 0) );
1191  } else {
1192  ATH_MSG_VERBOSE("Found TileHit (MBTS) for merging Id: " << m_tileTBID->to_string(toHit->pmt_ID(), 0) );
1193  }
1194 
1195  ATH_MSG_DEBUG( "TileHit (MBTS) Id: " << m_tileTBID->to_string((*fromHitIt)->pmt_ID(), 0)
1196  << " will be merged to " << m_tileTBID->to_string(toHit->pmt_ID(), 0) );
1197 
1198  if (msgLvl(MSG::VERBOSE)) {
1199  msg(MSG::VERBOSE) << "Before merging (MBTS) => " << (std::string) (**fromHitIt) << endmsg;
1200  msg(MSG::VERBOSE) << "Before merging (MBTS) => " << (std::string) (*toHit) << endmsg;
1201  }
1202 
1203  toHit->add(*fromHitIt, 0.1);
1204 
1205  if (msgLvl(MSG::VERBOSE)) {
1206  msg(MSG::VERBOSE) << "After merging (MBTS) => " << (std::string) (*toHit) << endmsg;
1207  msg(MSG::VERBOSE) << "TileHit to be deleted Id (MBTS): "
1208  << m_tileTBID->to_string((*fromHitIt)->pmt_ID(), 0) << endmsg;
1209  }
1210 
1211  coll->erase(fromHitIt);
1212 
1213  if (isToHitNew) {
1214  hitCont->push_back(toHit);
1215  }
1216  }
1217 }
1218 
1219 void TileHitVecToCntTool::findAndMergeMultipleHitsInChannel(std::unique_ptr<TileHitNonConstContainer>& hitCont) {
1220  for (std::unique_ptr<TileHitCollection>& coll : *hitCont) {
1221 
1222  int frag_id = coll->identify();
1223  int module = frag_id & 0x3F;
1224  IdentifierHash frag_hash = m_fragHashFunc(frag_id);
1225  std::vector<TileHit*> hits(48, nullptr);
1226  std::vector<std::unique_ptr<TileHit>> otherModuleHits;
1227  coll->erase(std::remove_if(coll->begin(), coll->end(),
1228  [this, &hits, &otherModuleHits, module, frag_hash] (TileHit* hit) {
1229  Identifier pmt_id = hit->pmt_ID();
1230  int channel = m_tileHWID->channel(hit->pmt_HWID());
1231  TileHit* channelHit = hits[channel];
1232  if (channelHit) {
1233  mergeExtraHitToChannelHit(hit, channelHit);
1234  return true;
1235  } else if (m_run2plus // Special case for merged E1 and MBTS in Run 2+ geometries, which will be merged finally correctly later
1236  && ((m_E1merged[frag_hash] && m_tileID->module(pmt_id) != module
1237  && m_tileID->tower(pmt_id) == E1_TOWER && m_tileID->sample(pmt_id) == TileID::SAMP_E) // Merged E1 in Run 2+ from other module
1238  || (m_MBTSmerged[frag_hash] && m_tileTBID->is_tiletb(pmt_id) && (m_tileTBID->phi(pmt_id) % 2 == 1)))) { // Merged MBTS in Run 2+ from other module
1239  otherModuleHits.push_back(std::make_unique<TileHit>(*hit));
1240  return true;
1241  } else {
1242  hits[channel] = hit;
1243  return false;
1244  }}),
1245  coll->end());
1246 
1247  for (std::unique_ptr<TileHit>& hit : otherModuleHits) {
1248  int channel = m_tileHWID->channel(hit->pmt_HWID());
1249  TileHit* channelHit = hits[channel];
1250  if (channelHit) {
1251  mergeExtraHitToChannelHit(hit.get(), channelHit);
1252  } else {
1253  hits[channel] = hit.get();
1254  coll->push_back(std::move(hit));
1255  }
1256  }
1257  }
1258 }
1259 
1261 
1262  ATH_MSG_DEBUG("Found extra hit for channel Id: "
1263  << m_tileID->to_string(extraHit->pmt_ID(), -1) << ", will be merged to "
1264  << m_tileID->to_string(channelHit->pmt_ID(), -1));
1265  ATH_MSG_VERBOSE("Before merging => " << (std::string) (*extraHit));
1266  ATH_MSG_VERBOSE("Before merging => " << (std::string) (*channelHit));
1267 
1268  channelHit->add(extraHit, 0.1);
1269 
1270  ATH_MSG_VERBOSE("After merging => " << (std::string) (*channelHit));
1271 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TileHit::scale
void scale(float coeff)
Scale energy of all sub-hits in a hit
Definition: TileHit.cxx:117
TileHitVecToCntTool::N_E4PRIME_CELLS
static const int N_E4PRIME_CELLS
Definition: TileHitVecToCntTool.h:184
TileHit::identify
Identifier identify(void) const
Return logical ID of the pmt.
Definition: TileSimEvent/TileSimEvent/TileHit.h:76
TileHitVecToCntTool::m_cabling
const TileCablingService * m_cabling
Definition: TileHitVecToCntTool.h:190
TileSamplingFraction::getSamplingFraction
float getSamplingFraction(unsigned int drawerIdx, unsigned int channel) const
Return Tile Calorimeter sampling fraction.
Definition: TileSamplingFraction.h:53
ATHRNG::RNGWrapper::setSeed
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition: RNGWrapper.h:169
TileTBID::channel_id
Identifier channel_id(int type, int module, int channel) const
identifer for one channel of a Tile testbeam detector
Definition: TileTBID.cxx:197
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
TileHitVecToCntTool::createContainers
StatusCode createContainers()
Definition: TileHitVecToCntTool.cxx:239
TileTBID::to_string
std::string to_string(const Identifier &id, int level=0) const
extract all fields from TileTB identifier Identifier get_all_fields ( const Identifier & id,...
Definition: TileTBID.cxx:49
TileHitVecToCntTool::E4_N_PHI
static const int E4_N_PHI
Definition: TileHitVecToCntTool.h:183
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
TileHitVecToCntTool::m_hitContainer_DigiHSTruthKey
SG::WriteHandleKey< TileHitContainer > m_hitContainer_DigiHSTruthKey
Definition: TileHitVecToCntTool.h:118
TileHitVecToCntTool::m_hitContainerKey
SG::WriteHandleKey< TileHitContainer > m_hitContainerKey
Definition: TileHitVecToCntTool.h:115
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
TileTBID::is_tiletb
bool is_tiletb(const Identifier &id) const
Test ID if it is TileTBID.
Definition: TileTBID.cxx:87
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TileHitVecToCntTool::E4_SIDE
static const int E4_SIDE
Definition: TileHitVecToCntTool.h:181
TileHitVecToCntTool::m_samplingFractionKey
SG::ReadCondHandleKey< TileSamplingFraction > m_samplingFractionKey
Name of TileSamplingFraction in condition store.
Definition: TileHitVecToCntTool.h:124
AthMsgStreamMacros.h
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
TileHitVecToCntTool::m_tileTBID
const TileTBID * m_tileTBID
Pointer to TileID helper.
Definition: TileHitVecToCntTool.h:161
TileHitVecConstIterator
AtlasHitsVector< TileHit >::const_iterator TileHitVecConstIterator
Definition: TileHitVector.h:30
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
TileHitVecToCntTool::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: TileHitVecToCntTool.h:158
TileHitVecToCntTool::initialize
StatusCode initialize() override final
Definition: TileHitVecToCntTool.cxx:51
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
AtlasHitsVector
Definition: AtlasHitsVector.h:33
Tile_Base_ID::side
int side(const Identifier &id) const
Definition: Tile_Base_ID.cxx:153
TileHitVecToCntTool::m_hitVectorNames
std::vector< std::string > m_hitVectorNames
Definition: TileHitVecToCntTool.h:113
Tile_Base_ID::sample
int sample(const Identifier &id) const
Definition: Tile_Base_ID.cxx:171
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:206
TileHitVecToCntTool::m_pileUp
Gaudi::Property< bool > m_pileUp
if true => pileup mode is activated
Definition: TileHitVecToCntTool.h:129
TileHitVecToCntTool::m_timeFlag
Gaudi::Property< int > m_timeFlag
special options to deal with times of hits for cosmics and TB
Definition: TileHitVecToCntTool.h:133
TileHitVecToCntTool::processBunchXing
virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final
Definition: TileHitVecToCntTool.cxx:667
TileHitVecToCntTool::m_mbtsOffset
int m_mbtsOffset
Definition: TileHitVecToCntTool.h:173
DataVector::get
const T * get(size_type n) const
Access an element, as an rvalue.
TileHitVecToCntTool::TileHitVecToCntTool
TileHitVecToCntTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: TileHitVecToCntTool.cxx:44
TileHitVecToCntTool::m_hits_DigiHSTruth
std::unique_ptr< TileHitNonConstContainer > m_hits_DigiHSTruth
pointer to hits container
Definition: TileHitVecToCntTool.h:171
TileHWID::frag
int frag(const HWIdentifier &id) const
extract frag field from HW identifier
Definition: TileHWID.h:181
TileHWID::drawer_hash_max
size_type drawer_hash_max(void) const
drawer hash table max size
Definition: TileHWID.h:268
Tile_Base_ID::GAPDET
@ GAPDET
Definition: Tile_Base_ID.h:48
TileCalibUtils.h
Tile_Base_ID::tower
int tower(const Identifier &id) const
Definition: Tile_Base_ID.cxx:165
TileHitVecToCntTool::m_inputKeys
StringArrayProperty m_inputKeys
vector with the names of TileHitVectors to use
Definition: TileHitVecToCntTool.h:110
Tile_Base_ID::SAMP_E
@ SAMP_E
Definition: Tile_Base_ID.h:55
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
TileHitVecToCntTool::m_mergeMultipleHitsInChannel
Gaudi::Property< bool > m_mergeMultipleHitsInChannel
Definition: TileHitVecToCntTool.h:153
TileHitCollection
Definition: TileHitCollection.h:12
TileTBID::type
int type(const Identifier &id) const
extract type field from TileTB identifier
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:146
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
TileHitVecToCntTool::processHitVectorForOverlay
void processHitVectorForOverlay(const TileHitVector *inputHits, int &nHit, double &eHitTot)
Definition: TileHitVecToCntTool.cxx:289
HWIdentifier
Definition: HWIdentifier.h:13
AtlasHitsVector::begin
const_iterator begin() const
Definition: AtlasHitsVector.h:131
LArG4AODNtuplePlotter.pe
pe
Definition: LArG4AODNtuplePlotter.py:116
TileHitVecToCntTool::m_hitVectorKeys
SG::ReadHandleKeyArray< TileHitVector > m_hitVectorKeys
Definition: TileHitVecToCntTool.h:112
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
TileHit::size
int size(void) const
Return length of energy/time vectors
Definition: TileSimEvent/TileSimEvent/TileHit.h:94
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
ReadCondHandle.h
TileTBID::module
int module(const Identifier &id) const
extract module field from TileTB identifier
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:150
TileHWID::channel
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
Definition: TileHWID.h:189
TileHitVecToCntTool::m_useTriggerTime
Gaudi::Property< bool > m_useTriggerTime
if true => take trigger time from external tool or from m_triggerTime
Definition: TileHitVecToCntTool.h:147
TileID.h
TileDetDescrManager.h
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TileHWID::ros
int ros(const HWIdentifier &id) const
extract ros field from HW identifier
Definition: TileHWID.h:167
PileUpMergeSvc::TimedList::type
std::list< value_t > type
type of the collection of timed data object
Definition: PileUpMergeSvc.h:75
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
TRT::Hit::side
@ side
Definition: HitInfo.h:83
TileHitVecToCntTool::m_cablingSvc
ServiceHandle< TileCablingSvc > m_cablingSvc
Definition: TileHitVecToCntTool.h:189
TileSamplingFraction::getNumberOfPhotoElectrons
float getNumberOfPhotoElectrons(unsigned int drawerIdx, unsigned int channel) const
Return number of photoelectrons per 1 GeV in Tile Calorimeter scintilator.
Definition: TileSamplingFraction.h:58
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.PyAthena.module
module
Definition: PyAthena.py:131
TileHitVecToCntTool::processHitVectorWithoutPileUp
void processHitVectorWithoutPileUp(const TileHitVector *inputHits, int &nHit, double &eHitTot, TileHitNonConstContainer *hitCont, CLHEP::HepRandomEngine *engine)
Definition: TileHitVecToCntTool.cxx:471
TileHitVecToCntTool::m_run2plus
bool m_run2plus
if true => RUN2+ geometry with merged E1 (and E4' in RUN2)
Definition: TileHitVecToCntTool.h:128
TileHitVecToCntTool::N_MBTS_CELLS
static const int N_MBTS_CELLS
Definition: TileHitVecToCntTool.h:177
WriteHandle.h
Handle class for recording to StoreGate.
TileHitVecToCntTool::m_run2
bool m_run2
if true => RUN2 geometry with E4' and merged E1
Definition: TileHitVecToCntTool.h:127
TileTBID.h
TileCablingService::isRun2PlusCabling
bool isRun2PlusCabling() const
Definition: TileCablingService.h:278
Tile_Base_ID::get_id
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const
create compact id from hash id (return == 0 for OK)
Definition: Tile_Base_ID.cxx:1077
TileHWID.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TileRawDataNonConstContainer< TileHitCollection >::iterator
std::vector< std::unique_ptr< TileHitCollection > >::iterator iterator
Definition: TileRawDataNonConstContainer.h:42
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
Tile_Base_ID::module
int module(const Identifier &id) const
Definition: Tile_Base_ID.cxx:159
TileHitVecToCntTool::m_usePhotoStatistics
Gaudi::Property< bool > m_usePhotoStatistics
Definition: TileHitVecToCntTool.h:151
TileCablingService.h
TileSamplingFraction
Condition object to keep and provide Tile Calorimeter sampling fraction and number of photoelectrons.
Definition: TileSamplingFraction.h:16
TileHit::reserve
void reserve(int len)
Reserve length of energy and time vectors in a hit
Definition: TileSimEvent/TileSimEvent/TileHit.h:69
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
lumiFormat.i
int i
Definition: lumiFormat.py:85
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
TileTBID::channel_context
IdContext channel_context(void) const
idContext for channels
Definition: TileTBID.cxx:315
TileHitVecToCntTool::m_tileHWID
const TileHWID * m_tileHWID
Pointer to TileID helper.
Definition: TileHitVecToCntTool.h:162
TileHitVecToCntTool::mergeEvent
virtual StatusCode mergeEvent(const EventContext &ctx) override final
Definition: TileHitVecToCntTool.cxx:832
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TileHitVecToCntTool::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number generator engine to use.
Definition: TileHitVecToCntTool.h:164
TileHitVecToCntTool::m_onlyUseContainerName
Gaudi::Property< bool > m_onlyUseContainerName
Definition: TileHitVecToCntTool.h:109
TileHitVecToCntTool::m_rndmEvtOverlay
Gaudi::Property< bool > m_rndmEvtOverlay
If true => overlay with random event (zero-luminosity pile-up)
Definition: TileHitVecToCntTool.h:145
TileHitVecToCntTool::m_deltaT
Gaudi::Property< double > m_deltaT
minimal time granularity for TileHit
Definition: TileHitVecToCntTool.h:131
TileHitVecToCntTool::findAndMergeMultipleHitsInChannel
void findAndMergeMultipleHitsInChannel(std::unique_ptr< TileHitNonConstContainer > &hitCont)
Definition: TileHitVecToCntTool.cxx:1219
TileHitVecToCntTool::m_fragHashFunc
TileFragHash m_fragHashFunc
Definition: TileHitVecToCntTool.h:191
TileHit::add
int add(float energy, float time)
Add sub-hit to a given hit.
Definition: TileHit.cxx:74
createCoolChannelIdFile.channel_id
channel_id
Definition: createCoolChannelIdFile.py:52
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TileHitVecToCntTool::prepareEvent
virtual StatusCode prepareEvent(const EventContext &ctx, unsigned int) override final
Definition: TileHitVecToCntTool.cxx:275
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TileHitVecToCntTool::m_triggerTimeTool
PublicToolHandle< ITriggerTime > m_triggerTimeTool
tool to take the time from
Definition: TileHitVecToCntTool.h:155
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileHitVecToCntTool::mergeExtraHitToChannelHit
void mergeExtraHitToChannelHit(TileHit *extraHit, TileHit *channelHit)
Definition: TileHitVecToCntTool.cxx:1260
TileCablingService::isRun2Cabling
bool isRun2Cabling() const
Definition: TileCablingService.h:277
TileFragHash::initialize
void initialize(const TileHWID *tileHWID, TYPE type=Default)
Definition: TileFragHash.cxx:23
TileTBID::channel
int channel(const Identifier &id) const
extract channel field from TileTB identifier
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:154
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
PileUpToolBase
Definition: PileUpToolBase.h:18
Tile_Base_ID::get_hash
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const
create hash id from compact id (return == 0 for OK)
Definition: Tile_Base_ID.cxx:1151
TileHitVecToCntTool::findAndMergeMBTS
void findAndMergeMBTS(TileHitCollection *coll, int frag_id, TileHitNonConstContainer *hitCont)
Definition: TileHitVecToCntTool.cxx:1160
TileHitVecToCntTool::processAllSubEvents
virtual StatusCode processAllSubEvents(const EventContext &ctx) override final
Definition: TileHitVecToCntTool.cxx:738
TileRawDataNonConstContainer::push_back
void push_back(element_t *rc)
Definition: TileRawDataNonConstContainer.h:68
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
TileHitVecToCntTool::e4pr_index
int e4pr_index(int phi) const
Definition: TileHitVecToCntTool.h:185
TileHitVecToCntTool::mbts_index
int mbts_index(int side, int phi, int eta) const
Definition: TileHitVecToCntTool.h:178
TileHitVecToCntTool::m_hits
std::unique_ptr< TileHitNonConstContainer > m_hits
pointer to hits container
Definition: TileHitVecToCntTool.h:170
TileHitVecToCntTool::m_allHits
std::vector< TileHit * > m_allHits
vector for all TileHits
Definition: TileHitVecToCntTool.h:168
TileHWID::drawer_id
HWIdentifier drawer_id(int frag) const
ROS HWIdentifer.
Definition: TileHWID.cxx:187
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TileCablingService::is_MBTS_merged_run2plus
bool is_MBTS_merged_run2plus(int module) const
Definition: TileCablingService.cxx:2453
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
TileHitVecToCntTool::m_maxHitTime
Gaudi::Property< double > m_maxHitTime
all sub-hits with time above m_maxHitTime will be ignored
Definition: TileHitVecToCntTool.h:137
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TileHitVecToCntTool::m_allHits_DigiHSTruth
std::vector< TileHit * > m_allHits_DigiHSTruth
vector for all TileHits
Definition: TileHitVecToCntTool.h:169
TileHitVecToCntTool::N_ETA
static const int N_ETA
Definition: TileHitVecToCntTool.h:176
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TileHit
Definition: TileSimEvent/TileSimEvent/TileHit.h:30
ATHRNG::RNGWrapper::getEngine
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition: RNGWrapper.h:134
RNGWrapper.h
Tile_Base_ID::pmt_hash_max
size_type pmt_hash_max(void) const
Definition: Tile_Base_ID.cxx:1318
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
TileHitNonConstContainer
This is a minimal version of a TileHitContainer in which the saved collections remain non-const.
Definition: TileHitNonConstContainer.h:31
TileHitVecToCntTool::m_MBTSmerged
std::vector< bool > m_MBTSmerged
Definition: TileHitVecToCntTool.h:193
TileHitVecToCntTool::m_photoStatisticsWindow
Gaudi::Property< double > m_photoStatisticsWindow
sum up energy in [-m_photoStatWindow,+m_photoStatWindow] and use it for photostatistics
Definition: TileHitVecToCntTool.h:139
TileHWID::drawer
int drawer(const HWIdentifier &id) const
extract drawer field from HW identifier
Definition: TileHWID.h:171
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
TileHit::pmt_HWID
HWIdentifier pmt_HWID(void) const
Return pmt hardware ID (== channel ID)
Definition: TileHit.cxx:125
Tile_Base_ID::to_string
std::string to_string(const Identifier &id, int level=0) const
Definition: Tile_Base_ID.cxx:52
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TileHit::energy
float energy(int ind=0) const
Return energy of ind-th sub-hit
Definition: TileSimEvent/TileSimEvent/TileHit.h:90
TileHitVecToCntTool::m_doDigiTruth
Gaudi::Property< bool > m_doDigiTruth
Definition: TileHitVecToCntTool.h:149
Tile_Base_ID::pmt_id
Identifier pmt_id(const Identifier &any_id) const
Definition: Tile_Base_ID.cxx:640
AtlasHitsVector::end
const_iterator end() const
Definition: AtlasHitsVector.h:134
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
TileHit::setTime
void setTime(float t, int ind=0)
Set time of ind-th sub-hit in a hit
Definition: TileSimEvent/TileSimEvent/TileHit.h:65
TileHitVecToCntTool::E4_ETA
static const int E4_ETA
Definition: TileHitVecToCntTool.h:182
TileHitVecToCntTool::m_photoElectronStatistics
Gaudi::Property< int > m_photoElectronStatistics
photoelectron statistics type: 0 - Poisson, 1 - "new" Poisson + Gauss, 2 - Poisson->Gauss
Definition: TileHitVecToCntTool.h:141
TileHitVecToCntTool::findAndMergeE1
void findAndMergeE1(TileHitCollection *coll, int frag_id, TileHitNonConstContainer *hitCont)
Definition: TileHitVecToCntTool.cxx:1102
Tile_Base_ID::pmt_context
IdContext pmt_context(void) const
id for PMTs
Definition: Tile_Base_ID.cxx:1065
AtlasHitsVector::size
size_type size() const
Definition: AtlasHitsVector.h:143
TileTBID::phi
int phi(const Identifier &id) const
extract phi field from MBTS identifier
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:165
SubEventIterator
std::vector< xAOD::EventInfo::SubEvent >::const_iterator SubEventIterator
Definition: IPileUpTool.h:22
TileCalibUtils::getDrawerIdx
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
Definition: TileCalibUtils.cxx:60
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
TileHitVecToCntTool::processHitVectorForPileUp
void processHitVectorForPileUp(const TileHitVector *inputHits, double SubEvtTimOffset, int &nHit, double &eHitTot, bool isSignal=false)
Definition: TileHitVecToCntTool.cxx:335
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
DataVector::erase
iterator erase(iterator position)
Remove element at a given position.
TileHitVecToCntTool::m_tileID
const TileID * m_tileID
Pointer to TileID helper.
Definition: TileHitVecToCntTool.h:160
Tile_Base_ID::cell_id
Identifier cell_id(const Identifier &any_id) const
Definition: Tile_Base_ID.cxx:581
TileHit::time
float time(int ind=0) const
Return time of ind-th sub-hit
Definition: TileSimEvent/TileSimEvent/TileHit.h:92
TileHitVecToCntTool::E1_TOWER
@ E1_TOWER
Definition: TileHitVecToCntTool.h:194
error
Definition: IImpactPoint3dEstimator.h:70
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
TileHitVecToCntTool::m_randomStreamName
Gaudi::Property< std::string > m_randomStreamName
Random Stream Name.
Definition: TileHitVecToCntTool.h:166
TileHitVecToCntTool::m_E1merged
std::vector< bool > m_E1merged
Definition: TileHitVecToCntTool.h:192
TileHit::setZero
void setZero()
Resize energy/time vectors in a hit to one and set energy/time to zero
Definition: TileSimEvent/TileSimEvent/TileHit.h:71
TileHitVecToCntTool.h
TileCablingService::E1_merged_with_run2plus
int E1_merged_with_run2plus(int ros, int module) const
Definition: TileCablingService.cxx:2457
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
TileHitVecToCntTool::finalize
StatusCode finalize() override final
Definition: TileHitVecToCntTool.cxx:997
ITriggerTime.h
interface to a tool that returns the time offset of the current trigger. Used by PileUpMergeSvc
TileHitVecToCntTool::N_PHI
static const int N_PHI
Definition: TileHitVecToCntTool.h:175
TileHit::pmt_ID
Identifier pmt_ID(void) const
Return logical ID of the pmt.
Definition: TileSimEvent/TileSimEvent/TileHit.h:78
TileHitVecToCntTool::m_triggerTime
Gaudi::Property< double > m_triggerTime
fixed trigger time value (default=0)
Definition: TileHitVecToCntTool.h:135
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
TileTBID::side
int side(const Identifier &id) const
define synonyms for minimum bias scintillators
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:161
TileHitVecToCntTool::applyPhotoStatistics
double applyPhotoStatistics(double energy, Identifier pmt_id, CLHEP::HepRandomEngine *engine, const TileSamplingFraction *samplingFraction, int drawerIdx)
Definition: TileHitVecToCntTool.cxx:1022
TileCablingService::s2h_channel_id
HWIdentifier s2h_channel_id(const Identifier &id) const
Definition: TileCablingService.cxx:1076
IAthRNGSvc.h
TileHitVecToCntTool::N_SIDE
static const int N_SIDE
Definition: TileHitVecToCntTool.h:174
Identifier
Definition: IdentifierFieldParser.cxx:14