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