Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include dark current contribution in M2 pedestal constraint for Phase2 #20422

Merged
merged 3 commits into from Sep 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Expand Up @@ -42,6 +42,15 @@ def customiseFor19989(process):
process.GlobalParameters = GlobalParameters
return process

# new parameter for HCAL method 2 reconstruction
def customiseFor20422(process):
from RecoLocalCalo.HcalRecProducers.HBHEMethod2Parameters_cfi import m2Parameters
for producer in producers_by_type(process, "HBHEPhase1Reconstructor"):
producer.algorithm.applyDCConstraint = m2Parameters.applyDCConstraint
for producer in producers_by_type(process, "HcalHitReconstructor"):
producer.applyDCConstraint = m2Parameters.applyDCConstraint
return process

# CMSSW version specific customizations
def customizeHLTforCMSSW(process, menuType="GRun"):

Expand All @@ -51,5 +60,6 @@ def customizeHLTforCMSSW(process, menuType="GRun"):
process = customiseFor19029(process)
process = customiseFor19824(process)
process = customiseFor19989(process)
process = customiseFor20422(process)

return process
Expand Up @@ -115,9 +115,9 @@ class PulseShapeFitOOTPileupCorrection
double iPedMean, double iPedSigHPD, double iPedSigSiPM,
double iNoiseHPD, double iNoiseSiPM,
double iTMin, double iTMax,
const std::vector<double> & its4Chi2, HcalTimeSlew::BiasSetting slewFlavor, int iFitTimes);
const std::vector<double> & its4Chi2, HcalTimeSlew::BiasSetting slewFlavor, int iFitTimes, bool iDCConstraint=false);

const HcalPulseShapes::Shape* currentPulseShape_=NULL;
const HcalPulseShapes::Shape* currentPulseShape_=nullptr;
void setChi2Term( bool isHPD );

void setPulseShapeTemplate (const HcalPulseShapes::Shape& ps, bool isHPD);
Expand Down Expand Up @@ -163,7 +163,8 @@ class PulseShapeFitOOTPileupCorrection
double noise_;
double noiseHPD_;
double noiseSiPM_;
HcalTimeSlew::BiasSetting slewFlavor_;
HcalTimeSlew::BiasSetting slewFlavor_;
bool dcConstraint_;

bool isCurrentChannelHPD_;
};
Expand Down
24 changes: 14 additions & 10 deletions RecoLocalCalo/HcalRecAlgos/src/PulseShapeFitOOTPileupCorrection.cc
Expand Up @@ -209,10 +209,10 @@ namespace FitterFuncs{

PulseShapeFitOOTPileupCorrection::PulseShapeFitOOTPileupCorrection() : cntsetPulseShape(0),
psfPtr_(nullptr), spfunctor_(nullptr), dpfunctor_(nullptr), tpfunctor_(nullptr),
TSMin_(0), TSMax_(0), vts4Chi2_(0), pedestalConstraint_(0),
timeConstraint_(0), addPulseJitter_(0), applyTimeSlew_(0),
TSMin_(0), TSMax_(0), vts4Chi2_(0), pedestalConstraint_(false),
timeConstraint_(false), addPulseJitter_(false), applyTimeSlew_(false),
ts4Min_(0), vts4Max_(0), pulseJitter_(0), timeMean_(0), timeSig_(0), pedMean_(0), pedSig_(0),
noise_(0) {
noise_(0), dcConstraint_(false) {
hybridfitter = new PSFitter::HybridMinimizer(PSFitter::HybridMinimizer::kMigrad);
iniTimesArr = { {-100,-75,-50,-25,0,25,50,75,100,125} };
}
Expand Down Expand Up @@ -243,7 +243,7 @@ void PulseShapeFitOOTPileupCorrection::setPUParams(bool iPedestalConstraint, b
double iNoiseHPD,double iNoiseSiPM,
double iTMin,double iTMax,
const std::vector<double> & its4Chi2,
HcalTimeSlew::BiasSetting slewFlavor, int iFitTimes) {
HcalTimeSlew::BiasSetting slewFlavor, int iFitTimes, bool iDCConstraint) {

TSMin_ = iTMin;
TSMax_ = iTMax;
Expand All @@ -270,6 +270,7 @@ void PulseShapeFitOOTPileupCorrection::setPUParams(bool iPedestalConstraint, b
noiseSiPM_ = iNoiseSiPM;
slewFlavor_ = slewFlavor;
fitTimes_ = iFitTimes;
dcConstraint_ = iDCConstraint;

}

Expand Down Expand Up @@ -473,7 +474,7 @@ void PulseShapeFitOOTPileupCorrection::fit(int iFit,float &timevalfit,float &cha
//a special number to label the initial condition
chi2=-1;
//3 fits why?!
const double *results = 0;
const double *results = nullptr;
for(int tries=0; tries<=3;++tries){
if( fitTimes_ != 2 || tries !=1 ){
hybridfitter->SetMinimizerType(PSFitter::HybridMinimizer::kMigrad);
Expand Down Expand Up @@ -529,6 +530,7 @@ void PulseShapeFitOOTPileupCorrection::phase1Apply(const HBHEChannelInfo& channe
double noisePHArr[HcalConst::maxSamples]={};
double tsTOT = 0, tstrig = 0; // in fC
double tsTOTen = 0; // in GeV
double sipmDarkCurrentWidth = psfPtr_->getSiPMDarkCurrent(channelData.darkCurrent(),channelData.fcByPE(),channelData.lambda());

// go over the time slices
for(unsigned int ip=0; ip<cssize; ++ip){
Expand All @@ -551,7 +553,7 @@ void PulseShapeFitOOTPileupCorrection::phase1Apply(const HBHEChannelInfo& channe
// dark current noise relevant for siPM
noiseDCArr[ip] = 0;
if(channelData.hasTimeInfo() && (charge-ped)>channelData.tsPedestalWidth(ip)) {
noiseDCArr[ip] = psfPtr_->getSiPMDarkCurrent(channelData.darkCurrent(),channelData.fcByPE(),channelData.lambda());
noiseDCArr[ip] = sipmDarkCurrentWidth;
}

// Photo statistics uncertainties
Expand All @@ -573,10 +575,12 @@ void PulseShapeFitOOTPileupCorrection::phase1Apply(const HBHEChannelInfo& channe
}
}

double averagePedSig2GeV=0.25*(channelData.tsPedestalWidth(0)*channelData.tsPedestalWidth(0)*channelData.tsGain(0)*channelData.tsGain(0) +
channelData.tsPedestalWidth(1)*channelData.tsPedestalWidth(1)*channelData.tsGain(1)*channelData.tsGain(1) +
channelData.tsPedestalWidth(2)*channelData.tsPedestalWidth(2)*channelData.tsGain(2)*channelData.tsGain(2) +
channelData.tsPedestalWidth(3)*channelData.tsPedestalWidth(3)*channelData.tsGain(3)*channelData.tsGain(3));
double sipmDarkCurrentWidth2 = 0.;
if(dcConstraint_) sipmDarkCurrentWidth2 = sipmDarkCurrentWidth*sipmDarkCurrentWidth;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, the dark current distribution is substantially non-Gaussian. So, the constraint done this way is perhaps not the best solution.
If so, I guess it's still OK for a trial for phase-2 studies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that will need to be a long-term development item for M2.

double averagePedSig2GeV=0.25*((channelData.tsPedestalWidth(0)*channelData.tsPedestalWidth(0)+sipmDarkCurrentWidth2)*channelData.tsGain(0)*channelData.tsGain(0) +
(channelData.tsPedestalWidth(1)*channelData.tsPedestalWidth(1)+sipmDarkCurrentWidth2)*channelData.tsGain(1)*channelData.tsGain(1) +
(channelData.tsPedestalWidth(2)*channelData.tsPedestalWidth(2)+sipmDarkCurrentWidth2)*channelData.tsGain(2)*channelData.tsGain(2) +
(channelData.tsPedestalWidth(3)*channelData.tsPedestalWidth(3)+sipmDarkCurrentWidth2)*channelData.tsGain(3)*channelData.tsGain(3));

// redefine the invertpedSig2
psfPtr_->setinvertpedSig2(1./(averagePedSig2GeV));
Expand Down
Expand Up @@ -14,6 +14,7 @@ static std::unique_ptr<PulseShapeFitOOTPileupCorrection>
parseHBHEMethod2Description(const edm::ParameterSet& conf)
{
const bool iPedestalConstraint = conf.getParameter<bool> ("applyPedConstraint");
const bool iDCConstraint = conf.getParameter<bool> ("applyDCConstraint");
const bool iTimeConstraint = conf.getParameter<bool> ("applyTimeConstraint");
const bool iAddPulseJitter = conf.getParameter<bool> ("applyPulseJitter");
const bool iApplyTimeSlew = conf.getParameter<bool> ("applyTimeSlew");
Expand Down Expand Up @@ -48,7 +49,7 @@ parseHBHEMethod2Description(const edm::ParameterSet& conf)
iPedMean, iPedSigHPD, iPedSigSiPM,
iNoiseHPD, iNoiseSiPM,
iTMin, iTMax, its4Chi2,
HcalTimeSlew::Medium, iFitTimes);
HcalTimeSlew::Medium, iFitTimes, iDCConstraint);

return corr;
}
Expand Down
Expand Up @@ -23,6 +23,9 @@
timeMin = cms.double(-12.5),#ns
timeMax = cms.double(12.5), #ns
ts4chi2 = cms.vdouble(15.,15.), #chi2 for triple pulse
fitTimes = cms.int32(1) # -1 means no constraint on number of fits per channel

fitTimes = cms.int32(1), # -1 means no constraint on number of fits per channel
applyDCConstraint = cms.bool(False),
)

from Configuration.Eras.Modifier_phase2_hcal_cff import phase2_hcal
phase2_hcal.toModify(m2Parameters, applyDCConstraint = True)