CMS 3D CMS Logo

List of all members | Public Member Functions
EcalUncalibRecHitRecWeightsAlgo< C > Class Template Reference

#include <EcalUncalibRecHitRecWeightsAlgo.h>

Public Member Functions

virtual EcalUncalibratedRecHit makeRecHit (const C &dataFrame, const double *pedestals, const double *pedestalsRMS, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalShapeBase &testbeamPulseShape)
 Compute parameters. More...
 
virtual ~EcalUncalibRecHitRecWeightsAlgo ()
 

Detailed Description

template<class C>
class EcalUncalibRecHitRecWeightsAlgo< C >

Template used to compute amplitude, pedestal, time jitter, chi2 of a pulse using a weights method

Author
R. Bruneliere - A. Zabi

The chi2 computation with matrix is replaced by the chi2express which is moved outside the weight algo (need to clean up the interface in next iteration so that we do not pass-by useless arrays)

Template used to compute amplitude, pedestal, time jitter, chi2 of a pulse using a weights method

Author
R. Bruneliere - A. Zabi

Definition at line 24 of file EcalUncalibRecHitRecWeightsAlgo.h.

Constructor & Destructor Documentation

◆ ~EcalUncalibRecHitRecWeightsAlgo()

template<class C>
virtual EcalUncalibRecHitRecWeightsAlgo< C >::~EcalUncalibRecHitRecWeightsAlgo ( )
inlinevirtual

Definition at line 27 of file EcalUncalibRecHitRecWeightsAlgo.h.

27 {};

Member Function Documentation

◆ makeRecHit()

template<class C>
virtual EcalUncalibratedRecHit EcalUncalibRecHitRecWeightsAlgo< C >::makeRecHit ( const C &  dataFrame,
const double *  pedestals,
const double *  pedestalsRMS,
const double *  gainRatios,
const EcalWeightSet::EcalWeightMatrix **  weights,
const EcalShapeBase testbeamPulseShape 
)
inlinevirtual

Compute parameters.

Definition at line 30 of file EcalUncalibRecHitRecWeightsAlgo.h.

Referenced by EcalTBWeightUncalibRecHitProducer::produce(), EcalUncalibRecHitWorkerWeights::run(), and EcalUncalibRecHitWorkerGlobal::run().

35  {
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  }
static constexpr int MAXSAMPLES
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
bool isSaturated(const Digi &digi, const int &maxADCvalue, int ifirst, int n)