CMS 3D CMS Logo

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

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 FlavorJetCorrectionExample (const edm::ParameterSet &fParameters)
 
 ~FlavorJetCorrectionExample () 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
 
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 mBCorrectorName
 
std::string mCCorrectorName
 
edm::InputTag mInput
 
std::string mUDSCorrectorName
 

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 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>
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 FlavorJetCorrectionExample.cc.

Constructor & Destructor Documentation

◆ FlavorJetCorrectionExample()

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

Definition at line 34 of file FlavorJetCorrectionExample.cc.

35  : mInput(fConfig.getParameter<edm::InputTag>("src")),
36  mUDSCorrectorName(fConfig.getParameter<std::string>("UDSQuarksCorrector")),
37  mCCorrectorName(fConfig.getParameter<std::string>("CQuarkCorrector")),
38  mBCorrectorName(fConfig.getParameter<std::string>("BQuarkCorrector")) {}

◆ ~FlavorJetCorrectionExample()

FlavorJetCorrectionExample::~FlavorJetCorrectionExample ( )
inlineoverride

Definition at line 14 of file FlavorJetCorrectionExample.cc.

14 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 40 of file FlavorJetCorrectionExample.cc.

40  {
41  // get all correctors
42  const JetCorrector* udsJetCorrector = JetCorrector::getJetCorrector(mUDSCorrectorName, fSetup);
43  const JetCorrector* cQuarkJetCorrector = JetCorrector::getJetCorrector(mCCorrectorName, fSetup);
44  const JetCorrector* bQuarkJetCorrector = JetCorrector::getJetCorrector(mBCorrectorName, fSetup);
45  const JetCorrector* corrector = nullptr;
46 
47  // get input jets (supposed to be MC corrected already)
49  fEvent.getByLabel(mInput, jets);
50  // loop over jets
51  for (unsigned ijet = 0; ijet < jets->size(); ++ijet) {
52  const CaloJet& jet = (*jets)[ijet];
53  std::cout << "FlavorJetCorrectionExample::analize-> jet #" << ijet;
54  if (ijet % 3 == 0) { // assume it is light quark
55  std::cout << ": use USD quark corrections" << std::endl;
56  corrector = udsJetCorrector;
57  } else if (ijet % 3 == 1) { // assume it is c quark
58  std::cout << ": use c quark corrections" << std::endl;
59  corrector = cQuarkJetCorrector;
60  } else { // assume it is b quark
61  std::cout << ": use b quark corrections" << std::endl;
62  corrector = bQuarkJetCorrector;
63  }
64  // get selected correction for the jet
65  double correction = corrector->correction(jet);
66  // dump it
67  std::cout << " jet pt/eta/phi: " << jet.pt() << '/' << jet.eta() << '/' << jet.phi()
68  << " -> correction factor: " << correction << ", corrected pt: " << jet.pt() * correction << std::endl;
69  }
70 }

References pfMETCorrectionType0_cfi::correction, pfClustersFromHGC3DClusters_cfi::corrector, gather_cfg::cout, hcaldqm::fEvent, JetCorrector::getJetCorrector(), metsig::jet, singleTopDQM_cfi::jets, mBCorrectorName, mCCorrectorName, mInput, and mUDSCorrectorName.

Member Data Documentation

◆ mBCorrectorName

std::string FlavorJetCorrectionExample::mBCorrectorName
private

Definition at line 21 of file FlavorJetCorrectionExample.cc.

Referenced by analyze().

◆ mCCorrectorName

std::string FlavorJetCorrectionExample::mCCorrectorName
private

Definition at line 20 of file FlavorJetCorrectionExample.cc.

Referenced by analyze().

◆ mInput

edm::InputTag FlavorJetCorrectionExample::mInput
private

Definition at line 18 of file FlavorJetCorrectionExample.cc.

Referenced by analyze().

◆ mUDSCorrectorName

std::string FlavorJetCorrectionExample::mUDSCorrectorName
private

Definition at line 19 of file FlavorJetCorrectionExample.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:35
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
pfClustersFromHGC3DClusters_cfi.corrector
corrector
Definition: pfClustersFromHGC3DClusters_cfi.py:4
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pfMETCorrectionType0_cfi.correction
correction
Definition: pfMETCorrectionType0_cfi.py:39
FlavorJetCorrectionExample::mUDSCorrectorName
std::string mUDSCorrectorName
Definition: FlavorJetCorrectionExample.cc:19
FlavorJetCorrectionExample::mCCorrectorName
std::string mCCorrectorName
Definition: FlavorJetCorrectionExample.cc:20
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
FlavorJetCorrectionExample::mInput
edm::InputTag mInput
Definition: FlavorJetCorrectionExample.cc:18
metsig::jet
Definition: SignAlgoResolutions.h:47
edm::InputTag
Definition: InputTag.h:15
FlavorJetCorrectionExample::mBCorrectorName
std::string mBCorrectorName
Definition: FlavorJetCorrectionExample.cc:21