CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LeafRefCandidateT.h
Go to the documentation of this file.
1 #ifndef Candidate_LeafRefCandidateT_h
2 #define Candidate_LeafRefCandidateT_h
3 
14 
15 
16 namespace reco {
17 
19  public:
23  typedef int Charge;
32 
33  typedef unsigned int index;
34 
37  // constructor from T
38  template < class REF >
39  LeafRefCandidateT( const REF & c, float m) :
40  LeafCandidate(c->charge(),PolarLorentzVector(c->pt(), c->eta(), c->phi(), m ),c->vertex()),
41  ref_(c.refCore(), c.key()){}
43  virtual ~LeafRefCandidateT() {}
44 
45 protected:
46  // get the ref (better be the correct ref!)
47  template<typename REF>
48  REF getRef() const { return REF(ref_.toRefCore(),ref_.index()); }
49 
50 public:
52  virtual size_t numberOfDaughters() const GCC11_FINAL { return 0; }
54  virtual const Candidate * daughter( size_type ) const GCC11_FINAL { return 0; }
56  virtual size_t numberOfMothers() const GCC11_FINAL { return 0; }
58  virtual const Candidate * mother( size_type ) const GCC11_FINAL { return 0; }
60  virtual Candidate * daughter( size_type ) GCC11_FINAL { return 0; }
62  virtual Candidate * daughter(const std::string& s ) GCC11_FINAL { return 0; }
64  virtual const Candidate * daughter(const std::string& s ) const GCC11_FINAL { return 0; }
67  virtual size_t numberOfSourceCandidatePtrs() const GCC11_FINAL { return 0;}
71  static const CandidatePtr dummyPtr;
72  return dummyPtr;
73  }
74 
75 
76 
78  virtual bool hasMasterClone() const GCC11_FINAL { return false; }
82  static const CandidateBaseRef dummyRef; return dummyRef;
83  }
86  virtual bool hasMasterClonePtr() const GCC11_FINAL { return false; }
90  static const CandidatePtr dummyPtr; return dummyPtr;
91  }
92 
94  template<typename Ref>
95  Ref masterRef() const { Ref dummyRef; return dummyRef; }
97 
98  template<typename C> C get() const {
99  if ( hasMasterClone() ) return masterClone()->template get<C>();
100  else return reco::get<C>( * this );
101  }
103  template<typename C, typename Tag> C get() const {
104  if ( hasMasterClone() ) return masterClone()->template get<C, Tag>();
105  else return reco::get<C, Tag>( * this );
106  }
108  template<typename C> C get( size_type i ) const {
109  if ( hasMasterClone() ) return masterClone()->template get<C>( i );
110  else return reco::get<C>( * this, i );
111  }
113  template<typename C, typename Tag> C get( size_type i ) const {
114  if ( hasMasterClone() ) return masterClone()->template get<C, Tag>( i );
115  else return reco::get<C, Tag>( * this, i );
116  }
118  template<typename C> size_type numberOf() const {
119  if ( hasMasterClone() ) return masterClone()->template numberOf<C>();
120  else return reco::numberOf<C>( * this );
121  }
123  template<typename C, typename Tag> size_type numberOf() const {
124  if ( hasMasterClone() ) return masterClone()->template numberOf<C, Tag>();
125  else return reco::numberOf<C, Tag>( * this );
126  }
127 
128 
129  virtual bool isElectron() const GCC11_FINAL { return false; }
130  virtual bool isMuon() const GCC11_FINAL { return false; }
131  virtual bool isStandAloneMuon() const GCC11_FINAL { return false; }
132  virtual bool isGlobalMuon() const GCC11_FINAL { return false; }
133  virtual bool isTrackerMuon() const GCC11_FINAL { return false; }
134  virtual bool isCaloMuon() const GCC11_FINAL { return false; }
135  virtual bool isPhoton() const GCC11_FINAL { return false; }
136  virtual bool isConvertedPhoton() const GCC11_FINAL { return false; }
137  virtual bool isJet() const GCC11_FINAL { return false; }
138 
140 
141  protected:
142 
144  virtual bool overlap( const Candidate & ) const;
145  virtual bool overlap( const LeafRefCandidateT & ) const;
146  template<typename, typename, typename> friend struct component;
147  friend class ::OverlapChecker;
148  friend class ShallowCloneCandidate;
150 
151  protected:
152  edm::RefCoreWithIndex ref_;
153  private:
154 
158  /*
159  virtual void setCharge( Charge q ) GCC11_FINAL {}
160  virtual void setThreeCharge( Charge qx3 ) GCC11_FINAL {}
161  virtual void setP4( const LorentzVector & p4 ) GCC11_FINAL {}
162  virtual void setP4( const PolarLorentzVector & p4 ) GCC11_FINAL {}
163  virtual void setPz( double pz ) GCC11_FINAL {}
164  virtual void setVertex( const Point & vertex ) GCC11_FINAL {}
165  virtual void setPdgId( int pdgId ) GCC11_FINAL {}
166  virtual void setStatus( int status ) GCC11_FINAL {}
167  virtual void setLongLived() GCC11_FINAL {}
168  virtual void setMassConstraint() GCC11_FINAL {}
169 
170  virtual double vertexChi2() const GCC11_FINAL { return 0.; }
171  virtual double vertexNdof() const GCC11_FINAL { return 0.; }
172  virtual double vertexNormalizedChi2() const GCC11_FINAL { return 0.; }
173  virtual double vertexCovariance(int i, int j) const GCC11_FINAL { return 0.; }
174  virtual void fillVertexCovariance(CovarianceMatrix & v) const GCC11_FINAL {}
175  */
176  };
177 
178 
179 
180  inline
181  bool LeafRefCandidateT::overlap( const Candidate & o ) const {
182  return p4() == o.p4() && vertex() == o.vertex() && charge() == o.charge();
183  }
184 
185  inline
187  return (ref_.id() == o.ref_.id()) & (ref_.index() == o.ref_.index());
188  }
189 
190 
191 
192 }
193 
194 #endif
virtual const CandidatePtr & masterClonePtr() const
int i
Definition: DBlmapReader.cc:9
virtual bool overlap(const Candidate &) const
check overlap with another Candidate
#define GCC11_FINAL
Ref masterRef() const
cast master clone reference to a concrete type
virtual const Candidate * mother(size_type) const
return mother at a given position (throws an exception)
math::XYZVector Vector
point in the space
virtual bool isConvertedPhoton() const
size_t size_type
Definition: Candidate.h:30
virtual CandidatePtr sourceCandidatePtr(size_type i) const
virtual const Point & vertex() const
vertex position (overwritten by PF...)
virtual bool isStandAloneMuon() const
unsigned int index() const
virtual const Candidate * daughter(size_type) const
return daughter at a given position (throws an exception)
virtual bool isElectron() const
virtual bool hasMasterClonePtr() const
virtual Candidate * daughter(size_type)
return daughter at a given position (throws an exception)
#define CMS_CLASS_VERSION(_version_)
Definition: classes.h:31
ProductID id() const
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
size_type numberOf() const
number of components
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual bool isCaloMuon() const
RefCore const & toRefCore() const
virtual bool isJet() const
virtual int charge() const
electric charge
Definition: LeafCandidate.h:91
size_type numberOf() const
number of components
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
LeafRefCandidateT()
default constructor
int Charge
electric charge type
virtual ~LeafRefCandidateT()
destructor
LeafRefCandidateT(const REF &c, float m)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
CandidateCollection daughters
collection of daughter candidates
string const
Definition: compareJSON.py:14
virtual Candidate * daughter(const std::string &s)
return daughter with a specified role name
#define private
Definition: FWFileEntry.h:17
virtual size_t numberOfDaughters() const
number of daughters
math::XYZPoint Point
point in the space
math::XYZTLorentzVector LorentzVector
Lorentz vector.
virtual bool isMuon() const
virtual bool isTrackerMuon() const
#define protected
Definition: FWEveView.cc:34
virtual size_t numberOfSourceCandidatePtrs() const
virtual bool isGlobalMuon() const
virtual const CandidateBaseRef & masterClone() const
virtual double phi() const
momentum azimuthal angle
edm::RefCoreWithIndex ref_
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
virtual bool isPhoton() const
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
virtual size_t numberOfMothers() const
number of mothers
def template
Definition: svgfig.py:520
virtual bool hasMasterClone() const
This only happens if the concrete Candidate type is ShallowCloneCandidate.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39
virtual const Candidate * daughter(const std::string &s) const
return daughter with a specified role name