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

ele/ph mass fix #36889

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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/EgammaElectronAlgos/src/GsfElectronAlgo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,7 @@ void GsfElectronAlgo::createElectron(reco::GsfElectronCollection& electrons,
// Will be overwritten later in the case of the regression
ele.setCorrectedEcalEnergyError(egamma::ecalClusterEnergyUncertaintyElectronSpecific(*(ele.superCluster())));
ele.setP4(GsfElectron::P4_FROM_SUPER_CLUSTER, momentum, 0, true);
ele.setMass(0.00050);

//====================================================
// brems fractions
Expand Down
1 change: 1 addition & 0 deletions RecoEgamma/EgammaElectronAlgos/src/RegressionHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,6 @@ void RegressionHelper::applyCombinationRegression(reco::GsfElectron& ele) const
combinedMomentum);

ele.setP4(reco::GsfElectron::P4_COMBINATION, newMomentum, combinedMomentumError, true);
ele.setMass(0.00050);
}
}
9 changes: 9 additions & 0 deletions RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -946,20 +946,25 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt,
if (candidateP4type_ == "fromEcalEnergy") {
newCandidate.setP4(newCandidate.p4(reco::Photon::ecal_photons));
newCandidate.setCandidateP4type(reco::Photon::ecal_photons);
newCandidate.setMass(0);
} else if (candidateP4type_ == "fromRegression1") {
newCandidate.setP4(newCandidate.p4(reco::Photon::regression1));
newCandidate.setCandidateP4type(reco::Photon::regression1);
newCandidate.setMass(0);
} else if (candidateP4type_ == "fromRegression2") {
newCandidate.setP4(newCandidate.p4(reco::Photon::regression2));
newCandidate.setCandidateP4type(reco::Photon::regression2);
newCandidate.setMass(0);
} else if (candidateP4type_ == "fromRefinedSCRegression") {
newCandidate.setP4(newCandidate.p4(reco::Photon::regression2));
newCandidate.setCandidateP4type(reco::Photon::regression2);
newCandidate.setMass(0);
}
} else {
math::XYZVector gamma_momentum = direction.unit() * scRef->energy();
math::XYZTLorentzVectorD p4(gamma_momentum.x(), gamma_momentum.y(), gamma_momentum.z(), scRef->energy());
newCandidate.setP4(p4);
newCandidate.setMass(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

use PolarLorentzVector. This is the internal representation of reco candidate p4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello Slava,

The setMass function does this transformation.
https://cmssdt.cern.ch/lxr/source/DataFormats/Candidate/interface/ParticleState.h#0159

Do you mean to use,
math::PtEtaPhiMLorentzVector p4(gamma_momentum.Pt(), gamma_momentum.Eta(), gamma_momentum.Phi(), 0.0);
I could not find Pt function in math::XYZVector.

Please let me know your opinion.
Thanks,
Reza

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, I meant to replace the XYZT p4 construction and setP4;setMass with just a construction of Polar p4 followed by setP4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Slava,

As I mentioned, math::XYZVector does not have the Pt function. I need to recalculate it and I afraid to introduce bug there. What is wrong with using setMass function?
It does this transformation automatically using setCartesian function,
https://cmssdt.cern.ch/lxr/source/DataFormats/Candidate/interface/ParticleState.h#0159

Thanks,
Reza

Copy link
Contributor

Choose a reason for hiding this comment

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

typedef math::PtEtaPhiMLorentzVector PolarLorentzVector;

newCandidate.setCandidateP4type(reco::Photon::ecal_photons);
// Make it an EE photon
reco::Photon::FiducialFlags fiducialFlags;
Expand Down Expand Up @@ -1084,15 +1089,19 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt,
if (candidateP4type_ == "fromEcalEnergy") {
newCandidate.setP4(newCandidate.p4(reco::Photon::ecal_photons));
newCandidate.setCandidateP4type(reco::Photon::ecal_photons);
newCandidate.setMass(0);
} else if (candidateP4type_ == "fromRegression1") {
newCandidate.setP4(newCandidate.p4(reco::Photon::regression1));
newCandidate.setCandidateP4type(reco::Photon::regression1);
newCandidate.setMass(0);
} else if (candidateP4type_ == "fromRegression2") {
newCandidate.setP4(newCandidate.p4(reco::Photon::regression2));
newCandidate.setCandidateP4type(reco::Photon::regression2);
newCandidate.setMass(0);
} else if (candidateP4type_ == "fromRefinedSCRegression") {
newCandidate.setP4(newCandidate.p4(reco::Photon::regression2));
newCandidate.setCandidateP4type(reco::Photon::regression2);
newCandidate.setMass(0);
}

outputPhotonCollection.push_back(newCandidate);
Expand Down