test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TtFullLepEvtPartons.cc
Go to the documentation of this file.
3 
5 
6 TtFullLepEvtPartons::TtFullLepEvtPartons(const std::vector<std::string>& partonsToIgnore)
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 }
19 
20 std::vector<const reco::Candidate*>
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
Class derived from the TopGenEvent for ttbar events.
Definition: TtGenEvent.h:18
std::vector< bool > ignorePartons_
flag partons that were chosen not to be used
std::vector< const reco::Candidate * > vec(const TtGenEvent &genEvt)
return vector of partons in the order defined in the corresponding enum
TtFullLepEvtPartons(const std::vector< std::string > &partonsToIgnore=std::vector< std::string >())
default constructor
reco::Candidate * dummyCandidatePtr() const
return pointer to an empty reco::Candidate