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::EDConsumerBase 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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Protected Attributes

reco::ShallowClonePtrCandidateb_
 
reco::ShallowClonePtrCandidatebBar_
 
edm::EDGetTokenT< std::vector
< pat::Electron > > 
elecsToken_
 
bool getMatch_
 
std::string jetCorrectionLevel_
 
edm::EDGetTokenT< std::vector
< pat::Jet > > 
jetsToken_
 
int key_
 hypothesis key (to be set by the buildKey function) More...
 
reco::ShallowClonePtrCandidatelepton_
 
reco::ShallowClonePtrCandidateleptonBar_
 
edm::EDGetTokenT< std::vector
< std::vector< int > > > 
matchToken_
 input label for all necessary collections More...
 
edm::EDGetTokenT< std::vector
< pat::MET > > 
metsToken_
 
edm::EDGetTokenT< std::vector
< pat::Muon > > 
musToken_
 
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
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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_, matchToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

5  :
6  elecsToken_(consumes<std::vector<pat::Electron> >(cfg.getParameter<edm::InputTag>("electrons"))),
7  musToken_ (consumes<std::vector<pat::Muon> >(cfg.getParameter<edm::InputTag>("muons"))),
8  jetsToken_ (consumes<std::vector<pat::Jet> >(cfg.getParameter<edm::InputTag>("jets"))),
9  metsToken_ (consumes<std::vector<pat::MET> >(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  matchToken_ = consumes<std::vector<std::vector<int> > >(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_
reco::ShallowClonePtrCandidate * leptonBar_
bool exists(std::string const &parameterName) const
checks if a parameter exists
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
input label for all necessary collections
edm::EDGetTokenT< std::vector< pat::Electron > > elecsToken_
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * bBar_
std::string jetCorrectionLevel_
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
reco::ShallowClonePtrCandidate * b_
reco::ShallowClonePtrCandidate * neutrinoBar_
edm::EDGetTokenT< std::vector< pat::Muon > > musToken_
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::LogInfo("TtFullHypothesis") << "no neutrinos for gen match" << std::endl;
120  return reco::CompositeCandidate();
121  }
123  edm::LogInfo("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(), and core.AutoHandle.AutoHandle::ReallyLoad().

57 { return (0<=idx && idx<(int)jets->size()); };
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
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(), elecsToken_, edm::Event::getByToken(), getMatch_, hypo(), i, fwrapper::jets, jetsToken_, key(), match(), matchToken_, metsToken_, musToken_, edm::Event::put(), and resetCandidates().

46 {
48  evt.getByToken(elecsToken_, elecs);
49 
51  evt.getByToken(musToken_, mus);
52 
54  evt.getByToken(jetsToken_, jets);
55 
57  evt.getByToken(metsToken_, mets);
58 
59  std::vector<std::vector<int> > matchVec;
60  if( getMatch_ ) {
62  evt.getByToken(matchToken_, 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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
virtual void buildKey()=0
build the event hypothesis key
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
vector< PseudoJet > jets
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
void resetCandidates()
reset candidate pointers before hypo build process
reco::CompositeCandidate hypo()
return event hypothesis
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
input label for all necessary collections
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
edm::EDGetTokenT< std::vector< pat::Electron > > elecsToken_
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
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:10
edm::EDGetTokenT< std::vector< pat::Muon > > musToken_
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, and customizeTrackingMonitorSeedNumber::idx.

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

109  {
110  typedef typename C::value_type O;
112  clone = new reco::ShallowClonePtrCandidate( ptr, ptr->charge(), ptr->p4(), ptr->vertex() );
113 }
tuple handle
Definition: patZpeak.py:22
Container::value_type value_type
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
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, customizeTrackingMonitorSeedNumber::idx, 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
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::string jetCorrectionLevel_

Member Data Documentation

reco::ShallowClonePtrCandidate* TtFullLepHypothesis::b_
protected
reco::ShallowClonePtrCandidate* TtFullLepHypothesis::bBar_
protected
edm::EDGetTokenT<std::vector<pat::Electron> > TtFullLepHypothesis::elecsToken_
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::EDGetTokenT<std::vector<pat::Jet> > TtFullLepHypothesis::jetsToken_
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::EDGetTokenT<std::vector<std::vector<int> > > TtFullLepHypothesis::matchToken_
protected

input label for all necessary collections

Definition at line 80 of file TtFullLepHypothesis.h.

Referenced by produce(), and TtFullLepHypothesis().

edm::EDGetTokenT<std::vector<pat::MET> > TtFullLepHypothesis::metsToken_
protected

Definition at line 84 of file TtFullLepHypothesis.h.

Referenced by produce().

edm::EDGetTokenT<std::vector<pat::Muon> > TtFullLepHypothesis::musToken_
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().