CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalRecHitSimpleAlgo.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_EcalRecAlgos_EcalRecHitSimpleAlgo_HH
2 #define RecoLocalCalo_EcalRecAlgos_EcalRecHitSimpleAlgo_HH
3 
15 #include "TMath.h"
16 #include <iostream>
17 
19  public:
20  // default ctor
22  adcToGeVConstant_ = -1;
23  adcToGeVConstantIsSet_ = false;
24  }
25 
26  virtual void setADCToGeVConstant(const float& value) {
29  }
30 
31 
32  // destructor
33  virtual ~EcalRecHitSimpleAlgo() { };
34 
36  virtual EcalRecHit makeRecHit(const EcalUncalibratedRecHit& uncalibRH,
37  const float& intercalibConstant,
38  const float& timeIntercalib = 0,
39  const uint32_t& flags = 0) const {
40 
42  std::cout << "EcalRecHitSimpleAlgo::makeRecHit: adcToGeVConstant_ not set before calling this method!" <<
43  " will use -1 and produce bogus rechits!" << std::endl;
44  }
45 
46  float clockToNsConstant = 25;
47  float energy = uncalibRH.amplitude()*adcToGeVConstant_*intercalibConstant;
48  float time = uncalibRH.jitter() * clockToNsConstant + timeIntercalib;
49 
50  EcalRecHit rh( uncalibRH.id(), energy, time );
51  rh.setChi2( uncalibRH.chi2() );
52  rh.setOutOfTimeEnergy( uncalibRH.outOfTimeEnergy() * adcToGeVConstant_ * intercalibConstant );
53  rh.setOutOfTimeChi2( uncalibRH.outOfTimeChi2() );
54  rh.setTimeError(uncalibRH.jitterErrorBits());
55 
56  // Now fill both recoFlag and the new flagBits
57  uint32_t flagbits(0);
58  uint32_t recoFlag = flags; // so far contains only v_DB_reco_flags_[ statusCode ] from the worker
59  // for the time being ignore them in flagBits
60 
63  flagbits |= (0x1 << EcalRecHit::kLeadingEdgeRecovered);
64 
65  } else if ( uncalibRH.recoFlag() == EcalUncalibratedRecHit::kSaturated ) {
66  // leading edge recovery failed - still keep the information
67  // about the saturation and do not flag as dead
68  recoFlag = EcalRecHit::kSaturated;
69  // and at some point may try the recovery with the neighbours
70  flagbits |= (0x1 << EcalRecHit::kSaturated);
71 
72  } else if( uncalibRH.isSaturated() ) {
73  recoFlag = EcalRecHit::kSaturated;
74  flagbits |= (0x1 << EcalRecHit::kSaturated);
75 
76  } else if ( uncalibRH.recoFlag() == EcalUncalibratedRecHit::kOutOfTime ) {
77  recoFlag = EcalRecHit::kOutOfTime;
78  flagbits |= (0x1 << EcalRecHit::kOutOfTime);
79 
80  } else if ( uncalibRH.recoFlag() == EcalUncalibratedRecHit::kFake ) {
81  recoFlag = EcalRecHit::kFake;
82  flagbits |= (0x1 << EcalRecHit::kFake);
83  }
84  else if ( uncalibRH.recoFlag() == EcalUncalibratedRecHit::kPoorReco ) {
85  recoFlag = EcalRecHit::kPoorReco;
86  flagbits |= (0x1 << EcalRecHit::kPoorReco);
87  }
88 
89  // now set both the reco flag and the new flagBits_
90  rh.setRecoFlag( recoFlag );
91  rh.setFlagBits( flagbits );
92 
93  return rh;
94  }
95 
96 private:
99 
100 };
101 #endif
virtual EcalRecHit makeRecHit(const EcalUncalibratedRecHit &uncalibRH, const float &intercalibConstant, const float &timeIntercalib=0, const uint32_t &flags=0) const
Compute parameters.
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
virtual void setADCToGeVConstant(const float &value)
Constructor.
void setChi2(float chi2)
Definition: EcalRecHit.cc:97
tuple cout
Definition: gather_cfg.py:41