ATLAS Offline Software
Loading...
Searching...
No Matches
IDTPM2::TrackRoiSelector Class Reference

doesn't actually need to be an algtool as it class variables, so requires no python configuration More...

#include <TrackRoiSelector.h>

Collaboration diagram for IDTPM2::TrackRoiSelector:

Classes

struct  exit_point

Public Member Functions

 TrackRoiSelector ()
 Constructor - self evidently.
virtual ~TrackRoiSelector ()=default
 Destructor.
template<class T>
bool accept (const T &t, const TrigRoiDescriptor *r) const
 geometric RoI filters - for non-trigger tracks (e.g. offline, truth, etc.)
template<class T>
std::vector< const T * > getTracks (const std::vector< const T * > &tracks, const TrigRoiDescriptor *roi) const
 track getter function (for offline tracks || truth particles)

Private Member Functions

exit_point getExitPoint (float tz0, float teta) const
 why are there these "exit point functions ?
std::optional< double > getOuterPhi (float pt, float phi, float r=1000.) const

Detailed Description

doesn't actually need to be an algtool as it class variables, so requires no python configuration

Definition at line 30 of file TrackRoiSelector.h.

Constructor & Destructor Documentation

◆ TrackRoiSelector()

IDTPM2::TrackRoiSelector::TrackRoiSelector ( )
inline

Constructor - self evidently.

Definition at line 35 of file TrackRoiSelector.h.

35{ }

◆ ~TrackRoiSelector()

virtual IDTPM2::TrackRoiSelector::~TrackRoiSelector ( )
virtualdefault

Destructor.

Member Function Documentation

◆ accept()

template<class T>
template bool IDTPM2::TrackRoiSelector::accept ( const T & t,
const TrigRoiDescriptor * r ) const

geometric RoI filters - for non-trigger tracks (e.g. offline, truth, etc.)

accept method for truth particles

Athena include(s).

Local include(s) STD includes


----— accept -----—

should really throw an exception

NB: This isn't actually correct - the tracks can bend out of the RoI even if the perigee phi is within the Roi so we check the outer phi limit later ...

must be contained along the beamline ...

this is actually wrong, but hey ho. It is even needed ?

calculation of approximate z position of the track at radius r && test if track within that z position at radius r

full check to determine whether a track is fully contained in the Roi (when used in conjunction with contained_zed above) sadly this will recalculate the Roi limits for every track, which is why the earlier version took this stuff from the Roi itself - will need to go back to that at some point,

now check phi taking account of the track transverse curvature NB: need to check the pt is properly signed

Definition at line 27 of file TrackRoiSelector.cxx.

27 {
28
29 if ( r==0 ) return true;
30
31 if ( t.pt()==0 ) return false; // throw runtime_error(shouldn't ever have a track with pt = 0" );
32
33 if( r->composite() ) {
34
35 for ( unsigned i=r->size() ; i-- ; ) if ( accept( t, (const TrigRoiDescriptor*)r->at(i) ) ) return true;
36
37 }
38 else {
39
40 if( r->isFullscan() ) return true;
41
42 // std::cout << "r->
43
47 bool contained_phi = ( r->phiMinus()<r->phiPlus() ) ?
48 ( t.phi()>r->phiMinus() && t.phi()<r->phiPlus() ) :
49 ( t.phi()>r->phiMinus() || t.phi()<r->phiPlus() );
50
52 bool contained_zed = ( t.z0()>r->zedMinus() && t.z0()<r->zedPlus() );
53
56 bool contained_eta = ( t.eta()<r->etaPlus() && t.eta()>r->etaMinus() );
57
60
61#if 0
65 // RoiDescriptor so that computes and stores it's exit points as standard
66
67 exit_point ex;
68 exit_point explus;
69 exit_point exminus;
70
71 TIDARoiDescriptor::exitpoint( t.z0(), t.eta(), ex.z, ex.r );
72
73 TIDARoiDescriptor::exitpoint( r->zedPlus(), r->etaPlus(), explus.z, explus.r );
74 TIDARoiDescriptor::exitpoint( r->zedMinus(), r->etaMinus(), exminus.z, exminus.r );
75
76#else
77
84 exit_point ex = getExitPoint( t.z0(), t.eta() );
85 exit_point explus = getExitPoint( r->zedPlus(), r->etaPlus() );
86 exit_point exminus = getExitPoint( r->zedMinus(), r->etaMinus() );
87#endif
88
89 float cross0 = ex.z*exminus.r - ex.r*exminus.z;
90 float cross1 = ex.z*explus.r - ex.r*explus.z;
91
92 contained_eta = ( cross0>0 && cross1<0 ) ? true : false;
93
96 std::optional<double> newphi = getOuterPhi( t.pt(), t.phi(), ex.r );
97
98 if( !newphi ) return false;
99
100 if( r->phiMinus() < r->phiPlus() ) contained_phi &= ( newphi > r->phiMinus() && newphi < r->phiPlus() );
101 else contained_phi &= ( newphi > r->phiMinus() || newphi < r->phiPlus() );
102
103 if( contained_eta && contained_phi && contained_zed ) return true;
104 }
105
106 return false;
107}
Athena::TPCnvVers::Current TrigRoiDescriptor
bool accept(const T &t, const TrigRoiDescriptor *r) const
geometric RoI filters - for non-trigger tracks (e.g. offline, truth, etc.)
exit_point getExitPoint(float tz0, float teta) const
why are there these "exit point functions ?
std::optional< double > getOuterPhi(float pt, float phi, float r=1000.) const
static double exitpoint(double tz0, double teta, double &zexit, double &rexit)
returns the tantheta for the limits and the r and z exit points from the ID volume
int r
Definition globals.cxx:22

◆ getExitPoint()

IDTPM2::TrackRoiSelector::exit_point IDTPM2::TrackRoiSelector::getExitPoint ( float tz0,
float teta ) const
private

why are there these "exit point functions ?

Actually, this class should really be implemented as inheriting from an ITrackSelector.

should we not use the versions in the RoiDescriptor ? this is actually a largely copy of a TrigRoiDescriptor function Geometric utility methods for track-RoI association


----— getExitPoint ----—

not quite right, because it might be passing out through the rear endcap

leaves through the barrel side || front face?

through the barrel edge actually need to calculate the z exit coordinate
for proper containment rather than spurious "eta containment"

Definition at line 151 of file TrackRoiSelector.cxx.

151 {
152
153 exit_point exitPoint;
154
155 double rexit = 0;
156 double zexit = 0;
157 const double maxRadius = 1000.;
158 const double maxZed = 2700.;
159
160 if ( teta < 0 ) zexit = -maxZed;
161 else if ( teta > 0 ) zexit = maxZed;
162 else {
163 exitPoint.z = tz0;
164 exitPoint.r = maxRadius;
165 return exitPoint;
166 }
167
168 double tantheta = std::tan( 2 * std::atan( std::exp( -teta ) ) );
169
170 rexit = ( zexit - tz0 ) * tantheta;
171
173 if ( std::fabs(rexit) > maxRadius ) {
178
179 zexit = maxRadius / tantheta + tz0;
180 rexit = maxRadius;
181 }
182
183 exitPoint.z = zexit;
184 exitPoint.r = rexit;
185
186 return exitPoint;
187}

◆ getOuterPhi()

std::optional< double > IDTPM2::TrackRoiSelector::getOuterPhi ( float pt,
float phi,
float r = 1000. ) const
private

----— getOuterPhi ----—

calculate the (very approximate) phi position for a track at a radius r

track (signed) radius of curvature (if pt is signed)

make sure it escapes the radius in question

calculate new position

wrap to -pi to pi - is this correct when using floats ? NB: float(M_PI)>M_PI ? so use doubles for all the calculations

Definition at line 118 of file TrackRoiSelector.cxx.

118 {
119
122
123
125 double mqR = 10 * pt / ( 2.99792458 * 2 ); // 2.998=speed of light, 2=Atlas B field
126 double ratio = 0.5 * r / mqR;
127 double newphi = phi;
128
130 if ( std::fabs(ratio)>1 ) return std::nullopt;
131
133 newphi -= std::asin( ratio );
134
137 while( newphi < -M_PI ) newphi += 2 * M_PI;
138 while( newphi > M_PI ) newphi -= 2 * M_PI;
139
140 return newphi;
141}
#define M_PI
Scalar phi() const
phi method

◆ getTracks()

template<class T>
std::vector< const T * > IDTPM2::TrackRoiSelector::getTracks ( const std::vector< const T * > & tracks,
const TrigRoiDescriptor * roi ) const

track getter function (for offline tracks || truth particles)

no point looking at tracks that never make it into the detector ...

Definition at line 77 of file TrackRoiSelector.h.

78 {
79
80 // std::cout << "\n\n\tSUTT roi filter" << tvec.size() << "\t" << *roi << "\n" << std::endl;
81
82 std::vector<const T*> selectedTracks;
83
84 for( size_t it=0 ; it<tracks.size() ; it++ ) {
85
86 const T* track = tracks.at(it);
87
89 if ( track->pt()==0 ) continue;
90
91 bool keep = accept<T>( *track, roi );
92
93 // if ( keep ) std::cout << it << "\t" << *tvec[it] << "\taccept: " << keep << std::endl;
94
95 if( keep ) selectedTracks.push_back( track );
96 }
97
98 // std::cout << "\tSUTT: " << selectedTracks.size() << std::endl;
99
100 return selectedTracks;
101}
unsigned long long T

The documentation for this class was generated from the following files: