CMS 3D CMS Logo

HcalTriggerPrimitiveAlgo.cc
Go to the documentation of this file.
2 
6 
10 
13 
16 
18 
19 #include <iostream>
20 
21 using namespace std;
22 
24  const std::vector<double>& w,
25  int latency,
26  uint32_t FG_threshold,
27  const std::vector<uint32_t>& FG_HF_thresholds,
28  uint32_t ZS_threshold,
29  int numberOfSamples,
36  uint32_t minSignalThreshold,
37  uint32_t PMT_NoiseThreshold)
38  : incoder_(nullptr),
39  outcoder_(nullptr),
40  theThreshold(0),
41  peakfind_(pf),
42  weights_(w),
43  latency_(latency),
44  FG_threshold_(FG_threshold),
45  FG_HF_thresholds_(FG_HF_thresholds),
46  ZS_threshold_(ZS_threshold),
47  numberOfSamples_(numberOfSamples),
48  numberOfPresamples_(numberOfPresamples),
49  numberOfFilterPresamplesHBQIE11_(numberOfFilterPresamplesHBQIE11),
50  numberOfFilterPresamplesHEQIE11_(numberOfFilterPresamplesHEQIE11),
51  numberOfSamplesHF_(numberOfSamplesHF),
52  numberOfPresamplesHF_(numberOfPresamplesHF),
53  useTDCInMinBiasBits_(useTDCInMinBiasBits),
54  minSignalThreshold_(minSignalThreshold),
55  PMT_NoiseThreshold_(PMT_NoiseThreshold),
56  NCTScaleShift(0),
57  RCTScaleShift(0),
58  peak_finder_algorithm_(2),
59  override_parameters_() {
60  //No peak finding setting (for Fastsim)
61  if (!peakfind_) {
62  numberOfSamples_ = 1;
66  }
67  // Switch to integer for comparisons - remove compiler warning
69 }
70 
72 
74  upgrade_hb_ = hb;
75  upgrade_he_ = he;
76  upgrade_hf_ = hf;
77 }
78 
79 void HcalTriggerPrimitiveAlgo::setFixSaturationFlag(bool fix_saturation) { fix_saturation_ = fix_saturation; }
80 
83 
84  if (override_parameters_.exists("ADCThresholdHF")) {
85  override_adc_hf_ = true;
86  override_adc_hf_value_ = override_parameters_.getParameter<uint32_t>("ADCThresholdHF");
87  }
88  if (override_parameters_.exists("TDCMaskHF")) {
89  override_tdc_hf_ = true;
90  override_tdc_hf_value_ = override_parameters_.getParameter<unsigned long long>("TDCMaskHF");
91  }
92 }
93 
95  // TODO: Need to add support for seperate 28, 29 in HE
96  //Hack for 300_pre10, should be removed.
97  if (frame.id().depth() == 5)
98  return;
99 
100  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(frame.id());
101  assert(ids.size() == 1 || ids.size() == 2);
102  IntegerCaloSamples samples1(ids[0], int(frame.size()));
103 
104  samples1.setPresamples(frame.presamples());
105  incoder_->adc2Linear(frame, samples1);
106 
107  std::vector<bool> msb;
108  incoder_->lookupMSB(frame, msb);
109 
110  if (ids.size() == 2) {
111  // make a second trigprim for the other one, and split the energy
112  IntegerCaloSamples samples2(ids[1], samples1.size());
113  for (int i = 0; i < samples1.size(); ++i) {
114  samples1[i] = uint32_t(samples1[i] * 0.5);
115  samples2[i] = samples1[i];
116  }
117  samples2.setPresamples(frame.presamples());
118  addSignal(samples2);
119  addFG(ids[1], msb);
120  }
121  addSignal(samples1);
122  addFG(ids[0], msb);
123 }
124 
126  if (frame.id().depth() == 1 || frame.id().depth() == 2) {
127  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(frame.id());
128  std::vector<HcalTrigTowerDetId>::const_iterator it;
129  for (it = ids.begin(); it != ids.end(); ++it) {
130  HcalTrigTowerDetId trig_tower_id = *it;
131  IntegerCaloSamples samples(trig_tower_id, frame.size());
132  samples.setPresamples(frame.presamples());
134 
135  // Don't add to final collection yet
136  // HF PMT veto sum is calculated in analyzerHF()
137  IntegerCaloSamples zero_samples(trig_tower_id, frame.size());
138  zero_samples.setPresamples(frame.presamples());
139  addSignal(zero_samples);
140 
141  // Pre-LS1 Configuration
142  if (trig_tower_id.version() == 0) {
143  // Mask off depths: fgid is the same for both depths
144  uint32_t fgid = (frame.id().maskDepth());
145 
146  if (theTowerMapFGSum.find(trig_tower_id) == theTowerMapFGSum.end()) {
147  SumFGContainer sumFG;
148  theTowerMapFGSum.insert(std::pair<HcalTrigTowerDetId, SumFGContainer>(trig_tower_id, sumFG));
149  }
150 
151  SumFGContainer& sumFG = theTowerMapFGSum[trig_tower_id];
152  SumFGContainer::iterator sumFGItr;
153  for (sumFGItr = sumFG.begin(); sumFGItr != sumFG.end(); ++sumFGItr) {
154  if (sumFGItr->id() == fgid) {
155  break;
156  }
157  }
158  // If find
159  if (sumFGItr != sumFG.end()) {
160  for (int i = 0; i < samples.size(); ++i) {
161  (*sumFGItr)[i] += samples[i];
162  }
163  } else {
164  //Copy samples (change to fgid)
165  IntegerCaloSamples sumFGSamples(DetId(fgid), samples.size());
166  sumFGSamples.setPresamples(samples.presamples());
167  for (int i = 0; i < samples.size(); ++i) {
168  sumFGSamples[i] = samples[i];
169  }
170  sumFG.push_back(sumFGSamples);
171  }
172 
173  // set veto to true if Long or Short less than threshold
174  if (HF_Veto.find(fgid) == HF_Veto.end()) {
175  vector<bool> vetoBits(samples.size(), false);
176  HF_Veto[fgid] = vetoBits;
177  }
178  for (int i = 0; i < samples.size(); ++i) {
179  if (samples[i] < minSignalThreshold_) {
180  HF_Veto[fgid][i] = true;
181  }
182  }
183  }
184  // HF 1x1
185  else if (trig_tower_id.version() == 1) {
186  uint32_t fgid = (frame.id().maskDepth());
187  HFDetails& details = theHFDetailMap[trig_tower_id][fgid];
188  // Check the frame type to determine long vs short
189  if (frame.id().depth() == 1) { // Long
190  details.long_fiber = samples;
191  details.LongDigi = frame;
192  } else if (frame.id().depth() == 2) { // Short
193  details.short_fiber = samples;
194  details.ShortDigi = frame;
195  } else {
196  // Neither long nor short... So we have no idea what to do
197  edm::LogWarning("HcalTPAlgo") << "Unable to figure out what to do with data frame for " << frame.id();
198  return;
199  }
200  }
201  // Uh oh, we are in a bad/unknown state! Things will start crashing.
202  else {
203  return;
204  }
205  }
206  }
207 }
208 
210  HcalDetId detId = frame.detid();
211  // prevent QIE10 calibration channels from entering TP emulation
212  if (detId.subdet() != HcalForward)
213  return;
214 
215  auto ids = theTrigTowerGeometry->towerIds(frame.id());
216  for (const auto& id : ids) {
217  if (id.version() == 0) {
218  edm::LogError("HcalTPAlgo") << "Encountered QIE10 data frame mapped to TP version 0:" << id;
219  continue;
220  }
221 
222  int nsamples = frame.samples();
223 
224  IntegerCaloSamples samples(id, nsamples);
225  samples.setPresamples(frame.presamples());
227 
228  // Don't add to final collection yet
229  // HF PMT veto sum is calculated in analyzerHF()
230  IntegerCaloSamples zero_samples(id, nsamples);
231  zero_samples.setPresamples(frame.presamples());
232  addSignal(zero_samples);
233 
234  auto fid = HcalDetId(frame.id());
235  auto& details = theHFUpgradeDetailMap[id][fid.maskDepth()];
236  auto& detail = details[fid.depth() - 1];
237  detail.samples = samples;
238  detail.digi = frame;
239  detail.validity.resize(nsamples);
240  detail.passTDC.resize(nsamples);
241  incoder_->lookupMSB(frame, detail.fgbits);
242  for (int idx = 0; idx < nsamples; ++idx) {
243  detail.validity[idx] = validChannel(frame, idx);
244  detail.passTDC[idx] = passTDC(frame, idx);
245  }
246  }
247 }
248 
250  HcalDetId detId(frame.id());
251  // prevent QIE11 calibration channels from entering TP emulation
252  if (detId.subdet() != HcalEndcap && detId.subdet() != HcalBarrel)
253  return;
254 
255  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(detId);
256  assert(ids.size() == 1 || ids.size() == 2);
257  IntegerCaloSamples samples1(ids[0], int(frame.samples()));
258 
259  samples1.setPresamples(frame.presamples());
260  incoder_->adc2Linear(frame, samples1);
261 
262  std::vector<std::bitset<2>> msb(frame.samples(), 0);
263  incoder_->lookupMSB(frame, msb);
264 
265  if (ids.size() == 2) {
266  // make a second trigprim for the other one, and share the energy
267  IntegerCaloSamples samples2(ids[1], samples1.size());
268  for (int i = 0; i < samples1.size(); ++i) {
269  samples1[i] = uint32_t(samples1[i]);
270  samples2[i] = samples1[i];
271  }
272  samples2.setPresamples(frame.presamples());
273  addSignal(samples2);
274  addUpgradeFG(ids[1], detId.depth(), msb);
275  addUpgradeTDCFG(ids[1], frame);
276  }
277  addSignal(samples1);
278  addUpgradeFG(ids[0], detId.depth(), msb);
279  addUpgradeTDCFG(ids[0], frame);
280 }
281 
284  SumMap::iterator itr = theSumMap.find(id);
285 
286  if (itr == theSumMap.end()) {
287  theSumMap.insert(std::make_pair(id, samples));
288  } else {
289  // wish CaloSamples had a +=
290  for (int i = 0; i < samples.size(); ++i) {
291  (itr->second)[i] += samples[i];
292  }
293  }
294 
295  // if fix_saturation == true, keep track of tower with saturated input LUT
296  if (fix_saturation_) {
297  SatMap::iterator itr_sat = theSatMap.find(id);
298 
299  assert((itr == theSumMap.end()) == (itr_sat == theSatMap.end()));
300 
301  if (itr_sat == theSatMap.end()) {
302  vector<bool> check_sat;
303  for (int i = 0; i < samples.size(); ++i) {
304  if (!(samples[i] < QIE11_LINEARIZATION_ET)) {
305  check_sat.push_back(true);
306  } else
307  check_sat.push_back(false);
308  }
309  theSatMap.insert(std::make_pair(id, check_sat));
310  } else {
311  for (int i = 0; i < samples.size(); ++i) {
312  if (!(samples[i] < QIE11_LINEARIZATION_ET))
313  (itr_sat->second)[i] = true;
314  }
315  }
316  }
317 }
318 
320  int shrink = weights_.size() - 1;
321  std::vector<bool>& msb = fgMap_[samples.id()];
322  IntegerCaloSamples sum(samples.id(), samples.size());
323 
324  //slide algo window
325  for (int ibin = 0; ibin < int(samples.size()) - shrink; ++ibin) {
326  int algosumvalue = 0;
327  for (unsigned int i = 0; i < weights_.size(); i++) {
328  //add up value * scale factor
329  algosumvalue += int(samples[ibin + i] * weights_[i]);
330  }
331  if (algosumvalue < 0)
332  sum[ibin] = 0; // low-side
333  //high-side
334  //else if (algosumvalue>QIE8_LINEARIZATION_ET) sum[ibin]=QIE8_LINEARIZATION_ET;
335  else
336  sum[ibin] = algosumvalue; //assign value to sum[]
337  }
338 
339  // Align digis and TP
340  int dgPresamples = samples.presamples();
341  int tpPresamples = numberOfPresamples_;
342  int shift = dgPresamples - tpPresamples;
343  int dgSamples = samples.size();
344  int tpSamples = numberOfSamples_;
345  if (peakfind_) {
346  if ((shift < shrink) || (shift + tpSamples + shrink > dgSamples - (peak_finder_algorithm_ - 1))) {
347  edm::LogInfo("HcalTriggerPrimitiveAlgo::analyze")
348  << "TP presample or size from the configuration file is out of the accessible range. Using digi values from "
349  "data instead...";
350  shift = shrink;
351  tpPresamples = dgPresamples - shrink;
352  tpSamples = dgSamples - (peak_finder_algorithm_ - 1) - shrink - shift;
353  }
354  }
355 
356  std::vector<int> finegrain(tpSamples, false);
357 
358  IntegerCaloSamples output(samples.id(), tpSamples);
359  output.setPresamples(tpPresamples);
360 
361  for (int ibin = 0; ibin < tpSamples; ++ibin) {
362  // ibin - index for output TP
363  // idx - index for samples + shift
364  int idx = ibin + shift;
365 
366  //Peak finding
367  if (peakfind_) {
368  bool isPeak = false;
369  switch (peak_finder_algorithm_) {
370  case 1:
371  isPeak = (samples[idx] > samples[idx - 1] && samples[idx] >= samples[idx + 1] && samples[idx] > theThreshold);
372  break;
373  case 2:
374  isPeak = (sum[idx] > sum[idx - 1] && sum[idx] >= sum[idx + 1] && sum[idx] > theThreshold);
375  break;
376  default:
377  break;
378  }
379 
380  if (isPeak) {
381  output[ibin] = std::min<unsigned int>(sum[idx], QIE8_LINEARIZATION_ET);
382  finegrain[ibin] = msb[idx];
383  }
384  // Not a peak
385  else
386  output[ibin] = 0;
387  } else { // No peak finding, just output running sum
388  output[ibin] = std::min<unsigned int>(sum[idx], QIE8_LINEARIZATION_ET);
389  finegrain[ibin] = msb[idx];
390  }
391 
392  // Only Pegged for 1-TS algo.
393  if (peak_finder_algorithm_ == 1) {
396  }
397  }
398  outcoder_->compress(output, finegrain, result);
399 }
400 
402  vector<bool> sample_saturation,
404  const HcalFinegrainBit& fg_algo) {
405  HcalDetId detId(samples.id());
406 
407  // Get the |ieta| for current sample
408  int theIeta = detId.ietaAbs();
409 
410  unsigned int dgSamples = samples.size();
411  unsigned int dgPresamples = samples.presamples();
412 
413  unsigned int tpSamples = numberOfSamples_;
414  unsigned int tpPresamples = numberOfPresamples_;
415 
416  unsigned int filterSamples = weightsQIE11_[theIeta].size();
417  unsigned int filterPresamples = theIeta > theTrigTowerGeometry->topology().lastHBRing()
420 
421  unsigned int shift = dgPresamples - tpPresamples;
422 
423  // shrink keeps the FIR filter from going off the end of the 8TS vector
424  unsigned int shrink = filterSamples - 1;
425 
426  auto& msb = fgUpgradeMap_[samples.id()];
427  auto& timingTDC = fgUpgradeTDCMap_[samples.id()];
428  IntegerCaloSamples sum(samples.id(), samples.size());
429 
430  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(detId);
431 
432  // keep track of tower with saturated energy and force the total TP saturated
433  bool force_saturation[samples.size()];
434  for (int i = 0; i < samples.size(); i++) {
435  force_saturation[i] = false;
436  }
437 
438  //slide algo window
439  for (unsigned int ibin = 0; ibin < dgSamples - shrink; ++ibin) {
440  int algosumvalue = 0;
441  bool check_sat = false;
442  for (unsigned int i = 0; i < filterSamples; i++) {
443  //add up value * scale factor
444  // In addition, divide by two in the 10 degree phi segmentation region
445  // to mimic 5 degree segmentation for the trigger
446  unsigned int sample = samples[ibin + i];
447 
448  if (fix_saturation_ && (sample_saturation.size() > ibin + i))
449  check_sat = (sample_saturation[ibin + i] | (sample > QIE11_MAX_LINEARIZATION_ET));
452 
453  // Usually use a segmentation factor of 1.0 but for ieta >= 21 use 0.5
454  double segmentationFactor = 1.0;
455  if (ids.size() == 2) {
456  segmentationFactor = 0.5;
457  }
458 
459  // Based on the |ieta| of the sample, retrieve the correct region weight
460  double theWeight = weightsQIE11_[theIeta][i];
461 
462  algosumvalue += int(sample * segmentationFactor * theWeight);
463  }
464  if (algosumvalue < 0)
465  sum[ibin] = 0; // low-side
466  //high-side
467  //else if (algosumvalue>QIE11_LINEARIZATION_ET) sum[ibin]=QIE11_LINEARIZATION_ET;
468  else
469  sum[ibin] = algosumvalue; //assign value to sum[]
470 
471  if (check_sat)
472  force_saturation[ibin] = true;
473  }
474 
475  std::vector<int> finegrain(tpSamples, false);
476 
477  IntegerCaloSamples output(samples.id(), tpSamples);
478  output.setPresamples(tpPresamples);
479 
480  for (unsigned int ibin = 0; ibin < tpSamples; ++ibin) {
481  // ibin - index for output TP
482  // idx - index for samples + shift - filterPresamples
483  int idx = ibin + shift - filterPresamples;
484 
485  // When idx is <= 0 peakfind would compare out-of-bounds of the vector. Avoid this ambiguity
486  if (idx <= 0) {
487  output[ibin] = 0;
488  continue;
489  }
490 
491  bool isPeak = (sum[idx] > sum[idx - 1] && sum[idx] >= sum[idx + 1] && sum[idx] > theThreshold);
492 
493  if (isPeak) {
494  output[ibin] = std::min<unsigned int>(sum[idx], QIE11_MAX_LINEARIZATION_ET);
495  if (fix_saturation_ && force_saturation[idx])
497  } else {
498  // Not a peak
499  output[ibin] = 0;
500  }
501  // peak-finding is not applied for FG bits
502  // compute(msb) returns two bits (MIP). compute(timingTDC,ids) returns 6 bits (1 depth, 2 reserved, 1 prompt, 1 delayed 01, 1 delayed 10)
503  finegrain[ibin] = fg_algo.compute(timingTDC[idx], ids[0]).to_ulong() | fg_algo.compute(msb[idx]).to_ulong() << 1;
504  }
505  outcoder_->compress(output, finegrain, result);
506 }
507 
510  const int hf_lumi_shift) {
511  HcalTrigTowerDetId detId(samples.id());
512 
513  // Align digis and TP
514  int dgPresamples = samples.presamples();
515  int tpPresamples = numberOfPresamplesHF_;
516  int shift = dgPresamples - tpPresamples;
517  int dgSamples = samples.size();
518  int tpSamples = numberOfSamplesHF_;
519  if (shift < 0 || shift + tpSamples > dgSamples) {
520  edm::LogInfo("HcalTriggerPrimitiveAlgo::analyzeHF")
521  << "TP presample or size from the configuration file is out of the accessible range. Using digi values from "
522  "data instead...";
523  tpPresamples = dgPresamples;
524  shift = 0;
525  tpSamples = dgSamples;
526  }
527 
528  std::vector<int> finegrain(tpSamples, false);
529 
530  TowerMapFGSum::const_iterator tower2fg = theTowerMapFGSum.find(detId);
531  assert(tower2fg != theTowerMapFGSum.end());
532 
533  const SumFGContainer& sumFG = tower2fg->second;
534  // Loop over all L+S pairs that mapped from samples.id()
535  // Note: 1 samples.id() = 6 x (L+S) without noZS
536  for (SumFGContainer::const_iterator sumFGItr = sumFG.begin(); sumFGItr != sumFG.end(); ++sumFGItr) {
537  const std::vector<bool>& veto = HF_Veto[sumFGItr->id().rawId()];
538  for (int ibin = 0; ibin < tpSamples; ++ibin) {
539  int idx = ibin + shift;
540  // if not vetod, add L+S to total sum and calculate FG
541  bool vetoed = idx < int(veto.size()) && veto[idx];
542  if (!(vetoed && (*sumFGItr)[idx] > PMT_NoiseThreshold_)) {
543  samples[idx] += (*sumFGItr)[idx];
544  finegrain[ibin] = (finegrain[ibin] || (*sumFGItr)[idx] >= FG_threshold_);
545  }
546  }
547  }
548 
549  IntegerCaloSamples output(samples.id(), tpSamples);
550  output.setPresamples(tpPresamples);
551 
552  for (int ibin = 0; ibin < tpSamples; ++ibin) {
553  int idx = ibin + shift;
554  output[ibin] = samples[idx] >> hf_lumi_shift;
555  static const int MAX_OUTPUT = QIE8_LINEARIZATION_ET; // QIE8_LINEARIZATION_ET = 1023
556  if (output[ibin] > MAX_OUTPUT)
557  output[ibin] = MAX_OUTPUT;
558  }
559  outcoder_->compress(output, finegrain, result);
560 }
561 
564  const int hf_lumi_shift,
565  const HcalFeatureBit* embit) {
566  // Align digis and TP
567  const int SHIFT = samples.presamples() - numberOfPresamplesHF_;
568  assert(SHIFT >= 0);
569  assert((SHIFT + numberOfSamplesHF_) <= samples.size());
570 
571  // Try to find the HFDetails from the map corresponding to our samples
572  const HcalTrigTowerDetId detId(samples.id());
573  HFDetailMap::const_iterator it = theHFDetailMap.find(detId);
574  // Missing values will give an empty digi
575  if (it == theHFDetailMap.end()) {
576  return;
577  }
578 
579  std::vector<std::bitset<2>> finegrain(numberOfSamplesHF_, false);
580 
581  // Set up out output of IntergerCaloSamples
583  output.setPresamples(numberOfPresamplesHF_);
584 
585  for (const auto& item : it->second) {
586  auto& details = item.second;
587  for (int ibin = 0; ibin < numberOfSamplesHF_; ++ibin) {
588  const int IDX = ibin + SHIFT;
589  int long_fiber_val = 0;
590  if (IDX < details.long_fiber.size()) {
591  long_fiber_val = details.long_fiber[IDX];
592  }
593  int short_fiber_val = 0;
594  if (IDX < details.short_fiber.size()) {
595  short_fiber_val = details.short_fiber[IDX];
596  }
597  output[ibin] += (long_fiber_val + short_fiber_val);
598 
599  uint32_t ADCLong = details.LongDigi[ibin].adc();
600  uint32_t ADCShort = details.ShortDigi[ibin].adc();
601 
602  if (details.LongDigi.id().ietaAbs() >= FIRST_FINEGRAIN_TOWER) {
603  finegrain[ibin][1] = (ADCLong > FG_HF_thresholds_[0] || ADCShort > FG_HF_thresholds_[0]);
604 
605  if (embit != nullptr)
606  finegrain[ibin][0] = embit->fineGrainbit(details.ShortDigi, details.LongDigi, ibin);
607  }
608  }
609  }
610 
611  for (int bin = 0; bin < numberOfSamplesHF_; ++bin) {
612  static const unsigned int MAX_OUTPUT = QIE8_LINEARIZATION_ET; // QIE8_LINEARIZATION_ET = 1023
613  output[bin] = min({MAX_OUTPUT, output[bin] >> hf_lumi_shift});
614  }
615 
616  std::vector<int> finegrain_converted;
617  finegrain_converted.reserve(finegrain.size());
618  for (const auto& fg : finegrain)
619  finegrain_converted.push_back(fg.to_ulong());
620  outcoder_->compress(output, finegrain_converted, result);
621 }
622 
623 bool HcalTriggerPrimitiveAlgo::passTDC(const QIE10DataFrame& digi, int ts) const {
625  auto adc_threshold = parameters->getADCThresholdHF();
626  auto tdc_mask = parameters->getTDCMaskHF();
627 
628  if (override_adc_hf_)
629  adc_threshold = override_adc_hf_value_;
630  if (override_tdc_hf_)
631  tdc_mask = override_tdc_hf_value_;
632 
633  if (digi[ts].adc() < adc_threshold)
634  return true;
635 
636  return (1ul << digi[ts].le_tdc()) & tdc_mask;
637 }
638 
640  // channels with invalid data should not contribute to the sum
641  if (digi.linkError() || ts >= digi.samples() || !digi[ts].ok())
642  return false;
643 
644  auto mask = conditions_->getHcalTPChannelParameter(HcalDetId(digi.id()))->getMask();
645  if (mask)
646  return false;
647 
648  return true;
649 }
650 
653  const int hf_lumi_shift,
654  const HcalFeatureBit* embit) {
655  // Align digis and TP
656  const int shift = samples.presamples() - numberOfPresamplesHF_;
657  assert(shift >= 0);
658  assert((shift + numberOfSamplesHF_) <= samples.size());
659  assert(hf_lumi_shift >= 2);
660 
661  // Try to find the HFDetails from the map corresponding to our samples
662  const HcalTrigTowerDetId detId(samples.id());
663  auto it = theHFUpgradeDetailMap.find(detId);
664  // Missing values will give an empty digi
665  if (it == theHFUpgradeDetailMap.end()) {
666  return;
667  }
668 
669  std::vector<std::bitset<2>> finegrain(numberOfSamplesHF_, false);
670 
671  // Set up out output of IntergerCaloSamples
673  output.setPresamples(numberOfPresamplesHF_);
674 
675  for (const auto& item : it->second) {
676  auto& details = item.second;
677  for (int ibin = 0; ibin < numberOfSamplesHF_; ++ibin) {
678  const int idx = ibin + shift;
679 
680  int long_fiber_val = 0;
681  int long_fiber_count = 0;
682  int short_fiber_val = 0;
683  int short_fiber_count = 0;
684 
685  bool saturated = false;
686 
687  for (auto i : {0, 2}) {
688  if (idx < details[i].samples.size() and details[i].validity[idx] and details[i].passTDC[idx]) {
689  long_fiber_val += details[i].samples[idx];
690  saturated = saturated || (details[i].samples[idx] == QIE10_LINEARIZATION_ET);
691  ++long_fiber_count;
692  }
693  }
694  for (auto i : {1, 3}) {
695  if (idx < details[i].samples.size() and details[i].validity[idx] and details[i].passTDC[idx]) {
696  short_fiber_val += details[i].samples[idx];
697  saturated = saturated || (details[i].samples[idx] == QIE10_LINEARIZATION_ET);
698  ++short_fiber_count;
699  }
700  }
701 
702  if (saturated) {
704  } else {
705  // For details of the energy handling, see:
706  // https://cms-docdb.cern.ch/cgi-bin/DocDB/ShowDocument?docid=12306
707  // If both readouts are valid, average of the two energies is taken
708  // division by 2 is compensated by adjusting the total scale shift in the end
709  if (long_fiber_count == 2)
710  long_fiber_val >>= 1;
711  if (short_fiber_count == 2)
712  short_fiber_val >>= 1;
713 
714  auto sum = long_fiber_val + short_fiber_val;
715  // Similar to above, if both channels are valid,
716  // average of the two energies is calculated
717  // division by 2 here is also compensated by adjusting the total scale shift in the end
718  if (long_fiber_count > 0 and short_fiber_count > 0)
719  sum >>= 1;
720 
721  output[ibin] += sum;
722  }
723 
724  for (const auto& detail : details) {
725  if (idx < int(detail.digi.size()) and detail.validity[idx] and
726  HcalDetId(detail.digi.id()).ietaAbs() >= FIRST_FINEGRAIN_TOWER) {
727  if (useTDCInMinBiasBits_ && !detail.passTDC[idx])
728  continue;
729  finegrain[ibin][1] = finegrain[ibin][1] or detail.fgbits[idx][0];
730  // what is commonly called the "second" HF min-bias bit is
731  // actually the 0-th bit, which can also be used instead for the EM bit
732  // (called finegrain[ibin][0] below) in non-HI running
733  finegrain[ibin][0] = finegrain[ibin][0] or detail.fgbits[idx][1];
734  }
735  }
736  // the EM bit is only used if the "second" FG bit is disabled
737  if (embit != nullptr and FG_HF_thresholds_.at(1) != 255) {
738  finegrain[ibin][0] = embit->fineGrainbit(details[1].digi,
739  details[3].digi,
740  details[0].digi,
741  details[2].digi,
742  details[1].validity[idx],
743  details[3].validity[idx],
744  details[0].validity[idx],
745  details[2].validity[idx],
746  idx);
747  }
748  }
749  }
750 
751  for (int bin = 0; bin < numberOfSamplesHF_; ++bin) {
752  output[bin] = min({(unsigned int)QIE10_MAX_LINEARIZATION_ET, output[bin] >> (hf_lumi_shift - 2)});
753  }
754  std::vector<int> finegrain_converted;
755  finegrain_converted.reserve(finegrain.size());
756  for (const auto& fg : finegrain)
757  finegrain_converted.push_back(fg.to_ulong());
758  outcoder_->compress(output, finegrain_converted, result);
759 }
760 
762  for (HcalTrigPrimDigiCollection::iterator tp = result.begin(); tp != result.end(); ++tp) {
763  bool ZS = true;
764  for (int i = 0; i < tp->size(); ++i) {
765  if (tp->sample(i).compressedEt() > ZS_threshold_I_) {
766  ZS = false;
767  break;
768  }
769  }
770  if (ZS)
771  tp->setZSInfo(false, true);
772  else
773  tp->setZSInfo(true, false);
774  }
775 }
776 
778  const HcalElectronicsMap* emap,
780  std::set<uint32_t> FrontEndErrors;
781 
783  const FEDRawData& raw = rawraw->FEDData(i);
784  if (raw.size() < 12)
785  continue;
786  const HcalDCCHeader* dccHeader = (const HcalDCCHeader*)(raw.data());
787  if (!dccHeader)
788  continue;
789  HcalHTRData htr;
790  for (int spigot = 0; spigot < HcalDCCHeader::SPIGOT_COUNT; spigot++) {
791  if (!dccHeader->getSpigotPresent(spigot))
792  continue;
793  dccHeader->getSpigotData(spigot, htr, raw.size());
794  int dccid = dccHeader->getSourceId();
795  int errWord = htr.getErrorsWord() & 0x1FFFF;
796  bool HTRError = (!htr.check() || htr.isHistogramEvent() || (errWord & 0x800) != 0);
797 
798  if (HTRError) {
799  bool valid = false;
800  for (int fchan = 0; fchan < 3 && !valid; fchan++) {
801  for (int fib = 0; fib < 9 && !valid; fib++) {
802  HcalElectronicsId eid(fchan, fib, spigot, dccid - FEDNumbering::MINHCALFEDID);
803  eid.setHTR(htr.readoutVMECrateId(), htr.htrSlot(), htr.htrTopBottom());
804  DetId detId = emap->lookup(eid);
805  if (detId.null())
806  continue;
807  HcalSubdetector subdet = (HcalSubdetector(detId.subdetId()));
808  if (detId.det() != 4 || (subdet != HcalBarrel && subdet != HcalEndcap && subdet != HcalForward))
809  continue;
810  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(detId);
811  for (std::vector<HcalTrigTowerDetId>::const_iterator triggerId = ids.begin(); triggerId != ids.end();
812  ++triggerId) {
813  FrontEndErrors.insert(triggerId->rawId());
814  }
815  //valid = true;
816  }
817  }
818  }
819  }
820  }
821 
822  // Loop over TP collection
823  // Set TP to zero if there is FE Format Error
824  HcalTriggerPrimitiveSample zeroSample(0);
825  for (HcalTrigPrimDigiCollection::iterator tp = result.begin(); tp != result.end(); ++tp) {
826  if (FrontEndErrors.find(tp->id().rawId()) != FrontEndErrors.end()) {
827  for (int i = 0; i < tp->size(); ++i)
828  tp->setSample(i, zeroSample);
829  }
830  }
831 }
832 
833 void HcalTriggerPrimitiveAlgo::addFG(const HcalTrigTowerDetId& id, std::vector<bool>& msb) {
834  FGbitMap::iterator itr = fgMap_.find(id);
835  if (itr != fgMap_.end()) {
836  std::vector<bool>& _msb = itr->second;
837  for (size_t i = 0; i < msb.size(); ++i)
838  _msb[i] = _msb[i] || msb[i];
839  } else
840  fgMap_[id] = msb;
841 }
842 
845  return false;
846  if (id.ietaAbs() > LAST_FINEGRAIN_TOWER)
847  return false;
848  if (id.ietaAbs() == HBHE_OVERLAP_TOWER and not upgrade_hb_)
849  return false;
850  return true;
851 }
852 
854  // This tower (ietaAbs == 16) does not accept upgraded FG bits,
855  // but needs pseudo legacy ones to ensure that the tower is processed
856  // even when the QIE8 depths in front of it do not have energy deposits.
857  if (id.ietaAbs() == HBHE_OVERLAP_TOWER and not upgrade_hb_)
858  return true;
859  return false;
860 }
861 
863  // Depth 7 for TT 26, 27, and 28 is not considered a fine grain depth.
864  // However, the trigger tower for these ieta should still be added to the fgUpgradeMap_
865  // Otherwise, depth 7-only signal will not be analyzed.
866  unsigned int aieta = id.ietaAbs();
867  if (aieta >= FIRST_DEPTH7_TOWER and aieta <= LAST_FINEGRAIN_TOWER and depth > LAST_FINEGRAIN_DEPTH)
868  return true;
869  return false;
870 }
871 
873  int depth,
874  const std::vector<std::bitset<2>>& bits) {
875  if (not validUpgradeFG(id, depth)) {
876  if (needLegacyFG(id)) {
877  std::vector<bool> pseudo(bits.size(), false);
878  addFG(id, pseudo);
879  } else if (needUpgradeID(id, depth)) {
880  // If the tower id is not in the map yet
881  // then for safety's sake add it, otherwise, no need
882  // Likewise, we're here with non-fg depth 7 so the bits are not to be added
883  auto it = fgUpgradeMap_.find(id);
884  if (it == fgUpgradeMap_.end()) {
885  FGUpgradeContainer element;
886  element.resize(bits.size());
887  fgUpgradeMap_.insert(std::make_pair(id, element));
888  }
889  }
890 
891  return;
892  }
893 
894  auto it = fgUpgradeMap_.find(id);
895  if (it == fgUpgradeMap_.end()) {
896  FGUpgradeContainer element;
897  element.resize(bits.size());
898  it = fgUpgradeMap_.insert(std::make_pair(id, element)).first;
899  }
900  for (unsigned int i = 0; i < bits.size(); ++i) {
901  it->second[i][0][depth - 1] = bits[i][0];
902  it->second[i][1][depth - 1] = bits[i][1];
903  }
904 }
905 
907  HcalDetId detId(frame.id());
908  if (detId.subdet() != HcalEndcap && detId.subdet() != HcalBarrel)
909  return;
910 
911  std::vector<HcalTrigTowerDetId> ids = theTrigTowerGeometry->towerIds(detId);
912  assert(ids.size() == 1 || ids.size() == 2);
913  IntegerCaloSamples samples1(ids[0], int(frame.samples()));
914  samples1.setPresamples(frame.presamples());
915  incoder_->adc2Linear(frame, samples1); // use linearization LUT
916 
917  auto it = fgUpgradeTDCMap_.find(id);
918  if (it == fgUpgradeTDCMap_.end()) {
919  FGUpgradeTDCContainer element;
920  element.resize(frame.samples());
921  it = fgUpgradeTDCMap_.insert(std::make_pair(id, element)).first;
922  }
923  for (int i = 0; i < frame.samples(); i++) {
924  it->second[i][detId.depth() - 1] = std::make_pair(samples1[i], frame[i].tdc());
925  }
926 }
927 
929  // Names are just abs(ieta) for HBHE
930  std::vector<std::string> ietaStrs = weightsQIE11.getParameterNames();
931  for (auto& ietaStr : ietaStrs) {
932  // Strip off "ieta" part of key and just use integer value in map
933  auto const& v = weightsQIE11.getParameter<std::vector<double>>(ietaStr);
934  weightsQIE11_[std::stoi(ietaStr.substr(4))] = {{v[0], v[1]}};
935  }
936 }
937 
939  // Simple map of |ieta| in HBHE to weight
940  // Only one weight for SOI-1 TS
941  weightsQIE11_[aieta] = {{weight, 1.0}};
942 }
943 
945  if (algo <= 0 || algo > 2)
946  throw cms::Exception("ERROR: Only algo 1 & 2 are supported.") << std::endl;
948 }
949 
951 
FEDNumbering.h
HcalHTRData::readoutVMECrateId
unsigned int readoutVMECrateId() const
HcalElectronicsId-style VME crate number.
Definition: HcalHTRData.cc:373
HcalTriggerPrimitiveAlgo::numberOfSamplesHF_
int numberOfSamplesHF_
Definition: HcalTriggerPrimitiveAlgo.h:149
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
hcaltpdigi_cfi.numberOfSamplesHF
numberOfSamplesHF
Definition: hcaltpdigi_cfi.py:57
HcalTriggerPrimitiveAlgo::addFG
void addFG(const HcalTrigTowerDetId &id, std::vector< bool > &msb)
Definition: HcalTriggerPrimitiveAlgo.cc:833
mps_fire.i
i
Definition: mps_fire.py:428
HcalTrigTowerGeometry::towerIds
std::vector< HcalTrigTowerDetId > towerIds(const HcalDetId &cellId) const
the mapping to and from DetIds
Definition: HcalTrigTowerGeometry.cc:15
MessageLogger.h
HcalTriggerPrimitiveAlgo::weightsQIE11_
std::array< std::array< double, 2 >, 29 > weightsQIE11_
Definition: HcalTriggerPrimitiveAlgo.h:139
HcalHTRData::isHistogramEvent
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
Definition: HcalHTRData.cc:409
config_102169_raw_cff.latency
latency
Definition: config_102169_raw_cff.py:29
HcalTriggerPrimitiveAlgo::overrideParameters
void overrideParameters(const edm::ParameterSet &ps)
Definition: HcalTriggerPrimitiveAlgo.cc:81
simplePhotonAnalyzer_cfi.sample
sample
Definition: simplePhotonAnalyzer_cfi.py:12
HcalTriggerPrimitiveAlgo::override_adc_hf_value_
uint32_t override_adc_hf_value_
Definition: HcalTriggerPrimitiveAlgo.h:230
HcalTriggerPrimitiveAlgo::HF_Veto
TowerMapVeto HF_Veto
Definition: HcalTriggerPrimitiveAlgo.h:208
QIE10DataFrame::samples
constexpr int samples() const
total number of samples in the digi
Definition: QIE10DataFrame.h:86
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
min
T min(T a, T b)
Definition: MathUtil.h:58
HcalTriggerPrimitiveSample
Definition: HcalTriggerPrimitiveSample.h:11
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
mps_merge.weight
weight
Definition: mps_merge.py:88
HcalTriggerPrimitiveAlgo::setUpgradeFlags
void setUpgradeFlags(bool hb, bool he, bool hf)
Definition: HcalTriggerPrimitiveAlgo.cc:73
HcalTriggerPrimitiveAlgo::upgrade_he_
bool upgrade_he_
Definition: HcalTriggerPrimitiveAlgo.h:222
QIE10DataFrame::linkError
constexpr bool linkError() const
Definition: QIE10DataFrame.h:101
HcalTriggerPrimitiveAlgo::setWeightsQIE11
void setWeightsQIE11(const edm::ParameterSet &weightsQIE11)
Definition: HcalTriggerPrimitiveAlgo.cc:928
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
HcalTriggerPrimitiveAlgo::FGUpgradeTDCContainer
std::vector< HcalFinegrainBit::TowerTDC > FGUpgradeTDCContainer
Definition: HcalTriggerPrimitiveAlgo.h:217
HcalTriggerPrimitiveAlgo::FIRST_FINEGRAIN_TOWER
static const int FIRST_FINEGRAIN_TOWER
Definition: HcalTriggerPrimitiveAlgo.h:241
HcalTriggerPrimitiveAlgo::addUpgradeFG
void addUpgradeFG(const HcalTrigTowerDetId &id, int depth, const std::vector< std::bitset< 2 >> &bits)
Definition: HcalTriggerPrimitiveAlgo.cc:872
HcalTriggerPrimitiveAlgo::ZS_threshold_
uint32_t ZS_threshold_
Definition: HcalTriggerPrimitiveAlgo.h:143
HcalTriggerPrimitiveAlgo::numberOfPresamples_
int numberOfPresamples_
Definition: HcalTriggerPrimitiveAlgo.h:146
HcalFinegrainBit::compute
std::bitset< 2 > compute(const Tower &) const
Definition: HcalFinegrainBit.cc:5
HcalTriggerPrimitiveAlgo::conditions_
const HcalDbService * conditions_
Definition: HcalTriggerPrimitiveAlgo.h:135
cms::cuda::assert
assert(be >=bs)
edm::SortedCollection
Definition: SortedCollection.h:49
HcalTPChannelParameters.h
HcalTPChannelParameter::getMask
uint32_t getMask() const
get mask for channel validity and self trigger information
Definition: HcalTPChannelParameter.h:10
HcalTriggerPrimitiveAlgo::FGUpgradeContainer
std::vector< HcalFinegrainBit::Tower > FGUpgradeContainer
Definition: HcalTriggerPrimitiveAlgo.h:213
DetId::null
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
HcalTriggerPrimitiveAlgo::setNCTScaleShift
void setNCTScaleShift(int)
Definition: HcalTriggerPrimitiveAlgo.cc:950
HcalTPGCompressor::compress
void compress(const IntegerCaloSamples &ics, const std::vector< int > &fineGrain, HcalTriggerPrimitiveDigi &digi) const
Definition: HcalTPGCompressor.cc:6
detail
Definition: ConvertingESProducerWithDependenciesT.h:23
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
hcaltpdigi_cfi.numberOfPresamples
numberOfPresamples
Definition: hcaltpdigi_cfi.py:56
HcalBarrel
Definition: HcalAssistant.h:33
findQualityFiles.v
v
Definition: findQualityFiles.py:179
HcalTriggerPrimitiveAlgo::fgUpgradeTDCMap_
FGUpgradeTDCMap fgUpgradeTDCMap_
Definition: HcalTriggerPrimitiveAlgo.h:219
HcalTriggerPrimitiveAlgo::override_tdc_hf_value_
unsigned long long override_tdc_hf_value_
Definition: HcalTriggerPrimitiveAlgo.h:232
HcalHTRData::htrSlot
unsigned int htrSlot() const
HcalElectronicsId-style HTR slot.
Definition: HcalHTRData.cc:365
HcalTriggerPrimitiveAlgo::QIE11_MAX_LINEARIZATION_ET
static const int QIE11_MAX_LINEARIZATION_ET
Definition: HcalTriggerPrimitiveAlgo.h:248
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
IntegerCaloSamples
Definition: IntegerCaloSamples.h:16
HcalDCCHeader::SPIGOT_COUNT
static const int SPIGOT_COUNT
Definition: HcalDCCHeader.h:19
HcalTriggerPrimitiveAlgo::setWeightQIE11
void setWeightQIE11(int aieta, double weight)
Definition: HcalTriggerPrimitiveAlgo.cc:938
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
EgammaValidation_cff.samples
samples
Definition: EgammaValidation_cff.py:18
HcalFinegrainBit
Definition: HcalFinegrainBit.h:8
HcalTriggerPrimitiveAlgo::setRCTScaleShift
void setRCTScaleShift(int)
Definition: HcalTriggerPrimitiveAlgo.cc:952
HcalTriggerPrimitiveAlgo::theSatMap
SatMap theSatMap
Definition: HcalTriggerPrimitiveAlgo.h:172
HcalTriggerPrimitiveAlgo::HFDetails
Definition: HcalTriggerPrimitiveAlgo.h:174
DetId
Definition: DetId.h:17
cmsdt::algo
algo
Definition: constants.h:171
hcaltpdigi_cfi.weightsQIE11
weightsQIE11
hardware algo
Definition: hcaltpdigi_cfi.py:20
HcalTriggerPrimitiveAlgo::QIE10_MAX_LINEARIZATION_ET
static const int QIE10_MAX_LINEARIZATION_ET
Definition: HcalTriggerPrimitiveAlgo.h:247
HcalDCCHeader::getSourceId
int getSourceId() const
Definition: HcalDCCHeader.h:32
FEDNumbering::MAXHCALFEDID
Definition: FEDNumbering.h:48
HcalTriggerPrimitiveAlgo::LAST_FINEGRAIN_TOWER
static const int LAST_FINEGRAIN_TOWER
Definition: HcalTriggerPrimitiveAlgo.h:238
HcalTriggerPrimitiveAlgo::passTDC
bool passTDC(const QIE10DataFrame &digi, int ts) const
Definition: HcalTriggerPrimitiveAlgo.cc:623
photonIsolationHIProducer_cfi.hf
hf
Definition: photonIsolationHIProducer_cfi.py:9
HcalTriggerPrimitiveAlgo::addSignal
void addSignal(const HBHEDataFrame &frame)
adds the signal to the map
Definition: HcalTriggerPrimitiveAlgo.cc:94
HcalTPParameters.h
HcalHTRData::htrTopBottom
unsigned int htrTopBottom() const
HcalElectronicsId-style HTR top/bottom (1=top/0=bottom)
Definition: HcalHTRData.cc:369
w
const double w
Definition: UKUtility.cc:23
HcalTriggerPrimitiveAlgo::analyzeQIE11
void analyzeQIE11(IntegerCaloSamples &samples, std::vector< bool > sample_saturation, HcalTriggerPrimitiveDigi &result, const HcalFinegrainBit &fg_algo)
Definition: HcalTriggerPrimitiveAlgo.cc:401
HcalTriggerPrimitiveAlgo::numberOfFilterPresamplesHEQIE11_
int numberOfFilterPresamplesHEQIE11_
Definition: HcalTriggerPrimitiveAlgo.h:148
HcalTriggerPrimitiveAlgo::FG_threshold_
uint32_t FG_threshold_
Definition: HcalTriggerPrimitiveAlgo.h:141
HcalTriggerPrimitiveAlgo::QIE10_LINEARIZATION_ET
static const int QIE10_LINEARIZATION_ET
Definition: HcalTriggerPrimitiveAlgo.h:244
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
hcal_dqm_sourceclient-live_cfg.FG_threshold
FG_threshold
Definition: hcal_dqm_sourceclient-live_cfg.py:101
IntegerCaloSamples.h
details
Definition: helper.h:56
HcalTriggerPrimitiveAlgo::fgUpgradeMap_
FGUpgradeMap fgUpgradeMap_
Definition: HcalTriggerPrimitiveAlgo.h:215
HcalTriggerPrimitiveAlgo::runZS
void runZS(HcalTrigPrimDigiCollection &tp)
Definition: HcalTriggerPrimitiveAlgo.cc:761
HcalTrigTowerDetId::version
int version() const
get the version code for the trigger tower
Definition: HcalTrigTowerDetId.h:60
HcalDbService::getHcalTPParameters
const HcalTPParameters * getHcalTPParameters() const
Definition: HcalDbService.cc:413
HcalTriggerPrimitiveAlgo::~HcalTriggerPrimitiveAlgo
~HcalTriggerPrimitiveAlgo()
Definition: HcalTriggerPrimitiveAlgo.cc:71
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
HcalTriggerPrimitiveAlgo::setFixSaturationFlag
void setFixSaturationFlag(bool fix_saturation)
Definition: HcalTriggerPrimitiveAlgo.cc:79
HcalTriggerPrimitiveAlgo::validUpgradeFG
bool validUpgradeFG(const HcalTrigTowerDetId &id, int depth) const
Definition: HcalTriggerPrimitiveAlgo.cc:843
HcalTriggerPrimitiveAlgo::override_parameters_
edm::ParameterSet override_parameters_
Definition: HcalTriggerPrimitiveAlgo.h:227
HcalTriggerPrimitiveAlgo::numberOfFilterPresamplesHBQIE11_
int numberOfFilterPresamplesHBQIE11_
Definition: HcalTriggerPrimitiveAlgo.h:147
HcalTriggerPrimitiveAlgo::minSignalThreshold_
uint32_t minSignalThreshold_
Definition: HcalTriggerPrimitiveAlgo.h:152
HcalTriggerPrimitiveAlgo::HBHE_OVERLAP_TOWER
static const int HBHE_OVERLAP_TOWER
Definition: HcalTriggerPrimitiveAlgo.h:235
HBHEDataFrame
Definition: HBHEDataFrame.h:14
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
HcalTriggerPrimitiveAlgo::PMT_NoiseThreshold_
uint32_t PMT_NoiseThreshold_
Definition: HcalTriggerPrimitiveAlgo.h:153
HcalTriggerPrimitiveAlgo::fix_saturation_
bool fix_saturation_
Definition: HcalTriggerPrimitiveAlgo.h:225
HcalTriggerPrimitiveDigi
Definition: HcalTriggerPrimitiveDigi.h:13
HcalTriggerPrimitiveAlgo::addUpgradeTDCFG
void addUpgradeTDCFG(const HcalTrigTowerDetId &id, const QIE11DataFrame &frame)
Definition: HcalTriggerPrimitiveAlgo.cc:906
edm::ParameterSet
Definition: ParameterSet.h:47
HcalFeatureBit::fineGrainbit
virtual bool fineGrainbit(const QIE10DataFrame &short1, const QIE10DataFrame &short2, const QIE10DataFrame &long1, const QIE10DataFrame &long2, bool validShort1, bool validShort2, bool validLong1, bool validLong2, int idx) const =0
HcalTriggerPrimitiveAlgo::theHFUpgradeDetailMap
HFUpgradeDetailMap theHFUpgradeDetailMap
Definition: HcalTriggerPrimitiveAlgo.h:191
HcalTriggerPrimitiveAlgo::theTrigTowerGeometry
const HcalTrigTowerGeometry * theTrigTowerGeometry
Definition: HcalTriggerPrimitiveAlgo.h:166
hcal_dqm_sourceclient-live_cfg.ZS_threshold
ZS_threshold
Definition: hcal_dqm_sourceclient-live_cfg.py:109
HcalTriggerPrimitiveAlgo::theSumMap
SumMap theSumMap
Definition: HcalTriggerPrimitiveAlgo.h:169
edm::SortedCollection::iterator
std::vector< T >::iterator iterator
Definition: SortedCollection.h:81
HcalTriggerPrimitiveAlgo::peakfind_
bool peakfind_
Definition: HcalTriggerPrimitiveAlgo.h:137
FEDNumbering::MINHCALFEDID
Definition: FEDNumbering.h:47
HcalDetId.h
HcalTriggerPrimitiveAlgo::HcalTriggerPrimitiveAlgo
HcalTriggerPrimitiveAlgo(bool pf, const std::vector< double > &w, int latency, uint32_t FG_threshold, const std::vector< uint32_t > &FG_HF_thresholds, uint32_t ZS_threshold, int numberOfSamples, int numberOfPresamples, int numberOfFilterPresamplesHBQIE11, int numberOfFilterPresamplesHEQIE11, int numberOfSamplesHF, int numberOfPresamplesHF, bool useTDCInMinBiasBits, uint32_t minSignalThreshold=0, uint32_t PMT_NoiseThreshold=0)
Definition: HcalTriggerPrimitiveAlgo.cc:23
hcaltpdigi_cff.FG_HF_thresholds
FG_HF_thresholds
Definition: hcaltpdigi_cff.py:26
HcalTriggerPrimitiveAlgo::analyzeHF
void analyzeHF(IntegerCaloSamples &samples, HcalTriggerPrimitiveDigi &result, const int hf_lumi_shift)
Definition: HcalTriggerPrimitiveAlgo.cc:508
HcalTrigTowerGeometry::topology
const HcalTopology & topology() const
Definition: HcalTrigTowerGeometry.h:27
HcalTriggerPrimitiveAlgo::override_adc_hf_
bool override_adc_hf_
Definition: HcalTriggerPrimitiveAlgo.h:229
HcalDetId::subdet
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
HcaluLUTTPGCoder::lookupMSB
void lookupMSB(const HBHEDataFrame &df, std::vector< bool > &msb) const
Definition: HcaluLUTTPGCoder.cc:589
HcalDetId
Definition: HcalDetId.h:12
createfilelist.int
int
Definition: createfilelist.py:10
HFDataFrame
Definition: HFDataFrame.h:14
hcaltpdigi_cfi.numberOfFilterPresamplesHBQIE11
numberOfFilterPresamplesHBQIE11
Definition: hcaltpdigi_cfi.py:59
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
HcalTriggerPrimitiveAlgo::analyzeHFQIE10
void analyzeHFQIE10(const IntegerCaloSamples &SAMPLES, HcalTriggerPrimitiveDigi &result, const int HF_LUMI_SHIFT, const HcalFeatureBit *HCALFEM)
Definition: HcalTriggerPrimitiveAlgo.cc:651
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
HcalTriggerPrimitiveAlgo::needLegacyFG
bool needLegacyFG(const HcalTrigTowerDetId &id) const
Definition: HcalTriggerPrimitiveAlgo.cc:853
HcalTriggerPrimitiveAlgo::needUpgradeID
bool needUpgradeID(const HcalTrigTowerDetId &id, int depth) const
Definition: HcalTriggerPrimitiveAlgo.cc:862
HcalFeatureBit
Definition: HcalFeatureBit.h:8
HcalTriggerPrimitiveAlgo::FIRST_DEPTH7_TOWER
static const int FIRST_DEPTH7_TOWER
Definition: HcalTriggerPrimitiveAlgo.h:236
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
HcalTrigTowerGeometry.h
HcalTriggerPrimitiveAlgo::theHFDetailMap
HFDetailMap theHFDetailMap
Definition: HcalTriggerPrimitiveAlgo.h:181
HcalTriggerPrimitiveAlgo::fgMap_
FGbitMap fgMap_
Definition: HcalTriggerPrimitiveAlgo.h:211
hcaltpdigi_cfi.numberOfFilterPresamplesHEQIE11
numberOfFilterPresamplesHEQIE11
Definition: hcaltpdigi_cfi.py:60
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
HcalTriggerPrimitiveAlgo::validChannel
bool validChannel(const QIE10DataFrame &digi, int ts) const
Definition: HcalTriggerPrimitiveAlgo.cc:639
HcalElectronicsId.h
HcalTriggerPrimitiveAlgo::NCTScaleShift
int NCTScaleShift
Definition: HcalTriggerPrimitiveAlgo.h:154
HcalTriggerPrimitiveAlgo::RCTScaleShift
int RCTScaleShift
Definition: HcalTriggerPrimitiveAlgo.h:155
hcalSimParameters_cfi.hb
hb
Definition: hcalSimParameters_cfi.py:60
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
HcalTriggerPrimitiveAlgo.h
HcalDCCHeader::getSpigotPresent
bool getSpigotPresent(unsigned int nspigot) const
Read the "PRESENT" bit for this spigot.
Definition: HcalDCCHeader.h:106
HcalDCCHeader
Definition: HcalDCCHeader.h:17
HcalTriggerPrimitiveAlgo::theThreshold
double theThreshold
Definition: HcalTriggerPrimitiveAlgo.h:136
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
HcalElectronicsMap
Definition: HcalElectronicsMap.h:31
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
HcalTriggerPrimitiveAlgo::LAST_FINEGRAIN_DEPTH
static const int LAST_FINEGRAIN_DEPTH
Definition: HcalTriggerPrimitiveAlgo.h:237
HcalForward
Definition: HcalAssistant.h:36
HcalTriggerPrimitiveAlgo::numberOfPresamplesHF_
int numberOfPresamplesHF_
Definition: HcalTriggerPrimitiveAlgo.h:150
HcalTriggerPrimitiveAlgo::upgrade_hf_
bool upgrade_hf_
Definition: HcalTriggerPrimitiveAlgo.h:223
HcalTriggerPrimitiveAlgo::peak_finder_algorithm_
int peak_finder_algorithm_
Definition: HcalTriggerPrimitiveAlgo.h:161
std
Definition: JetResolutionObject.h:76
HcalTriggerPrimitiveAlgo::setPeakFinderAlgorithm
void setPeakFinderAlgorithm(int algo)
Definition: HcalTriggerPrimitiveAlgo.cc:944
HcalElectronicsMap::lookup
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
Definition: HcalElectronicsMap.cc:70
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
QIE10DataFrame
Definition: QIE10DataFrame.h:11
hcalSimParameters_cfi.he
he
Definition: hcalSimParameters_cfi.py:79
HcalEndcap
Definition: HcalAssistant.h:34
packedPFCandidateRefMixer_cfi.pf
pf
Definition: packedPFCandidateRefMixer_cfi.py:4
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
QIE11DataFrame
Definition: QIE11DataFrame.h:11
Exception
Definition: hltDiff.cc:245
HcalTriggerPrimitiveAlgo::outcoder_
const HcalTPGCompressor * outcoder_
Definition: HcalTriggerPrimitiveAlgo.h:134
HcalTriggerPrimitiveAlgo::ZS_threshold_I_
int ZS_threshold_I_
Definition: HcalTriggerPrimitiveAlgo.h:144
HcalDbService::getHcalTPChannelParameter
const HcalTPChannelParameter * getHcalTPChannelParameter(const HcalGenericDetId &fId, bool throwOnFail=true) const
Definition: HcalDbService.cc:391
HcalTriggerPrimitiveAlgo::override_tdc_hf_
bool override_tdc_hf_
Definition: HcalTriggerPrimitiveAlgo.h:231
hcaltpdigi_cfi.numberOfPresamplesHF
numberOfPresamplesHF
Definition: hcaltpdigi_cfi.py:58
IntegerCaloSamples::setPresamples
void setPresamples(int pre)
set presample information
Definition: IntegerCaloSamples.cc:13
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HcalTriggerPrimitiveAlgo::runFEFormatError
void runFEFormatError(const FEDRawDataCollection *rawraw, const HcalElectronicsMap *emap, HcalTrigPrimDigiCollection &result)
Definition: HcalTriggerPrimitiveAlgo.cc:777
hcaltpdigi_cfi.useTDCInMinBiasBits
useTDCInMinBiasBits
Definition: hcaltpdigi_cfi.py:61
HcalTriggerPrimitiveAlgo::analyze
void analyze(IntegerCaloSamples &samples, HcalTriggerPrimitiveDigi &result)
adds the actual digis
Definition: HcalTriggerPrimitiveAlgo.cc:319
HcalDCCHeader.h
mps_fire.result
result
Definition: mps_fire.py:311
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
HcalDetId::ietaAbs
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
ParameterSet.h
HcalTriggerPrimitiveAlgo::theTowerMapFGSum
TowerMapFGSum theTowerMapFGSum
Definition: HcalTriggerPrimitiveAlgo.h:195
HcalTriggerPrimitiveAlgo::useTDCInMinBiasBits_
bool useTDCInMinBiasBits_
Definition: HcalTriggerPrimitiveAlgo.h:151
HcalTriggerPrimitiveAlgo::upgrade_hb_
bool upgrade_hb_
Definition: HcalTriggerPrimitiveAlgo.h:221
HcalTriggerPrimitiveAlgo::FG_HF_thresholds_
std::vector< uint32_t > FG_HF_thresholds_
Definition: HcalTriggerPrimitiveAlgo.h:142
QIE10DataFrame::id
constexpr edm::DataFrame::id_type id() const
Definition: QIE10DataFrame.h:77
HcalHTRData
Definition: HcalHTRData.h:16
PbPb_ZMuSkimMuonDPG_cff.veto
veto
Definition: PbPb_ZMuSkimMuonDPG_cff.py:61
HcalTriggerPrimitiveAlgo::numberOfSamples_
int numberOfSamples_
Definition: HcalTriggerPrimitiveAlgo.h:145
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
HcalTriggerPrimitiveAlgo::analyzeHF2016
void analyzeHF2016(const IntegerCaloSamples &SAMPLES, HcalTriggerPrimitiveDigi &result, const int HF_LUMI_SHIFT, const HcalFeatureBit *HCALFEM)
Definition: HcalTriggerPrimitiveAlgo.cc:562
HcalHTRData::getErrorsWord
unsigned int getErrorsWord() const
Get the errors word.
Definition: HcalHTRData.h:162
HcalDCCHeader::getSpigotData
int getSpigotData(int nspigot, HcalHTRData &decodeTool, int validSize) const
Definition: HcalDCCHeader.cc:27
HcalTriggerPrimitiveAlgo::SumFGContainer
std::vector< IntegerCaloSamples > SumFGContainer
Definition: HcalTriggerPrimitiveAlgo.h:193
numberOfSamples
Definition: TotemSampicFrame.h:53
HcaluLUTTPGCoder::adc2Linear
void adc2Linear(const HBHEDataFrame &df, IntegerCaloSamples &ics) const override
Definition: HcaluLUTTPGCoder.cc:537
weight
Definition: weight.py:1
HcalTriggerPrimitiveAlgo::QIE11_LINEARIZATION_ET
static const int QIE11_LINEARIZATION_ET
Definition: HcalTriggerPrimitiveAlgo.h:245
HcalTriggerPrimitiveAlgo::QIE8_LINEARIZATION_ET
static const int QIE8_LINEARIZATION_ET
Definition: HcalTriggerPrimitiveAlgo.h:243
HcalTopology::lastHBRing
int lastHBRing() const
Definition: HcalTopology.h:92
HcalTriggerPrimitiveAlgo::weights_
std::vector< double > weights_
Definition: HcalTriggerPrimitiveAlgo.h:138
HcalTriggerPrimitiveAlgo::incoder_
const HcaluLUTTPGCoder * incoder_
Definition: HcalTriggerPrimitiveAlgo.h:133
HcalTrigTowerDetId
Definition: HcalTrigTowerDetId.h:14
HcalHTRData.h
HcalHTRData::check
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event.
Definition: HcalHTRData.cc:63