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

Public Member Functions

 TauJetCorrectorExample (const edm::ParameterSet &)
 
 ~TauJetCorrectorExample ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

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

Private Attributes

std::string jetname
 
int nEvt
 
int njets
 
JetCorrectortaucorrector
 
std::string tauCorrectorname
 
std::string tauname
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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 99 of file TauJetCorrectorExample.cc.

99  :
100  jetname(iConfig.getUntrackedParameter<std::string>("JetHandle","iterativeCone5CaloJets")),
101  tauname(iConfig.getUntrackedParameter<std::string>("TauHandle","coneIsolation")),
102  tauCorrectorname(iConfig.getUntrackedParameter<std::string>("tauCorrHandle", "TauJetCorrectorIcone5")),
103  nEvt(0), njets(0), taucorrector(0)
104 {
105  //now do what ever initialization is needed
106 
107 }
T getUntrackedParameter(std::string const &, T const &) const
TauJetCorrectorExample::~TauJetCorrectorExample ( )

Definition at line 110 of file TauJetCorrectorExample.cc.

111 {
112 
113  // do anything here that needs to be done at desctruction time
114  // (e.g. close files, deallocate resources etc.)
115 
116 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 125 of file TauJetCorrectorExample.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 183 of file TauJetCorrectorExample.cc.

184 {
185 
186 // taucorrector = const_cast<JetCorrector*>(JetCorrector::getJetCorrector(tauCorrectorname, iSetup));
187 
188 }
void TauJetCorrectorExample::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 192 of file TauJetCorrectorExample.cc.

192  {
193 }

Member Data Documentation

std::string TauJetCorrectorExample::jetname
private

Definition at line 73 of file TauJetCorrectorExample.cc.

int TauJetCorrectorExample::nEvt
private

Definition at line 77 of file TauJetCorrectorExample.cc.

Referenced by analyze().

int TauJetCorrectorExample::njets
private

Definition at line 78 of file TauJetCorrectorExample.cc.

Referenced by analyze().

JetCorrector* TauJetCorrectorExample::taucorrector
private

Definition at line 80 of file TauJetCorrectorExample.cc.

Referenced by analyze().

std::string TauJetCorrectorExample::tauCorrectorname
private

Definition at line 75 of file TauJetCorrectorExample.cc.

Referenced by analyze().

std::string TauJetCorrectorExample::tauname
private

Definition at line 74 of file TauJetCorrectorExample.cc.

Referenced by analyze().