CMS 3D CMS Logo

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  const std::string name = "") {
32  cmp.addDaughter(reco::ShallowCloneCandidate(c), name);
33  }
34  };
35  struct ShallowClonePtr {
39  }
40  };
41  } // namespace helpers
42 } // namespace combiner
43 
44 template <typename Selector,
45  typename PairSelector = AnyPairSelector,
46  typename Cloner = combiner::helpers::NormalClone,
48  typename Setup = AddFourMomenta>
49 class CandCombiner : public CandCombinerBase<OutputCollection, typename Cloner::CandPtr> {
50 public:
51  typedef typename Cloner::CandPtr CandPtr;
56  CandCombiner(int q1, int q2) : base(q1, q2), select_(), selectPair_(), setup_() {}
58  CandCombiner(int q1, int q2, int q3) : base(q1, q2, q3), select_(), selectPair_(), setup_() {}
60  CandCombiner(int q1, int q2, int q3, int q4) : base(q1, q2, q3, q4), select_(), selectPair_(), setup_() {}
66  CandCombiner(const Selector& select, int q1, int q2, int q3)
67  : base(q1, q2, q3), select_(select), selectPair_(), setup_() {}
69  CandCombiner(const Selector& select, int q1, int q2, int q3, int q4)
70  : base(q1, q2, q3, q4), select_(select), selectPair_(), setup_() {}
78  CandCombiner(const Selector& select, const PairSelector& selectPair, int q1, int q2, int q3)
81  CandCombiner(const Selector& select, const PairSelector& selectPair, int q1, int q2, int q3, int q4)
82  : base(q1, q2, q3, q4), select_(select), selectPair_(selectPair), setup_() {}
86  CandCombiner(const Selector& select, const PairSelector& selectPair, const Setup& setup, int q1, int q2)
89  CandCombiner(const Selector& select, const PairSelector& selectPair, const Setup& setup, int q1, int q2, int q3)
93  const Selector& select, const PairSelector& selectPair, const Setup& setup, int q1, int q2, int q3, int q4)
97  const PairSelector& selectPair,
98  const Setup& setup,
99  const std::vector<int>& dauCharge)
100  : base(true, dauCharge), select_(select), selectPair_(selectPair), setup_(setup) {}
102  CandCombiner(const Selector& select, const PairSelector& selectPair, const std::vector<int>& dauCharge)
103  : base(true, dauCharge), select_(select), selectPair_(selectPair), setup_() {}
105  CandCombiner(const std::vector<int>& dauCharge) : base(true, dauCharge), select_(), selectPair_(), setup_() {}
108  const PairSelector& selectPair,
109  const Setup& setup,
110  bool checkCharge,
111  bool checkOverlap,
112  const std::vector<int>& dauCharge)
115  Setup& setup() { return setup_; }
116 
117 private:
119  bool select(const reco::Candidate& c) const override { return select_(c); }
121  bool selectPair(const reco::Candidate& c1, const reco::Candidate& c2) const override { return selectPair_(c1, c2); }
123  void setup(typename OutputCollection::value_type& c) const override { setup_.set(c); }
126  const CandPtr& c,
127  const std::string name = "") const override {
128  Cloner::addDaughter(cmp, c, name);
129  }
136 };
137 
138 #endif
CandCombiner::CandCombiner
CandCombiner(const Selector &select, int q1, int q2, int q3, int q4)
constructor from a selector and four charges
Definition: CandCombiner.h:69
PA_ZEESkim_cff.checkCharge
checkCharge
Definition: PA_ZEESkim_cff.py:27
CandCombiner::CandCombiner
CandCombiner(const Selector &select, int q1, int q2, int q3)
constructor from a selector and three charges
Definition: CandCombiner.h:66
Selector
Functor that operates on <T>
Definition: Selector.h:22
CompositeCandidate.h
CandCombiner::CandCombiner
CandCombiner(const Selector &select, const PairSelector &selectPair, const Setup &setup)
Definition: CandCombiner.h:83
CandCombiner::CandCombiner
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:96
CandCombiner::select
bool select(const reco::Candidate &c) const override
select a candidate
Definition: CandCombiner.h:119
NamedCompositeCandidate.h
bmtfDigis_cfi.Setup
Setup
Definition: bmtfDigis_cfi.py:5
CandCombiner::CandCombiner
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:92
CandCombiner::CandCombiner
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:81
CandCombiner::CandCombiner
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:107
combiner::helpers::ShallowClonePtr::CandPtr
reco::CandidatePtr CandPtr
Definition: CandCombiner.h:36
CandCombiner::setup
Setup & setup()
return reference to setup object to allow its initialization
Definition: CandCombiner.h:115
combiner::helpers::ShallowClone::addDaughter
static void addDaughter(reco::CompositeCandidate &cmp, const reco::CandidateBaseRef &c, const std::string name="")
Definition: CandCombiner.h:29
CandCombiner::CandCombiner
CandCombiner(const Selector &select, const PairSelector &selectPair, int q1, int q2)
constructor from a selector and two charges
Definition: CandCombiner.h:75
CandCombiner::CandCombiner
CandCombiner(const Selector &select, const PairSelector &selectPair)
constructor from selector
Definition: CandCombiner.h:72
CandCombiner::CandCombiner
CandCombiner(const std::vector< int > &dauCharge)
constructor from a selector, specifying to check for charge
Definition: CandCombiner.h:105
CandCombiner::CandCombiner
CandCombiner(int q1, int q2)
constructor from a selector and two charges
Definition: CandCombiner.h:56
reco::CompositeCandidateCollection
std::vector< CompositeCandidate > CompositeCandidateCollection
collection of Candidate objects
Definition: CompositeCandidateFwd.h:19
CandSelector.h
CandCombiner::CandCombiner
CandCombiner(const Selector &select, int q1, int q2)
constructor from a selector and two charges
Definition: CandCombiner.h:64
CandCombiner::CandCombiner
CandCombiner()
default constructor
Definition: CandCombiner.h:54
CandCombiner::selectPair
bool selectPair(const reco::Candidate &c1, const reco::Candidate &c2) const override
select a candidate
Definition: CandCombiner.h:121
q2
double q2[4]
Definition: TauolaWrapper.h:88
AnyPairSelector.h
CandCombiner::CandCombiner
CandCombiner(const Selector &select, const PairSelector &selectPair, int q1, int q2, int q3)
constructor from a selector and three charges
Definition: CandCombiner.h:78
CandCombiner::select_
Selector select_
candidate selector
Definition: CandCombiner.h:131
funct::true
true
Definition: Factorize.h:173
combiner::helpers::NormalClone
Definition: CandCombiner.h:19
q1
double q1[4]
Definition: TauolaWrapper.h:87
helpers
Definition: makeCompositeCandidate.h:8
combiner::helpers::ShallowClone
Definition: CandCombiner.h:27
CandCombiner::CandCombiner
CandCombiner(int q1, int q2, int q3)
constructor from a selector and three charges
Definition: CandCombiner.h:58
AddFourMomenta.h
combiner::helpers::NormalClone::CandPtr
reco::CandidateBaseRef CandPtr
Definition: CandCombiner.h:20
g4TestGeometry_cfi.checkOverlap
def checkOverlap(process)
Definition: g4TestGeometry_cfi.py:3
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
ShallowClonePtrCandidate.h
CandCombiner::base
CandCombinerBase< OutputCollection, CandPtr > base
Definition: CandCombiner.h:52
combiner::helpers::ShallowClonePtr
Definition: CandCombiner.h:35
CandCombiner::selectPair_
PairSelector selectPair_
candidate pair selector
Definition: CandCombiner.h:133
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
combiner
Definition: CandCombiner.h:17
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Ptr< Candidate >
reco::Candidate
Definition: Candidate.h:27
CandCombiner::CandCombiner
CandCombiner(int q1, int q2, int q3, int q4)
constructor from a selector and four charges
Definition: CandCombiner.h:60
ShallowCloneCandidate.h
ALCARECOPromptCalibProdSiPixelAli0T_cff.Selector
Selector
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:81
fileCollector.cmp
cmp
Definition: fileCollector.py:125
CandCombiner::setup
void setup(typename OutputCollection::value_type &c) const override
set kinematics to reconstructed composite
Definition: CandCombiner.h:123
reco::JetExtendedAssociation::Ref
edm::Ref< Container > Ref
Definition: JetExtendedAssociation.h:32
CandCombinerBase.h
CandCombiner::addDaughter
void addDaughter(typename OutputCollection::value_type &cmp, const CandPtr &c, const std::string name="") const override
add candidate daughter
Definition: CandCombiner.h:125
PairSelector
Definition: PairSelector.h:11
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::RefToBase< Candidate >
CandCombiner::CandCombiner
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:89
CandCombiner
Definition: CandCombiner.h:49
reco::ShallowCloneCandidate
Definition: ShallowCloneCandidate.h:15
AddFourMomenta
Definition: AddFourMomenta.h:18
CandCombinerBase
Definition: CandCombinerBase.h:14
reco::ShallowClonePtrCandidate
Definition: ShallowClonePtrCandidate.h:15
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
HLTTauReferences_cfi.OutputCollection
OutputCollection
Definition: HLTTauReferences_cfi.py:92
CandCombiner::setup_
Setup setup_
utility to setup composite candidate kinematics from daughters
Definition: CandCombiner.h:135
combiner::helpers::ShallowClone::CandPtr
reco::CandidateBaseRef CandPtr
Definition: CandCombiner.h:28
CandCombiner::CandPtr
Cloner::CandPtr CandPtr
Definition: CandCombiner.h:51
CandCombiner::CandCombiner
CandCombiner(const Selector &select, const PairSelector &selectPair, const std::vector< int > &dauCharge)
constructor from a selector, specifying to check for charge
Definition: CandCombiner.h:102
CandCombiner::CandCombiner
CandCombiner(const Selector &select, const PairSelector &selectPair, const Setup &setup, int q1, int q2)
constructor from a selector and two charges
Definition: CandCombiner.h:86
CandCombiner::CandCombiner
CandCombiner(const Selector &select)
default constructor
Definition: CandCombiner.h:62
combiner::helpers::ShallowClonePtr::addDaughter
static void addDaughter(reco::CompositeCandidate &cmp, const reco::CandidatePtr &c, const std::string name="")
Definition: CandCombiner.h:37
reco::CompositeCandidate
Definition: CompositeCandidate.h:21
AnyPairSelector
Definition: AnyPairSelector.h:10
combiner::helpers::NormalClone::addDaughter
static void addDaughter(reco::CompositeCandidate &cmp, const Ref &c, const std::string name="")
Definition: CandCombiner.h:22