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 flags
57 
58  bool good=true;
59 
62  good=false;
63  }
65  // leading edge recovery failed - still keep the information
66  // about the saturation and do not flag as dead
67  rh.setFlag(EcalRecHit::kSaturated);
68  good=false;
69  }
70  if( uncalibRH.isSaturated() ) {
71  rh.setFlag(EcalRecHit::kSaturated);
72  good=false;
73  }
75  rh.setFlag(EcalRecHit::kOutOfTime) ;
76  good=false;
77  }
79  rh.setFlag(EcalRecHit::kPoorReco);
80  good=false;
81  }
84  }
87  }
88 
89  if (good) rh.setFlag(EcalRecHit::kGood);
90  return rh;
91  }
92 
93 private:
96 
97 };
98 #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)
make rechits from dataframes
bool checkFlag(Flags flag) const
void setChi2(float chi2)
Definition: EcalRecHit.cc:52
tuple cout
Definition: gather_cfg.py:121