CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CandCombiner.h
Go to the documentation of this file.
1 #ifndef CandUtils_CandCombiner_h
2 #define CandUtils_CandCombiner_h
3 
16 
17 namespace combiner {
18  namespace helpers {
19  struct NormalClone {
21  template<typename Ref>
22  static void addDaughter(reco::CompositeCandidate & cmp, const Ref & c, const std::string name = "") {
23  cmp.addDaughter(*c, name);
24  }
25  };
26 
27  struct ShallowClone {
31  }
32  };
33  struct ShallowClonePtr {
35  static void addDaughter(reco::CompositeCandidate & cmp, const reco::CandidatePtr & c, const std::string name = "") {
37  }
38  };
39  }
40 }
41 
42 template<typename Selector,
43  typename PairSelector = AnyPairSelector,
44  typename Cloner = combiner::helpers::NormalClone,
45  typename OutputCollection = reco::CompositeCandidateCollection,
46  typename Setup = AddFourMomenta>
47 class CandCombiner : public CandCombinerBase<OutputCollection, typename Cloner::CandPtr> {
48 public:
49  typedef typename Cloner::CandPtr CandPtr;
53  base(),
54  select_(), selectPair_(), setup_() { }
56  CandCombiner(int q1, int q2) :
57  base(q1, q2),
58  select_(), selectPair_(), setup_() { }
60  CandCombiner( int q1, int q2, int q3 ) :
61  base(q1, q2, q3),
62  select_(), selectPair_(), setup_() { }
64  CandCombiner(int q1, int q2, int q3, int q4) :
65  base(q1, q2, q3, q4),
66  select_(), selectPair_(), setup_() { }
69  base( ),
70  select_(select), selectPair_(), setup_() { }
72  CandCombiner( const Selector & select, int q1, int q2 ) :
73  base(q1, q2),
74  select_(select), selectPair_(), setup_() { }
76  CandCombiner( const Selector & select, int q1, int q2, int q3 ) :
77  base(q1, q2, q3),
78  select_(select), selectPair_(), setup_() { }
80  CandCombiner( const Selector & select, int q1, int q2, int q3, int q4 ) :
81  base(q1, q2, q3, q4),
82  select_(select), selectPair_(), setup_() { }
84  CandCombiner(const Selector & select, const PairSelector & selectPair) :
85  base( ),
86  select_(select), selectPair_(selectPair), setup_() { }
88  CandCombiner(const Selector & select, const PairSelector & selectPair, int q1, int q2) :
89  base(q1, q2),
90  select_(select), selectPair_(selectPair), setup_() { }
92  CandCombiner(const Selector & select, const PairSelector & selectPair, int q1, int q2, int q3) :
93  base(q1, q2, q3),
94  select_(select), selectPair_(selectPair), setup_() { }
96  CandCombiner(const Selector & select, const PairSelector & selectPair, int q1, int q2, int q3, int q4) :
97  base(q1, q2, q3, q4),
98  select_(select), selectPair_(selectPair), setup_() { }
99  CandCombiner(const Selector & select, const PairSelector & selectPair, const Setup & setup) :
100  base(),
101  select_(select), selectPair_(selectPair), setup_(setup) { }
103  CandCombiner(const Selector & select, const PairSelector & selectPair, const Setup & setup, int q1, int q2) :
104  base(q1, q2),
105  select_(select), selectPair_(selectPair), setup_(setup) { }
107  CandCombiner(const Selector & select, const PairSelector & selectPair, const Setup & setup, int q1, int q2, int q3) :
108  base(q1, q2, q3),
109  select_(select), selectPair_(selectPair), setup_(setup) { }
111  CandCombiner(const Selector & select, const PairSelector & selectPair, const Setup & setup, int q1, int q2, int q3, int q4) :
112  base(q1, q2, q3, q4),
113  select_(select), selectPair_(selectPair), setup_(setup) { }
115  CandCombiner(const Selector & select, const PairSelector & selectPair, const Setup & setup,const std::vector <int> & dauCharge) :
116  base(true, dauCharge), select_(select), selectPair_(selectPair), setup_(setup) { }
118  CandCombiner( const Selector & select, const PairSelector & selectPair, const std::vector <int> & dauCharge ) :
119  base(true, dauCharge), select_(select), selectPair_(selectPair), setup_() { }
121  CandCombiner(const std::vector <int> & dauCharge) :
122  base(true, dauCharge), select_(), selectPair_(), setup_() { }
124  CandCombiner(const Selector & select, const PairSelector & selectPair, const Setup & setup,
125  bool checkCharge, bool checkOverlap, const std::vector <int> & dauCharge) :
126  base(checkCharge, checkOverlap, dauCharge),
127  select_(select), selectPair_(selectPair), setup_(setup) { }
129  Setup & setup() { return setup_; }
130 
131 private:
133  virtual bool select(const reco::Candidate & c) const {
134  return select_(c);
135  }
137  virtual bool selectPair(const reco::Candidate & c1, const reco::Candidate & c2) const {
138  return selectPair_(c1, c2);
139  }
141  virtual void setup(typename OutputCollection::value_type & c) const {
142  setup_.set(c);
143  }
145  virtual void addDaughter(typename OutputCollection::value_type & cmp, const CandPtr & c, const std::string name = "") const {
146  Cloner::addDaughter(cmp, c, name);
147  }
151  PairSelector selectPair_;
154 };
155 
156 #endif
virtual void setup(typename OutputCollection::value_type &c) const
set kinematics to reconstructed composite
Definition: CandCombiner.h:141
Setup & setup()
return reference to setup object to allow its initialization
Definition: CandCombiner.h:129
CandCombiner(const Selector &select, const PairSelector &selectPair, const Setup &setup, int q1, int q2, int q3, int q4)
constructor from a selector and four charges
Definition: CandCombiner.h:111
std::vector< CompositeCandidate > CompositeCandidateCollection
collection of Candidate objects
CandCombinerBase< OutputCollection, CandPtr > base
Definition: CandCombiner.h:50
static void addDaughter(reco::CompositeCandidate &cmp, const reco::CandidateBaseRef &c, const std::string name="")
Definition: CandCombiner.h:29
CandCombiner(int q1, int q2, int q3)
constructor from a selector and three charges
Definition: CandCombiner.h:60
CandCombiner()
default constructor
Definition: CandCombiner.h:52
CandCombiner(int q1, int q2, int q3, int q4)
constructor from a selector and four charges
Definition: CandCombiner.h:64
double q2[4]
Definition: TauolaWrapper.h:88
CandCombiner(const Selector &select, const PairSelector &selectPair, int q1, int q2, int q3)
constructor from a selector and three charges
Definition: CandCombiner.h:92
CandCombiner(const Selector &select, const PairSelector &selectPair, const Setup &setup, int q1, int q2, int q3)
constructor from a selector and three charges
Definition: CandCombiner.h:107
virtual bool selectPair(const reco::Candidate &c1, const reco::Candidate &c2) const
select a candidate
Definition: CandCombiner.h:137
CandCombiner(const Selector &select, const PairSelector &selectPair, const std::vector< int > &dauCharge)
constructor from a selector, specifying to check for charge
Definition: CandCombiner.h:118
CandCombiner(const Selector &select)
default constructor
Definition: CandCombiner.h:68
Setup setup_
utility to setup composite candidate kinematics from daughters
Definition: CandCombiner.h:153
CandCombiner(const Selector &select, const PairSelector &selectPair, const Setup &setup, int q1, int q2)
constructor from a selector and two charges
Definition: CandCombiner.h:103
CandCombiner(const Selector &select, int q1, int q2, int q3, int q4)
constructor from a selector and four charges
Definition: CandCombiner.h:80
virtual void addDaughter(typename OutputCollection::value_type &cmp, const CandPtr &c, const std::string name="") const
add candidate daughter
Definition: CandCombiner.h:145
virtual bool select(const reco::Candidate &c) const
select a candidate
Definition: CandCombiner.h:133
PairSelector selectPair_
candidate pair selector
Definition: CandCombiner.h:151
CandCombiner(const Selector &select, int q1, int q2, int q3)
constructor from a selector and three charges
Definition: CandCombiner.h:76
CandCombiner(const Selector &select, int q1, int q2)
constructor from a selector and two charges
Definition: CandCombiner.h:72
reco::CandidateBaseRef CandPtr
Definition: CandCombiner.h:28
Container::value_type value_type
Functor that operates on &lt;T&gt;
Definition: Selector.h:24
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
CandCombiner(const Selector &select, const PairSelector &selectPair, const Setup &setup)
Definition: CandCombiner.h:99
CandCombiner(const Selector &select, const PairSelector &selectPair, const Setup &setup, const std::vector< int > &dauCharge)
constructor from a selector, specifying to check for charge
Definition: CandCombiner.h:115
reco::CandidateBaseRef CandPtr
Definition: CandCombiner.h:20
double q1[4]
Definition: TauolaWrapper.h:87
CandCombiner(const Selector &select, const PairSelector &selectPair, const Setup &setup, bool checkCharge, bool checkOverlap, const std::vector< int > &dauCharge)
constructor from a selector, specifying optionally to check for charge
Definition: CandCombiner.h:124
Cloner::CandPtr CandPtr
Definition: CandCombiner.h:49
CandCombiner(int q1, int q2)
constructor from a selector and two charges
Definition: CandCombiner.h:56
CandCombiner(const Selector &select, const PairSelector &selectPair)
constructor from selector
Definition: CandCombiner.h:84
CandCombiner(const std::vector< int > &dauCharge)
constructor from a selector, specifying to check for charge
Definition: CandCombiner.h:121
CandCombiner(const Selector &select, const PairSelector &selectPair, int q1, int q2, int q3, int q4)
constructor from a selector and four charges
Definition: CandCombiner.h:96
CandCombiner(const Selector &select, const PairSelector &selectPair, int q1, int q2)
constructor from a selector and two charges
Definition: CandCombiner.h:88
static void addDaughter(reco::CompositeCandidate &cmp, const Ref &c, const std::string name="")
Definition: CandCombiner.h:22
static void addDaughter(reco::CompositeCandidate &cmp, const reco::CandidatePtr &c, const std::string name="")
Definition: CandCombiner.h:35
Selector select_
candidate selector
Definition: CandCombiner.h:149