#include <RecoJets/JetAnalyzers/interface/JetPlotsExample.h>
Public Member Functions | |
JetPlotsExample (const edm::ParameterSet &) | |
Private Member Functions | |
void | analyze (const edm::Event &, const edm::EventSetup &) |
void | beginJob (const edm::EventSetup &) |
void | endJob () |
Private Attributes | |
std::string | CaloJetAlgorithm |
std::string | GenJetAlgorithm |
TH1F | h_etaCal |
TH1F | h_etaGen |
TH1F | h_phiCal |
TH1F | h_phiGen |
TH1F | h_ptCal |
TH1F | h_ptGen |
TFile * | m_file |
Definition at line 15 of file JetPlotsExample.h.
JetPlotsExample::JetPlotsExample | ( | const edm::ParameterSet & | cfg | ) |
Definition at line 23 of file JetPlotsExample.cc.
00023 : 00024 CaloJetAlgorithm( cfg.getParameter<string>( "CaloJetAlgorithm" ) ), 00025 GenJetAlgorithm( cfg.getParameter<string>( "GenJetAlgorithm" ) ) 00026 { 00027 }
void JetPlotsExample::analyze | ( | const edm::Event & | evt, | |
const edm::EventSetup & | es | |||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 41 of file JetPlotsExample.cc.
References CaloJetAlgorithm, GenJetAlgorithm, edm::Event::getByLabel(), h_etaCal, h_etaGen, h_phiCal, h_phiGen, h_ptCal, and h_ptGen.
00041 { 00042 00043 //Get the CaloJet collection 00044 Handle<CaloJetCollection> caloJets; 00045 evt.getByLabel( CaloJetAlgorithm, caloJets ); 00046 00047 //Loop over the two leading CaloJets and fill some histograms 00048 int jetInd = 0; 00049 for( CaloJetCollection::const_iterator cal = caloJets->begin(); cal != caloJets->end() && jetInd<2; ++ cal ) { 00050 // std::cout << "CALO JET #" << jetInd << std::endl << cal->print() << std::endl; 00051 h_ptCal.Fill( cal->pt() ); 00052 h_etaCal.Fill( cal->eta() ); 00053 h_phiCal.Fill( cal->phi() ); 00054 jetInd++; 00055 } 00056 00057 //Get the GenJet collection 00058 Handle<GenJetCollection> genJets; 00059 evt.getByLabel( GenJetAlgorithm, genJets ); 00060 00061 //Loop over the two leading GenJets and fill some histograms 00062 jetInd = 0; 00063 for( GenJetCollection::const_iterator gen = genJets->begin(); gen != genJets->end() && jetInd<2; ++ gen ) { 00064 // std::cout << "GEN JET #" << jetInd << std::endl << gen->print() << std::endl; 00065 h_ptGen.Fill( gen->pt() ); 00066 h_etaGen.Fill( gen->eta() ); 00067 h_phiGen.Fill( gen->phi() ); 00068 jetInd++; 00069 } 00070 00071 }
void JetPlotsExample::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 29 of file JetPlotsExample.cc.
References h_etaCal, h_etaGen, h_phiCal, h_phiGen, h_ptCal, h_ptGen, and m_file.
00029 { 00030 00031 // Open the histogram file and book some associated histograms 00032 m_file=new TFile("histo.root","RECREATE"); 00033 h_ptCal = TH1F( "ptCal", "p_{T} of leading CaloJets", 50, 0, 1000 ); 00034 h_etaCal = TH1F( "etaCal", "#eta of leading CaloJets", 50, -3, 3 ); 00035 h_phiCal = TH1F( "phiCal", "#phi of leading CaloJets", 50, -M_PI, M_PI ); 00036 h_ptGen = TH1F( "ptGen", "p_{T} of leading GenJets", 50, 0, 1000 ); 00037 h_etaGen = TH1F( "etaGen", "#eta of leading GenJets", 50, -3, 3 ); 00038 h_phiGen = TH1F( "phiGen", "#phi of leading GenJets", 50, -M_PI, M_PI ); 00039 }
Reimplemented from edm::EDAnalyzer.
Definition at line 73 of file JetPlotsExample.cc.
References h_etaCal, h_etaGen, h_phiCal, h_phiGen, h_ptCal, h_ptGen, and m_file.
00073 { 00074 if (m_file !=0) 00075 { 00076 //Write the histograms to the file. 00077 m_file->cd(); 00078 h_ptCal.Write(); 00079 h_etaCal.Write(); 00080 h_phiCal.Write(); 00081 h_ptGen.Write(); 00082 h_etaGen.Write(); 00083 h_phiGen.Write(); 00084 delete m_file; 00085 m_file=0; 00086 } 00087 00088 }
std::string JetPlotsExample::CaloJetAlgorithm [private] |
std::string JetPlotsExample::GenJetAlgorithm [private] |
TH1F JetPlotsExample::h_etaCal [private] |
TH1F JetPlotsExample::h_etaGen [private] |
TH1F JetPlotsExample::h_phiCal [private] |
TH1F JetPlotsExample::h_phiGen [private] |
TH1F JetPlotsExample::h_ptCal [private] |
TH1F JetPlotsExample::h_ptGen [private] |
TFile* JetPlotsExample::m_file [private] |