CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
CandMCTagUtils Namespace Reference

Functions

std::vector< const
reco::Candidate * > 
getAncestors (const reco::Candidate &c)
 
bool hasBottom (const reco::Candidate &c)
 
bool hasCharm (const reco::Candidate &c)
 
bool isLightParton (const reco::Candidate &c)
 
bool isParton (const reco::Candidate &c)
 

Function Documentation

std::vector< const reco::Candidate * > CandMCTagUtils::getAncestors ( const reco::Candidate c)

Definition at line 10 of file CandMCTag.cc.

References trackerHits::c, reco::Candidate::mother(), and reco::Candidate::numberOfMothers().

Referenced by JetMCTagUtils::decayFromBHadron(), and JetMCTagUtils::decayFromCHadron().

11 {
12  vector<const reco::Candidate *> moms;
13  if( c.numberOfMothers() == 1 ) {
14  const Candidate * dau = &c;
15  const Candidate * mom = c.mother();
16  while ( dau->numberOfMothers() == 1) {
17  moms.push_back( dau );
18  dau = mom ;
19  mom = dau->mother();
20  }
21  }
22  return moms;
23 }
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
bool CandMCTagUtils::hasBottom ( const reco::Candidate c)

Definition at line 26 of file CandMCTag.cc.

References abs, and reco::Candidate::pdgId().

Referenced by JetMCTagUtils::decayFromBHadron(), and HadronAndPartonSelector::produce().

27 {
28  int code1;
29  int code2;
30  bool tmpHasBottom = false;
31  code1 = (int)( ( abs(c.pdgId() ) / 100)%10 );
32  code2 = (int)( ( abs(c.pdgId() ) /1000)%10 );
33  if ( code1 == 5 || code2 == 5) tmpHasBottom = true;
34  return tmpHasBottom;
35  }
#define abs(x)
Definition: mlp_lapack.h:159
virtual int pdgId() const =0
PDG identifier.
bool CandMCTagUtils::hasCharm ( const reco::Candidate c)

Definition at line 37 of file CandMCTag.cc.

References abs, and reco::Candidate::pdgId().

Referenced by JetMCTagUtils::decayFromCHadron(), and HadronAndPartonSelector::produce().

38 {
39  int code1;
40  int code2;
41  bool tmpHasCharm = false;
42  code1 = (int)( ( abs(c.pdgId() ) / 100)%10 );
43  code2 = (int)( ( abs(c.pdgId() ) /1000)%10 );
44  if ( code1 == 4 || code2 == 4) tmpHasCharm = true;
45  return tmpHasCharm;
46 }
#define abs(x)
Definition: mlp_lapack.h:159
virtual int pdgId() const =0
PDG identifier.
bool CandMCTagUtils::isLightParton ( const reco::Candidate c)

Definition at line 63 of file CandMCTag.cc.

References abs, and reco::Candidate::pdgId().

Referenced by JetFlavourClustering::setFlavours().

64 {
65  int id = abs(c.pdgId());
66 
67  if( id == 1 ||
68  id == 2 ||
69  id == 3 ||
70  id == 21 )
71  return true;
72  else
73  return false;
74 }
#define abs(x)
Definition: mlp_lapack.h:159
virtual int pdgId() const =0
PDG identifier.
bool CandMCTagUtils::isParton ( const reco::Candidate c)

Definition at line 48 of file CandMCTag.cc.

References abs, and reco::Candidate::pdgId().

Referenced by Herwig6PartonSelector::run(), HerwigppPartonSelector::run(), SherpaPartonSelector::run(), Pythia8PartonSelector::run(), Pythia6PartonSelector::run(), and InputGenJetsParticleSelector::testPartonChildren().

49 {
50  int id = abs(c.pdgId());
51 
52  if( id == 1 ||
53  id == 2 ||
54  id == 3 ||
55  id == 4 ||
56  id == 5 ||
57  id == 21 )
58  return true;
59  else
60  return false;
61 }
#define abs(x)
Definition: mlp_lapack.h:159
virtual int pdgId() const =0
PDG identifier.