CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalUncalibRecHitLeadingEdgeAlgo.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_EcalRecAlgos_EcalUncalibRecHitLeadingEdgeAlgo_HH
2 #define RecoLocalCalo_EcalRecAlgos_EcalUncalibRecHitLeadingEdgeAlgo_HH
3 
13 #include "Math/SVector.h"
14 #include "Math/SMatrix.h"
16 
18 
20 
21 
22 template < class C > class EcalUncalibRecHitLeadingEdgeAlgo : public EcalUncalibRecHitRecAbsAlgo < C > {
23  public:
24  // destructor
27 
28  void setLeadingEdgeSample( int isample ) { leadingSample_ = isample; }
30 
31  void setPulseShape( std::vector<double> & shape ) { shape_ = shape; }
32  std::vector<double> & getPulseShape() { return shape_; }
33 
35  virtual EcalUncalibratedRecHit makeRecHit(const C & dataFrame,
36  const double *pedestals,
37  const double *gainRatios,
39  const EcalWeightSet::EcalChi2WeightMatrix** chi2Matrix
40  )
41  {
42  double amplitude_(-1.), pedestal_(-1.), jitter_(-1.), chi2_(-1.);
43 
44  // compute amplitude
45  amplitude_ = double (((double) (dataFrame.sample( leadingSample_ ).adc() -
46  pedestals[ dataFrame.sample( leadingSample_ ).gainId() - 1]) *
48  gainRatios[ dataFrame.sample( leadingSample_ ).gainId() - 1] ));
49 
50 
51 
52  return EcalUncalibratedRecHit(dataFrame.id(), amplitude_, pedestal_, jitter_, chi2_);
53  }
54 
55  // saturation correction
56  double saturationCorrection(int unsaturatedSample)
57  {
58  if ( unsaturatedSample > 0 && unsaturatedSample < (int)shape_.size() ) {
59  return 1./ shape_[ unsaturatedSample ];
60  } else {
61  edm::LogError("EcalUncalibRecHitLeadingEdgeAlgo") << "Invalid sample " << unsaturatedSample
62  << " for a shape vector of size " << shape_.size();
63  return 0;
64  }
65  }
66 
67  private:
69  std::vector< double > shape_;
70 };
71 #endif
double saturationCorrection(int unsaturatedSample)
void setPulseShape(std::vector< double > &shape)
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalWeightSet::EcalChi2WeightMatrix **chi2Matrix)
Compute parameters.
math::Matrix< 10, 10 >::type EcalChi2WeightMatrix
Definition: EcalWeightSet.h:23
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:22