24 virtual void endJob()
override ;
41 #include <CLHEP/Random/RandGauss.h>
54 produces<std::vector<reco::Muon> >();
74 LogTrace(
"") <<
">>> Using database for momentum scale corrections !!";
84 LogTrace(
"") <<
">>> Using database for momentum resolution corrections !!";
99 edm::LogError(
"") <<
">>> Muon collection does not exist !!!";
102 unsigned int muonCollectionSize = muonCollection->size();
106 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
110 double shift = (*momCorrector_)(*mu) - mu->
pt();
111 LogTrace(
"") <<
"\tmomentumScaleShift= " << shift <<
" [GeV]";
116 if (sigma>0.) sigma =
sqrt(sigma);
else sigma = 0.;
117 LogTrace(
"") <<
"\tPt additional smearing= " << sigma <<
" [GeV]";
120 double rndg = CLHEP::RandGauss::shoot();
123 double ptmu = mu->
pt();
124 ptmu += shift + sigma*rndg;
131 newmuons->push_back(*newmu);
virtual void produce(edm::Event &, const edm::EventSetup &) override
T getUntrackedParameter(std::string const &, T const &) const
std::auto_ptr< MomentumScaleCorrector > momCorrector_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::auto_ptr< ResolutionFunction > momResolutionData_
virtual double phi() const final
momentum azimuthal angle
std::string dbMCResolutionLabel_
virtual void endJob() override
std::vector< Muon > MuonCollection
collection of Muon objects
std::string dbScaleLabel_
std::string dbDataResolutionLabel_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
~DistortedMuonProducerFromDB()
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
virtual double mass() const final
mass
T const * product() const
virtual void setP4(const LorentzVector &p4) final
set 4-momentum
std::auto_ptr< ResolutionFunction > momResolutionMC_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
static unsigned int const shift
DistortedMuonProducerFromDB(const edm::ParameterSet &)
virtual double eta() const final
momentum pseudorapidity
Muon * clone() const
create a clone
Power< A, B >::type pow(const A &a, const B &b)
virtual double pt() const final
transverse momentum
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_