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

Fixing ECAL-Trk energy combination such that it gets the uncorrected ecal energy err #23677

Merged
merged 1 commit into from
Jun 26, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RecoEgamma/EgammaTools/interface/EpCombinationTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class EpCombinationTool

void setEventContent(const edm::EventSetup& iSetup);
std::pair<float, float> combine(const reco::GsfElectron& electron) const;
std::pair<float, float> combine(const reco::GsfElectron& electron,float corrEcalEnergyErr) const;

private:
EgammaRegressionContainer ecalTrkEnergyRegress_;
Expand Down
4 changes: 2 additions & 2 deletions RecoEgamma/EgammaTools/src/ElectronEnergyCalibrator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ setEnergyAndSystVarations(const float scale,const float smearNrSigma,const float
energyData[EGEnergySysIndex::kSmearUp] = calCombinedMom(ele,corrUp,smearUp).first;
energyData[EGEnergySysIndex::kSmearDown] = calCombinedMom(ele,corrDn,smearDn).first;

const std::pair<float, float> combinedMomentum = calCombinedMom(ele,corr,smear);
setEcalEnergy(ele,corr,smear);
const std::pair<float, float> combinedMomentum = epCombinationTool_->combine(ele);
const float energyCorr = combinedMomentum.first / oldP4.t();

const math::XYZTLorentzVector newP4(oldP4.x() * energyCorr,
Expand Down Expand Up @@ -189,7 +189,7 @@ std::pair<float,float> ElectronEnergyCalibrator::calCombinedMom(reco::GsfElectro
const float oldTrkMomErr = ele.trackMomentumError();

setEcalEnergy(ele,scale,smear);
const auto& combinedMomentum = epCombinationTool_->combine(ele);
const auto& combinedMomentum = epCombinationTool_->combine(ele,oldEcalEnergyErr*scale);

ele.setCorrectedEcalEnergy(oldEcalEnergy);
ele.setCorrectedEcalEnergyError(oldEcalEnergyErr);
Expand Down
9 changes: 8 additions & 1 deletion RecoEgamma/EgammaTools/src/EpCombinationTool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,20 @@ void EpCombinationTool::setEventContent(const edm::EventSetup& iSetup)
}

std::pair<float, float> EpCombinationTool::combine(const reco::GsfElectron& ele)const
{
return combine(ele,ele.correctedEcalEnergyError());
}

//when doing the E/p combination, its very important to ensure the ecalEnergyErr
//that the regression is trained on is used, not the actual ecalEnergyErr of the electron
//these differ when you correct the ecalEnergyErr by smearing value needed to get data/MC to agree
std::pair<float, float> EpCombinationTool::combine(const reco::GsfElectron& ele,const float corrEcalEnergyErr)const
{
const float scRawEnergy = ele.superCluster()->rawEnergy();
const float esEnergy = ele.superCluster()->preshowerEnergy();


const float corrEcalEnergy = ele.correctedEcalEnergy();
const float corrEcalEnergyErr = ele.correctedEcalEnergyError();
const float ecalMean = ele.correctedEcalEnergy() / (scRawEnergy+esEnergy);
const float ecalSigma = corrEcalEnergyErr / corrEcalEnergy;

Expand Down