CMS 3D CMS Logo

HcalADCSaturationFlag.cc
Go to the documentation of this file.
1 #include "../interface/HcalADCSaturationFlag.h"
3 
4 
5 
6 namespace HcalSaturation
7 {
8  // Template class that loops over digi collection, sets rechit
9  // saturation status bit on if ADC count is >= SaturationLevel_;
10 
11  template <class T, class V>
12  void checkADCSaturation(T &rechit, const V &digi, int level)
13  {
14  // Loop over digi
15  for (int i=0;i<digi.size();++i)
16  {
17  if (digi.sample(i).adc()>=level)
18  {
19  rechit.setFlagField(1,HcalCaloFlagLabels::ADCSaturationBit);
20  break;
21  }
22  }
23  return;
24  }
25 }
26 
27 using namespace HcalSaturation;
28 
30 {
31  SaturationLevel_=127; // default saturation level (7-bit QIE)
32 }
33 
35 {
36  SaturationLevel_=level; // allow user to specify saturation level
37 }
38 
40 {}
41 
43 {
44  checkADCSaturation<HBHERecHit, HBHEDataFrame>(rechit, digi, SaturationLevel_);
45  return;
46 }
47 
49 {
50  checkADCSaturation<HORecHit, HODataFrame>(rechit, digi, SaturationLevel_);
51  return;
52 }
53 
55 {
56  checkADCSaturation<HFRecHit, HFDataFrame>(rechit, digi, SaturationLevel_);
57  return;
58 }
59 
61 {
62  checkADCSaturation<ZDCRecHit, ZDCDataFrame>(rechit, digi, SaturationLevel_);
63  return;
64 }
void setSaturationFlag(HBHERecHit &rechit, const HBHEDataFrame &digi)
void checkADCSaturation(T &rechit, const V &digi, int level)
long double T