Skip to content

Commit

Permalink
remove unneded mothod, redefine variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
mariadalfonso committed Mar 2, 2018
1 parent dcf83dc commit c857b1d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 36 deletions.
4 changes: 1 addition & 3 deletions RecoLocalCalo/HcalRecAlgos/interface/MahiFit.h
Expand Up @@ -127,8 +127,6 @@ class MahiFit

void solveSubmatrix(PulseMatrix& mat, PulseVector& invec, PulseVector& outvec, unsigned nP) const;

inline double getSiPMDarkCurrent(double darkCurrent, double fcByPE, double lambda) const { double mu = darkCurrent * 25 / fcByPE; return sqrt(mu/pow(1-lambda,3)) * fcByPE;}

mutable MahiNnlsWorkspace nnlsWork_;

//hard coded in initializer
Expand All @@ -144,7 +142,7 @@ class MahiFit

bool applyTimeSlew_;
HcalTimeSlew::BiasSetting slewFlavor_;
double TSdelay1GeV_=0;
double tsDelay1GeV_=0;

float meanTime_;
float timeSigmaHPD_;
Expand Down
Expand Up @@ -42,17 +42,13 @@ class PulseShapeFitOOTPileupCorrection

const HcalPulseShapes::Shape* currentPulseShape_=nullptr;
const HcalTimeSlew* hcalTimeSlewDelay_=nullptr;
double TSdelay1GeV_=0;

void setChi2Term( bool isHPD );
double tsDelay1GeV_=0;

void setPulseShapeTemplate (const HcalPulseShapes::Shape& ps, bool isHPD, unsigned nSamples, const HcalTimeSlew* hcalTimeSlewDelay);
void resetPulseShapeTemplate(const HcalPulseShapes::Shape& ps, unsigned nSamples);

private:

inline double getSiPMDarkCurrent(double darkCurrent, double fcByPE, double lambda) const { double mu = darkCurrent * 25 / fcByPE; return sqrt(mu/pow(1-lambda,3)) * fcByPE;}

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;
void fit(int iFit,float &timevalfit,float &chargevalfit,float &pedvalfit,float &chi2,bool &fitStatus,double &iTSMax,
Expand Down
12 changes: 3 additions & 9 deletions RecoLocalCalo/HcalRecAlgos/src/MahiFit.cc
Expand Up @@ -78,12 +78,6 @@ void MahiFit::phase1Apply(const HBHEChannelInfo& channelData,
//ADC granularity
double noiseADC = (1./sqrt(12))*channelData.tsDFcPerADC(iTS);

//Dark current (for SiPMs)
double noiseDC=0;
if(channelData.hasTimeInfo() && !channelData.hasEffectivePedestals() && (charge-ped)>channelData.tsPedestalWidth(iTS)) {
noiseDC = getSiPMDarkCurrent(channelData.darkCurrent(),channelData.fcByPE(),channelData.lambda());
}

//Photostatistics
double noisePhoto = 0;
if ( (charge-ped)>channelData.tsPedestalWidth(iTS)) {
Expand All @@ -94,7 +88,7 @@ void MahiFit::phase1Apply(const HBHEChannelInfo& channelData,
double pedWidth = channelData.tsPedestalWidth(iTS);

//Total uncertainty from all sources
nnlsWork_.noiseTerms.coeffRef(iTS) = noiseADC*noiseADC + noiseDC*noiseDC + noisePhoto*noisePhoto + pedWidth*pedWidth;
nnlsWork_.noiseTerms.coeffRef(iTS) = noiseADC*noiseADC + noisePhoto*noisePhoto + pedWidth*pedWidth;

tsTOT += (charge - ped)*channelData.tsGain(0);
if( iTS==nnlsWork_.tsOffset ){
Expand Down Expand Up @@ -259,7 +253,7 @@ void MahiFit::updatePulseShape(double itQ, FullSampleVector &pulseShape, FullSam
float t0=meanTime_;

if(applyTimeSlew_) {
if(itQ<=1.0) t0+=TSdelay1GeV_;
if(itQ<=1.0) t0+=tsDelay1GeV_;
else t0+=hcalTimeSlewDelay_->delay(itQ,slewFlavor_);
}

Expand Down Expand Up @@ -477,7 +471,7 @@ void MahiFit::setPulseShapeTemplate(const HcalPulseShapes::Shape& ps,const HcalT
{

hcalTimeSlewDelay_ = hcalTimeSlewDelay;
TSdelay1GeV_= hcalTimeSlewDelay->delay(1.0, slewFlavor_);
tsDelay1GeV_= hcalTimeSlewDelay->delay(1.0, slewFlavor_);

resetPulseShapeTemplate(ps);
currentPulseShape_ = &ps;
Expand Down
21 changes: 3 additions & 18 deletions RecoLocalCalo/HcalRecAlgos/src/PulseShapeFitOOTPileupCorrection.cc
Expand Up @@ -19,14 +19,6 @@ PulseShapeFitOOTPileupCorrection::~PulseShapeFitOOTPileupCorrection() {
if(hybridfitter) delete hybridfitter;
}

void PulseShapeFitOOTPileupCorrection::setChi2Term( bool isHPD ) {

if(isHPD) timeSig_ = timeSigHPD_;
else timeSig_ = timeSigSiPM_;

}


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,
Expand Down Expand Up @@ -72,7 +64,7 @@ void PulseShapeFitOOTPileupCorrection::setPulseShapeTemplate(const HcalPulseShap
isCurrentChannelHPD_ = isHPD;

hcalTimeSlewDelay_ = hcalTimeSlewDelay;
TSdelay1GeV_= hcalTimeSlewDelay->delay(1.0, slewFlavor_);
tsDelay1GeV_= hcalTimeSlewDelay->delay(1.0, slewFlavor_);

}
}
Expand All @@ -99,7 +91,7 @@ int PulseShapeFitOOTPileupCorrection::pulseShapeFit(const double * energyArr, co
//Add Time Slew !!! does this need to be pedestal subtracted
tmpslew[i] = 0;
if(applyTimeSlew_) {
if(chargeArr[i]<=1.0) tmpslew[i] = TSdelay1GeV_;
if(chargeArr[i]<=1.0) tmpslew[i] = tsDelay1GeV_;
else tmpslew[i] = hcalTimeSlewDelay_->delay(chargeArr[i],slewFlavor_);
}

Expand Down Expand Up @@ -252,7 +244,6 @@ void PulseShapeFitOOTPileupCorrection::phase1Apply(const HBHEChannelInfo& channe
double chargeArr[HcalConst::maxSamples]={}, pedArr[HcalConst::maxSamples]={}, gainArr[HcalConst::maxSamples]={};
double energyArr[HcalConst::maxSamples]={}, pedenArr[HcalConst::maxSamples]={};
double noiseADCArr[HcalConst::maxSamples]={};
double noiseDCArr[HcalConst::maxSamples]={};
double noiseArrSq[HcalConst::maxSamples]={};
double noisePHArr[HcalConst::maxSamples]={};
double tsTOT = 0, tstrig = 0; // in fC
Expand All @@ -277,12 +268,6 @@ void PulseShapeFitOOTPileupCorrection::phase1Apply(const HBHEChannelInfo& channe
// quantization noise from the ADC (QIE8 or QIE10/11)
noiseADCArr[ip] = (1./sqrt(12))*channelData.tsDFcPerADC(ip);

// dark current noise relevant for siPM (only if effective pedestal not used)
noiseDCArr[ip] = 0;
if(channelData.hasTimeInfo() && !channelData.hasEffectivePedestals() && (charge-ped)>channelData.tsPedestalWidth(ip)) {
noiseDCArr[ip] = getSiPMDarkCurrent(channelData.darkCurrent(),channelData.fcByPE(),channelData.lambda());
}

// Photo statistics uncertainties
// sigmaFC/FC = 1/sqrt(Ne);
// 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.
Expand All @@ -293,7 +278,7 @@ void PulseShapeFitOOTPileupCorrection::phase1Apply(const HBHEChannelInfo& channe
}

// sum all in quadrature
noiseArrSq[ip]= noiseADCArr[ip]*noiseADCArr[ip] + noiseDCArr[ip]*noiseDCArr[ip] + channelData.tsPedestalWidth(ip)*channelData.tsPedestalWidth(ip) + noisePHArr[ip]*noisePHArr[ip];
noiseArrSq[ip]= noiseADCArr[ip]*noiseADCArr[ip] + channelData.tsPedestalWidth(ip)*channelData.tsPedestalWidth(ip) + noisePHArr[ip]*noisePHArr[ip];

tsTOT += charge - ped;
tsTOTen += energy - peden;
Expand Down
1 change: 0 additions & 1 deletion RecoLocalCalo/HcalRecAlgos/src/PulseShapeFunctor.cc
Expand Up @@ -68,7 +68,6 @@ namespace FitterFuncs{
int i_start = ( -HcalConst::iniTimeShift - pulseTime - slew >0 ? 0 : (int)std::abs(-HcalConst::iniTimeShift-pulseTime-slew) + 1);
double offset_start = i_start - HcalConst::iniTimeShift - pulseTime - slew; //-199-2*pars[0]-2.*slew (for pars[0] > 98.5) or just -98.5-pars[0]-slew;
// zeroing output binned pulse shape
// ntmpbin = { {0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f} };
ntmpbin.fill(0.0f);

if( edm::isNotFinite(offset_start) ){ //Check for nan
Expand Down

0 comments on commit c857b1d

Please sign in to comment.