CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
makeCompositeCandidate.h
Go to the documentation of this file.
1 #ifndef CandUtils_makeCompositeCandidate_h
2 #define CandUtils_makeCompositeCandidate_h
6 #include <memory>
7 
8 namespace helpers {
10  CompositeCandidateMaker(std::auto_ptr<reco::CompositeCandidate> cmp) :
11  cmp_( cmp ) {
12  }
13  void addDaughter(const reco::Candidate & dau) {
14  cmp_->addDaughter( dau );
15  }
16  template<typename S>
17  std::auto_ptr<reco::Candidate> operator[]( const S & setup ) {
18  setup.set( * cmp_ );
19  return release();
20  }
21  private:
22  std::auto_ptr<reco::CompositeCandidate> cmp_;
23  std::auto_ptr<reco::Candidate> release() {
24  std::auto_ptr<reco::Candidate> ret( cmp_.get() );
25  cmp_.release();
26  return ret;
27  }
28  };
29 
31  CompositePtrCandidateMaker(std::auto_ptr<reco::CompositePtrCandidate> cmp) :
32  cmp_( cmp ) {
33  }
34  void addDaughter(const reco::CandidatePtr & dau) {
35  cmp_->addDaughter( dau );
36  }
37  template<typename S>
38  std::auto_ptr<reco::Candidate> operator[]( const S & setup ) {
39  setup.set( * cmp_ );
40  return release();
41  }
42  private:
43  std::auto_ptr<reco::CompositePtrCandidate> cmp_;
44  std::auto_ptr<reco::Candidate> release() {
45  std::auto_ptr<reco::Candidate> ret( cmp_.get() );
46  cmp_.release();
47  return ret;
48  }
49  };
50 }
51 
54  const reco::Candidate & c2);
55 
58  const reco::Candidate & c2,
59  const reco::Candidate & c3);
60 
63  const reco::Candidate & c2,
64  const reco::Candidate & c3);
65 
66 
69  const reco::Candidate & c2,
70  const reco::Candidate & c3,
71  const reco::Candidate & c4);
72 
73 template<typename C>
75 makeCompositeCandidate(const typename C::const_iterator & begin,
76  const typename C::const_iterator & end) {
78  cmp(std::auto_ptr<reco::CompositeCandidate>(new reco::CompositeCandidate) );
79  for(typename C::const_iterator i = begin; i != end; ++ i)
80  cmp.addDaughter(* i);
81  return cmp;
82 }
83 
86  const reco::CandidateRef & c2);
87 
90  const reco::CandidateRef & c2,
91  const reco::CandidateRef & c3);
92 
95  const reco::CandidateRef & c2,
96  const reco::CandidateRef & c3,
97  const reco::CandidateRef & c4);
98 
99 template<typename C>
101 makeCompositeCandidateWithRefsToMaster(const typename C::const_iterator & begin,
102  const typename C::const_iterator & end) {
104  cmp(std::auto_ptr<reco::CompositeCandidate>(new reco::CompositeCandidate));
105  for(typename C::const_iterator i = begin; i != end; ++ i)
106  cmp.addDaughter(ShallowCloneCandidate(CandidateBaseRef(* i)));
107  return cmp;
108 }
109 
112  const reco::CandidatePtr & c2);
113 
116  const reco::CandidatePtr & c2,
117  const reco::CandidatePtr & c3);
118 
121  const reco::CandidatePtr & c2,
122  const reco::CandidatePtr & c3);
123 
124 
127  const reco::CandidatePtr & c2,
128  const reco::CandidatePtr & c3,
129  const reco::CandidatePtr & c4);
130 
131 #endif
int i
Definition: DBlmapReader.cc:9
void addDaughter(const reco::CandidatePtr &dau)
std::auto_ptr< reco::CompositeCandidate > cmp_
void addDaughter(const reco::Candidate &dau)
helpers::CompositePtrCandidateMaker makeCompositePtrCandidate(const reco::CandidatePtr &c1, const reco::CandidatePtr &c2)
std::auto_ptr< reco::Candidate > operator[](const S &setup)
std::auto_ptr< reco::Candidate > operator[](const S &setup)
std::auto_ptr< reco::CompositePtrCandidate > cmp_
#define end
Definition: vmac.h:38
helpers::CompositeCandidateMaker makeCompositeCandidateWithRefsToMaster(const reco::CandidateRef &c1, const reco::CandidateRef &c2)
std::auto_ptr< reco::Candidate > release()
edm::RefToBase< Candidate > CandidateBaseRef
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:31
#define begin
Definition: vmac.h:31
helpers::CompositeCandidateMaker makeCompositeCandidate(const reco::Candidate &c1, const reco::Candidate &c2)
std::auto_ptr< reco::Candidate > release()
CompositeCandidateMaker(std::auto_ptr< reco::CompositeCandidate > cmp)
CompositePtrCandidateMaker(std::auto_ptr< reco::CompositePtrCandidate > cmp)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")