CMS 3D CMS Logo

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)

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().

{
  vector<const reco::Candidate *> moms;
  if( c.numberOfMothers() == 1 ) {
    const Candidate * dau = &c;
    const Candidate * mom = c.mother();
    while ( dau->numberOfMothers() == 1) {
      moms.push_back( dau );
      dau = mom ;
      mom = dau->mother();
    } 
  } 
  return moms;
}
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().

{
  int code1;
  int code2;
  bool tmpHasBottom = false;
  code1 = (int)( ( abs(c.pdgId() ) / 100)%10 );
  code2 = (int)( ( abs(c.pdgId() ) /1000)%10 );
  if ( code1 == 5 || code2 == 5) tmpHasBottom = true;
  return tmpHasBottom;
 }
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().

{
  int code1;
  int code2;
  bool tmpHasCharm = false;
  code1 = (int)( ( abs(c.pdgId() ) / 100)%10 );
  code2 = (int)( ( abs(c.pdgId() ) /1000)%10 );
  if ( code1 == 4 || code2 == 4) tmpHasCharm = true;
  return tmpHasCharm;
}