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.;
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_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< reco::GenParticleMatch > genMatchMapToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
DistortedMuonProducer(const edm::ParameterSet &)
virtual double phi() const final
momentum azimuthal angle
std::vector< double > efficiencyRatioOverMC_
virtual void endJob() override
std::vector< Muon > MuonCollection
collection of Muon objects
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
std::vector< double > shiftOnOneOverPt_
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
std::vector< double > relativeUncertaintyOnPt_
virtual double mass() const final
mass
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.
virtual double eta() const final
momentum pseudorapidity
Muon * clone() const
create a clone
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual double pt() const final
transverse momentum