CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef std::vector< JetJetCollection
 

Private Member Functions

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

Private Attributes

edm::Service< TFileServicefs
 
TH1F * mCorPt
 
bool mDebug
 
std::string mJetCorService
 
std::string mJetName
 
double mMinRawJetPt
 
TH1F * mRawPt
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, 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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<class Jet>
class JetCorrectorOnTheFly< Jet >

Definition at line 29 of file JetCorrectorOnTheFly.cc.

Member Typedef Documentation

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

Definition at line 35 of file JetCorrectorOnTheFly.cc.

Constructor & Destructor Documentation

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

Definition at line 52 of file JetCorrectorOnTheFly.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

53 {
54  mJetCorService = iConfig.getParameter<std::string> ("JetCorrectionService");
55  mJetName = iConfig.getParameter<std::string> ("JetCollectionName");
56  mMinRawJetPt = iConfig.getParameter<double> ("MinRawJetPt");
57  mDebug = iConfig.getParameter<bool> ("Debug");
58 }
T getParameter(std::string const &) const
template<class Jet >
JetCorrectorOnTheFly< Jet >::~JetCorrectorOnTheFly ( )

Definition at line 61 of file JetCorrectorOnTheFly.cc.

62 {
63 
64 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 67 of file JetCorrectorOnTheFly.cc.

References JetCorrector::correction(), gather_cfg::cout, edm::Event::getByLabel(), JetCorrector::getJetCorrector(), fwrapper::jets, and pileupReCalc_HLTpaths::scale.

68 {
71  iEvent.getByLabel(mJetName,jets);
72 
74  iEvent.getByLabel("offlinePrimaryVertices",recVtxs);
75  int NPV(0);
76  for(unsigned int ind=0;ind<recVtxs->size();ind++) {
77  if (!((*recVtxs)[ind].isFake())) {
78  NPV++;
79  }
80  }
81  typename JetCollection::const_iterator i_jet;
83  for(i_jet = jets->begin(); i_jet != jets->end(); i_jet++) {
84  if (i_jet->pt() < mMinRawJetPt) continue;
85  //double scale = corrector->correction(i_jet->p4());
86  double scale = corrector->correction(*i_jet,iEvent,iSetup);
87  if (mDebug) {
88  std::cout<<"energy = "<<i_jet->energy()<<", "
89  <<"eta = "<<i_jet->eta()<<", "
90  <<"raw pt = "<<i_jet->pt()<<", "
91  <<"NPV = "<<NPV<<", "
92  <<"correction = "<<scale<<", "
93  <<"cor pt = "<<scale*i_jet->pt()<<endl;
94  }
95  mRawPt->Fill(i_jet->pt());
96  mCorPt->Fill(scale*i_jet->pt());
97  }
98 
99 
100 }
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
vector< PseudoJet > jets
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
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:50
tuple cout
Definition: gather_cfg.py:121
template<class Jet >
void JetCorrectorOnTheFly< Jet >::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 103 of file JetCorrectorOnTheFly.cc.

104 {
105  mRawPt = fs->make<TH1F>("RawJetPt","RawJetPt",1000,0,1000);
106  mCorPt = fs->make<TH1F>("CorJetPt","CorJetPt",1000,0,1000);
107 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::Service< TFileService > fs
template<class Jet >
void JetCorrectorOnTheFly< Jet >::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 110 of file JetCorrectorOnTheFly.cc.

111 {
112 
113 }

Member Data Documentation

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

Definition at line 40 of file JetCorrectorOnTheFly.cc.

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

Definition at line 45 of file JetCorrectorOnTheFly.cc.

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

Definition at line 44 of file JetCorrectorOnTheFly.cc.

template<class Jet >
std::string JetCorrectorOnTheFly< Jet >::mJetCorService
private

Definition at line 41 of file JetCorrectorOnTheFly.cc.

template<class Jet >
std::string JetCorrectorOnTheFly< Jet >::mJetName
private

Definition at line 42 of file JetCorrectorOnTheFly.cc.

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

Definition at line 43 of file JetCorrectorOnTheFly.cc.

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

Definition at line 45 of file JetCorrectorOnTheFly.cc.