CMS 3D CMS Logo

VectorHit.h
Go to the documentation of this file.
1 #ifndef DataFormats_TrackerRecHit2D_VectorHit_h
2 #define DataFormats_TrackerRecHit2D_VectorHit_h
3 
16 
19 
23 
25 
27 
28 class VectorHit final : public BaseTrackerRecHit {
29 public:
31 
33 
34  VectorHit(const GeomDet& idet,
35  const LocalPoint& posInner,
36  const LocalVector& dir,
38  const float chi2,
39  OmniClusterRef const& lower,
40  OmniClusterRef const& upper,
41  const float curvature,
42  const float curvatureError,
43  const float phi);
44 
45  VectorHit(const GeomDet& idet,
46  const VectorHit2D& vh2Dzx,
47  const VectorHit2D& vh2Dzy,
48  OmniClusterRef const& lower,
49  OmniClusterRef const& upper,
50  const float curvature,
51  const float curvatureError,
52  const float phi);
53 
54  ~VectorHit() override = default;
55 
56  VectorHit* clone() const override { return new VectorHit(*this); }
57  RecHitPointer cloneSH() const override { return std::make_shared<VectorHit>(*this); }
58 
59  bool sharesInput(const TrackingRecHit* other, SharedInputType what) const override;
60  bool sharesClusters(VectorHit const& other, SharedInputType what) const;
61 
62  // Parameters of the segment, for the track fit
63  // For a 4D segment: (dx/dz,dy/dz,x,y)
64  bool hasPositionAndError() const override {
65  //if det is present pos&err are available as well.
66  //if det() is not present (null) the hit has been read from file and not updated
67  return det();
68  };
69 
70  void getKfComponents(KfComponentsHolder& holder) const override { getKfComponents4D(holder); }
71  void getKfComponents4D(KfComponentsHolder& holder) const;
72 
73  // returning methods
74  LocalPoint localPosition() const override { return thePosition; }
75  virtual LocalVector localDirection() const { return theDirection; }
76  const AlgebraicSymMatrix44& covMatrix() const;
77  LocalError localPositionError() const override;
80 
81  float chi2() const { return theChi2; }
82  int dimension() const override { return theDimension; }
83  float curvature() const { return theCurvature; }
84  float curvatureError() const { return theCurvatureError; }
85  float phi() const { return thePhi; }
86 
87  float transverseMomentum(float magField) const;
88  float momentum(float magField) const;
89 
95  // Non const variants needed for cluster re-keying
98 
99  //FIXME::to update with a proper CPE maybe...
106 
107  bool isPhase2() const override { return true; }
108 
109  //FIXME: I have always two clusters in a VH
110  OmniClusterRef const& firstClusterRef() const override { return theLowerCluster; }
112 
113  //This method returns the direction of the segment/stub in global coordinates
115  float theta() const;
116 
117  // Access to component RecHits (if any)
118  std::vector<const TrackingRecHit*> recHits() const override;
119  std::vector<TrackingRecHit*> recHits() override;
120 
121 private:
122  // double dispatch
123  VectorHit* clone_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
124  return cloner(*this, tsos).release();
125  }
126  RecHitPointer cloneSH_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
127  return cloner.makeShared(*this, tsos);
128  }
129 
132 
133  // the covariance matrix, has the following meaning
134  // mat[0][0]=var(dx/dz)
135  // mat[1][1]=var(dy/dz)
136  // mat[2][2]=var(x)
137  // mat[3][3]=var(y)
138  // mat[0][2]=cov(dx/dz,x)
139  // mat[1][3]=cov(dy/dz,y)
141  float theChi2;
142  static constexpr int theDimension = 4;
147  float thePhi;
148 };
149 
150 inline bool operator<(const VectorHit& one, const VectorHit& other) { return (one.chi2() < other.chi2()); }
151 
152 std::ostream& operator<<(std::ostream& os, const VectorHit& vh);
153 
155 
156 #endif
SharedInputType
definition of equality via shared input
OmniClusterRef & upperClusterRef()
Definition: VectorHit.h:97
float theta() const
Definition: VectorHit.cc:154
float theCurvatureError
Definition: VectorHit.h:146
static Global3DPoint phase2clusterGlobalPos(const PixelGeomDetUnit *geomDet, ClusterRef cluster)
Definition: VectorHit.cc:114
virtual LocalVector localDirection() const
Definition: VectorHit.h:75
int dimension() const override
Definition: VectorHit.h:82
VectorHit * clone() const override
Definition: VectorHit.h:56
float transverseMomentum(float magField) const
Definition: VectorHit.cc:156
bool isPhase2() const override
Definition: VectorHit.h:107
OmniClusterRef const upperClusterRef() const
Definition: VectorHit.h:94
Global3DVector globalDirection() const
Definition: VectorHit.cc:152
GlobalError lowerGlobalPosErr() const
Definition: VectorHit.cc:123
bool sharesInput(const TrackingRecHit *other, SharedInputType what) const override
Definition: VectorHit.cc:58
LocalError localDirectionError() const
Definition: VectorHit.cc:167
RecHitPointer cloneSH() const override
Definition: VectorHit.h:57
float momentum(float magField) const
Definition: VectorHit.cc:161
Global3DVector globalDirectionVH() const
Definition: VectorHit.cc:145
LocalPoint thePosition
Definition: VectorHit.h:130
ClusterRef lowerCluster() const
"lower" is logical, not geometrically lower; in pixel-strip modules the "lower" is always a pixel ...
Definition: VectorHit.h:91
const GeomDet * det() const
Global3DPoint lowerGlobalPos() const
Definition: VectorHit.cc:102
float phi() const
Definition: VectorHit.h:85
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
Definition: VectorHit.cc:185
float thePhi
Definition: VectorHit.h:147
static constexpr int theDimension
Definition: VectorHit.h:142
float curvature() const
Definition: VectorHit.h:83
AlgebraicSymMatrix44 theCovMatrix
Definition: VectorHit.h:140
ClusterRef upperCluster() const
Definition: VectorHit.h:92
std::ostream & operator<<(std::ostream &os, const VectorHit &vh)
Definition: VectorHit.cc:173
bool hasPositionAndError() const override
to be redefined by daughter class
Definition: VectorHit.h:64
void setType(Type ttype)
OmniClusterRef theUpperCluster
Definition: VectorHit.h:144
float chi2() const
Definition: VectorHit.h:81
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
GlobalError upperGlobalPosErr() const
Definition: VectorHit.cc:129
static GlobalError phase2clusterGlobalPosErr(const PixelGeomDetUnit *geomDet)
Definition: VectorHit.cc:135
OmniClusterRef::Phase2Cluster1DRef ClusterRef
Definition: VectorHit.h:30
TrackingRecHit::ConstRecHitPointer makeShared(TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
Definition: TkCloner.h:24
OmniClusterRef & lowerClusterRef()
Definition: VectorHit.h:96
LocalError localPositionError() const override
Definition: VectorHit.cc:163
std::shared_ptr< TrackingRecHit const > RecHitPointer
OmniClusterRef theLowerCluster
Definition: VectorHit.h:143
float curvatureError() const
Definition: VectorHit.h:84
float theCurvature
Definition: VectorHit.h:145
bool operator<(const VectorHit &one, const VectorHit &other)
Definition: VectorHit.h:150
LocalPoint localPosition() const override
Definition: VectorHit.h:74
Phase2Cluster1DRef cluster_phase2OT() const
OmniClusterRef const lowerClusterRef() const
Definition: VectorHit.h:93
const AlgebraicSymMatrix44 & covMatrix() const
Definition: VectorHit.cc:171
VectorHit * clone_(TkCloner const &cloner, TrajectoryStateOnSurface const &tsos) const override
Definition: VectorHit.h:123
bool sharesClusters(VectorHit const &other, SharedInputType what) const
Definition: VectorHit.cc:78
edmNew::DetSetVector< VectorHit > VectorHitCollection
Definition: VectorHit.h:154
VectorHit()
Definition: VectorHit.h:32
~VectorHit() override=default
LocalVector theDirection
Definition: VectorHit.h:131
Global3DPoint upperGlobalPos() const
Definition: VectorHit.cc:108
RecHitPointer cloneSH_(TkCloner const &cloner, TrajectoryStateOnSurface const &tsos) const override
Definition: VectorHit.h:126
OmniClusterRef const & firstClusterRef() const override
Definition: VectorHit.h:110
void getKfComponents(KfComponentsHolder &holder) const override
Definition: VectorHit.h:70
float theChi2
Definition: VectorHit.h:141
ClusterRef cluster() const
Definition: VectorHit.h:111
void getKfComponents4D(KfComponentsHolder &holder) const
Definition: VectorHit.cc:85