CMS 3D CMS Logo

Public Member Functions | Protected Attributes | Private Member Functions

TtGenEvent Class Reference

Class derived from the TopGenEvent for ttbar events. More...

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

Inheritance diagram for TtGenEvent:
TopGenEvent

List of all members.

Public Member Functions

bool fromGluonFusion () const
 check if the tops were produced from a pair of gluons
bool fromQuarkAnnihilation () const
 check if the tops were produced from qqbar
std::pair< WDecay::LeptonType,
WDecay::LeptonType
fullLeptonicChannel () const
const reco::GenParticlehadronicDecayB (bool excludeTauLeptons=false) const
 get b of hadronic decay branch
const reco::GenParticlehadronicDecayQuark (bool invertFlavor=false) const
 get light quark of hadronic decay branch
const reco::GenParticlehadronicDecayQuarkBar () const
 get light anti-quark of hadronic decay branch
const reco::GenParticlehadronicDecayTop (bool excludeTauLeptons=false) const
 get top of hadronic decay branch
std::vector< const
reco::GenParticle * > 
hadronicDecayTopRadiation (bool excludeTauLeptons=false) const
 gluons as radiated from the hadronicly decaying top quark
const reco::GenParticlehadronicDecayW (bool excludeTauLeptons=false) const
 get W of hadronic decay branch
bool isFullHadronic (bool excludeTauLeptons=false) const
 check if the event can be classified as full hadronic
bool isFullLeptonic (bool excludeTauLeptons=false) const
 check if the event can be classified as full leptonic
bool isFullLeptonic (WDecay::LeptonType typeA, WDecay::LeptonType typeB) const
 check if the event is full leptonic with the lepton being of typeA or typeB irrelevant of order; all leptons including taus are allowed
bool isSemiLeptonic (bool excludeTauLeptons=false) const
 check if the event can be classified as semi-laptonic
bool isSemiLeptonic (WDecay::LeptonType typeA) const
 check if the event is semi-leptonic with the lepton being of typeA; all leptons including taus are allowed
bool isSemiLeptonic (WDecay::LeptonType typeA, WDecay::LeptonType typeB) const
 check if the event is semi-leptonic with the lepton being of typeA or typeB; all leptons including taus are allowed
bool isTtBar () const
 check if the event can be classified as ttbar
const reco::GenParticlelepton (bool excludeTauLeptons=false) const
 get lepton for semi-leptonic or full leptonic decays
const reco::GenParticleleptonBar (bool excludeTauLeptons=false) const
 get anti-lepton for semi-leptonic or full leptonic decays
const reco::GenParticleleptonicDecayB (bool excludeTauLeptons=false) const
 get b of leptonic decay branch
const reco::GenParticleleptonicDecayTop (bool excludeTauLeptons=false) const
 get top of leptonic decay branch
std::vector< const
reco::GenParticle * > 
leptonicDecayTopRadiation (bool excludeTauLeptons=false) const
 gluons as radiated from the leptonicly decaying top quark
const reco::GenParticleleptonicDecayW (bool excludeTauLeptons=false) const
 get W of leptonic decay branch
const reco::GenParticleneutrino (bool excludeTauLeptons=false) const
 get neutrino for semi-leptonic or full leptonic decays
const reco::GenParticleneutrinoBar (bool excludeTauLeptons=false) const
 get anti-neutrino for semi-leptonic or full leptonic decays
WDecay::LeptonType semiLeptonicChannel () const
 return decay channel; all leptons including taus are allowed
const reco::GenParticlesingleLepton (bool excludeTauLeptons=false) const
 return single lepton if available; 0 else
const reco::GenParticlesingleNeutrino (bool excludeTauLeptons=false) const
 return single neutrino if available; 0 else
const math::XYZTLorentzVectortopPair () const
 return combined 4-vector of top and topBar
 TtGenEvent (reco::GenParticleRefProd &decaySubset, reco::GenParticleRefProd &initSubset)
 default constructor from decaySubset and initSubset
 TtGenEvent ()
 empty constructor
virtual ~TtGenEvent ()
 default destructor

Protected Attributes

math::XYZTLorentzVector topPair_
 combined 4-vector of top and topBar

Private Member Functions

bool isNumberOfLeptons (bool excludeTauLeptons, int nlep) const

Detailed Description

Class derived from the TopGenEvent for ttbar events.

The structure holds reference information to the generator particles of the decay chains for each top quark and of the initial partons and provides access and administration. The derived class contains a few additional getters with respect to its base class.

Definition at line 18 of file TtGenEvent.h.


Constructor & Destructor Documentation

TtGenEvent::TtGenEvent ( ) [inline]

empty constructor

Definition at line 23 of file TtGenEvent.h.

{};
TtGenEvent::TtGenEvent ( reco::GenParticleRefProd decaySubset,
reco::GenParticleRefProd initSubset 
)
virtual TtGenEvent::~TtGenEvent ( ) [inline, virtual]

default destructor

Definition at line 27 of file TtGenEvent.h.

{};

Member Function Documentation

bool TtGenEvent::fromGluonFusion ( ) const

check if the tops were produced from a pair of gluons

Definition at line 20 of file TtGenEvent.cc.

References TopGenEvent::initPartons_, and benchmark_cfg::pdgId.

{
  const reco::GenParticleCollection& initPartsColl = *initPartons_;
  if(initPartsColl.size()==2)
    if(initPartsColl[0].pdgId()==21 && initPartsColl[1].pdgId()==21)
      return true;
  return false;
}
bool TtGenEvent::fromQuarkAnnihilation ( ) const

check if the tops were produced from qqbar

Definition at line 30 of file TtGenEvent.cc.

References abs, TopGenEvent::initPartons_, benchmark_cfg::pdgId, and TopDecayID::tID.

{
  const reco::GenParticleCollection& initPartsColl = *initPartons_;
  if(initPartsColl.size()==2)
    if(std::abs(initPartsColl[0].pdgId())<TopDecayID::tID && initPartsColl[0].pdgId()==-initPartsColl[1].pdgId())
      return true;
  return false;
}
std::pair< WDecay::LeptonType, WDecay::LeptonType > TtGenEvent::fullLeptonicChannel ( ) const
const reco::GenParticle * TtGenEvent::hadronicDecayB ( bool  excludeTauLeptons = false) const

get b of hadronic decay branch

Definition at line 197 of file TtGenEvent.cc.

References abs, TopDecayID::bID, reco::flavour(), i, TopGenEvent::parts_, benchmark_cfg::pdgId, and singleLepton().

Referenced by TtSemiLepEvtPartons::vec().

{
  const reco::GenParticle* cand=0;
  if( singleLepton(excludeTauLeptons) ){
    const reco::GenParticleCollection& partsColl = *parts_;
    const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
    for (unsigned int i = 0; i < partsColl.size(); ++i) {
      if (std::abs(partsColl[i].pdgId())==TopDecayID::bID && 
          reco::flavour(singleLep)==reco::flavour(partsColl[i])) {
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
const reco::GenParticle * TtGenEvent::hadronicDecayQuark ( bool  invertFlavor = false) const

get light quark of hadronic decay branch

Definition at line 167 of file TtGenEvent.cc.

References abs, Exception, reco::flavour(), edm::errors::InvalidReference, TopGenEvent::parts_, singleLepton(), TopDecayID::tID, w(), and TopDecayID::WID.

Referenced by hadronicDecayQuarkBar(), and TtSemiLepEvtPartons::vec().

{
  const reco::GenParticle* cand=0;
  // catch W boson and check its daughters for a quark; 
  // make sure the decay is semi-leptonic first; this 
  // only makes sense if taus are not excluded from the 
  // decision
  if( singleLepton(false) ){
    for(reco::GenParticleCollection::const_iterator w=parts_->begin(); w!=parts_->end(); ++w){
      if( std::abs( w->pdgId() )==TopDecayID::WID ){
        // make sure that the particle is a W daughter
        for(reco::GenParticle::const_iterator wd=w->begin(); wd!=w->end(); ++wd){ 
          // make sure that the parton is a quark
          if( std::abs(wd->pdgId())<TopDecayID::tID ){
            if( invertFlavor?reco::flavour(*wd)<0:reco::flavour(*wd)>0 ){
              cand = dynamic_cast<const reco::GenParticle* > (&(*wd));
              if(cand == 0){
                throw edm::Exception( edm::errors::InvalidReference, "Not a GenParticle" );
              }
              break;
            }
          }
        }
      }
    }
  }
  return cand;
}
const reco::GenParticle* TtGenEvent::hadronicDecayQuarkBar ( ) const [inline]

get light anti-quark of hadronic decay branch

Definition at line 72 of file TtGenEvent.h.

References hadronicDecayQuark().

Referenced by TtSemiLepEvtPartons::vec().

{return hadronicDecayQuark(true); };
const reco::GenParticle * TtGenEvent::hadronicDecayTop ( bool  excludeTauLeptons = false) const

get top of hadronic decay branch

Definition at line 232 of file TtGenEvent.cc.

References abs, reco::flavour(), i, TopGenEvent::parts_, benchmark_cfg::pdgId, singleLepton(), and TopDecayID::tID.

Referenced by hadronicDecayTopRadiation().

{
  const reco::GenParticle* cand=0;
  if( singleLepton(excludeTauLeptons) ){
    const reco::GenParticleCollection& partsColl = *parts_;
    const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
    for (unsigned int i = 0; i < partsColl.size(); ++i) {
      if (std::abs(partsColl[i].pdgId())==TopDecayID::tID &&
          reco::flavour(singleLep)==reco::flavour(partsColl[i])) {
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
std::vector< const reco::GenParticle * > TtGenEvent::hadronicDecayTopRadiation ( bool  excludeTauLeptons = false) const

gluons as radiated from the hadronicly decaying top quark

Definition at line 308 of file TtGenEvent.cc.

References hadronicDecayTop(), benchmark_cfg::pdgId, TopGenEvent::radiatedGluons(), and TopDecayID::tID.

                                                                                                   {
  if( hadronicDecayTop(excludeTauLeptons) ){
    return (hadronicDecayTop(excludeTauLeptons)->pdgId()>0 ? radiatedGluons(TopDecayID::tID) : radiatedGluons(-TopDecayID::tID));
  }
  std::vector<const reco::GenParticle*> rad;
  return (rad);
}
const reco::GenParticle * TtGenEvent::hadronicDecayW ( bool  excludeTauLeptons = false) const

get W of hadronic decay branch

Definition at line 214 of file TtGenEvent.cc.

References abs, reco::flavour(), i, TopGenEvent::parts_, benchmark_cfg::pdgId, singleLepton(), and TopDecayID::WID.

{
  const reco::GenParticle* cand=0;
  if( singleLepton(excludeTauLeptons) ){
    const reco::GenParticleCollection& partsColl = *parts_;
    const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
    for (unsigned int i = 0; i < partsColl.size(); ++i) {
      if (std::abs(partsColl[i].pdgId())==TopDecayID::WID && 
          reco::flavour(singleLep) != -reco::flavour(partsColl[i])) { 
        // PDG Id:13=mu- 24=W+ (+24)->(-13) (-24)->(+13) opposite sign
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
bool TtGenEvent::isFullHadronic ( bool  excludeTauLeptons = false) const [inline]

check if the event can be classified as full hadronic

Definition at line 36 of file TtGenEvent.h.

References isNumberOfLeptons(), and isTtBar().

Referenced by TtFullHadEvtPartons::vec().

{ return isTtBar() ? isNumberOfLeptons(excludeTauLeptons, 0) : false;}
bool TtGenEvent::isFullLeptonic ( WDecay::LeptonType  typeA,
WDecay::LeptonType  typeB 
) const [inline]

check if the event is full leptonic with the lepton being of typeA or typeB irrelevant of order; all leptons including taus are allowed

Definition at line 102 of file TtGenEvent.h.

References first, fullLeptonicChannel(), and edm::second().

{
  return ( (fullLeptonicChannel().first==typeA && fullLeptonicChannel().second==typeB)||
           (fullLeptonicChannel().first==typeB && fullLeptonicChannel().second==typeA));
}
bool TtGenEvent::isFullLeptonic ( bool  excludeTauLeptons = false) const [inline]

check if the event can be classified as full leptonic

Definition at line 40 of file TtGenEvent.h.

References isNumberOfLeptons(), and isTtBar().

Referenced by fullLeptonicChannel(), and TtFullLepEvtPartons::vec().

{ return isTtBar() ? isNumberOfLeptons(excludeTauLeptons, 2) : false;}
bool TtGenEvent::isNumberOfLeptons ( bool  excludeTauLeptons,
int  nlep 
) const [inline, private]

check whether the number of leptons among the daughters of the W boson is nlep or not; there is an option to exclude taus from the list of leptons to consider

Definition at line 98 of file TtGenEvent.h.

References WDecay::kTau, and TopGenEvent::numberOfLeptons().

Referenced by isFullHadronic(), isFullLeptonic(), and isSemiLeptonic().

{return excludeTauLeptons ? (numberOfLeptons()-numberOfLeptons(WDecay::kTau))==nlep : numberOfLeptons()==nlep;}
bool TtGenEvent::isSemiLeptonic ( WDecay::LeptonType  typeA) const [inline]

check if the event is semi-leptonic with the lepton being of typeA; all leptons including taus are allowed

Definition at line 45 of file TtGenEvent.h.

References semiLeptonicChannel().

{ return semiLeptonicChannel()==typeA ? true : false; };
bool TtGenEvent::isSemiLeptonic ( WDecay::LeptonType  typeA,
WDecay::LeptonType  typeB 
) const [inline]

check if the event is semi-leptonic with the lepton being of typeA or typeB; all leptons including taus are allowed

Definition at line 47 of file TtGenEvent.h.

References semiLeptonicChannel().

{ return (semiLeptonicChannel()==typeA || semiLeptonicChannel()==typeB)? true : false; };
bool TtGenEvent::isSemiLeptonic ( bool  excludeTauLeptons = false) const [inline]

check if the event can be classified as semi-laptonic

Definition at line 38 of file TtGenEvent.h.

References isNumberOfLeptons(), and isTtBar().

Referenced by semiLeptonicChannel(), singleLepton(), singleNeutrino(), and TtSemiLepEvtPartons::vec().

{ return isTtBar() ? isNumberOfLeptons(excludeTauLeptons, 1) : false;}
bool TtGenEvent::isTtBar ( ) const [inline]

check if the event can be classified as ttbar

Definition at line 30 of file TtGenEvent.h.

References TopGenEvent::top(), and TopGenEvent::topBar().

Referenced by isFullHadronic(), isFullLeptonic(), and isSemiLeptonic().

{return (top() && topBar());}
const reco::GenParticle * TtGenEvent::lepton ( bool  excludeTauLeptons = false) const

get lepton for semi-leptonic or full leptonic decays

Definition at line 71 of file TtGenEvent.cc.

References abs, reco::flavour(), i, reco::isLepton(), TopGenEvent::parts_, benchmark_cfg::pdgId, and TopDecayID::WID.

Referenced by fullLeptonicChannel().

{
  const reco::GenParticle* cand = 0;
  const reco::GenParticleCollection& partsColl = *parts_;
  for (unsigned int i = 0; i < partsColl.size(); ++i) {
    if (reco::isLepton(partsColl[i]) && partsColl[i].mother() &&
        std::abs(partsColl[i].mother()->pdgId())==TopDecayID::WID) {
      if(reco::flavour(partsColl[i])>0){
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
const reco::GenParticle * TtGenEvent::leptonBar ( bool  excludeTauLeptons = false) const

get anti-lepton for semi-leptonic or full leptonic decays

Definition at line 87 of file TtGenEvent.cc.

References abs, reco::flavour(), i, reco::isLepton(), TopGenEvent::parts_, benchmark_cfg::pdgId, and TopDecayID::WID.

Referenced by fullLeptonicChannel().

{
  const reco::GenParticle* cand = 0;
  const reco::GenParticleCollection& partsColl = *parts_;
  for (unsigned int i = 0; i < partsColl.size(); ++i) {
    if (reco::isLepton(partsColl[i]) && partsColl[i].mother() &&
        std::abs(partsColl[i].mother()->pdgId())==TopDecayID::WID) {
      if(reco::flavour(partsColl[i])<0){
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
const reco::GenParticle * TtGenEvent::leptonicDecayB ( bool  excludeTauLeptons = false) const

get b of leptonic decay branch

Definition at line 249 of file TtGenEvent.cc.

References abs, TopDecayID::bID, reco::flavour(), i, TopGenEvent::parts_, benchmark_cfg::pdgId, and singleLepton().

Referenced by TtSemiLepEvtPartons::vec().

{
  const reco::GenParticle* cand=0;
  if( singleLepton(excludeTauLeptons) ){
    const reco::GenParticleCollection& partsColl = *parts_;
    const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
    for (unsigned int i = 0; i < partsColl.size(); ++i) {
      if (std::abs(partsColl[i].pdgId())==TopDecayID::bID &&
          reco::flavour(singleLep)!=reco::flavour(partsColl[i])) {
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
const reco::GenParticle * TtGenEvent::leptonicDecayTop ( bool  excludeTauLeptons = false) const

get top of leptonic decay branch

Definition at line 284 of file TtGenEvent.cc.

References abs, reco::flavour(), i, TopGenEvent::parts_, benchmark_cfg::pdgId, singleLepton(), and TopDecayID::tID.

Referenced by leptonicDecayTopRadiation().

{
  const reco::GenParticle* cand=0;
  if( singleLepton(excludeTauLeptons) ){
    const reco::GenParticleCollection& partsColl = *parts_;
    const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
    for( unsigned int i = 0; i < partsColl.size(); ++i ){
      if( std::abs(partsColl[i].pdgId())==TopDecayID::tID &&
          reco::flavour(singleLep)!=reco::flavour(partsColl[i]) ){
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
std::vector< const reco::GenParticle * > TtGenEvent::leptonicDecayTopRadiation ( bool  excludeTauLeptons = false) const

gluons as radiated from the leptonicly decaying top quark

Definition at line 300 of file TtGenEvent.cc.

References leptonicDecayTop(), benchmark_cfg::pdgId, TopGenEvent::radiatedGluons(), and TopDecayID::tID.

                                                                                                   {
  if( leptonicDecayTop(excludeTauLeptons) ){
    return (leptonicDecayTop(excludeTauLeptons)->pdgId()>0 ? radiatedGluons(TopDecayID::tID) : radiatedGluons(-TopDecayID::tID));
  }
  std::vector<const reco::GenParticle*> rad;
  return (rad);
}
const reco::GenParticle * TtGenEvent::leptonicDecayW ( bool  excludeTauLeptons = false) const

get W of leptonic decay branch

Definition at line 266 of file TtGenEvent.cc.

References abs, reco::flavour(), i, TopGenEvent::parts_, benchmark_cfg::pdgId, singleLepton(), and TopDecayID::WID.

{
  const reco::GenParticle* cand=0;
  if( singleLepton(excludeTauLeptons) ){
    const reco::GenParticleCollection& partsColl = *parts_;
    const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
    for (unsigned int i = 0; i < partsColl.size(); ++i) {
      if (std::abs(partsColl[i].pdgId())==TopDecayID::WID &&
          reco::flavour(singleLep) == - reco::flavour(partsColl[i])) { 
        // PDG Id:13=mu- 24=W+ (+24)->(-13) (-24)->(+13) opposite sign
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
const reco::GenParticle * TtGenEvent::neutrino ( bool  excludeTauLeptons = false) const

get neutrino for semi-leptonic or full leptonic decays

Definition at line 119 of file TtGenEvent.cc.

References abs, reco::flavour(), i, reco::isNeutrino(), TopGenEvent::parts_, benchmark_cfg::pdgId, and TopDecayID::WID.

{
  const reco::GenParticle* cand=0;
  const reco::GenParticleCollection & partsColl = *parts_;
  for (unsigned int i = 0; i < partsColl.size(); ++i) {
    if (reco::isNeutrino(partsColl[i]) && partsColl[i].mother() &&
        std::abs(partsColl[i].mother()->pdgId())==TopDecayID::WID) {
      if(reco::flavour(partsColl[i])>0){
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
const reco::GenParticle * TtGenEvent::neutrinoBar ( bool  excludeTauLeptons = false) const

get anti-neutrino for semi-leptonic or full leptonic decays

Definition at line 135 of file TtGenEvent.cc.

References abs, reco::flavour(), i, reco::isNeutrino(), TopGenEvent::parts_, benchmark_cfg::pdgId, and TopDecayID::WID.

{
  const reco::GenParticle* cand=0;
  const reco::GenParticleCollection & partsColl = *parts_;
  for (unsigned int i = 0; i < partsColl.size(); ++i) {
    if (reco::isNeutrino(partsColl[i]) && partsColl[i].mother() &&
        std::abs(partsColl[i].mother()->pdgId())==TopDecayID::WID) {
      if(reco::flavour(partsColl[i])<0){
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
WDecay::LeptonType TtGenEvent::semiLeptonicChannel ( ) const
const reco::GenParticle * TtGenEvent::singleLepton ( bool  excludeTauLeptons = false) const

return single lepton if available; 0 else

Definition at line 103 of file TtGenEvent.cc.

References abs, i, reco::isLepton(), isSemiLeptonic(), TopGenEvent::parts_, benchmark_cfg::pdgId, and TopDecayID::WID.

Referenced by hadronicDecayB(), hadronicDecayQuark(), hadronicDecayTop(), hadronicDecayW(), leptonicDecayB(), leptonicDecayTop(), leptonicDecayW(), and semiLeptonicChannel().

{
  const reco::GenParticle* cand = 0;
  if( isSemiLeptonic(excludeTauLeptons) ){
    const reco::GenParticleCollection& partsColl = *parts_;
    for (unsigned int i = 0; i < partsColl.size(); ++i) {
      if (reco::isLepton(partsColl[i]) && partsColl[i].mother() &&
          std::abs(partsColl[i].mother()->pdgId())==TopDecayID::WID) {
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
const reco::GenParticle * TtGenEvent::singleNeutrino ( bool  excludeTauLeptons = false) const

return single neutrino if available; 0 else

Definition at line 151 of file TtGenEvent.cc.

References abs, i, reco::isNeutrino(), isSemiLeptonic(), TopGenEvent::parts_, benchmark_cfg::pdgId, and TopDecayID::WID.

{
  const reco::GenParticle* cand=0;
  if( isSemiLeptonic(excludeTauLeptons) ) {
    const reco::GenParticleCollection & partsColl = *parts_;
    for (unsigned int i = 0; i < partsColl.size(); ++i) {
      if (reco::isNeutrino(partsColl[i]) && partsColl[i].mother() &&
          std::abs(partsColl[i].mother()->pdgId())==TopDecayID::WID) {
        cand = &partsColl[i];
      }
    }
  }
  return cand;
}
const math::XYZTLorentzVector* TtGenEvent::topPair ( ) const [inline]

return combined 4-vector of top and topBar

Definition at line 87 of file TtGenEvent.h.

{ return isTtBar() ? &topPair_ : 0; };

Member Data Documentation

combined 4-vector of top and topBar

Definition at line 87 of file TtGenEvent.h.

Referenced by TtGenEvent().