CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::auto_ptr<reco::NamedCompositeCandidate> cmp ) :
11  cmp_( cmp ) {
12  }
13  void addDaughter( const reco::Candidate & dau, std::string name ) {
14  cmp_->addDaughter( dau, name );
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::NamedCompositeCandidate> 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 }
30 
32 makeNamedCompositeCandidate( const reco::Candidate & c1, std::string s1,
33  const reco::Candidate & c2, std::string s2 );
34 
36 makeNamedCompositeCandidate( const reco::Candidate & c1, std::string s1,
37  const reco::Candidate & c2, std::string s2,
38  const reco::Candidate & c3, std::string s3 );
39 
41 makeNamedCompositeCandidate( const reco::Candidate & c1, std::string s1,
42  const reco::Candidate & c2, std::string s2,
43  const reco::Candidate & c3, std::string s3 );
44 
45 
47 makeNamedCompositeCandidate( const reco::Candidate & c1, std::string s1,
48  const reco::Candidate & c2, std::string s2,
49  const reco::Candidate & c3, std::string s3,
50  const reco::Candidate & c4, std::string s4 );
51 
52 template<typename C>
54 makeNamedCompositeCandidate( const typename C::const_iterator & begin,
55  const typename C::const_iterator & end,
56  const std::vector<std::string>::const_iterator sbegin,
57  const std::vector<std::string>::const_iterator send ) {
59  cmp( std::auto_ptr<reco::NamedCompositeCandidate>( new reco::NamedCompositeCandidate ) );
60  std::vector<std::string>::const_iterator si = sbegin;
61  for( typename C::const_iterator i = begin; i != end && si != send; ++ i, ++si )
62  cmp.addDaughter( * i, * si );
63  return cmp;
64 }
65 
68  const reco::CandidateRef & c2, std::string s2 );
69 
72  const reco::CandidateRef & c2, std::string s2,
73  const reco::CandidateRef & c3, std::string s3 );
74 
77  const reco::CandidateRef & c2, std::string s2,
78  const reco::CandidateRef & c3, std::string s3,
79  const reco::CandidateRef & c4, std::string s4 );
80 
81 template<typename C>
83 makeNamedCompositeCandidateWithRefsToMaster( const typename C::const_iterator & begin,
84  const typename C::const_iterator & end,
85  const std::vector<std::string>::const_iterator sbegin,
86  const std::vector<std::string>::const_iterator send ) {
88  cmp( std::auto_ptr<reco::NamedCompositeCandidate>( new reco::NamedCompositeCandidate ) );
89  std::vector<std::string>::const_iterator si = sbegin;
90  for( typename C::const_iterator i = begin; i != end && si != send; ++ i, ++ si )
91  cmp.addDaughter( ShallowCloneCandidate( CandidateBaseRef( * i ) ), * si );
92  return cmp;
93 }
94 
95 #endif
int i
Definition: DBlmapReader.cc:9
NamedCompositeCandidateMaker(std::auto_ptr< reco::NamedCompositeCandidate > cmp)
void addDaughter(const reco::Candidate &dau, std::string name)
std::auto_ptr< reco::Candidate > operator[](const S &setup)
tuple s2
Definition: indexGen.py:106
#define end
Definition: vmac.h:38
helpers::NamedCompositeCandidateMaker makeNamedCompositeCandidate(const reco::Candidate &c1, std::string s1, const reco::Candidate &c2, std::string s2)
helpers::NamedCompositeCandidateMaker makeNamedCompositeCandidateWithRefsToMaster(const reco::CandidateRef &c1, std::string s1, const reco::CandidateRef &c2, std::string s2)
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
std::auto_ptr< reco::NamedCompositeCandidate > cmp_
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
std::auto_ptr< reco::Candidate > release()