template<typename T>
class SmearedJetProducerT< T >
Produce collection of "smeared" jets.
The aim of this correction is to account for the difference in jet energy resolution between Monte Carlo simulation and Data.
- Author
- Sébastien Brochet
Definition at line 97 of file SmearedJetProducerT.h.
Definition at line 175 of file SmearedJetProducerT.h.
References gather_cfg::cout, ztail::d, reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), JME::JetResolution::get(), JME::JetResolutionScaleFactor::get(), JME::JetResolution::getResolution(), JME::JetResolutionScaleFactor::getScaleFactor(), edm::EventBase::isRealData(), metsig::jet, JME::JetEta, JME::JetPt, singleTopDQM_cfi::jets, eostools::move(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), L1TObjectsTimingClient_cff::resolution, JME::Rho, SurveyInfoScenario_cff::seed, and mathSSE::sqrt().
204 unsigned int runNum_uint =
static_cast<unsigned int>(
event.id().run());
205 unsigned int lumiNum_uint =
static_cast<unsigned int>(
event.id().luminosityBlock());
206 unsigned int evNum_uint =
static_cast<unsigned int>(
event.id().event());
207 unsigned int jet0eta = uint32_t(jets.empty() ? 0 : jets[0].eta() / 0.01);
208 std::uint32_t
seed = jet0eta +
m_nomVar + (lumiNum_uint << 10) + (runNum_uint << 20) + evNum_uint;
216 auto smearedJets = std::make_unique<JetCollection>();
218 for (
const auto&
jet : jets) {
221 smearedJets->push_back(
jet);
232 std::cout <<
"jet: pt: " <<
jet.pt() <<
" eta: " <<
jet.eta() <<
" phi: " <<
jet.phi()
233 <<
" e: " <<
jet.energy() << std::endl;
234 std::cout <<
"resolution: " << jet_resolution << std::endl;
235 std::cout <<
"resolution scale factor: " << jer_sf << std::endl;
242 double smearFactor = 1.;
250 std::cout <<
"gen jet: pt: " << genJet->
pt() <<
" eta: " << genJet->
eta() <<
" phi: " << genJet->
phi()
251 <<
" e: " << genJet->
energy() << std::endl;
254 double dPt =
jet.pt() - genJet->
pt();
255 smearFactor = 1 +
m_nomVar * (jer_sf - 1.) * dPt /
jet.pt();
257 }
else if (jer_sf > 1) {
262 double sigma = jet_resolution *
std::sqrt(jer_sf * jer_sf - 1);
264 std::cout <<
"gaussian width: " << sigma << std::endl;
267 std::normal_distribution<>
d(0, sigma);
270 std::cout <<
"Impossible to smear this jet" << std::endl;
279 std::cout <<
"The smearing factor (" << smearFactor <<
") is either negative or too small. Fixing it to " 280 << newSmearFactor <<
" to avoid change of direction." << std::endl;
282 smearFactor = newSmearFactor;
286 smearedJet.scaleEnergy(smearFactor);
289 std::cout <<
"smeared jet (" << smearFactor <<
"): pt: " << smearedJet.pt() <<
" eta: " << smearedJet.eta()
290 <<
" phi: " << smearedJet.phi() <<
" e: " << smearedJet.energy() << std::endl;
293 smearedJets->push_back(smearedJet);
edm::EDGetTokenT< JetCollection > m_jets_token
float getResolution(const JetParameters ¶meters) const
double eta() const final
momentum pseudorapidity
static const JetResolution get(const edm::EventSetup &, const std::string &)
double pt() const final
transverse momentum
GreaterByPt< T > jetPtComparator
std::unique_ptr< JME::JetResolution > m_resolution_from_file
std::vector< T > JetCollection
std::string m_jets_algo_pt
bool m_useDeterministicSeed
double energy() const final
energy
Jets made from MC generator particles.
edm::EDGetTokenT< double > m_rho_token
static const double MIN_JET_ENERGY
std::mt19937 m_random_generator
float getScaleFactor(const JetParameters ¶meters, Variation variation=Variation::NOMINAL) const
Variation m_systematic_variation
static const JetResolutionScaleFactor get(const edm::EventSetup &, const std::string &)
std::shared_ptr< pat::GenJetMatcher > m_genJetMatcher
std::unique_ptr< JME::JetResolutionScaleFactor > m_scale_factor_from_file
double phi() const final
momentum azimuthal angle