CMS 3D CMS Logo

SiStripOverlapHit.cc
Go to the documentation of this file.
2 #include <cmath>
3 
5  // check which hit is closer to the IP
6  // assign it to hitA_, the other to hitB_
7  double rA = measA.recHit()->globalPosition().perp();
8  double rB = measB.recHit()->globalPosition().perp();
9  if (rA < rB) {
10  measA_ = measA;
11  measB_ = measB;
12  } else {
13  measA_ = measB;
14  measB_ = measA;
15  }
16 }
17 
19  assert(hit < 2);
20  switch (hit) {
21  case 0:
22  return updated ? measA_.updatedState() : measA_.predictedState();
23  case 1:
24  return updated ? measB_.updatedState() : measB_.predictedState();
25  default:
26  return measA_.updatedState();
27  }
28 }
29 
30 double SiStripOverlapHit::getTrackLocalAngle(unsigned int hit) const {
31  // since x is the precise coordinate and z is pointing out, we want the angle between z and x
32  return hit ? atan(trajectoryStateOnSurface(hit - 1).localDirection().x() /
33  trajectoryStateOnSurface(hit - 1).localDirection().z())
34  : (getTrackLocalAngle(1) + getTrackLocalAngle(2)) / 2.;
35 }
36 
37 double SiStripOverlapHit::offset(unsigned int hit) const {
38  assert(hit < 2);
39  // x is the precise coordinate
40  return this->hit(hit)->localPosition().x() - trajectoryStateOnSurface(hit, false).localPosition().x();
41 }
42 
43 double SiStripOverlapHit::shift() const {
44  // so this is the double difference
45  return offset(0) - offset(1);
46 }
47 
48 double SiStripOverlapHit::distance(bool fromTrajectory) const {
49  if (fromTrajectory) {
50  return (trajectoryStateOnSurface(0, true).globalPosition().basicVector() -
51  trajectoryStateOnSurface(1, true).globalPosition().basicVector())
52  .mag();
53  } else {
54  return (hitA()->globalPosition().basicVector() - hitB()->globalPosition().basicVector()).mag();
55  }
56 }
57 
59  auto vector = (hitA()->globalPosition().basicVector() + hitB()->globalPosition().basicVector()) / 2.;
60  return GlobalPoint(vector);
61 }
TrajectoryStateOnSurface const & predictedState() const
ConstRecHitPointer const & hit(unsigned int hit) const
GlobalPoint position() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double getTrackLocalAngle(unsigned int hit) const
double offset(unsigned int hit) const
assert(be >=bs)
double distance(bool fromTrajectory=false) const
T x() const
Definition: PV3DBase.h:59
SiStripOverlapHit(TrajectoryMeasurement const &measA, TrajectoryMeasurement const &measB)
double shift() const
TrajectoryMeasurement measB_
ConstRecHitPointer const & hitB() const
TrajectoryMeasurement measA_
ConstRecHitPointer const & hitA() const
TrajectoryStateOnSurface const & updatedState() const
TrajectoryStateOnSurface const & trajectoryStateOnSurface(unsigned int hit=0, bool updated=true) const
ConstRecHitPointer const & recHit() const