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);
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
#define DEFINE_FWK_MODULE(type)
std::string dbMCResolutionLabel_
double pt() const final
transverse momentum
std::vector< Muon > MuonCollection
collection of Muon objects
std::string dbScaleLabel_
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_