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 
12 #include "TMath.h"
13 #include <iostream>
14 
16  public:
17  // default ctor
19  adcToGeVConstant_ = -1;
20  adcToGeVConstantIsSet_ = false;
21  }
22 
23  virtual void setADCToGeVConstant(const float& value) {
26  }
27 
28 
29  // destructor
30  virtual ~EcalRecHitSimpleAlgo() { };
31 
33  virtual EcalRecHit makeRecHit(const EcalUncalibratedRecHit& uncalibRH,
34  const float& intercalibConstant,
35  const float& timeIntercalib = 0,
36  const uint32_t& flags = 0) const {
37 
39  std::cout << "EcalRecHitSimpleAlgo::makeRecHit: adcToGeVConstant_ not set before calling this method!" <<
40  " will use -1 and produce bogus rechits!" << std::endl;
41  }
42 
43  float clockToNsConstant = 25;
44  float energy = uncalibRH.amplitude()*adcToGeVConstant_*intercalibConstant;
45  float time = uncalibRH.jitter() * clockToNsConstant + timeIntercalib;
46 
47  EcalRecHit rh( uncalibRH.id(), energy, time );
48  rh.setChi2( uncalibRH.chi2() );
49  rh.setOutOfTimeEnergy( uncalibRH.outOfTimeEnergy() * adcToGeVConstant_ * intercalibConstant );
50  rh.setOutOfTimeChi2( uncalibRH.outOfTimeChi2() );
51  rh.setTimeError(uncalibRH.jitterErrorBits());
52 
53  // Now fill flags
54 
55  bool good=true;
56 
59  good=false;
60  }
62  // leading edge recovery failed - still keep the information
63  // about the saturation and do not flag as dead
64  rh.setFlag(EcalRecHit::kSaturated);
65  good=false;
66  }
67  if( uncalibRH.isSaturated() ) {
68  rh.setFlag(EcalRecHit::kSaturated);
69  good=false;
70  }
72  rh.setFlag(EcalRecHit::kOutOfTime) ;
73  good=false;
74  }
76  rh.setFlag(EcalRecHit::kPoorReco);
77  good=false;
78  }
81  }
84  }
85 
86  if (good) rh.setFlag(EcalRecHit::kGood);
87  return rh;
88  }
89 
90 private:
93 
94 };
95 #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:44
tuple cout
Definition: gather_cfg.py:121