CMS 3D CMS Logo

TtFullHadHypothesis.h
Go to the documentation of this file.
1 #ifndef TtFullHadHypothesis_h
2 #define TtFullHadHypothesis_h
3 
4 #include <memory>
5 #include <vector>
6 
11 
14 
16 
17 /*
18  \class TtFullHadHypothesis TtFullHadHypothesis.h "TopQuarkAnalysis/TopJetCombination/interface/TtFullHadHypothesis.h"
19 
20  \brief Interface class for the creation of full-hadronic ttbar event hypotheses
21 
22  The class provides an interface for the creation of full-hadronic ttbar event hypotheses. Input information is read
23  from the event content and the proper candidate creation is taken care of. Hypotheses are characterized by the
24  CompositeCandidate made of a ttbar pair (including all its decay products in a parton level interpretation) and an
25  enumerator type key to specify the algorithm to determine the candidate (hypothesis cklass). The buildKey and the
26  buildHypo class have to implemented by derived classes.
27 **/
28 
30 public:
32  explicit TtFullHadHypothesis(const edm::ParameterSet& cfg);
34  ~TtFullHadHypothesis() override;
35 
36 protected:
38  void produce(edm::Event&, const edm::EventSetup&) override;
40  void resetCandidates();
43  std::string jetCorrectionLevel(const std::string& quarkType);
45  template <typename C>
48  void setCandidate(const edm::Handle<std::vector<pat::Jet> >& handle,
49  const int& idx,
51  const std::string& correctionLevel);
53  int key() const { return key_; };
57  bool isValid(const int& idx, const edm::Handle<std::vector<pat::Jet> >& jets) {
58  return (0 <= idx && idx < (int)jets->size());
59  };
60 
61  // -----------------------------------------
62  // implemet the following two functions
63  // for a concrete event hypothesis
64  // -----------------------------------------
65 
67  virtual void buildKey() = 0;
69  virtual void buildHypo(edm::Event& event,
70  const edm::Handle<std::vector<pat::Jet> >& jets,
71  std::vector<int>& jetPartonAssociation,
72  const unsigned int iComb) = 0;
73 
74 protected:
77  bool getMatch_;
85  int key_;
94 };
95 
96 // has to be placed in the header since otherwise the function template
97 // would cause unresolved references in classes derived from this base class
98 template <typename C>
100  const int& idx,
102  typedef typename C::value_type O;
104  clone = new reco::ShallowClonePtrCandidate(ptr, ptr->charge(), ptr->p4(), ptr->vertex());
105 }
106 #endif
int key() const
return key
void setCandidate(const edm::Handle< C > &handle, const int &idx, reco::ShallowClonePtrCandidate *&clone)
use one object in a collection to set a ShallowClonePtrCandidate
std::string jetCorrectionLevel(const std::string &quarkType)
helper function to construct the proper correction level string for corresponding quarkType ...
reco::ShallowClonePtrCandidate * lightPBar_
~TtFullHadHypothesis() override
default destructor
reco::ShallowClonePtrCandidate * lightQBar_
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 * lightP_
virtual void buildHypo(edm::Event &event, const edm::Handle< std::vector< pat::Jet > > &jets, std::vector< int > &jetPartonAssociation, const unsigned int iComb)=0
build event hypothesis from the reco objects of a full-hadronic event
void produce(edm::Event &, const edm::EventSetup &) override
produce the event hypothesis as CompositeCandidate and Key
edm::EDGetTokenT< std::vector< std::vector< int > > > matchToken_
std::string jetCorrectionLevel_
virtual void buildKey()=0
build the event hypothesis key
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
reco::ShallowClonePtrCandidate * bBar_
void resetCandidates()
reset candidate pointers before hypo build process
reco::ShallowClonePtrCandidate * b_
int key_
hypothesis key (to be set by the buildKey function)
TtFullHadHypothesis(const edm::ParameterSet &cfg)
default constructor
reco::CompositeCandidate hypo()
return event hypothesis
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
input label for all necessary collections
reco::ShallowClonePtrCandidate * lightQ_
Definition: event.py:1