26 std::pair<TrajectoryStateOnSurface,double>
28 const Plane& plane)
const
39 std::pair< TrajectoryStateOnSurface,
double>
46 ? SurfaceSideDefinition::
beforeSurface : SurfaceSideDefinition::afterSurface;
48 return errorprop( fts, cyl, side, gp.parameters(),gp.s());
59 double startZ = plane.localZ(gpos);
61 double rho = ts.transverseCurvature();
73 LogDebug(
"RKPropagatorInS")<<
" startZ = "<<startZ;
76 LogDebug(
"RKPropagatorInS")<<
"Propagation is not performed: state is already on final surface.";
88 std::pair<bool,double> propResult = planeCrossing.pathLength(plane);
89 if likely( propResult.first && theVolume !=0) {
90 double s = propResult.second;
97 LogDebug(
"RKPropagatorInS")<<
"Straight line propgation to plane failed !!";
104 if (theVolume != 0) {
105 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: starting prop to plane in volume with pos " << theVolume->position()
106 <<
" Z axis " << theVolume->toGlobal(
LocalVector(0,0,1)) ;
108 LogDebug(
"RKPropagatorInS") <<
"The starting position is " << ts.position() <<
" (global) "
109 << theVolume->toLocal(ts.position()) <<
" (local) " ;
112 FrameChanger::PlanePtr localPlane = changer.
transformPlane( plane, *theVolume);
113 LogDebug(
"RKPropagatorInS") <<
"The plane position is " << plane.position() <<
" (global) "
114 << localPlane->position() <<
" (local) " ;
116 LogDebug(
"RKPropagatorInS") <<
"The initial distance to plane is " << plane.localZ( ts.position()) ;
119 std::pair<bool,double> res3 =
cross.pathLength(plane);
120 LogDebug(
"RKPropagatorInS") <<
"straight line distance " << res3.first <<
" " << res3.second ;
124 typedef RKAdaptiveSolver<double,RKOneCashKarpStep, 6> Solver;
129 CartesianLorentzForce deriv(
field, ts.charge());
131 RKCartesianDistance dist;
132 double eps = theTolerance;
140 while (safeGuard++<100) {
143 std::pair<bool,double>
path = pathLength( plane, startState.position(),
144 startState.momentum(),
145 (double) ts.charge(), currentDirection);
147 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Path length calculation to plane failed!"
148 <<
"...distance to plane " << plane.localZ( globalPosition(startState.position()))
149 <<
"...Local starting position in volume " << startState.position()
150 <<
"...Magnetic field " <<
field.inTesla( startState.position()) ;
156 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Path lenght to plane is " << path.second ;
159 double sstep = path.second;
161 LogDebug(
"RKPropagatorInS") <<
"On-surface accuracy not reached, but pathLength calculation says we are there! "
162 <<
"path " << path.second <<
" distance to plane is " << startZ ;
167 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Solving for " << sstep
168 <<
" current distance to plane is " << startZ ;
170 RKVector rkresult = solver( 0,
start, sstep, deriv, dist, eps);
173 double remainingZ = plane.localZ( globalPosition(cur.position()));
175 if ( fabs(remainingZ) < eps) {
176 LogDebug(
"RKPropagatorInS") <<
"On-surface accuracy reached! " << remainingZ ;
183 if (remainingZ * startZ > 0) {
184 LogDebug(
"RKPropagatorInS") <<
"Accuracy not reached yet, trying in same direction again "
188 LogDebug(
"RKPropagatorInS") <<
"Accuracy not reached yet, trying in opposite direction "
190 currentDirection = invertDirection( currentDirection);
195 edm::LogError(
"FailedPropagation") <<
" too many iterations trying to reach plane ";
203 typedef RKAdaptiveSolver<double,RKOneCashKarpStep, 6> Solver;
209 throw PropagationException(
"Cannot propagate to an arbitrary cylinder");
216 double startR = cyl.radius() - pos.perp();
240 std::pair<bool,double> propResult = cylCrossing.pathLength(cyl);
241 if likely( propResult.first && theVolume !=0) {
242 double s = propResult.second;
246 LogDebug(
"RKPropagatorInS") <<
"Straight line propagation to cylinder succeeded !!";
251 edm::LogError(
"RKPropagatorInS") <<
"Straight line propagation to cylinder failed !!";
261 RKCartesianDistance dist;
262 double eps = theTolerance;
269 while (safeGuard++<100) {
273 currentDirection, eps);
275 std::pair<bool,double> path = pathLength.pathLength( cyl);
277 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Path length calculation to cylinder failed!"
278 <<
"Radius " << cyl.radius() <<
" pos.perp() " <<
LocalPoint(startState.position()).
perp() ;
282 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Path lenght to cylinder is " << path.second
283 <<
" from point (R,z) " << startState.position().perp()
284 <<
", " << startState.position().z()
285 <<
" to R " << cyl.radius()
289 double sstep = path.second;
291 LogDebug(
"RKPropagatorInS") <<
"accuracy not reached, but pathLength calculation says we are there! "
295 startState.momentum(),
300 LogDebug(
"RKPropagatorInS") <<
"RKPropagatorInS: Solving for " << sstep
301 <<
" current distance to cylinder is " << startR ;
303 RKVector rkresult = solver( 0,
start, sstep, deriv, dist, eps);
306 double remainingR = cyl.radius() - cur.position().perp();
308 if ( fabs(remainingR) < eps) {
309 LogDebug(
"RKPropagatorInS") <<
"Accuracy reached! " << remainingR ;
317 if (remainingR * startR > 0) {
318 LogDebug(
"RKPropagatorInS") <<
"Accuracy not reached yet, trying in same direction again "
322 LogDebug(
"RKPropagatorInS") <<
"Accuracy not reached yet, trying in opposite direction "
324 currentDirection = invertDirection( currentDirection);
329 edm::LogError(
"FailedPropagation") <<
" too many iterations trying to reach cylinder ";
333 TrajectoryStateOnSurface
336 return propagateWithPath( fts, plane).first;
339 TrajectoryStateOnSurface
342 return propagateWithPath( fts, cyl).first;
347 return new RKPropagatorInS(*
this);
376 if (theVolume != 0)
return theVolume->toLocal( pos).basicVector();
382 if (theVolume != 0)
return theVolume->toLocal( mom).basicVector();
388 if (theVolume != 0)
return theVolume->toGlobal(
LocalPoint(pos));
395 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
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)
double transverseCurvature() const
return(e1-e2)*(e1-e2)+dp *dp
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.