#include <JetPlotsExample.h>
Public Member Functions | |
JetPlotsExample (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 |
TFile * | m_file |
std::map< TString, TH1 * > | m_HistNames1D |
int | NJets |
Definition at line 15 of file JetPlotsExample.h.
typedef std::vector<Jet> JetPlotsExample< Jet >::JetCollection [private] |
Definition at line 20 of file JetPlotsExample.h.
JetPlotsExample< Jet >::JetPlotsExample | ( | edm::ParameterSet const & | cfg | ) |
Definition at line 25 of file JetPlotsExample.cc.
References edm::ParameterSet::getParameter().
{ JetAlgorithm = cfg.getParameter<std::string> ("JetAlgorithm"); HistoFileName = cfg.getParameter<std::string> ("HistoFileName"); NJets = cfg.getParameter<int> ("NJets"); }
void JetPlotsExample< Jet >::analyze | ( | edm::Event const & | e, |
edm::EventSetup const & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 49 of file JetPlotsExample.cc.
References edm::Event::getByLabel(), getHLTprescales::index, and analyzePatCleaning_cfg::jets.
{ Handle<JetCollection> jets; evt.getByLabel(JetAlgorithm,jets); typename JetCollection::const_iterator i_jet; int index = 0; TString hname; hname = "NumberOfJets"; FillHist1D(hname,jets->size()); for(i_jet = jets->begin(); i_jet != jets->end() && index < NJets; ++i_jet) { hname = "JetPt"; FillHist1D(hname,i_jet->pt()); hname = "JetEta"; FillHist1D(hname,i_jet->eta()); hname = "JetPhi"; FillHist1D(hname,i_jet->phi()); index++; } }
void JetPlotsExample< Jet >::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 33 of file JetPlotsExample.cc.
References M_PI.
{ TString hname; m_file = new TFile(HistoFileName.c_str(),"RECREATE"); hname = "JetPt"; m_HistNames1D[hname] = new TH1F(hname,hname,100,0,1000); hname = "JetEta"; m_HistNames1D[hname] = new TH1F(hname,hname,120,-6,6); hname = "JetPhi"; m_HistNames1D[hname] = new TH1F(hname,hname,100,-M_PI,M_PI); hname = "NumberOfJets"; m_HistNames1D[hname] = new TH1F(hname,hname,100,0,100); }
void JetPlotsExample< Jet >::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 74 of file JetPlotsExample.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 JetPlotsExample< Jet >::FillHist1D | ( | const TString & | histName, |
const Double_t & | x | ||
) | [private] |
Definition at line 88 of file JetPlotsExample.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 JetPlotsExample< Jet >::HistoFileName [private] |
Definition at line 31 of file JetPlotsExample.h.
std::string JetPlotsExample< Jet >::JetAlgorithm [private] |
Definition at line 29 of file JetPlotsExample.h.
TFile* JetPlotsExample< Jet >::m_file [private] |
Definition at line 26 of file JetPlotsExample.h.
std::map<TString, TH1*> JetPlotsExample< Jet >::m_HistNames1D [private] |
Definition at line 25 of file JetPlotsExample.h.
int JetPlotsExample< Jet >::NJets [private] |
Definition at line 33 of file JetPlotsExample.h.