#include <CaloMCTruthTreeProducer.h>
Public Member Functions | |
virtual void | analyze (edm::Event const &e, edm::EventSetup const &iSetup) |
virtual void | beginJob () |
CaloMCTruthTreeProducer (edm::ParameterSet const &cfg) | |
virtual void | endJob () |
~CaloMCTruthTreeProducer () | |
Private Attributes | |
float | dR_ |
float | emfJet_ |
float | etaGen_ |
float | etaJet_ |
TFile * | file_ |
std::string | genjets_ |
std::string | histogramFile_ |
std::string | jets_ |
TTree * | mcTruthTree_ |
float | phiGen_ |
float | phiJet_ |
float | ptGen_ |
float | ptHat_ |
float | ptJet_ |
int | rank_ |
Definition at line 10 of file CaloMCTruthTreeProducer.h.
CaloMCTruthTreeProducer::CaloMCTruthTreeProducer | ( | edm::ParameterSet const & | cfg | ) | [explicit] |
Definition at line 29 of file CaloMCTruthTreeProducer.cc.
References edm::ParameterSet::getParameter().
{ jets_ = cfg.getParameter<std::string> ("jets"); genjets_ = cfg.getParameter<std::string> ("genjets"); histogramFile_ = cfg.getParameter<std::string> ("histogramFile"); }
CaloMCTruthTreeProducer::~CaloMCTruthTreeProducer | ( | ) |
Definition at line 105 of file CaloMCTruthTreeProducer.cc.
{ delete file_; delete mcTruthTree_; }
void CaloMCTruthTreeProducer::analyze | ( | edm::Event const & | e, |
edm::EventSetup const & | iSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 63 of file CaloMCTruthTreeProducer.cc.
References analyzePatCleaning_cfg::jets, njet, and CosmicsPD_Skims::radius.
{ edm::Handle<GenJetCollection> genjets; edm::Handle<CaloJetCollection> jets; edm::Handle<GenEventInfoProduct> hEventInfo; CaloJetCollection::const_iterator i_jet,i_matched; GenJetCollection::const_iterator i_genjet; event.getByLabel (genjets_,genjets); event.getByLabel (jets_,jets); event.getByLabel("generator",hEventInfo); ptHat_ = hEventInfo->binningValues()[0]; float rr; int njet(0); if (jets->size()>0 && genjets->size()>0) { for (i_genjet = genjets->begin(); i_genjet != genjets->end(); i_genjet++) { float rmin(99); for(i_jet = jets->begin();i_jet != jets->end(); i_jet++) { rr=radius(i_genjet,i_jet); if (rr<rmin) { rmin = rr; i_matched = i_jet; } } ptGen_ = i_genjet->pt(); etaGen_ = i_genjet->eta(); phiGen_ = i_genjet->phi(); ptJet_ = i_matched->pt(); etaJet_ = i_matched->eta(); phiJet_ = i_matched->phi(); emfJet_ = i_matched->emEnergyFraction(); dR_ = rmin; rank_ = njet; mcTruthTree_->Fill(); njet++; } } }
void CaloMCTruthTreeProducer::beginJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 36 of file CaloMCTruthTreeProducer.cc.
{ file_ = new TFile(histogramFile_.c_str(),"RECREATE"); mcTruthTree_ = new TTree("mcTruthTree","mcTruthTree"); mcTruthTree_->Branch("ptJet", &ptJet_, "ptJet_/F"); mcTruthTree_->Branch("ptGen", &ptGen_, "ptGen_/F"); mcTruthTree_->Branch("ptHat", &ptHat_, "ptHat_/F"); mcTruthTree_->Branch("emfJet", &emfJet_, "emfJet_/F"); mcTruthTree_->Branch("etaJet", &etaJet_, "etaJet_/F"); mcTruthTree_->Branch("etaGen", &etaGen_, "etaGen_/F"); mcTruthTree_->Branch("phiJet", &phiJet_, "phiJet_/F"); mcTruthTree_->Branch("phiGen", &phiGen_, "phiGen_/F"); mcTruthTree_->Branch("dR", &dR_, "dR_/F"); mcTruthTree_->Branch("rank", &rank_, "rank_/I"); }
void CaloMCTruthTreeProducer::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 53 of file CaloMCTruthTreeProducer.cc.
{ if (file_ !=0) { file_->cd(); mcTruthTree_->Write(); } file_ = 0; }
float CaloMCTruthTreeProducer::dR_ [private] |
Definition at line 25 of file CaloMCTruthTreeProducer.h.
float CaloMCTruthTreeProducer::emfJet_ [private] |
Definition at line 25 of file CaloMCTruthTreeProducer.h.
float CaloMCTruthTreeProducer::etaGen_ [private] |
Definition at line 25 of file CaloMCTruthTreeProducer.h.
float CaloMCTruthTreeProducer::etaJet_ [private] |
Definition at line 25 of file CaloMCTruthTreeProducer.h.
TFile* CaloMCTruthTreeProducer::file_ [private] |
Definition at line 23 of file CaloMCTruthTreeProducer.h.
std::string CaloMCTruthTreeProducer::genjets_ [private] |
Definition at line 22 of file CaloMCTruthTreeProducer.h.
std::string CaloMCTruthTreeProducer::histogramFile_ [private] |
Definition at line 20 of file CaloMCTruthTreeProducer.h.
std::string CaloMCTruthTreeProducer::jets_ [private] |
Definition at line 21 of file CaloMCTruthTreeProducer.h.
TTree* CaloMCTruthTreeProducer::mcTruthTree_ [private] |
Definition at line 24 of file CaloMCTruthTreeProducer.h.
float CaloMCTruthTreeProducer::phiGen_ [private] |
Definition at line 25 of file CaloMCTruthTreeProducer.h.
float CaloMCTruthTreeProducer::phiJet_ [private] |
Definition at line 25 of file CaloMCTruthTreeProducer.h.
float CaloMCTruthTreeProducer::ptGen_ [private] |
Definition at line 25 of file CaloMCTruthTreeProducer.h.
float CaloMCTruthTreeProducer::ptHat_ [private] |
Definition at line 25 of file CaloMCTruthTreeProducer.h.
float CaloMCTruthTreeProducer::ptJet_ [private] |
Definition at line 25 of file CaloMCTruthTreeProducer.h.
int CaloMCTruthTreeProducer::rank_ [private] |
Definition at line 26 of file CaloMCTruthTreeProducer.h.