CMS 3D CMS Logo

CandidateWithRef.h
Go to the documentation of this file.
1 #ifndef Candidate_CandidateWithRef_h
2 #define Candidate_CandidateWithRef_h
3 
14 
15 namespace reco {
16 
17  template <typename Ref>
19  public:
20  typedef Ref reference;
24  CandidateWithRef(const LorentzVector &p4, Charge q = 0, const Point &vtx = Point(0, 0, 0))
25  : LeafCandidate(q, p4, vtx) {}
27  ~CandidateWithRef() override;
29  CandidateWithRef *clone() const override;
31  void setRef(const Ref &r) { ref_ = r; }
33  reference ref() const { return ref_; }
34 
36 
37  private:
39  bool overlap(const Candidate &) const override;
41  reference ref_;
42  };
43 
44  // the following has to be added for any single Ref type
45  // GET_DEFAULT_CANDIDATE_COMPONENT( CandidateWithRef<Ref>, CandidateWithRef<Ref>::reference, ref )
46 
47  template <typename Ref>
49 
50  template <typename Ref>
52  return new CandidateWithRef<Ref>(*this);
53  }
54 
55  template <typename Ref>
57  const CandidateWithRef *o = dynamic_cast<const CandidateWithRef *>(&c);
58  if (o == 0)
59  return false;
60  if (ref().isNull())
61  return false;
62  if (o->ref().isNull())
63  return false;
64  return (ref() != o->ref());
65  }
66 
67 } // namespace reco
68 
69 #endif
int Charge
electric charge type
Definition: Candidate.h:35
CandidateWithRef(const LorentzVector &p4, Charge q=0, const Point &vtx=Point(0, 0, 0))
constructor from values
reference ref_
reference to a CaloRecHit
CandidateWithRef * clone() const override
returns a clone of the candidate
#define CMS_CLASS_VERSION(_version_)
CandidateWithRef()
default constructor
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
const LorentzVector & p4() const final
four-momentum Lorentz vector
~CandidateWithRef() override
destructor
void setRef(const Ref &r)
set reference
reference ref() const
reference
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
bool overlap(const Candidate &) const override
check overlap with another candidate
fixed size matrix
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27