#include <JetCorExample.h>
Public Member Functions | |
JetCorExample (edm::ParameterSet const &cfg) | |
Private Types | |
typedef std::vector< Jet > | JetCollection |
Private Member Functions | |
void | analyze (edm::Event const &e, edm::EventSetup const &iSetup) |
void | beginJob () |
void | endJob () |
void | FillHist1D (const TString &histName, const Double_t &x) |
Private Attributes | |
std::string | HistoFileName |
std::string | JetAlgorithm |
std::string | JetCorrectionService |
TFile * | m_file |
std::map< TString, TH1 * > | m_HistNames1D |
Definition at line 15 of file JetCorExample.h.
typedef std::vector<Jet> JetCorExample< Jet >::JetCollection [private] |
Definition at line 20 of file JetCorExample.h.
JetCorExample< Jet >::JetCorExample | ( | edm::ParameterSet const & | cfg | ) |
Definition at line 22 of file JetCorExample.cc.
References edm::ParameterSet::getParameter().
{ JetAlgorithm = cfg.getParameter<std::string> ("JetAlgorithm"); HistoFileName = cfg.getParameter<std::string> ("HistoFileName"); JetCorrectionService = cfg.getParameter<std::string> ("JetCorrectionService"); }
void JetCorExample< Jet >::analyze | ( | edm::Event const & | e, |
edm::EventSetup const & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 42 of file JetCorExample.cc.
References JetCorrector::correction(), edm::Event::getByLabel(), JetCorrector::getJetCorrector(), and analyzePatCleaning_cfg::jets.
{ Handle<JetCollection> jets; evt.getByLabel(JetAlgorithm,jets); typename JetCollection::const_iterator i_jet; TString hname; const JetCorrector* corrector = JetCorrector::getJetCorrector (JetCorrectionService,iSetup); double scale; for(i_jet = jets->begin(); i_jet != jets->end(); i_jet++) { scale = corrector->correction(i_jet->p4()); hname = "JetPt"; FillHist1D(hname,i_jet->pt()); hname = "CorJetPt"; FillHist1D(hname,scale*i_jet->pt()); } }
void JetCorExample< Jet >::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 30 of file JetCorExample.cc.
{ TString hname; m_file = new TFile(HistoFileName.c_str(),"RECREATE"); hname = "JetPt"; m_HistNames1D[hname] = new TH1F(hname,hname,100,0,1000); hname = "CorJetPt"; m_HistNames1D[hname] = new TH1F(hname,hname,100,0,1000); }
void JetCorExample< Jet >::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 63 of file JetCorExample.cc.
{ if (m_file !=0) { m_file->cd(); for (std::map<TString, TH1*>::iterator hid = m_HistNames1D.begin(); hid != m_HistNames1D.end(); hid++) hid->second->Write(); delete m_file; m_file = 0; } }
void JetCorExample< Jet >::FillHist1D | ( | const TString & | histName, |
const Double_t & | x | ||
) | [private] |
Definition at line 77 of file JetCorExample.cc.
References gather_cfg::cout.
{ std::map<TString, TH1*>::iterator hid=m_HistNames1D.find(histName); if (hid==m_HistNames1D.end()) std::cout << "%fillHist -- Could not find histogram with name: " << histName << std::endl; else hid->second->Fill(value); }
std::string JetCorExample< Jet >::HistoFileName [private] |
Definition at line 31 of file JetCorExample.h.
std::string JetCorExample< Jet >::JetAlgorithm [private] |
Definition at line 29 of file JetCorExample.h.
std::string JetCorExample< Jet >::JetCorrectionService [private] |
Definition at line 33 of file JetCorExample.h.
TFile* JetCorExample< Jet >::m_file [private] |
Definition at line 26 of file JetCorExample.h.
std::map<TString, TH1*> JetCorExample< Jet >::m_HistNames1D [private] |
Definition at line 25 of file JetCorExample.h.