CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackingRecHit.h
Go to the documentation of this file.
1 #ifndef TrackingRecHit_h
2 #define TrackingRecHit_h
3 
12 
13 
15 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
16 #define NO_DICT
17 #endif
18 
19 #include<vector>
20 #include<memory>
21 
22 class TkCloner;
24 class KfComponentsHolder;
25 
27 public:
28 
29 #ifdef NO_DICT
30  using RecHitPointer = std::shared_ptr<TrackingRecHit const>; // requires to much editing
31  using ConstRecHitPointer = std::shared_ptr<TrackingRecHit const>;
32 #else
33  typedef TrackingRecHit const * RecHitPointer;
34  typedef TrackingRecHit const * ConstRecHitPointer;
35 #endif
36 
37  typedef std::vector<ConstRecHitPointer> RecHitContainer;
38  typedef std::vector<ConstRecHitPointer> ConstRecHitContainer;
39 
40 
41 
43 
44  typedef unsigned int id_type;
45 
53  enum Type { valid = 0, missing = 1, inactive = 2, bad = 3, missing_inner = 4, missing_outer = 5};
54  static const int typeMask = 0xf; // mask for the above
55  static const int rttiShift = 24; // shift amount to get the rtti
56 
59 
62  TrackingRecHit(DetId id, unsigned int rt, Type type=valid ) : m_id(id), m_status((rt<< rttiShift)|int(type)), m_det(nullptr){}
63 
64 
65  explicit TrackingRecHit(const GeomDet & idet, Type type=valid) : m_id(idet.geographicalId()), m_status(type), m_det(&idet){}
66  TrackingRecHit(const GeomDet & idet, unsigned int rt, Type type=valid ) : m_id(idet.geographicalId()), m_status((rt<< rttiShift)|int(type)), m_det(&idet){}
67  TrackingRecHit(const GeomDet & idet, TrackingRecHit const & rh) : m_id(rh.m_id), m_status(rh.m_status), m_det(&idet){}
68 
69 
70  virtual ~TrackingRecHit() {}
71 
72  // fake TTRH interface
73  virtual TrackingRecHit const * hit() const { return this;}
74  virtual TrackingRecHit * cloneHit() const { return clone();}
75 
76 
77  virtual TrackingRecHit * clone() const = 0;
78 #ifdef NO_DICT
79  virtual RecHitPointer cloneSH() const { return RecHitPointer(clone());}
80  // clone and add the geom (ready for refit)
81  RecHitPointer cloneForFit(const GeomDet & idet) const {
82  auto cl = cloneSH();
83  const_cast<TrackingRecHit&>(*cl).setDet(idet); // const_cast (can be fixed editing some 100 files)
84  return cl;
85  }
86 #endif
87  virtual void setDet(const GeomDet & idet) {m_det = &idet;}
88 
89 
90  virtual AlgebraicVector parameters() const = 0;
91 
92  virtual AlgebraicSymMatrix parametersError() const = 0;
93 
94  virtual AlgebraicMatrix projectionMatrix() const = 0;
95 
96  virtual void getKfComponents( KfComponentsHolder & holder ) const ;
97 
98  virtual int dimension() const = 0;
99 
101  virtual std::vector<const TrackingRecHit*> recHits() const = 0;
102  virtual void recHitsV(std::vector<const TrackingRecHit*> & ) const;
103 
105  virtual std::vector<TrackingRecHit*> recHits() = 0;
106  virtual void recHitsV(std::vector<TrackingRecHit*> & );
107 
108 #ifdef NO_DICT
111  std::vector<const TrackingRecHit*> hits;
112  recHitsV(hits);
113  for (auto h : hits) result.push_back(h->cloneSH());
114  return result;
115  }
116 #endif
117 
118  id_type rawId() const { return m_id;}
119  DetId geographicalId() const {return m_id;}
120 
121  const GeomDet * det() const { return m_det;}
122  virtual const Surface * surface() const {return &(det()->surface());}
123 
124 
128  virtual const GeomDetUnit * detUnit() const;
129 
130 
131  virtual LocalPoint localPosition() const = 0;
132 
133  virtual LocalError localPositionError() const = 0;
134 
136  virtual bool hasPositionAndError() const {return true;};
137 
138  virtual float weight() const {return 1.;}
139 
140  Type type() const { return Type(typeMask&m_status); }
141  Type getType() const { return Type(typeMask&m_status); }
142  bool isValid() const {return getType()==valid;}
143 
144  unsigned int getRTTI() const { return m_status >> rttiShift;}
145 
151  virtual bool sharesInput( const TrackingRecHit* other, SharedInputType what) const;
152 
153 
154  // global coordinates
155 
156  virtual GlobalPoint globalPosition() const;
157  virtual GlobalError globalPositionError() const;
158 
159  virtual float errorGlobalR() const;
160  virtual float errorGlobalZ() const;
161  virtual float errorGlobalRPhi() const;
162 
163 
169  virtual bool canImproveWithTrack() const {return false;}
170 private:
171  friend class TkCloner;
172  // double dispatch
173  virtual TrackingRecHit * clone(TkCloner const&, TrajectoryStateOnSurface const&) const {
174  assert("clone"==nullptr);
175  return clone(); // default
176  }
177 #ifdef NO_DICT
178  virtual RecHitPointer cloneSH(TkCloner const&, TrajectoryStateOnSurface const&) const {
179  assert("cloneSH"==nullptr);
180  return cloneSH(); // default
181  }
182 #endif
183 
184 protected:
185  // used by muon...
186  void setId(id_type iid) { m_id=iid;}
187  void setType(Type ttype) { m_status=ttype;}
188 
189  void setRTTI (unsigned int rt) { m_status &= (rt<< rttiShift);} // can be done only once...
190 
191 private:
192 
194 
195  unsigned int m_status; // bit assigned (type 0-8) (rtti 24-31)
196 
197  const GeomDet * m_det;
198 
199 };
200 
201 #endif
SharedInputType
definition of equality via shared input
type
Definition: HCALResponse.h:21
virtual int dimension() const =0
virtual void getKfComponents(KfComponentsHolder &holder) const
virtual const Surface * surface() const
virtual float weight() const
unsigned int id_type
virtual RecHitPointer cloneSH() const
virtual float errorGlobalR() const
virtual ConstRecHitContainer transientHits() const
TrackingRecHit(const GeomDet &idet, Type type=valid)
void setId(id_type iid)
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
Type type() const
std::vector< ConstRecHitPointer > RecHitContainer
TrackingRecHit(const GeomDet &idet, TrackingRecHit const &rh)
virtual void setDet(const GeomDet &idet)
virtual TrackingRecHit * clone(TkCloner const &, TrajectoryStateOnSurface const &) const
#define nullptr
virtual GlobalPoint globalPosition() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
virtual AlgebraicVector parameters() const =0
CLHEP::HepMatrix AlgebraicMatrix
virtual float errorGlobalRPhi() const
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
const GeomDet * det() const
tuple result
Definition: query.py:137
void setType(Type ttype)
virtual ~TrackingRecHit()
virtual std::vector< const TrackingRecHit * > recHits() const =0
Access to component RecHits (if any)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
TrackingRecHit(const GeomDet &idet, unsigned int rt, Type type=valid)
static const int rttiShift
virtual bool hasPositionAndError() const
to be redefined by daughter class
unsigned int getRTTI() const
std::shared_ptr< TrackingRecHit const > RecHitPointer
std::vector< ConstRecHitPointer > ConstRecHitContainer
virtual TrackingRecHit * cloneHit() const
virtual TrackingRecHit * clone() const =0
TrackingRecHit(DetId id, Type type=valid)
Definition: DetId.h:18
virtual TrackingRecHit const * hit() const
CLHEP::HepVector AlgebraicVector
Type getType() const
virtual float errorGlobalZ() const
virtual LocalError localPositionError() const =0
unsigned int m_status
void setRTTI(unsigned int rt)
TrackingRecHit(DetId id, unsigned int rt, Type type=valid)
virtual bool canImproveWithTrack() const
bool isValid() const
TrackingRecHit(id_type id=0, Type type=valid)
virtual RecHitPointer cloneSH(TkCloner const &, TrajectoryStateOnSurface const &) const
virtual AlgebraicMatrix projectionMatrix() const =0
static const int typeMask
RecHitPointer cloneForFit(const GeomDet &idet) const
virtual const GeomDetUnit * detUnit() const
CLHEP::HepSymMatrix AlgebraicSymMatrix
DetId geographicalId() const
virtual void recHitsV(std::vector< const TrackingRecHit * > &) const
virtual LocalPoint localPosition() const =0
virtual GlobalError globalPositionError() const
const GeomDet * m_det
id_type rawId() const
virtual AlgebraicSymMatrix parametersError() const =0