25 virtual void endJob()
override ;
45 #include <CLHEP/Random/RandFlat.h>
46 #include <CLHEP/Random/RandGauss.h>
52 produces<std::vector<reco::Muon> >();
59 std::vector<double> defEtaEdges;
60 defEtaEdges.push_back(-999999.);
61 defEtaEdges.push_back(999999.);
66 std::vector<double> defDistortion;
67 defDistortion.push_back(0.);
90 std::vector<double> defEfficiencyRatio;
91 defEfficiencyRatio.push_back(1.);
103 if ( effWrong and momWrong) {
104 edm::LogError(
"") <<
"WARNING: DistortedMuonProducer : Size of some parameters do not match the EtaBinEdges vector!!";
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.;
166 unsigned int etaBin =
nbins;
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);
215 newmuons->push_back(*newmu);
T getUntrackedParameter(std::string const &, T const &) const
virtual void beginJob() override
std::vector< double > etaBinEdges_
edm::EDGetTokenT< reco::GenParticleMatch > genMatchMapToken_
virtual float pt() const
transverse momentum
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
virtual float phi() const
momentum azimuthal angle
DistortedMuonProducer(const edm::ParameterSet &)
virtual void setP4(const LorentzVector &p4)
set 4-momentum
std::vector< double > efficiencyRatioOverMC_
virtual void endJob() override
std::vector< Muon > MuonCollection
collection of Muon objects
std::vector< double > shiftOnOneOverPt_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual float eta() const
momentum pseudorapidity
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
std::vector< double > relativeUncertaintyOnPt_
bool isNull() const
Checks for null.
Muon * clone() const
create a clone
std::vector< double > relativeShiftOnPt_
std::vector< double > uncertaintyOnOneOverPt_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
virtual float mass() const
mass
virtual void produce(edm::Event &, const edm::EventSetup &) override