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 Attributes
CaloMCTruthTreeProducer Class Reference

#include <CaloMCTruthTreeProducer.h>

Inheritance diagram for CaloMCTruthTreeProducer:
edm::EDAnalyzer

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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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_
 

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

Definition at line 10 of file CaloMCTruthTreeProducer.h.

Constructor & Destructor Documentation

CaloMCTruthTreeProducer::CaloMCTruthTreeProducer ( edm::ParameterSet const &  cfg)
explicit

Definition at line 29 of file CaloMCTruthTreeProducer.cc.

References edm::ParameterSet::getParameter().

30 {
31  jets_ = cfg.getParameter<std::string> ("jets");
32  genjets_ = cfg.getParameter<std::string> ("genjets");
33  histogramFile_ = cfg.getParameter<std::string> ("histogramFile");
34 }
CaloMCTruthTreeProducer::~CaloMCTruthTreeProducer ( )

Definition at line 105 of file CaloMCTruthTreeProducer.cc.

106 {
107  delete file_;
108  delete mcTruthTree_;
109 }

Member Function Documentation

void CaloMCTruthTreeProducer::analyze ( edm::Event const &  e,
edm::EventSetup const &  iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 63 of file CaloMCTruthTreeProducer.cc.

References fwrapper::jets, njet, CosmicsPD_Skims::radius, and findQualityFiles::rr.

64 {
68  CaloJetCollection::const_iterator i_jet,i_matched;
69  GenJetCollection::const_iterator i_genjet;
70  event.getByLabel (genjets_,genjets);
71  event.getByLabel (jets_,jets);
72  event.getByLabel("generator",hEventInfo);
73  ptHat_ = hEventInfo->binningValues()[0];
74  float rr;
75  int njet(0);
76  if (jets->size()>0 && genjets->size()>0)
77  {
78  for (i_genjet = genjets->begin(); i_genjet != genjets->end(); i_genjet++)
79  {
80  float rmin(99);
81  for(i_jet = jets->begin();i_jet != jets->end(); i_jet++)
82  {
83  rr=radius(i_genjet,i_jet);
84  if (rr<rmin)
85  {
86  rmin = rr;
87  i_matched = i_jet;
88  }
89  }
90  ptGen_ = i_genjet->pt();
91  etaGen_ = i_genjet->eta();
92  phiGen_ = i_genjet->phi();
93  ptJet_ = i_matched->pt();
94  etaJet_ = i_matched->eta();
95  phiJet_ = i_matched->phi();
96  emfJet_ = i_matched->emEnergyFraction();
97  dR_ = rmin;
98  rank_ = njet;
99  mcTruthTree_->Fill();
100  njet++;
101  }
102  }
103 }
int njet
Definition: HydjetWrapper.h:91
vector< PseudoJet > jets
void CaloMCTruthTreeProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 36 of file CaloMCTruthTreeProducer.cc.

37 {
38  file_ = new TFile(histogramFile_.c_str(),"RECREATE");
39  mcTruthTree_ = new TTree("mcTruthTree","mcTruthTree");
40 
41  mcTruthTree_->Branch("ptJet", &ptJet_, "ptJet_/F");
42  mcTruthTree_->Branch("ptGen", &ptGen_, "ptGen_/F");
43  mcTruthTree_->Branch("ptHat", &ptHat_, "ptHat_/F");
44  mcTruthTree_->Branch("emfJet", &emfJet_, "emfJet_/F");
45  mcTruthTree_->Branch("etaJet", &etaJet_, "etaJet_/F");
46  mcTruthTree_->Branch("etaGen", &etaGen_, "etaGen_/F");
47  mcTruthTree_->Branch("phiJet", &phiJet_, "phiJet_/F");
48  mcTruthTree_->Branch("phiGen", &phiGen_, "phiGen_/F");
49  mcTruthTree_->Branch("dR", &dR_, "dR_/F");
50  mcTruthTree_->Branch("rank", &rank_, "rank_/I");
51 }
void CaloMCTruthTreeProducer::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 53 of file CaloMCTruthTreeProducer.cc.

54 {
55  if (file_ !=0)
56  {
57  file_->cd();
58  mcTruthTree_->Write();
59  }
60  file_ = 0;
61 }

Member Data Documentation

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.