CMS 3D CMS Logo

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) override
 return vector of partons in the order defined in the corresponding enum More...
 
 ~TtSemiLepEvtPartons () 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 semi-leptonic ttbar events.

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

Definition at line 21 of file TtSemiLepEvtPartons.h.

Member Enumeration Documentation

◆ anonymous enum

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::TtSemiLepEvtPartons ( const std::vector< std::string > &  partonsToIgnore = std::vector<std::string>())

default constructor

Definition at line 6 of file TtSemiLepEvtPartons.cc.

6  {
7  // default: use all partons
8  for (unsigned int i = 0; i < 4; 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) == "HadB")
17  ignorePartons_[HadB] = true;
18  else if ((*str) == "LepB")
19  ignorePartons_[LepB] = true;
20  else
21  throw cms::Exception("Configuration")
22  << "The following string in partonsToIgnore is not supported: " << (*str) << "\n";
23  }
24 }

References Exception, HadB, mps_fire::i, TtEventPartons::ignorePartons_, LepB, LightQ, LightQBar, TtFullHadJetPartonMatch_cfi::partonsToIgnore, and str.

◆ ~TtSemiLepEvtPartons()

TtSemiLepEvtPartons::~TtSemiLepEvtPartons ( )
inlineoverride

default destructor

Definition at line 31 of file TtSemiLepEvtPartons.h.

31 {};

Member Function Documentation

◆ vec()

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

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

Implements TtEventPartons.

Definition at line 26 of file TtSemiLepEvtPartons.cc.

26  {
27  std::vector<const reco::Candidate*> vec;
28 
29  if (genEvt.isSemiLeptonic()) {
30  // fill vector with partons from genEvent
31  // (use enum for positions of the partons in the vector)
32  vec.resize(4);
33  vec[LightQ] = genEvt.hadronicDecayQuark() ? genEvt.hadronicDecayQuark() : dummyCandidatePtr();
34  vec[LightQBar] = genEvt.hadronicDecayQuarkBar() ? genEvt.hadronicDecayQuarkBar() : dummyCandidatePtr();
35  vec[HadB] = genEvt.hadronicDecayB() ? genEvt.hadronicDecayB() : dummyCandidatePtr();
36  vec[LepB] = genEvt.leptonicDecayB() ? genEvt.leptonicDecayB() : dummyCandidatePtr();
37  } else {
38  // fill vector with dummy objects if the event is not semi-leptonic ttbar
39  for (unsigned i = 0; i < 4; i++)
40  vec.push_back(dummyCandidatePtr());
41  }
42 
43  // erase partons from vector if they where chosen to be ignored
44  prune(vec);
45 
46  return vec;
47 }

References TtEventPartons::dummyCandidatePtr(), TtGenEvtProducer_cfi::genEvt, HadB, mps_fire::i, LepB, LightQ, LightQBar, and TtEventPartons::prune().

TtSemiLepEvtPartons::vec
std::vector< const reco::Candidate * > vec(const TtGenEvent &genEvt) override
return vector of partons in the order defined in the corresponding enum
Definition: TtSemiLepEvtPartons.cc:26
mps_fire.i
i
Definition: mps_fire.py:355
TtSemiLepEvtPartons::LightQBar
Definition: TtSemiLepEvtPartons.h:25
Lepton
Definition: Lepton.py:1
TtEventPartons::dummyCandidatePtr
reco::Candidate * dummyCandidatePtr() const
return pointer to an empty reco::Candidate
Definition: TtEventPartons.h:35
TtSemiLepEvtPartons::LepB
Definition: TtSemiLepEvtPartons.h:25
TtEventPartons::prune
void prune(std::vector< const reco::Candidate * > &vec)
erase partons from vector if they where chosen to be ignored
Definition: TtEventPartons.cc:13
str
#define str(s)
Definition: TestProcessor.cc:48
TtEventPartons::ignorePartons_
std::vector< bool > ignorePartons_
flag partons that were chosen not to be used
Definition: TtEventPartons.h:43
TtSemiLepEvtPartons::HadB
Definition: TtSemiLepEvtPartons.h:25
TtFullHadJetPartonMatch_cfi.partonsToIgnore
partonsToIgnore
Definition: TtFullHadJetPartonMatch_cfi.py:57
TtSemiLepEvtPartons::LightQ
Definition: TtSemiLepEvtPartons.h:25
Exception
Definition: hltDiff.cc:246
TtGenEvtProducer_cfi.genEvt
genEvt
Definition: TtGenEvtProducer_cfi.py:7