CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TSCPBuilderNoMaterial.cc
Go to the documentation of this file.
10 
12  const GlobalPoint& referencePoint) const {
13  if (positionEqual(referencePoint, originalFTS.position()))
14  return constructTSCP(originalFTS, referencePoint);
15 
16  // Now do the propagation or whatever...
17 
18  PairBoolFTS newStatePair = createFTSatTransverseImpactPoint(originalFTS, referencePoint);
19  if (newStatePair.first) {
20  return constructTSCP(newStatePair.second, referencePoint);
21  } else {
23  }
24 }
25 
27  const GlobalPoint& referencePoint) const {
28  if (positionEqual(referencePoint, originalTSOS.globalPosition()))
29  return constructTSCP(*originalTSOS.freeState(), referencePoint);
30 
31  // Now do the propagation
32 
33  PairBoolFTS newStatePair = createFTSatTransverseImpactPoint(*originalTSOS.freeState(), referencePoint);
34  if (newStatePair.first) {
35  return constructTSCP(newStatePair.second, referencePoint);
36  } else {
38  }
39 }
40 
42  const FTS& originalFTS, const GlobalPoint& referencePoint) const {
43  //
44  // Straight line approximation? |rho|<1.e-10 equivalent to ~ 1um
45  // difference in transversal position at 10m.
46  //
47  if (fabs(originalFTS.transverseCurvature()) < 1.e-10) {
48  return createFTSatTransverseImpactPointNeutral(originalFTS, referencePoint);
49  } else {
50  return createFTSatTransverseImpactPointCharged(originalFTS, referencePoint);
51  }
52 }
53 
55  const FTS& originalFTS, const GlobalPoint& referencePoint) const {
56  GlobalVector pvecOrig = originalFTS.momentum();
57  GlobalPoint xvecOrig = originalFTS.position();
58  double kappa = originalFTS.transverseCurvature();
59  double pxOrig = pvecOrig.x();
60  double pyOrig = pvecOrig.y();
61  double pzOrig = pvecOrig.z();
62  double xOrig = xvecOrig.x();
63  double yOrig = xvecOrig.y();
64  double zOrig = xvecOrig.z();
65 
66  // double fac = 1./originalFTS.charge()/MagneticField::inInverseGeV(referencePoint).z();
67  double fac = 1. / originalFTS.charge() / (originalFTS.parameters().magneticField().inInverseGeV(referencePoint).z());
68  GlobalVectorDouble xOrig2Centre = GlobalVectorDouble(fac * pyOrig, -fac * pxOrig, 0.);
69  GlobalVectorDouble xOrigProj = GlobalVectorDouble(xOrig, yOrig, 0.);
70  GlobalVectorDouble xRefProj = GlobalVectorDouble(referencePoint.x(), referencePoint.y(), 0.);
71  GlobalVectorDouble deltax = xRefProj - xOrigProj - xOrig2Centre;
72  GlobalVectorDouble ndeltax = deltax.unit();
73 
75  Surface::PositionType pos(referencePoint);
76  // Need to define plane with orientation as the
77  // ImpactPointSurface
78  GlobalVector X(ndeltax.x(), ndeltax.y(), ndeltax.z());
79  GlobalVector Y(0., 0., 1.);
81  BoundPlane* plane = new BoundPlane(pos, rot);
82  // Using Teddy's HelixBarrelPlaneCrossingByCircle for general barrel planes.
83  // A large variety of other,
84  // direct solutions turned out to be not so stable numerically.
85  HelixBarrelPlaneCrossingByCircle planeCrossing(HelixPlaneCrossing::PositionType(xOrig, yOrig, zOrig),
86  HelixPlaneCrossing::DirectionType(pxOrig, pyOrig, pzOrig),
87  kappa,
88  direction);
89  std::pair<bool, double> propResult = planeCrossing.pathLength(*plane);
90  if (!propResult.first) {
91  edm::LogWarning("TSCPBuilderNoMaterial") << "Propagation to perigee plane failed!";
92  return PairBoolFTS(false, FreeTrajectoryState());
93  }
94  double s = propResult.second;
95  HelixPlaneCrossing::PositionType xGen = planeCrossing.position(s);
96  GlobalPoint xPerigee = GlobalPoint(xGen.x(), xGen.y(), xGen.z());
97  // direction (reconverted to GlobalVector, renormalised)
98  HelixPlaneCrossing::DirectionType pGen = planeCrossing.direction(s);
99  pGen *= pvecOrig.mag() / pGen.mag();
100  GlobalVector pPerigee = GlobalVector(pGen.x(), pGen.y(), pGen.z());
101  delete plane;
102 
103  if (originalFTS.hasError()) {
104  const AlgebraicSymMatrix55& errorMatrix = originalFTS.curvilinearError().matrix();
105  AnalyticalCurvilinearJacobian curvilinJacobian(originalFTS.parameters(), xPerigee, pPerigee, s);
106  const AlgebraicMatrix55& jacobian = curvilinJacobian.jacobian();
107  CurvilinearTrajectoryError cte(ROOT::Math::Similarity(jacobian, errorMatrix));
108 
109  return PairBoolFTS(
110  true,
112  xPerigee, pPerigee, originalFTS.charge(), &(originalFTS.parameters().magneticField())),
113  cte));
114  } else {
115  return PairBoolFTS(true,
117  xPerigee, pPerigee, originalFTS.charge(), &(originalFTS.parameters().magneticField()))));
118  }
119 }
120 
122  const FTS& originalFTS, const GlobalPoint& referencePoint) const {
123  GlobalPoint xvecOrig = originalFTS.position();
124  double phi = originalFTS.momentum().phi();
125  double theta = originalFTS.momentum().theta();
126  double xOrig = xvecOrig.x();
127  double yOrig = xvecOrig.y();
128  double zOrig = xvecOrig.z();
129  double xR = referencePoint.x();
130  double yR = referencePoint.y();
131 
132  double s2D = (xR - xOrig) * cos(phi) + (yR - yOrig) * sin(phi);
133  double s = s2D / sin(theta);
134  double xGen = xOrig + s2D * cos(phi);
135  double yGen = yOrig + s2D * sin(phi);
136  double zGen = zOrig + s2D / tan(theta);
137  GlobalPoint xPerigee = GlobalPoint(xGen, yGen, zGen);
138 
139  GlobalVector pPerigee = originalFTS.momentum();
140 
141  if (originalFTS.hasError()) {
142  const AlgebraicSymMatrix55& errorMatrix = originalFTS.curvilinearError().matrix();
143  AnalyticalCurvilinearJacobian curvilinJacobian(originalFTS.parameters(), xPerigee, pPerigee, s);
144  const AlgebraicMatrix55& jacobian = curvilinJacobian.jacobian();
145  CurvilinearTrajectoryError cte(ROOT::Math::Similarity(jacobian, errorMatrix));
146 
147  return PairBoolFTS(
148  true,
150  xPerigee, pPerigee, originalFTS.charge(), &(originalFTS.parameters().magneticField())),
151  cte));
152  } else {
153  return PairBoolFTS(true,
155  xPerigee, pPerigee, originalFTS.charge(), &(originalFTS.parameters().magneticField()))));
156  }
157 }
TrajectoryStateClosestToPoint operator()(const FTS &originalFTS, const GlobalPoint &referencePoint) const override
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
Vector3DBase< double, GlobalTag > GlobalVectorDouble
const GlobalTrajectoryParameters & parameters() const
const AlgebraicMatrix55 & jacobian() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Plane BoundPlane
Definition: Plane.h:94
PairBoolFTS createFTSatTransverseImpactPointCharged(const FTS &originalFTS, const GlobalPoint &referencePoint) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
T y() const
Definition: PV3DBase.h:60
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
#define X(str)
Definition: MuonsGrabber.cc:38
GlobalPoint globalPosition() const
PropagationDirection
TrackCharge charge() const
std::pair< bool, FreeTrajectoryState > PairBoolFTS
const CurvilinearTrajectoryError & curvilinearError() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:36
static TrajectoryStateClosestToPoint constructTSCP(const FTS &originalFTS, const GlobalPoint &referencePoint)
static bool positionEqual(const GlobalPoint &ptB, const GlobalPoint &ptA)
T mag() const
Definition: PV3DBase.h:64
T z() const
Cartesian z coordinate.
FreeTrajectoryState const * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:61
DirectionType direction(double s) const override
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
GlobalVector momentum() const
Vector3DBase unit() const
Definition: Vector3DBase.h:54
GlobalPoint position() const
std::pair< bool, double > pathLength(const Plane &) override
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
double transverseCurvature() const
const AlgebraicSymMatrix55 & matrix() const
const MagneticField & magneticField() const
PairBoolFTS createFTSatTransverseImpactPointNeutral(const FTS &originalFTS, const GlobalPoint &referencePoint) const
Log< level::Warning, false > LogWarning
T x() const
Definition: PV3DBase.h:59
PositionType position(double s) const override
Global3DVector GlobalVector
Definition: GlobalVector.h:10
PairBoolFTS createFTSatTransverseImpactPoint(const FTS &originalFTS, const GlobalPoint &referencePoint) const