CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
Phase2Cluster1DRef cluster_phase2OT() const
float theCurvatureError
Definition: VectorHit.h:143
static Global3DPoint phase2clusterGlobalPos(const PixelGeomDetUnit *geomDet, ClusterRef cluster)
Definition: VectorHit.cc:114
int dimension() const override
Definition: VectorHit.h:82
VectorHit * clone() const override
Definition: VectorHit.h:56
bool isPhase2() const override
Definition: VectorHit.h:104
virtual LocalVector localDirection() const
Definition: VectorHit.h:75
GlobalError lowerGlobalPosErr() const
Definition: VectorHit.cc:123
const auto & magField
GlobalError upperGlobalPosErr() const
Definition: VectorHit.cc:129
OmniClusterRef const upperClusterRef() const
Definition: VectorHit.h:94
bool sharesInput(const TrackingRecHit *other, SharedInputType what) const override
Definition: VectorHit.cc:58
void getKfComponents4D(KfComponentsHolder &holder) const
Definition: VectorHit.cc:85
RecHitPointer cloneSH() const override
Definition: VectorHit.h:57
TrackingRecHit::ConstRecHitPointer makeShared(TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
Definition: TkCloner.h:24
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
float transverseMomentum(float magField) const
Definition: VectorHit.cc:156
LocalPoint thePosition
Definition: VectorHit.h:127
LocalError localDirectionError() const
Definition: VectorHit.cc:167
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
Definition: VectorHit.cc:185
float thePhi
Definition: VectorHit.h:144
float chi2() const
Definition: VectorHit.h:81
static constexpr int theDimension
Definition: VectorHit.h:139
float curvature() const
Definition: VectorHit.h:83
AlgebraicSymMatrix44 theCovMatrix
Definition: VectorHit.h:137
bool sharesClusters(VectorHit const &other, SharedInputType what) const
Definition: VectorHit.cc:78
float curvatureError() const
Definition: VectorHit.h:84
ClusterRef upperCluster() const
Definition: VectorHit.h:92
const GeomDet * det() const
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 phi() const
Definition: VectorHit.h:85
float momentum(float magField) const
Definition: VectorHit.cc:161
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
Global3DPoint upperGlobalPos() const
Definition: VectorHit.cc:108
static GlobalError phase2clusterGlobalPosErr(const PixelGeomDetUnit *geomDet)
Definition: VectorHit.cc:135
Global3DVector globalDirection() const
Definition: VectorHit.cc:152
const AlgebraicSymMatrix44 & covMatrix() const
Definition: VectorHit.cc:171
OmniClusterRef::Phase2Cluster1DRef ClusterRef
Definition: VectorHit.h:30
ClusterRef lowerCluster() const
&quot;lower&quot; is logical, not geometrically lower; in pixel-strip modules the &quot;lower&quot; is always a pixel ...
Definition: VectorHit.h:91
OmniClusterRef const lowerClusterRef() const
Definition: VectorHit.h:93
LocalError localPositionError() const override
Definition: VectorHit.cc:163
std::shared_ptr< TrackingRecHit const > RecHitPointer
ValidHit vh
Definition: classes.h:14
OmniClusterRef theLowerCluster
Definition: VectorHit.h:140
float theCurvature
Definition: VectorHit.h:142
LocalPoint localPosition() const override
Definition: VectorHit.h:74
VectorHit * clone_(TkCloner const &cloner, TrajectoryStateOnSurface const &tsos) const override
Definition: VectorHit.h:120
edmNew::DetSetVector< VectorHit > VectorHitCollection
Definition: VectorHit.h:151
VectorHit()
Definition: VectorHit.h:32
~VectorHit() override=default
LocalVector theDirection
Definition: VectorHit.h:128
bool operator<(DTCELinkId const &lhs, DTCELinkId const &rhs)
Definition: DTCELinkId.h:70
float theta() const
Definition: VectorHit.cc:154
Global3DPoint lowerGlobalPos() const
Definition: VectorHit.cc:102
RecHitPointer cloneSH_(TkCloner const &cloner, TrajectoryStateOnSurface const &tsos) const override
Definition: VectorHit.h:123
OmniClusterRef const & firstClusterRef() const override
Definition: VectorHit.h:107
ClusterRef cluster() const
Definition: VectorHit.h:108
void getKfComponents(KfComponentsHolder &holder) const override
Definition: VectorHit.h:70
float theChi2
Definition: VectorHit.h:138
Global3DVector globalDirectionVH() const
Definition: VectorHit.cc:145