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 
96  //FIXME::to update with a proper CPE maybe...
103 
104  bool isPhase2() const override { return true; }
105 
106  //FIXME: I have always two clusters in a VH
107  OmniClusterRef const& firstClusterRef() const override { return theLowerCluster; }
109 
110  //This method returns the direction of the segment/stub in global coordinates
112  float theta() const;
113 
114  // Access to component RecHits (if any)
115  std::vector<const TrackingRecHit*> recHits() const override;
116  std::vector<TrackingRecHit*> recHits() override;
117 
118 private:
119  // double dispatch
120  VectorHit* clone_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
121  return cloner(*this, tsos).release();
122  }
123  RecHitPointer cloneSH_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
124  return cloner.makeShared(*this, tsos);
125  }
126 
129 
130  // the covariance matrix, has the following meaning
131  // mat[0][0]=var(dx/dz)
132  // mat[1][1]=var(dy/dz)
133  // mat[2][2]=var(x)
134  // mat[3][3]=var(y)
135  // mat[0][2]=cov(dx/dz,x)
136  // mat[1][3]=cov(dy/dz,y)
138  float theChi2;
139  static constexpr int theDimension = 4;
144  float thePhi;
145 };
146 
147 inline bool operator<(const VectorHit& one, const VectorHit& other) { return (one.chi2() < other.chi2()); }
148 
149 std::ostream& operator<<(std::ostream& os, const VectorHit& vh);
150 
152 
153 #endif
SharedInputType
definition of equality via shared input
float theta() const
Definition: VectorHit.cc:154
float theCurvatureError
Definition: VectorHit.h:143
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:104
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:127
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:144
static constexpr int theDimension
Definition: VectorHit.h:139
float curvature() const
Definition: VectorHit.h:83
AlgebraicSymMatrix44 theCovMatrix
Definition: VectorHit.h:137
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:141
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
LocalError localPositionError() const override
Definition: VectorHit.cc:163
std::shared_ptr< TrackingRecHit const > RecHitPointer
OmniClusterRef theLowerCluster
Definition: VectorHit.h:140
float curvatureError() const
Definition: VectorHit.h:84
float theCurvature
Definition: VectorHit.h:142
bool operator<(const VectorHit &one, const VectorHit &other)
Definition: VectorHit.h:147
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:120
bool sharesClusters(VectorHit const &other, SharedInputType what) const
Definition: VectorHit.cc:78
edmNew::DetSetVector< VectorHit > VectorHitCollection
Definition: VectorHit.h:151
VectorHit()
Definition: VectorHit.h:32
~VectorHit() override=default
LocalVector theDirection
Definition: VectorHit.h:128
Global3DPoint upperGlobalPos() const
Definition: VectorHit.cc:108
RecHitPointer cloneSH_(TkCloner const &cloner, TrajectoryStateOnSurface const &tsos) const override
Definition: VectorHit.h:123
OmniClusterRef const & firstClusterRef() const override
Definition: VectorHit.h:107
void getKfComponents(KfComponentsHolder &holder) const override
Definition: VectorHit.h:70
float theChi2
Definition: VectorHit.h:138
ClusterRef cluster() const
Definition: VectorHit.h:108
void getKfComponents4D(KfComponentsHolder &holder) const
Definition: VectorHit.cc:85