CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PartonJetCorrectionExample Class Reference
Inheritance diagram for PartonJetCorrectionExample:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 PartonJetCorrectionExample (const edm::ParameterSet &fParameters)
 
 ~PartonJetCorrectionExample () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::string m_bJ_CorrectorName
 
std::string m_bT_CorrectorName
 
std::string m_gJ_CorrectorName
 
std::string m_qJ_CorrectorName
 
edm::InputTag mInput
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 11 of file PartonJetCorrectionExample.cc.

Constructor & Destructor Documentation

◆ PartonJetCorrectionExample()

PartonJetCorrectionExample::PartonJetCorrectionExample ( const edm::ParameterSet fParameters)
explicit

Definition at line 35 of file PartonJetCorrectionExample.cc.

36  : mInput(fConfig.getParameter<edm::InputTag>("src")),
37  m_gJ_CorrectorName(fConfig.getParameter<std::string>("gJetCorrector")),
38  m_qJ_CorrectorName(fConfig.getParameter<std::string>("qJetCorrector")),
39  m_bJ_CorrectorName(fConfig.getParameter<std::string>("bJetCorrector")),
40  m_bT_CorrectorName(fConfig.getParameter<std::string>("bTopCorrector")) {}

◆ ~PartonJetCorrectionExample()

PartonJetCorrectionExample::~PartonJetCorrectionExample ( )
inlineoverride

Definition at line 14 of file PartonJetCorrectionExample.cc.

14 {}

Member Function Documentation

◆ analyze()

void PartonJetCorrectionExample::analyze ( const edm::Event fEvent,
const edm::EventSetup fSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 42 of file PartonJetCorrectionExample.cc.

42  {
43  // get all correctors
44  const JetCorrector* gJetCorrector = JetCorrector::getJetCorrector(m_gJ_CorrectorName, fSetup);
45  const JetCorrector* qJetCorrector = JetCorrector::getJetCorrector(m_qJ_CorrectorName, fSetup);
46  const JetCorrector* bJetCorrector = JetCorrector::getJetCorrector(m_bJ_CorrectorName, fSetup);
47  const JetCorrector* bTopCorrector = JetCorrector::getJetCorrector(m_bT_CorrectorName, fSetup);
48  const JetCorrector* corrector = nullptr;
49 
50  // get input jets (supposed to be MC corrected already)
52  fEvent.getByLabel(mInput, jets);
53  // loop over jets
54  for (unsigned ijet = 0; ijet < jets->size(); ++ijet) {
55  const CaloJet& jet = (*jets)[ijet];
56  std::cout << "PartonJetCorrectionExample::analize-> jet #" << ijet;
57  if (ijet % 4 == 0) { // assume it is gluon from diJet
58  std::cout << ": use gJ corrections" << std::endl;
59  corrector = gJetCorrector;
60  } else if (ijet % 4 == 1) { // assume it is light quark from diJet
61  std::cout << ": use qJ corrections" << std::endl;
62  corrector = qJetCorrector;
63  } else if (ijet % 4 == 2) { // assume it is b quark from diJet
64  std::cout << ": use bJ corrections" << std::endl;
65  corrector = bJetCorrector;
66  } else { // assume it is b quark from ttbar
67  std::cout << ": use bT corrections" << std::endl;
68  corrector = bTopCorrector;
69  }
70  // get selected correction for the jet
71  double correction = corrector->correction(jet);
72  // dump it
73  std::cout << " jet pt/eta/phi: " << jet.pt() << '/' << jet.eta() << '/' << jet.phi()
74  << " -> correction factor: " << correction << ", corrected pt: " << jet.pt() * correction << std::endl;
75  }
76 }

References pfMETCorrectionType0_cfi::correction, pfClustersFromHGC3DClusters_cfi::corrector, gather_cfg::cout, hcaldqm::fEvent, JetCorrector::getJetCorrector(), metsig::jet, singleTopDQM_cfi::jets, m_bJ_CorrectorName, m_bT_CorrectorName, m_gJ_CorrectorName, m_qJ_CorrectorName, and mInput.

Member Data Documentation

◆ m_bJ_CorrectorName

std::string PartonJetCorrectionExample::m_bJ_CorrectorName
private

Definition at line 21 of file PartonJetCorrectionExample.cc.

Referenced by analyze().

◆ m_bT_CorrectorName

std::string PartonJetCorrectionExample::m_bT_CorrectorName
private

Definition at line 22 of file PartonJetCorrectionExample.cc.

Referenced by analyze().

◆ m_gJ_CorrectorName

std::string PartonJetCorrectionExample::m_gJ_CorrectorName
private

Definition at line 19 of file PartonJetCorrectionExample.cc.

Referenced by analyze().

◆ m_qJ_CorrectorName

std::string PartonJetCorrectionExample::m_qJ_CorrectorName
private

Definition at line 20 of file PartonJetCorrectionExample.cc.

Referenced by analyze().

◆ mInput

edm::InputTag PartonJetCorrectionExample::mInput
private

Definition at line 18 of file PartonJetCorrectionExample.cc.

Referenced by analyze().

reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
gather_cfg.cout
cout
Definition: gather_cfg.py:144
reco::JetCorrector
Definition: JetCorrector.h:33
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
pfClustersFromHGC3DClusters_cfi.corrector
corrector
Definition: pfClustersFromHGC3DClusters_cfi.py:5
PartonJetCorrectionExample::m_qJ_CorrectorName
std::string m_qJ_CorrectorName
Definition: PartonJetCorrectionExample.cc:20
PartonJetCorrectionExample::m_bJ_CorrectorName
std::string m_bJ_CorrectorName
Definition: PartonJetCorrectionExample.cc:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pfMETCorrectionType0_cfi.correction
correction
Definition: pfMETCorrectionType0_cfi.py:39
JetCorrector::getJetCorrector
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing
Definition: JetCorrector.cc:48
hcaldqm::fEvent
Definition: DQTask.h:32
metsig::jet
Definition: SignAlgoResolutions.h:47
PartonJetCorrectionExample::m_bT_CorrectorName
std::string m_bT_CorrectorName
Definition: PartonJetCorrectionExample.cc:22
PartonJetCorrectionExample::mInput
edm::InputTag mInput
Definition: PartonJetCorrectionExample.cc:18
PartonJetCorrectionExample::m_gJ_CorrectorName
std::string m_gJ_CorrectorName
Definition: PartonJetCorrectionExample.cc:19
edm::InputTag
Definition: InputTag.h:15