CMS 3D CMS Logo

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

#include <EcalUncalibRecHitTimeWeightsAlgo.h>

Public Member Functions

 EcalUncalibRecHitTimeWeightsAlgo ()
 
double time (const C &dataFrame, const std::vector< double > &amplitudes, const EcalPedestals::Item *aped, const EcalMGPAGainRatio *aGain, const FullSampleVector &fullpulse, const EcalWeightSet::EcalWeightMatrix **weights)
 Compute time. More...
 
virtual ~EcalUncalibRecHitTimeWeightsAlgo ()
 

Detailed Description

template<class C>
class EcalUncalibRecHitTimeWeightsAlgo< C >

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

Author
J. Bendavid, E. Di Marco

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)

Definition at line 27 of file EcalUncalibRecHitTimeWeightsAlgo.h.

Constructor & Destructor Documentation

◆ EcalUncalibRecHitTimeWeightsAlgo()

Definition at line 29 of file EcalUncalibRecHitTimeWeightsAlgo.h.

29 {};

◆ ~EcalUncalibRecHitTimeWeightsAlgo()

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

Definition at line 30 of file EcalUncalibRecHitTimeWeightsAlgo.h.

30 {};

Member Function Documentation

◆ time()

template<class C>
double EcalUncalibRecHitTimeWeightsAlgo< C >::time ( const C &  dataFrame,
const std::vector< double > &  amplitudes,
const EcalPedestals::Item aped,
const EcalMGPAGainRatio aGain,
const FullSampleVector fullpulse,
const EcalWeightSet::EcalWeightMatrix **  weights 
)
inline

Compute time.

Definition at line 33 of file EcalUncalibRecHitTimeWeightsAlgo.h.

38  {
39  const unsigned int nsample = EcalDataFrame::MAXSAMPLES;
40 
41  double maxamplitude = -std::numeric_limits<double>::max();
42 
43  double pulsenorm = 0.;
44  int iGainSwitch = 0;
45 
46  ROOT::Math::SVector<double, nsample> pedSubSamples;
47  for (unsigned int iSample = 0; iSample < nsample; iSample++) {
48  const EcalMGPASample &sample = dataFrame.sample(iSample);
49 
50  double amplitude = 0.;
51  int gainId = sample.gainId();
52 
53  double pedestal = 0.;
54  double gainratio = 1.;
55 
56  if (gainId == 0 || gainId == 3) {
57  pedestal = aped->mean_x1;
58  gainratio = aGain->gain6Over1() * aGain->gain12Over6();
59  iGainSwitch = 1;
60  } else if (gainId == 1) {
61  pedestal = aped->mean_x12;
62  gainratio = 1.;
63  iGainSwitch = 0;
64  } else if (gainId == 2) {
65  pedestal = aped->mean_x6;
66  gainratio = aGain->gain12Over6();
67  iGainSwitch = 1;
68  }
69 
70  amplitude = ((double)(sample.adc()) - pedestal) * gainratio;
71 
72  if (gainId == 0) {
73  //saturation
74  amplitude = (4095. - pedestal) * gainratio;
75  }
76 
77  pedSubSamples(iSample) = amplitude;
78 
79  if (amplitude > maxamplitude) {
80  maxamplitude = amplitude;
81  }
82  pulsenorm += fullpulse(iSample);
83  }
84 
85  std::vector<double>::const_iterator amplit;
86  for (amplit = amplitudes.begin(); amplit < amplitudes.end(); ++amplit) {
87  int ipulse = std::distance(amplitudes.begin(), amplit);
88  int bx = ipulse - 5;
89  int firstsamplet = std::max(0, bx + 3);
90  int offset = 7 - 3 - bx;
91 
92  TVectorD pulse;
93  pulse.ResizeTo(nsample);
94  for (unsigned int isample = firstsamplet; isample < nsample; ++isample) {
95  pulse(isample) = fullpulse(isample + offset);
96  pedSubSamples(isample) = std::max(0., pedSubSamples(isample) - amplitudes[ipulse] * pulse(isample) / pulsenorm);
97  }
98  }
99 
100  // Compute parameters
101  double amplitude_(-1.), jitter_(-1.);
102  ROOT::Math::SVector<double, 3> param = (*(weights[iGainSwitch])) * pedSubSamples;
103  amplitude_ = param(EcalUncalibRecHitRecAbsAlgo<C>::iAmplitude);
104  if (amplitude_)
105  jitter_ = -param(EcalUncalibRecHitRecAbsAlgo<C>::iTime) / amplitude_;
106  else
107  jitter_ = 0.;
108 
109  return jitter_;
110  }

Referenced by EcalUncalibRecHitWorkerMultiFit::run().

EcalDataFrame::MAXSAMPLES
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
HLT_2018_cff.weights
weights
Definition: HLT_2018_cff.py:87167
CustomPhysics_cfi.amplitude
amplitude
Definition: CustomPhysics_cfi.py:12
EcalPedestal::mean_x6
float mean_x6
Definition: EcalPedestals.h:21
simplePhotonAnalyzer_cfi.sample
sample
Definition: simplePhotonAnalyzer_cfi.py:12
pulse
double pulse(double x, double y, double z, double t)
Definition: SiStripPulseShape.cc:49
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
simKBmtfDigis_cfi.bx
bx
Definition: simKBmtfDigis_cfi.py:55
EcalPedestal::mean_x1
float mean_x1
Definition: EcalPedestals.h:23
EcalUncalibRecHitRecAbsAlgo
Definition: EcalUncalibRecHitRecAbsAlgo.h:18
EcalPedestal::mean_x12
float mean_x12
Definition: EcalPedestals.h:19
EcalMGPAGainRatio::gain12Over6
float gain12Over6() const
Definition: EcalMGPAGainRatio.h:19
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
EcalCondDBWriter_cfi.pedestal
pedestal
Definition: EcalCondDBWriter_cfi.py:49
EcalMGPASample
Definition: EcalMGPASample.h:22
EcalMGPAGainRatio::gain6Over1
float gain6Over1() const
Definition: EcalMGPAGainRatio.h:20
ecalMGPA::gainId
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
Definition: EcalMGPASample.h:13
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82