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