CMS 3D CMS Logo

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 }
HcalBaseSignalGenerator::fC2pe
void fC2pe(CaloSamples &samples) const
Definition: HcalBaseSignalGenerator.h:20
ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
HcalSignalGenerator::samplesInPE
CaloSamples samplesInPE(const DIGI &digi)
Definition: HcalSignalGenerator.h:110
HcalElectronicsSim::setStartingCapId
void setStartingCapId(int startingCapId)
Definition: HcalElectronicsSim.cc:163
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
HcalDbService::getHcalShape
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:326
HcalDbService::getHcalCoder
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:319
HcalSignalGenerator.h
CaloVNoiseSignalGenerator::theNoiseSignals
std::vector< CaloSamples > theNoiseSignals
Definition: CaloVNoiseSignalGenerator.h:34
HcalBaseSignalGenerator::theElectronicsSim
HcalElectronicsSim * theElectronicsSim
Definition: HcalBaseSignalGenerator.h:27
HcalSignalGenerator::validDigi
bool validDigi(const DIGI &digi)
Definition: HcalSignalGenerator.h:101
HcalSignalGenerator
Definition: HcalSignalGenerator.h:31
HcalDetId
Definition: HcalDetId.h:12
CaloSamples
Definition: CaloSamples.h:14
HcalQIECoder
Definition: HcalQIECoder.h:20
HcalSignalGenerator::theConditions
edm::ESHandle< HcalDbService > theConditions
Definition: HcalSignalGenerator.h:159
HcalQIE11DigitizerTraits::PreMixFactor
static constexpr double PreMixFactor
Definition: HcalQIE1011Traits.h:21
QIE10DataFrame
Definition: QIE10DataFrame.h:11
HcalSignalGenerator::fillDigis
virtual void fillDigis(const COLLECTION *digis)
Definition: HcalSignalGenerator.h:83
HcalQIE10DigitizerTraits::PreMixFactor
static constexpr double PreMixFactor
Definition: HcalQIE1011Traits.h:12
QIE11DataFrame
Definition: QIE11DataFrame.h:11
HcalQIEShape
Definition: HcalQIEShape.h:17
HcalCoderDb
Definition: HcalCoderDb.h:15
mps_fire.result
result
Definition: mps_fire.py:303