46 #include <CLHEP/Random/RandFlat.h>
47 #include <CLHEP/Random/RandGauss.h>
53 produces<std::vector<reco::PFCandidate> >();
61 std::vector<double> defEtaEdges;
62 defEtaEdges.push_back(-999999.);
63 defEtaEdges.push_back(999999.);
68 std::vector<double> defDistortion;
69 defDistortion.push_back(0.);
92 std::vector<double> defEfficiencyRatio;
93 defEfficiencyRatio.push_back(1.);
105 if ( effWrong and momWrong) {
106 edm::LogError(
"") <<
"WARNING: DistortedPFCandProducer : Size of some parameters do not match the EtaBinEdges vector!!";
131 edm::LogError(
"") <<
">>> Muon collection does not exist !!!";
137 edm::LogError(
"") <<
">>> Muon-GenParticle match map does not exist !!!";
145 edm::LogError(
"") <<
">>> PFCandidate collection does not exist !!!";
149 unsigned int muonCollectionSize = muonCollection->size();
150 unsigned int pfCollectionSize = pfCollection->size();
152 if (pfCollectionSize<1)
return;
156 bool pfMuonFound =
false;
164 for (
unsigned int j=0;
j<pfCollectionSize;
j++) {
169 double ptmu = pf->
pt();
172 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
180 if (muref.
key()==mu.
key()) {
193 else {pfMuonFound =
false; }
201 if ( !pfMuonFound)
continue;
203 double ptgen = pf->
pt();
204 double etagen = pf->
eta();
211 LogTrace(
"") <<
">>> Muon-GenParticle match found; ptmu= " << pf->
pt() <<
", ptgen= " << ptgen;
213 LogTrace(
"") <<
">>> MUON-GENPARTICLE MATCH NOT FOUND!!!";
218 double effRatio = 0.;
226 unsigned int etaBin =
nbins;
228 for (
unsigned int j=1;
j<=
nbins; ++
j) {
235 LogTrace(
"") <<
">>> etaBin: " << etaBin <<
", for etagen =" << etagen;
238 LogTrace(
"") <<
">>> Muon outside eta range: reject it; etagen = " << etagen;
243 if (!pfMuonFound)
continue;
248 LogTrace(
"") <<
"\tshiftOnOneOverPt= " << shift1*100 <<
" [%]";
249 LogTrace(
"") <<
"\trelativeShiftOnPt= " << shift2*100 <<
" [%]";
254 LogTrace(
"") <<
"\tuncertaintyOnOneOverPt= " << sigma1 <<
" [1/GeV]";
255 LogTrace(
"") <<
"\trelativeUncertaintyOnPt= " << sigma2*100 <<
" [%]";
259 LogTrace(
"") <<
"\tefficiencyRatioOverMC= " << effRatio;
262 double rndf = CLHEP::RandFlat::shoot();
263 if (rndf>effRatio)
continue;
266 double rndg1 = CLHEP::RandGauss::shoot();
267 double rndg2 = CLHEP::RandGauss::shoot();
272 ptmu += ptgen * ( shift1*ptgen + shift2 + sigma1*rndg1*ptgen + sigma2*rndg2);
273 pfMuonFound =
false ;
284 newmuons->push_back(*newmu);
T getUntrackedParameter(std::string const &, T const &) const
std::vector< double > relativeUncertaintyOnPt_
#define DEFINE_FWK_MODULE(type)
virtual PFCandidate * clone() const
return a clone
bool isTrackerMuon() const
virtual TrackRef track() const
reference to a Track
bool isGlobalMuon() const
virtual void setP4(const LorentzVector &p4)
set 4-momentum
bool isStandAloneMuon() const
virtual double eta() const
momentum pseudorapidity
bool isNonnull() const
Checks for non-null.
virtual double mass() const
mass
bool isNull() const
Checks for null.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< double > uncertaintyOnOneOverPt_
virtual void produce(edm::Event &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
reco::MuonRef muonRef() const
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
virtual double pt() const
transverse momentum
std::vector< double > efficiencyRatioOverMC_
key_type key() const
Accessor for product key.
edm::InputTag genMatchMapTag_
Particle reconstructed by the particle flow algorithm.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
virtual ParticleType particleId() const
std::vector< double > relativeShiftOnPt_
~DistortedPFCandProducer()
std::vector< double > shiftOnOneOverPt_
virtual double phi() const
momentum azimuthal angle
std::vector< double > etaBinEdges_
DistortedPFCandProducer(const edm::ParameterSet &)