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 Member Functions | Private Attributes
TauJetCorrectorExample Class Reference

#include <MyTauAndHLTAnalyzer/TauJetCorrectorExample/src/TauJetCorrectorExample.cc>

Inheritance diagram for TauJetCorrectorExample:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TauJetCorrectorExample (const edm::ParameterSet &)
 
 ~TauJetCorrectorExample ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

std::string jetname
 
int nEvt
 
int njets
 
JetCorrectortaucorrector
 
std::string tauCorrectorname
 
edm::EDGetTokenT
< reco::IsolatedTauTagInfoCollection
tautoken
 

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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 61 of file TauJetCorrectorExample.cc.

Constructor & Destructor Documentation

TauJetCorrectorExample::TauJetCorrectorExample ( const edm::ParameterSet iConfig)
explicit

Definition at line 102 of file TauJetCorrectorExample.cc.

102  :
103 #ifdef THIS_IS_AN_EVENT_EXAMPLE
104  exampletoken(consumes<ExampleData>(edm::InputTag("example"))),
105 #endif
106  jetname(iConfig.getUntrackedParameter<std::string>("JetHandle","iterativeCone5CaloJets")),
107  tautoken(consumes<reco::IsolatedTauTagInfoCollection>(edm::InputTag(iConfig.getUntrackedParameter<std::string>("TauHandle","coneIsolation")))),
108  tauCorrectorname(iConfig.getUntrackedParameter<std::string>("tauCorrHandle", "TauJetCorrectorIcone5")),
109  nEvt(0), njets(0), taucorrector(0)
110 {
111  //now do what ever initialization is needed
112 
113 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::IsolatedTauTagInfoCollection > tautoken
TauJetCorrectorExample::~TauJetCorrectorExample ( )

Definition at line 116 of file TauJetCorrectorExample.cc.

117 {
118 
119  // do anything here that needs to be done at desctruction time
120  // (e.g. close files, deallocate resources etc.)
121 
122 }

Member Function Documentation

void TauJetCorrectorExample::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 131 of file TauJetCorrectorExample.cc.

References JetCorrector::correction(), gather_cfg::cout, edm::EventSetup::get(), edm::Event::getByToken(), JetCorrector::getJetCorrector(), nEvt, njets, RecoTauCleanerPlugins::pt, pileupReCalc_HLTpaths::scale, metsig::tau, taucorrector, tauCorrectorname, and tautoken.

132 {
134 
135  using namespace edm;
136 
137 #ifdef THIS_IS_AN_EVENT_EXAMPLE
139  iEvent.getByToken(exampletoken,pIn);
140 #endif
141 
142 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
143  ESHandle<SetupData> pSetup;
144  iSetup.get<SetupRecord>().get(pSetup);
145 #endif
146  using namespace edm;
147 
148  // this analyzer produces a small root file with basic candidates and some MC information
149  // some additional print statements
150  ++nEvt;
151  if((nEvt%10==0 && nEvt<=100)||(nEvt%100==0 && nEvt>100))
152  std::cout << "reading event " << nEvt << std::endl;
153 
154  // get taus
156  iEvent.getByToken(tautoken,tauTagInfoHandle);
157  reco::IsolatedTauTagInfoCollection::const_iterator tau=tauTagInfoHandle->begin();
158 
159  //get tau jet corrector
160  //const JetCorrector* taucorrector = JetCorrector::getJetCorrector(tauCorrectorname, iSetup);
161 
162  // std::cout << "setting everything to 0 just before tau loop" << std::endl;
163  njets=0;
164 
165  std::cout << "starting tau loop" << std::endl;
166  for(tau=tauTagInfoHandle->begin();tau!=tauTagInfoHandle->end() && njets<10;++tau) {
167 
168  //Should check tau discriminator, but not done here
169 
170  double pt = tau->jet().get()->et();
171 
172  //correction returns correction factor which must then be applied to original ET
173  double scale = taucorrector->correction(tau->jet().get()->p4());
174  double ptcorr = tau->jet().get()->et() * scale;
175 
176  std::cout << "Tau jet: Original Et = " << pt << " Corrected Et = " << ptcorr << std::endl;
177 
178  ++njets;
179  }
180 
181 
182 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
edm::EDGetTokenT< reco::IsolatedTauTagInfoCollection > tautoken
const T & get() const
Definition: EventSetup.h:55
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
void TauJetCorrectorExample::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 189 of file TauJetCorrectorExample.cc.

190 {
191 
192 // taucorrector = const_cast<JetCorrector*>(JetCorrector::getJetCorrector(tauCorrectorname, iSetup));
193 
194 }
void TauJetCorrectorExample::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 198 of file TauJetCorrectorExample.cc.

198  {
199 }

Member Data Documentation

std::string TauJetCorrectorExample::jetname
private

Definition at line 76 of file TauJetCorrectorExample.cc.

int TauJetCorrectorExample::nEvt
private

Definition at line 80 of file TauJetCorrectorExample.cc.

Referenced by analyze().

int TauJetCorrectorExample::njets
private

Definition at line 81 of file TauJetCorrectorExample.cc.

Referenced by analyze().

JetCorrector* TauJetCorrectorExample::taucorrector
private

Definition at line 83 of file TauJetCorrectorExample.cc.

Referenced by analyze().

std::string TauJetCorrectorExample::tauCorrectorname
private

Definition at line 78 of file TauJetCorrectorExample.cc.

Referenced by analyze().

edm::EDGetTokenT<reco::IsolatedTauTagInfoCollection> TauJetCorrectorExample::tautoken
private

Definition at line 77 of file TauJetCorrectorExample.cc.

Referenced by analyze().