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 
7 
8 class OmniClusterRef;
9 
10 namespace trackerHitRTTI {
11  // tracking hit can be : single (si1D, si2D, pix), projected, matched or multi
12  enum RTTI { undef=0, single=1, proj=2, match=3, multi=4};
13  inline RTTI rtti(TrackingRecHit const & hit) { return RTTI(hit.getRTTI());}
14  inline bool isUndef(TrackingRecHit const & hit) { return rtti(hit)==undef;}
15  inline bool isSingle(TrackingRecHit const & hit) { return rtti(hit)==single;}
16  inline bool isProjected(TrackingRecHit const & hit) { return rtti(hit)==proj;}
17  inline bool isMatched(TrackingRecHit const & hit) { return rtti(hit)==match;}
18  inline bool isMulti(TrackingRecHit const & hit) { return rtti(hit)==multi;}
19 }
20 
22 public:
24 
25  virtual ~BaseTrackerRecHit() {}
26 
27  // no position (as in persistent)
28  BaseTrackerRecHit(DetId id, trackerHitRTTI::RTTI rt) : TrackingRecHit(id,(unsigned int)(rt)) {}
29 
31  DetId id, trackerHitRTTI::RTTI rt) : TrackingRecHit(id,(unsigned int)(rt)), pos_(p), err_(e){}
32 
34  bool isSingle() const { return trackerHitRTTI::isSingle(*this);}
35  bool isProjected() const { return trackerHitRTTI::isProjected(*this);}
36  bool isMatched() const { return trackerHitRTTI::isMatched(*this);}
37  bool isMulti() const { return trackerHitRTTI::isMulti(*this);}
38 
39  // used by trackMerger (to be improved)
40  virtual OmniClusterRef const & firstClusterRef() const=0;
41 
42 
43  // verify that hits can share clusters...
44  inline bool sameDetModule(TrackingRecHit const & hit) const;
45 
47 
49 
50  bool hasPositionAndError() const GCC11_FINAL;
51 
52  const LocalPoint & localPositionFast() const { return pos_; }
53  const LocalError & localPositionErrorFast() const { return err_; }
54 
55  // to be specialized for 1D and 2D
56  virtual void getKfComponents( KfComponentsHolder & holder ) const=0;
57  virtual int dimension() const=0;
58 
59  void getKfComponents1D( KfComponentsHolder & holder ) const;
60  void getKfComponents2D( KfComponentsHolder & holder ) const;
61 
62 
63 public:
64 
65  // obsolete (for what tracker is concerned...) interface
66  virtual AlgebraicVector parameters() const;
67  virtual AlgebraicSymMatrix parametersError() const;
68  virtual AlgebraicMatrix projectionMatrix() const;
69 
70  private:
71 
74 };
75 
76 
78  unsigned int myid = geographicalId().rawId();
79  unsigned int mysubd = myid >> (DetId::kSubdetOffset);
80 
81  unsigned int id = hit.geographicalId().rawId();
82  unsigned int subd = id >> (DetId::kSubdetOffset);
83 
84  if (mysubd!=subd) return false;
85 
86  //Protection against invalid hits
87  if(!hit.isValid()) return false;
88 
89  const unsigned int limdet = 10; // TIB=11
90 
91  if (mysubd>limdet) { // strip
92  // mask glue and stereo
93  myid|=3;
94  id|=3;
95  }
96  return id==myid;
97 
98 }
99 
100 
101 // Comparison operators
102 inline bool operator<( const BaseTrackerRecHit& one, const BaseTrackerRecHit& other) {
103  return ( one.geographicalId() < other.geographicalId() );
104 }
105 #endif // BaseTrackerRecHit_H
bool isMulti() const
RTTI rtti(TrackingRecHit const &hit)
virtual int dimension() const =0
static const int kSubdetOffset
Definition: DetId.h:23
virtual AlgebraicSymMatrix parametersError() const
bool sameDetModule(TrackingRecHit const &hit) const
virtual LocalPoint localPosition() const GCC11_FINAL
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
bool operator<(const FedChannelConnection &, const FedChannelConnection &)
bool hasPositionAndError() const GCC11_FINAL
to be redefined by daughter class
CLHEP::HepMatrix AlgebraicMatrix
void getKfComponents2D(KfComponentsHolder &holder) const
bool isMatched(TrackingRecHit const &hit)
virtual void getKfComponents(KfComponentsHolder &holder) const =0
virtual ~BaseTrackerRecHit()
unsigned int getRTTI() const
BaseTrackerRecHit(const LocalPoint &p, const LocalError &e, DetId id, trackerHitRTTI::RTTI rt)
virtual AlgebraicVector parameters() const
const LocalError & localPositionErrorFast() const
Definition: DetId.h:20
CLHEP::HepVector AlgebraicVector
bool isSingle(TrackingRecHit const &hit)
virtual OmniClusterRef const & firstClusterRef() const =0
bool isProjected() const
bool isValid() const
string const
Definition: compareJSON.py:14
void getKfComponents1D(KfComponentsHolder &holder) const
bool isMatched() const
bool isMulti(TrackingRecHit const &hit)
virtual LocalError localPositionError() const GCC11_FINAL
CLHEP::HepSymMatrix AlgebraicSymMatrix
trackerHitRTTI::RTTI rtti() const
bool isUndef(TrackingRecHit const &hit)
virtual AlgebraicMatrix projectionMatrix() const
const LocalPoint & localPositionFast() const
DetId geographicalId() const
BaseTrackerRecHit(DetId id, trackerHitRTTI::RTTI rt)
bool isProjected(TrackingRecHit const &hit)
bool isSingle() const
Unlimited (trivial) bounds.