26 std::pair<TrajectoryStateOnSurface,double>
28 const Plane& plane)
const
38 std::pair< TrajectoryStateOnSurface,
double>
45 ? SurfaceSideDefinition::
beforeSurface : SurfaceSideDefinition::afterSurface;
57 double startZ = plane.localZ(gpos);
59 double rho = ts.transverseCurvature();
71 LogDebug(
"RKPropagatorInS")<<
" startZ = "<<startZ;
74 LogDebug(
"RKPropagatorInS")<<
"Propagation is not performed: state is already on final surface.";
86 std::pair<bool,double> propResult = planeCrossing.pathLength(plane);
87 if likely( propResult.first && theVolume !=0) {
88 double s = propResult.second;
95 LogDebug(
"RKPropagatorInS")<<
"Straight line propgation to plane failed !!";
102 if (theVolume != 0) {
103 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: starting prop to plane in volume with pos " << theVolume->position()
104 <<
" Z axis " << theVolume->toGlobal(
LocalVector(0,0,1)) ;
106 LogDebug(
"RKPropagatorInS") <<
"The starting position is " << ts.position() <<
" (global) "
107 << theVolume->toLocal(ts.position()) <<
" (local) " ;
110 FrameChanger::PlanePtr localPlane = changer.
transformPlane( plane, *theVolume);
111 LogDebug(
"RKPropagatorInS") <<
"The plane position is " << plane.position() <<
" (global) "
112 << localPlane->position() <<
" (local) " ;
114 LogDebug(
"RKPropagatorInS") <<
"The initial distance to plane is " << plane.localZ( ts.position()) ;
117 std::pair<bool,double> res3 =
cross.pathLength(plane);
118 LogDebug(
"RKPropagatorInS") <<
"straight line distance " << res3.first <<
" " << res3.second ;
122 typedef RKAdaptiveSolver<double,RKOneCashKarpStep, 6> Solver;
127 CartesianLorentzForce deriv(field, ts.charge());
129 RKCartesianDistance dist;
130 double eps = theTolerance;
138 while (safeGuard++<100) {
141 std::pair<bool,double>
path = pathLength( plane, startState.position(),
142 startState.momentum(),
143 (double) ts.charge(), currentDirection);
145 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Path length calculation to plane failed!"
146 <<
"...distance to plane " << plane.localZ( globalPosition(startState.position()))
147 <<
"...Local starting position in volume " << startState.position()
148 <<
"...Magnetic field " << field.inTesla( startState.position()) ;
154 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Path lenght to plane is " << path.second ;
157 double sstep = path.second;
159 LogDebug(
"RKPropagatorInS") <<
"On-surface accuracy not reached, but pathLength calculation says we are there! "
160 <<
"path " << path.second <<
" distance to plane is " << startZ ;
165 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Solving for " << sstep
166 <<
" current distance to plane is " << startZ ;
168 RKVector rkresult = solver( 0,
start, sstep, deriv, dist, eps);
171 double remainingZ = plane.localZ( globalPosition(cur.position()));
173 if ( fabs(remainingZ) < eps) {
174 LogDebug(
"RKPropagatorInS") <<
"On-surface accuracy reached! " << remainingZ ;
181 if (remainingZ * startZ > 0) {
182 LogDebug(
"RKPropagatorInS") <<
"Accuracy not reached yet, trying in same direction again "
186 LogDebug(
"RKPropagatorInS") <<
"Accuracy not reached yet, trying in opposite direction "
188 currentDirection = invertDirection( currentDirection);
193 edm::LogError(
"FailedPropagation") <<
" too many iterations trying to reach plane ";
201 typedef RKAdaptiveSolver<double,RKOneCashKarpStep, 6> Solver;
207 throw PropagationException(
"Cannot propagate to an arbitrary cylinder");
214 double startR = cyl.radius() - pos.perp();
238 std::pair<bool,double> propResult = cylCrossing.pathLength(cyl);
239 if likely( propResult.first && theVolume !=0) {
240 double s = propResult.second;
244 LogDebug(
"RKPropagatorInS") <<
"Straight line propagation to cylinder succeeded !!";
249 edm::LogError(
"RKPropagatorInS") <<
"Straight line propagation to cylinder failed !!";
257 CartesianLorentzForce deriv(field, ts.
charge());
259 RKCartesianDistance dist;
260 double eps = theTolerance;
267 while (safeGuard++<100) {
271 currentDirection, eps);
273 std::pair<bool,double> path = pathLength.pathLength( cyl);
275 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Path length calculation to cylinder failed!"
276 <<
"Radius " << cyl.radius() <<
" pos.perp() " <<
LocalPoint(startState.position()).
perp() ;
280 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Path lenght to cylinder is " << path.second
281 <<
" from point (R,z) " << startState.position().perp()
282 <<
", " << startState.position().z()
283 <<
" to R " << cyl.radius()
287 double sstep = path.second;
289 LogDebug(
"RKPropagatorInS") <<
"accuracy not reached, but pathLength calculation says we are there! "
293 startState.momentum(),
298 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Solving for " << sstep
299 <<
" current distance to cylinder is " << startR ;
301 RKVector rkresult = solver( 0,
start, sstep, deriv, dist, eps);
304 double remainingR = cyl.radius() - cur.position().perp();
306 if ( fabs(remainingR) < eps) {
307 LogDebug(
"RKPropagatorInS") <<
"Accuracy reached! " << remainingR ;
315 if (remainingR * startR > 0) {
316 LogDebug(
"RKPropagatorInS") <<
"Accuracy not reached yet, trying in same direction again "
320 LogDebug(
"RKPropagatorInS") <<
"Accuracy not reached yet, trying in opposite direction "
322 currentDirection = invertDirection( currentDirection);
327 edm::LogError(
"FailedPropagation") <<
" too many iterations trying to reach cylinder ";
334 return new RKPropagatorInS(*
this);
363 if (theVolume != 0)
return theVolume->toLocal( pos).basicVector();
369 if (theVolume != 0)
return theVolume->toLocal( mom).basicVector();
375 if (theVolume != 0)
return theVolume->toGlobal(
LocalPoint(pos));
382 if (theVolume != 0)
return theVolume->toGlobal(
LocalVector(mom));
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
tuple start
Check for commandline option errors.
Local3DVector LocalVector
ROOT::Math::Plane3D::Vector Vector
Global3DPoint GlobalPoint
TrackCharge charge() const
tuple path
else: Piece not in the list, fine.
static RKSmallVector< double, 6 > rkstate(const Vector3D &pos, const Vector3D &mom)
Abs< T >::type abs(const T &t)
const Vector3D & momentum() const
GlobalVector momentum() const
GlobalPoint position() const
static Plane transformPlane(const Plane &plane, const GloballyPositioned< T > &frame)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
double transverseCurvature() const
return(e1-e2)*(e1-e2)+dp *dp
std::pair< TrajectoryStateOnSurface, double > analyticalErrorPropagation(const FreeTrajectoryState &startingState, const Surface &surface, SurfaceSideDefinition::SurfaceSide side, const GlobalTrajectoryParameters &destParameters, const double &s)
T perp() const
Magnitude of transverse component.
const Vector3D & position() const
const BasicVectorType & basicVector() const
Global3DVector GlobalVector
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.