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 HcalTimeSlew *hcalTimeSlew_delay) const
 
 PulseShapeFitOOTPileupCorrection ()
 
void resetPulseShapeTemplate (const HcalPulseShapes::Shape &ps, unsigned nSamples)
 
void setChi2Term (bool isHPD)
 
void setPulseShapeTemplate (const HcalPulseShapes::Shape &ps, bool isHPD, unsigned nSamples)
 
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
 

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
 
double getSiPMDarkCurrent (double darkCurrent, double fcByPE, double lambda) 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 HcalTimeSlew *hcalTimeSlew_delay) 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, HcalConst::maxSamplesiniTimesArr
 
bool isCurrentChannelHPD_
 
double noise_
 
double noiseHPD_
 
double noiseSiPM_
 
bool pedestalConstraint_
 
double pedMean_
 
double pedSig_
 
double pedSigHPD_
 
double pedSigSiPM_
 
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 ( )

Definition at line 8 of file PulseShapeFitOOTPileupCorrection.cc.

References hybridfitter, iniTimesArr, and PSFitter::HybridMinimizer::kMigrad.

8  : cntsetPulseShape(0),
9  psfPtr_(nullptr), spfunctor_(nullptr), dpfunctor_(nullptr), tpfunctor_(nullptr),
10  TSMin_(0), TSMax_(0), vts4Chi2_(0), pedestalConstraint_(false),
11  timeConstraint_(false), addPulseJitter_(false), applyTimeSlew_(false),
12  ts4Min_(0), vts4Max_(0), pulseJitter_(0), timeMean_(0), timeSig_(0), pedMean_(0), pedSig_(0),
13  noise_(0) {
15  iniTimesArr = { {-100,-75,-50,-25,0,25,50,75,100,125} };
16 }
std::array< double, HcalConst::maxSamples > iniTimesArr
std::unique_ptr< ROOT::Math::Functor > tpfunctor_
std::unique_ptr< ROOT::Math::Functor > dpfunctor_
std::unique_ptr< ROOT::Math::Functor > spfunctor_
std::unique_ptr< FitterFuncs::PulseShapeFunctor > psfPtr_
PulseShapeFitOOTPileupCorrection::~PulseShapeFitOOTPileupCorrection ( )

Definition at line 18 of file PulseShapeFitOOTPileupCorrection.cc.

References hybridfitter.

18  {
19  if(hybridfitter) delete hybridfitter;
20 }

Member Function Documentation

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 156 of file PulseShapeFitOOTPileupCorrection.cc.

References funct::abs(), PSFitter::HybridMinimizer::Clear(), dpfunctor_, fitTimes_, hybridfitter, mps_fire::i, iniTimesArr, createfilelist::int, PSFitter::HybridMinimizer::kMigrad, PSFitter::HybridMinimizer::kScan, PSFitter::HybridMinimizer::Minimize(), PSFitter::HybridMinimizer::MinValue(), gen::n, pedMean_, pedSig_, mps_update::results, PSFitter::HybridMinimizer::SetFixedVariable(), PSFitter::HybridMinimizer::SetFunction(), PSFitter::HybridMinimizer::SetLimitedVariable(), PSFitter::HybridMinimizer::SetMinimizerType(), spfunctor_, timeMean_, timeSig_, tpfunctor_, TSMax_, TSMin_, varNames, and PSFitter::HybridMinimizer::X().

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

156  {
157  int n = 3;
158  if(iFit == 2) n = 5; //Two Pulse Fit
159  if(iFit == 3) n = 7; //Three Pulse Fit
160  //Step 1 Single Pulse fit
161  float pedMax = iTSMax; //=> max timeslice
162  float tMin = TSMin_; //Fitting Time Min
163  float tMax = TSMax_; //Fitting Time Max
164  //Checks to make sure fitting happens
165  if(pedMax < 1.) pedMax = 1.;
166  // Set starting values andf step sizes for parameters
167  double vstart[n];
168  for(int i = 0; i < int((n-1)/2); i++) {
169  vstart[2*i+0] = iniTimesArr[iBX[i]]+timeMean_;
170  vstart[2*i+1] = iEnArr[iBX[i]];
171  }
172  vstart[n-1] = pedMean_;
173 
174  double step[n];
175  for(int i = 0; i < n; i++) step[i] = 0.1;
176 
177  if(iFit == 1) hybridfitter->SetFunction(*spfunctor_);
178  if(iFit == 2) hybridfitter->SetFunction(*dpfunctor_);
179  if(iFit == 3) hybridfitter->SetFunction(*tpfunctor_);
180  hybridfitter->Clear();
181  //Times and amplitudes
182  for(int i = 0; i < int((n-1)/2); i++) {
183  hybridfitter->SetLimitedVariable(0+i*2, varNames[2*i+0] , vstart[0+i*2], step[0+i*2],iniTimesArr[iBX[i]]+tMin, iniTimesArr[ iBX[i] ]+tMax);
184  hybridfitter->SetLimitedVariable(1+i*2, varNames[2*i+1] , vstart[1+i*2], step[1+i*2], 0, 1.2*iTSTOTEn);
185  //Secret Option to fix the time
186  if(timeSig_ < 0) hybridfitter->SetFixedVariable(0+i*2, varNames[2*i+0],vstart[0+i*2]);
187  }
188  //Pedestal
189  if(vstart[n-1] > std::abs(pedMax)) vstart[n-1] = pedMax;
190  hybridfitter->SetLimitedVariable(n-1, varNames[n-1], vstart[n-1], step[n-1],-pedMax,pedMax);
191  //Secret Option to fix the pedestal
192  if(pedSig_ < 0) hybridfitter->SetFixedVariable(n-1,varNames[n-1],vstart[n-1]);
193  //a special number to label the initial condition
194  chi2=-1;
195  //3 fits why?!
196  const double *results = nullptr;
197  for(int tries=0; tries<=3;++tries){
198  if( fitTimes_ != 2 || tries !=1 ){
200  fitStatus = hybridfitter->Minimize();
201  }
202  double chi2valfit = hybridfitter->MinValue();
203  const double *newresults = hybridfitter->X();
204  if(chi2 == -1 || chi2>chi2valfit+0.01) {
205  results=newresults;
206  chi2=chi2valfit;
207  if( tries == 0 && fitTimes_ == 1 ) break;
208  if( tries == 1 && (fitTimes_ == 2 || fitTimes_ ==3 ) ) break;
209  if( tries == 2 && fitTimes_ == 4 ) break;
210  if( tries == 3 && fitTimes_ == 5 ) break;
211  //Secret option to speed up the fit => perhaps we should drop this
212  if(timeSig_ < 0 || pedSig_ < 0) break;
213  if(tries==0){
215  fitStatus = hybridfitter->Minimize();
216  } else if(tries==1){
217  hybridfitter->SetStrategy(1);
218  } else if(tries==2){
219  hybridfitter->SetStrategy(2);
220  }
221  } else {
222  break;
223  }
224  }
225  assert(results);
226 
227  timevalfit = results[0];
228  chargevalfit = results[1];
229  pedvalfit = results[n-1];
230 
231 }
double MinValue() const override
return minimum function value
constexpr char const * varNames[]
void SetFunction(const ROOT::Math::IMultiGenFunction &func) override
set the function to minimize
void SetMinimizerType(EMinimizerType type)
std::array< double, HcalConst::maxSamples > iniTimesArr
bool SetFixedVariable(unsigned int, const std::string &, double) override
set fixed variable (override if minimizer supports them )
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 double * X() const override
return pointer to X values at the minimum
bool SetLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double, double) override
set upper/lower limited variable (override if minimizer supports them )
step
double PulseShapeFitOOTPileupCorrection::getSiPMDarkCurrent ( double  darkCurrent,
double  fcByPE,
double  lambda 
) const
private

Definition at line 23 of file PulseShapeFitOOTPileupCorrection.cc.

References RPCpg::mu, funct::pow(), and mathSSE::sqrt().

Referenced by phase1Apply().

23  {
24  double mu = darkCurrent * 25 / fcByPE;
25  return sqrt(mu/pow(1-lambda,3)) * fcByPE;
26 }
T sqrt(T t)
Definition: SSEVec.h:18
const int mu
Definition: Constants.h:22
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void PulseShapeFitOOTPileupCorrection::phase1Apply ( const HBHEChannelInfo channelData,
float &  reconstructedEnergy,
float &  reconstructedTime,
bool &  useTriple,
float &  chi2,
const HcalTimeSlew hcalTimeSlew_delay 
) const

Definition at line 233 of file PulseShapeFitOOTPileupCorrection.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, HBHEChannelInfo::darkCurrent(), HBHEChannelInfo::fcByPE(), muonCSCDigis_cfi::gain, getSiPMDarkCurrent(), HBHEChannelInfo::hasEffectivePedestals(), HBHEChannelInfo::hasTimeInfo(), HBHEChannelInfo::lambda(), HcalConst::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().

239 {
240 
241  psfPtr_->setDefaultcntNANinfit();
242 
243  const unsigned cssize = channelData.nSamples();
244  const unsigned int soi = channelData.soi();
245 
246  // initialize arrays to be zero
247  double chargeArr[HcalConst::maxSamples]={}, pedArr[HcalConst::maxSamples]={}, gainArr[HcalConst::maxSamples]={};
248  double energyArr[HcalConst::maxSamples]={}, pedenArr[HcalConst::maxSamples]={};
249  double noiseADCArr[HcalConst::maxSamples]={};
250  double noiseDCArr[HcalConst::maxSamples]={};
251  double noiseArrSq[HcalConst::maxSamples]={};
252  double noisePHArr[HcalConst::maxSamples]={};
253  double tsTOT = 0, tstrig = 0; // in fC
254  double tsTOTen = 0; // in GeV
255 
256 
257  // go over the time slices
258  for(unsigned int ip=0; ip<cssize; ++ip){
259  if( ip >= (unsigned) HcalConst::maxSamples ) continue; // Too many samples than what we wanna fit (10 is enough...) -> skip them
260 
261  // const int capid = channelData.capid(); // not needed
262  double charge = channelData.tsRawCharge(ip);
263  double ped = channelData.tsPedestal(ip);
264  double gain = channelData.tsGain(ip);
265 
266  double energy = charge*gain;
267  double peden = ped*gain;
268 
269  chargeArr[ip] = charge; pedArr[ip] = ped; gainArr[ip] = gain;
270  energyArr[ip] = energy; pedenArr[ip] = peden;
271 
272  // quantization noise from the ADC (QIE8 or QIE10/11)
273  noiseADCArr[ip] = (1./sqrt(12))*channelData.tsDFcPerADC(ip);
274 
275  // dark current noise relevant for siPM (only if effective pedestal not used)
276  noiseDCArr[ip] = 0;
277  if(channelData.hasTimeInfo() && !channelData.hasEffectivePedestals() && (charge-ped)>channelData.tsPedestalWidth(ip)) {
278  noiseDCArr[ip] = getSiPMDarkCurrent(channelData.darkCurrent(),channelData.fcByPE(),channelData.lambda());
279  }
280 
281  // Photo statistics uncertainties
282  // sigmaFC/FC = 1/sqrt(Ne);
283  // 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.
284 
285  noisePHArr[ip] = 0;
286  if((charge-ped)>channelData.tsPedestalWidth(ip)) {
287  noisePHArr[ip] = sqrt((charge-ped)*channelData.fcByPE());
288  }
289 
290  // sum all in quadrature
291  noiseArrSq[ip]= noiseADCArr[ip]*noiseADCArr[ip] + noiseDCArr[ip]*noiseDCArr[ip] + channelData.tsPedestalWidth(ip)*channelData.tsPedestalWidth(ip) + noisePHArr[ip]*noisePHArr[ip];
292 
293  tsTOT += charge - ped;
294  tsTOTen += energy - peden;
295  if( ip == soi || ip == soi+1 ){
296  tstrig += charge - ped;
297  }
298  }
299 
300  double averagePedSig2GeV=0.25*(channelData.tsPedestalWidth(0)*channelData.tsPedestalWidth(0)*channelData.tsGain(0)*channelData.tsGain(0) +
301  channelData.tsPedestalWidth(1)*channelData.tsPedestalWidth(1)*channelData.tsGain(1)*channelData.tsGain(1) +
302  channelData.tsPedestalWidth(2)*channelData.tsPedestalWidth(2)*channelData.tsGain(2)*channelData.tsGain(2) +
303  channelData.tsPedestalWidth(3)*channelData.tsPedestalWidth(3)*channelData.tsGain(3)*channelData.tsGain(3));
304 
305  // redefine the invertpedSig2
306  psfPtr_->setinvertpedSig2(1./(averagePedSig2GeV));
307 
308  if(channelData.hasTimeInfo()) {
310  } else {
312  }
313 
314  std::vector<float> fitParsVec;
315  if(tstrig >= ts4Min_ && tsTOTen > 0.) { //Two sigma from 0
316  pulseShapeFit(energyArr, pedenArr, chargeArr, pedArr, gainArr, tsTOTen, fitParsVec, noiseArrSq, channelData.soi(), hcalTimeSlew_delay);
317  } else {
318  fitParsVec.clear();
319  fitParsVec.push_back(0.); //charge
320  fitParsVec.push_back(-9999); // time
321  fitParsVec.push_back(0.); // ped
322  fitParsVec.push_back(-9999); // chi2
323  fitParsVec.push_back(false); // triple
324  }
325 
326 
327  reconstructedEnergy = fitParsVec[0];
328  reconstructedTime = fitParsVec[1];
329  chi2 = fitParsVec[3];
330  useTriple = fitParsVec[4];
331 
332 }
double lambda() const
bool hasTimeInfo() const
double tsGain(const unsigned ts) const
unsigned soi() 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 HcalTimeSlew *hcalTimeSlew_delay) const
bool hasEffectivePedestals() const
double tsPedestal(const unsigned ts) const
constexpr int maxSamples
double tsRawCharge(const unsigned ts) const
T sqrt(T t)
Definition: SSEVec.h:18
double fcByPE() const
double darkCurrent() const
double tsPedestalWidth(const unsigned ts) const
std::unique_ptr< FitterFuncs::PulseShapeFunctor > psfPtr_
double getSiPMDarkCurrent(double darkCurrent, double fcByPE, double lambda) const
unsigned nSamples() const
float tsDFcPerADC(const unsigned ts) const
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 HcalTimeSlew hcalTimeSlew_delay 
) const
private

Definition at line 90 of file PulseShapeFitOOTPileupCorrection.cc.

References funct::abs(), applyTimeSlew_, rpcdqm::BX, vertices_cff::chi2, HcalTimeSlew::delay(), fit(), mps_fire::i, createfilelist::int, SiStripPI::max, HcalConst::maxSamples, HcalConst::nsPerBX, psfPtr_, HcalConst::shiftTS, slewFlavor_, mathSSE::sqrt(), ts4Chi2_, and ts4Max_.

Referenced by phase1Apply().

90  {
91  double tsMAX=0;
93  double tstrig = 0; // in fC
94  for(unsigned int i=0;i<HcalConst::maxSamples;++i){
95  tmpx[i]=i;
96  tmpy[i]=energyArr[i]-pedenArr[i];
97  //Add Time Slew !!! does this need to be pedestal subtracted
98  tmpslew[i] = 0;
99  if(applyTimeSlew_) tmpslew[i] = hcalTimeSlew_delay->delay(std::max(1.0,chargeArr[i]),slewFlavor_);
100  // add the noise components
101  tmperry2[i]=noiseArrSq[i];
102 
103  //Propagate it through
104  tmperry2[i]*=(gainArr[i]*gainArr[i]); //Convert from fC to GeV
105  tmperry [i]=sqrt(tmperry2[i]);
106 
107  if(std::abs(energyArr[i])>tsMAX) tsMAX=std::abs(tmpy[i]);
108  if( i ==soi || i ==(soi+1) ){
109  tstrig += chargeArr[i] - pedArr[i];
110  }
111  }
112  psfPtr_->setpsFitx (tmpx);
113  psfPtr_->setpsFity (tmpy);
114  psfPtr_->setpsFiterry (tmperry);
115  psfPtr_->setpsFiterry2(tmperry2);
116  psfPtr_->setpsFitslew (tmpslew);
117 
118  //Fit 1 single pulse
119  float timevalfit = 0;
120  float chargevalfit= 0;
121  float pedvalfit = 0;
122  float chi2 = 999; //cannot be zero
123  bool fitStatus = false;
124  bool useTriple = false;
125 
126  unsigned BX[3] = {soi,soi+1,soi-1};
127  if(ts4Chi2_ != 0) fit(1,timevalfit,chargevalfit,pedvalfit,chi2,fitStatus,tsMAX,tsTOTen,tmpy,BX);
128 // Based on the pulse shape ( 2. likely gives the same performance )
129  if(tmpy[soi-2] > 3.*tmpy[soi-1]) BX[2] = soi-2;
130 // Only do three-pulse fit when tstrig < ts4Max_, otherwise one-pulse fit is used (above)
131  if(chi2 > ts4Chi2_ && tstrig < ts4Max_) { //fails chi2 cut goes straight to 3 Pulse fit
132  fit(3,timevalfit,chargevalfit,pedvalfit,chi2,fitStatus,tsMAX,tsTOTen,tmpy,BX);
133  useTriple=true;
134  }
135 
136  timevalfit -= (int(soi)-HcalConst::shiftTS)*HcalConst::nsPerBX;
137 
138  /*
139  if(chi2 > ts345Chi2_) { //fails do two pulse chi2 for TS5
140  BX[1] = 5;
141  fit(3,timevalfit,chargevalfit,pedvalfit,chi2,fitStatus,tsMAX,tsTOTen,BX);
142  }
143  */
144  //Fix back the timeslew
145  //if(applyTimeSlew_) timevalfit+=HcalTimeSlew::delay(std::max(1.0,chargeArr[4]),slewFlavor_);
146  int outfitStatus = (fitStatus ? 1: 0 );
147  fitParsVec.clear();
148  fitParsVec.push_back(chargevalfit);
149  fitParsVec.push_back(timevalfit);
150  fitParsVec.push_back(pedvalfit);
151  fitParsVec.push_back(chi2);
152  fitParsVec.push_back(useTriple);
153  return outfitStatus;
154 }
double delay(double 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:14
constexpr int shiftTS
constexpr int maxSamples
T sqrt(T t)
Definition: SSEVec.h:18
constexpr int nsPerBX
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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
std::unique_ptr< FitterFuncs::PulseShapeFunctor > psfPtr_
void PulseShapeFitOOTPileupCorrection::resetPulseShapeTemplate ( const HcalPulseShapes::Shape ps,
unsigned  nSamples 
)

Definition at line 78 of file PulseShapeFitOOTPileupCorrection.cc.

References addPulseJitter_, applyTimeSlew_, cntsetPulseShape, FitterFuncs::PulseShapeFunctor::doublePulseShapeFunc(), dpfunctor_, noise_, pedestalConstraint_, pedMean_, pedSig_, psfPtr_, pulseJitter_, FitterFuncs::PulseShapeFunctor::singlePulseShapeFunc(), spfunctor_, timeConstraint_, timeMean_, timeSig_, tpfunctor_, and FitterFuncs::PulseShapeFunctor::triplePulseShapeFunc().

Referenced by setPulseShapeTemplate().

78  {
82  spfunctor_ = std::unique_ptr<ROOT::Math::Functor>( new ROOT::Math::Functor(psfPtr_.get(),&FitterFuncs::PulseShapeFunctor::singlePulseShapeFunc, 3) );
83  dpfunctor_ = std::unique_ptr<ROOT::Math::Functor>( new ROOT::Math::Functor(psfPtr_.get(),&FitterFuncs::PulseShapeFunctor::doublePulseShapeFunc, 5) );
84  tpfunctor_ = std::unique_ptr<ROOT::Math::Functor>( new ROOT::Math::Functor(psfPtr_.get(),&FitterFuncs::PulseShapeFunctor::triplePulseShapeFunc, 7) );
85 
86 }
double singlePulseShapeFunc(const double *x)
std::unique_ptr< ROOT::Math::Functor > tpfunctor_
constexpr size_t nSamples
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_
void PulseShapeFitOOTPileupCorrection::setChi2Term ( bool  isHPD)
void PulseShapeFitOOTPileupCorrection::setPulseShapeTemplate ( const HcalPulseShapes::Shape ps,
bool  isHPD,
unsigned  nSamples 
)

Definition at line 66 of file PulseShapeFitOOTPileupCorrection.cc.

References currentPulseShape_, isCurrentChannelHPD_, resetPulseShapeTemplate(), and setChi2Term().

66  {
67  // initialize for every different channel types (HPD vs SiPM)
68 
69  if (!(&ps == currentPulseShape_ && isHPD == isCurrentChannelHPD_))
70  {
71  setChi2Term(isHPD);
73  currentPulseShape_ = &ps;
74  isCurrentChannelHPD_ = isHPD;
75  }
76 }
constexpr size_t nSamples
void resetPulseShapeTemplate(const HcalPulseShapes::Shape &ps, unsigned nSamples)
const HcalPulseShapes::Shape * currentPulseShape_
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 36 of file PulseShapeFitOOTPileupCorrection.cc.

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

42  {
43 
44  TSMin_ = iTMin;
45  TSMax_ = iTMax;
46  // ts4Chi2_ = its4Chi2;
47  vts4Chi2_ = its4Chi2;
48  pedestalConstraint_ = iPedestalConstraint;
49  timeConstraint_ = iTimeConstraint;
50  addPulseJitter_ = iAddPulseJitter;
51  applyTimeSlew_ = iApplyTimeSlew;
52  ts4Min_ = iTS4Min;
53  // ts4Max_ = iTS4Max;
54  vts4Max_ = iTS4Max;
55  pulseJitter_ = iPulseJitter*iPulseJitter;
56  timeMean_ = iTimeMean;
57  // timeSig_ = iTimeSig;
58  timeSigHPD_ = iTimeSigHPD;
59  timeSigSiPM_ = iTimeSigSiPM;
60  pedMean_ = iPedMean;
61  slewFlavor_ = slewFlavor;
62  fitTimes_ = iFitTimes;
63 
64 }

Member Data Documentation

bool PulseShapeFitOOTPileupCorrection::addPulseJitter_
private

Definition at line 75 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by resetPulseShapeTemplate(), and setPUParams().

bool PulseShapeFitOOTPileupCorrection::applyTimeSlew_
private
double PulseShapeFitOOTPileupCorrection::chargeThreshold_
private

Definition at line 62 of file PulseShapeFitOOTPileupCorrection.h.

int PulseShapeFitOOTPileupCorrection::cntsetPulseShape
private

Definition at line 60 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by resetPulseShapeTemplate().

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

Definition at line 44 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by setPulseShapeTemplate().

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

Definition at line 67 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and resetPulseShapeTemplate().

int PulseShapeFitOOTPileupCorrection::fitTimes_
private

Definition at line 63 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and setPUParams().

PSFitter::HybridMinimizer* PulseShapeFitOOTPileupCorrection::hybridfitter
private
std::array<double,HcalConst::maxSamples> PulseShapeFitOOTPileupCorrection::iniTimesArr
private

Definition at line 61 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and PulseShapeFitOOTPileupCorrection().

bool PulseShapeFitOOTPileupCorrection::isCurrentChannelHPD_
private

Definition at line 95 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by setPulseShapeTemplate().

double PulseShapeFitOOTPileupCorrection::noise_
private

Definition at line 90 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by resetPulseShapeTemplate().

double PulseShapeFitOOTPileupCorrection::noiseHPD_
private

Definition at line 91 of file PulseShapeFitOOTPileupCorrection.h.

double PulseShapeFitOOTPileupCorrection::noiseSiPM_
private

Definition at line 92 of file PulseShapeFitOOTPileupCorrection.h.

bool PulseShapeFitOOTPileupCorrection::pedestalConstraint_
private

Definition at line 73 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by resetPulseShapeTemplate(), and setPUParams().

double PulseShapeFitOOTPileupCorrection::pedMean_
private

Definition at line 86 of file PulseShapeFitOOTPileupCorrection.h.

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

double PulseShapeFitOOTPileupCorrection::pedSig_
private

Definition at line 87 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and resetPulseShapeTemplate().

double PulseShapeFitOOTPileupCorrection::pedSigHPD_
private

Definition at line 88 of file PulseShapeFitOOTPileupCorrection.h.

double PulseShapeFitOOTPileupCorrection::pedSigSiPM_
private

Definition at line 89 of file PulseShapeFitOOTPileupCorrection.h.

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

Definition at line 81 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by resetPulseShapeTemplate(), and setPUParams().

HcalTimeSlew::BiasSetting PulseShapeFitOOTPileupCorrection::slewFlavor_
private

Definition at line 93 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by pulseShapeFit(), and setPUParams().

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

Definition at line 66 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and resetPulseShapeTemplate().

bool PulseShapeFitOOTPileupCorrection::timeConstraint_
private

Definition at line 74 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by resetPulseShapeTemplate(), and setPUParams().

double PulseShapeFitOOTPileupCorrection::timeMean_
private

Definition at line 82 of file PulseShapeFitOOTPileupCorrection.h.

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

double PulseShapeFitOOTPileupCorrection::timeSig_
private

Definition at line 83 of file PulseShapeFitOOTPileupCorrection.h.

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

double PulseShapeFitOOTPileupCorrection::timeSigHPD_
private

Definition at line 84 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by setChi2Term(), and setPUParams().

double PulseShapeFitOOTPileupCorrection::timeSigSiPM_
private

Definition at line 85 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by setChi2Term(), and setPUParams().

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

Definition at line 68 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and resetPulseShapeTemplate().

double PulseShapeFitOOTPileupCorrection::ts4Chi2_
mutableprivate

Definition at line 71 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by phase1Apply(), and pulseShapeFit().

double PulseShapeFitOOTPileupCorrection::ts4Max_
mutableprivate

Definition at line 79 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by phase1Apply(), and pulseShapeFit().

double PulseShapeFitOOTPileupCorrection::ts4Min_
private

Definition at line 78 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by phase1Apply(), and setPUParams().

int PulseShapeFitOOTPileupCorrection::TSMax_
private

Definition at line 70 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and setPUParams().

int PulseShapeFitOOTPileupCorrection::TSMin_
private

Definition at line 69 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by fit(), and setPUParams().

bool PulseShapeFitOOTPileupCorrection::unConstrainedFit_
private

Definition at line 76 of file PulseShapeFitOOTPileupCorrection.h.

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

Definition at line 72 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by phase1Apply(), and setPUParams().

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

Definition at line 80 of file PulseShapeFitOOTPileupCorrection.h.

Referenced by phase1Apply(), and setPUParams().