Skip to content

Commit

Permalink
add the chi2 in the run2 and phase1 M2
Browse files Browse the repository at this point in the history
  • Loading branch information
mariadalfonso committed Sep 20, 2016
1 parent 2a1ab18 commit a2c6139
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Expand Up @@ -95,14 +95,16 @@ class PulseShapeFitOOTPileupCorrection
void phase1Apply(const HBHEChannelInfo& channelData,
float& reconstructedEnergy,
float& reconstructedTime,
bool & useTriple) const;
bool & useTriple,
float& chi2) const;

void apply(const CaloSamples & cs,
const std::vector<int> & capidvec,
const HcalCalibrations & calibs,
double& reconstructedEnergy,
float& reconstructedTime,
bool & useTriple) const;
bool & useTriple,
float& chi2) const;

void setPUParams(bool iPedestalConstraint, bool iTimeConstraint,bool iAddPulseJitter,bool iApplyTimeSlew,
double iTS4Min, std::vector<double> iTS4Max,
Expand Down
6 changes: 4 additions & 2 deletions RecoLocalCalo/HcalRecAlgos/src/HcalSimpleRecAlgo.cc
Expand Up @@ -355,6 +355,7 @@ namespace HcalSimpleRecAlgoImpl {
if( puCorrMethod == 2 ){

bool useTriple=false;
float chi2=-1;

CaloSamples cs;
coder.adc2fC(digi,cs);
Expand All @@ -363,7 +364,7 @@ namespace HcalSimpleRecAlgoImpl {
const int capid = digi[ip].capid();
capidvec.push_back(capid);
}
psFitOOTpuCorr->apply(cs, capidvec, calibs, ampl, time, useTriple);
psFitOOTpuCorr->apply(cs, capidvec, calibs, ampl, time, useTriple,chi2);
}

// S. Brandt - Feb 19th : Adding Section for HLT
Expand Down Expand Up @@ -422,6 +423,7 @@ namespace HcalSimpleRecAlgoImpl {
float t0 =0, t2 =0;
float time = -9999;
bool useTriple = false;
float chi2 = -1;

// Disable method 1 inside the removePileup function this way!
// Some code in removePileup does NOT do pileup correction & to make sure maximum share of code
Expand Down Expand Up @@ -460,7 +462,7 @@ namespace HcalSimpleRecAlgoImpl {
const int capid = digi[ip].capid();
capidvec.push_back(capid);
}
psFitOOTpuCorr->apply(cs, capidvec, calibs, ampl, time, useTriple);
psFitOOTpuCorr->apply(cs, capidvec, calibs, ampl, time, useTriple,chi2);
}

// S. Brandt - Feb 19th : Adding Section for HLT
Expand Down
Expand Up @@ -293,7 +293,8 @@ void PulseShapeFitOOTPileupCorrection::apply(const CaloSamples & cs,
const HcalCalibrations & calibs,
double& reconstructedEnergy,
float& reconstructedTime,
bool& useTriple) const
bool& useTriple,
float& chi2) const
{
psfPtr_->setDefaultcntNANinfit();

Expand Down Expand Up @@ -352,6 +353,7 @@ void PulseShapeFitOOTPileupCorrection::apply(const CaloSamples & cs,

reconstructedEnergy=fitParsVec[0];
reconstructedTime=fitParsVec[1];
chi2 = fitParsVec[3];
useTriple=fitParsVec[4];

}
Expand Down Expand Up @@ -502,7 +504,8 @@ void PulseShapeFitOOTPileupCorrection::fit(int iFit,float &timevalfit,float &cha
void PulseShapeFitOOTPileupCorrection::phase1Apply(const HBHEChannelInfo& channelData,
float& reconstructedEnergy,
float& reconstructedTime,
bool& useTriple) const
bool& useTriple,
float& chi2) const
{

psfPtr_->setDefaultcntNANinfit();
Expand Down Expand Up @@ -566,6 +569,7 @@ void PulseShapeFitOOTPileupCorrection::phase1Apply(const HBHEChannelInfo& channe

reconstructedEnergy = fitParsVec[0];
reconstructedTime = fitParsVec[1];
chi2 = fitParsVec[3];
useTriple = fitParsVec[4];

}
4 changes: 3 additions & 1 deletion RecoLocalCalo/HcalRecAlgos/src/SimpleHBHEPhase1Algo.cc
Expand Up @@ -72,14 +72,15 @@ HBHERecHit SimpleHBHEPhase1Algo::reconstruct(const HBHEChannelInfo& info,
// Run "Method 2"
float m2t = 0.f, m2E = 0.f;
bool useTriple = false;
float chi2=-1;
const PulseShapeFitOOTPileupCorrection* method2 = psFitOOTpuCorr_.get();
if (method2)
{
psFitOOTpuCorr_->setPulseShapeTemplate(theHcalPulseShapes_.getShape(info.recoShape()),
!info.hasTimeInfo());
// "phase1Apply" call below sets m2E, m2t, and useTriple.
// These parameters are pased by non-const reference.
method2->phase1Apply(info, m2E, m2t, useTriple);
method2->phase1Apply(info, m2E, m2t, useTriple, chi2);
m2E *= hbminusCorrectionFactor(channelId, m2E, isData);
}

Expand Down Expand Up @@ -112,6 +113,7 @@ HBHERecHit SimpleHBHEPhase1Algo::reconstruct(const HBHEChannelInfo& info,
rh = HBHERecHit(channelId, rhE, rht, tdcTime);
rh.setRawEnergy(m0E);
rh.setAuxEnergy(m3E);
rh.setChiSquared(chi2);

// Set rechit aux words
HBHERecHitAuxSetter::setAux(info, &rh);
Expand Down

0 comments on commit a2c6139

Please sign in to comment.