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_
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
std::auto_ptr< ResolutionFunction > momResolutionData_
std::string dbMCResolutionLabel_
virtual void setP4(const LorentzVector &p4)
set 4-momentum
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.
virtual float eta() const
momentum pseudorapidity
~DistortedMuonProducerFromDB()
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
Muon * clone() const
create a clone
T const * product() const
std::auto_ptr< ResolutionFunction > momResolutionMC_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
static unsigned int const shift
virtual float mass() const
mass
DistortedMuonProducerFromDB(const edm::ParameterSet &)
Power< A, B >::type pow(const A &a, const B &b)
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_