ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TrackPropagationHelper::Imp Class Reference
Collaboration diagram for TrackPropagationHelper::Imp:

Public Member Functions

 Imp (TrackPropagationHelper *tc)
 
bool outsideIDVolume (const Amg::Vector3D &p) const
 
void movePoint1ToZPlaneAndPoint2 (Amg::Vector3D &p1, const Amg::Vector3D &p2, const double &z) const
 
void movePoint1ToInfiniteCylinderAndPoint2 (Amg::Vector3D &p1, const Amg::Vector3D &p2, const double &r) const
 
bool makePointsNeutral_SinglePar (std::vector< Amg::Vector3D > &points, const Trk::Track *)
 
bool makePointsCharged_SinglePar (std::vector< Amg::Vector3D > &points, const Trk::Track *, Trk::IExtrapolator *extrapolator, Trk::ParticleHypothesis hypo)
 
bool addPointsBetweenParameters_Charged (std::vector< Amg::Vector3D > &points, const Trk::Track *, const Trk::TrackParameters *par1, const Trk::TrackParameters *par2, Trk::IExtrapolator *extrapolator, Trk::ParticleHypothesis hypo)
 
const Trk::TrackParametersextrapolateToNewPar (Trk::IExtrapolator *extrapolator, const Trk::Track *trk, const Trk::TrackParameters *prevpars, Trk::ParticleHypothesis hypo, const double &dist)
 

Static Public Member Functions

static double maxPointDistSq (const Amg::Vector3D &)
 

Public Attributes

TrackPropagationHelpertheclass {}
 
std::unique_ptr< VP1TrackSanitytracksanity {}
 
const double maxInDetr {}
 
const double maxInDetrsq {}
 
const double maxz {}
 
const double fallback_flydist {}
 
std::vector< Trk::PlaneSurfacesurfaces
 For debugging. More...
 
bool showExtrapSurfaces
 

Detailed Description

Definition at line 36 of file TrackPropagationHelper.cxx.

Constructor & Destructor Documentation

◆ Imp()

TrackPropagationHelper::Imp::Imp ( TrackPropagationHelper tc)
inline

Definition at line 38 of file TrackPropagationHelper.cxx.

39  : theclass(tc),
40  tracksanity(new VP1TrackSanity(tc?tc->systemBase():nullptr)),
41  maxInDetr(1.1*CLHEP::m),
43  maxz(3.5*CLHEP::m),
45  showExtrapSurfaces(VP1QtUtils::environmentVariableIsOn("VP1_TRKSYS_SHOWEXTRAPSURFACES"))
46  {
47  }

Member Function Documentation

◆ addPointsBetweenParameters_Charged()

bool TrackPropagationHelper::Imp::addPointsBetweenParameters_Charged ( std::vector< Amg::Vector3D > &  points,
const Trk::Track trk,
const Trk::TrackParameters par1,
const Trk::TrackParameters par2,
Trk::IExtrapolator extrapolator,
Trk::ParticleHypothesis  hypo 
)

Definition at line 446 of file TrackPropagationHelper.cxx.

449 {
450  double distbetween = sqrt((par2->position()-par1->position()).mag2());
451  if (distbetween<0.001) {
452  theclass->messageVerbose("TrackPropagationHelper::Imp::addPointsBetweenParameters_Charged: parameters on top of each other. Skip, but no error.");
453  return true;
454  }
455  // theclass->messageVerbose("TrackPropagationHelper::Imp::addPointsBetweenParameters_Charged: par1="
456  // +str(par1->position())+", par2=" +str(par2->position())+", dist="+str(distbetween));
457 
458  Amg::Vector3D p2(par2->position());
459  const Trk::TrackParameters * prevpars = par1;
460 
461  double olddistsq(1.0e99);
462  double distadded(0);
463  const double maxdistadded = std::max(2*CLHEP::m,(par1->position()-p2).mag()*1.5);
464  while ( (prevpars->position()-p2).mag()> maxPointDistSq(prevpars->position()) && distadded<maxdistadded ) {
465 
466  // theclass->messageVerbose("distadded: "+str(distadded)+", distance left="+str(sqrt((prevpars->position()-p2).mag2()))+", jump="+str(maxPointDistSq(prevpars->position())));
467  const Trk::TrackParameters * newpars = extrapolateToNewPar( extrapolator, trk, prevpars, hypo, maxPointDistSq(prevpars->position()) );
468  if (!newpars){
469  if (VP1Msg::verbose())
470  theclass->messageVerbose("TrackPropagationHelper::Imp::addPointsBetweenParameters_Charged: Extrapolation failed.");
471  return false;
472  }
473  const double distsq = (par2->position()-newpars->position()).mag2();
474  if (distsq>olddistsq) {
475  delete newpars;
476  if (VP1Msg::verbose())
477  theclass->messageVerbose("TrackPropagationHelper::Imp::addPointsBetweenParameters_Charged: distq("+str(distsq)+")>olddistsq ("+str(olddistsq)+") so overshot?");
478  return false;
479  }
480  olddistsq = distsq;
481  // if ((prevpars->position()-newpars->position()).mag2() > 4*maxpointdistsq) {
482  // delete newpars;
483  // return false;
484  // }
485  points.push_back(newpars->position());
486  distadded += (newpars->position()-prevpars->position()).mag();
487  if (prevpars!=par1)
488  delete prevpars;
489  prevpars = newpars;
490  }
491  if (prevpars!=par1)
492  delete prevpars;
493  return (distadded<maxdistadded);
494 }

◆ extrapolateToNewPar()

const Trk::TrackParameters * TrackPropagationHelper::Imp::extrapolateToNewPar ( Trk::IExtrapolator extrapolator,
const Trk::Track trk,
const Trk::TrackParameters prevpars,
Trk::ParticleHypothesis  hypo,
const double &  dist 
)

Definition at line 337 of file TrackPropagationHelper.cxx.

342 {
343  if (!trk||!prevpars||!extrapolator)
344  return nullptr;
345 
346  Trk::CurvilinearUVT uvt(prevpars->momentum().unit());
347 
348 
349  Amg::Transform3D t(uvt.curvU(),uvt.curvV(),uvt.curvT(), prevpars->position()+(prevpars->momentum().unit()*dist));
350 
351  Trk::PlaneSurface surf(t);
352 
353 
354  if (showExtrapSurfaces) surfaces.push_back(surf);
355 
356 
357  const Trk::TrackParameters *newpars(nullptr);
358  try {
359  newpars = extrapolator->extrapolate(Gaudi::Hive::currentContext(),
360  *prevpars,
361  surf,
362  Trk::alongMomentum,false,hypo).release(); // change this to extrapolate current param to surface.
363  } catch (const std::runtime_error& e) {
364  theclass->message("Failure trying to use extrapolator for track (Exception thrown: " + QString(e.what())+")");
365  return nullptr;
366  }
367  if (!newpars) {
368  theclass->message("Failure trying to use extrapolator for track");
369  return nullptr;
370  }
371  if (!newpars) {
372  theclass->message("Failure trying to use extrapolator for track");
373  return nullptr;
374  }
375  return newpars;
376 }

◆ makePointsCharged_SinglePar()

bool TrackPropagationHelper::Imp::makePointsCharged_SinglePar ( std::vector< Amg::Vector3D > &  points,
const Trk::Track track,
Trk::IExtrapolator extrapolator,
Trk::ParticleHypothesis  hypo 
)

Definition at line 384 of file TrackPropagationHelper.cxx.

386 {
387  if (VP1Msg::verbose())
388  theclass->messageVerbose("makePointsCharged_SinglePar start");
389  points.clear();
390  if (!extrapolator) {
391  theclass->message("makePointsCharged_SinglePar ERROR: Null extrapolator tool provided!");
392  return false;
393  }
394  const Trk::TrackParameters * par = *(track->trackParameters()->begin());
395  if (!tracksanity->isSafe(par)) {
396  theclass->messageDebug("makePointsCharged_SinglePar called with unsafe track parameter");
397  return false;
398  }
399 
400  Amg::Vector3D p0(par->position());
401  points.push_back(p0);
402  const bool startoutsideID(outsideIDVolume(p0));
403 
404  double distadded(0);
405  const double maxdistadded = 2*CLHEP::m;
406  points.reserve(20);//skip a few reallocs
407  const Trk::TrackParameters * prevpars = par;
408  const Trk::TrackParameters * temppars(nullptr);
409 
410  while (distadded<maxdistadded) {
411  temppars = extrapolateToNewPar( extrapolator, track, prevpars, hypo, maxPointDistSq(prevpars->position()));
412  if (temppars)
413  distadded += (temppars->position()-prevpars->position()).mag();
414  if (prevpars!=par)
415  delete prevpars;
416  prevpars = nullptr;
417  if (!temppars) {
418  theclass->messageDebug("makePointsCharged_SinglePar ERROR: Failed to use extrapolator for next point");
419  if (points.size()<2) {
420  points.clear();
421  return false;
422  }
423  return true;//Fixme??
424  }
425  Amg::Vector3D p(temppars->position());
426  points.push_back(p);
427  prevpars = temppars;
428  temppars = nullptr;
429  if (!startoutsideID && outsideIDVolume(p)) {
430  if (prevpars!=par)
431  delete prevpars;
432  prevpars = nullptr;
433  break;
434  }
435  }
436  if (prevpars!=par)
437  delete prevpars;
438 
439  if (VP1Msg::verbose())
440  theclass->messageVerbose("makePointsCharged_SinglePar end");
441  return true;
442 
443 }

◆ makePointsNeutral_SinglePar()

bool TrackPropagationHelper::Imp::makePointsNeutral_SinglePar ( std::vector< Amg::Vector3D > &  points,
const Trk::Track track 
)

Definition at line 204 of file TrackPropagationHelper.cxx.

205 {
206  if (VP1Msg::verbose())
207  theclass->messageVerbose("makePointsNeutral_SinglePar start");
208  points.clear();
209  const Trk::TrackParameters * par = *(track->trackParameters()->begin());
210  if (!tracksanity->isSafe(par)) {
211  theclass->messageDebug("makePointsNeutral_SinglePar called with unsafe track parameter");
212  return false;
213  }
214  Amg::Vector3D u(par->momentum().unit());
215  Amg::Vector3D a(par->position()),b;
216  if (outsideIDVolume(a)) {
217  //We start outside. We just add fallback_flydist. (fixme: warn?)
218  b = a +fallback_flydist*u;
219  } else {
220  //Make a second point, where trajectory hits maxInDetr,maxz
221  b = a +999*CLHEP::m*u;
222  if (b.z()<-maxz)
224  else
225  if (b.z()>maxz)
227  if (b.perp2()>maxInDetrsq)
229  }
230  points.reserve(2);
231  points.push_back(a);
232  points.push_back(b);
233  if (VP1Msg::verbose())
234  theclass->messageVerbose("makePointsNeutral_SinglePar (single track parameter) end");
235  return true;
236 }

◆ maxPointDistSq()

static double TrackPropagationHelper::Imp::maxPointDistSq ( const Amg::Vector3D )
inlinestatic

all paths return the same number const double absz(fabs(p.z())), absrsq(p.perp2()); if ( (absz<2.75*CLHEP::m) and (absrsq<(1.2*CLHEP::m)*(1.2*CLHEP::m)) ) { if ( (absz<0.67*CLHEP::m) and (absrsq<(0.16*CLHEP::m)*(0.16*CLHEP::m)) ) { return 2*CLHEPcm;//inside pixel } return 2*CLHEPcm;//ID outside pixel }

Definition at line 78 of file TrackPropagationHelper.cxx.

78  {
79  //Vertex region:
89  return 2*CLHEP::cm;//Outside ID
90  }

◆ movePoint1ToInfiniteCylinderAndPoint2()

void TrackPropagationHelper::Imp::movePoint1ToInfiniteCylinderAndPoint2 ( Amg::Vector3D p1,
const Amg::Vector3D p2,
const double &  r 
) const

Definition at line 117 of file TrackPropagationHelper.cxx.

118 {
119  //Fixme: what happens here if we don't cross? And how can we be sure
120  //that we don't move FURTHER than the other point? (i.e. if the
121  //infinite line with p1 and p2 crosses, but the segment p1p2 does
122  //not!?
123  double p1r(p1.perp());
124  double dr(p2.perp()-p1r);
125  if (dr==0.0) {
126  theclass->message("movePoint1ToInfiniteCylinderAndPoint2 Error: Points have same r!!");
127  return;
128  }
129  double s((r-p1r)/dr);
130  double t(1.0-s);
131  // p1.set( p1.x()*t + p2.x()*s, p1.y()*t + p2.y()*s, p1.z()*t + p2.z()*s );
132  p1[0]= p1.x()*t + p2.x()*s;
133  //p1[1]= p2.y()*s, p1.z()*t; original
134  p1[1]= p1.y()*t + p2.y()*s; //sroe, compiler warning fix
135  p1[2]= p1.z()*t + p2.z()*s;
136 }

◆ movePoint1ToZPlaneAndPoint2()

void TrackPropagationHelper::Imp::movePoint1ToZPlaneAndPoint2 ( Amg::Vector3D p1,
const Amg::Vector3D p2,
const double &  z 
) const

Definition at line 101 of file TrackPropagationHelper.cxx.

102 {
103  double dx(p2.x()-p1.x()), dy(p2.y()-p1.y()), dz(p2.z()-p1.z());
104  if (dz==0.0) {
105  theclass->message("movePoint1ToZPlaneAndPoint2 Error: Points have same z!!");
106  return;
107  }
108  double s( (z-p1.z())/dz );
109  // p1.set( p1.x()+dx*s, p1.y()+dy*s, z );
110  p1[0]= p1.x()+dx*s;
111  p1[1]= p1.y()+dy*s;
112  p1[2]= z;
113 
114 }

◆ outsideIDVolume()

bool TrackPropagationHelper::Imp::outsideIDVolume ( const Amg::Vector3D p) const
inline

Definition at line 56 of file TrackPropagationHelper.cxx.

56  {
57  return fabs(p.z())>maxz||p.perp2()>maxInDetrsq;
58  }

Member Data Documentation

◆ fallback_flydist

const double TrackPropagationHelper::Imp::fallback_flydist {}

Definition at line 54 of file TrackPropagationHelper.cxx.

◆ maxInDetr

const double TrackPropagationHelper::Imp::maxInDetr {}

Definition at line 51 of file TrackPropagationHelper.cxx.

◆ maxInDetrsq

const double TrackPropagationHelper::Imp::maxInDetrsq {}

Definition at line 52 of file TrackPropagationHelper.cxx.

◆ maxz

const double TrackPropagationHelper::Imp::maxz {}

Definition at line 53 of file TrackPropagationHelper.cxx.

◆ showExtrapSurfaces

bool TrackPropagationHelper::Imp::showExtrapSurfaces

Definition at line 93 of file TrackPropagationHelper.cxx.

◆ surfaces

std::vector<Trk::PlaneSurface> TrackPropagationHelper::Imp::surfaces

For debugging.

Definition at line 92 of file TrackPropagationHelper.cxx.

◆ theclass

TrackPropagationHelper* TrackPropagationHelper::Imp::theclass {}

Definition at line 49 of file TrackPropagationHelper.cxx.

◆ tracksanity

std::unique_ptr<VP1TrackSanity> TrackPropagationHelper::Imp::tracksanity {}

Definition at line 50 of file TrackPropagationHelper.cxx.


The documentation for this class was generated from the following file:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
beamspotman.r
def r
Definition: beamspotman.py:676
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
VP1HelperClassBase::messageVerbose
void messageVerbose(const QString &) const
Definition: VP1HelperClassBase.cxx:78
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
Trk::alongMomentum
@ alongMomentum
Definition: PropDirection.h:20
VP1TrackSanity
Definition: VP1TrackSanity.h:34
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
TrackPropagationHelper::Imp::tracksanity
std::unique_ptr< VP1TrackSanity > tracksanity
Definition: TrackPropagationHelper.cxx:50
VP1HelperClassBase::messageDebug
void messageDebug(const QString &) const
Definition: VP1HelperClassBase.cxx:65
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
TrackPropagationHelper::Imp::fallback_flydist
const double fallback_flydist
Definition: TrackPropagationHelper.cxx:54
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
TrackPropagationHelper::Imp::extrapolateToNewPar
const Trk::TrackParameters * extrapolateToNewPar(Trk::IExtrapolator *extrapolator, const Trk::Track *trk, const Trk::TrackParameters *prevpars, Trk::ParticleHypothesis hypo, const double &dist)
Definition: TrackPropagationHelper.cxx:337
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
VP1QtUtils::environmentVariableIsOn
static bool environmentVariableIsOn(const QString &name)
Definition: VP1QtUtils.cxx:127
z
#define z
TrackPropagationHelper::Imp::maxInDetrsq
const double maxInDetrsq
Definition: TrackPropagationHelper.cxx:52
Trk::IExtrapolator::extrapolate
virtual std::unique_ptr< NeutralParameters > extrapolate(const NeutralParameters &parameters, const Surface &sf, PropDirection dir=anyDirection, const BoundaryCheck &bcheck=true) const =0
Main extrapolation Interface starting from neutral parameters and aiming at surface.
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
TrackPropagationHelper::Imp::movePoint1ToZPlaneAndPoint2
void movePoint1ToZPlaneAndPoint2(Amg::Vector3D &p1, const Amg::Vector3D &p2, const double &z) const
Definition: TrackPropagationHelper.cxx:101
TrackPropagationHelper::Imp::maxz
const double maxz
Definition: TrackPropagationHelper.cxx:53
TrackPropagationHelper::Imp::theclass
TrackPropagationHelper * theclass
Definition: TrackPropagationHelper.cxx:49
Trk::ParametersBase
Definition: ParametersBase.h:55
TrackPropagationHelper::Imp::maxPointDistSq
static double maxPointDistSq(const Amg::Vector3D &)
Definition: TrackPropagationHelper.cxx:78
VP1HelperClassBase::systemBase
IVP1System * systemBase() const
Definition: VP1HelperClassBase.h:50
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
TrackPropagationHelper::Imp::outsideIDVolume
bool outsideIDVolume(const Amg::Vector3D &p) const
Definition: TrackPropagationHelper.cxx:56
TrackPropagationHelper::Imp::movePoint1ToInfiniteCylinderAndPoint2
void movePoint1ToInfiniteCylinderAndPoint2(Amg::Vector3D &p1, const Amg::Vector3D &p2, const double &r) const
Definition: TrackPropagationHelper.cxx:117
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
TrackPropagationHelper::Imp::showExtrapSurfaces
bool showExtrapSurfaces
Definition: TrackPropagationHelper.cxx:93
TrackPropagationHelper::Imp::maxInDetr
const double maxInDetr
Definition: TrackPropagationHelper.cxx:51
a
TList * a
Definition: liststreamerinfos.cxx:10
Trk::CurvilinearUVT
Definition: CurvilinearUVT.h:45
Trk::PlaneSurface
Definition: PlaneSurface.h:64
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
str
Definition: BTagTrackIpAccessor.cxx:11
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
mag2
Scalar mag2() const
mag2 method - forward to squaredNorm()
Definition: AmgMatrixBasePlugin.h:31
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26
jobOptions.points
points
Definition: jobOptions.GenevaPy8_Zmumu.py:97
TRTCalib_cfilter.p0
p0
Definition: TRTCalib_cfilter.py:129
TrackPropagationHelper::Imp::surfaces
std::vector< Trk::PlaneSurface > surfaces
For debugging.
Definition: TrackPropagationHelper.cxx:92