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 {}; }
Vector3DBase< float, LocalTag >
VectorHit::lowerCluster
ClusterRef lowerCluster() const
"lower" is logical, not geometrically lower; in pixel-strip modules the "lower" is always a pixel
Definition: VectorHit.h:91
mps_fire.i
i
Definition: mps_fire.py:428
KfComponentsHolder::projFunc
ProjectMatrix< double, 5, D > & projFunc()
Definition: KfComponentsHolder.h:56
BaseTrackerRecHit::sameDetModule
bool sameDetModule(TrackingRecHit const &hit) const
Definition: BaseTrackerRecHit.h:134
GeomDet
Definition: GeomDet.h:27
VectorHit::upperCluster
ClusterRef upperCluster() const
Definition: VectorHit.h:92
VectorHit2D::chi2
float chi2() const
Definition: VectorHit2D.h:25
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
VectorHit::localDirection
virtual LocalVector localDirection() const
Definition: VectorHit.h:75
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
vh
ValidHit vh
Definition: classes.h:14
TrackingRecHit::det
const GeomDet * det() const
Definition: TrackingRecHit.h:122
KfComponentsHolder::tsosLocalErrors
const AlgebraicSymMatrix55 & tsosLocalErrors() const
Definition: KfComponentsHolder.h:83
PixelTopology::pitch
virtual std::pair< float, float > pitch() const =0
VectorHit2D::covMatrix
const AlgebraicSymMatrix22 & covMatrix() const
Definition: VectorHit2D.h:24
VectorHit::lowerGlobalPos
Global3DPoint lowerGlobalPos() const
Definition: VectorHit.cc:102
StackGeomDet::upperDet
const GeomDetUnit * upperDet() const
Definition: StackGeomDet.h:20
VectorHit::sharesClusters
bool sharesClusters(VectorHit const &other, SharedInputType what) const
Definition: VectorHit.cc:78
VectorHit::theChi2
float theChi2
Definition: VectorHit.h:138
VectorHit::thePosition
LocalPoint thePosition
Definition: VectorHit.h:127
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
PixelRecoUtilities::curvature
T curvature(T InversePt, const edm::EventSetup &iSetup)
Definition: PixelRecoUtilities.h:42
OmniClusterRef
Definition: OmniClusterRef.h:12
VectorHit::theDirection
LocalVector theDirection
Definition: VectorHit.h:128
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
edm::Ref
Definition: AssociativeIterator.h:58
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
KfComponentsHolder::tsosLocalParameters
const AlgebraicVector5 & tsosLocalParameters() const
Definition: KfComponentsHolder.h:82
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
VectorHit::theCurvature
float theCurvature
Definition: VectorHit.h:142
TrackingRecHit::SharedInputType
SharedInputType
definition of equality via shared input
Definition: TrackingRecHit.h:59
ErrorFrameTransformer
Definition: ErrorFrameTransformer.h:12
VectorHit::momentum
float momentum(float magField) const
Definition: VectorHit.cc:161
BaseTrackerRecHit
Definition: BaseTrackerRecHit.h:15
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
VectorHit::recHits
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
Definition: VectorHit.cc:185
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
VectorHit::VectorHit
VectorHit()
Definition: VectorHit.h:32
StackGeomDet::lowerDet
const GeomDetUnit * lowerDet() const
Definition: StackGeomDet.h:19
trackingPlots.other
other
Definition: trackingPlots.py:1460
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
Point3DBase< float, LocalTag >
VectorHit::cluster
ClusterRef cluster() const
Definition: VectorHit.h:108
PixelTopology
Definition: PixelTopology.h:10
VectorHit::globalDirection
Global3DVector globalDirection() const
Definition: VectorHit.cc:152
VectorHit::upperClusterRef
const OmniClusterRef upperClusterRef() const
Definition: VectorHit.h:94
KfComponentsHolder::measuredParams
AlgebraicROOTObject< D >::Vector & measuredParams()
Definition: KfComponentsHolder.h:67
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
VectorHit::theta
float theta() const
Definition: VectorHit.cc:154
TrackingRecHit::all
Definition: TrackingRecHit.h:59
PVValHelper::phi
Definition: PVValidationHelpers.h:69
LocalError
Definition: LocalError.h:12
PixelGeomDetUnit::specificTopology
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Definition: PixelGeomDetUnit.cc:17
VectorHit::covMatrix
const AlgebraicSymMatrix44 & covMatrix() const
Definition: VectorHit.cc:171
VectorHit2D
Definition: VectorHit2D.h:11
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
LocalVector
Local3DVector LocalVector
Definition: LocalVector.h:12
VectorHit::transverseMomentum
float transverseMomentum(float magField) const
Definition: VectorHit.cc:156
KfComponentsHolder::measuredErrors
AlgebraicROOTObject< D, D >::SymMatrix & measuredErrors()
Definition: KfComponentsHolder.h:75
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
GlobalErrorBase< double, ErrorMatrixTag >
VectorHit::phase2clusterGlobalPosErr
static GlobalError phase2clusterGlobalPosErr(const PixelGeomDetUnit *geomDet)
Definition: VectorHit.cc:135
VectorHit::theDimension
static constexpr int theDimension
Definition: VectorHit.h:139
KfComponentsHolder
Definition: KfComponentsHolder.h:13
BaseTrackerRecHit::surface
const Surface * surface() const final
Definition: BaseTrackerRecHit.h:83
VectorHit::lowerClusterRef
const OmniClusterRef lowerClusterRef() const
Definition: VectorHit.h:93
StackGeomDet.h
VectorHit::theCovMatrix
AlgebraicSymMatrix44 theCovMatrix
Definition: VectorHit.h:137
VectorHit::upperGlobalPos
Global3DPoint upperGlobalPos() const
Definition: VectorHit.cc:108
AlgebraicSymMatrix44
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
Definition: AlgebraicROOTObjects.h:22
TrackingRecHit
Definition: TrackingRecHit.h:21
VectorHit::lowerGlobalPosErr
GlobalError lowerGlobalPosErr() const
Definition: VectorHit.cc:123
VectorHit
Definition: VectorHit.h:28
VectorHit::phase2clusterGlobalPos
static Global3DPoint phase2clusterGlobalPos(const PixelGeomDetUnit *geomDet, ClusterRef cluster)
Definition: VectorHit.cc:114
StackGeomDet
Definition: StackGeomDet.h:7
AlgebraicVector4
ROOT::Math::SVector< double, 4 > AlgebraicVector4
Definition: AlgebraicROOTObjects.h:13
operator<<
std::ostream & operator<<(std::ostream &os, const VectorHit &vh)
Definition: VectorHit.cc:173
VectorHit::localDirectionError
LocalError localDirectionError() const
Definition: VectorHit.cc:167
packedPFCandidateRefMixer_cfi.pf
pf
Definition: packedPFCandidateRefMixer_cfi.py:4
VectorHit::globalDirectionVH
Global3DVector globalDirectionVH() const
Definition: VectorHit.cc:145
PixelTopology::localY
virtual float localY(float mpY) const =0
genVertex_cff.x
x
Definition: genVertex_cff.py:12
pileupCalc.upper
upper
Definition: pileupCalc.py:214
PixelTopology::localX
virtual float localX(float mpX) const =0
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
VectorHit::upperGlobalPosErr
GlobalError upperGlobalPosErr() const
Definition: VectorHit.cc:129
VectorHit::localPositionError
LocalError localPositionError() const override
Definition: VectorHit.cc:163
VectorHit::getKfComponents4D
void getKfComponents4D(KfComponentsHolder &holder) const
Definition: VectorHit.cc:85
trackerHitRTTI
Definition: trackerHitRTTI.h:6
VectorHit::sharesInput
bool sharesInput(const TrackingRecHit *other, SharedInputType what) const override
Definition: VectorHit.cc:58
ProjectMatrix
Definition: ProjectMatrix.h:8
trackerHitRTTI::isVector
bool isVector(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:42
KfComponentsHolder::params
AlgebraicROOTObject< D >::Vector & params()
Definition: KfComponentsHolder.h:31
AlgebraicSymMatrix22
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > AlgebraicSymMatrix22
Definition: AlgebraicROOTObjects.h:20
g
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
KfComponentsHolder::errors
AlgebraicROOTObject< D, D >::SymMatrix & errors()
Definition: KfComponentsHolder.h:39
VectorHit.h
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37