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