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 Member Functions | Private Attributes
IsolatedParticlesGeneratedJets Class Reference

#include <Calibration/IsolatedParticles/plugins/IsolatedParticlesGeneratedJets.cc>

Inheritance diagram for IsolatedParticlesGeneratedJets:
edm::EDAnalyzer

Public Member Functions

 IsolatedParticlesGeneratedJets (const edm::ParameterSet &)
 
 ~IsolatedParticlesGeneratedJets ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
void BookHistograms ()
 
void clearTreeVectors ()
 
virtual void endJob ()
 

Private Attributes

bool debug
 
edm::Service< TFileServicefs
 
edm::InputTag jetSrc
 
edm::InputTag partSrc
 
std::vector< double > * t_gjetE
 
std::vector< double > * t_gjetEta
 
std::vector< int > * t_gjetN
 
std::vector< double > * t_gjetPhi
 
std::vector< double > * t_gjetPt
 
std::vector< std::vector
< double > > * 
t_jetTrkCharge
 
std::vector< std::vector
< double > > * 
t_jetTrkEta
 
std::vector< std::vector
< double > > * 
t_jetTrkP
 
std::vector< std::vector
< double > > * 
t_jetTrkPdg
 
std::vector< std::vector
< double > > * 
t_jetTrkPhi
 
std::vector< std::vector
< double > > * 
t_jetTrkPt
 
TTree * tree
 

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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 34 of file IsolatedParticlesGeneratedJets.h.

Constructor & Destructor Documentation

IsolatedParticlesGeneratedJets::IsolatedParticlesGeneratedJets ( const edm::ParameterSet iConfig)
explicit

Definition at line 23 of file IsolatedParticlesGeneratedJets.cc.

References debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), jetSrc, and partSrc.

23  {
24 
25  debug = iConfig.getUntrackedParameter<bool> ("Debug", false);
26  jetSrc = iConfig.getParameter<edm::InputTag>("JetSource");
27  partSrc = iConfig.getParameter<edm::InputTag>("ParticleSource");
28 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
IsolatedParticlesGeneratedJets::~IsolatedParticlesGeneratedJets ( )

Definition at line 31 of file IsolatedParticlesGeneratedJets.cc.

31  {
32 
33 }

Member Function Documentation

void IsolatedParticlesGeneratedJets::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 35 of file IsolatedParticlesGeneratedJets.cc.

References abs, DeDxDiscriminatorTools::charge(), clearTreeVectors(), gather_cfg::cout, debug, reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), eta(), genParticleCandidates2GenParticles_cfi::genParticles, edm::Event::getByLabel(), JetMatchingTools::getGenParticles(), jetSrc, AlCaHLTBitMon_ParallelJobs::p, partSrc, benchmark_cfg::pdgId, phi, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), t_gjetE, t_gjetEta, t_gjetN, t_gjetPhi, t_gjetPt, t_jetTrkCharge, t_jetTrkEta, t_jetTrkP, t_jetTrkPdg, t_jetTrkPhi, t_jetTrkPt, and tree.

35  {
36 
37  //using namespace edm;
39 
40  //=== genJet information
42  iEvent.getByLabel(jetSrc, genJets);
43 
44  //=== genJet information
46  iEvent.getByLabel(partSrc, genParticles);
47 
48  JetMatchingTools jetMatching (iEvent);
49  std::vector <std::vector <const reco::GenParticle*> > genJetConstituents (genJets->size());
50 
51  int njets = 0;
52  for (unsigned iGenJet = 0; iGenJet < genJets->size(); ++iGenJet) {
53  const reco::GenJet& genJet = (*genJets) [iGenJet];
54 
55  double genJetE = genJet.energy();
56  double genJetPt = genJet.pt();
57  double genJetEta = genJet.eta();
58  double genJetPhi = genJet.phi();
59 
60  if( genJetPt> 30.0 && std::abs(genJetEta)<3.0 ) {
61 
62  njets++;
63 
64  std::vector <const reco::GenParticle*> genJetConstituents = jetMatching.getGenParticles ((*genJets) [iGenJet]);
65 
66  std::vector<double> v_trkP, v_trkPt, v_trkEta, v_trkPhi, v_trkPdg, v_trkCharge;
67 
68  if(debug) std::cout<<"Jet(pt,Eta,Phi) "<<genJetPt<<" "<<genJetEta<<" "<<genJetPhi <<std::endl;
69  for(unsigned int ic=0; ic<genJetConstituents.size(); ic++) {
70 
71  if(debug) {
72  std::cout << "p,pt,eta,phi "<<genJetConstituents[ic]->p()<<" "<<genJetConstituents[ic]->pt()
73  <<" "<<genJetConstituents[ic]->eta()<<" "<<genJetConstituents[ic]->phi()
74  <<std::endl;
75  }
76 
77  v_trkP.push_back(genJetConstituents[ic]->p());
78  v_trkPt.push_back(genJetConstituents[ic]->pt());
79  v_trkEta.push_back(genJetConstituents[ic]->eta());
80  v_trkPhi.push_back(genJetConstituents[ic]->phi());
81  v_trkPdg.push_back(genJetConstituents[ic]->pdgId());
82  v_trkCharge.push_back(genJetConstituents[ic]->charge());
83 
84  } //loop over genjet constituents
85 
86  t_gjetE ->push_back(genJetE );
87  t_gjetPt ->push_back(genJetPt );
88  t_gjetEta ->push_back(genJetEta);
89  t_gjetPhi ->push_back(genJetPhi);
90 
91  t_jetTrkP ->push_back(v_trkP );
92  t_jetTrkPt ->push_back(v_trkPt );
93  t_jetTrkEta ->push_back(v_trkEta);
94  t_jetTrkPhi ->push_back(v_trkPhi);
95  t_jetTrkPdg ->push_back(v_trkPdg);
96  t_jetTrkCharge ->push_back(v_trkCharge);
97 
98  } // if jetPt>30
99 
100  } //loop over genjets
101 
102  t_gjetN->push_back(njets);
103 
104  unsigned int indx = 0;
105  for(reco::GenParticleCollection::const_iterator ig = genParticles->begin(); ig!= genParticles->end(); ++ig,++indx) {
106 
107  if (debug)
108  std::cout << "Track " << indx << " Status " << ig->status() << " charge "
109  << ig->charge() << " pdgId " << ig->pdgId() << " mass "
110  << ig->mass() << " P " << ig->momentum() << " E "
111  << ig->energy() << " Origin " << ig->vertex() << std::endl;
112  }
113 
114 
115  tree->Fill();
116 }
std::vector< std::vector< double > > * t_jetTrkEta
#define abs(x)
Definition: mlp_lapack.h:159
T eta() const
std::vector< std::vector< double > > * t_jetTrkPdg
double charge(const std::vector< uint8_t > &Ampls)
virtual double eta() const
momentum pseudorapidity
virtual double energy() const
energy
std::vector< std::vector< double > > * t_jetTrkPhi
Jets made from MC generator particles.
Definition: GenJet.h:25
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::vector< std::vector< double > > * t_jetTrkPt
std::vector< std::vector< double > > * t_jetTrkCharge
virtual double pt() const
transverse momentum
tuple cout
Definition: gather_cfg.py:121
std::vector< std::vector< double > > * t_jetTrkP
virtual double phi() const
momentum azimuthal angle
Definition: DDAxes.h:10
void IsolatedParticlesGeneratedJets::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file IsolatedParticlesGeneratedJets.cc.

References BookHistograms().

118  {
119 
120  BookHistograms();
121 
122 }
void IsolatedParticlesGeneratedJets::BookHistograms ( )
private

Definition at line 139 of file IsolatedParticlesGeneratedJets.cc.

References fs, TFileDirectory::make(), t_gjetE, t_gjetEta, t_gjetN, t_gjetPhi, t_gjetPt, t_jetTrkCharge, t_jetTrkEta, t_jetTrkP, t_jetTrkPdg, t_jetTrkPhi, t_jetTrkPt, and tree.

Referenced by beginJob().

139  {
140 
141  tree = fs->make<TTree>("tree", "tree");
142 
143  t_gjetN = new std::vector<int> ();
144  t_gjetE = new std::vector<double>();
145  t_gjetPt = new std::vector<double>();
146  t_gjetEta = new std::vector<double>();
147  t_gjetPhi = new std::vector<double>();
148 
149  t_jetTrkP = new std::vector<std::vector<double> >();
150  t_jetTrkPt = new std::vector<std::vector<double> >();
151  t_jetTrkEta = new std::vector<std::vector<double> >();
152  t_jetTrkPhi = new std::vector<std::vector<double> >();
153  t_jetTrkPdg = new std::vector<std::vector<double> >();
154  t_jetTrkCharge = new std::vector<std::vector<double> >();
155 
156  tree->Branch("t_gjetN", "vector<int>", &t_gjetN);
157  tree->Branch("t_gjetE", "vector<double>", &t_gjetE);
158  tree->Branch("t_gjetPt", "vector<double>", &t_gjetPt);
159  tree->Branch("t_gjetEta", "vector<double>", &t_gjetEta);
160  tree->Branch("t_gjetPhi", "vector<double>", &t_gjetPhi);
161 
162  tree->Branch("t_jetTrkP", "vector<vector<double> >", &t_jetTrkP);
163  tree->Branch("t_jetTrkPt", "vector<vector<double> >", &t_jetTrkPt);
164  tree->Branch("t_jetTrkEta", "vector<vector<double> >", &t_jetTrkEta);
165  tree->Branch("t_jetTrkPhi", "vector<vector<double> >", &t_jetTrkPhi);
166  tree->Branch("t_jetTrkPdg", "vector<vector<double> >", &t_jetTrkPdg);
167  tree->Branch("t_jetTrkCharge", "vector<vector<double> >", &t_jetTrkCharge);
168 
169 }
std::vector< std::vector< double > > * t_jetTrkEta
std::vector< std::vector< double > > * t_jetTrkPdg
std::vector< std::vector< double > > * t_jetTrkPhi
std::vector< std::vector< double > > * t_jetTrkPt
std::vector< std::vector< double > > * t_jetTrkCharge
T * make() const
make new ROOT object
std::vector< std::vector< double > > * t_jetTrkP
void IsolatedParticlesGeneratedJets::clearTreeVectors ( )
private

Definition at line 124 of file IsolatedParticlesGeneratedJets.cc.

References t_gjetE, t_gjetEta, t_gjetN, t_gjetPhi, t_gjetPt, t_jetTrkCharge, t_jetTrkEta, t_jetTrkP, t_jetTrkPdg, t_jetTrkPhi, and t_jetTrkPt.

Referenced by analyze().

124  {
125  t_gjetN ->clear();
126  t_gjetE ->clear();
127  t_gjetPt ->clear();
128  t_gjetEta ->clear();
129  t_gjetPhi ->clear();
130 
131  t_jetTrkP ->clear();
132  t_jetTrkPt ->clear();
133  t_jetTrkEta ->clear();
134  t_jetTrkPhi ->clear();
135  t_jetTrkPdg ->clear();
136  t_jetTrkCharge ->clear();
137 }
std::vector< std::vector< double > > * t_jetTrkEta
std::vector< std::vector< double > > * t_jetTrkPdg
std::vector< std::vector< double > > * t_jetTrkPhi
std::vector< std::vector< double > > * t_jetTrkPt
std::vector< std::vector< double > > * t_jetTrkCharge
std::vector< std::vector< double > > * t_jetTrkP
void IsolatedParticlesGeneratedJets::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 171 of file IsolatedParticlesGeneratedJets.cc.

171  {
172 }

Member Data Documentation

bool IsolatedParticlesGeneratedJets::debug
private

Definition at line 48 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), and IsolatedParticlesGeneratedJets().

edm::Service<TFileService> IsolatedParticlesGeneratedJets::fs
private

Definition at line 50 of file IsolatedParticlesGeneratedJets.h.

Referenced by BookHistograms().

edm::InputTag IsolatedParticlesGeneratedJets::jetSrc
private

Definition at line 49 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), and IsolatedParticlesGeneratedJets().

edm::InputTag IsolatedParticlesGeneratedJets::partSrc
private

Definition at line 49 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), and IsolatedParticlesGeneratedJets().

std::vector<double>* IsolatedParticlesGeneratedJets::t_gjetE
private

Definition at line 55 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), BookHistograms(), and clearTreeVectors().

std::vector<double> * IsolatedParticlesGeneratedJets::t_gjetEta
private

Definition at line 55 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), BookHistograms(), and clearTreeVectors().

std::vector<int>* IsolatedParticlesGeneratedJets::t_gjetN
private

Definition at line 53 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), BookHistograms(), and clearTreeVectors().

std::vector<double> * IsolatedParticlesGeneratedJets::t_gjetPhi
private

Definition at line 55 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), BookHistograms(), and clearTreeVectors().

std::vector<double> * IsolatedParticlesGeneratedJets::t_gjetPt
private

Definition at line 55 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), BookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkCharge
private

Definition at line 62 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), BookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkEta
private

Definition at line 59 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), BookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkP
private

Definition at line 57 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), BookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkPdg
private

Definition at line 61 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), BookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkPhi
private

Definition at line 60 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), BookHistograms(), and clearTreeVectors().

std::vector< std::vector<double> >* IsolatedParticlesGeneratedJets::t_jetTrkPt
private

Definition at line 58 of file IsolatedParticlesGeneratedJets.h.

Referenced by analyze(), BookHistograms(), and clearTreeVectors().

TTree* IsolatedParticlesGeneratedJets::tree
private