CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions
TSCPBuilderNoMaterial Class Reference

#include <TSCPBuilderNoMaterial.h>

Inheritance diagram for TSCPBuilderNoMaterial:
TrajectoryStateClosestToPointBuilder

Public Member Functions

virtual
TrajectoryStateClosestToPoint 
operator() (const FTS &originalFTS, const GlobalPoint &referencePoint) const
 
virtual
TrajectoryStateClosestToPoint 
operator() (const TSOS &originalTSOS, const GlobalPoint &referencePoint) const
 
virtual ~TSCPBuilderNoMaterial ()
 
- 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 16 of file TSCPBuilderNoMaterial.h.

Member Typedef Documentation

Definition at line 31 of file TSCPBuilderNoMaterial.h.

Definition at line 32 of file TSCPBuilderNoMaterial.h.

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

Definition at line 33 of file TSCPBuilderNoMaterial.h.

Constructor & Destructor Documentation

virtual TSCPBuilderNoMaterial::~TSCPBuilderNoMaterial ( )
inlinevirtual

Definition at line 21 of file TSCPBuilderNoMaterial.h.

21 {}

Member Function Documentation

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

Definition at line 48 of file TSCPBuilderNoMaterial.cc.

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

Referenced by operator()().

50 {
51  //
52  // Straight line approximation? |rho|<1.e-10 equivalent to ~ 1um
53  // difference in transversal position at 10m.
54  //
55  if( fabs(originalFTS.transverseCurvature())<1.e-10 ) {
56  return createFTSatTransverseImpactPointNeutral(originalFTS, referencePoint);
57  } else {
58  return createFTSatTransverseImpactPointCharged(originalFTS, referencePoint);
59  }
60 }
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 63 of file TSCPBuilderNoMaterial.cc.

References anyDirection, FreeTrajectoryState::charge(), FreeTrajectoryState::curvilinearError(), HelixBarrelPlaneCrossingByCircle::direction(), FreeTrajectoryState::hasError(), MagneticField::inInverseGeV(), AnalyticalCurvilinearJacobian::jacobian(), 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(), PV3DBase< T, PVType, FrameType >::y(), Basic3DVector< T >::y(), PV3DBase< T, PVType, FrameType >::z(), and Basic3DVector< T >::z().

Referenced by createFTSatTransverseImpactPoint().

65 {
66 
67  GlobalVector pvecOrig = originalFTS.momentum();
68  GlobalPoint xvecOrig = originalFTS.position();
69  double kappa = originalFTS.transverseCurvature();
70  double pxOrig = pvecOrig.x();
71  double pyOrig = pvecOrig.y();
72  double pzOrig = pvecOrig.z();
73  double xOrig = xvecOrig.x();
74  double yOrig = xvecOrig.y();
75  double zOrig = xvecOrig.z();
76 
77 // double fac = 1./originalFTS.charge()/MagneticField::inInverseGeV(referencePoint).z();
78  double fac = 1./originalFTS.charge()/
79  (originalFTS.parameters().magneticField().inInverseGeV(referencePoint).z());
80  GlobalVectorDouble xOrig2Centre = GlobalVectorDouble(fac * pyOrig, -fac * pxOrig, 0.);
81  GlobalVectorDouble xOrigProj = GlobalVectorDouble(xOrig, yOrig, 0.);
82  GlobalVectorDouble xRefProj = GlobalVectorDouble(referencePoint.x(), referencePoint.y(), 0.);
83  GlobalVectorDouble deltax = xRefProj-xOrigProj-xOrig2Centre;
84  GlobalVectorDouble ndeltax = deltax.unit();
85 
87  Surface::PositionType pos(referencePoint);
88  // Need to define plane with orientation as the
89  // ImpactPointSurface
90  GlobalVector X(ndeltax.x(), ndeltax.y(), ndeltax.z());
91  GlobalVector Y(0.,0.,1.);
93  BoundPlane* plane = new BoundPlane(pos,rot);
94  // Using Teddy's HelixBarrelPlaneCrossingByCircle for general barrel planes.
95  // A large variety of other,
96  // direct solutions turned out to be not so stable numerically.
98  planeCrossing(HelixPlaneCrossing::PositionType(xOrig, yOrig, zOrig),
99  HelixPlaneCrossing::DirectionType(pxOrig, pyOrig, pzOrig),
100  kappa, direction);
101  std::pair<bool,double> propResult = planeCrossing.pathLength(*plane);
102  if ( !propResult.first ) {
103  edm::LogWarning ("TSCPBuilderNoMaterial") << "Propagation to perigee plane failed!";
104  return PairBoolFTS(false, FreeTrajectoryState() );
105  }
106  double s = propResult.second;
107  HelixPlaneCrossing::PositionType xGen = planeCrossing.position(s);
108  GlobalPoint xPerigee = GlobalPoint(xGen.x(),xGen.y(),xGen.z());
109  // direction (reconverted to GlobalVector, renormalised)
110  HelixPlaneCrossing::DirectionType pGen = planeCrossing.direction(s);
111  pGen *= pvecOrig.mag()/pGen.mag();
112  GlobalVector pPerigee = GlobalVector(pGen.x(),pGen.y(),pGen.z());
113  delete plane;
114 
115  if (originalFTS.hasError()) {
116  const AlgebraicSymMatrix55 &errorMatrix = originalFTS.curvilinearError().matrix();
117  AnalyticalCurvilinearJacobian curvilinJacobian(originalFTS.parameters(), xPerigee,
118  pPerigee, s);
119  const AlgebraicMatrix55 &jacobian = curvilinJacobian.jacobian();
120  CurvilinearTrajectoryError cte( ROOT::Math::Similarity(jacobian, errorMatrix) );
121 
122  return PairBoolFTS(true,
123  FreeTrajectoryState(GlobalTrajectoryParameters(xPerigee, pPerigee, originalFTS.charge(),
124  &(originalFTS.parameters().magneticField())), cte) );
125  }
126  else {
127  return PairBoolFTS(true,
128  FreeTrajectoryState(GlobalTrajectoryParameters(xPerigee, pPerigee, originalFTS.charge(),
129  &(originalFTS.parameters().magneticField()))) );
130  }
131 
132 }
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
const GlobalTrajectoryParameters & parameters() const
const AlgebraicMatrix55 & jacobian() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
#define X(str)
Definition: MuonsGrabber.cc:48
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
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:39
T mag() const
Definition: PV3DBase.h:67
T z() const
Cartesian z coordinate.
T z() const
Definition: PV3DBase.h:64
Vector3DBase< double, GlobalTag > GlobalVectorDouble
GlobalVector momentum() const
GlobalPoint position() const
double transverseCurvature() const
const AlgebraicSymMatrix55 & matrix() const
const MagneticField & magneticField() const
static const G4double kappa
T x() const
Definition: PV3DBase.h:62
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
Global3DVector GlobalVector
Definition: GlobalVector.h:10
TSCPBuilderNoMaterial::PairBoolFTS TSCPBuilderNoMaterial::createFTSatTransverseImpactPointNeutral ( const FTS originalFTS,
const GlobalPoint referencePoint 
) const
private

Definition at line 136 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().

138 {
139 
140  GlobalPoint xvecOrig = originalFTS.position();
141  double phi = originalFTS.momentum().phi();
142  double theta = originalFTS.momentum().theta();
143  double xOrig = xvecOrig.x();
144  double yOrig = xvecOrig.y();
145  double zOrig = xvecOrig.z();
146  double xR = referencePoint.x();
147  double yR = referencePoint.y();
148 
149  double s2D = (xR - xOrig) * cos(phi) + (yR - yOrig) * sin(phi);
150  double s = s2D / sin(theta);
151  double xGen = xOrig + s2D*cos(phi);
152  double yGen = yOrig + s2D*sin(phi);
153  double zGen = zOrig + s2D/tan(theta);
154  GlobalPoint xPerigee = GlobalPoint(xGen, yGen, zGen);
155 
156  GlobalVector pPerigee = originalFTS.momentum();
157 
158  if (originalFTS.hasError()) {
159  const AlgebraicSymMatrix55 &errorMatrix = originalFTS.curvilinearError().matrix();
160  AnalyticalCurvilinearJacobian curvilinJacobian(originalFTS.parameters(), xPerigee,
161  pPerigee, s);
162  const AlgebraicMatrix55 &jacobian = curvilinJacobian.jacobian();
163  CurvilinearTrajectoryError cte( ROOT::Math::Similarity(jacobian, errorMatrix) );
164 
165  return PairBoolFTS(true,
166  FreeTrajectoryState(GlobalTrajectoryParameters(xPerigee, pPerigee, originalFTS.charge(),
167  &(originalFTS.parameters().magneticField())), cte));
168  }
169  else {
170  return PairBoolFTS(true,
171  FreeTrajectoryState(GlobalTrajectoryParameters(xPerigee, pPerigee, originalFTS.charge(),
172  &(originalFTS.parameters().magneticField()))) );
173  }
174 
175 }
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:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
T y() const
Definition: PV3DBase.h:63
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TrackCharge charge() const
std::pair< bool, FreeTrajectoryState > PairBoolFTS
const CurvilinearTrajectoryError & curvilinearError() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
T z() const
Definition: PV3DBase.h:64
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
const AlgebraicSymMatrix55 & matrix() const
const MagneticField & magneticField() const
T x() const
Definition: PV3DBase.h:62
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
TrajectoryStateClosestToPoint TSCPBuilderNoMaterial::operator() ( const FTS originalFTS,
const GlobalPoint referencePoint 
) const
virtual

Implements TrajectoryStateClosestToPointBuilder.

Definition at line 12 of file TSCPBuilderNoMaterial.cc.

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

14 {
15  if (positionEqual(referencePoint, originalFTS.position()))
16  return constructTSCP(originalFTS, referencePoint);
17 
18  // Now do the propagation or whatever...
19 
20  PairBoolFTS newStatePair =
21  createFTSatTransverseImpactPoint(originalFTS, referencePoint);
22  if (newStatePair.first) {
23  return constructTSCP(newStatePair.second, referencePoint);
24  } else {
26  }
27 }
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
virtual

Implements TrajectoryStateClosestToPointBuilder.

Definition at line 30 of file TSCPBuilderNoMaterial.cc.

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

32 {
33  if (positionEqual(referencePoint, originalTSOS.globalPosition()))
34  return constructTSCP(*originalTSOS.freeState(), referencePoint);
35 
36  // Now do the propagation
37 
38  PairBoolFTS newStatePair =
39  createFTSatTransverseImpactPoint(*originalTSOS.freeState(), referencePoint);
40  if (newStatePair.first) {
41  return constructTSCP(newStatePair.second, referencePoint);
42  } else {
44  }
45 }
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