Definition at line 125 of file DistortedPFCandProducer.cc.
References reco::PFCandidate::clone(), DEFINE_FWK_MODULE, efficiencyRatioOverMC_, reco::LeafCandidate::eta(), conversionPostprocessing_cfi::etaBin, etaBinEdges_, funct::false, genMatchMapToken_, edm::Event::getByToken(), mps_fire::i, reco::Muon::isGlobalMuon(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::isNull(), edm::EventBase::isRealData(), reco::Muon::isStandAloneMuon(), reco::Muon::isTrackerMuon(), edm::RefToBase< T >::key(), edm::Ref< C, T, F >::key(), LogTrace, reco::LeafCandidate::mass(), eostools::move(), RPCpg::mu, reco::PFCandidate::mu, HiRecoMuon_cff::muonCollection, reco::PFCandidate::muonRef(), muonToken_, pileupCalc::nbins, MuonAlignmentFromReference_cff::newmuons, reco::PFCandidate::particleId(), packedPFCandidateRefMixer_cfi::pf, pfToken_, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), edm::Event::put(), relativeShiftOnPt_, relativeUncertaintyOnPt_, reco::LeafCandidate::setP4(), shiftOnOneOverPt_, reco::Muon::track(), and uncertaintyOnOneOverPt_.
Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().
132 edm::LogError(
"") <<
">>> Muon collection does not exist !!!";
138 edm::LogError(
"") <<
">>> Muon-GenParticle match map does not exist !!!";
146 edm::LogError(
"") <<
">>> PFCandidate collection does not exist !!!";
150 unsigned int muonCollectionSize = muonCollection->size();
151 unsigned int pfCollectionSize = pfCollection->size();
153 if (pfCollectionSize<1)
return;
157 bool pfMuonFound =
false;
165 for (
unsigned int j=0; j<pfCollectionSize; j++) {
170 double ptmu = pf->
pt();
173 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
181 if (muref.
key()==mu.
key()) {
194 else {pfMuonFound =
false; }
202 if ( !pfMuonFound)
continue;
204 double ptgen = pf->
pt();
205 double etagen = pf->
eta();
212 LogTrace(
"") <<
">>> Muon-GenParticle match found; ptmu= " << pf->
pt() <<
", ptgen= " << ptgen;
214 LogTrace(
"") <<
">>> MUON-GENPARTICLE MATCH NOT FOUND!!!";
219 double effRatio = 0.;
229 for (
unsigned int j=1; j<=
nbins; ++j) {
236 LogTrace(
"") <<
">>> etaBin: " << etaBin <<
", for etagen =" << etagen;
239 LogTrace(
"") <<
">>> Muon outside eta range: reject it; etagen = " << etagen;
244 if (!pfMuonFound)
continue;
249 LogTrace(
"") <<
"\tshiftOnOneOverPt= " << shift1*100 <<
" [%]";
250 LogTrace(
"") <<
"\trelativeShiftOnPt= " << shift2*100 <<
" [%]";
255 LogTrace(
"") <<
"\tuncertaintyOnOneOverPt= " << sigma1 <<
" [1/GeV]";
256 LogTrace(
"") <<
"\trelativeUncertaintyOnPt= " << sigma2*100 <<
" [%]";
260 LogTrace(
"") <<
"\tefficiencyRatioOverMC= " << effRatio;
263 double rndf = CLHEP::RandFlat::shoot();
264 if (rndf>effRatio)
continue;
267 double rndg1 = CLHEP::RandGauss::shoot();
268 double rndg2 = CLHEP::RandGauss::shoot();
273 ptmu += ptgen * ( shift1*ptgen + shift2 + sigma1*rndg1*ptgen + sigma2*rndg2);
274 pfMuonFound =
false ;
virtual double pt() const final
transverse momentum
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isNonnull() const
Checks for non-null.
virtual double mass() const final
mass
std::vector< double > relativeUncertaintyOnPt_
virtual double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual PFCandidate * clone() const
return a clone
bool isTrackerMuon() const
edm::EDGetTokenT< edm::View< reco::PFCandidate > > pfToken_
virtual TrackRef track() const
reference to a Track
bool isGlobalMuon() const
key_type key() const
Accessor for product key.
bool isStandAloneMuon() const
virtual double phi() const final
momentum azimuthal angle
edm::EDGetTokenT< reco::GenParticleMatch > genMatchMapToken_
std::vector< double > uncertaintyOnOneOverPt_
bool isNull() const
Checks for null.
reco::MuonRef muonRef() const
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
std::vector< double > efficiencyRatioOverMC_
virtual void setP4(const LorentzVector &p4) final
set 4-momentum
Particle reconstructed by the particle flow algorithm.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
virtual ParticleType particleId() const
std::vector< double > relativeShiftOnPt_
std::vector< double > shiftOnOneOverPt_
std::vector< double > etaBinEdges_