CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
GlobalTag
GlobalPointDouble
 
typedef Vector3DBase< double,
GlobalTag
GlobalVectorDouble
 
typedef std::pair< bool,
FreeTrajectoryState
PairBoolFTS
 

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

Definition at line 26 of file TSCPBuilderNoMaterial.h.

Definition at line 27 of file TSCPBuilderNoMaterial.h.

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

Definition at line 28 of file TSCPBuilderNoMaterial.h.

Constructor & Destructor Documentation

TSCPBuilderNoMaterial::~TSCPBuilderNoMaterial ( )
inlineoverride

Definition at line 19 of file TSCPBuilderNoMaterial.h.

19 {}

Member Function Documentation

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

Definition at line 41 of file TSCPBuilderNoMaterial.cc.

References createFTSatTransverseImpactPointCharged(), createFTSatTransverseImpactPointNeutral(), alignCSCRings::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 createFTSatTransverseImpactPointCharged(const FTS &originalFTS, const GlobalPoint &referencePoint) const
double transverseCurvature() const
PairBoolFTS createFTSatTransverseImpactPointNeutral(const FTS &originalFTS, const GlobalPoint &referencePoint) const
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(), 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 }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
Vector3DBase< double, GlobalTag > GlobalVectorDouble
const GlobalTrajectoryParameters & parameters() const
const AlgebraicMatrix55 & jacobian() const
Plane BoundPlane
Definition: Plane.h:94
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
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
PropagationDirection
TrackCharge charge() const
std::pair< bool, FreeTrajectoryState > PairBoolFTS
const CurvilinearTrajectoryError & curvilinearError() const
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:36
T mag() const
Definition: PV3DBase.h:64
T z() const
Cartesian z coordinate.
T z() const
Definition: PV3DBase.h:61
GlobalVector momentum() const
GlobalPoint position() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
double transverseCurvature() const
const AlgebraicSymMatrix55 & matrix() const
const MagneticField & magneticField() const
Log< level::Warning, false > LogWarning
T x() const
Definition: PV3DBase.h:59
Global3DVector GlobalVector
Definition: GlobalVector.h:10
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 GlobalTrajectoryParameters & parameters() const
const AlgebraicMatrix55 & jacobian() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
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
TrackCharge charge() const
std::pair< bool, FreeTrajectoryState > PairBoolFTS
const CurvilinearTrajectoryError & curvilinearError() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
T z() const
Definition: PV3DBase.h:61
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
GlobalPoint position() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const AlgebraicSymMatrix55 & matrix() const
const MagneticField & magneticField() const
T x() const
Definition: PV3DBase.h:59
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
static TrajectoryStateClosestToPoint constructTSCP(const FTS &originalFTS, const GlobalPoint &referencePoint)
static bool positionEqual(const GlobalPoint &ptB, const GlobalPoint &ptA)
GlobalPoint position() const
PairBoolFTS createFTSatTransverseImpactPoint(const FTS &originalFTS, const GlobalPoint &referencePoint) const
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 }
GlobalPoint globalPosition() const
std::pair< bool, FreeTrajectoryState > PairBoolFTS
static TrajectoryStateClosestToPoint constructTSCP(const FTS &originalFTS, const GlobalPoint &referencePoint)
static bool positionEqual(const GlobalPoint &ptB, const GlobalPoint &ptA)
FreeTrajectoryState const * freeState(bool withErrors=true) const
PairBoolFTS createFTSatTransverseImpactPoint(const FTS &originalFTS, const GlobalPoint &referencePoint) const