CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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) override
 return vector of partons in the order defined in the corresponding enum More...
 
 ~TtFullHadEvtPartons () override
 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 21 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 B, BBar, Exception, mps_fire::i, TtEventPartons::ignorePartons_, LightP, LightPBar, LightQ, LightQBar, and str.

6  {
7  // default: use all partons
8  for (unsigned int i = 0; i < 6; i++)
9  ignorePartons_.push_back(false);
10  // read vector of strings and flag partons to be ignored
11  for (std::vector<std::string>::const_iterator str = partonsToIgnore.begin(); str != partonsToIgnore.end(); ++str) {
12  if ((*str) == "LightQ")
13  ignorePartons_[LightQ] = true;
14  else if ((*str) == "LightQBar")
15  ignorePartons_[LightQBar] = true;
16  else if ((*str) == "B")
17  ignorePartons_[B] = true;
18  else if ((*str) == "LightP")
19  ignorePartons_[LightP] = true;
20  else if ((*str) == "LightPBar")
21  ignorePartons_[LightPBar] = true;
22  else if ((*str) == "BBar")
23  ignorePartons_[BBar] = true;
24  else
25  throw cms::Exception("Configuration")
26  << "The following string in partonsToIgnore is not supported: " << (*str) << "\n";
27  }
28 }
std::vector< bool > ignorePartons_
flag partons that were chosen not to be used
#define str(s)
TtFullHadEvtPartons::~TtFullHadEvtPartons ( )
inlineoverride

default destructor

Definition at line 31 of file TtFullHadEvtPartons.h.

31 {};

Member Function Documentation

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

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

Implements TtEventPartons.

Definition at line 30 of file TtFullHadEvtPartons.cc.

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

30  {
31  std::vector<const reco::Candidate*> vec;
32 
33  if (genEvt.isFullHadronic()) {
34  // fill vector with partons from genEvent
35  // (use enum for positions of the partons in the vector)
36  vec.resize(6);
39  vec[B] = genEvt.b() ? genEvt.b() : dummyCandidatePtr();
42  vec[BBar] = genEvt.bBar() ? genEvt.bBar() : dummyCandidatePtr();
43  } else {
44  // fill vector with dummy objects if the event is not fully-hadronic ttbar
45  for (unsigned i = 0; i < 6; i++)
46  vec.push_back(dummyCandidatePtr());
47  }
48 
49  // erase partons from vector if they where chosen to be ignored
50  prune(vec);
51 
52  return vec;
53 }
const reco::GenParticle * b() const
return b quark if available; 0 else
Definition: TopGenEvent.h:97
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:150
const reco::GenParticle * bBar() const
return anti-b quark if available; 0 else
Definition: TopGenEvent.h:99
bool isFullHadronic(bool excludeTauLeptons=false) const
check if the event can be classified as full hadronic
Definition: TtGenEvent.h:34
const reco::GenParticle * daughterQuarkBarOfWMinus() const
return anti-quark daughter of anti-W boson
Definition: TopGenEvent.h:76
const reco::GenParticle * daughterQuarkBarOfWPlus() const
return anti-quark daughter of W boson
Definition: TopGenEvent.h:74
reco::Candidate * dummyCandidatePtr() const
return pointer to an empty reco::Candidate
const reco::GenParticle * daughterQuarkOfWMinus() const
return quark daughter of anti-W boson
Definition: TopGenEvent.h:72
std::vector< const reco::Candidate * > vec(const TtGenEvent &genEvt) override
return vector of partons in the order defined in the corresponding enum