CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Typedefs | Functions
GenParticlesHelper Namespace Reference

Typedefs

typedef
reco::GenParticleCollection::const_iterator 
IG
 
typedef
reco::GenParticleRefVector::const_iterator 
IGR
 

Functions

void findDescendents (const reco::GenParticleRef &base, reco::GenParticleRefVector &descendents, int status, int pdgId=0)
 find all descendents of a given status and pdgId (recursive) More...
 
void findParticles (const reco::GenParticleCollection &sourceParticles, reco::GenParticleRefVector &particleRefs, int pdgId, int status)
 find all particles of a given pdgId and status More...
 
void findSisters (const reco::GenParticleRef &baseSister, reco::GenParticleRefVector &sisterRefs)
 find the particles having the same daughter as baseSister More...
 
bool hasAncestor (const reco::GenParticle *particle, int pdgId, int status)
 does the particle have an ancestor with this pdgId and this status? More...
 
bool isDirect (const reco::GenParticleRef &particle)
 check if particle is direct (has status 3 or is a daughter of particle with status 3) More...
 
std::ostream & operator<< (std::ostream &out, const reco::GenParticleRef &genRef)
 

Typedef Documentation

typedef reco::GenParticleCollection::const_iterator GenParticlesHelper::IG

Definition at line 10 of file GenParticlesHelper.h.

Definition at line 11 of file GenParticlesHelper.h.

Function Documentation

void GenParticlesHelper::findDescendents ( const reco::GenParticleRef base,
reco::GenParticleRefVector descendents,
int  status,
int  pdgId = 0 
)

find all descendents of a given status and pdgId (recursive)

Referenced by TauGenJetProducer::produce().

void GenParticlesHelper::findParticles ( const reco::GenParticleCollection sourceParticles,
reco::GenParticleRefVector particleRefs,
int  pdgId,
int  status 
)

find all particles of a given pdgId and status

Referenced by TauGenJetProducer::produce().

void GenParticlesHelper::findSisters ( const reco::GenParticleRef baseSister,
reco::GenParticleRefVector sisterRefs 
)

find the particles having the same daughter as baseSister

bool GenParticlesHelper::hasAncestor ( const reco::GenParticle particle,
int  pdgId,
int  status 
)

does the particle have an ancestor with this pdgId and this status?

Definition at line 77 of file GenParticlesHelper.cc.

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), reco::CompositeRefCandidateT< D >::motherRefVector(), reco::LeafCandidate::pdgId(), mps_update::status, and reco::LeafCandidate::status().

77  {
78  if (particle->pdgId() == pdgId && particle->status() == status)
79  return true;
80 
81  const GenParticleRefVector& mothers = particle->motherRefVector();
82 
83  for (IGR im = mothers.begin(); im != mothers.end(); ++im) {
84  const GenParticle& part = **im;
85  if (hasAncestor(&part, pdgId, status))
86  return true;
87  }
88 
89  return false;
90  }
reco::GenParticleRefVector::const_iterator IGR
list status
Definition: mps_update.py:107
int status() const final
status word
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
int pdgId() const final
PDG identifier.
const mothers & motherRefVector() const
references to mothers
part
Definition: HCALResponse.h:20
bool hasAncestor(const reco::GenParticle *particle, int pdgId, int status)
does the particle have an ancestor with this pdgId and this status?
bool GenParticlesHelper::isDirect ( const reco::GenParticleRef particle)

check if particle is direct (has status 3 or is a daughter of particle with status 3)

Definition at line 61 of file GenParticlesHelper.cc.

References cms::cuda::assert(), and mps_update::status.

61  {
62  assert((particle->status() != 0) && (particle->status() < 4));
63  if (particle->status() == 3)
64  return true;
65  else {
66  assert(particle->numberOfMothers() > 0);
67 
68  // get first mother
69  const GenParticleRefVector& mothers = particle->motherRefVector();
70  if (mothers[0]->status() == 3)
71  return true;
72  else
73  return false;
74  }
75  }
list status
Definition: mps_update.py:107
assert(be >=bs)
std::ostream & GenParticlesHelper::operator<< ( std::ostream &  out,
const reco::GenParticleRef genRef 
)

Definition at line 92 of file GenParticlesHelper.cc.

References edm::Ref< C, T, F >::key(), and submitPVResolutionJobs::out.

92  {
93  if (!out)
94  return out;
95 
96  out << genRef.key() << " " << genRef->pt();
97 
98  return out;
99  }
key_type key() const
Accessor for product key.
Definition: Ref.h:250