CMS 3D CMS Logo

HGCDigitizer.cc
Go to the documentation of this file.
21 #include <algorithm>
22 #include <boost/foreach.hpp>
24 
25 //#define EDM_ML_DEBUG
26 using namespace std;
27 using namespace hgc_digi;
28 typedef std::vector<std::pair<float, float>>::iterator itr;
29 typedef std::map<uint32_t, std::vector<std::pair<float, float>>> IdHit_Map;
30 namespace {
31 
32  constexpr std::array<double, 4> occupancyGuesses = {{0.5, 0.2, 0.2, 0.8}};
33 
34  float getPositionDistance(const HGCalGeometry* geom, const DetId& id) { return geom->getPosition(id).mag(); }
35 
36  float getPositionDistance(const HcalGeometry* geom, const DetId& id) {
37  return geom->getGeometry(id)->getPosition().mag();
38  }
39 
40  int getCellThickness(const HGCalGeometry* geom, const DetId& detid) {
41  const auto& dddConst = geom->topology().dddConstants();
42  return (1 + dddConst.waferType(detid));
43  }
44 
45  int getCellThickness(const HcalGeometry* geom, const DetId& detid) { return 1; }
46 
47  void getValidDetIds(const HGCalGeometry* geom, std::unordered_set<DetId>& valid) {
48  const std::vector<DetId>& ids = geom->getValidDetIds();
49  valid.reserve(ids.size());
50  valid.insert(ids.begin(), ids.end());
51  }
52 
53  void getValidDetIds(const HcalGeometry* geom, std::unordered_set<DetId>& valid) {
54  const std::vector<DetId>& ids = geom->getValidDetIds();
55  for (const auto& id : ids) {
56  if (HcalEndcap == id.subdetId() && DetId::Hcal == id.det())
57  valid.emplace(id);
58  }
59  valid.reserve(valid.size());
60  }
61 
62  DetId simToReco(const HcalGeometry* geom, unsigned simid) {
63  DetId result(0);
64  const auto& topo = geom->topology();
65  const auto* dddConst = topo.dddConstants();
66  HcalDetId id = HcalHitRelabeller::relabel(simid, dddConst);
67 
68  if (id.subdet() == int(HcalEndcap)) {
69  result = id;
70  }
71 
72  return result;
73  }
74 
75  DetId simToReco(const HGCalGeometry* geom, unsigned simId) {
76  DetId result(0);
77  const auto& topo = geom->topology();
78  const auto& dddConst = topo.dddConstants();
79 
80  if ((dddConst.geomMode() == HGCalGeometryMode::Hexagon8) ||
81  (dddConst.geomMode() == HGCalGeometryMode::Hexagon8Full) ||
82  (dddConst.geomMode() == HGCalGeometryMode::Trapezoid)) {
83  result = DetId(simId);
84  } else {
85  int subdet(DetId(simId).subdetId()), layer, cell, sec, subsec, zp;
86  HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell);
87  //sec is wafer and subsec is celltyp
88  //skip this hit if after ganging it is not valid
89  auto recoLayerCell = dddConst.simToReco(cell, layer, sec, topo.detectorType());
90  cell = recoLayerCell.first;
91  layer = recoLayerCell.second;
92  if (layer < 0 || cell < 0) {
93  return result;
94  } else {
95  //assign the RECO DetId
96  result = HGCalDetId((ForwardSubdetector)subdet, zp, layer, subsec, sec, cell);
97  }
98  }
99  return result;
100  }
101 
102  void saveSimHitAccumulator_forPreMix(PHGCSimAccumulator& simResult,
103  const hgc::HGCPUSimHitDataAccumulator& simData,
104  const std::unordered_set<DetId>& validIds,
105  const float minCharge,
106  const float maxCharge) {
107  constexpr auto nEnergies = std::tuple_size<decltype(hgc_digi::HGCCellHitInfo().PUhit_info)>::value;
108  static_assert(nEnergies <= PHGCSimAccumulator::SimHitCollection::energyMask + 1,
109  "PHGCSimAccumulator bit pattern needs to updated");
111  "PHGCSimAccumulator bit pattern needs to updated");
112  const float minPackChargeLog = minCharge > 0.f ? std::log(minCharge) : -2;
113  const float maxPackChargeLog = std::log(maxCharge);
115 
116  simResult.reserve(simData.size());
117 
118  for (const auto& id : validIds) {
119  auto found = simData.find(id);
120  if (found == simData.end())
121  continue;
122 
123  const hgc_digi::PUSimHitData& accCharge_across_bxs = found->second.PUhit_info[0];
124  const hgc_digi::PUSimHitData& timing_across_bxs = found->second.PUhit_info[1];
125  for (size_t iSample = 0; iSample < hgc_digi::nSamples; ++iSample) {
126  const std::vector<float>& accCharge_inthis_bx = accCharge_across_bxs[iSample];
127  const std::vector<float>& timing_inthis_bx = timing_across_bxs[iSample];
128  std::vector<unsigned short> vc, vt;
129  size_t nhits = accCharge_inthis_bx.size();
130 
131  for (size_t ihit = 0; ihit < nhits; ++ihit) {
132  if (accCharge_inthis_bx[ihit] > minCharge) {
133  unsigned short c =
134  logintpack::pack16log(accCharge_inthis_bx[ihit], minPackChargeLog, maxPackChargeLog, base);
135  unsigned short t = logintpack::pack16log(timing_inthis_bx[ihit], minPackChargeLog, maxPackChargeLog, base);
136  vc.emplace_back(c);
137  vt.emplace_back(t);
138  }
139  }
140  simResult.emplace_back(id.rawId(), iSample, vc, vt);
141  }
142  }
143  simResult.shrink_to_fit();
144  }
145 
146  typedef std::vector<std::pair<float, float>>::iterator itr;
147  typedef std::unordered_map<uint32_t, std::vector<std::pair<float, float>>> IdHit_Map;
148  template <typename GEOM>
149  void loadSimHitAccumulator_forPreMix(hgc::HGCSimHitDataAccumulator& simData,
151  const GEOM* geom,
152  IdHit_Map& hitRefs_bx0,
153  const PHGCSimAccumulator& simAccumulator,
154  const float minCharge,
155  const float maxCharge,
156  bool setIfZero,
157  const std::array<float, 3>& tdcForToAOnset,
158  const bool minbiasFlag,
159  std::unordered_map<uint32_t, bool>& hitOrder_monitor,
160  const unsigned int thisBx) {
161  const float minPackChargeLog = minCharge > 0.f ? std::log(minCharge) : -2;
162  const float maxPackChargeLog = std::log(maxCharge);
164  for (const auto& detIdIndexHitInfo : simAccumulator) {
165  unsigned int detId = detIdIndexHitInfo.detId();
166 
167  auto simIt = simData.emplace(detId, HGCCellInfo()).first;
168  size_t nhits = detIdIndexHitInfo.nhits();
169 
170  hitOrder_monitor[detId] = false;
171  if (nhits > 0) {
172  unsigned short iSample = detIdIndexHitInfo.sampleIndex();
173 
174  const auto& unsigned_charge_array = detIdIndexHitInfo.chargeArray();
175  const auto& unsigned_time_array = detIdIndexHitInfo.timeArray();
176 
177  float p_charge, p_time;
178  unsigned short unsigned_charge, unsigned_time;
179 
180  for (size_t ihit = 0; ihit < nhits; ++ihit) {
181  unsigned_charge = (unsigned_charge_array[ihit] & PHGCSimAccumulator::SimHitCollection::dataMask);
182  unsigned_time = (unsigned_time_array[ihit] & PHGCSimAccumulator::SimHitCollection::dataMask);
183  p_time = logintpack::unpack16log(unsigned_time, minPackChargeLog, maxPackChargeLog, base);
184  p_charge = logintpack::unpack16log(unsigned_charge, minPackChargeLog, maxPackChargeLog, base);
185 
186  (simIt->second).hit_info[0][iSample] += p_charge;
187  if (iSample == (unsigned short)thisBx) {
188  if (hitRefs_bx0[detId].empty()) {
189  hitRefs_bx0[detId].emplace_back(p_charge, p_time);
190  } else {
191  if (p_time < hitRefs_bx0[detId].back().second) {
192  auto findPos = std::upper_bound(hitRefs_bx0[detId].begin(),
193  hitRefs_bx0[detId].end(),
194  std::make_pair(0.f, p_time),
195  [](const auto& i, const auto& j) { return i.second < j.second; });
196 
197  auto insertedPos = findPos;
198  if (findPos == hitRefs_bx0[detId].begin()) {
199  insertedPos = hitRefs_bx0[detId].emplace(insertedPos, p_charge, p_time);
200  } else {
201  itr prevPos = findPos - 1;
202  if (prevPos->second == p_time) {
203  prevPos->first = prevPos->first + p_charge;
204  insertedPos = prevPos;
205  } else if (prevPos->second < p_time) {
206  insertedPos = hitRefs_bx0[detId].emplace(findPos, (prevPos)->first + p_charge, p_time);
207  }
208  }
209 
210  for (itr step = insertedPos; step != hitRefs_bx0[detId].end(); ++step) {
211  if (step != insertedPos)
212  step->first += p_charge;
213  }
214 
215  hitOrder_monitor[detId] = true;
216 
217  } else if (p_time == hitRefs_bx0[detId].back().second) {
218  hitRefs_bx0[detId].back().first += p_charge;
219  } else if (p_time > hitRefs_bx0[detId].back().second) {
220  hitRefs_bx0[detId].emplace_back(hitRefs_bx0[detId].back().first + p_charge, p_time);
221  }
222  }
223  }
224  }
225  }
226  }
227 
228  if (minbiasFlag) {
229  for (const auto& hitmapIterator : hitRefs_bx0) {
230  unsigned int detectorId = hitmapIterator.first;
231  auto simIt = simData.emplace(detectorId, HGCCellInfo()).first;
232  const bool orderChanged = hitOrder_monitor[detectorId];
233  int waferThickness = getCellThickness(geom, detectorId);
234  float cell_threshold = tdcForToAOnset[waferThickness - 1];
235  const auto& hitRec = hitmapIterator.second;
236  float accChargeForToA(0.f), fireTDC(0.f);
237  const auto aboveThrPos = std::upper_bound(
238  hitRec.begin(), hitRec.end(), std::make_pair(cell_threshold, 0.f), [](const auto& i, const auto& j) {
239  return i.first < j.first;
240  });
241 
242  if (aboveThrPos == hitRec.end()) {
243  accChargeForToA = hitRec.back().first;
244  fireTDC = 0.f;
245  } else if (hitRec.end() - aboveThrPos > 0 || orderChanged) {
246  accChargeForToA = aboveThrPos->first;
247  fireTDC = aboveThrPos->second;
248  if (aboveThrPos - hitRec.begin() >= 1) {
249  const auto& belowThrPos = aboveThrPos - 1;
250  float chargeBeforeThr = belowThrPos->first;
251  float timeBeforeThr = belowThrPos->second;
252  float deltaQ = accChargeForToA - chargeBeforeThr;
253  float deltaTOF = fireTDC - timeBeforeThr;
254  fireTDC = (cell_threshold - chargeBeforeThr) * deltaTOF / deltaQ + timeBeforeThr;
255  }
256  }
257  (simIt->second).hit_info[1][9] = fireTDC;
258  }
259  }
260  }
261 } //namespace
262 
264  : simHitAccumulator_(new HGCSimHitDataAccumulator()),
265  pusimHitAccumulator_(new HGCPUSimHitDataAccumulator()),
266  myDet_(DetId::Forward),
267  mySubDet_(ForwardSubdetector::ForwardEmpty),
268  refSpeed_(0.1 * CLHEP::c_light), //[CLHEP::c_light]=mm/ns convert to cm/ns
269  averageOccupancies_(occupancyGuesses),
270  nEvents_(1) {
271  //configure from cfg
272 
273  hitCollection_ = ps.getParameter<std::string>("hitCollection");
274  digiCollection_ = ps.getParameter<std::string>("digiCollection");
275  maxSimHitsAccTime_ = ps.getParameter<uint32_t>("maxSimHitsAccTime");
276  bxTime_ = ps.getParameter<double>("bxTime");
277  geometryType_ = ps.getParameter<uint32_t>("geometryType");
278  digitizationType_ = ps.getParameter<uint32_t>("digitizationType");
279  verbosity_ = ps.getUntrackedParameter<uint32_t>("verbosity", 0);
280  tofDelay_ = ps.getParameter<double>("tofDelay");
281  premixStage1_ = ps.getParameter<bool>("premixStage1");
282  premixStage1MinCharge_ = ps.getParameter<double>("premixStage1MinCharge");
283  premixStage1MaxCharge_ = ps.getParameter<double>("premixStage1MaxCharge");
284  std::unordered_set<DetId>().swap(validIds_);
285  iC.consumes<std::vector<PCaloHit>>(edm::InputTag("g4SimHits", hitCollection_));
286  const auto& myCfg_ = ps.getParameter<edm::ParameterSet>("digiCfg");
287 
288  if (myCfg_.existsAs<edm::ParameterSet>("chargeCollectionEfficiencies")) {
289  cce_.clear();
290  const auto& temp = myCfg_.getParameter<edm::ParameterSet>("chargeCollectionEfficiencies")
291  .getParameter<std::vector<double>>("values");
292  for (double cce : temp) {
293  cce_.emplace_back(cce);
294  }
295  } else {
296  std::vector<float>().swap(cce_);
297  }
298 
299  if (hitCollection_.find("HitsEE") != std::string::npos) {
300  if (geometryType_ == 0) {
302  } else {
304  }
305  theHGCEEDigitizer_ = std::make_unique<HGCEEDigitizer>(ps);
306  }
307  if (hitCollection_.find("HitsHEfront") != std::string::npos) {
308  if (geometryType_ == 0) {
310  } else {
312  }
313  theHGCHEfrontDigitizer_ = std::make_unique<HGCHEfrontDigitizer>(ps);
314  }
315  if (hitCollection_.find("HcalHits") != std::string::npos and geometryType_ == 0) {
317  theHGCHEbackDigitizer_ = std::make_unique<HGCHEbackDigitizer>(ps);
318  }
319  if (hitCollection_.find("HitsHEback") != std::string::npos and geometryType_ == 1) {
321  theHGCHEbackDigitizer_ = std::make_unique<HGCHEbackDigitizer>(ps);
322  }
323  if (hitCollection_.find("HFNoseHits") != std::string::npos) {
326  theHFNoseDigitizer_ = std::make_unique<HFNoseDigitizer>(ps);
327  }
328 }
329 
330 //
332  // reserve memory for a full detector
333  unsigned idx = getType();
336 }
337 
338 //
339 void HGCDigitizer::finalizeEvent(edm::Event& e, edm::EventSetup const& es, CLHEP::HepRandomEngine* hre) {
340  hitRefs_bx0.clear();
341  hitOrder_monitor.clear();
342  const CaloSubdetectorGeometry* theGeom = (nullptr == gHGCal_ ? static_cast<const CaloSubdetectorGeometry*>(gHcal_)
343  : static_cast<const CaloSubdetectorGeometry*>(gHGCal_));
344 
345  ++nEvents_;
346 
347  unsigned idx = getType();
348  // release memory for unfilled parts of hash table
349  if (validIds_.size() * averageOccupancies_[idx] > simHitAccumulator_->size()) {
350  simHitAccumulator_->reserve(simHitAccumulator_->size());
351  pusimHitAccumulator_->reserve(simHitAccumulator_->size());
352  }
353  //update occupancy guess
354  const double thisOcc = simHitAccumulator_->size() / ((double)validIds_.size());
356 
357  if (premixStage1_) {
358  auto simRecord = std::make_unique<PHGCSimAccumulator>();
359 
360  if (!pusimHitAccumulator_->empty()) {
361  saveSimHitAccumulator_forPreMix(
363  }
364 
365  e.put(std::move(simRecord), digiCollection());
366 
367  } else {
368  if (producesEEDigis()) {
369  auto digiResult = std::make_unique<HGCalDigiCollection>();
370 
371  theHGCEEDigitizer_->run(digiResult, *simHitAccumulator_, theGeom, validIds_, digitizationType_, hre);
372 
373  edm::LogVerbatim("HGCDigitizer") << "HGCDigitizer:: finalize event - produced " << digiResult->size()
374  << " EE hits";
375 #ifdef EDM_ML_DEBUG
376  checkPosition(&(*digiResult));
377 #endif
378  e.put(std::move(digiResult), digiCollection());
379  }
380  if (producesHEfrontDigis()) {
381  auto digiResult = std::make_unique<HGCalDigiCollection>();
382  theHGCHEfrontDigitizer_->run(digiResult, *simHitAccumulator_, theGeom, validIds_, digitizationType_, hre);
383  edm::LogVerbatim("HGCDigitizer") << "HGCDigitizer:: finalize event - produced " << digiResult->size()
384  << " HE silicon hits";
385 #ifdef EDM_ML_DEBUG
386  checkPosition(&(*digiResult));
387 #endif
388  e.put(std::move(digiResult), digiCollection());
389  }
390  if (producesHEbackDigis()) {
391  auto digiResult = std::make_unique<HGCalDigiCollection>();
392  theHGCHEbackDigitizer_->run(digiResult, *simHitAccumulator_, theGeom, validIds_, digitizationType_, hre);
393  edm::LogVerbatim("HGCDigitizer") << "HGCDigitizer:: finalize event - produced " << digiResult->size()
394  << " HE Scintillator hits";
395 #ifdef EDM_ML_DEBUG
396  checkPosition(&(*digiResult));
397 #endif
398  e.put(std::move(digiResult), digiCollection());
399  }
400  if (producesHFNoseDigis()) {
401  auto digiResult = std::make_unique<HGCalDigiCollection>();
402  theHFNoseDigitizer_->run(digiResult, *simHitAccumulator_, theGeom, validIds_, digitizationType_, hre);
403  edm::LogVerbatim("HGCDigitizer") << "HGCDigitizer:: finalize event - produced " << digiResult->size()
404  << " HFNose hits";
405 #ifdef EDM_ML_DEBUG
406  checkPosition(&(*digiResult));
407 #endif
408  e.put(std::move(digiResult), digiCollection());
409  }
410  }
411 
414 }
416  edm::EventSetup const& eventSetup,
417  CLHEP::HepRandomEngine* hre) {
418  //get inputs
420  e.getByLabel(edm::InputTag("g4SimHits", hitCollection_), hits);
421  if (!hits.isValid()) {
422  edm::LogError("HGCDigitizer") << " @ accumulate_minbias : can't find " << hitCollection_
423  << " collection of g4SimHits";
424  return;
425  }
426 
427  //accumulate in-time the main event
428  if (nullptr != gHGCal_) {
430  } else if (nullptr != gHcal_) {
431  accumulate_forPreMix(hits, 0, gHcal_, hre);
432  } else {
433  throw cms::Exception("BadConfiguration") << "HGCDigitizer is not producing EE, FH, or BH digis!";
434  }
435 }
436 
437 //
438 void HGCDigitizer::accumulate(edm::Event const& e, edm::EventSetup const& eventSetup, CLHEP::HepRandomEngine* hre) {
439  //get inputs
441  e.getByLabel(edm::InputTag("g4SimHits", hitCollection_), hits);
442  if (!hits.isValid()) {
443  edm::LogError("HGCDigitizer") << " @ accumulate : can't find " << hitCollection_ << " collection of g4SimHits";
444  return;
445  }
446 
447  //accumulate in-time the main event
448  if (nullptr != gHGCal_) {
449  accumulate(hits, 0, gHGCal_, hre);
450  } else if (nullptr != gHcal_) {
451  accumulate(hits, 0, gHcal_, hre);
452  } else {
453  throw cms::Exception("BadConfiguration") << "HGCDigitizer is not producing EE, FH, or BH digis!";
454  }
455 }
456 
457 //
459  edm::EventSetup const& eventSetup,
460  CLHEP::HepRandomEngine* hre) {
462  e.getByLabel(edm::InputTag("g4SimHits", hitCollection_), hits);
463 
464  if (!hits.isValid()) {
465  edm::LogError("HGCDigitizer") << " @ accumulate : can't find " << hitCollection_ << " collection of g4SimHits";
466  return;
467  }
468 
469  if (nullptr != gHGCal_) {
470  accumulate_forPreMix(hits, e.bunchCrossing(), gHGCal_, hre);
471  } else if (nullptr != gHcal_) {
472  accumulate_forPreMix(hits, e.bunchCrossing(), gHcal_, hre);
473  } else {
474  throw cms::Exception("BadConfiguration") << "HGCDigitizer is not producing EE, FH, or BH digis!";
475  }
476 }
477 
478 //
480  edm::EventSetup const& eventSetup,
481  CLHEP::HepRandomEngine* hre) {
482  //get inputs
484  e.getByLabel(edm::InputTag("g4SimHits", hitCollection_), hits);
485 
486  if (!hits.isValid()) {
487  edm::LogError("HGCDigitizer") << " @ accumulate : can't find " << hitCollection_ << " collection of g4SimHits";
488  return;
489  }
490 
491  //accumulate for the simulated bunch crossing
492  if (nullptr != gHGCal_) {
493  accumulate(hits, e.bunchCrossing(), gHGCal_, hre);
494  } else if (nullptr != gHcal_) {
495  accumulate(hits, e.bunchCrossing(), gHcal_, hre);
496  } else {
497  throw cms::Exception("BadConfiguration") << "HGCDigitizer is not producing EE, FH, or BH digis!";
498  }
499 }
500 
501 //
502 template <typename GEOM>
504  int bxCrossing,
505  const GEOM* geom,
506  CLHEP::HepRandomEngine* hre) {
507  if (nullptr == geom)
508  return;
509 
510  float keV2fC(0.f);
511 
512  int nchits = (int)hits->size();
513 
514  std::vector<HGCCaloHitTuple_t> hitRefs;
515  hitRefs.reserve(nchits);
516  for (int i = 0; i < nchits; ++i) {
517  const auto& the_hit = hits->at(i);
518  DetId id = simToReco(geom, the_hit.id());
519  // to be written the verbosity block
520  if (id.rawId() != 0) {
521  hitRefs.emplace_back(i, id.rawId(), (float)the_hit.time());
522  }
523  }
524  std::sort(hitRefs.begin(), hitRefs.end(), this->orderByDetIdThenTime);
525 
526  nchits = hitRefs.size();
527  for (int i = 0; i < nchits; ++i) {
528  const int hitidx = std::get<0>(hitRefs[i]);
529  const uint32_t id = std::get<1>(hitRefs[i]);
530  if (!validIds_.count(id))
531  continue;
532 
533  HGCPUSimHitDataAccumulator::iterator simHitIt = pusimHitAccumulator_->emplace(id, HGCCellHitInfo()).first;
534  if (id == 0)
535  continue;
536 
537  const float toa = std::get<2>(hitRefs[i]);
538  const PCaloHit& hit = hits->at(hitidx);
539  const float charge = hit.energy() * 1e6 * keV2fC; // * getCCE(geom, id, cce_);
540 
541  const float dist2center(getPositionDistance(geom, id));
542  const float tof = toa - dist2center / refSpeed_ + tofDelay_;
543  const int itime = std::floor(tof / bxTime_) + 9;
544 
545  if (itime < 0 || itime > (int)maxBx_)
546  continue;
547 
548  if (itime >= (int)simHitIt->second.PUhit_info[0].size())
549  continue;
550  (simHitIt->second).PUhit_info[1][itime].push_back(tof);
551  (simHitIt->second).PUhit_info[0][itime].push_back(charge);
552  }
553  if (nchits == 0) {
554  HGCPUSimHitDataAccumulator::iterator simHitIt = pusimHitAccumulator_->emplace(0, HGCCellHitInfo()).first;
555  (simHitIt->second).PUhit_info[1][9].push_back(0.0);
556  (simHitIt->second).PUhit_info[0][9].push_back(0.0);
557  }
558  hitRefs.clear();
559 }
560 
561 //
562 template <typename GEOM>
564  int bxCrossing,
565  const GEOM* geom,
566  CLHEP::HepRandomEngine* hre) {
567  if (nullptr == geom)
568  return;
569 
570  //configuration to apply for the computation of time-of-flight
571  std::array<float, 3> tdcForToAOnset{{0.f, 0.f, 0.f}};
572  float keV2fC(0.f);
573  bool weightToAbyEnergy = getWeight(tdcForToAOnset, keV2fC);
574 
575  //create list of tuples (pos in container, RECO DetId, time) to be sorted first
576  int nchits = (int)hits->size();
577 
578  std::vector<HGCCaloHitTuple_t> hitRefs;
579  hitRefs.reserve(nchits);
580  for (int i = 0; i < nchits; ++i) {
581  const auto& the_hit = hits->at(i);
582  DetId id = simToReco(geom, the_hit.id());
583 
584  if (verbosity_ > 0) {
585  if (producesEEDigis())
586  edm::LogVerbatim("HGCDigitizer") << "HGCDigitizer::i/p " << std::hex << the_hit.id() << " o/p " << id.rawId()
587  << std::dec;
588  else
589  edm::LogVerbatim("HGCDigitizer") << "HGCDigitizer::i/p " << std::hex << the_hit.id() << " o/p " << id.rawId()
590  << std::dec;
591  }
592 
593  if (0 != id.rawId()) {
594  hitRefs.emplace_back(i, id.rawId(), (float)the_hit.time());
595  }
596  }
597 
598  std::sort(hitRefs.begin(), hitRefs.end(), this->orderByDetIdThenTime);
599  //loop over sorted hits
600  nchits = hitRefs.size();
601  for (int i = 0; i < nchits; ++i) {
602  const int hitidx = std::get<0>(hitRefs[i]);
603  const uint32_t id = std::get<1>(hitRefs[i]);
604 
605  //get the data for this cell, if not available then we skip it
606 
607  if (!validIds_.count(id))
608  continue;
609  HGCSimHitDataAccumulator::iterator simHitIt = simHitAccumulator_->emplace(id, HGCCellInfo()).first;
610 
611  if (id == 0)
612  continue; // to be ignored at RECO level
613 
614  const float toa = std::get<2>(hitRefs[i]);
615  const PCaloHit& hit = hits->at(hitidx);
616  const float charge = hit.energy() * 1e6 * keV2fC;
617 
618  //distance to the center of the detector
619  const float dist2center(getPositionDistance(geom, id));
620 
621  //hit time: [time()]=ns [centerDist]=cm [refSpeed_]=cm/ns + delay by 1ns
622  //accumulate in 15 buckets of 25ns (9 pre-samples, 1 in-time, 5 post-samples)
623  const float tof = toa - dist2center / refSpeed_ + tofDelay_;
624  const int itime = std::floor(tof / bxTime_) + 9;
625 
626  //no need to add bx crossing - tof comes already corrected from the mixing module
627  //itime += bxCrossing;
628  //itime += 9;
629 
630  if (itime < 0 || itime > (int)maxBx_)
631  continue;
632 
633  //check if time index is ok and store energy
634  if (itime >= (int)simHitIt->second.hit_info[0].size())
635  continue;
636 
637  (simHitIt->second).hit_info[0][itime] += charge;
638 
639  //for time-of-arrival: save the time-sorted list of timestamps with cumulative charge just above threshold
640  //working version with pileup only for in-time hits
641  int waferThickness = getCellThickness(geom, id);
642  bool orderChanged = false;
643  if (itime == (int)thisBx_) {
644  //if start empty => just add charge and time
645  if (hitRefs_bx0[id].empty()) {
646  hitRefs_bx0[id].emplace_back(charge, tof);
647 
648  } else if (tof <= hitRefs_bx0[id].back().second) {
649  //find position to insert new entry preserving time sorting
650  std::vector<std::pair<float, float>>::iterator findPos =
652  hitRefs_bx0[id].end(),
653  std::pair<float, float>(0.f, tof),
654  [](const auto& i, const auto& j) { return i.second <= j.second; });
655 
656  std::vector<std::pair<float, float>>::iterator insertedPos = findPos;
657  if (findPos->second == tof) {
658  //just merge timestamps with exact timing
659  findPos->first += charge;
660  } else {
661  //insert new element cumulating the charge
662  insertedPos = hitRefs_bx0[id].insert(findPos,
663  (findPos == hitRefs_bx0[id].begin())
664  ? std::pair<float, float>(charge, tof)
665  : std::pair<float, float>((findPos - 1)->first + charge, tof));
666  }
667 
668  //cumulate the charge of new entry for all elements that follow in the sorted list
669  //and resize list accounting for cases when the inserted element itself crosses the threshold
670  for (std::vector<std::pair<float, float>>::iterator step = insertedPos; step != hitRefs_bx0[id].end(); ++step) {
671  if (step != insertedPos)
672  step->first += charge;
673  // resize the list stopping with the first timeStamp with cumulative charge above threshold
674  if (step->first > tdcForToAOnset[waferThickness - 1] && step->second != hitRefs_bx0[id].back().second) {
676  hitRefs_bx0[id].end(),
677  std::pair<float, float>(0.f, step->second),
678  [](const auto& i, const auto& j) { return i.second < j.second; }) -
679  hitRefs_bx0[id].begin());
680  for (auto stepEnd = step + 1; stepEnd != hitRefs_bx0[id].end(); ++stepEnd)
681  stepEnd->first += charge;
682  break;
683  }
684  }
685 
686  orderChanged = true;
687  } else {
688  //add new entry at the end of the list
689  if (hitRefs_bx0[id].back().first <= tdcForToAOnset[waferThickness - 1]) {
690  hitRefs_bx0[id].emplace_back(hitRefs_bx0[id].back().first + charge, tof);
691  }
692  }
693  }
694  float accChargeForToA = hitRefs_bx0[id].empty() ? 0.f : hitRefs_bx0[id].back().first;
695  //now compute the firing ToA through the interpolation of the consecutive time-stamps at threshold
696  if (weightToAbyEnergy)
697  (simHitIt->second).hit_info[1][itime] += charge * tof;
698  else if (accChargeForToA > tdcForToAOnset[waferThickness - 1] &&
699  ((simHitIt->second).hit_info[1][itime] == 0 || orderChanged == true)) {
700  float fireTDC = hitRefs_bx0[id].back().second;
701  if (hitRefs_bx0[id].size() > 1) {
702  float chargeBeforeThr = (hitRefs_bx0[id].end() - 2)->first;
703  float tofchargeBeforeThr = (hitRefs_bx0[id].end() - 2)->second;
704 
705  float deltaQ = accChargeForToA - chargeBeforeThr;
706  float deltaTOF = fireTDC - tofchargeBeforeThr;
707  fireTDC = (tdcForToAOnset[waferThickness - 1] - chargeBeforeThr) * deltaTOF / deltaQ + tofchargeBeforeThr;
708  }
709  (simHitIt->second).hit_info[1][itime] = fireTDC;
710  }
711  }
712  hitRefs.clear();
713 }
714 void HGCDigitizer::accumulate_forPreMix(const PHGCSimAccumulator& simAccumulator, const bool minbiasFlag) {
715  //configuration to apply for the computation of time-of-flight
716  std::array<float, 3> tdcForToAOnset{{0.f, 0.f, 0.f}};
717  float keV2fC(0.f);
718  bool weightToAbyEnergy = getWeight(tdcForToAOnset, keV2fC);
719 
720  if (nullptr != gHGCal_) {
721  loadSimHitAccumulator_forPreMix(*simHitAccumulator_,
723  gHGCal_,
724  hitRefs_bx0,
725  simAccumulator,
728  !weightToAbyEnergy,
729  tdcForToAOnset,
730  minbiasFlag,
732  thisBx_);
733  } else if (nullptr != gHcal_) {
734  loadSimHitAccumulator_forPreMix(*simHitAccumulator_,
736  gHcal_,
737  hitRefs_bx0,
738  simAccumulator,
741  !weightToAbyEnergy,
742  tdcForToAOnset,
743  minbiasFlag,
745  thisBx_);
746  }
747 }
748 
749 //
751  //get geometry
754 
755  gHGCal_ = nullptr;
756  gHcal_ = nullptr;
757 
758  if (producesEEDigis())
759  gHGCal_ = dynamic_cast<const HGCalGeometry*>(geom->getSubdetectorGeometry(myDet_, mySubDet_));
760  if (producesHEfrontDigis())
761  gHGCal_ = dynamic_cast<const HGCalGeometry*>(geom->getSubdetectorGeometry(myDet_, mySubDet_));
762  if (producesHFNoseDigis())
763  gHGCal_ = dynamic_cast<const HGCalGeometry*>(geom->getSubdetectorGeometry(myDet_, mySubDet_));
764 
765  if (producesHEbackDigis()) {
766  if (geometryType_ == 0) {
767  gHcal_ = dynamic_cast<const HcalGeometry*>(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap));
768  } else {
769  gHGCal_ = dynamic_cast<const HGCalGeometry*>(geom->getSubdetectorGeometry(myDet_, mySubDet_));
770  }
771  }
772 
773  int nadded(0);
774  //valid ID lists
775  if (nullptr != gHGCal_) {
776  getValidDetIds(gHGCal_, validIds_);
777  } else if (nullptr != gHcal_) {
778  getValidDetIds(gHcal_, validIds_);
779  } else {
780  throw cms::Exception("BadConfiguration") << "HGCDigitizer is not producing EE, FH, or BH digis!";
781  }
782 
783  if (verbosity_ > 0)
784  edm::LogInfo("HGCDigitizer") << "Added " << nadded << ":" << validIds_.size() << " detIds without "
785  << hitCollection_ << " in first event processed" << std::endl;
786 }
787 
788 //
789 void HGCDigitizer::endRun() { std::unordered_set<DetId>().swap(validIds_); }
790 
791 //
793  for (HGCSimHitDataAccumulator::iterator it = simHitAccumulator_->begin(); it != simHitAccumulator_->end(); it++) {
794  it->second.hit_info[0].fill(0.);
795  it->second.hit_info[1].fill(0.);
796  }
797 }
798 
799 uint32_t HGCDigitizer::getType() const {
801  if (geometryType_ == 0) {
802  switch (mySubDet_) {
804  idx = 0;
805  break;
807  idx = 1;
808  break;
810  idx = 2;
811  break;
813  idx = 3;
814  break;
815  default:
816  break;
817  }
818  } else {
819  switch (myDet_) {
820  case DetId::HGCalEE:
821  idx = 0;
822  break;
823  case DetId::HGCalHSi:
824  idx = 1;
825  break;
826  case DetId::HGCalHSc:
827  idx = 2;
828  break;
829  case DetId::Forward:
830  idx = 3;
831  break;
832  default:
833  break;
834  }
835  }
836  return idx;
837 }
838 
839 bool HGCDigitizer::getWeight(std::array<float, 3>& tdcForToAOnset, float& keV2fC) const {
840  bool weightToAbyEnergy(false);
841  if (geometryType_ == 0) {
842  switch (mySubDet_) {
844  weightToAbyEnergy = theHGCEEDigitizer_->toaModeByEnergy();
845  tdcForToAOnset = theHGCEEDigitizer_->tdcForToAOnset();
846  keV2fC = theHGCEEDigitizer_->keV2fC();
847  break;
849  weightToAbyEnergy = theHGCHEfrontDigitizer_->toaModeByEnergy();
850  tdcForToAOnset = theHGCHEfrontDigitizer_->tdcForToAOnset();
851  keV2fC = theHGCHEfrontDigitizer_->keV2fC();
852  break;
854  weightToAbyEnergy = theHGCHEbackDigitizer_->toaModeByEnergy();
855  tdcForToAOnset = theHGCHEbackDigitizer_->tdcForToAOnset();
856  keV2fC = theHGCHEbackDigitizer_->keV2fC();
857  break;
859  weightToAbyEnergy = theHFNoseDigitizer_->toaModeByEnergy();
860  tdcForToAOnset = theHFNoseDigitizer_->tdcForToAOnset();
861  keV2fC = theHFNoseDigitizer_->keV2fC();
862  break;
863  default:
864  break;
865  }
866  } else {
867  switch (myDet_) {
868  case DetId::HGCalEE:
869  weightToAbyEnergy = theHGCEEDigitizer_->toaModeByEnergy();
870  tdcForToAOnset = theHGCEEDigitizer_->tdcForToAOnset();
871  keV2fC = theHGCEEDigitizer_->keV2fC();
872  break;
873  case DetId::HGCalHSi:
874  weightToAbyEnergy = theHGCHEfrontDigitizer_->toaModeByEnergy();
875  tdcForToAOnset = theHGCHEfrontDigitizer_->tdcForToAOnset();
876  keV2fC = theHGCHEfrontDigitizer_->keV2fC();
877  break;
878  case DetId::HGCalHSc:
879  weightToAbyEnergy = theHGCHEbackDigitizer_->toaModeByEnergy();
880  tdcForToAOnset = theHGCHEbackDigitizer_->tdcForToAOnset();
881  keV2fC = theHGCHEbackDigitizer_->keV2fC();
882  break;
883  case DetId::Forward:
884  weightToAbyEnergy = theHFNoseDigitizer_->toaModeByEnergy();
885  tdcForToAOnset = theHFNoseDigitizer_->tdcForToAOnset();
886  keV2fC = theHFNoseDigitizer_->keV2fC();
887  break;
888  default:
889  break;
890  }
891  }
892  return weightToAbyEnergy;
893 }
894 
896  const double tol(0.5);
897  if (geometryType_ != 0 && nullptr != gHGCal_) {
898  for (const auto& digi : *(digis)) {
899  const DetId& id = digi.id();
900  const GlobalPoint& global = gHGCal_->getPosition(id);
901  double r = global.perp();
902  double z = std::abs(global.z());
903  std::pair<double, double> zrange = gHGCal_->topology().dddConstants().rangeZ(true);
904  std::pair<double, double> rrange = gHGCal_->topology().dddConstants().rangeR(z, true);
905  bool ok = ((r >= rrange.first) && (r <= rrange.second) && (z >= zrange.first) && (z <= zrange.second));
906  std::string ck = (((r < rrange.first - tol) || (r > rrange.second + tol) || (z < zrange.first - tol) ||
907  (z > zrange.second + tol))
908  ? "***** ERROR *****"
909  : "");
910  bool val = gHGCal_->topology().valid(id);
911  if ((!ok) || (!val)) {
912  if (id.det() == DetId::HGCalEE || id.det() == DetId::HGCalHSi) {
913  edm::LogVerbatim("HGCDigitizer") << "Check " << HGCSiliconDetId(id) << " " << global << " R " << r << ":"
914  << rrange.first << ":" << rrange.second << " Z " << z << ":" << zrange.first
915  << ":" << zrange.second << " Flag " << ok << ":" << val << " " << ck;
916  } else if (id.det() == DetId::HGCalHSc) {
917  edm::LogVerbatim("HGCDigitizer") << "Check " << HGCScintillatorDetId(id) << " " << global << " R " << r << ":"
918  << rrange.first << ":" << rrange.second << " Z " << z << ":" << zrange.first
919  << ":" << zrange.second << " Flag " << ok << ":" << val << " " << ck;
920  } else if ((id.det() == DetId::Forward) && (id.subdetId() == static_cast<int>(HFNose))) {
921  edm::LogVerbatim("HGCDigitizer") << "Check " << HFNoseDetId(id) << " " << global << " R " << r << ":"
922  << rrange.first << ":" << rrange.second << " Z " << z << ":" << zrange.first
923  << ":" << zrange.second << " Flag " << ok << ":" << val << " " << ck;
924  } else {
925  edm::LogVerbatim("HGCDigitizer")
926  << "Check " << std::hex << id.rawId() << std::dec << " " << id.det() << ":" << id.subdetId() << " "
927  << global << " R " << r << ":" << rrange.first << ":" << rrange.second << " Z " << z << ":"
928  << zrange.first << ":" << zrange.second << " Flag " << ok << ":" << val << " " << ck;
929  }
930  }
931  }
932  }
933 }
934 
935 template void HGCDigitizer::accumulate_forPreMix<HcalGeometry>(edm::Handle<edm::PCaloHitContainer> const& hits,
936  int bxCrossing,
937  const HcalGeometry* geom,
938  CLHEP::HepRandomEngine* hre);
939 
940 template void HGCDigitizer::accumulate_forPreMix<HGCalGeometry>(edm::Handle<edm::PCaloHitContainer> const& hits,
941  int bxCrossing,
942  const HGCalGeometry* geom,
943  CLHEP::HepRandomEngine* hre);
944 
945 template void HGCDigitizer::accumulate<HcalGeometry>(edm::Handle<edm::PCaloHitContainer> const& hits,
946  int bxCrossing,
947  const HcalGeometry* geom,
948  CLHEP::HepRandomEngine* hre);
949 template void HGCDigitizer::accumulate<HGCalGeometry>(edm::Handle<edm::PCaloHitContainer> const& hits,
950  int bxCrossing,
951  const HGCalGeometry* geom,
952  CLHEP::HepRandomEngine* hre);
logintpack::pack16log
int16_t pack16log(double x, double lmin, double lmax, uint16_t base=32768)
Definition: liblogintpack.h:27
HGCDigitizer::HGCDigitizer
HGCDigitizer(const edm::ParameterSet &ps, edm::ConsumesCollector &iC)
Definition: HGCDigitizer.cc:263
PHGCSimAccumulator
Definition: PHGCSimAccumulator.h:8
HGCDigitizer::thisBx_
static const unsigned int thisBx_
Definition: HGCDigitizer.h:153
HGCDigitizer::producesHFNoseDigis
bool producesHFNoseDigis()
Definition: HGCDigitizer.h:84
mps_fire.i
i
Definition: mps_fire.py:355
HGCDigitizer::producesHEfrontDigis
bool producesHEfrontDigis()
Definition: HGCDigitizer.h:82
hgc_digi::HGCCellHitInfo
Definition: HGCDigitizerTypes.h:25
HGCalTopology::dddConstants
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
TkClusParameters_cff.zrange
zrange
Definition: TkClusParameters_cff.py:7
PHGCSimAccumulator::shrink_to_fit
void shrink_to_fit()
Definition: PHGCSimAccumulator.h:72
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
HGCalDDDConstants::rangeZ
std::pair< double, double > rangeZ(bool reco) const
Definition: HGCalDDDConstants.cc:979
ForwardEmpty
Definition: ForwardSubdetector.h:5
HGCDigitizer::premixStage1MinCharge_
double premixStage1MinCharge_
Definition: HGCDigitizer.h:109
HGCDigitizer::simHitAccumulator_
std::unique_ptr< hgc::HGCSimHitDataAccumulator > simHitAccumulator_
Definition: HGCDigitizer.h:116
HGCDigitizer::digiCollection
std::string digiCollection()
Definition: HGCDigitizer.h:85
HGCDigitizer::gHGCal_
const HGCalGeometry * gHGCal_
Definition: HGCDigitizer.h:131
step
step
Definition: StallMonitor.cc:94
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HGCDigitizer::theHGCHEbackDigitizer_
std::unique_ptr< HGCHEbackDigitizer > theHGCHEbackDigitizer_
Definition: HGCDigitizer.h:125
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
RandomNumberGenerator.h
HGCalGeometryMode.h
PHGCSimAccumulator::SimHitCollection::sampleOffset
constexpr static unsigned sampleOffset
Definition: PHGCSimAccumulator.h:27
HGCDigitizer::endRun
void endRun()
Definition: HGCDigitizer.cc:789
CrossingFrame.h
HGCalTestNumbering::unpackHexagonIndex
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
Definition: HGCalTestNumbering.cc:47
DetId::Hcal
Definition: DetId.h:28
edm::LogInfo
Definition: MessageLogger.h:254
liblogintpack.h
HGCDigitizer::nEvents_
uint32_t nEvents_
Definition: HGCDigitizer.h:149
PHGCSimAccumulator::SimHitCollection::dataMask
constexpr static unsigned dataMask
Definition: PHGCSimAccumulator.h:30
edm::SortedCollection
Definition: SortedCollection.h:49
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
PileUpEventPrincipal
Definition: PileUpEventPrincipal.h:19
HGCDigitizer::maxBx_
static const unsigned int maxBx_
Definition: HGCDigitizer.h:152
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HGCDigitizer::beginRun
void beginRun(const edm::EventSetup &es)
actions at the start/end of run
Definition: HGCDigitizer.cc:750
HFNoseDetId.h
HGCDigitizer::refSpeed_
float refSpeed_
Definition: HGCDigitizer.h:142
PHGCSimAccumulator::SimHitCollection::energyMask
constexpr static unsigned energyMask
Definition: PHGCSimAccumulator.h:26
HGCDigitizer::producesHEbackDigis
bool producesHEbackDigis()
Definition: HGCDigitizer.h:83
HGCDigitizer::premixStage1_
bool premixStage1_
Definition: HGCDigitizer.h:106
HFNoseDetId
Definition: HFNoseDetId.h:22
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle
Definition: AssociativeIterator.h:50
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
training_settings.idx
idx
Definition: training_settings.py:16
dqmdumpme.first
first
Definition: dqmdumpme.py:55
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
validateGeometry_cfg.valid
valid
Definition: validateGeometry_cfg.py:21
end
#define end
Definition: vmac.h:39
ForwardSubdetector.h
PHGCSimAccumulator::SimHitCollection::sampleMask
constexpr static unsigned sampleMask
Definition: PHGCSimAccumulator.h:28
hgc_digi
Definition: HGCDigitizerTypes.h:10
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
DetId::HGCalHSi
Definition: DetId.h:33
DetId::HGCalEE
Definition: DetId.h:32
HGCDigitizer::accumulate_forPreMix
void accumulate_forPreMix(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
Definition: HGCDigitizer.cc:415
HGCalGeometryMode::Trapezoid
Definition: HGCalGeometryMode.h:25
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
MixCollection.h
cuda_std::upper_bound
__host__ constexpr __device__ RandomIt upper_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:45
Service.h
PHGCSimAccumulator::reserve
void reserve(size_t size)
Definition: PHGCSimAccumulator.h:68
HFNose
Definition: ForwardSubdetector.h:11
DDAxes::z
edm::ESHandle< CaloGeometry >
PileUpEventPrincipal.h
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
HGCDigitizer::pusimHitAccumulator_
std::unique_ptr< hgc::HGCPUSimHitDataAccumulator > pusimHitAccumulator_
Definition: HGCDigitizer.h:117
logintpack::unpack16log
double unpack16log(int16_t i, double lmin, double lmax, uint16_t base=32768)
Definition: liblogintpack.h:62
HGCDigitizer::orderByDetIdThenTime
static bool orderByDetIdThenTime(const HGCCaloHitTuple_t &a, const HGCCaloHitTuple_t &b)
Definition: HGCDigitizer.h:37
HGCDigitizer::gHcal_
const HcalGeometry * gHcal_
Definition: HGCDigitizer.h:132
Point3DBase< float, GlobalTag >
OrderedSet.t
t
Definition: OrderedSet.py:90
nhits
Definition: HIMultiTrackSelector.h:42
HGCalGeometry
Definition: HGCalGeometry.h:30
HGCalGeometry::topology
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:112
HGCalDDDConstants::rangeR
std::pair< double, double > rangeR(double z, bool reco) const
Definition: HGCalDDDConstants.cc:934
CaloGeometryRecord.h
CLHEP
Definition: CocoaGlobals.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
hgc_digi::HGCCellInfo
Definition: HGCDigitizerTypes.h:31
HGCEE
Definition: ForwardSubdetector.h:8
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
HGCDigitizer::hitCollection_
std::string hitCollection_
Definition: HGCDigitizer.h:97
std::empty
constexpr auto empty(const C &c) -> decltype(c.empty())
Definition: cuda_cxx17.h:24
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
hgc_digi::nSamples
constexpr size_t nSamples
Definition: HGCDigitizerTypes.h:13
Event.h
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
HGCDigitizer::theHGCEEDigitizer_
std::unique_ptr< HGCEEDigitizer > theHGCEEDigitizer_
Definition: HGCDigitizer.h:124
HGCalGeometryMode::Hexagon8Full
Definition: HGCalGeometryMode.h:25
HGCDigitizer::accumulate
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
handle SimHit accumulation
Definition: HGCDigitizer.cc:438
HGCDigitizer::maxSimHitsAccTime_
int maxSimHitsAccTime_
Definition: HGCDigitizer.h:114
HcalHitRelabeller.h
HGCDigitizer::finalizeEvent
void finalizeEvent(edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre)
Definition: HGCDigitizer.cc:339
HGCDigitizer::theHGCHEfrontDigitizer_
std::unique_ptr< HGCHEfrontDigitizer > theHGCHEfrontDigitizer_
Definition: HGCDigitizer.h:126
PCaloHit.h
HGCDigitizer::resetSimHitDataAccumulator
void resetSimHitDataAccumulator()
Definition: HGCDigitizer.cc:792
HGCDigitizer::hitRefs_bx0
std::unordered_map< uint32_t, std::vector< std::pair< float, float > > > hitRefs_bx0
Definition: HGCDigitizer.h:155
HcalDetId
Definition: HcalDetId.h:12
createfilelist.int
int
Definition: createfilelist.py:10
edm::LogVerbatim
Definition: MessageLogger.h:297
IdealGeometryRecord.h
HGCalGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Definition: HGCalGeometry.cc:192
edm::EventSetup
Definition: EventSetup.h:57
HGCDigitizer::digitizationType_
int digitizationType_
Definition: HGCDigitizer.h:103
PCaloHit
Definition: PCaloHit.h:8
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
get
#define get
hgc_digi::HGCSimHitDataAccumulator
std::unordered_map< uint32_t, HGCCellInfo > HGCSimHitDataAccumulator
Definition: HGCDigitizerTypes.h:38
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:87
HGCDigitizer::validIds_
std::unordered_set< DetId > validIds_
Definition: HGCDigitizer.h:130
HGCDigitizer::bxTime_
double bxTime_
Definition: HGCDigitizer.h:115
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HGCDigitizer::tofDelay_
float tofDelay_
Definition: HGCDigitizer.h:145
HGCDigitizer::premixStage1MaxCharge_
double premixStage1MaxCharge_
Definition: HGCDigitizer.h:111
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HcalHitRelabeller::relabel
DetId relabel(const uint32_t testId) const
Definition: HcalHitRelabeller.cc:49
PHGCSimAccumulator::emplace_back
void emplace_back(unsigned int detId, unsigned short sampleIndex, const std::vector< unsigned short > &accCharge, const std::vector< unsigned short > &timing)
Definition: PHGCSimAccumulator.h:77
HGCalDetId
Definition: HGCalDetId.h:8
HGCDigitizer::initializeEvent
void initializeEvent(edm::Event const &e, edm::EventSetup const &c)
actions at the start/end of event
Definition: HGCDigitizer.cc:331
HGCDigitizer::myDet_
DetId::Detector myDet_
Definition: HGCDigitizer.h:135
heppy_batch.val
val
Definition: heppy_batch.py:351
HGCalDetId.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
HGCDigitizer::verbosity_
uint32_t verbosity_
Definition: HGCDigitizer.h:139
hgc_digi::PUSimHitData
std::array< HGCSimDataCollection, nSamples > PUSimHitData
Definition: HGCDigitizerTypes.h:20
HGCDigitizer::digiCollection_
std::string digiCollection_
Definition: HGCDigitizer.h:97
HcalEndcap
Definition: HcalAssistant.h:34
hgc_digi::HGCPUSimHitDataAccumulator
std::unordered_map< uint32_t, HGCCellHitInfo > HGCPUSimHitDataAccumulator
Definition: HGCDigitizerTypes.h:39
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:21
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
DetId::HGCalHSc
Definition: DetId.h:34
HGCDigitizer.h
transform.h
relativeConstraints.value
value
Definition: relativeConstraints.py:53
HGCDigitizer::getWeight
bool getWeight(std::array< float, 3 > &tdcForToAOnset, float &keV2fC) const
Definition: HGCDigitizer.cc:839
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
Exception
Definition: hltDiff.cc:246
CaloGeometry.h
HGCDigitizer::theHFNoseDigitizer_
std::unique_ptr< HFNoseDigitizer > theHFNoseDigitizer_
Definition: HGCDigitizer.h:127
HGCDigitizer::checkPosition
void checkPosition(const HGCalDigiCollection *digis) const
Definition: HGCDigitizer.cc:895
EventSetup.h
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
HGCDigitizer::producesEEDigis
bool producesEEDigis()
Definition: HGCDigitizer.h:81
PCaloHitContainer.h
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
HGCalGeometryMode::Hexagon8
Definition: HGCalGeometryMode.h:25
HGCDigitizer::cce_
std::vector< float > cce_
Definition: HGCDigitizer.h:154
HGCalTopology::valid
bool valid(const DetId &id) const override
Is this a valid cell id.
Definition: HGCalTopology.cc:464
HGCDigitizer::mySubDet_
ForwardSubdetector mySubDet_
Definition: HGCDigitizer.h:136
mps_fire.result
result
Definition: mps_fire.py:303
HGCHEF
Definition: ForwardSubdetector.h:9
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DetId::Forward
Definition: DetId.h:30
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
IdHit_Map
std::map< uint32_t, std::vector< std::pair< float, float > > > IdHit_Map
Definition: HGCDigitizer.cc:29
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92
HGCDigitizer::getType
uint32_t getType() const
Definition: HGCDigitizer.cc:799
HcalGeometry
Definition: HcalGeometry.h:17
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
edm::InputTag
Definition: InputTag.h:15
begin
#define begin
Definition: vmac.h:32
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
hit
Definition: SiStripHitEffFromCalibTree.cc:88
HGCDigitizer::hitOrder_monitor
std::unordered_map< uint32_t, bool > hitOrder_monitor
Definition: HGCDigitizer.h:156
hgcalTriggerNtuples_cfi.keV2fC
keV2fC
Definition: hgcalTriggerNtuples_cfi.py:11
HGCHEB
Definition: ForwardSubdetector.h:10
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HGCalTestNumbering.h
HGCDigitizer::averageOccupancies_
std::array< double, 4 > averageOccupancies_
Definition: HGCDigitizer.h:148
HGCDigitizer::geometryType_
int geometryType_
Definition: HGCDigitizer.h:100