CMS 3D CMS Logo

EcalUncalibRecHitMaxSampleAlgo.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_EcalRecAlgos_EcalUncalibRecHitMaxSampleAlgo_HH
2 #define RecoLocalCalo_EcalRecAlgos_EcalUncalibRecHitMaxSampleAlgo_HH
3 
13 
14 
16 {
17 
18  public:
19 
21  virtual EcalUncalibratedRecHit makeRecHit(const C& dataFrame, const double* pedestals,
22  const double* gainRatios,
24  const EcalWeightSet::EcalChi2WeightMatrix** chi2Matrix);
25 
26  private:
28  double chi2_;
29 
30 };
31 
33 template<class C> EcalUncalibratedRecHit
34 EcalUncalibRecHitMaxSampleAlgo<C>::makeRecHit(const C& dataFrame, const double* pedestals,
35  const double* gainRatios,
37  const EcalWeightSet::EcalChi2WeightMatrix** chi2Matrix) {
38 
40  pedestal_ = 4095;
41  jitter_ = -1;
42  chi2_ = -1;
43  //bool isSaturated = 0;
44  uint32_t flags = 0;
45  for(int16_t iSample = 0; iSample < C::MAXSAMPLES; iSample++) {
46 
47  gainId_ = dataFrame.sample(iSample).gainId();
48 
49  if (gainId_ == 0 )
50  {
52  }
53 
54  // ampli gain 12
55  if ( gainId_ == 1){
56  sampleAdc_ = dataFrame.sample(iSample).adc();
57  }
58 
59  else
60  {
61  if ( gainId_ == 2){ // ampli gain 6
62  sampleAdc_ = 200 + (dataFrame.sample(iSample).adc() - 200) * 2 ;
63  }
64  else { // accounts for gainId_==3 or 0 - ampli gain 1 and gain0
65  sampleAdc_ = 200 + (dataFrame.sample(iSample).adc() - 200) * 12 ;
66  }
67  }
68 
69  if( sampleAdc_ >amplitude_ ) {
71  jitter_ = iSample;
72  }// if statement
73 
75 
76  }// loop on samples
77 
78 
79  return EcalUncalibratedRecHit( dataFrame.id(), static_cast<double>(amplitude_-pedestal_) , static_cast<double>(pedestal_), static_cast<double>(jitter_ - 5), chi2_, flags );
80 }
81 
82 #endif
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalWeightSet::EcalChi2WeightMatrix **chi2Matrix)
compute rechits
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
T min(T a, T b)
Definition: MathUtil.h:58
math::Matrix< 10, 10 >::type EcalChi2WeightMatrix
Definition: EcalWeightSet.h:23
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:22