CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions
TSCPBuilderNoMaterial Class Referencefinal

#include <TSCPBuilderNoMaterial.h>

Inheritance diagram for TSCPBuilderNoMaterial:
TrajectoryStateClosestToPointBuilder

Public Member Functions

TrajectoryStateClosestToPoint operator() (const FTS &originalFTS, const GlobalPoint &referencePoint) const override
 
TrajectoryStateClosestToPoint operator() (const TSOS &originalTSOS, const GlobalPoint &referencePoint) const override
 
 ~TSCPBuilderNoMaterial () override
 
- Public Member Functions inherited from TrajectoryStateClosestToPointBuilder
virtual ~TrajectoryStateClosestToPointBuilder ()
 

Private Types

typedef Point3DBase< double, GlobalTagGlobalPointDouble
 
typedef Vector3DBase< double, GlobalTagGlobalVectorDouble
 
typedef std::pair< bool, FreeTrajectoryStatePairBoolFTS
 

Private Member Functions

PairBoolFTS createFTSatTransverseImpactPoint (const FTS &originalFTS, const GlobalPoint &referencePoint) const
 
PairBoolFTS createFTSatTransverseImpactPointCharged (const FTS &originalFTS, const GlobalPoint &referencePoint) const
 
PairBoolFTS createFTSatTransverseImpactPointNeutral (const FTS &originalFTS, const GlobalPoint &referencePoint) const
 

Additional Inherited Members

- Public Types inherited from TrajectoryStateClosestToPointBuilder
typedef FreeTrajectoryState FTS
 
typedef TrajectoryStateOnSurface TSOS
 
- Static Public Member Functions inherited from TrajectoryStateClosestToPointBuilder
static bool positionEqual (const GlobalPoint &ptB, const GlobalPoint &ptA)
 
- Static Protected Member Functions inherited from TrajectoryStateClosestToPointBuilder
static TrajectoryStateClosestToPoint constructTSCP (const FTS &originalFTS, const GlobalPoint &referencePoint)
 

Detailed Description

This class builds a TrajectoryStateClosestToPoint given an original TrajectoryStateOnSurface or FreeTrajectoryState. This new state is then defined at the point of closest approach to the reference point. In case the propagation was not successful, this state can be invalid.

Definition at line 17 of file TSCPBuilderNoMaterial.h.

Member Typedef Documentation

◆ GlobalPointDouble

Definition at line 26 of file TSCPBuilderNoMaterial.h.

◆ GlobalVectorDouble

Definition at line 27 of file TSCPBuilderNoMaterial.h.

◆ PairBoolFTS

typedef std::pair<bool, FreeTrajectoryState> TSCPBuilderNoMaterial::PairBoolFTS
private

Definition at line 28 of file TSCPBuilderNoMaterial.h.

Constructor & Destructor Documentation

◆ ~TSCPBuilderNoMaterial()

TSCPBuilderNoMaterial::~TSCPBuilderNoMaterial ( )
inlineoverride

Definition at line 19 of file TSCPBuilderNoMaterial.h.

19 {}

Member Function Documentation

◆ createFTSatTransverseImpactPoint()

TSCPBuilderNoMaterial::PairBoolFTS TSCPBuilderNoMaterial::createFTSatTransverseImpactPoint ( const FTS originalFTS,
const GlobalPoint referencePoint 
) const
private

Definition at line 41 of file TSCPBuilderNoMaterial.cc.

References createFTSatTransverseImpactPointCharged(), createFTSatTransverseImpactPointNeutral(), MillePedeFileConverter_cfg::e, and FreeTrajectoryState::transverseCurvature().

Referenced by operator()().

42  {
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 }
PairBoolFTS createFTSatTransverseImpactPointNeutral(const FTS &originalFTS, const GlobalPoint &referencePoint) const
PairBoolFTS createFTSatTransverseImpactPointCharged(const FTS &originalFTS, const GlobalPoint &referencePoint) const
double transverseCurvature() const

◆ createFTSatTransverseImpactPointCharged()

TSCPBuilderNoMaterial::PairBoolFTS TSCPBuilderNoMaterial::createFTSatTransverseImpactPointCharged ( const FTS originalFTS,
const GlobalPoint referencePoint 
) const
private

Definition at line 54 of file TSCPBuilderNoMaterial.cc.

References anyDirection, FreeTrajectoryState::charge(), FreeTrajectoryState::curvilinearError(), HelixBarrelPlaneCrossingByCircle::direction(), FreeTrajectoryState::hasError(), MagneticField::inInverseGeV(), AnalyticalCurvilinearJacobian::jacobian(), hgcalLayerClustersEE_cfi::kappa, PV3DBase< T, PVType, FrameType >::mag(), GlobalTrajectoryParameters::magneticField(), CurvilinearTrajectoryError::matrix(), FreeTrajectoryState::momentum(), FreeTrajectoryState::parameters(), HelixBarrelPlaneCrossingByCircle::pathLength(), HelixBarrelPlaneCrossingByCircle::position(), FreeTrajectoryState::position(), makeMuonMisalignmentScenario::rot, alignCSCRings::s, FreeTrajectoryState::transverseCurvature(), Vector3DBase< T, FrameTag >::unit(), X, PV3DBase< T, PVType, FrameType >::x(), Basic3DVector< T >::x(), beamSpotPI::Y, PV3DBase< T, PVType, FrameType >::y(), Basic3DVector< T >::y(), PV3DBase< T, PVType, FrameType >::z(), and Basic3DVector< T >::z().

Referenced by createFTSatTransverseImpactPoint().

55  {
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 }
const CurvilinearTrajectoryError & curvilinearError() const
T x() const
Cartesian x coordinate.
Vector3DBase< double, GlobalTag > GlobalVectorDouble
T z() const
Definition: PV3DBase.h:61
Plane BoundPlane
Definition: Plane.h:94
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:36
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
#define X(str)
Definition: MuonsGrabber.cc:38
PropagationDirection
T y() const
Cartesian y coordinate.
std::pair< bool, FreeTrajectoryState > PairBoolFTS
const GlobalTrajectoryParameters & parameters() const
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
TrackCharge charge() const
T mag() const
Definition: PV3DBase.h:64
GlobalVector momentum() const
double transverseCurvature() const
T z() const
Cartesian z coordinate.
const AlgebraicSymMatrix55 & matrix() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const MagneticField & magneticField() const
Log< level::Warning, false > LogWarning
Global3DVector GlobalVector
Definition: GlobalVector.h:10
const AlgebraicMatrix55 & jacobian() const

◆ createFTSatTransverseImpactPointNeutral()

TSCPBuilderNoMaterial::PairBoolFTS TSCPBuilderNoMaterial::createFTSatTransverseImpactPointNeutral ( const FTS originalFTS,
const GlobalPoint referencePoint 
) const
private

Definition at line 121 of file TSCPBuilderNoMaterial.cc.

References FreeTrajectoryState::charge(), funct::cos(), FreeTrajectoryState::curvilinearError(), FreeTrajectoryState::hasError(), AnalyticalCurvilinearJacobian::jacobian(), GlobalTrajectoryParameters::magneticField(), CurvilinearTrajectoryError::matrix(), FreeTrajectoryState::momentum(), FreeTrajectoryState::parameters(), phi, PV3DBase< T, PVType, FrameType >::phi(), FreeTrajectoryState::position(), alignCSCRings::s, funct::sin(), funct::tan(), PV3DBase< T, PVType, FrameType >::theta(), theta(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by createFTSatTransverseImpactPoint().

122  {
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 }
const CurvilinearTrajectoryError & curvilinearError() const
T z() const
Definition: PV3DBase.h:61
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
std::pair< bool, FreeTrajectoryState > PairBoolFTS
const GlobalTrajectoryParameters & parameters() const
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
TrackCharge charge() const
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
const AlgebraicSymMatrix55 & matrix() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const MagneticField & magneticField() const
Geom::Theta< T > theta() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
const AlgebraicMatrix55 & jacobian() const

◆ operator()() [1/2]

TrajectoryStateClosestToPoint TSCPBuilderNoMaterial::operator() ( const FTS originalFTS,
const GlobalPoint referencePoint 
) const
overridevirtual

Implements TrajectoryStateClosestToPointBuilder.

Definition at line 11 of file TSCPBuilderNoMaterial.cc.

References TrajectoryStateClosestToPointBuilder::constructTSCP(), createFTSatTransverseImpactPoint(), FreeTrajectoryState::position(), and TrajectoryStateClosestToPointBuilder::positionEqual().

12  {
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 }
std::pair< bool, FreeTrajectoryState > PairBoolFTS
GlobalPoint position() const
static TrajectoryStateClosestToPoint constructTSCP(const FTS &originalFTS, const GlobalPoint &referencePoint)
static bool positionEqual(const GlobalPoint &ptB, const GlobalPoint &ptA)
PairBoolFTS createFTSatTransverseImpactPoint(const FTS &originalFTS, const GlobalPoint &referencePoint) const

◆ operator()() [2/2]

TrajectoryStateClosestToPoint TSCPBuilderNoMaterial::operator() ( const TSOS originalTSOS,
const GlobalPoint referencePoint 
) const
overridevirtual

Implements TrajectoryStateClosestToPointBuilder.

Definition at line 26 of file TSCPBuilderNoMaterial.cc.

References TrajectoryStateClosestToPointBuilder::constructTSCP(), createFTSatTransverseImpactPoint(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), and TrajectoryStateClosestToPointBuilder::positionEqual().

27  {
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 }
std::pair< bool, FreeTrajectoryState > PairBoolFTS
static TrajectoryStateClosestToPoint constructTSCP(const FTS &originalFTS, const GlobalPoint &referencePoint)
static bool positionEqual(const GlobalPoint &ptB, const GlobalPoint &ptA)
PairBoolFTS createFTSatTransverseImpactPoint(const FTS &originalFTS, const GlobalPoint &referencePoint) const
GlobalPoint globalPosition() const
FreeTrajectoryState const * freeState(bool withErrors=true) const