CMS 3D CMS Logo

NamedCandCombiner.h
Go to the documentation of this file.
1 #ifndef CandUtils_NamedCandCombiner_h
2 #define CandUtils_NamedCandCombiner_h
3 
14 #include <string>
15 
16 namespace combiner {
17  namespace helpers {
18  struct NormalClone {
19  template<typename Ptr, typename CMP>
20  static void addDaughter(CMP & cmp, const Ptr & c, std::string name) {
21  cmp.addDaughter(*c, name);
22  }
23  };
24 
25  struct ShallowClone {
26  template<typename CMP>
27  static void addDaughter(CMP & cmp, const reco::CandidatePtr & c, std::string name) {
28  if(c->numberOfDaughters()==0)
30  else
31  cmp.addDaughter(*c, name);
32  }
33  };
34  }
35 }
36 
37 template<typename Selector,
38  typename PairSelector = AnyPairSelector,
39  typename Cloner = combiner::helpers::NormalClone,
40  typename Setup = AddFourMomenta>
42 public:
46  select_(), selectPair_(), setup_(), name_(name) { }
50  select_(), selectPair_(), setup_(), name_(name) { }
52  NamedCandCombiner(std::string name, int q1, int q2, int q3 ) :
54  select_(), selectPair_(), setup_(), name_(name) { }
56  NamedCandCombiner(std::string name, int q1, int q2, int q3, int q4) :
57  NamedCandCombinerBase(name, q1, q2, q3, q4),
58  select_(), selectPair_(), setup_(), name_(name) { }
68  NamedCandCombiner(std::string name, const Selector & select, int q1, int q2, int q3 ) :
72  NamedCandCombiner(std::string name, const Selector & select, int q1, int q2, int q3, int q4 ) :
73  NamedCandCombinerBase(name, q1, q2, q3, q4),
84  NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, int q1, int q2, int q3) :
88  NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, int q1, int q2, int q3, int q4) :
89  NamedCandCombinerBase(name, q1, q2, q3, q4),
99  NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, const Setup & setup, int q1, int q2, int q3) :
103  NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, const Setup & setup, int q1, int q2, int q3, int q4) :
104  NamedCandCombinerBase(name, q1, q2, q3, q4),
107  NamedCandCombiner(std::string name, const Selector & select, const PairSelector & selectPair, const Setup & setup,const std::vector <int> & dauCharge) :
110  NamedCandCombiner( std::string name, const Selector & select, const PairSelector & selectPair, const std::vector <int> & dauCharge ) :
113  NamedCandCombiner(std::string name, const std::vector <int> & dauCharge) :
114  NamedCandCombinerBase(name, true, dauCharge), select_(), selectPair_(), setup_(), name_(name) { }
117  bool checkCharge, bool checkOverlap, const std::vector <int> & dauCharge) :
121  Setup & setup() { return setup_; }
122 
123 private:
125  virtual bool select(const reco::Candidate & c) const {
126  return select_(c);
127  }
129  virtual bool selectPair(const reco::Candidate & c1, const reco::Candidate & c2) const {
130  return selectPair_(c1, c2);
131  }
133  virtual void setup(reco::NamedCompositeCandidate & c) const {
134  setup_.set(c);
135  }
138  Cloner::addDaughter(cmp, c, n);
139  }
148 };
149 
150 #endif
combiner::helpers::NormalClone::addDaughter
static void addDaughter(CMP &cmp, const Ptr &c, std::string name)
Definition: NamedCandCombiner.h:20
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const std::vector< int > &dauCharge)
constructor from a selector, specifying to check for charge
Definition: NamedCandCombiner.h:113
PA_ZEESkim_cff.checkCharge
checkCharge
Definition: PA_ZEESkim_cff.py:27
NamedCandCombiner::selectPair_
PairSelector selectPair_
candidate pair selector
Definition: NamedCandCombiner.h:143
Selector
Functor that operates on <T>
Definition: Selector.h:22
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, int q1, int q2, int q3)
constructor from a selector and three charges
Definition: NamedCandCombiner.h:52
NamedCandCombiner::name_
std::string name_
name
Definition: NamedCandCombiner.h:147
NamedCandCombiner::select
virtual bool select(const reco::Candidate &c) const
select a candidate
Definition: NamedCandCombiner.h:125
NamedCandCombiner::addDaughter
virtual void addDaughter(reco::NamedCompositeCandidate &cmp, const reco::CandidatePtr &c, std::string n) const
add candidate daughter
Definition: NamedCandCombiner.h:137
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
NamedCandCombiner::setup
Setup & setup()
return reference to setup object to allow its initialization
Definition: NamedCandCombiner.h:121
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, const PairSelector &selectPair)
constructor from selector
Definition: NamedCandCombiner.h:76
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, const PairSelector &selectPair, const Setup &setup)
Definition: NamedCandCombiner.h:91
NamedCompositeCandidate.h
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, int q1, int q2, int q3, int q4)
constructor from a selector and four charges
Definition: NamedCandCombiner.h:56
NamedCandCombiner::setup_
Setup setup_
utility to setup composite candidate kinematics from daughters
Definition: NamedCandCombiner.h:145
bmtfDigis_cfi.Setup
Setup
Definition: bmtfDigis_cfi.py:5
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name)
default constructor
Definition: NamedCandCombiner.h:44
NamedCandCombiner::select_
Selector select_
candidate selector
Definition: NamedCandCombiner.h:141
NamedCandCombinerBase
Definition: NamedCandCombinerBase.h:13
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, int q1, int q2)
constructor from a selector and two charges
Definition: NamedCandCombiner.h:48
CandSelector.h
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, 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: NamedCandCombiner.h:116
reco::NamedCompositeCandidate
Definition: NamedCompositeCandidate.h:21
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, int q1, int q2)
constructor from a selector and two charges
Definition: NamedCandCombiner.h:64
q2
double q2[4]
Definition: TauolaWrapper.h:88
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, const PairSelector &selectPair, int q1, int q2, int q3)
constructor from a selector and three charges
Definition: NamedCandCombiner.h:84
AnyPairSelector.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, const PairSelector &selectPair, const Setup &setup, int q1, int q2, int q3)
constructor from a selector and three charges
Definition: NamedCandCombiner.h:99
funct::true
true
Definition: Factorize.h:173
NamedCandCombiner::selectPair
virtual bool selectPair(const reco::Candidate &c1, const reco::Candidate &c2) const
select a candidate
Definition: NamedCandCombiner.h:129
combiner::helpers::NormalClone
Definition: CandCombiner.h:19
q1
double q1[4]
Definition: TauolaWrapper.h:87
helpers
Definition: makeCompositeCandidate.h:8
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, const PairSelector &selectPair, const std::vector< int > &dauCharge)
constructor from a selector, specifying to check for charge
Definition: NamedCandCombiner.h:110
AddFourMomenta.h
g4TestGeometry_cfi.checkOverlap
def checkOverlap(process)
Definition: g4TestGeometry_cfi.py:3
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
ShallowClonePtrCandidate.h
combiner::helpers::ShallowClone::addDaughter
static void addDaughter(CMP &cmp, const reco::CandidatePtr &c, std::string name)
Definition: NamedCandCombiner.h:27
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, const PairSelector &selectPair, const Setup &setup, int q1, int q2)
constructor from a selector and two charges
Definition: NamedCandCombiner.h:95
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
combiner
Definition: CandCombiner.h:17
NamedCandCombiner
Definition: NamedCandCombiner.h:41
edm::Ptr< Candidate >
reco::Candidate
Definition: Candidate.h:27
NamedCandCombiner::setup
virtual void setup(reco::NamedCompositeCandidate &c) const
set kinematics to reconstructed composite
Definition: NamedCandCombiner.h:133
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, const PairSelector &selectPair, const Setup &setup, const std::vector< int > &dauCharge)
constructor from a selector, specifying to check for charge
Definition: NamedCandCombiner.h:107
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, const PairSelector &selectPair, int q1, int q2)
constructor from a selector and two charges
Definition: NamedCandCombiner.h:80
ALCARECOPromptCalibProdSiPixelAli0T_cff.Selector
Selector
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:81
NamedCandCombinerBase.h
fileCollector.cmp
cmp
Definition: fileCollector.py:125
PairSelector
Definition: PairSelector.h:11
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select)
default constructor
Definition: NamedCandCombiner.h:60
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, int q1, int q2, int q3, int q4)
constructor from a selector and four charges
Definition: NamedCandCombiner.h:72
AddFourMomenta
Definition: AddFourMomenta.h:18
reco::ShallowClonePtrCandidate
Definition: ShallowClonePtrCandidate.h:15
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, int q1, int q2, int q3)
constructor from a selector and three charges
Definition: NamedCandCombiner.h:68
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, 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: NamedCandCombiner.h:103
NamedCandCombiner::NamedCandCombiner
NamedCandCombiner(std::string name, const Selector &select, const PairSelector &selectPair, int q1, int q2, int q3, int q4)
constructor from a selector and four charges
Definition: NamedCandCombiner.h:88
AnyPairSelector
Definition: AnyPairSelector.h:10