CMS 3D CMS Logo

EcalUncalibRecHitRecWeightsAlgo.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_EcalRecAlgos_EcalUncalibRecHitRecWeightsAlgo_HH
2 #define RecoLocalCalo_EcalRecAlgos_EcalUncalibRecHitRecWeightsAlgo_HH
3 
15 #include "Math/SVector.h"
16 #include "Math/SMatrix.h"
20 
21 #include <vector>
22 
23 template <class C>
25 public:
26  // destructor
28 
30  virtual EcalUncalibratedRecHit makeRecHit(const C& dataFrame,
31  const double* pedestals,
32  const double* pedestalsRMS,
33  const double* gainRatios,
35  const EcalShapeBase& testbeamPulseShape) {
36  double amplitude_(-1.), pedestal_(-1.), jitter_(-1.), chi2_(-1.);
37  uint32_t flag = 0;
38 
39  // Get time samples
40  ROOT::Math::SVector<double, C::MAXSAMPLES> frame;
41  int gainId0 = 1;
42  int iGainSwitch = 0;
43  bool isSaturated = false;
44  for (int iSample = 0; iSample < C::MAXSAMPLES; iSample++) {
45  int gainId = dataFrame.sample(iSample).gainId();
46  //Handling saturation (treating saturated gainId as maximum gain)
47  if (gainId == 0) {
48  gainId = 3;
49  //isSaturated = 1;
50  // in pileup run May2012 samples 7,8,9,10 have gainid ==0
51  // fix it like this: it won't hurt for the future SA20120512
52  if (iSample == 4 || iSample == 5 || iSample == 6)
53  isSaturated = true;
54  }
55 
56  // if (gainId != gainId0) iGainSwitch = 1;
57  // same problem as above: mark saturation only when physically
58  // expected to occur SA20120513
59  if ((gainId != gainId0) && (iSample == 4 || iSample == 5 || iSample == 6))
60  iGainSwitch = 1;
61  if (!iGainSwitch)
62  frame(iSample) = double(dataFrame.sample(iSample).adc());
63  else
64  frame(iSample) =
65  double(((double)(dataFrame.sample(iSample).adc()) - pedestals[gainId - 1]) * gainRatios[gainId - 1]);
66  }
67 
68  // Compute parameters
69  ROOT::Math::SVector<double, 3> param = (*(weights[iGainSwitch])) * frame;
72  if (amplitude_)
73  jitter_ = -param(EcalUncalibRecHitRecAbsAlgo<C>::iTime) / amplitude_;
74  else
75  jitter_ = 0.;
76 
77  //When saturated gain flag i
78  if (isSaturated) {
80  amplitude_ = double((4095. - pedestals[2]) * gainRatios[2]);
81  }
82  return EcalUncalibratedRecHit(dataFrame.id(), amplitude_, pedestal_, jitter_, chi2_, flag);
83  }
84 
86 };
87 #endif
EcalUncalibRecHitRecWeightsAlgo
Definition: EcalUncalibRecHitRecWeightsAlgo.h:24
HLT_2018_cff.weights
weights
Definition: HLT_2018_cff.py:87167
EcalWeightSet::EcalWeightMatrix
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:19
EcalShapeBase
Definition: EcalShapeBase.h:24
EcalUncalibRecHitRecAbsAlgo
Definition: EcalUncalibRecHitRecAbsAlgo.h:18
CastorSimpleRecAlgoImpl::isSaturated
bool isSaturated(const Digi &digi, const int &maxADCvalue, int ifirst, int n)
Definition: CastorSimpleRecAlgo.cc:97
EcalUncalibRecHitRecAbsAlgo.h
EcalShapeBase.h
EcalUncalibratedRecHit
Definition: EcalUncalibratedRecHit.h:8
gen::C
C
Definition: PomwigHadronizer.cc:76
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
EcalUncalibRecHitRecWeightsAlgo::makeRecHit
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *pedestalsRMS, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalShapeBase &testbeamPulseShape)
Compute parameters.
Definition: EcalUncalibRecHitRecWeightsAlgo.h:30
EcalUncalibratedRecHit::kSaturated
Definition: EcalUncalibratedRecHit.h:15
ecalMGPA::gainId
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
Definition: EcalMGPASample.h:13
EcalWeightSet.h
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116