CMS 3D CMS Logo

BaseTrackerRecHit.h
Go to the documentation of this file.
1 #ifndef BaseTrackerRecHit_H
2 #define BaseTrackerRecHit_H
3 
9 
10 //#define DO_INTERNAL_CHECKS_BTR
11 //#define VI_DEBUG
12 
13 class OmniClusterRef;
14 
16 public:
18 
19  // fake TTRH interface
20  BaseTrackerRecHit const* hit() const final { return this; }
21 
22  ~BaseTrackerRecHit() override {}
23 
24  // no position (as in persistent)
27  : TrackingRecHit(idet, (unsigned int)(rt)), qualWord_(0) {}
28 
30  : TrackingRecHit(idet, (unsigned int)(rt)), pos_(p), err_(e), qualWord_(0) {
31  auto trackerDet = static_cast<TrackerGeomDet const*>(det());
32  LocalError lape = trackerDet->localAlignmentError();
33  if (lape.valid())
34  err_ = LocalError(err_.xx() + lape.xx(), err_.xy() + lape.xy(), err_.yy() + lape.yy());
35  }
36 
37  trackerHitRTTI::RTTI rtti() const { return trackerHitRTTI::rtti(*this); }
38  bool isSingle() const { return trackerHitRTTI::isSingle(*this); }
39  bool isMatched() const { return trackerHitRTTI::isMatched(*this); }
40  bool isProjected() const { return trackerHitRTTI::isProjected(*this); }
41  bool isProjMono() const { return trackerHitRTTI::isProjMono(*this); }
42  bool isProjStereo() const { return trackerHitRTTI::isProjStereo(*this); }
43  bool isMulti() const { return trackerHitRTTI::isMulti(*this); }
44 
45  virtual bool isPixel() const { return false; }
46  virtual bool isPhase2() const { return false; }
47 
48  // used by trackMerger (to be improved)
49  virtual OmniClusterRef const& firstClusterRef() const = 0;
50 
51  // verify that hits can share clusters...
52  inline bool sameDetModule(TrackingRecHit const& hit) const;
53 
54  bool hasPositionAndError() const override;
55 
56  LocalPoint localPosition() const override {
57  check();
58  return pos_;
59  }
60 
61  LocalError localPositionError() const override {
62  check();
63  return err_;
64  }
65  const LocalPoint& localPositionFast() const {
66  check();
67  return pos_;
68  }
70  check();
71  return err_;
72  }
73 
74  // to be specialized for 1D and 2D
75  void getKfComponents(KfComponentsHolder& holder) const override = 0;
76  int dimension() const override = 0;
77 
78  void getKfComponents1D(KfComponentsHolder& holder) const;
79  void getKfComponents2D(KfComponentsHolder& holder) const;
80 
81  // global coordinates
82  // Extension of the TrackingRecHit interface
83  const Surface* surface() const final { return &(det()->surface()); }
84 
86 
89  }
90  float errorGlobalR() const final { return std::sqrt(globalPositionError().rerr(globalPosition())); }
91  float errorGlobalZ() const final { return std::sqrt(globalPositionError().czz()); }
92  float errorGlobalRPhi() const final {
93  return globalPosition().perp() * sqrt(globalPositionError().phierr(globalPosition()));
94  }
95 
96  // once cache removed will obsolete the above
100  float r = gp.perp();
101  float errorRPhi = r * std::sqrt(float(globalError.phierr(gp)));
102  float errorR = std::sqrt(float(globalError.rerr(gp)));
103  float errorZ = std::sqrt(float(globalError.czz()));
104  return (TrackingRecHitGlobalState){gp.basicVector(), r, gp.barePhi(), errorR, errorZ, errorRPhi};
105  }
106 
108  virtual float clusterProbability() const { return 1.f; }
109 
110 public:
111  // obsolete (for what tracker is concerned...) interface
112  AlgebraicVector parameters() const override;
113  AlgebraicSymMatrix parametersError() const override;
114  AlgebraicMatrix projectionMatrix() const override;
115 
116 private:
117 #ifdef VI_DEBUG
118  void check() const { assert(det()); }
119 #elif defined(DO_INTERNAL_CHECKS_BTR)
120  void check() const;
121 #else
122  static void check() {}
123 #endif
124 
125 protected:
128 
129 protected:
130  //this comes for free (padding)
131  unsigned int qualWord_;
132 };
133 
135  unsigned int myid = geographicalId().rawId();
136  unsigned int mysubd = myid >> (DetId::kSubdetOffset);
137 
138  unsigned int id = hit.geographicalId().rawId();
139  unsigned int subd = id >> (DetId::kSubdetOffset);
140 
141  if (mysubd != subd)
142  return false;
143 
144  //Protection against invalid hits
145  if (!hit.isValid())
146  return false;
147 
148  const unsigned int limdet = 10; // TIB=11
149 
150  if (mysubd > limdet) { // strip
151  // mask glue and stereo
152  myid |= 3;
153  id |= 3;
154  }
155  return id == myid;
156 }
157 
158 // Comparison operators
160  return (one.geographicalId() < other.geographicalId());
161 }
162 #endif // BaseTrackerRecHit_H
GlobalErrorBase::phierr
T phierr(const GlobalPoint &aPoint) const
Definition: GlobalErrorBase.h:149
BaseTrackerRecHit::isMatched
bool isMatched() const
Definition: BaseTrackerRecHit.h:39
TrackingRecHitGlobalState.h
SiPixelPI::one
Definition: SiPixelPayloadInspectorHelper.h:39
BaseTrackerRecHit::sameDetModule
bool sameDetModule(TrackingRecHit const &hit) const
Definition: BaseTrackerRecHit.h:134
BaseTrackerRecHit::globalPositionError
GlobalError globalPositionError() const final
Definition: BaseTrackerRecHit.h:87
BaseTrackerRecHit::errorGlobalR
float errorGlobalR() const final
Definition: BaseTrackerRecHit.h:90
GeomDet
Definition: GeomDet.h:27
trackerHitRTTI::isProjMono
bool isProjMono(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:27
BaseTrackerRecHit::clusterProbability
virtual float clusterProbability() const
cluster probability, overloaded by pixel rechits.
Definition: BaseTrackerRecHit.h:108
trackerHitRTTI::isSingle
bool isSingle(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:26
LocalError::xy
float xy() const
Definition: LocalError.h:23
BaseTrackerRecHit::errorGlobalZ
float errorGlobalZ() const final
Definition: BaseTrackerRecHit.h:91
trackerHitRTTI::isProjected
bool isProjected(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:29
BaseTrackerRecHit::err_
LocalError err_
Definition: BaseTrackerRecHit.h:127
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BaseTrackerRecHit::hit
BaseTrackerRecHit const * hit() const final
Definition: BaseTrackerRecHit.h:20
hcal_runs.rt
rt
Definition: hcal_runs.py:76
TrackingRecHit::det
const GeomDet * det() const
Definition: TrackingRecHit.h:122
BaseTrackerRecHit::parameters
AlgebraicVector parameters() const override
Definition: BaseTrackerRecHit.cc:76
BaseTrackerRecHit::isMulti
bool isMulti() const
Definition: BaseTrackerRecHit.h:43
cms::cuda::assert
assert(be >=bs)
Surface
Definition: Surface.h:36
watchdog.const
const
Definition: watchdog.py:83
OmniClusterRef
Definition: OmniClusterRef.h:12
operator<
bool operator<(const BaseTrackerRecHit &one, const BaseTrackerRecHit &other)
Definition: BaseTrackerRecHit.h:159
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
BaseTrackerRecHit::BaseTrackerRecHit
BaseTrackerRecHit(const LocalPoint &p, const LocalError &e, GeomDet const &idet, trackerHitRTTI::RTTI rt)
Definition: BaseTrackerRecHit.h:29
BaseTrackerRecHit::isProjMono
bool isProjMono() const
Definition: BaseTrackerRecHit.h:41
BaseTrackerRecHit::check
static void check()
Definition: BaseTrackerRecHit.h:122
DetId::kSubdetOffset
static const int kSubdetOffset
Definition: DetId.h:22
DetId
Definition: DetId.h:17
trackerHitRTTI::isMulti
bool isMulti(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:34
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
ErrorFrameTransformer
Definition: ErrorFrameTransformer.h:12
BaseTrackerRecHit::errorGlobalRPhi
float errorGlobalRPhi() const final
Definition: BaseTrackerRecHit.h:92
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
Surface.h
BaseTrackerRecHit
Definition: BaseTrackerRecHit.h:15
LocalError::xx
float xx() const
Definition: LocalError.h:22
BaseTrackerRecHit::pos_
LocalPoint pos_
Definition: BaseTrackerRecHit.h:126
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
BaseTrackerRecHit::getKfComponents
void getKfComponents(KfComponentsHolder &holder) const override=0
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
trackerHitRTTI::RTTI
RTTI
Definition: trackerHitRTTI.h:8
trackingPlots.other
other
Definition: trackingPlots.py:1460
Point3DBase< float, LocalTag >
TrackingRecHitGlobalState
Definition: TrackingRecHitGlobalState.h:7
BaseTrackerRecHit::localPositionError
LocalError localPositionError() const override
Definition: BaseTrackerRecHit.h:61
trackerHitRTTI::rtti
RTTI rtti(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:23
GlobalErrorBase::rerr
T rerr(const GlobalPoint &aPoint) const
Definition: GlobalErrorBase.h:138
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
trackerHitRTTI::isMatched
bool isMatched(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:33
BaseTrackerRecHit::rtti
trackerHitRTTI::RTTI rtti() const
Definition: BaseTrackerRecHit.h:37
TrackerGeomDet.h
LocalError
Definition: LocalError.h:12
BaseTrackerRecHit::globalPosition
GlobalPoint globalPosition() const final
Definition: BaseTrackerRecHit.h:85
BaseTrackerRecHit::localPositionFast
const LocalPoint & localPositionFast() const
Definition: BaseTrackerRecHit.h:65
createfilelist.int
int
Definition: createfilelist.py:10
trackerHitRTTI.h
BaseTrackerRecHit::globalState
TrackingRecHitGlobalState globalState() const
Definition: BaseTrackerRecHit.h:97
GlobalErrorBase< double, ErrorMatrixTag >
BaseTrackerRecHit::hasPositionAndError
bool hasPositionAndError() const override
to be redefined by daughter class
Definition: BaseTrackerRecHit.cc:29
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
LocalError::valid
bool valid() const
Definition: LocalError.h:20
BaseTrackerRecHit::firstClusterRef
virtual OmniClusterRef const & firstClusterRef() const =0
BaseTrackerRecHit::~BaseTrackerRecHit
~BaseTrackerRecHit() override
Definition: BaseTrackerRecHit.h:22
KfComponentsHolder
Definition: KfComponentsHolder.h:13
BaseTrackerRecHit::localPositionErrorFast
const LocalError & localPositionErrorFast() const
Definition: BaseTrackerRecHit.h:69
BaseTrackerRecHit::surface
const Surface * surface() const final
Definition: BaseTrackerRecHit.h:83
TrackingRecHit
Definition: TrackingRecHit.h:21
alignCSCRings.r
r
Definition: alignCSCRings.py:93
BaseTrackerRecHit::isProjStereo
bool isProjStereo() const
Definition: BaseTrackerRecHit.h:42
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
BaseTrackerRecHit::localPosition
LocalPoint localPosition() const override
Definition: BaseTrackerRecHit.h:56
ErrorFrameTransformer.h
BaseTrackerRecHit::qualWord_
unsigned int qualWord_
Definition: BaseTrackerRecHit.h:131
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
BaseTrackerRecHit::isSingle
bool isSingle() const
Definition: BaseTrackerRecHit.h:38
BaseTrackerRecHit::projectionMatrix
AlgebraicMatrix projectionMatrix() const override
Definition: BaseTrackerRecHit.cc:86
BaseTrackerRecHit::BaseTrackerRecHit
BaseTrackerRecHit(const GeomDet &idet, trackerHitRTTI::RTTI rt)
Definition: BaseTrackerRecHit.h:26
GlobalErrorBase::czz
T czz() const
Definition: GlobalErrorBase.h:107
trackerHitRTTI::isProjStereo
bool isProjStereo(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:28
BaseTrackerRecHit::isProjected
bool isProjected() const
Definition: BaseTrackerRecHit.h:40
BaseTrackerRecHit::BaseTrackerRecHit
BaseTrackerRecHit(DetId id, trackerHitRTTI::RTTI rt)
Definition: BaseTrackerRecHit.h:25
BaseTrackerRecHit::getKfComponents2D
void getKfComponents2D(KfComponentsHolder &holder) const
Definition: BaseTrackerRecHit.cc:53
BaseTrackerRecHit::isPixel
virtual bool isPixel() const
Definition: BaseTrackerRecHit.h:45
BaseTrackerRecHit::BaseTrackerRecHit
BaseTrackerRecHit()
Definition: BaseTrackerRecHit.h:17
ErrorFrameTransformer::transform
static GlobalError transform(const LocalError &le, const Surface &surf)
Definition: ErrorFrameTransformer.h:16
BaseTrackerRecHit::isPhase2
virtual bool isPhase2() const
Definition: BaseTrackerRecHit.h:46
BaseTrackerRecHit::dimension
int dimension() const override=0
LocalError::yy
float yy() const
Definition: LocalError.h:24
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
hit
Definition: SiStripHitEffFromCalibTree.cc:88
BaseTrackerRecHit::getKfComponents1D
void getKfComponents1D(KfComponentsHolder &holder) const
Definition: BaseTrackerRecHit.cc:35
BaseTrackerRecHit::parametersError
AlgebraicSymMatrix parametersError() const override
Definition: BaseTrackerRecHit.cc:81
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37