CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CandidateWithRef.h
Go to the documentation of this file.
1 #ifndef Candidate_CandidateWithRef_h
2 #define Candidate_CandidateWithRef_h
3 
13 
14 namespace reco {
15 
16  template<typename Ref>
18  public:
19  typedef Ref reference;
23  CandidateWithRef( const LorentzVector & p4, Charge q = 0, const Point & vtx = Point( 0, 0, 0 ) ) :
24  LeafCandidate( q, p4, vtx ) { }
26  virtual ~CandidateWithRef();
28  virtual CandidateWithRef * clone() const;
30  void setRef( const Ref & r ) { ref_ = r; }
32  reference ref() const { return ref_; }
33 
35 
36  private:
38  virtual bool overlap( const Candidate & ) const;
41  };
42 
43  // the following has to be added for any single Ref type
44  // GET_DEFAULT_CANDIDATE_COMPONENT( CandidateWithRef<Ref>, CandidateWithRef<Ref>::reference, ref )
45 
46  template<typename Ref>
48  }
49 
50  template<typename Ref>
52  return new CandidateWithRef<Ref>( * this );
53  }
54 
55  template<typename Ref>
56  bool CandidateWithRef<Ref>::overlap( const Candidate & c ) const {
57  const CandidateWithRef * o = dynamic_cast<const CandidateWithRef *>( & c );
58  if ( o == 0 ) return false;
59  if ( ref().isNull() ) return false;
60  if ( o->ref().isNull() ) return false;
61  return ( ref() != o->ref() );
62  }
63 
64 }
65 
66 #endif
int Charge
electric charge type
Definition: Candidate.h:39
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
CandidateWithRef(const LorentzVector &p4, Charge q=0, const Point &vtx=Point(0, 0, 0))
constructor from values
reference ref_
reference to a CaloRecHit
#define CMS_CLASS_VERSION(_version_)
CandidateWithRef()
default constructor
virtual bool overlap(const Candidate &) const
check overlap with another candidate
virtual CandidateWithRef * clone() const
returns a clone of the candidate
virtual ~CandidateWithRef()
destructor
void setRef(const Ref &r)
set reference
reference ref() const
reference
string const
Definition: compareJSON.py:14
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
#define private
Definition: FWFileEntry.h:17
math::XYZPoint Point
point in the space
Definition: Candidate.h:45
def template
Definition: svgfig.py:520
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:32