CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HcalSignalGenerator.cc
Go to the documentation of this file.
2 
3 //specializations
4 
5 template <>
8  int DigiSum = 0;
9  for (int id = 0; id < digi.samples(); id++) {
10  if (digi[id].adc() > 0)
11  ++DigiSum;
12  }
13  return (DigiSum > 0);
14 }
15 
16 template <>
19  HcalDetId cell = digi.id();
20  CaloSamples result = CaloSamples(cell, digi.samples());
21 
22  // first, check if there was an overflow in this fake digi:
23  bool overflow = false;
24  // find and list them
25 
26  for (int isample = 0; isample < digi.samples(); ++isample) {
27  //only check error bit for non-zero ADCs
28  if (digi[isample].adc() > 0 && !digi[isample].ok())
29  overflow = true;
30  }
31 
32  if (overflow) { // do full conversion, go back and overwrite fake entries
33  const HcalQIECoder* channelCoder = theConditions->getHcalCoder(cell);
34  const HcalQIEShape* channelShape = theConditions->getHcalShape(cell);
35  HcalCoderDb coder(*channelCoder, *channelShape);
36  coder.adc2fC(digi, result);
37 
38  // overwrite with coded information
39  for (int isample = 0; isample < digi.samples(); ++isample) {
40  if (digi[isample].ok())
41  result[isample] = float(digi[isample].adc()) / HcalQIE10DigitizerTraits::PreMixFactor;
42  }
43  } else { // saves creating the coder, etc., every time
44  // use coded information
45  for (int isample = 0; isample < digi.samples(); ++isample) {
46  result[isample] = float(digi[isample].adc()) / HcalQIE10DigitizerTraits::PreMixFactor;
47  if (digi[isample].soi())
48  result.setPresamples(isample);
49  }
50  }
51 
52  // translation done in fC, convert to pe:
53  fC2pe(result);
54 
55  return result;
56 }
57 
58 template <>
61  // loop over digis, adding these to the existing maps
62  for (typename COLLECTION::const_iterator it = digis->begin(); it != digis->end(); ++it) {
63  QIE10DataFrame df(*it);
64  // for the first signal, set the starting cap id
65  if ((it == digis->begin()) && theElectronicsSim) {
66  int startingCapId = df[0].capid();
67  theElectronicsSim->setStartingCapId(startingCapId);
68  }
69  if (validDigi(df)) {
70  theNoiseSignals.push_back(samplesInPE(df));
71  }
72  }
73 }
74 
75 template <>
78  int DigiSum = 0;
79  for (int id = 0; id < digi.samples(); id++) {
80  if (digi[id].adc() > 0)
81  ++DigiSum;
82  }
83  return (DigiSum > 0);
84 }
85 
86 template <>
89  HcalDetId cell = digi.id();
90  CaloSamples result = CaloSamples(cell, digi.samples());
91 
92  // first, check if there was an overflow in this fake digi:
93  bool overflow = false;
94  // find and list them
95 
96  for (int isample = 0; isample < digi.samples(); ++isample) {
97  if (digi[isample].tdc() == 1) {
98  overflow = true;
99  break;
100  }
101  }
102 
103  if (overflow) { // do full conversion, go back and overwrite fake entries
104  const HcalQIECoder* channelCoder = theConditions->getHcalCoder(cell);
105  const HcalQIEShape* channelShape = theConditions->getHcalShape(cell);
106  HcalCoderDb coder(*channelCoder, *channelShape);
107  coder.adc2fC(digi, result);
108 
109  // overwrite with coded information
110  for (int isample = 0; isample < digi.samples(); ++isample) {
111  if (digi[isample].tdc() == 0)
112  result[isample] = float(digi[isample].adc()) / HcalQIE11DigitizerTraits::PreMixFactor;
113  }
114  } else { // saves creating the coder, etc., every time
115  // use coded information
116  for (int isample = 0; isample < digi.samples(); ++isample) {
117  result[isample] = float(digi[isample].adc()) / HcalQIE11DigitizerTraits::PreMixFactor;
118  if (digi[isample].soi())
119  result.setPresamples(isample);
120  }
121  }
122 
123  // translation done in fC, convert to pe:
124  fC2pe(result);
125 
126  return result;
127 }
128 
129 template <>
132  // loop over digis, adding these to the existing maps
133  for (typename COLLECTION::const_iterator it = digis->begin(); it != digis->end(); ++it) {
134  QIE11DataFrame df(*it);
135  // for the first signal, set the starting cap id
136  if ((it == digis->begin()) && theElectronicsSim) {
137  int startingCapId = df[0].capid();
138  theElectronicsSim->setStartingCapId(startingCapId);
139  }
140  if (validDigi(df)) {
141  theNoiseSignals.push_back(samplesInPE(df));
142  }
143  }
144 }
CaloSamples samplesInPE(const DIGI &digi)
void setStartingCapId(int startingCapId)
void fC2pe(CaloSamples &samples) const
bool validDigi(const DIGI &digi)
static constexpr double PreMixFactor
tuple result
Definition: mps_fire.py:311
std::vector< CaloSamples > theNoiseSignals
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:33
HcalElectronicsSim * theElectronicsSim
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
virtual void fillDigis(const COLLECTION *digis)
static constexpr double PreMixFactor
uint16_t *__restrict__ uint16_t const *__restrict__ adc
const HcalDbService * theConditions