21 virtual void endJob()
override ;
43 #include <CLHEP/Random/RandFlat.h>
44 #include <CLHEP/Random/RandGauss.h>
50 produces<std::vector<reco::Muon> >();
57 std::vector<double> defEtaEdges;
58 defEtaEdges.push_back(-999999.);
59 defEtaEdges.push_back(999999.);
64 std::vector<double> defDistortion;
65 defDistortion.push_back(0.);
88 std::vector<double> defEfficiencyRatio;
89 defEfficiencyRatio.push_back(1.);
101 if ( effWrong and momWrong) {
102 edm::LogError(
"") <<
"WARNING: DistortedMuonProducer : Size of some parameters do not match the EtaBinEdges vector!!";
127 edm::LogError(
"") <<
">>> Muon collection does not exist !!!";
133 edm::LogError(
"") <<
">>> Muon-GenParticle match map does not exist !!!";
137 unsigned int muonCollectionSize = muonCollection->size();
141 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
144 double ptgen = mu->
pt();
145 double etagen = mu->
eta();
150 LogTrace(
"") <<
">>> Muon-GenParticle match found; ptmu= " << mu->
pt() <<
", ptgen= " << ptgen;
152 LogTrace(
"") <<
">>> MUON-GENPARTICLE MATCH NOT FOUND!!!";
156 double effRatio = 0.;
164 unsigned int etaBin =
nbins;
166 for (
unsigned int j=1;
j<=
nbins; ++
j) {
173 LogTrace(
"") <<
">>> etaBin: " << etaBin <<
", for etagen =" << etagen;
176 LogTrace(
"") <<
">>> Muon outside eta range: reject it; etagen = " << etagen;
183 LogTrace(
"") <<
"\tshiftOnOneOverPt= " << shift1*100 <<
" [%]";
184 LogTrace(
"") <<
"\trelativeShiftOnPt= " << shift2*100 <<
" [%]";
189 LogTrace(
"") <<
"\tuncertaintyOnOneOverPt= " << sigma1 <<
" [1/GeV]";
190 LogTrace(
"") <<
"\trelativeUncertaintyOnPt= " << sigma2*100 <<
" [%]";
194 LogTrace(
"") <<
"\tefficiencyRatioOverMC= " << effRatio;
197 double rndf = CLHEP::RandFlat::shoot();
198 if (rndf>effRatio)
continue;
201 double rndg1 = CLHEP::RandGauss::shoot();
202 double rndg2 = CLHEP::RandGauss::shoot();
205 double ptmu = mu->
pt();
206 ptmu += ptgen * ( shift1*ptgen + shift2 + sigma1*rndg1*ptgen + sigma2*rndg2);
213 newmuons->push_back(*newmu);
T getUntrackedParameter(std::string const &, T const &) const
virtual void beginJob() override
std::vector< double > etaBinEdges_
#define DEFINE_FWK_MODULE(type)
DistortedMuonProducer(const edm::ParameterSet &)
std::vector< double > efficiencyRatioOverMC_
virtual void endJob() override
std::vector< Muon > MuonCollection
collection of Muon objects
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
edm::InputTag genMatchMapTag_
bool isNull() const
Checks for null.
std::vector< double > shiftOnOneOverPt_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< double > relativeUncertaintyOnPt_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
Muon * clone() const
create a clone
virtual float mass() const GCC11_FINAL
mass
std::vector< double > relativeShiftOnPt_
std::vector< double > uncertaintyOnOneOverPt_
virtual void setP4(const LorentzVector &p4) GCC11_FINAL
set 4-momentum
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
virtual float pt() const GCC11_FINAL
transverse momentum
virtual void produce(edm::Event &, const edm::EventSetup &) override