Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:24:27

0001 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalADCSaturationFlag.h"
0002 #include "DataFormats/METReco/interface/HcalCaloFlagLabels.h"
0003 
0004 namespace HcalSaturation {
0005   // Template class that loops over digi collection, sets rechit
0006   // saturation status bit on if ADC count is >= SaturationLevel_;
0007 
0008   template <class T, class V>
0009   void checkADCSaturation(T& rechit, const V& digi, int level) {
0010     // Loop over digi
0011     for (int i = 0; i < digi.size(); ++i) {
0012       if (digi.sample(i).adc() >= level) {
0013         rechit.setFlagField(1, HcalCaloFlagLabels::ADCSaturationBit);
0014         break;
0015       }
0016     }
0017     return;
0018   }
0019 }  // namespace HcalSaturation
0020 
0021 using namespace HcalSaturation;
0022 
0023 HcalADCSaturationFlag::HcalADCSaturationFlag() {
0024   SaturationLevel_ = 127;  // default saturation level (7-bit QIE)
0025 }
0026 
0027 HcalADCSaturationFlag::HcalADCSaturationFlag(int level) {
0028   SaturationLevel_ = level;  // allow user to specify saturation level
0029 }
0030 
0031 HcalADCSaturationFlag::~HcalADCSaturationFlag() {}
0032 
0033 void HcalADCSaturationFlag::setSaturationFlag(HBHERecHit& rechit, const HBHEDataFrame& digi) {
0034   checkADCSaturation<HBHERecHit, HBHEDataFrame>(rechit, digi, SaturationLevel_);
0035   return;
0036 }
0037 
0038 void HcalADCSaturationFlag::setSaturationFlag(HORecHit& rechit, const HODataFrame& digi) {
0039   checkADCSaturation<HORecHit, HODataFrame>(rechit, digi, SaturationLevel_);
0040   return;
0041 }
0042 
0043 void HcalADCSaturationFlag::setSaturationFlag(HFRecHit& rechit, const HFDataFrame& digi) {
0044   checkADCSaturation<HFRecHit, HFDataFrame>(rechit, digi, SaturationLevel_);
0045   return;
0046 }
0047 
0048 void HcalADCSaturationFlag::setSaturationFlag(ZDCRecHit& rechit, const ZDCDataFrame& digi) {
0049   checkADCSaturation<ZDCRecHit, ZDCDataFrame>(rechit, digi, SaturationLevel_);
0050   return;
0051 }