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