CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BaseTrackerRecHit.h
Go to the documentation of this file.
1 #ifndef BaseTrackerRecHit_H
2 #define BaseTrackerRecHit_H
3 
9 
10 
11 
12 // #define VI_DEBUG
13 
14 class OmniClusterRef;
15 
16 namespace trackerHitRTTI {
17  // tracking hit can be : single (si1D, si2D, pix), projected, matched or multi
18  enum RTTI { undef=0, single=1, projStereo=2, projMono=3, match=4, multi=5, gs=6};
19  inline RTTI rtti(TrackingRecHit const & hit) { return RTTI(hit.getRTTI());}
20  inline bool isUndef(TrackingRecHit const & hit) { return rtti(hit)==undef;}
21  inline bool isSingle(TrackingRecHit const & hit) { return rtti(hit)==single;}
22  inline bool isProjMono(TrackingRecHit const & hit) { return rtti(hit)==projMono;}
23  inline bool isProjStereo(TrackingRecHit const & hit) { return rtti(hit)==projStereo;}
24  inline bool isProjected(TrackingRecHit const & hit) { return (rtti(hit)==projMono) | (rtti(hit)==projStereo);}
25  inline bool isMatched(TrackingRecHit const & hit) { return rtti(hit)==match;}
26  inline bool isMulti(TrackingRecHit const & hit) { return rtti(hit)==multi;}
27  inline bool isGS(TrackingRecHit const & hit) { return rtti(hit)==gs;}
28  inline bool isSingleType(TrackingRecHit const & hit) { return (rtti(hit)>0) & (rtti(hit)<4) ;}
29 
30  inline unsigned int projId(TrackingRecHit const & hit) { return hit.rawId()+int(rtti(hit))-1;}
31 }
32 
34 public:
36 
37  // fake TTRH interface
38  BaseTrackerRecHit const * hit() const GCC11_FINAL { return this;}
39 
40  virtual ~BaseTrackerRecHit() {}
41 
42  // no position (as in persistent)
43  BaseTrackerRecHit(DetId id, trackerHitRTTI::RTTI rt) : TrackingRecHit(id,(unsigned int)(rt)) {}
44 
46  GeomDet const & idet, trackerHitRTTI::RTTI rt) :
47  TrackingRecHit(idet, (unsigned int)(rt)), pos_(p), err_(e){
49  if (lape.valid())
50  err_ = LocalError(err_.xx()+lape.xx(),
51  err_.xy()+lape.xy(),
52  err_.yy()+lape.yy()
53  );
54  }
55 
57  bool isSingle() const { return trackerHitRTTI::isSingle(*this);}
58  bool isMatched() const { return trackerHitRTTI::isMatched(*this);}
59  bool isProjected() const { return trackerHitRTTI::isProjected(*this);}
60  bool isProjMono() const { return trackerHitRTTI::isProjMono(*this);}
61  bool isProjSterep() const { return trackerHitRTTI::isProjStereo(*this);}
62  bool isMulti() const { return trackerHitRTTI::isMulti(*this);}
63 
64  virtual bool isPixel() const { return false;}
65 
66  // used by trackMerger (to be improved)
67  virtual OmniClusterRef const & firstClusterRef() const=0;
68 
69 
70  // verify that hits can share clusters...
71  inline bool sameDetModule(TrackingRecHit const & hit) const;
72 
74 
76 
78 
79 
80  const LocalPoint & localPositionFast() const { check(); return pos_; }
81  const LocalError & localPositionErrorFast() const { check(); return err_; }
82 
83 
84 
85  // to be specialized for 1D and 2D
86  virtual void getKfComponents( KfComponentsHolder & holder ) const=0;
87  virtual int dimension() const=0;
88 
89  void getKfComponents1D( KfComponentsHolder & holder ) const;
90  void getKfComponents2D( KfComponentsHolder & holder ) const;
91 
92 
93  // global coordinates
94  // Extension of the TrackingRecHit interface
95  virtual const Surface * surface() const GCC11_FINAL {return &(det()->surface());}
96 
97 
99  return surface()->toGlobal(localPosition());
100  }
101 
106 
107  // once cache removed will obsolete the above
109  GlobalError
112  float r = gp.perp();
113  float errorRPhi = r*std::sqrt(float(globalError.phierr(gp)));
114  float errorR = std::sqrt(float(globalError.rerr(gp)));
115  float errorZ = std::sqrt(float(globalError.czz()));
116  return (TrackingRecHitGlobalState){
117  gp.basicVector(), r, gp.barePhi(),
118  errorR,errorZ,errorRPhi
119  };
120  }
121 
123  virtual float clusterProbability() const { return 1.f; }
124 
125 public:
126 
127  // obsolete (for what tracker is concerned...) interface
128  virtual AlgebraicVector parameters() const;
129  virtual AlgebraicSymMatrix parametersError() const;
130  virtual AlgebraicMatrix projectionMatrix() const;
131 
132 private:
133 
134 #ifdef VI_DEBUG
135  void check() const { assert(det());}
136 #elif EDM_LM_DEBUG
137  void check() const;
138 #else
139  static void check(){}
140 #endif
141 
142 private:
143 
146 protected:
147  //this comes for free (padding)
148  unsigned int qualWord_;
149 };
150 
151 
153  unsigned int myid = geographicalId().rawId();
154  unsigned int mysubd = myid >> (DetId::kSubdetOffset);
155 
156  unsigned int id = hit.geographicalId().rawId();
157  unsigned int subd = id >> (DetId::kSubdetOffset);
158 
159  if (mysubd!=subd) return false;
160 
161  //Protection against invalid hits
162  if(!hit.isValid()) return false;
163 
164  const unsigned int limdet = 10; // TIB=11
165 
166  if (mysubd>limdet) { // strip
167  // mask glue and stereo
168  myid|=3;
169  id|=3;
170  }
171  return id==myid;
172 
173 }
174 
175 
176 // Comparison operators
177 inline bool operator<( const BaseTrackerRecHit& one, const BaseTrackerRecHit& other) {
178  return ( one.geographicalId() < other.geographicalId() );
179 }
180 #endif // BaseTrackerRecHit_H
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
bool valid() const
Definition: LocalError.h:21
bool isMulti() const
RTTI rtti(TrackingRecHit const &hit)
static GlobalError transform(const LocalError &le, const Surface &surf)
float xx() const
Definition: LocalError.h:24
bool isSingleType(TrackingRecHit const &hit)
T perp() const
Definition: PV3DBase.h:72
TrackingRecHitGlobalState globalState() const
virtual int dimension() const =0
bool isProjMono(TrackingRecHit const &hit)
BaseTrackerRecHit const * hit() const GCC11_FINAL
bool isGS(TrackingRecHit const &hit)
static const int kSubdetOffset
Definition: DetId.h:21
virtual AlgebraicSymMatrix parametersError() const
bool sameDetModule(TrackingRecHit const &hit) const
bool isProjSterep() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
BaseTrackerRecHit(const LocalPoint &p, const LocalError &e, GeomDet const &idet, trackerHitRTTI::RTTI rt)
T phierr(const GlobalPoint &aPoint) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
T barePhi() const
Definition: PV3DBase.h:68
unsigned int projId(TrackingRecHit const &hit)
GlobalError globalPositionError() const GCC11_FINAL
float xy() const
Definition: LocalError.h:25
bool operator<(const FedChannelConnection &, const FedChannelConnection &)
virtual LocalError localPositionError() const GCC11_FINAL
bool hasPositionAndError() const GCC11_FINAL
to be redefined by daughter class
CLHEP::HepMatrix AlgebraicMatrix
bool isProjStereo(TrackingRecHit const &hit)
float yy() const
Definition: LocalError.h:26
const GeomDet * det() const
T sqrt(T t)
Definition: SSEVec.h:48
void getKfComponents2D(KfComponentsHolder &holder) const
bool isMatched(TrackingRecHit const &hit)
virtual void getKfComponents(KfComponentsHolder &holder) const =0
virtual ~BaseTrackerRecHit()
unsigned int getRTTI() const
virtual bool isPixel() const
virtual AlgebraicVector parameters() const
const LocalError & localPositionErrorFast() const
bool isProjMono() const
LocalError const & localAlignmentError() const
Return local alligment error.
Definition: GeomDet.h:78
virtual const Surface * surface() const GCC11_FINAL
Definition: DetId.h:18
CLHEP::HepVector AlgebraicVector
bool isSingle(TrackingRecHit const &hit)
T rerr(const GlobalPoint &aPoint) const
virtual OmniClusterRef const & firstClusterRef() const =0
bool isProjected() const
bool isValid() const
string const
Definition: compareJSON.py:14
virtual GlobalPoint globalPosition() const GCC11_FINAL
float errorGlobalZ() const GCC11_FINAL
void getKfComponents1D(KfComponentsHolder &holder) const
bool isMatched() const
bool isMulti(TrackingRecHit const &hit)
CLHEP::HepSymMatrix AlgebraicSymMatrix
float errorGlobalRPhi() const GCC11_FINAL
trackerHitRTTI::RTTI rtti() const
bool isUndef(TrackingRecHit const &hit)
virtual AlgebraicMatrix projectionMatrix() const
float errorGlobalR() const GCC11_FINAL
const LocalPoint & localPositionFast() const
DetId geographicalId() const
virtual float clusterProbability() const
cluster probability, overloaded by pixel rechits.
BaseTrackerRecHit(DetId id, trackerHitRTTI::RTTI rt)
virtual LocalPoint localPosition() const GCC11_FINAL
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
bool isProjected(TrackingRecHit const &hit)
unsigned int qualWord_
id_type rawId() const
bool isSingle() const
Unlimited (trivial) bounds.