CMS 3D CMS Logo

makeNamedCompositeCandidate.h
Go to the documentation of this file.
1 #ifndef CandUtils_makeNamedCompositeCandidate_h
2 #define CandUtils_makeNamedCompositeCandidate_h
5 #include <memory>
6 #include <string>
7 
8 namespace helpers {
10  NamedCompositeCandidateMaker(std::unique_ptr<reco::NamedCompositeCandidate> cmp) : cmp_(std::move(cmp)) {}
11 
12  void addDaughter(const reco::Candidate& dau, std::string name) { cmp_->addDaughter(dau, name); }
13  template <typename S>
14  std::unique_ptr<reco::Candidate> operator[](const S& setup) {
15  setup.set(*cmp_);
16  return release();
17  }
18 
19  private:
20  std::unique_ptr<reco::NamedCompositeCandidate> cmp_;
21  std::unique_ptr<reco::Candidate> release() {
22  std::unique_ptr<reco::Candidate> ret(cmp_.get());
23  cmp_.release();
24  return ret;
25  }
26  };
27 } // namespace helpers
28 
30  std::string s1,
31  const reco::Candidate& c2,
32  std::string s2);
33 
35  std::string s1,
36  const reco::Candidate& c2,
38  const reco::Candidate& c3,
39  std::string s3);
40 
42  std::string s1,
43  const reco::Candidate& c2,
45  const reco::Candidate& c3,
46  std::string s3);
47 
49  std::string s1,
50  const reco::Candidate& c2,
52  const reco::Candidate& c3,
53  std::string s3,
54  const reco::Candidate& c4,
55  std::string s4);
56 
57 template <typename C>
59  const typename C::const_iterator& end,
60  const std::vector<std::string>::const_iterator sbegin,
61  const std::vector<std::string>::const_iterator send) {
63  std::unique_ptr<reco::NamedCompositeCandidate>(new reco::NamedCompositeCandidate));
64  std::vector<std::string>::const_iterator si = sbegin;
65  for (typename C::const_iterator i = begin; i != end && si != send; ++i, ++si)
66  cmp.addDaughter(*i, *si);
67  return cmp;
68 }
69 
71  std::string s1,
72  const reco::CandidateRef& c2,
73  std::string s2);
74 
76  std::string s1,
77  const reco::CandidateRef& c2,
79  const reco::CandidateRef& c3,
80  std::string s3);
81 
83  std::string s1,
84  const reco::CandidateRef& c2,
86  const reco::CandidateRef& c3,
87  std::string s3,
88  const reco::CandidateRef& c4,
89  std::string s4);
90 
91 template <typename C>
93  const typename C::const_iterator& begin,
94  const typename C::const_iterator& end,
95  const std::vector<std::string>::const_iterator sbegin,
96  const std::vector<std::string>::const_iterator send) {
98  std::unique_ptr<reco::NamedCompositeCandidate>(new reco::NamedCompositeCandidate));
99  std::vector<std::string>::const_iterator si = sbegin;
100  for (typename C::const_iterator i = begin; i != end && si != send; ++i, ++si)
101  cmp.addDaughter(ShallowCloneCandidate(CandidateBaseRef(*i)), *si);
102  return cmp;
103 }
104 
105 #endif
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
mps_fire.i
i
Definition: mps_fire.py:428
makeNamedCompositeCandidate
helpers::NamedCompositeCandidateMaker makeNamedCompositeCandidate(const reco::Candidate &c1, std::string s1, const reco::Candidate &c2, std::string s2)
Definition: makeNamedCompositeCandidate.cc:7
NamedCompositeCandidate.h
helpers::NamedCompositeCandidateMaker::addDaughter
void addDaughter(const reco::Candidate &dau, std::string name)
Definition: makeNamedCompositeCandidate.h:12
indexGen.s2
s2
Definition: indexGen.py:107
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::Ref
Definition: AssociativeIterator.h:58
mps_fire.end
end
Definition: mps_fire.py:242
reco::NamedCompositeCandidate
Definition: NamedCompositeCandidate.h:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::CandidateBaseRef
edm::RefToBase< Candidate > CandidateBaseRef
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:31
helpers::NamedCompositeCandidateMaker::cmp_
std::unique_ptr< reco::NamedCompositeCandidate > cmp_
Definition: makeNamedCompositeCandidate.h:20
helpers
Definition: makeCompositeCandidate.h:8
helpers::NamedCompositeCandidateMaker::release
std::unique_ptr< reco::Candidate > release()
Definition: makeNamedCompositeCandidate.h:21
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
helpers::NamedCompositeCandidateMaker
Definition: makeNamedCompositeCandidate.h:9
makeNamedCompositeCandidateWithRefsToMaster
helpers::NamedCompositeCandidateMaker makeNamedCompositeCandidateWithRefsToMaster(const reco::CandidateRef &c1, std::string s1, const reco::CandidateRef &c2, std::string s2)
Definition: makeNamedCompositeCandidate.cc:42
reco::Candidate
Definition: Candidate.h:27
ShallowCloneCandidate.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
fileCollector.cmp
cmp
Definition: fileCollector.py:125
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
S
Definition: CSCDBL1TPParametersExtended.h:16
helpers::NamedCompositeCandidateMaker::operator[]
std::unique_ptr< reco::Candidate > operator[](const S &setup)
Definition: makeNamedCompositeCandidate.h:14
helpers::NamedCompositeCandidateMaker::NamedCompositeCandidateMaker
NamedCompositeCandidateMaker(std::unique_ptr< reco::NamedCompositeCandidate > cmp)
Definition: makeNamedCompositeCandidate.h:10