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_
std::string dbMCResolutionLabel_
virtual void endJob() override
std::vector< Muon > MuonCollection
collection of Muon objects
std::string dbScaleLabel_
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
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 float eta() const GCC11_FINAL
momentum pseudorapidity
Muon * clone() const
create a clone
virtual float mass() const GCC11_FINAL
mass
T const * product() const
std::auto_ptr< ResolutionFunction > momResolutionMC_
virtual void setP4(const LorentzVector &p4) GCC11_FINAL
set 4-momentum
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
static unsigned int const shift
DistortedMuonProducerFromDB(const edm::ParameterSet &)
virtual float pt() const GCC11_FINAL
transverse momentum
Power< A, B >::type pow(const A &a, const B &b)
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_