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
L1Analysis::L1AnalysisGenerator Class Reference

#include <L1AnalysisGenerator.h>

Public Member Functions

L1AnalysisGeneratorDataFormatgetData ()
 
 L1AnalysisGenerator ()
 
void Reset ()
 
void Set (const edm::Event &e)
 
 ~L1AnalysisGenerator ()
 

Private Attributes

L1AnalysisGeneratorDataFormat generator_
 

Detailed Description

Definition at line 15 of file L1AnalysisGenerator.h.

Constructor & Destructor Documentation

L1Analysis::L1AnalysisGenerator::L1AnalysisGenerator ( )

Definition at line 10 of file L1AnalysisGenerator.cc.

11 {
12 }
L1Analysis::L1AnalysisGenerator::~L1AnalysisGenerator ( )

Definition at line 14 of file L1AnalysisGenerator.cc.

15 {
16 }

Member Function Documentation

L1AnalysisGeneratorDataFormat* L1Analysis::L1AnalysisGenerator::getData ( void  )
inline

Definition at line 22 of file L1AnalysisGenerator.h.

References generator_.

Referenced by L1NtupleProducer::L1NtupleProducer().

22 {return &generator_;}
L1AnalysisGeneratorDataFormat generator_
void L1Analysis::L1AnalysisGenerator::Reset ( void  )
inline
void L1Analysis::L1AnalysisGenerator::Set ( const edm::Event e)

Definition at line 18 of file L1AnalysisGenerator.cc.

References funct::abs(), reco::LeafCandidate::energy(), genParticleCandidates2GenParticles_cfi::genParticles, edm::Event::getByLabel(), i, reco::CompositeRefCandidateT< D >::mother(), reco::CompositeRefCandidateT< D >::numberOfMothers(), AlCaHLTBitMon_ParallelJobs::p, SingleMuPt40Fwdv2_cfi_GEN_SIM::pdgId, reco::LeafCandidate::pdgId(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), reco::LeafCandidate::pz(), and reco::LeafCandidate::status().

19 {
21  e.getByLabel("genParticles", genParticles);
22  for(size_t i = 0; i < genParticles->size(); ++ i) {
23  const GenParticle & p = (*genParticles)[i];
24  int id = p.pdgId();
25  //int st = p.status();
26  if (abs(id) == 13) {
27  unsigned int nMo=p.numberOfMothers();
28 // std::cout << "id " << id << "; st " << st
29 // << "; nMo " << nMo << std::endl;
30  for(unsigned int i=0;i<nMo;++i){
31 // int thisParentID = dynamic_cast <const reco::GenParticle*>(p.mother(i))->pdgId();
32 // std::cout << " mother ID " << thisParentID << std::endl;
33  }
34  }
35 
36 //
37 // See if the parent was interesting
38  int parentID = -10000;
39  unsigned int nMo=p.numberOfMothers();
40  for(unsigned int i=0;i<nMo;++i){
41  int thisParentID = dynamic_cast
42  <const reco::GenParticle*>(p.mother(i))->pdgId();
43 //
44 // Is this a bottom hadron?
45  int hundredsIndex = abs(thisParentID)/100;
46  int thousandsIndex = abs(thisParentID)/1000;
47  if ( ((abs(thisParentID) >= 23) &&
48  (abs(thisParentID) <= 25)) ||
49  (abs(thisParentID) == 6) ||
50  (hundredsIndex == 5) ||
51  (hundredsIndex == 4) ||
52  (thousandsIndex == 5) ||
53  (thousandsIndex == 4)
54  )
55  parentID = thisParentID;
56  }
57  if ((parentID == -10000) && (nMo > 0))
58  parentID = dynamic_cast
59  <const reco::GenParticle*>(p.mother(0))->pdgId();
60 //
61 // If the parent of this particle is interesting, store all of the info
62  if ((parentID != p.pdgId()) &&
63  ((parentID > -9999)
64  || (abs(id) == 11)
65  || (abs(id) == 13)
66  || (abs(id) == 23)
67  || (abs(id) == 24)
68  || (abs(id) == 25)
69  || (abs(id) == 4)
70  || (abs(id) == 5)
71  || (abs(id) == 6))
72  )
73  {
74  generator_.id.push_back(p.pdgId());
75  generator_.status.push_back(p.status());
76  generator_.px.push_back(p.px());
77  generator_.py.push_back(p.py());
78  generator_.pz.push_back(p.pz());
79  generator_.e.push_back(p.energy());
80  generator_.parent_id.push_back(parentID);
81  }
82  }
83 
84 }
int i
Definition: DBlmapReader.cc:9
virtual double energy() const final
energy
virtual int status() const final
status word
virtual size_t numberOfMothers() const
number of mothers
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual double py() const final
y coordinate of momentum vector
L1AnalysisGeneratorDataFormat generator_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
virtual double pz() const final
z coordinate of momentum vector
virtual int pdgId() const final
PDG identifier.
virtual double px() const final
x coordinate of momentum vector
virtual const Candidate * mother(size_type=0) const
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...

Member Data Documentation

L1AnalysisGeneratorDataFormat L1Analysis::L1AnalysisGenerator::generator_
private

Definition at line 25 of file L1AnalysisGenerator.h.

Referenced by getData(), and Reset().