Definition at line 122 of file DistortedMuonProducer.cc.
References reco::Muon::clone(), DEFINE_FWK_MODULE, efficiencyRatioOverMC_, reco::LeafCandidate::eta(), conversionPostprocessing_cfi::etaBin, etaBinEdges_, genMatchMapToken_, edm::Event::getByToken(), i, edm::Ref< C, T, F >::isNull(), edm::EventBase::isRealData(), j, LogTrace, reco::LeafCandidate::mass(), eostools::move(), RPCpg::mu, HiRecoMuon_cff::muonCollection, muonToken_, pileupCalc::nbins, MuonAlignmentFromReference_cff::newmuons, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), edm::Event::put(), relativeShiftOnPt_, relativeUncertaintyOnPt_, reco::LeafCandidate::setP4(), shiftOnOneOverPt_, and uncertaintyOnOneOverPt_.
Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().
129 edm::LogError(
"") <<
">>> Muon collection does not exist !!!";
135 edm::LogError(
"") <<
">>> Muon-GenParticle match map does not exist !!!";
139 unsigned int muonCollectionSize = muonCollection->size();
143 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
146 double ptgen = mu->
pt();
147 double etagen = mu->
eta();
152 LogTrace(
"") <<
">>> Muon-GenParticle match found; ptmu= " << mu->
pt() <<
", ptgen= " << ptgen;
154 LogTrace(
"") <<
">>> MUON-GENPARTICLE MATCH NOT FOUND!!!";
158 double effRatio = 0.;
168 for (
unsigned int j=1;
j<=
nbins; ++
j) {
175 LogTrace(
"") <<
">>> etaBin: " << etaBin <<
", for etagen =" << etagen;
178 LogTrace(
"") <<
">>> Muon outside eta range: reject it; etagen = " << etagen;
185 LogTrace(
"") <<
"\tshiftOnOneOverPt= " << shift1*100 <<
" [%]";
186 LogTrace(
"") <<
"\trelativeShiftOnPt= " << shift2*100 <<
" [%]";
191 LogTrace(
"") <<
"\tuncertaintyOnOneOverPt= " << sigma1 <<
" [1/GeV]";
192 LogTrace(
"") <<
"\trelativeUncertaintyOnPt= " << sigma2*100 <<
" [%]";
196 LogTrace(
"") <<
"\tefficiencyRatioOverMC= " << effRatio;
199 double rndf = CLHEP::RandFlat::shoot();
200 if (rndf>effRatio)
continue;
203 double rndg1 = CLHEP::RandGauss::shoot();
204 double rndg2 = CLHEP::RandGauss::shoot();
207 double ptmu = mu->
pt();
208 ptmu += ptgen * ( shift1*ptgen + shift2 + sigma1*rndg1*ptgen + sigma2*rndg2);
virtual double pt() const final
transverse momentum
std::vector< double > etaBinEdges_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< reco::GenParticleMatch > genMatchMapToken_
virtual double mass() const final
mass
virtual double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< double > efficiencyRatioOverMC_
std::vector< Muon > MuonCollection
collection of Muon objects
virtual double phi() const final
momentum azimuthal angle
std::vector< double > shiftOnOneOverPt_
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
std::vector< double > relativeUncertaintyOnPt_
bool isNull() const
Checks for null.
std::vector< double > relativeShiftOnPt_
virtual void setP4(const LorentzVector &p4) final
set 4-momentum
std::vector< double > uncertaintyOnOneOverPt_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Muon * clone() const
create a clone