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 template <class C>
16 public:
18  EcalUncalibratedRecHit makeRecHit(const C& dataFrame,
19  const double* pedestals,
20  const double* gainRatios,
22  const EcalWeightSet::EcalChi2WeightMatrix** chi2Matrix) override;
23 
24 private:
26  double chi2_;
27 };
28 
30 template <class C>
32  const C& dataFrame,
33  const double* pedestals,
34  const double* gainRatios,
36  const EcalWeightSet::EcalChi2WeightMatrix** chi2Matrix) {
37  amplitude_ = std::numeric_limits<int16_t>::min();
38  pedestal_ = 4095;
39  jitter_ = -1;
40  chi2_ = -1;
41  //bool isSaturated = 0;
42  uint32_t flags = 0;
43  for (int16_t iSample = 0; iSample < C::MAXSAMPLES; iSample++) {
44  gainId_ = dataFrame.sample(iSample).gainId();
45 
46  if (gainId_ == 0) {
48  }
49 
50  // ampli gain 12
51  if (gainId_ == 1) {
52  sampleAdc_ = dataFrame.sample(iSample).adc();
53  }
54 
55  else {
56  if (gainId_ == 2) { // ampli gain 6
57  sampleAdc_ = 200 + (dataFrame.sample(iSample).adc() - 200) * 2;
58  } else { // accounts for gainId_==3 or 0 - ampli gain 1 and gain0
59  sampleAdc_ = 200 + (dataFrame.sample(iSample).adc() - 200) * 12;
60  }
61  }
62 
63  if (sampleAdc_ > amplitude_) {
64  amplitude_ = sampleAdc_;
65  jitter_ = iSample;
66  } // if statement
67 
68  if (sampleAdc_ < pedestal_)
69  pedestal_ = sampleAdc_;
70 
71  } // loop on samples
72 
73  return EcalUncalibratedRecHit(dataFrame.id(),
74  static_cast<double>(amplitude_ - pedestal_),
75  static_cast<double>(pedestal_),
76  static_cast<double>(jitter_ - 5),
77  chi2_,
78  flags);
79 }
80 
81 #endif
math::Matrix< 10, 10 >::type EcalChi2WeightMatrix
Definition: EcalWeightSet.h:20
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:19
static constexpr int MAXSAMPLES
EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalWeightSet::EcalChi2WeightMatrix **chi2Matrix) override
compute rechits