CMS 3D CMS Logo

TopGenEvent Class Reference

#include <AnalysisDataFormats/TopObjects/interface/TopGenEvent.h>

Inheritance diagram for TopGenEvent:

StGenEvent TtGenEvent

List of all members.

Public Member Functions

const reco::GenParticleb () const
 return b quark if available; 0 else
const reco::GenParticlebBar () const
 return anti-b quark if available; 0 else
const reco::GenParticlecandidate (int id) const
 get candidate with given pdg id if available; 0 else
void dumpEventContent () const
 print content of the top decay chain as formated LogInfo to the MessageLogger output for debugging
const reco::GenParticleeMinus () const
 return electron if available; 0 else
const reco::GenParticleePlus () const
 return positron if available; 0 else
const reco::GenParticleCollectioninitialPartons () const
 return particles of initial partons
std::vector< const
reco::GenParticle * > 
lightQuarks (bool plusB=false) const
 return all light quarks or all quarks including b's
const reco::GenParticlemuMinus () const
 return muon if available; 0 else
const reco::GenParticlemuPlus () const
 return anti-muon if available; 0 else
int numberOfBQuarks (bool fromTopQuark=true) const
 return number of b quarks in the decay chain
int numberOfLeptons (WDecay::LeptonType type, bool fromWBoson=true) const
 return number of leptons in the decay chain
int numberOfLeptons (bool fromWBoson=true) const
 return number of leptons in the decay chain
const reco::GenParticleCollectionparticles () const
 return particles of decay chain
std::vector< const
reco::GenParticle * > 
radiatedGluons (int pdgId) const
 return radiated gluons from particle with pdgId
const reco::GenParticletauMinus () const
 return tau if available; 0 else
const reco::GenParticletauPlus () const
 return anti-tau if available; 0 else
const reco::GenParticletop () const
 return top if available; 0 else
const reco::GenParticletopBar () const
 return anti-top if available; 0 else
 TopGenEvent (reco::GenParticleRefProd &, reco::GenParticleRefProd &)
 default constructor
 TopGenEvent ()
 empty constructor
std::vector< const
reco::GenParticle * > 
topSisters () const
 return number of top anti-top sisters
const reco::GenParticlewMinus () const
 return W minus if available; 0 else
const reco::GenParticlewPlus () const
 return W plus if available; 0 else
virtual ~TopGenEvent ()
 default destructor

Protected Attributes

reco::GenParticleRefProd initPartons_
 reference to the list of initial partons (has to be kept in the event!)
reco::GenParticleRefProd parts_
 reference to the top decay chain (has to be kept in the event!)


Detailed Description

Definition at line 42 of file TopGenEvent.h.


Constructor & Destructor Documentation

TopGenEvent::TopGenEvent (  )  [inline]

empty constructor

Definition at line 47 of file TopGenEvent.h.

00047 {};

TopGenEvent::TopGenEvent ( reco::GenParticleRefProd parts,
reco::GenParticleRefProd inits 
)

default constructor

default contructor

Definition at line 10 of file TopGenEvent.cc.

References initPartons_, and parts_.

00011 {
00012   parts_ = parts; 
00013   initPartons_= inits;
00014 }

virtual TopGenEvent::~TopGenEvent (  )  [inline, virtual]

default destructor

Definition at line 51 of file TopGenEvent.h.

00051 {};


Member Function Documentation

const reco::GenParticle* TopGenEvent::b (  )  const [inline]

return b quark if available; 0 else

Definition at line 93 of file TopGenEvent.h.

References TopDecayID::bID, and candidate().

Referenced by TtFullHadEventPartons::vec(), and TtFullLepEventPartons::vec().

00093 { return candidate( TopDecayID::bID    );}

const reco::GenParticle* TopGenEvent::bBar (  )  const [inline]

return anti-b quark if available; 0 else

Definition at line 95 of file TopGenEvent.h.

References TopDecayID::bID, and candidate().

Referenced by TtFullHadEventPartons::vec(), and TtFullLepEventPartons::vec().

00095 { return candidate(-TopDecayID::bID    );}

const reco::GenParticle * TopGenEvent::candidate ( int  id  )  const

get candidate with given pdg id if available; 0 else

Definition at line 17 of file TopGenEvent.cc.

References i, and parts_.

Referenced by b(), bBar(), eMinus(), ePlus(), muMinus(), muPlus(), tauMinus(), tauPlus(), top(), topBar(), wMinus(), and wPlus().

00018 {
00019   const reco::GenParticle* cand=0;
00020   const reco::GenParticleCollection & partsColl = *parts_;
00021   for (unsigned int i = 0; i < partsColl.size(); ++i) {
00022     if (partsColl[i].pdgId()==id) {
00023       cand = &partsColl[i];
00024     }
00025   }  
00026   return cand;
00027 }

void TopGenEvent::dumpEventContent (  )  const

print content of the top decay chain as formated LogInfo to the MessageLogger output for debugging

Definition at line 30 of file TopGenEvent.cc.

References funct::log(), and parts_.

00031 {
00032   edm::LogVerbatim log("TopGenEvent");
00033   log << "\n"
00034       << "--------------------------------------\n"
00035       << "- Dump TopGenEvent Content           -\n"
00036       << "--------------------------------------\n";
00037   for (reco::GenParticleCollection::const_iterator part = parts_->begin(); 
00038        part<parts_->end(); ++part) {
00039     log << "pdgId:"  << std::setw(5)  << part->pdgId()     << ", "
00040         << "mass:"   << std::setw(11) << part->p4().mass() << ", "
00041         << "energy:" << std::setw(11) << part->energy()    << ", " 
00042         << "pt:"     << std::setw(11) << part->pt()        << "\n"; 
00043   }
00044 }

const reco::GenParticle* TopGenEvent::eMinus (  )  const [inline]

return electron if available; 0 else

Definition at line 73 of file TopGenEvent.h.

References candidate(), and TopDecayID::elecID.

00073 { return candidate( TopDecayID::elecID );}

const reco::GenParticle* TopGenEvent::ePlus (  )  const [inline]

return positron if available; 0 else

Definition at line 75 of file TopGenEvent.h.

References candidate(), and TopDecayID::elecID.

00075 { return candidate(-TopDecayID::elecID );}

const reco::GenParticleCollection& TopGenEvent::initialPartons (  )  const [inline]

return particles of initial partons

Definition at line 56 of file TopGenEvent.h.

References initPartons_.

00056 { return *initPartons_;}

std::vector< const reco::GenParticle * > TopGenEvent::lightQuarks ( bool  plusB = false  )  const

return all light quarks or all quarks including b's

Definition at line 148 of file TopGenEvent.cc.

References funct::abs(), TopDecayID::bID, edm::errors::InvalidReference, and parts_.

00149 {
00150   std::vector<const reco::GenParticle*> lightQuarks;
00151   reco::GenParticleCollection::const_iterator part = parts_->begin();
00152   for ( ; part < parts_->end(); ++part) {
00153     if( (bIncluded && abs(part->pdgId())==TopDecayID::bID) || abs(part->pdgId())<TopDecayID::bID ) {
00154       if( dynamic_cast<const reco::GenParticle*>( &(*part) ) == 0){
00155         throw edm::Exception( edm::errors::InvalidReference, "Not a GenParticle" );
00156       }
00157       lightQuarks.push_back( part->clone() );
00158     }
00159   }  
00160   return lightQuarks;
00161 }

const reco::GenParticle* TopGenEvent::muMinus (  )  const [inline]

return muon if available; 0 else

Definition at line 77 of file TopGenEvent.h.

References candidate(), and TopDecayID::muonID.

00077 { return candidate( TopDecayID::muonID );}

const reco::GenParticle* TopGenEvent::muPlus (  )  const [inline]

return anti-muon if available; 0 else

Definition at line 79 of file TopGenEvent.h.

References candidate(), and TopDecayID::muonID.

00079 { return candidate(-TopDecayID::muonID );}

int TopGenEvent::numberOfBQuarks ( bool  fromTopQuark = true  )  const

return number of b quarks in the decay chain

Definition at line 111 of file TopGenEvent.cc.

References funct::abs(), TopDecayID::bID, i, parts_, and TopDecayID::tID.

00112 {
00113   int bq=0;
00114   const reco::GenParticleCollection & partsColl = *parts_;
00115   for (unsigned int i = 0; i < partsColl.size(); ++i) {
00116     if (abs(partsColl[i].pdgId())==TopDecayID::bID) {
00117       if(fromTopQuark){
00118         if(partsColl[i].mother() &&  abs(partsColl[i].mother()->pdgId())==TopDecayID::tID){
00119           ++bq;
00120         }
00121       }
00122       else{
00123         ++bq;
00124       }
00125     }
00126   }  
00127   return bq;
00128 }

int TopGenEvent::numberOfLeptons ( WDecay::LeptonType  type,
bool  fromWBoson = true 
) const

return number of leptons in the decay chain

Definition at line 67 of file TopGenEvent.cc.

References funct::abs(), TopDecayID::elecID, i, reco::isLepton(), WDecay::kElec, WDecay::kMuon, WDecay::kNone, WDecay::kTau, TopDecayID::muonID, parts_, TopDecayID::tauID, and TopDecayID::WID.

00068 {
00069   int leptonType=-1;
00070   switch(typeRestriction){
00071     // resolve whether or not there is
00072     // any restriction in lepton types
00073   case WDecay::kElec: 
00074     leptonType=TopDecayID::elecID;
00075     break;
00076   case WDecay::kMuon: 
00077     leptonType=TopDecayID::muonID;
00078     break;
00079   case WDecay::kTau: 
00080     leptonType=TopDecayID::tauID;
00081     break;
00082   case WDecay::kNone:
00083     break;
00084   }
00085   int lep=0;
00086   const reco::GenParticleCollection & partsColl = *parts_;
00087   for(unsigned int i = 0; i < partsColl.size(); ++i) {
00088     if(fromWBoson){
00089       // restrict to particles originating from the W boson
00090       if( !(partsColl[i].mother() &&  abs(partsColl[i].mother()->pdgId())==TopDecayID::WID) ){
00091         continue;
00092       }
00093     }
00094     if(leptonType>0){
00095       // in case of lepton type restriction
00096       if( abs(partsColl[i].pdgId())==leptonType ){
00097         ++lep;
00098       }
00099     }
00100     else{
00101       // take any lepton type into account else
00102       if( reco::isLepton(partsColl[i]) ){
00103         ++lep;
00104       }
00105     }
00106   }  
00107   return lep;
00108 }

int TopGenEvent::numberOfLeptons ( bool  fromWBoson = true  )  const

return number of leptons in the decay chain

Definition at line 47 of file TopGenEvent.cc.

References funct::abs(), i, reco::isLepton(), parts_, and TopDecayID::WID.

Referenced by TtGenEvent::isNumberOfLeptons().

00048 {
00049   int lep=0;
00050   const reco::GenParticleCollection & partsColl = *parts_;
00051   for (unsigned int i = 0; i < partsColl.size(); ++i) {
00052     if (reco::isLepton(partsColl[i])) {
00053       if(fromWBoson){
00054         if(partsColl[i].mother() &&  abs(partsColl[i].mother()->pdgId())==TopDecayID::WID){
00055           ++lep;
00056         }
00057       }
00058       else{
00059         ++lep;
00060       }
00061     }
00062   }  
00063   return lep;
00064 }

const reco::GenParticleCollection& TopGenEvent::particles (  )  const [inline]

return particles of decay chain

Definition at line 54 of file TopGenEvent.h.

References parts_.

00054 { return *parts_; }

std::vector< const reco::GenParticle * > TopGenEvent::radiatedGluons ( int  pdgId  )  const

return radiated gluons from particle with pdgId

Definition at line 164 of file TopGenEvent.cc.

References TopDecayID::glueID, edm::errors::InvalidReference, and parts_.

Referenced by TtGenEvent::hadronicDecayTopRadiation(), and TtGenEvent::leptonicDecayTopRadiation().

00164                                           {
00165   std::vector<const reco::GenParticle*> rads;
00166   for (reco::GenParticleCollection::const_iterator part = parts_->begin(); part < parts_->end(); ++part) {
00167     if(part->pdgId()==TopDecayID::glueID){
00168       if ( part->mother() && part->mother()->pdgId()==pdgId ){
00169         if( dynamic_cast<const reco::GenParticle*>( &(*part) ) == 0){
00170           throw edm::Exception( edm::errors::InvalidReference, "Not a GenParticle" );
00171         }
00172         rads.push_back( part->clone() );
00173       }
00174     }
00175   }  
00176   return rads;
00177 }

const reco::GenParticle* TopGenEvent::tauMinus (  )  const [inline]

return tau if available; 0 else

Definition at line 81 of file TopGenEvent.h.

References candidate(), and TopDecayID::tauID.

00081 { return candidate( TopDecayID::tauID  );}

const reco::GenParticle* TopGenEvent::tauPlus (  )  const [inline]

return anti-tau if available; 0 else

Definition at line 83 of file TopGenEvent.h.

References candidate(), and TopDecayID::tauID.

00083 { return candidate(-TopDecayID::tauID  );}

const reco::GenParticle* TopGenEvent::top (  )  const [inline]

return top if available; 0 else

Definition at line 89 of file TopGenEvent.h.

References candidate(), and TopDecayID::tID.

Referenced by TtGenEvent::isTtBar().

00089 { return candidate( TopDecayID::tID    );}

const reco::GenParticle* TopGenEvent::topBar (  )  const [inline]

return anti-top if available; 0 else

Definition at line 91 of file TopGenEvent.h.

References candidate(), and TopDecayID::tID.

Referenced by TtGenEvent::isTtBar().

00091 { return candidate(-TopDecayID::tID    );}

std::vector< const reco::GenParticle * > TopGenEvent::topSisters (  )  const

return number of top anti-top sisters

Definition at line 131 of file TopGenEvent.cc.

References funct::abs(), edm::errors::InvalidReference, parts_, and TopDecayID::tID.

00132 {
00133   std::vector<const reco::GenParticle*> sisters;
00134   for(reco::GenParticleCollection::const_iterator part = parts_->begin(); part<parts_->end(); ++part){
00135     if( part->numberOfMothers()==0 && abs(part->pdgId())!= TopDecayID::tID){
00136       // choose top sister which do not have a 
00137       // mother and are whether top nor anti-top 
00138       if( dynamic_cast<const reco::GenParticle*>( &(*part) ) == 0){
00139         throw edm::Exception( edm::errors::InvalidReference, "Not a GenParticle" );
00140       }
00141       sisters.push_back( part->clone() );
00142     }
00143   }  
00144   return sisters;
00145 }

const reco::GenParticle* TopGenEvent::wMinus (  )  const [inline]

return W minus if available; 0 else

Definition at line 85 of file TopGenEvent.h.

References candidate(), and TopDecayID::WID.

00085 { return candidate( TopDecayID::WID    );}

const reco::GenParticle* TopGenEvent::wPlus (  )  const [inline]

return W plus if available; 0 else

Definition at line 87 of file TopGenEvent.h.

References candidate(), and TopDecayID::WID.

00087 { return candidate(-TopDecayID::WID    );}


Member Data Documentation

reco::GenParticleRefProd TopGenEvent::initPartons_ [protected]

reference to the list of initial partons (has to be kept in the event!)

Definition at line 107 of file TopGenEvent.h.

Referenced by initialPartons(), StGenEvent::StGenEvent(), TopGenEvent(), and TtGenEvent::TtGenEvent().

reco::GenParticleRefProd TopGenEvent::parts_ [protected]

reference to the top decay chain (has to be kept in the event!)

Definition at line 105 of file TopGenEvent.h.

Referenced by StGenEvent::associatedB(), candidate(), StGenEvent::decayB(), dumpEventContent(), TtGenEvent::hadronicDecayB(), TtGenEvent::hadronicDecayQuark(), TtGenEvent::hadronicDecayTop(), TtGenEvent::hadronicDecayW(), TtGenEvent::lepton(), TtGenEvent::leptonBar(), TtGenEvent::leptonicDecayB(), TtGenEvent::leptonicDecayTop(), TtGenEvent::leptonicDecayW(), TtGenEvent::lightQBarFromTop(), TtGenEvent::lightQBarFromTopBar(), TtGenEvent::lightQFromTop(), TtGenEvent::lightQFromTopBar(), lightQuarks(), TtGenEvent::neutrino(), TtGenEvent::neutrinoBar(), numberOfBQuarks(), numberOfLeptons(), particles(), radiatedGluons(), TtGenEvent::singleLepton(), StGenEvent::singleLepton(), TtGenEvent::singleNeutrino(), StGenEvent::singleNeutrino(), StGenEvent::singleTop(), StGenEvent::singleW(), StGenEvent::StGenEvent(), TopGenEvent(), topSisters(), and TtGenEvent::TtGenEvent().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:41 2009 for CMSSW by  doxygen 1.5.4