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

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

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

Inheritance diagram for TtFullLepEvtPartons:
TtEventPartons

Public Types

enum  { B, BBar, Lepton, LeptonBar }
 

Public Member Functions

 TtFullLepEvtPartons (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...
 
 ~TtFullLepEvtPartons ()
 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-leptonic ttbar events.

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

Definition at line 19 of file TtFullLepEvtPartons.h.

Member Enumeration Documentation

anonymous enum

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

Enumerator
B 
BBar 
Lepton 
LeptonBar 

Definition at line 25 of file TtFullLepEvtPartons.h.

Constructor & Destructor Documentation

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

default constructor

Definition at line 6 of file TtFullLepEvtPartons.cc.

References BBar, Exception, i, and TtEventPartons::ignorePartons_.

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

default destructor

Definition at line 32 of file TtFullLepEvtPartons.h.

32 {};

Member Function Documentation

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

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

Implements TtEventPartons.

Definition at line 21 of file TtFullLepEvtPartons.cc.

References B, TopGenEvent::b(), BBar, TopGenEvent::bBar(), TtEventPartons::dummyCandidatePtr(), i, TtGenEvent::isFullLeptonic(), and TtEventPartons::prune().

22 {
23  std::vector<const reco::Candidate*> vec;
24 
25  if(genEvt.isFullLeptonic()) {
26  // fill vector with partons from genEvent
27  // (use enum for positions of the partons in the vector)
28  vec.resize(2);
29  vec[B ] = genEvt.b() ? genEvt.b() : dummyCandidatePtr();
30  vec[BBar] = genEvt.bBar() ? genEvt.bBar() : dummyCandidatePtr();
31  }
32  else {
33  // fill vector with dummy objects if the event is not fully-leptonic ttbar
34  for(unsigned i=0; i<2; i++)
35  vec.push_back( dummyCandidatePtr() );
36  }
37 
38  // erase partons from vector if they where chosen to be ignored
39  prune(vec);
40 
41  return vec;
42 }
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 * bBar() const
return anti-b quark if available; 0 else
Definition: TopGenEvent.h:102
bool isFullLeptonic(bool excludeTauLeptons=false) const
check if the event can be classified as full leptonic
Definition: TtGenEvent.h:40
std::vector< const reco::Candidate * > vec(const TtGenEvent &genEvt)
return vector of partons in the order defined in the corresponding enum
reco::Candidate * dummyCandidatePtr() const
return pointer to an empty reco::Candidate