test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Types

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

Public Member Functions

 TtSemiLepEvtPartons (const std::vector< std::string > &partonsToIgnore=std::vector< std::string >())
 default constructor More...
 
std::vector< const
reco::Candidate * > 
vec (const TtGenEvent &genEvt)
 return vector of partons in the order defined in the corresponding enum More...
 
 ~TtSemiLepEvtPartons ()
 default destructor More...
 
- Public Member Functions inherited from TtEventPartons
void expand (std::vector< int > &vec)
 insert dummy index -3 for all partons that were chosen to be ignored More...
 
 TtEventPartons ()
 default constructor More...
 
virtual ~TtEventPartons ()
 default destructor More...
 

Additional Inherited Members

- Protected Member Functions inherited from TtEventPartons
reco::CandidatedummyCandidatePtr () const
 return pointer to an empty reco::Candidate More...
 
void prune (std::vector< const reco::Candidate * > &vec)
 erase partons from vector if they where chosen to be ignored More...
 
- Protected Attributes inherited from TtEventPartons
std::vector< bool > ignorePartons_
 flag partons that were chosen not to be used More...
 

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 edm::hlt::Exception, HadB, i, TtEventPartons::ignorePartons_, LepB, LightQ, and LightQBar.

7 {
8  // default: use all partons
9  for(unsigned int i = 0; i < 4; i++)
10  ignorePartons_.push_back(false);
11  // read vector of strings and flag partons to be ignored
12  for(std::vector<std::string>::const_iterator str = partonsToIgnore.begin(); str != partonsToIgnore.end(); ++str) {
13  if ((*str) == "LightQ" ) ignorePartons_[LightQ ] = true;
14  else if((*str) == "LightQBar") ignorePartons_[LightQBar] = true;
15  else if((*str) == "HadB" ) ignorePartons_[HadB ] = true;
16  else if((*str) == "LepB" ) ignorePartons_[LepB ] = true;
17  else throw cms::Exception("Configuration")
18  << "The following string in partonsToIgnore is not supported: " << (*str) << "\n";
19  }
20 }
int i
Definition: DBlmapReader.cc:9
std::vector< bool > ignorePartons_
flag partons that were chosen not to be used
TtSemiLepEvtPartons::~TtSemiLepEvtPartons ( )
inline

default destructor

Definition at line 32 of file TtSemiLepEvtPartons.h.

32 {};

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

24 {
25  std::vector<const reco::Candidate*> vec;
26 
27  if(genEvt.isSemiLeptonic()) {
28  // fill vector with partons from genEvent
29  // (use enum for positions of the partons in the vector)
30  vec.resize(4);
31  vec[LightQ ] = genEvt.hadronicDecayQuark() ? genEvt.hadronicDecayQuark() : dummyCandidatePtr();
33  vec[HadB ] = genEvt.hadronicDecayB() ? genEvt.hadronicDecayB() : dummyCandidatePtr();
34  vec[LepB ] = genEvt.leptonicDecayB() ? genEvt.leptonicDecayB() : dummyCandidatePtr();
35  }
36  else {
37  // fill vector with dummy objects if the event is not semi-leptonic ttbar
38  for(unsigned i=0; i<4; i++)
39  vec.push_back( dummyCandidatePtr() );
40  }
41 
42  // erase partons from vector if they where chosen to be ignored
43  prune(vec);
44 
45  return vec;
46 }
std::vector< const reco::Candidate * > vec(const TtGenEvent &genEvt)
return vector of partons in the order defined in the corresponding enum
int i
Definition: DBlmapReader.cc:9
const reco::GenParticle * hadronicDecayB(bool excludeTauLeptons=false) const
get b of hadronic decay branch
Definition: TtGenEvent.cc:196
bool isSemiLeptonic(bool excludeTauLeptons=false) const
check if the event can be classified as semi-laptonic
Definition: TtGenEvent.h:38
const reco::GenParticle * hadronicDecayQuarkBar() const
get light anti-quark of hadronic decay branch
Definition: TtGenEvent.h:72
void prune(std::vector< const reco::Candidate * > &vec)
erase partons from vector if they where chosen to be ignored
const reco::GenParticle * hadronicDecayQuark(bool invertFlavor=false) const
get light quark of hadronic decay branch
Definition: TtGenEvent.cc:166
const reco::GenParticle * leptonicDecayB(bool excludeTauLeptons=false) const
get b of leptonic decay branch
Definition: TtGenEvent.cc:248
reco::Candidate * dummyCandidatePtr() const
return pointer to an empty reco::Candidate