CMS 3D CMS Logo

HcalZSAlgoRealistic.cc
Go to the documentation of this file.
1 #include "HcalZSAlgoRealistic.h"
2 #include <iostream>
3 
5  bool use1ts,
6  int levelHB,
7  int levelHE,
8  int levelHO,
9  int levelHF,
10  std::pair<int, int> HBsearchTS,
11  std::pair<int, int> HEsearchTS,
12  std::pair<int, int> HOsearchTS,
13  std::pair<int, int> HFsearchTS)
15  use1ts_(use1ts),
16  thresholdHB_(levelHB),
17  thresholdHE_(levelHE),
18  thresholdHO_(levelHO),
19  thresholdHF_(levelHF),
20  HBsearchTS_(HBsearchTS),
21  HEsearchTS_(HEsearchTS),
22  HOsearchTS_(HOsearchTS),
23  HFsearchTS_(HFsearchTS) {
24  usingDBvalues = false;
25 }
26 
28  bool use1ts,
29  std::pair<int, int> HBsearchTS,
30  std::pair<int, int> HEsearchTS,
31  std::pair<int, int> HOsearchTS,
32  std::pair<int, int> HFsearchTS)
34  use1ts_(use1ts),
35  HBsearchTS_(HBsearchTS),
36  HEsearchTS_(HEsearchTS),
37  HOsearchTS_(HOsearchTS),
38  HFsearchTS_(HFsearchTS) {
39  thresholdHB_ = -1;
40  thresholdHE_ = -1;
41  thresholdHO_ = -1;
42  thresholdHF_ = -1;
43  usingDBvalues = true;
44 }
45 
46 template <class Digi>
47 bool HcalZSAlgoRealistic::keepMe(const Digi &inp, int start, int finish, int threshold, uint32_t zsmask) const {
48  if ((usingDBvalues) && (threshold < 0) && (m_dbService != nullptr)) {
49  threshold = (m_dbService->getHcalZSThreshold(inp.id()))->getValue();
50  }
51 
52  // determine the sum of 2 timeslices
53  for (int i = start; i < finish; i++) {
54  if ((zsmask & (1 << i)) != 0)
55  continue;
56  if ((inp[i].adc() + inp[i + 1].adc()) >= threshold)
57  return true;
58  }
59  return false;
60 }
61 
62 // zs mask not used for QIE10,11
63 
64 template <>
65 bool HcalZSAlgoRealistic::keepMe<QIE10DataFrame>(
66  const QIE10DataFrame &inp, int start, int finish, int threshold, uint32_t zsmask) const {
67  if ((usingDBvalues) && (threshold < 0) && (m_dbService != nullptr)) {
68  threshold = (m_dbService->getHcalZSThreshold(inp.id()))->getValue();
69  }
70 
71  // determine the sum of 2 timeslices
72  for (int i = start; i < finish; i++) {
73  if ((inp[i].adc() + inp[i + 1].adc()) >= threshold)
74  return true;
75  }
76  return false;
77 }
78 
79 template <>
80 bool HcalZSAlgoRealistic::keepMe<QIE11DataFrame>(
81  const QIE11DataFrame &inp, int start, int finish, int threshold, uint32_t zsmask) const {
82  if ((usingDBvalues) && (threshold < 0) && (m_dbService != nullptr)) {
83  threshold = (m_dbService->getHcalZSThreshold(inp.id()))->getValue();
84  }
85 
86  // sum of 2 timeslices or just single one
87  for (int i = start; i < finish; i++) {
88  int sum = inp[i].adc();
89  if (!use1ts_)
90  sum += inp[i + 1].adc();
91  if (sum >= threshold)
92  return true;
93  }
94  return false;
95 }
96 
98  if (digi.id().subdet() == HcalBarrel) {
99  int start = std::max(0, HBsearchTS_.first);
100  int finish = std::min(digi.size() - 1, HBsearchTS_.second);
101  return keepMe(digi, start, finish, thresholdHB_, digi.zsCrossingMask());
102  } else {
103  int start = std::max(0, HEsearchTS_.first);
104  int finish = std::min(digi.size() - 1, HEsearchTS_.second);
105  return keepMe(digi, start, finish, thresholdHE_, digi.zsCrossingMask());
106  }
107 }
108 
110  int start = std::max(0, HOsearchTS_.first);
111  int finish = std::min(digi.size() - 1, HOsearchTS_.second);
112  return keepMe(digi, start, finish, thresholdHO_, digi.zsCrossingMask());
113 }
114 
116  int start = std::max(0, HFsearchTS_.first);
117  int finish = std::min(digi.size() - 1, HFsearchTS_.second);
118  return keepMe(digi, start, finish, thresholdHF_, digi.zsCrossingMask());
119 }
120 
122  int start = std::max(0, HFsearchTS_.first);
123  int finish = std::min((int)digi.samples() - 1, HFsearchTS_.second);
124  return keepMe(digi, start, finish, thresholdHF_, 0);
125 }
126 
128  HcalDetId hid(digi.id());
129  if (hid.subdet() == HcalBarrel) {
130  int start = std::max(0, HBsearchTS_.first);
131  int finish = std::min(digi.samples() - 1, HBsearchTS_.second);
132  return keepMe(digi, start, finish, thresholdHB_, 0);
133  } else {
134  int start = std::max(0, HEsearchTS_.first);
135  int finish = std::min(digi.samples() - 1, HEsearchTS_.second);
136  return keepMe(digi, start, finish, thresholdHE_, 0);
137  }
138 }
HFDataFrame::zsCrossingMask
constexpr uint32_t zsCrossingMask() const
zs crossing mask (which sums considered)
Definition: HFDataFrame.h:35
HcalZSAlgoRealistic::HFsearchTS_
std::pair< int, int > HFsearchTS_
Definition: HcalZSAlgoRealistic.h:49
ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
mps_fire.i
i
Definition: mps_fire.py:355
start
Definition: start.py:1
HcalZSAlgoRealistic::thresholdHO_
int thresholdHO_
Definition: HcalZSAlgoRealistic.h:48
QIE10DataFrame::samples
constexpr int samples() const
total number of samples in the digi
Definition: QIE10DataFrame.h:86
min
T min(T a, T b)
Definition: MathUtil.h:58
HcalZSAlgoRealistic::HOsearchTS_
std::pair< int, int > HOsearchTS_
Definition: HcalZSAlgoRealistic.h:49
TrendClient_cfi.Digi
Digi
Definition: TrendClient_cfi.py:7
HcalBarrel
Definition: HcalAssistant.h:33
HcalZeroSuppressionAlgo
Definition: HcalZeroSuppressionAlgo.h:15
HcalZSAlgoRealistic::keepMe
bool keepMe(const Digi &inp, int start, int finish, int threshold, uint32_t zsmask) const
Definition: HcalZSAlgoRealistic.cc:47
HODataFrame::zsCrossingMask
constexpr uint32_t zsCrossingMask() const
zs crossing mask (which sums considered)
Definition: HODataFrame.h:35
HcalDbService::getHcalZSThreshold
const HcalZSThreshold * getHcalZSThreshold(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:355
HcalZSAlgoRealistic::usingDBvalues
bool usingDBvalues
Definition: HcalZSAlgoRealistic.h:47
QIE11DataFrame::samples
constexpr int samples() const
total number of samples in the digi
Definition: QIE11DataFrame.h:77
HcalZSAlgoRealistic.h
HcalZSAlgoRealistic::shouldKeep
bool shouldKeep(const HBHEDataFrame &digi) const override
Definition: HcalZSAlgoRealistic.cc:97
HBHEDataFrame
Definition: HBHEDataFrame.h:14
HFDataFrame::size
constexpr int size() const
total number of samples in the digi
Definition: HFDataFrame.h:27
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
QIE11DataFrame::id
constexpr edm::DataFrame::id_type id() const
Definition: QIE11DataFrame.h:68
HcalDetId::subdet
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
HcalDetId
Definition: HcalDetId.h:12
HFDataFrame
Definition: HFDataFrame.h:14
HODataFrame::size
constexpr int size() const
total number of samples in the digi
Definition: HODataFrame.h:27
HcalZSAlgoRealistic::thresholdHE_
int thresholdHE_
Definition: HcalZSAlgoRealistic.h:48
HcalZSAlgoRealistic::HEsearchTS_
std::pair< int, int > HEsearchTS_
Definition: HcalZSAlgoRealistic.h:49
HcalZSAlgoRealistic::thresholdHB_
int thresholdHB_
Definition: HcalZSAlgoRealistic.h:48
HBHEDataFrame::zsCrossingMask
constexpr uint32_t zsCrossingMask() const
zs crossing mask (which sums considered)
Definition: HBHEDataFrame.h:35
HcalZSAlgoRealistic::HcalZSAlgoRealistic
HcalZSAlgoRealistic(bool markAndPass, bool use1ts, std::pair< int, int > HBsearchTS, std::pair< int, int > HEsearchTS, std::pair< int, int > HOsearchTS, std::pair< int, int > HFsearchTS)
Definition: HcalZSAlgoRealistic.cc:27
HBHEDataFrame::id
constexpr const HcalDetId & id() const
Definition: HBHEDataFrame.h:23
HcalZSAlgoRealistic::thresholdHF_
int thresholdHF_
Definition: HcalZSAlgoRealistic.h:48
HBHEDataFrame::size
constexpr int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:27
HcalZSAlgoRealistic::use1ts_
bool use1ts_
Definition: HcalZSAlgoRealistic.h:47
QIE10DataFrame
Definition: QIE10DataFrame.h:11
HODataFrame
Definition: HODataFrame.h:14
QIE11DataFrame
Definition: QIE11DataFrame.h:11
HcalZSAlgoRealistic::HBsearchTS_
std::pair< int, int > HBsearchTS_
Definition: HcalZSAlgoRealistic.h:49
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
QIE10DataFrame::id
constexpr edm::DataFrame::id_type id() const
Definition: QIE10DataFrame.h:77
HcalZeroSuppressionAlgo::m_dbService
const HcalDbService * m_dbService
Definition: HcalZeroSuppressionAlgo.h:34
hcalDigisNoSuppression_cfi.use1ts
use1ts
Definition: hcalDigisNoSuppression_cfi.py:15