CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
PulseShapeFitOOTPileupCorrection Class Reference

#include <PulseShapeFitOOTPileupCorrection.h>

Public Member Functions

void phase1Apply (const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &reconstructedTime, bool &useTriple, float &chi2) const
 
 PulseShapeFitOOTPileupCorrection ()
 
void resetPulseShapeTemplate (const HcalPulseShapes::Shape &ps, unsigned nSamples)
 
void setPulseShapeTemplate (const HcalPulseShapes::Shape &ps, bool isHPD, unsigned nSamples, const HcalTimeSlew *hcalTimeSlewDelay)
 
void setPUParams (bool iPedestalConstraint, bool iTimeConstraint, bool iAddPulseJitter, bool iApplyTimeSlew, double iTS4Min, const std::vector< double > &iTS4Max, double iPulseJitter, double iTimeMean, double iTimeSigHPD, double iTimeSigSiPM, double iPedMean, double iTMin, double iTMax, const std::vector< double > &its4Chi2, HcalTimeSlew::BiasSetting slewFlavor, int iFitTimes)
 
 ~PulseShapeFitOOTPileupCorrection ()
 

Public Attributes

const HcalPulseShapes::ShapecurrentPulseShape_ = nullptr
 
const HcalTimeSlewhcalTimeSlewDelay_ = nullptr
 
double tsDelay1GeV_ = 0
 

Private Member Functions

void fit (int iFit, float &timevalfit, float &chargevalfit, float &pedvalfit, float &chi2, bool &fitStatus, double &iTSMax, const double &iTSTOTen, double *iEnArr, unsigned(&iBX)[3]) const
 
int pulseShapeFit (const double *energyArr, const double *pedenArr, const double *chargeArr, const double *pedArr, const double *gainArr, const double tsTOTen, std::vector< float > &fitParsVec, const double *ADCnoise, unsigned int soi) const
 

Private Attributes

bool addPulseJitter_
 
bool applyTimeSlew_
 
double chargeThreshold_
 
int cntsetPulseShape
 
std::unique_ptr< ROOT::Math::Functor > dpfunctor_
 
int fitTimes_
 
PSFitter::HybridMinimizerhybridfitter
 
std::array< double, hcal::constants::maxSamplesiniTimesArr
 
bool isCurrentChannelHPD_
 
bool pedestalConstraint_
 
double pedMean_
 
double pedSig_
 
std::unique_ptr< FitterFuncs::PulseShapeFunctorpsfPtr_
 
double pulseJitter_
 
HcalTimeSlew::BiasSetting slewFlavor_
 
std::unique_ptr< ROOT::Math::Functor > spfunctor_
 
bool timeConstraint_
 
double timeMean_
 
double timeSig_
 
double timeSigHPD_
 
double timeSigSiPM_
 
std::unique_ptr< ROOT::Math::Functor > tpfunctor_
 
double ts4Chi2_
 
double ts4Max_
 
double ts4Min_
 
int TSMax_
 
int TSMin_
 
bool unConstrainedFit_
 
std::vector< double > vts4Chi2_
 
std::vector< double > vts4Max_
 

Detailed Description

Definition at line 23 of file PulseShapeFitOOTPileupCorrection.h.

Constructor & Destructor Documentation

◆ PulseShapeFitOOTPileupCorrection()

PulseShapeFitOOTPileupCorrection::PulseShapeFitOOTPileupCorrection ( )

Definition at line 10 of file PulseShapeFitOOTPileupCorrection.cc.

References hybridfitter, iniTimesArr, and kMigrad.

11  : cntsetPulseShape(0),
12  psfPtr_(nullptr),
13  spfunctor_(nullptr),
14  dpfunctor_(nullptr),
15  tpfunctor_(nullptr),
16  TSMin_(0),
17  TSMax_(0),
18  vts4Chi2_(0),
19  pedestalConstraint_(false),
20  timeConstraint_(false),
21  addPulseJitter_(false),
22  applyTimeSlew_(false),
23  ts4Min_(0),
24  vts4Max_(0),
25  pulseJitter_(0),
26  timeMean_(0),
27  timeSig_(0),
28  pedMean_(0) {
30  iniTimesArr = {{-100, -75, -50, -25, 0, 25, 50, 75, 100, 125}};
31 }
std::array< double, hcal::constants::maxSamples > iniTimesArr
std::unique_ptr< ROOT::Math::Functor > tpfunctor_
std::unique_ptr< ROOT::Math::Functor > dpfunctor_
std::unique_ptr< ROOT::Math::Functor > spfunctor_
const char * kMigrad
std::unique_ptr< FitterFuncs::PulseShapeFunctor > psfPtr_

◆ ~PulseShapeFitOOTPileupCorrection()

PulseShapeFitOOTPileupCorrection::~PulseShapeFitOOTPileupCorrection ( )

Definition at line 33 of file PulseShapeFitOOTPileupCorrection.cc.

References hybridfitter.

33  {
34  if (hybridfitter)
35  delete hybridfitter;
36 }

Member Function Documentation

◆ fit()

void PulseShapeFitOOTPileupCorrection::fit ( int  iFit,
float &  timevalfit,
float &  chargevalfit,
float &  pedvalfit,
float &  chi2,
bool &  fitStatus,
double &  iTSMax,
const double &  iTSTOTen,
double *  iEnArr,
unsigned(&)  iBX[3] 
) const
private

Definition at line 196 of file PulseShapeFitOOTPileupCorrection.cc.

References funct::abs(), cms::cuda::assert(), nano_mu_local_reco_cff::chi2, dpfunctor_, fitTimes_, hybridfitter, mps_fire::i, iniTimesArr, createfilelist::int, kMigrad, dqmiodumpmetadata::n, pedMean_, pedSig_, mysort::results, PSFitter::HybridMinimizer::SetMinimizerType(), spfunctor_, timeMean_, timeSig_, tpfunctor_, TSMax_, TSMin_, and varNames.

Referenced by trackingPlots.Iteration::modules(), and pulseShapeFit().

205  {
206  int n = 3;
207  if (iFit == 2)
208  n = 5; //Two Pulse Fit
209  if (iFit == 3)
210  n = 7; //Three Pulse Fit
211  //Step 1 Single Pulse fit
212  float pedMax = iTSMax; //=> max timeslice
213  float tMin = TSMin_; //Fitting Time Min
214  float tMax = TSMax_; //Fitting Time Max
215  //Checks to make sure fitting happens
216  if (pedMax < 1.)
217  pedMax = 1.;
218  // Set starting values andf step sizes for parameters
219  double vstart[n];
220  for (int i = 0; i < int((n - 1) / 2); i++) {
221  vstart[2 * i + 0] = iniTimesArr[iBX[i]] + timeMean_;
222  vstart[2 * i + 1] = iEnArr[iBX[i]];
223  }
224  vstart[n - 1] = pedMean_;
225 
226  double step[n];
227  for (int i = 0; i < n; i++)
228  step[i] = 0.1;
229 
230  if (iFit == 1)
231  hybridfitter->SetFunction(*spfunctor_);
232  if (iFit == 2)
233  hybridfitter->SetFunction(*dpfunctor_);
234  if (iFit == 3)
235  hybridfitter->SetFunction(*tpfunctor_);
236  hybridfitter->Clear();
237  //Times and amplitudes
238  for (int i = 0; i < int((n - 1) / 2); i++) {
239  hybridfitter->SetLimitedVariable(0 + i * 2,
240  varNames[2 * i + 0],
241  vstart[0 + i * 2],
242  step[0 + i * 2],
243  iniTimesArr[iBX[i]] + tMin,
244  iniTimesArr[iBX[i]] + tMax);
245  hybridfitter->SetLimitedVariable(
246  1 + i * 2, varNames[2 * i + 1], vstart[1 + i * 2], step[1 + i * 2], 0, 1.2 * iTSTOTEn);
247  //Secret Option to fix the time
248  if (timeSig_ < 0)
249  hybridfitter->SetFixedVariable(0 + i * 2, varNames[2 * i + 0], vstart[0 + i * 2]);
250  }
251  //Pedestal
252  if (vstart[n - 1] > std::abs(pedMax))
253  vstart[n - 1] = pedMax;
254  hybridfitter->SetLimitedVariable(n - 1, varNames[n - 1], vstart[n - 1], step[n - 1], -pedMax, pedMax);
255  //Secret Option to fix the pedestal
256  if (pedSig_ < 0)
257  hybridfitter->SetFixedVariable(n - 1, varNames[n - 1], vstart[n - 1]);
258  //a special number to label the initial condition
259  chi2 = -1;
260  //3 fits why?!
261  const double *results = nullptr;
262  for (int tries = 0; tries <= 3; ++tries) {
263  if (fitTimes_ != 2 || tries != 1) {
265  fitStatus = hybridfitter->Minimize();
266  }
267  double chi2valfit = hybridfitter->MinValue();
268  const double *newresults = hybridfitter->X();
269  if (chi2 == -1 || chi2 > chi2valfit + 0.01) {
270  results = newresults;
271  chi2 = chi2valfit;
272  if (tries == 0 && fitTimes_ == 1)
273  break;
274  if (tries == 1 && (fitTimes_ == 2 || fitTimes_ == 3))
275  break;
276  if (tries == 2 && fitTimes_ == 4)
277  break;
278  if (tries == 3 && fitTimes_ == 5)
279  break;
280  //Secret option to speed up the fit => perhaps we should drop this
281  if (timeSig_ < 0 || pedSig_ < 0)
282  break;
283  if (tries == 0) {
284  hybridfitter->SetMinimizerType(ROOT::Minuit2::kScan);
285  fitStatus = hybridfitter->Minimize();
286  } else if (tries == 1) {
287  hybridfitter->SetStrategy(1);
288  } else if (tries == 2) {
289  hybridfitter->SetStrategy(2);
290  }
291  } else {
292  break;
293  }
294  }
295  assert(results);
296 
297  timevalfit = results[0];
298  chargevalfit = results[1];
299  pedvalfit = results[n - 1];
300 }
constexpr char const * varNames[]
assert(be >=bs)
std::array< double, hcal::constants::maxSamples > iniTimesArr
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::unique_ptr< ROOT::Math::Functor > tpfunctor_
std::unique_ptr< ROOT::Math::Functor > dpfunctor_
std::unique_ptr< ROOT::Math::Functor > spfunctor_
const char * kMigrad
results
Definition: mysort.py:8
step
Definition: StallMonitor.cc:83
void SetMinimizerType(ROOT::Minuit2::EMinimizerType type)

◆ phase1Apply()

void PulseShapeFitOOTPileupCorrection::phase1Apply ( const HBHEChannelInfo channelData,
float &  reconstructedEnergy,
float &  reconstructedTime,
bool &  useTriple,
float &  chi2 
) const

Definition at line 302 of file PulseShapeFitOOTPileupCorrection.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, nano_mu_local_reco_cff::chi2, HcalDetId::depth(), hcalRecHitTable_cff::energy, HBHEChannelInfo::fcByPE(), PedestalClient_cfi::gain, HBHEChannelInfo::hasTimeInfo(), HBHEChannelInfo::id(), hcal::constants::maxSamples, HBHEChannelInfo::nSamples(), psfPtr_, pulseShapeFit(), HBHEChannelInfo::soi(), mathSSE::sqrt(), ts4Chi2_, ts4Max_, ts4Min_, HBHEChannelInfo::tsDFcPerADC(), HBHEChannelInfo::tsGain(), HBHEChannelInfo::tsPedestal(), HBHEChannelInfo::tsPedestalWidth(), HBHEChannelInfo::tsRawCharge(), vts4Chi2_, and vts4Max_.

Referenced by SimpleHBHEPhase1Algo::reconstruct().

306  {
307  psfPtr_->setDefaultcntNANinfit();
308 
309  const unsigned cssize = channelData.nSamples();
310  const unsigned int soi = channelData.soi();
311 
312  // initialize arrays to be zero
313  double chargeArr[hcal::constants::maxSamples] = {}, pedArr[hcal::constants::maxSamples] = {},
314  gainArr[hcal::constants::maxSamples] = {};
315  double energyArr[hcal::constants::maxSamples] = {}, pedenArr[hcal::constants::maxSamples] = {};
316  double noiseADCArr[hcal::constants::maxSamples] = {};
317  double noiseArrSq[hcal::constants::maxSamples] = {};
318  double noisePHArr[hcal::constants::maxSamples] = {};
319  double tstrig = 0; // in fC
320  double tsTOTen = 0; // in GeV
321 
322  // go over the time slices
323  for (unsigned int ip = 0; ip < cssize; ++ip) {
324  if (ip >= (unsigned)hcal::constants::maxSamples)
325  continue; // Too many samples than what we wanna fit (10 is enough...) -> skip them
326 
327  // const int capid = channelData.capid(); // not needed
328  double charge = channelData.tsRawCharge(ip);
329  double ped = channelData.tsPedestal(ip);
330  double gain = channelData.tsGain(ip);
331 
332  double energy = charge * gain;
333  double peden = ped * gain;
334 
335  chargeArr[ip] = charge;
336  pedArr[ip] = ped;
337  gainArr[ip] = gain;
338  energyArr[ip] = energy;
339  pedenArr[ip] = peden;
340 
341  // quantization noise from the ADC (QIE8 or QIE10/11)
342  noiseADCArr[ip] = (1. / sqrt(12)) * channelData.tsDFcPerADC(ip);
343 
344  // Photo statistics uncertainties
345  // sigmaFC/FC = 1/sqrt(Ne);
346  // Note2. (from kPedro): the output number of photoelectrons after smearing is treated very differently for SiPMs: *each* pe is assigned a different time based on a random generation from the Y11 pulse plus the SimHit time. In HPDs, the overall pulse is shaped all at once using just the SimHit time.
347 
348  noisePHArr[ip] = 0;
349  if ((charge - ped) > channelData.tsPedestalWidth(ip)) {
350  noisePHArr[ip] = sqrt((charge - ped) * channelData.fcByPE());
351  }
352 
353  // sum all in quadrature
354  noiseArrSq[ip] = noiseADCArr[ip] * noiseADCArr[ip] +
355  channelData.tsPedestalWidth(ip) * channelData.tsPedestalWidth(ip) +
356  noisePHArr[ip] * noisePHArr[ip];
357 
358  tsTOTen += energy - peden;
359  if (ip == soi || ip == soi + 1) {
360  tstrig += charge - ped;
361  }
362  }
363 
364  double averagePedSig2GeV =
365  0.25 *
366  (channelData.tsPedestalWidth(0) * channelData.tsPedestalWidth(0) * channelData.tsGain(0) * channelData.tsGain(0) +
367  channelData.tsPedestalWidth(1) * channelData.tsPedestalWidth(1) * channelData.tsGain(1) * channelData.tsGain(1) +
368  channelData.tsPedestalWidth(2) * channelData.tsPedestalWidth(2) * channelData.tsGain(2) * channelData.tsGain(2) +
369  channelData.tsPedestalWidth(3) * channelData.tsPedestalWidth(3) * channelData.tsGain(3) * channelData.tsGain(3));
370 
371  // redefine the invertpedSig2
372  psfPtr_->setinvertpedSig2(1. / (averagePedSig2GeV));
373 
374  if (channelData.hasTimeInfo()) {
375  ts4Chi2_ = vts4Chi2_[1];
376  if (channelData.id().depth() == 1)
377  ts4Max_ = vts4Max_[1];
378  else
379  ts4Max_ = vts4Max_[2];
380 
381  } else {
382  ts4Max_ = vts4Max_[0];
383  ts4Chi2_ = vts4Chi2_[0];
384  }
385 
386  std::vector<float> fitParsVec;
387  if (tstrig >= ts4Min_ && tsTOTen > 0.) { //Two sigma from 0
388  pulseShapeFit(energyArr, pedenArr, chargeArr, pedArr, gainArr, tsTOTen, fitParsVec, noiseArrSq, channelData.soi());
389  } else {
390  fitParsVec.clear();
391  fitParsVec.push_back(0.); //charge
392  fitParsVec.push_back(-9999); // time
393  fitParsVec.push_back(0.); // ped
394  fitParsVec.push_back(-9999); // chi2
395  fitParsVec.push_back(false); // triple
396  }
397 
398  reconstructedEnergy = fitParsVec[0];
399  reconstructedTime = fitParsVec[1];
400  chi2 = fitParsVec[3];
401  useTriple = fitParsVec[4];
402 }
constexpr double fcByPE() const
constexpr float tsDFcPerADC(const unsigned ts) const
constexpr double tsRawCharge(const unsigned ts) const
constexpr double tsPedestalWidth(const unsigned ts) const
int pulseShapeFit(const double *energyArr, const double *pedenArr, const double *chargeArr, const double *pedArr, const double *gainArr, const double tsTOTen, std::vector< float > &fitParsVec, const double *ADCnoise, unsigned int soi) const
constexpr HcalDetId id() const
T sqrt(T t)
Definition: SSEVec.h:19
constexpr double tsGain(const unsigned ts) const
constexpr unsigned soi() const
constexpr int maxSamples
Definition: HcalConstants.h:6
constexpr bool hasTimeInfo() const
constexpr unsigned nSamples() const
constexpr double tsPedestal(const unsigned ts) const
std::unique_ptr< FitterFuncs::PulseShapeFunctor > psfPtr_
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164

◆ pulseShapeFit()

int PulseShapeFitOOTPileupCorrection::pulseShapeFit ( const double *  energyArr,
const double *  pedenArr,
const double *  chargeArr,
const double *  pedArr,
const double *  gainArr,
const double  tsTOTen,
std::vector< float > &  fitParsVec,
const double *  ADCnoise,
unsigned int  soi 
) const
private

Definition at line 112 of file PulseShapeFitOOTPileupCorrection.cc.

References funct::abs(), applyTimeSlew_, L1TStage2uGTEmulatorClient_cff::BX, nano_mu_local_reco_cff::chi2, HcalTimeSlew::delay(), fit(), hcalTimeSlewDelay_, mps_fire::i, createfilelist::int, hcal::constants::maxSamples, hcal::constants::nsPerBX, psfPtr_, hcal::constants::shiftTS, slewFlavor_, mathSSE::sqrt(), ts4Chi2_, ts4Max_, and tsDelay1GeV_.

Referenced by phase1Apply().

120  {
121  double tsMAX = 0;
124  double tstrig = 0; // in fC
125  for (unsigned int i = 0; i < hcal::constants::maxSamples; ++i) {
126  tmpx[i] = i;
127  tmpy[i] = energyArr[i] - pedenArr[i];
128  //Add Time Slew !!! does this need to be pedestal subtracted
129  tmpslew[i] = 0;
130  if (applyTimeSlew_) {
131  if (chargeArr[i] <= 1.0)
132  tmpslew[i] = tsDelay1GeV_;
133  else
134  tmpslew[i] = hcalTimeSlewDelay_->delay(chargeArr[i], slewFlavor_);
135  }
136 
137  // add the noise components
138  tmperry2[i] = noiseArrSq[i];
139 
140  //Propagate it through
141  tmperry2[i] *= (gainArr[i] * gainArr[i]); //Convert from fC to GeV
142  tmperry[i] = sqrt(tmperry2[i]);
143 
144  if (std::abs(energyArr[i]) > tsMAX)
145  tsMAX = std::abs(tmpy[i]);
146  if (i == soi || i == (soi + 1)) {
147  tstrig += chargeArr[i] - pedArr[i];
148  }
149  }
150  psfPtr_->setpsFitx(tmpx);
151  psfPtr_->setpsFity(tmpy);
152  psfPtr_->setpsFiterry(tmperry);
153  psfPtr_->setpsFiterry2(tmperry2);
154  psfPtr_->setpsFitslew(tmpslew);
155 
156  //Fit 1 single pulse
157  float timevalfit = 0;
158  float chargevalfit = 0;
159  float pedvalfit = 0;
160  float chi2 = 999; //cannot be zero
161  bool fitStatus = false;
162  bool useTriple = false;
163 
164  unsigned BX[3] = {soi, soi + 1, soi - 1};
165  if (ts4Chi2_ != 0)
166  fit(1, timevalfit, chargevalfit, pedvalfit, chi2, fitStatus, tsMAX, tsTOTen, tmpy, BX);
167  // Based on the pulse shape ( 2. likely gives the same performance )
168  if (tmpy[soi - 2] > 3. * tmpy[soi - 1])
169  BX[2] = soi - 2;
170  // Only do three-pulse fit when tstrig < ts4Max_, otherwise one-pulse fit is used (above)
171  if (chi2 > ts4Chi2_ && tstrig < ts4Max_) { //fails chi2 cut goes straight to 3 Pulse fit
172  fit(3, timevalfit, chargevalfit, pedvalfit, chi2, fitStatus, tsMAX, tsTOTen, tmpy, BX);
173  useTriple = true;
174  }
175 
176  timevalfit -= (int(soi) - hcal::constants::shiftTS) * hcal::constants::nsPerBX;
177 
178  /*
179  if(chi2 > ts345Chi2_) { //fails do two pulse chi2 for TS5
180  BX[1] = 5;
181  fit(3,timevalfit,chargevalfit,pedvalfit,chi2,fitStatus,tsMAX,tsTOTen,BX);
182  }
183  */
184  //Fix back the timeslew
185  //if(applyTimeSlew_) timevalfit+=HcalTimeSlew::delay(std::max(1.0,chargeArr[4]),slewFlavor_);
186  int outfitStatus = (fitStatus ? 1 : 0);
187  fitParsVec.clear();
188  fitParsVec.push_back(chargevalfit);
189  fitParsVec.push_back(timevalfit);
190  fitParsVec.push_back(pedvalfit);
191  fitParsVec.push_back(chi2);
192  fitParsVec.push_back(useTriple);
193  return outfitStatus;
194 }
constexpr int shiftTS
Definition: HcalConstants.h:11
float delay(float fC, BiasSetting bias=Medium) const
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
Definition: HcalTimeSlew.cc:20
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr int nsPerBX
Definition: HcalConstants.h:8
void fit(int iFit, float &timevalfit, float &chargevalfit, float &pedvalfit, float &chi2, bool &fitStatus, double &iTSMax, const double &iTSTOTen, double *iEnArr, unsigned(&iBX)[3]) const
constexpr int maxSamples
Definition: HcalConstants.h:6
std::unique_ptr< FitterFuncs::PulseShapeFunctor > psfPtr_

◆ resetPulseShapeTemplate()

void PulseShapeFitOOTPileupCorrection::resetPulseShapeTemplate ( const HcalPulseShapes::Shape ps,
unsigned  nSamples 
)

Definition at line 98 of file PulseShapeFitOOTPileupCorrection.cc.

References addPulseJitter_, cntsetPulseShape, FitterFuncs::PulseShapeFunctor::doublePulseShapeFunc(), dpfunctor_, PresampleTask_cfi::nSamples, pedestalConstraint_, pedMean_, psfPtr_, pulseJitter_, FitterFuncs::PulseShapeFunctor::singlePulseShapeFunc(), spfunctor_, timeConstraint_, timeMean_, tpfunctor_, and FitterFuncs::PulseShapeFunctor::triplePulseShapeFunc().

Referenced by setPulseShapeTemplate().

98  {
100  psfPtr_ = std::make_unique<FitterFuncs::PulseShapeFunctor>(
102  spfunctor_ =
103  std::make_unique<ROOT::Math::Functor>(psfPtr_.get(), &FitterFuncs::PulseShapeFunctor::singlePulseShapeFunc, 3);
104  dpfunctor_ =
105  std::make_unique<ROOT::Math::Functor>(psfPtr_.get(), &FitterFuncs::PulseShapeFunctor::doublePulseShapeFunc, 5);
106  tpfunctor_ =
107  std::make_unique<ROOT::Math::Functor>(psfPtr_.get(), &FitterFuncs::PulseShapeFunctor::triplePulseShapeFunc, 7);
108 }
double singlePulseShapeFunc(const double *x)
std::unique_ptr< ROOT::Math::Functor > tpfunctor_
std::unique_ptr< ROOT::Math::Functor > dpfunctor_
double triplePulseShapeFunc(const double *x)
std::unique_ptr< ROOT::Math::Functor > spfunctor_
double doublePulseShapeFunc(const double *x)
std::unique_ptr< FitterFuncs::PulseShapeFunctor > psfPtr_

◆ setPulseShapeTemplate()

void PulseShapeFitOOTPileupCorrection::setPulseShapeTemplate ( const HcalPulseShapes::Shape ps,
bool  isHPD,
unsigned  nSamples,
const HcalTimeSlew hcalTimeSlewDelay 
)

Definition at line 75 of file PulseShapeFitOOTPileupCorrection.cc.

References currentPulseShape_, HcalTimeSlew::delay(), hcalTimeSlewDelay_, isCurrentChannelHPD_, PresampleTask_cfi::nSamples, psfPtr_, resetPulseShapeTemplate(), slewFlavor_, timeSigHPD_, timeSigSiPM_, and tsDelay1GeV_.

78  {
79  // initialize for every different channel types (HPD vs SiPM)
80 
81  if (!(&ps == currentPulseShape_ && isHPD == isCurrentChannelHPD_)) {
83 
84  // redefine the inverttimeSig2
85  if (!isHPD)
86  psfPtr_->setinverttimeSig2(1. / (timeSigSiPM_ * timeSigSiPM_));
87  else
88  psfPtr_->setinverttimeSig2(1. / (timeSigHPD_ * timeSigHPD_));
89 
90  currentPulseShape_ = &ps;
91  isCurrentChannelHPD_ = isHPD;
92 
93  hcalTimeSlewDelay_ = hcalTimeSlewDelay;
94  tsDelay1GeV_ = hcalTimeSlewDelay->delay(1.0, slewFlavor_);
95  }
96 }
float delay(float fC, BiasSetting bias=Medium) const
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
Definition: HcalTimeSlew.cc:20
std::unique_ptr< FitterFuncs::PulseShapeFunctor > psfPtr_
void resetPulseShapeTemplate(const HcalPulseShapes::Shape &ps, unsigned nSamples)
const HcalPulseShapes::Shape * currentPulseShape_

◆ setPUParams()

void PulseShapeFitOOTPileupCorrection::setPUParams ( bool  iPedestalConstraint,
bool  iTimeConstraint,
bool  iAddPulseJitter,
bool  iApplyTimeSlew,
double  iTS4Min,
const std::vector< double > &  iTS4Max,
double  iPulseJitter,
double  iTimeMean,
double  iTimeSigHPD,
double  iTimeSigSiPM,
double  iPedMean,
double  iTMin,
double  iTMax,
const std::vector< double > &  its4Chi2,
HcalTimeSlew::BiasSetting  slewFlavor,
int  iFitTimes 
)

Definition at line 38 of file PulseShapeFitOOTPileupCorrection.cc.

References addPulseJitter_, applyTimeSlew_, fitTimes_, pedestalConstraint_, pedMean_, pulseJitter_, slewFlavor_, timeConstraint_, timeMean_, timeSigHPD_, timeSigSiPM_, ts4Min_, TSMax_, TSMin_, vts4Chi2_, and vts4Max_.

53  {
54  TSMin_ = iTMin;
55  TSMax_ = iTMax;
56  // ts4Chi2_ = its4Chi2;
57  vts4Chi2_ = its4Chi2;
58  pedestalConstraint_ = iPedestalConstraint;
59  timeConstraint_ = iTimeConstraint;
60  addPulseJitter_ = iAddPulseJitter;
61  applyTimeSlew_ = iApplyTimeSlew;
62  ts4Min_ = iTS4Min;
63  // ts4Max_ = iTS4Max;
64  vts4Max_ = iTS4Max;
65  pulseJitter_ = iPulseJitter * iPulseJitter;
66  timeMean_ = iTimeMean;
67  // timeSig_ = iTimeSig;
68  timeSigHPD_ = iTimeSigHPD;
69  timeSigSiPM_ = iTimeSigSiPM;
70  pedMean_ = iPedMean;
71  slewFlavor_ = slewFlavor;
72  fitTimes_ = iFitTimes;
73 }

Member Data Documentation

◆ addPulseJitter_

bool PulseShapeFitOOTPileupCorrection::addPulseJitter_
private

Definition at line 98 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by resetPulseShapeTemplate(), and setPUParams().

◆ applyTimeSlew_

bool PulseShapeFitOOTPileupCorrection::applyTimeSlew_
private

Definition at line 100 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by pulseShapeFit(), and setPUParams().

◆ chargeThreshold_

double PulseShapeFitOOTPileupCorrection::chargeThreshold_
private

Definition at line 85 of file PulseShapeFitOOTPileupCorrection.h.

◆ cntsetPulseShape

int PulseShapeFitOOTPileupCorrection::cntsetPulseShape
private

Definition at line 83 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by resetPulseShapeTemplate().

◆ currentPulseShape_

const HcalPulseShapes::Shape* PulseShapeFitOOTPileupCorrection::currentPulseShape_ = nullptr

Definition at line 51 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by setPulseShapeTemplate().

◆ dpfunctor_

std::unique_ptr<ROOT::Math::Functor> PulseShapeFitOOTPileupCorrection::dpfunctor_
private

Definition at line 90 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and resetPulseShapeTemplate().

◆ fitTimes_

int PulseShapeFitOOTPileupCorrection::fitTimes_
private

Definition at line 86 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and setPUParams().

◆ hcalTimeSlewDelay_

const HcalTimeSlew* PulseShapeFitOOTPileupCorrection::hcalTimeSlewDelay_ = nullptr

Definition at line 52 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by pulseShapeFit(), and setPulseShapeTemplate().

◆ hybridfitter

PSFitter::HybridMinimizer* PulseShapeFitOOTPileupCorrection::hybridfitter
private

◆ iniTimesArr

std::array<double, hcal::constants::maxSamples> PulseShapeFitOOTPileupCorrection::iniTimesArr
private

Definition at line 84 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and PulseShapeFitOOTPileupCorrection().

◆ isCurrentChannelHPD_

bool PulseShapeFitOOTPileupCorrection::isCurrentChannelHPD_
private

Definition at line 113 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by setPulseShapeTemplate().

◆ pedestalConstraint_

bool PulseShapeFitOOTPileupCorrection::pedestalConstraint_
private

Definition at line 96 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by resetPulseShapeTemplate(), and setPUParams().

◆ pedMean_

double PulseShapeFitOOTPileupCorrection::pedMean_
private

Definition at line 109 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), resetPulseShapeTemplate(), and setPUParams().

◆ pedSig_

double PulseShapeFitOOTPileupCorrection::pedSig_
private

Definition at line 110 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit().

◆ psfPtr_

std::unique_ptr<FitterFuncs::PulseShapeFunctor> PulseShapeFitOOTPileupCorrection::psfPtr_
private

◆ pulseJitter_

double PulseShapeFitOOTPileupCorrection::pulseJitter_
private

Definition at line 104 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by resetPulseShapeTemplate(), and setPUParams().

◆ slewFlavor_

HcalTimeSlew::BiasSetting PulseShapeFitOOTPileupCorrection::slewFlavor_
private

◆ spfunctor_

std::unique_ptr<ROOT::Math::Functor> PulseShapeFitOOTPileupCorrection::spfunctor_
private

Definition at line 89 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and resetPulseShapeTemplate().

◆ timeConstraint_

bool PulseShapeFitOOTPileupCorrection::timeConstraint_
private

Definition at line 97 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by resetPulseShapeTemplate(), and setPUParams().

◆ timeMean_

double PulseShapeFitOOTPileupCorrection::timeMean_
private

Definition at line 105 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), resetPulseShapeTemplate(), and setPUParams().

◆ timeSig_

double PulseShapeFitOOTPileupCorrection::timeSig_
private

Definition at line 106 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit().

◆ timeSigHPD_

double PulseShapeFitOOTPileupCorrection::timeSigHPD_
private

Definition at line 107 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by setPulseShapeTemplate(), and setPUParams().

◆ timeSigSiPM_

double PulseShapeFitOOTPileupCorrection::timeSigSiPM_
private

Definition at line 108 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by setPulseShapeTemplate(), and setPUParams().

◆ tpfunctor_

std::unique_ptr<ROOT::Math::Functor> PulseShapeFitOOTPileupCorrection::tpfunctor_
private

Definition at line 91 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and resetPulseShapeTemplate().

◆ ts4Chi2_

double PulseShapeFitOOTPileupCorrection::ts4Chi2_
mutableprivate

Definition at line 94 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by phase1Apply(), and pulseShapeFit().

◆ ts4Max_

double PulseShapeFitOOTPileupCorrection::ts4Max_
mutableprivate

Definition at line 102 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by phase1Apply(), and pulseShapeFit().

◆ ts4Min_

double PulseShapeFitOOTPileupCorrection::ts4Min_
private

Definition at line 101 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by phase1Apply(), and setPUParams().

◆ tsDelay1GeV_

double PulseShapeFitOOTPileupCorrection::tsDelay1GeV_ = 0

Definition at line 53 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by pulseShapeFit(), and setPulseShapeTemplate().

◆ TSMax_

int PulseShapeFitOOTPileupCorrection::TSMax_
private

Definition at line 93 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and setPUParams().

◆ TSMin_

int PulseShapeFitOOTPileupCorrection::TSMin_
private

Definition at line 92 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and setPUParams().

◆ unConstrainedFit_

bool PulseShapeFitOOTPileupCorrection::unConstrainedFit_
private

Definition at line 99 of file PulseShapeFitOOTPileupCorrection.h.

◆ vts4Chi2_

std::vector<double> PulseShapeFitOOTPileupCorrection::vts4Chi2_
private

Definition at line 95 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by phase1Apply(), and setPUParams().

◆ vts4Max_

std::vector<double> PulseShapeFitOOTPileupCorrection::vts4Max_
private

Definition at line 103 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by phase1Apply(), and setPUParams().