CMS 3D CMS Logo

VectorHit.cc
Go to the documentation of this file.
3 #include "CLHEP/Units/PhysicalConstants.h"
4 
6  const LocalPoint& posLower,
7  const LocalVector& dir,
8  const AlgebraicSymMatrix44& covMatrix,
9  const float chi2,
10  OmniClusterRef const& lower,
11  OmniClusterRef const& upper,
12  const float curvature,
13  const float curvatureError,
14  const float phi)
16  thePosition(posLower),
17  theDirection(dir),
18  theCovMatrix(covMatrix),
19  theChi2(chi2),
20  theLowerCluster(lower),
21  theUpperCluster(upper),
22  theCurvature(curvature),
23  theCurvatureError(curvatureError),
24  thePhi(phi) {}
25 
27  const VectorHit2D& vh2Dzx,
28  const VectorHit2D& vh2Dzy,
29  OmniClusterRef const& lower,
30  OmniClusterRef const& upper,
31  const float curvature,
32  const float curvatureError,
33  const float phi)
35  thePosition(LocalPoint(vh2Dzx.localPosition().x(), vh2Dzy.localPosition().x(), 0.)),
36  theDirection(LocalVector(vh2Dzx.localDirection().x(), vh2Dzy.localDirection().x(), 1.)),
37  theLowerCluster(lower),
38  theUpperCluster(upper),
39  theCurvature(curvature),
40  theCurvatureError(curvatureError),
41  thePhi(phi) {
42  //building the cov matrix 4x4 starting from the 2x2
43  const AlgebraicSymMatrix22& covMatZX = vh2Dzx.covMatrix();
44  const AlgebraicSymMatrix22& covMatZY = vh2Dzy.covMatrix();
45 
47 
48  theCovMatrix[0][0] = covMatZX[0][0]; // var(dx/dz)
49  theCovMatrix[1][1] = covMatZY[0][0]; // var(dy/dz)
50  theCovMatrix[2][2] = covMatZX[1][1]; // var(x)
51  theCovMatrix[3][3] = covMatZY[1][1]; // var(y)
52  theCovMatrix[0][2] = covMatZX[0][1]; // cov(dx/dz,x)
53  theCovMatrix[1][3] = covMatZY[0][1]; // cov(dy/dz,y)
54 
55  theChi2 = vh2Dzx.chi2() + vh2Dzy.chi2();
56 }
57 
59  if (what == all && (geographicalId() != other->geographicalId()))
60  return false;
61 
62  if (!sameDetModule(*other))
63  return false;
64 
66  const VectorHit* otherVh = static_cast<const VectorHit*>(other);
67  return sharesClusters(*otherVh, what);
68  }
69 
70  if (what == all)
71  return false;
72 
73  // what about multi???
74  auto const& otherClus = reinterpret_cast<const BaseTrackerRecHit*>(other)->firstClusterRef();
75  return (otherClus == lowerClusterRef()) || (otherClus == upperClusterRef());
76 }
77 
79  bool lower = this->lowerClusterRef() == other.lowerClusterRef();
80  bool upper = this->upperClusterRef() == other.upperClusterRef();
81 
82  return (what == TrackingRecHit::all) ? (lower && upper) : (upper || lower);
83 }
84 
86  AlgebraicVector4& pars = holder.params<theDimension>();
87  pars[0] = theDirection.x();
88  pars[1] = theDirection.y();
89  pars[2] = thePosition.x();
90  pars[3] = thePosition.y();
91 
92  holder.errors<theDimension>() = theCovMatrix;
93 
95  for (int i = 0; i < 4; ++i)
96  pf.index[i] = i + 1;
97 
99  holder.measuredErrors<theDimension>() = holder.tsosLocalErrors().Sub<AlgebraicSymMatrix44>(1, 1);
100 }
101 
103  const StackGeomDet* stackDet = static_cast<const StackGeomDet*>(det());
104  const PixelGeomDetUnit* geomDetLower = static_cast<const PixelGeomDetUnit*>(stackDet->lowerDet());
105  return phase2clusterGlobalPos(geomDetLower, lowerCluster());
106 }
107 
109  const StackGeomDet* stackDet = static_cast<const StackGeomDet*>(det());
110  const PixelGeomDetUnit* geomDetUpper = static_cast<const PixelGeomDetUnit*>(stackDet->upperDet());
111  return phase2clusterGlobalPos(geomDetUpper, upperCluster());
112 }
113 
115  const PixelTopology* topo = &geomDet->specificTopology();
116  float ix = cluster->center();
117  float iy = cluster->column() + 0.5f; // halfway the column
118  LocalPoint lp(topo->localX(ix), topo->localY(iy), 0); // x, y, z
119  Global3DPoint gp = geomDet->surface().toGlobal(lp);
120  return gp;
121 }
122 
124  const StackGeomDet* stackDet = static_cast<const StackGeomDet*>(det());
125  const PixelGeomDetUnit* geomDetLower = static_cast<const PixelGeomDetUnit*>(stackDet->lowerDet());
126  return phase2clusterGlobalPosErr(geomDetLower);
127 }
128 
130  const StackGeomDet* stackDet = static_cast<const StackGeomDet*>(det());
131  const PixelGeomDetUnit* geomDetUpper = static_cast<const PixelGeomDetUnit*>(stackDet->upperDet());
132  return phase2clusterGlobalPosErr(geomDetUpper);
133 }
134 
136  const PixelTopology* topo = &geomDet->specificTopology();
137  float pitchX = topo->pitch().first;
138  float pitchY = topo->pitch().second;
139  constexpr float invTwelve = 1. / 12;
140  LocalError le(pow(pitchX, 2) * invTwelve, 0, pow(pitchY, 2) * invTwelve); // e2_xx, e2_xy, e2_yy
141  GlobalError ge(ErrorFrameTransformer().transform(le, geomDet->surface()));
142  return ge;
143 }
144 
146  Local3DVector theLocalDelta =
148  Global3DVector g = det()->surface().toGlobal(theLocalDelta);
149  return g;
150 }
151 
153 
154 float VectorHit::theta() const { return globalDirection().theta(); }
155 
156 float VectorHit::transverseMomentum(float magField) const {
157  return magField * (CLHEP::c_light * 1e-5F) / theCurvature;
158  // pT [GeV] ~ 0.3 * B[T] * R [m], curvature is in cms, using precise value from speed of light
159  // because curvature is a signed quantity this transverse momentum is also signed
160 }
161 float VectorHit::momentum(float magField) const { return transverseMomentum(magField) / (1. * sin(theta())); }
162 
164  return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]);
165 }
166 
168  return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]);
169 }
170 
172 
173 std::ostream& operator<<(std::ostream& os, const VectorHit& vh) {
174  os << " VectorHit create in the DetId#: " << vh.geographicalId() << "\n"
175  << " Vectorhit local position : " << vh.localPosition() << "\n"
176  << " Vectorhit local direction : " << vh.localDirection() << "\n"
177  << " Vectorhit global direction : " << vh.globalDirection() << "\n"
178  << " Lower cluster global position : " << vh.lowerGlobalPos() << "\n"
179  << " Upper cluster global position : " << vh.upperGlobalPos();
180 
181  return os;
182 }
183 
185 std::vector<const TrackingRecHit*> VectorHit::recHits() const { return {}; }
186 
188 std::vector<TrackingRecHit*> VectorHit::recHits() { return {}; }
SharedInputType
definition of equality via shared input
const AlgebraicSymMatrix22 & covMatrix() const
Definition: VectorHit2D.h:24
float theta() const
Definition: VectorHit.cc:154
static Global3DPoint phase2clusterGlobalPos(const PixelGeomDetUnit *geomDet, ClusterRef cluster)
Definition: VectorHit.cc:114
Local3DVector LocalVector
Definition: LocalVector.h:12
virtual LocalVector localDirection() const
Definition: VectorHit.h:75
const GeomDetUnit * lowerDet() const
Definition: StackGeomDet.h:19
bool sameDetModule(TrackingRecHit const &hit) const
float transverseMomentum(float magField) const
Definition: VectorHit.cc:156
T z() const
Definition: PV3DBase.h:61
const GeomDetUnit * upperDet() const
Definition: StackGeomDet.h:20
OmniClusterRef const upperClusterRef() const
Definition: VectorHit.h:94
Global3DVector globalDirection() const
Definition: VectorHit.cc:152
const AlgebraicSymMatrix55 & tsosLocalErrors() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
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
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
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
const GeomDet * det() const
Global3DPoint lowerGlobalPos() const
Definition: VectorHit.cc:102
T curvature(T InversePt, const MagneticField &field)
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
Definition: VectorHit.cc:185
static constexpr int theDimension
Definition: VectorHit.h:142
virtual float localX(float mpX) const =0
const AlgebraicVector5 & tsosLocalParameters() const
AlgebraicSymMatrix44 theCovMatrix
Definition: VectorHit.h:140
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
ClusterRef upperCluster() const
Definition: VectorHit.h:92
AlgebraicROOTObject< D, D >::SymMatrix & measuredErrors()
std::ostream & operator<<(std::ostream &os, const VectorHit &vh)
Definition: VectorHit.cc:173
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
ROOT::Math::SVector< double, 4 > AlgebraicVector4
LocalError localPositionError() const override
Definition: VectorHit.cc:163
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
AlgebraicROOTObject< D >::Vector & params()
AlgebraicROOTObject< D, D >::SymMatrix & errors()
ProjectMatrix< double, 5, D > & projFunc()
float theCurvature
Definition: VectorHit.h:145
LocalPoint localPosition() const override
Definition: VectorHit.h:74
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
DetId geographicalId() const
OmniClusterRef const lowerClusterRef() const
Definition: VectorHit.h:93
virtual float localY(float mpY) const =0
const AlgebraicSymMatrix44 & covMatrix() const
Definition: VectorHit.cc:171
bool sharesClusters(VectorHit const &other, SharedInputType what) const
Definition: VectorHit.cc:78
VectorHit()
Definition: VectorHit.h:32
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > AlgebraicSymMatrix22
LocalVector theDirection
Definition: VectorHit.h:131
Global3DPoint upperGlobalPos() const
Definition: VectorHit.cc:108
bool isVector(TrackingRecHit const &hit)
AlgebraicROOTObject< D >::Vector & measuredParams()
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
const Surface * surface() const final
float x
OmniClusterRef const & firstClusterRef() const override
Definition: VectorHit.h:110
virtual std::pair< float, float > pitch() const =0
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
float theChi2
Definition: VectorHit.h:141
float chi2() const
Definition: VectorHit2D.h:25
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
ClusterRef cluster() const
Definition: VectorHit.h:111
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
void getKfComponents4D(KfComponentsHolder &holder) const
Definition: VectorHit.cc:85
unsigned transform(const HcalDetId &id, unsigned transformCode)