CMS 3D CMS Logo

Public Member Functions

EcalUncalibRecHitRecWeightsAlgo< C > Class Template Reference

#include <EcalUncalibRecHitRecWeightsAlgo.h>

List of all members.

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.
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

Id:
EcalUncalibRecHitRecWeightsAlgo.h,v 1.14 2012/05/13 21:00:57 argiro Exp
Date:
2012/05/13 21:00:57
Revision:
1.14
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

Id:
EcalUncalibRecHitWorkerWeights.h,v 1.2 2009/10/19 19:00:58 theofil Exp
Date:
2009/10/19 19:00:58
Revision:
1.2
Author:
R. Bruneliere - A. Zabi

Definition at line 26 of file EcalUncalibRecHitRecWeightsAlgo.h.


Constructor & Destructor Documentation

template<class C>
virtual EcalUncalibRecHitRecWeightsAlgo< C >::~EcalUncalibRecHitRecWeightsAlgo ( ) [inline, virtual]

Definition at line 30 of file EcalUncalibRecHitRecWeightsAlgo.h.

{ };

Member Function Documentation

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 
) [inline, virtual]

Compute parameters.

Definition at line 33 of file EcalUncalibRecHitRecWeightsAlgo.h.

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

      {
    double amplitude_(-1.),  pedestal_(-1.), jitter_(-1.), chi2_(-1.);
    uint32_t flag = 0;


    // Get time samples
    ROOT::Math::SVector<double,C::MAXSAMPLES> frame;
    int gainId0 = 1;
    int iGainSwitch = 0;
    bool isSaturated = 0;
    for(int iSample = 0; iSample < C::MAXSAMPLES; iSample++) {
      int gainId = dataFrame.sample(iSample).gainId();
      //Handling saturation (treating saturated gainId as maximum gain)
      if ( gainId == 0 ) 
        { 
          gainId = 3;
          //isSaturated = 1;
          // in pileup run May2012 samples 7,8,9,10 have gainid ==0
          // fix it like this: it won't hurt for the future SA20120512
          if(iSample==4 || iSample ==5 || iSample==6) isSaturated = 1;
        }

      //      if (gainId != gainId0) iGainSwitch = 1;
      // same problem as above: mark saturation only when physically
      // expected to occur SA20120513
      if ( (gainId != gainId0) && (iSample==4 || iSample ==5 || iSample==6) ) iGainSwitch = 1;
      if (!iGainSwitch)
        frame(iSample) = double(dataFrame.sample(iSample).adc());
      else
        frame(iSample) = double(((double)(dataFrame.sample(iSample).adc()) - pedestals[gainId-1]) * gainRatios[gainId-1]);
    }

    // Compute parameters
    ROOT::Math::SVector <double,3> param = (*(weights[iGainSwitch])) * frame;
    amplitude_ = param(EcalUncalibRecHitRecAbsAlgo<C>::iAmplitude);
    pedestal_ = param(EcalUncalibRecHitRecAbsAlgo<C>::iPedestal);
    if (amplitude_) jitter_ = param(EcalUncalibRecHitRecAbsAlgo<C>::iTime);


    //When saturated gain flag i
    if (isSaturated)
      {
        flag = EcalUncalibratedRecHit::kSaturated;
        amplitude_ = double((4095. - pedestals[2]) * gainRatios[2]);
      }
    return EcalUncalibratedRecHit( dataFrame.id(), amplitude_, pedestal_, jitter_, chi2_, flag);
  }