CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
TtFullLepHypothesis Class Referenceabstract

#include <TtFullLepHypothesis.h>

Inheritance diagram for TtFullLepHypothesis:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper TtFullLepHypGenMatch TtFullLepHypKinSolution

Public Member Functions

 TtFullLepHypothesis (const edm::ParameterSet &)
 default constructor More...
 
 ~TtFullLepHypothesis ()
 default destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Protected Member Functions

virtual void buildHypo (edm::Event &evt, const edm::Handle< std::vector< pat::Electron > > &elecs, const edm::Handle< std::vector< pat::Muon > > &mus, const edm::Handle< std::vector< pat::Jet > > &jets, const edm::Handle< std::vector< pat::MET > > &mets, std::vector< int > &match, const unsigned int iComb)=0
 build event hypothesis from the reco objects of a semi-leptonic event More...
 
virtual void buildKey ()=0
 build the event hypothesis key More...
 
reco::CompositeCandidate hypo ()
 return event hypothesis More...
 
bool isValid (const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
 check if index is in valid range of selected jets More...
 
int key () const
 return key More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 produce the event hypothesis as CompositeCandidate and Key More...
 
void resetCandidates ()
 reset candidate pointers before hypo build process More...
 
template<typename C >
void setCandidate (const edm::Handle< C > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone)
 use one object in a collection to set a ShallowClonePtrCandidate More...
 
void setCandidate (const edm::Handle< std::vector< pat::Jet > > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone, const std::string &correctionLevel)
 use one object in a jet collection to set a ShallowClonePtrCandidate with proper jet corrections More...
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Protected Attributes

reco::ShallowClonePtrCandidateb_
 
reco::ShallowClonePtrCandidatebBar_
 
edm::InputTag elecs_
 
bool getMatch_
 
std::string jetCorrectionLevel_
 
edm::InputTag jets_
 
int key_
 hypothesis key (to be set by the buildKey function) More...
 
reco::ShallowClonePtrCandidatelepton_
 
reco::ShallowClonePtrCandidateleptonBar_
 
edm::InputTag match_
 input label for all necessary collections More...
 
edm::InputTag mets_
 
edm::InputTag mus_
 
reco::ShallowClonePtrCandidateneutrino_
 
reco::ShallowClonePtrCandidateneutrinoBar_
 
reco::LeafCandidaterecNu
 candidates needed for the genmatch hypothesis More...
 
reco::LeafCandidaterecNuBar
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 34 of file TtFullLepHypothesis.h.

Constructor & Destructor Documentation

TtFullLepHypothesis::TtFullLepHypothesis ( const edm::ParameterSet cfg)
explicit

default constructor

Definition at line 5 of file TtFullLepHypothesis.cc.

References edm::ParameterSet::exists(), getMatch_, edm::ParameterSet::getParameter(), jetCorrectionLevel_, and match_.

5  :
6  elecs_(cfg.getParameter<edm::InputTag>("electrons")),
7  mus_ (cfg.getParameter<edm::InputTag>("muons")),
8  jets_ (cfg.getParameter<edm::InputTag>("jets")),
9  mets_ (cfg.getParameter<edm::InputTag>("mets")),
10 
11  lepton_(0), leptonBar_(0), b_(0),
12  bBar_(0), neutrino_(0), neutrinoBar_(0)
13 {
14  getMatch_ = false;
15  if( cfg.exists("match") ) {
16  getMatch_ = true;
17  match_ = cfg.getParameter<edm::InputTag>("match");
18  }
19  // if no other correction is given apply L3 (abs) correction
20  jetCorrectionLevel_ = "abs";
21  if( cfg.exists("jetCorrectionLevel") ) {
22  jetCorrectionLevel_ = cfg.getParameter<std::string>("jetCorrectionLevel");
23  }
24  else{ // if no other correction is given apply L3 (abs) correction
25  jetCorrectionLevel_ = "abs";
26  }
27  produces<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > >();
28  produces<int>("Key");
29 }
T getParameter(std::string const &) const
reco::ShallowClonePtrCandidate * neutrino_
edm::InputTag match_
input label for all necessary collections
reco::ShallowClonePtrCandidate * leptonBar_
bool exists(std::string const &parameterName) const
checks if a parameter exists
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * bBar_
std::string jetCorrectionLevel_
reco::ShallowClonePtrCandidate * b_
reco::ShallowClonePtrCandidate * neutrinoBar_
TtFullLepHypothesis::~TtFullLepHypothesis ( )

default destructor

Definition at line 32 of file TtFullLepHypothesis.cc.

References b_, bBar_, lepton_, leptonBar_, neutrino_, and neutrinoBar_.

33 {
34  if( lepton_ ) delete lepton_;
35  if( leptonBar_ ) delete leptonBar_;
36  if( b_ ) delete b_;
37  if( bBar_ ) delete bBar_;
38  if( neutrino_ ) delete neutrino_;
39  if( neutrinoBar_ ) delete neutrinoBar_;
40  //if( met_ ) delete met_;
41 }
reco::ShallowClonePtrCandidate * neutrino_
reco::ShallowClonePtrCandidate * leptonBar_
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * bBar_
reco::ShallowClonePtrCandidate * b_
reco::ShallowClonePtrCandidate * neutrinoBar_

Member Function Documentation

virtual void TtFullLepHypothesis::buildHypo ( edm::Event evt,
const edm::Handle< std::vector< pat::Electron > > &  elecs,
const edm::Handle< std::vector< pat::Muon > > &  mus,
const edm::Handle< std::vector< pat::Jet > > &  jets,
const edm::Handle< std::vector< pat::MET > > &  mets,
std::vector< int > &  match,
const unsigned int  iComb 
)
protectedpure virtual

build event hypothesis from the reco objects of a semi-leptonic event

Implemented in TtFullLepHypGenMatch, and TtFullLepHypKinSolution.

Referenced by produce().

virtual void TtFullLepHypothesis::buildKey ( )
protectedpure virtual

build the event hypothesis key

Implemented in TtFullLepHypGenMatch, and TtFullLepHypKinSolution.

Referenced by produce().

reco::CompositeCandidate TtFullLepHypothesis::hypo ( )
protected

return event hypothesis

Definition at line 111 of file TtFullLepHypothesis.cc.

References reco::CompositeCandidate::addDaughter(), TtFullLepDaughter::B, b_, TtFullLepDaughter::BBar, bBar_, key(), TtEvent::kGenMatch, TtEvent::kKinSolution, TtFullLepDaughter::Lep, TtFullLepDaughter::LepBar, lepton_, leptonBar_, neutrino_, neutrinoBar_, TtFullLepDaughter::Nu, TtFullLepDaughter::NuBar, recNu, recNuBar, AddFourMomenta::set(), TtFullLepDaughter::Top, TtFullHadDaughter::Top, TtFullLepDaughter::TopBar, TtFullHadDaughter::TopBar, TtFullHadDaughter::WMinus, TtFullLepDaughter::WMinus, TtFullHadDaughter::WPlus, and TtFullLepDaughter::WPlus.

Referenced by produce().

112 {
113  // check for sanity of the hypothesis
114  if( !lepton_ || !leptonBar_ || !b_ || !bBar_ ){
115  return reco::CompositeCandidate();
116  }
117 
119  edm::LogWarning("TtFullHypothesis") << "no neutrinos for gen match" << std::endl;
120  return reco::CompositeCandidate();
121  }
123  edm::LogWarning("TtFullHypothesis") << "no neutrinos for kin solution" << std::endl;
124  return reco::CompositeCandidate();
125  }
126 
127  // setup transient references
129 
130  AddFourMomenta addFourMomenta;
131 
132  // build up the top branch
138  addFourMomenta.set(WPlus);
141  addFourMomenta.set(Top);
142 
143  // build up the anti top branch
149  addFourMomenta.set(WMinus);
150  TopBar.addDaughter(WMinus, TtFullLepDaughter::WMinus);
152  addFourMomenta.set(TopBar);
153 
154  // build ttbar hypothesis
157  addFourMomenta.set( hyp );
158 
159  // the four momentum of the met is not added to the hypothesis
160  // because it is allready included through the neutrinos
161  //hyp.addDaughter(*met_, TtFullLepDaughter::Met);
162  return hyp;
163 }
reco::ShallowClonePtrCandidate * neutrino_
reco::ShallowClonePtrCandidate * leptonBar_
static const std::string WMinus
reco::LeafCandidate * recNuBar
static const std::string Nu
reco::LeafCandidate * recNu
candidates needed for the genmatch hypothesis
static const std::string WPlus
static const std::string B
static const std::string Top
static const std::string Top
static const std::string TopBar
static const std::string WMinus
static const std::string LepBar
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
static const std::string WPlus
static const std::string TopBar
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * bBar_
static const std::string BBar
int key() const
return key
void set(reco::Candidate &c) const
set up a candidate
reco::ShallowClonePtrCandidate * b_
static const std::string NuBar
static const std::string Lep
reco::ShallowClonePtrCandidate * neutrinoBar_
bool TtFullLepHypothesis::isValid ( const int &  idx,
const edm::Handle< std::vector< pat::Jet > > &  jets 
)
inlineprotected

check if index is in valid range of selected jets

Definition at line 57 of file TtFullLepHypothesis.h.

References fwrapper::jets.

Referenced by TtFullLepHypGenMatch::buildHypo().

57 { return (0<=idx && idx<(int)jets->size()); };
int TtFullLepHypothesis::key ( ) const
inlineprotected

return key

Definition at line 53 of file TtFullLepHypothesis.h.

References key_.

Referenced by hypo(), and produce().

53 { return key_; };
int key_
hypothesis key (to be set by the buildKey function)
void TtFullLepHypothesis::produce ( edm::Event evt,
const edm::EventSetup setup 
)
protectedvirtual

produce the event hypothesis as CompositeCandidate and Key

Implements edm::EDProducer.

Definition at line 45 of file TtFullLepHypothesis.cc.

References buildHypo(), buildKey(), elecs_, edm::Event::getByLabel(), getMatch_, hypo(), i, fwrapper::jets, jets_, key(), match(), match_, mets_, mus_, edm::Event::put(), and resetCandidates().

46 {
48  evt.getByLabel(elecs_, elecs);
49 
51  evt.getByLabel(mus_, mus);
52 
54  evt.getByLabel(jets_, jets);
55 
57  evt.getByLabel(mets_, mets);
58 
59  std::vector<std::vector<int> > matchVec;
60  if( getMatch_ ) {
62  evt.getByLabel(match_, matchHandle);;
63  matchVec = *matchHandle;
64  }
65  else {
66  std::vector<int> dummyMatch;
67  for(unsigned int i = 0; i < 4; ++i)
68  dummyMatch.push_back( -1 );
69  matchVec.push_back( dummyMatch );
70  }
71 
72  // declare auto_ptr for products
73  std::auto_ptr<std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > >
74  pOut( new std::vector<std::pair<reco::CompositeCandidate, std::vector<int> > > );
75  std::auto_ptr<int> pKey(new int);
76 
77  // build and feed out key
78  buildKey();
79  *pKey=key();
80  evt.put(pKey, "Key");
81 
82  // go through given vector of jet combinations
83  unsigned int idMatch = 0;
84  typedef std::vector<std::vector<int> >::iterator MatchVecIterator;
85  for(MatchVecIterator match = matchVec.begin(); match != matchVec.end(); ++match) {
86  // reset pointers
88  // build hypothesis
89  buildHypo(evt, elecs, mus, jets, mets, *match, idMatch++);
90  pOut->push_back( std::make_pair(hypo(), *match) );
91  }
92  // feed out hyps and matches
93  evt.put(pOut);
94 }
int i
Definition: DBlmapReader.cc:9
edm::InputTag match_
input label for all necessary collections
virtual void buildKey()=0
build the event hypothesis key
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
vector< PseudoJet > jets
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void resetCandidates()
reset candidate pointers before hypo build process
reco::CompositeCandidate hypo()
return event hypothesis
virtual void buildHypo(edm::Event &evt, const edm::Handle< std::vector< pat::Electron > > &elecs, const edm::Handle< std::vector< pat::Muon > > &mus, const edm::Handle< std::vector< pat::Jet > > &jets, const edm::Handle< std::vector< pat::MET > > &mets, std::vector< int > &match, const unsigned int iComb)=0
build event hypothesis from the reco objects of a semi-leptonic event
int key() const
return key
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
void TtFullLepHypothesis::resetCandidates ( )
protected

reset candidate pointers before hypo build process

Definition at line 98 of file TtFullLepHypothesis.cc.

References b_, bBar_, lepton_, leptonBar_, neutrino_, and neutrinoBar_.

Referenced by produce().

99 {
100  lepton_ = 0;
101  leptonBar_ = 0;
102  b_ = 0;
103  bBar_ = 0;
104  neutrino_ = 0;
105  neutrinoBar_= 0;
106  //met_ = 0;
107 }
reco::ShallowClonePtrCandidate * neutrino_
reco::ShallowClonePtrCandidate * leptonBar_
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * bBar_
reco::ShallowClonePtrCandidate * b_
reco::ShallowClonePtrCandidate * neutrinoBar_
template<typename C >
void TtFullLepHypothesis::setCandidate ( const edm::Handle< C > &  handle,
const int &  idx,
reco::ShallowClonePtrCandidate *&  clone 
)
protected

use one object in a collection to set a ShallowClonePtrCandidate

Definition at line 109 of file TtFullLepHypothesis.h.

References patZpeak::handle.

Referenced by TtFullLepHypKinSolution::buildHypo(), and TtFullLepHypGenMatch::buildHypo().

109  {
110  typedef typename C::value_type O;
111  edm::Ptr<O> ptr = edm::Ptr<O>(handle, idx);
112  clone = new reco::ShallowClonePtrCandidate( ptr, ptr->charge(), ptr->p4(), ptr->vertex() );
113 }
tuple handle
Definition: patZpeak.py:22
Container::value_type value_type
void TtFullLepHypothesis::setCandidate ( const edm::Handle< std::vector< pat::Jet > > &  handle,
const int &  idx,
reco::ShallowClonePtrCandidate *&  clone,
const std::string &  correctionLevel 
)
protected

use one object in a jet collection to set a ShallowClonePtrCandidate with proper jet corrections

Definition at line 167 of file TtFullLepHypothesis.cc.

References patZpeak::handle, and jetCorrectionLevel_.

168 {
170  clone = new reco::ShallowClonePtrCandidate( ptr, ptr->charge(), ptr->correctedJet(jetCorrectionLevel_, "bottom").p4(), ptr->vertex() );
171 }
tuple handle
Definition: patZpeak.py:22
std::string jetCorrectionLevel_

Member Data Documentation

reco::ShallowClonePtrCandidate* TtFullLepHypothesis::b_
protected
reco::ShallowClonePtrCandidate* TtFullLepHypothesis::bBar_
protected
edm::InputTag TtFullLepHypothesis::elecs_
protected

Definition at line 81 of file TtFullLepHypothesis.h.

Referenced by produce().

bool TtFullLepHypothesis::getMatch_
protected

internal check whether the match information exists or not, if false a blind dummy match vector will be used internally

Definition at line 78 of file TtFullLepHypothesis.h.

Referenced by produce(), and TtFullLepHypothesis().

std::string TtFullLepHypothesis::jetCorrectionLevel_
protected

specify the desired jet correction level (the default should be L3Absolute-'abs')

Definition at line 87 of file TtFullLepHypothesis.h.

Referenced by TtFullLepHypKinSolution::buildHypo(), TtFullLepHypGenMatch::buildHypo(), setCandidate(), and TtFullLepHypothesis().

edm::InputTag TtFullLepHypothesis::jets_
protected

Definition at line 83 of file TtFullLepHypothesis.h.

Referenced by produce().

int TtFullLepHypothesis::key_
protected

hypothesis key (to be set by the buildKey function)

Definition at line 89 of file TtFullLepHypothesis.h.

Referenced by TtFullLepHypKinSolution::buildKey(), TtFullLepHypGenMatch::buildKey(), and key().

reco::ShallowClonePtrCandidate* TtFullLepHypothesis::lepton_
protected

candidates for internal use for the creation of the hypothesis candidate

Definition at line 92 of file TtFullLepHypothesis.h.

Referenced by TtFullLepHypKinSolution::buildHypo(), TtFullLepHypGenMatch::buildHypo(), hypo(), resetCandidates(), and ~TtFullLepHypothesis().

reco::ShallowClonePtrCandidate* TtFullLepHypothesis::leptonBar_
protected
edm::InputTag TtFullLepHypothesis::match_
protected

input label for all necessary collections

Definition at line 80 of file TtFullLepHypothesis.h.

Referenced by produce(), and TtFullLepHypothesis().

edm::InputTag TtFullLepHypothesis::mets_
protected

Definition at line 84 of file TtFullLepHypothesis.h.

Referenced by produce().

edm::InputTag TtFullLepHypothesis::mus_
protected

Definition at line 82 of file TtFullLepHypothesis.h.

Referenced by produce().

reco::ShallowClonePtrCandidate* TtFullLepHypothesis::neutrino_
protected
reco::ShallowClonePtrCandidate* TtFullLepHypothesis::neutrinoBar_
protected
reco::LeafCandidate* TtFullLepHypothesis::recNu
protected

candidates needed for the genmatch hypothesis

Definition at line 101 of file TtFullLepHypothesis.h.

Referenced by TtFullLepHypGenMatch::buildMatchingNeutrinos(), and hypo().

reco::LeafCandidate* TtFullLepHypothesis::recNuBar
protected

Definition at line 102 of file TtFullLepHypothesis.h.

Referenced by TtFullLepHypGenMatch::buildMatchingNeutrinos(), and hypo().