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
TtFullHadEvtPartons Class Reference

Class to fill partons in a well defined order for fully-hadronic ttbar events. More...

#include "AnalysisDataFormats/TopObjects/interface/TtFullHadEvtPartons.h"

Inheritance diagram for TtFullHadEvtPartons:
TtEventPartons

Public Types

enum  {
  LightQ, LightQBar, B, LightP,
  LightPBar, BBar
}
 

Public Member Functions

 TtFullHadEvtPartons (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...
 
 ~TtFullHadEvtPartons ()
 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 fully-hadronic ttbar events.

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

Definition at line 19 of file TtFullHadEvtPartons.h.

Member Enumeration Documentation

anonymous enum

fully-hadronic parton enum used to define the order in the vector for lepton and jet combinatorics

Enumerator
LightQ 
LightQBar 
B 
LightP 
LightPBar 
BBar 

Definition at line 25 of file TtFullHadEvtPartons.h.

Constructor & Destructor Documentation

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

default constructor

Definition at line 6 of file TtFullHadEvtPartons.cc.

References BBar, edm::hlt::Exception, i, TtEventPartons::ignorePartons_, LightP, LightPBar, LightQ, and LightQBar.

7 {
8  // default: use all partons
9  for(unsigned int i = 0; i < 6; 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) == "B" ) ignorePartons_[B ] = true;
16  else if((*str) == "LightP" ) ignorePartons_[LightP ] = true;
17  else if((*str) == "LightPBar" ) ignorePartons_[LightPBar] = true;
18  else if((*str) == "BBar" ) ignorePartons_[BBar ] = true;
19  else throw cms::Exception("Configuration")
20  << "The following string in partonsToIgnore is not supported: " << (*str) << "\n";
21  }
22 }
int i
Definition: DBlmapReader.cc:9
std::vector< bool > ignorePartons_
flag partons that were chosen not to be used
TtFullHadEvtPartons::~TtFullHadEvtPartons ( )
inline

default destructor

Definition at line 32 of file TtFullHadEvtPartons.h.

32 {};

Member Function Documentation

std::vector< const reco::Candidate * > TtFullHadEvtPartons::vec ( const TtGenEvent genEvt)
virtual

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

Implements TtEventPartons.

Definition at line 25 of file TtFullHadEvtPartons.cc.

References B, TopGenEvent::b(), BBar, TopGenEvent::bBar(), TopGenEvent::daughterQuarkBarOfWMinus(), TopGenEvent::daughterQuarkBarOfWPlus(), TopGenEvent::daughterQuarkOfWMinus(), TopGenEvent::daughterQuarkOfWPlus(), TtEventPartons::dummyCandidatePtr(), i, TtGenEvent::isFullHadronic(), LightP, LightPBar, LightQ, LightQBar, and TtEventPartons::prune().

26 {
27  std::vector<const reco::Candidate*> vec;
28 
29  if(genEvt.isFullHadronic()) {
30  // fill vector with partons from genEvent
31  // (use enum for positions of the partons in the vector)
32  vec.resize(6);
33  vec[LightQ ] = genEvt.daughterQuarkOfWPlus() ? genEvt.daughterQuarkOfWPlus() : dummyCandidatePtr();
35  vec[B ] = genEvt.b() ? genEvt.b() : dummyCandidatePtr();
38  vec[BBar ] = genEvt.bBar() ? genEvt.bBar() : dummyCandidatePtr();
39  }
40  else {
41  // fill vector with dummy objects if the event is not fully-hadronic ttbar
42  for(unsigned i=0; i<6; i++)
43  vec.push_back( dummyCandidatePtr() );
44  }
45 
46  // erase partons from vector if they where chosen to be ignored
47  prune(vec);
48 
49  return vec;
50 }
const reco::GenParticle * b() const
return b quark if available; 0 else
Definition: TopGenEvent.h:100
int i
Definition: DBlmapReader.cc:9
void prune(std::vector< const reco::Candidate * > &vec)
erase partons from vector if they where chosen to be ignored
const reco::GenParticle * daughterQuarkOfWPlus(bool invertQuarkCharge=false, bool invertBosonCharge=false) const
return quark daughter quark of W boson
Definition: TopGenEvent.cc:170
const reco::GenParticle * bBar() const
return anti-b quark if available; 0 else
Definition: TopGenEvent.h:102
bool isFullHadronic(bool excludeTauLeptons=false) const
check if the event can be classified as full hadronic
Definition: TtGenEvent.h:36
const reco::GenParticle * daughterQuarkBarOfWMinus() const
return anti-quark daughter of anti-W boson
Definition: TopGenEvent.h:79
const reco::GenParticle * daughterQuarkBarOfWPlus() const
return anti-quark daughter of W boson
Definition: TopGenEvent.h:77
reco::Candidate * dummyCandidatePtr() const
return pointer to an empty reco::Candidate
std::vector< const reco::Candidate * > vec(const TtGenEvent &genEvt)
return vector of partons in the order defined in the corresponding enum
const reco::GenParticle * daughterQuarkOfWMinus() const
return quark daughter of anti-W boson
Definition: TopGenEvent.h:75