CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
JetCorrectorOnTheFly< Jet > Class Template Reference
Inheritance diagram for JetCorrectorOnTheFly< Jet >:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 JetCorrectorOnTheFly (const edm::ParameterSet &)
 
 ~JetCorrectorOnTheFly () 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 Types

typedef std::vector< JetJetCollection
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

edm::Service< TFileServicefs
 
TH1F * mCorPt
 
bool mDebug
 
edm::EDGetTokenT< reco::JetCorrectormJetCorrector
 
edm::EDGetTokenT< JetCollectionmJetToken
 
double mMinRawJetPt
 
TH1F * mRawPt
 
edm::EDGetTokenT< reco::VertexCollectionmVertexToken
 

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

template<class Jet>
class JetCorrectorOnTheFly< Jet >

Definition at line 28 of file JetCorrectorOnTheFly.cc.

Member Typedef Documentation

◆ JetCollection

template<class Jet >
typedef std::vector<Jet> JetCorrectorOnTheFly< Jet >::JetCollection
private

Definition at line 34 of file JetCorrectorOnTheFly.cc.

Constructor & Destructor Documentation

◆ JetCorrectorOnTheFly()

template<class Jet >
JetCorrectorOnTheFly< Jet >::JetCorrectorOnTheFly ( const edm::ParameterSet iConfig)
explicit

Definition at line 52 of file JetCorrectorOnTheFly.cc.

52  {
53  mJetCorrector = consumes<reco::JetCorrector>(iConfig.getParameter<edm::InputTag>("JetCorrector"));
54  mJetToken = consumes<JetCollection>(edm::InputTag(iConfig.getParameter<edm::InputTag>("JetCollectionName")));
55  mVertexToken = consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVertices"));
56  mMinRawJetPt = iConfig.getParameter<double>("MinRawJetPt");
57  mDebug = iConfig.getParameter<bool>("Debug");
58 }

References edm::ParameterSet::getParameter().

◆ ~JetCorrectorOnTheFly()

template<class Jet >
JetCorrectorOnTheFly< Jet >::~JetCorrectorOnTheFly ( )
override

Definition at line 61 of file JetCorrectorOnTheFly.cc.

61 {}

Member Function Documentation

◆ analyze()

template<class Jet >
void JetCorrectorOnTheFly< Jet >::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 64 of file JetCorrectorOnTheFly.cc.

64  {
66  iEvent.getByToken(mJetCorrector, corrector);
68  iEvent.getByToken(mJetToken, jets);
69 
71  iEvent.getByToken(mVertexToken, recVtxs);
72  int NPV(0);
73  for (unsigned int ind = 0; ind < recVtxs->size(); ind++) {
74  if (!((*recVtxs)[ind].isFake())) {
75  NPV++;
76  }
77  }
78  typename JetCollection::const_iterator i_jet;
80  for (i_jet = jets->begin(); i_jet != jets->end(); i_jet++) {
81  if (i_jet->pt() < mMinRawJetPt)
82  continue;
83  //double scale = corrector->correction(i_jet->p4());
84  double scale = corrector->correction(*i_jet);
85  if (mDebug) {
86  std::cout << "energy = " << i_jet->energy() << ", "
87  << "eta = " << i_jet->eta() << ", "
88  << "raw pt = " << i_jet->pt() << ", "
89  << "NPV = " << NPV << ", "
90  << "correction = " << scale << ", "
91  << "cor pt = " << scale * i_jet->pt() << endl;
92  }
93  mRawPt->Fill(i_jet->pt());
94  mCorPt->Fill(scale * i_jet->pt());
95  }
96 }

References pfClustersFromHGC3DClusters_cfi::corrector, gather_cfg::cout, iEvent, singleTopDQM_cfi::jets, and Scenarios_cff::scale.

◆ beginJob()

template<class Jet >
void JetCorrectorOnTheFly< Jet >::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 99 of file JetCorrectorOnTheFly.cc.

99  {
100  mRawPt = fs->make<TH1F>("RawJetPt", "RawJetPt", 1000, 0, 1000);
101  mCorPt = fs->make<TH1F>("CorJetPt", "CorJetPt", 1000, 0, 1000);
102 }

◆ endJob()

template<class Jet >
void JetCorrectorOnTheFly< Jet >::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 105 of file JetCorrectorOnTheFly.cc.

105 {}

Member Data Documentation

◆ fs

template<class Jet >
edm::Service<TFileService> JetCorrectorOnTheFly< Jet >::fs
private

Definition at line 39 of file JetCorrectorOnTheFly.cc.

◆ mCorPt

template<class Jet >
TH1F * JetCorrectorOnTheFly< Jet >::mCorPt
private

Definition at line 45 of file JetCorrectorOnTheFly.cc.

◆ mDebug

template<class Jet >
bool JetCorrectorOnTheFly< Jet >::mDebug
private

Definition at line 44 of file JetCorrectorOnTheFly.cc.

◆ mJetCorrector

template<class Jet >
edm::EDGetTokenT<reco::JetCorrector> JetCorrectorOnTheFly< Jet >::mJetCorrector
private

Definition at line 40 of file JetCorrectorOnTheFly.cc.

◆ mJetToken

template<class Jet >
edm::EDGetTokenT<JetCollection> JetCorrectorOnTheFly< Jet >::mJetToken
private

Definition at line 41 of file JetCorrectorOnTheFly.cc.

◆ mMinRawJetPt

template<class Jet >
double JetCorrectorOnTheFly< Jet >::mMinRawJetPt
private

Definition at line 43 of file JetCorrectorOnTheFly.cc.

◆ mRawPt

template<class Jet >
TH1F* JetCorrectorOnTheFly< Jet >::mRawPt
private

Definition at line 45 of file JetCorrectorOnTheFly.cc.

◆ mVertexToken

template<class Jet >
edm::EDGetTokenT<reco::VertexCollection> JetCorrectorOnTheFly< Jet >::mVertexToken
private

Definition at line 42 of file JetCorrectorOnTheFly.cc.

JetCorrectorOnTheFly::mCorPt
TH1F * mCorPt
Definition: JetCorrectorOnTheFly.cc:45
JetCorrectorOnTheFly::mVertexToken
edm::EDGetTokenT< reco::VertexCollection > mVertexToken
Definition: JetCorrectorOnTheFly.cc:42
JetCorrectorOnTheFly::fs
edm::Service< TFileService > fs
Definition: JetCorrectorOnTheFly.cc:39
gather_cfg.cout
cout
Definition: gather_cfg.py:144
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle< reco::JetCorrector >
JetCorrectorOnTheFly::mJetToken
edm::EDGetTokenT< JetCollection > mJetToken
Definition: JetCorrectorOnTheFly.cc:41
pfClustersFromHGC3DClusters_cfi.corrector
corrector
Definition: pfClustersFromHGC3DClusters_cfi.py:4
pvSelector_cfi.NPV
NPV
Definition: pvSelector_cfi.py:5
JetCorrectorOnTheFly::mJetCorrector
edm::EDGetTokenT< reco::JetCorrector > mJetCorrector
Definition: JetCorrectorOnTheFly.cc:40
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
JetCorrectorOnTheFly::mRawPt
TH1F * mRawPt
Definition: JetCorrectorOnTheFly.cc:45
iEvent
int iEvent
Definition: GenABIO.cc:224
JetCorrectorOnTheFly::mDebug
bool mDebug
Definition: JetCorrectorOnTheFly.cc:44
JetCorrectorOnTheFly::mMinRawJetPt
double mMinRawJetPt
Definition: JetCorrectorOnTheFly.cc:43
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64