CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TtFullLepHypothesis.h
Go to the documentation of this file.
1 #ifndef TtFullLepHypothesis_h
2 #define TtFullLepHypothesis_h
3 
4 #include <memory>
5 #include <vector>
6 
12 
19 
21 
22 /*
23  \class TtFullLepHypothesis TtFullLepHypothesis.h "TopQuarkAnalysis/TopJetCombination/interface/TtFullLepHypothesis.h"
24 
25  \brief Interface class for the creation of full leptonic ttbar event hypotheses
26 
27  The class provides an interface for the creation of full leptonic ttbar event hypotheses. Input information is read
28  from the event content and the proper candidate creation is taken care of. Hypotheses are characterized by the
29  CompositeCandidate made of a ttbar pair (including all its decay products in a parton level interpretation) and an
30  enumerator type key to specify the algorithm to determine the candidate (hypothesis class). The buildKey and the
31  buildHypo class have to implemented by derived classes.
32 **/
33 
35 
36  public:
38  explicit TtFullLepHypothesis(const edm::ParameterSet&);
41 
42  protected:
44  virtual void produce(edm::Event&, const edm::EventSetup&);
46  void resetCandidates();
48  template <typename C>
51  void setCandidate(const edm::Handle<std::vector<pat::Jet> >& handle, const int& idx, reco::ShallowClonePtrCandidate*& clone, const std::string& correctionLevel);
53  int key() const { return key_; };
57  bool isValid(const int& idx, const edm::Handle<std::vector<pat::Jet> >& jets){ return (0<=idx && idx<(int)jets->size()); };
58 
59  // -----------------------------------------
60  // implemet the following two functions
61  // for a concrete event hypothesis
62  // -----------------------------------------
63 
65  virtual void buildKey() = 0;
67  virtual void buildHypo(edm::Event& evt,
68  const edm::Handle<std::vector<pat::Electron > >& elecs,
69  const edm::Handle<std::vector<pat::Muon> >& mus,
70  const edm::Handle<std::vector<pat::Jet> >& jets,
71  const edm::Handle<std::vector<pat::MET> >& mets,
72  std::vector<int>& match,
73  const unsigned int iComb) = 0;
74 
75  protected:
78  bool getMatch_;
87  std::string jetCorrectionLevel_;
89  int key_;
98  //reco::ShallowClonePtrCandidate *met_;
99 
103 };
104 
105 // unfortunately this has to be placed in the header since otherwise the function template
106 // would cause unresolved references in classes derived from this base class
107 template<typename C>
108 void
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 }
114 
115 #endif
reco::ShallowClonePtrCandidate * neutrino_
edm::InputTag match_
input label for all necessary collections
reco::ShallowClonePtrCandidate * leptonBar_
reco::LeafCandidate * recNuBar
int key_
hypothesis key (to be set by the buildKey function)
void setCandidate(const edm::Handle< C > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone)
use one object in a collection to set a ShallowClonePtrCandidate
virtual void buildKey()=0
build the event hypothesis key
reco::LeafCandidate * recNu
candidates needed for the genmatch hypothesis
Container::value_type value_type
tuple handle
Definition: patZpeak.py:22
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
T * clone(const T *tp)
Definition: Ptr.h:42
reco::ShallowClonePtrCandidate * lepton_
reco::ShallowClonePtrCandidate * bBar_
std::string jetCorrectionLevel_
int key() const
return key
~TtFullLepHypothesis()
default destructor
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
reco::ShallowClonePtrCandidate * b_
TtFullLepHypothesis(const edm::ParameterSet &)
default constructor
virtual void produce(edm::Event &, const edm::EventSetup &)
produce the event hypothesis as CompositeCandidate and Key
bool isValid(const int &idx, const edm::Handle< std::vector< pat::Jet > > &jets)
check if index is in valid range of selected jets
reco::ShallowClonePtrCandidate * neutrinoBar_