CMS 3D CMS Logo

Public Types | Public Member Functions

TtSemiLepEvtPartons Class Reference

Class to fill partons in a well defined order for semi-leptonic ttbar events. More...

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

Inheritance diagram for TtSemiLepEvtPartons:
TtEventPartons

List of all members.

Public Types

enum  {
  LightQ, LightQBar, HadB, LepB,
  Lepton
}

Public Member Functions

 TtSemiLepEvtPartons (const std::vector< std::string > &partonsToIgnore=std::vector< std::string >())
 default constructor
std::vector< const
reco::Candidate * > 
vec (const TtGenEvent &genEvt)
 return vector of partons in the order defined in the corresponding enum
 ~TtSemiLepEvtPartons ()
 default destructor

Detailed Description

Class to fill partons in a well defined order for semi-leptonic ttbar events.

This class is mainly used for the jet-parton matching in TopTools.

Definition at line 19 of file TtSemiLepEvtPartons.h.


Member Enumeration Documentation

anonymous enum

semi-leptonic parton enum used to define the order in the vector for lepton and jet combinatorics

Enumerator:
LightQ 
LightQBar 
HadB 
LepB 
Lepton 

Definition at line 25 of file TtSemiLepEvtPartons.h.


Constructor & Destructor Documentation

TtSemiLepEvtPartons::TtSemiLepEvtPartons ( const std::vector< std::string > &  partonsToIgnore = std::vector<std::string>())

default constructor

Definition at line 6 of file TtSemiLepEvtPartons.cc.

References Exception, HadB, i, TtEventPartons::ignorePartons_, LepB, LightQ, and LightQBar.

{
  // default: use all partons
  for(unsigned int i = 0; i < 4; i++)
    ignorePartons_.push_back(false);
  // read vector of strings and flag partons to be ignored
  for(std::vector<std::string>::const_iterator str = partonsToIgnore.begin(); str != partonsToIgnore.end(); ++str) {
    if     ((*str) == "LightQ"   ) ignorePartons_[LightQ   ] = true;
    else if((*str) == "LightQBar") ignorePartons_[LightQBar] = true;
    else if((*str) == "HadB"     ) ignorePartons_[HadB     ] = true;
    else if((*str) == "LepB"     ) ignorePartons_[LepB     ] = true;
    else throw cms::Exception("Configuration")
      << "The following string in partonsToIgnore is not supported: " << (*str) << "\n";
  }
}
TtSemiLepEvtPartons::~TtSemiLepEvtPartons ( ) [inline]

default destructor

Definition at line 32 of file TtSemiLepEvtPartons.h.

{};

Member Function Documentation

std::vector< const reco::Candidate * > TtSemiLepEvtPartons::vec ( const TtGenEvent genEvt) [virtual]

return vector of partons in the order defined in the corresponding enum

Implements TtEventPartons.

Definition at line 23 of file TtSemiLepEvtPartons.cc.

References TtEventPartons::dummyCandidatePtr(), HadB, TtGenEvent::hadronicDecayB(), TtGenEvent::hadronicDecayQuark(), TtGenEvent::hadronicDecayQuarkBar(), i, TtGenEvent::isSemiLeptonic(), LepB, TtGenEvent::leptonicDecayB(), LightQ, LightQBar, and TtEventPartons::prune().

{
  std::vector<const reco::Candidate*> vec;

  if(genEvt.isSemiLeptonic()) {
    // fill vector with partons from genEvent
    // (use enum for positions of the partons in the vector)
    vec.resize(4);
    vec[LightQ   ] = genEvt.hadronicDecayQuark()    ? genEvt.hadronicDecayQuark()    : dummyCandidatePtr();
    vec[LightQBar] = genEvt.hadronicDecayQuarkBar() ? genEvt.hadronicDecayQuarkBar() : dummyCandidatePtr();
    vec[HadB     ] = genEvt.hadronicDecayB()        ? genEvt.hadronicDecayB()        : dummyCandidatePtr();
    vec[LepB     ] = genEvt.leptonicDecayB()        ? genEvt.leptonicDecayB()        : dummyCandidatePtr();
  }
  else {
    // fill vector with dummy objects if the event is not semi-leptonic ttbar
    for(unsigned i=0; i<4; i++)
      vec.push_back( dummyCandidatePtr() );
  }

  // erase partons from vector if they where chosen to be ignored
  prune(vec);

  return vec;
}