ATLAS Offline Software
TargetSurfaces.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TransportJacobian.h, (c) ATLAS Detector software
8 
9 #ifndef TRKEXUTILS_TARGETSURFACES_H
10 #define TRKEXUTILS_TARGETSURFACES_H
11 
12 // CLHEP
13 #include <utility>
14 
20 #include "TrkSurfaces/Surface.h"
21 
22 class MsgStream;
23 
24 namespace Trk {
25 
26 class TrackingVolume;
27 
39 {
40  Target = 0,
43  SensitiveLayer = 3, // sensitive layer
44  MaterialLayer = 4 // material layer
45 };
47 {
48  Unknown = 0,
49  Frame = 1, // static volume
50  AlignableVolume = 2, // alignable volume
51  DenseVolume = 3 // dense alignable volume
52 };
53 
56 {
57 
58  const Surface* surf; // surface
59  BoundaryCheck bcheck; // boundary check
60  SurfNavigType sfType; // surface type : boundary, layer ...
61  unsigned int index; // layer or boundary index
62  const TrackingVolume* assocVol; // associated volume
63  TVNavigType volType; // volume type : static, detached, dense ...
64  double distanceAlongPath; // latest calculated distance
65  double distance; // minimal distance estimate
66  float signAbsDist; // sign of minimal distance when available
67  Amg::Vector3D intersection; // global position
68  int status; // navigation status (-1 crossed, 0 in loop, 1 ahead )
69 
72  BoundaryCheck bc,
73  SurfNavigType stype,
74  int ind,
75  const TrackingVolume* tVol,
76  TVNavigType vtype)
77  : surf(sf)
78  , bcheck(std::move(bc))
79  , sfType(stype)
80  , index(ind)
81  , assocVol(tVol)
82  , volType(vtype)
84  , distance(0)
85  , signAbsDist(0)
86  , intersection(0, 0, 0)
87  , status(0)
88  {
89  }
90 
92  ~TargetSurface() = default;
93 
95  void setDistance(double dAlongPath, double dMin, float sign)
96  {
97  distanceAlongPath = dAlongPath;
98  distance = dMin;
99  signAbsDist = sign;
100  }
101 
103  void setPosition(Amg::Vector3D intPos) { intersection = std::move(intPos); }
104 
106  void setStatus(int st) { status = st; }
107 
110  {
111  // temporary check ( remove after development finished )
112  // if ( fabs(distance) < step ) std::cout <<"fast distance update
113  // inappropriate " << std::endl; end temporary
114 
115  distance = distance > 0 ? distance - step : distance + step;
118  }
119 };
120 
121 typedef std::vector<TargetSurface> TargetSurfaceVector;
124 
126 {
127 public:
129  TargetSurfaces() = default;
130 
132  ~TargetSurfaces() = default;
133 
136  const Trk::Surface* sf,
137  const BoundaryCheck& bc);
138 
141  const Amg::Vector3D& direction,
142  const Trk::TrackingVolume*,
143  const Trk::Surface* sf,
144  const BoundaryCheck& bc);
145 
148  const Trk::Surface* sf,
149  const BoundaryCheck& bc);
150 
153  const Amg::Vector3D& direction,
154  const Trk::TrackingVolume*,
155  const Trk::Surface* sf,
156  const BoundaryCheck& bc);
157 
159  bool initFrameVolume(const Amg::Vector3D& position,
160  const Amg::Vector3D& direction,
161  const Trk::TrackingVolume*);
162 
164  void fillSolutions(int index,
165  Amg::Vector3D gp,
166  TargetSurfaceVector& solutions);
167 
169  bool checkDistance(const Amg::Vector3D& position,
170  const Amg::Vector3D& direction,
171  double nextStep);
172 
174  double distanceToNext();
175 
177  bool flipDirection();
178 
180  int nextSf();
181 
183  unsigned numSf();
184 
186  bool debugMode();
187 
189  void setDebugModeOn() { m_debugMode = true; }
190 
192  void setDebugModeOff() { m_debugMode = false; }
193 
196 
199 
200 private:
202  const Amg::Vector3D& pos,
203  const Amg::Vector3D& dir,
204  bool base);
205  void save(Trk::TargetSurface& tt, bool base);
206  void findNext();
208  bool updateDistance(int index,
210  const Amg::Vector3D& position,
211  const Amg::Vector3D& direction);
212 
213  bool m_orderTrue{true}; // neutral(true)/charged(false)
214  bool m_flipDirection{false};
215  bool m_absDist{false};
216  bool m_debugMode{false};
217  float m_tolerance{0.001};
219  m_baseSurfaces; // surfaces to be followed all along the path;
220  std::vector<TargetSurfaceVector>
221  m_tempSurfaces; // surfaces shadowed by an envelope
222  TargetSurfaceVector m_ordered; // ordered intersections;
223 
226  unsigned int m_numAlongPath{0};
227  int m_nextSf{-1};
228  double m_distanceToNext{1e6};
229  double m_lastStep{0};
230  double m_flipDistance{0};
231 
234 };
235 
236 inline double
238 {
239  return m_distanceToNext;
240 }
241 
242 inline bool
244 {
245  return m_flipDirection;
246 }
247 
248 inline int
250 {
251  return m_nextSf;
252 }
253 
254 inline unsigned int
256 {
257  return m_numAlongPath;
258 }
259 
260 inline bool
262 {
263  return m_debugMode;
264 }
265 
266 inline const Trk::TrackingVolume*
268 {
269  return m_currentDense;
270 }
271 
272 inline const Trk::TrackingVolume*
274 {
275  return m_currentFrame;
276 }
277 
278 } // end of namespace
279 
280 #endif // TRKEXUTILS_TARGETSURFACES_H
Trk::TargetSurfaces::currentDense
const Trk::TrackingVolume * currentDense()
current material volume/input for propagation
Definition: TargetSurfaces.h:267
Trk::TargetSurfaces::m_absDist
bool m_absDist
Definition: TargetSurfaces.h:215
Trk::TargetSurface::bcheck
BoundaryCheck bcheck
Definition: TargetSurfaces.h:59
base
std::string base
Definition: hcg.cxx:78
Trk::DenseVolume
@ DenseVolume
Definition: TargetSurfaces.h:51
Trk::TargetSurfaces::m_numAlongPath
unsigned int m_numAlongPath
Definition: TargetSurfaces.h:226
Trk::TargetSurface::distanceAlongPath
double distanceAlongPath
Definition: TargetSurfaces.h:64
Trk::TargetSurfaces::save
void save(Trk::TargetSurface &tt, bool base)
Definition: TargetSurfaces.cxx:368
Trk::TargetSurfaces::checkDistance
bool checkDistance(const Amg::Vector3D &position, const Amg::Vector3D &direction, double nextStep)
distance reevaluation
Definition: TargetSurfaces.cxx:471
Trk::TargetSurfaces::currentFrame
const Trk::TrackingVolume * currentFrame()
current material volume/input for propagation
Definition: TargetSurfaces.h:273
Trk::TargetSurfaces::m_orderTrue
bool m_orderTrue
Definition: TargetSurfaces.h:213
TrackParameters.h
Surface.h
Trk::TargetSurfaces::findNext
void findNext()
Definition: TargetSurfaces.cxx:418
Trk::TargetSurface
target surface info ( navigation )
Definition: TargetSurfaces.h:56
index
Definition: index.py:1
Trk::TargetSurfaces::m_currentDense
const Trk::TrackingVolume * m_currentDense
Definition: TargetSurfaces.h:233
Trk::Target
@ Target
Definition: TargetSurfaces.h:40
Trk::TargetSurface::~TargetSurface
~TargetSurface()=default
Destructor.
Trk::TargetSurfaces::m_debugMode
bool m_debugMode
Definition: TargetSurfaces.h:216
Trk::TargetSurface::setDistance
void setDistance(double dAlongPath, double dMin, float sign)
Distance info.
Definition: TargetSurfaces.h:95
Trk::TargetSurface::assocVol
const TrackingVolume * assocVol
Definition: TargetSurfaces.h:62
NeutralParameters.h
Trk::TargetSurfaces::m_probeDir
Amg::Vector3D m_probeDir
Definition: TargetSurfaces.h:225
Trk::TargetSurface::sfType
SurfNavigType sfType
Definition: TargetSurfaces.h:60
Trk::ExCellCharged
ExtrapolationCell< TrackParameters > ExCellCharged
Definition: IExtrapolationEngine.h:24
Trk::TVNavigType
TVNavigType
Definition: TargetSurfaces.h:47
Trk::TargetSurfaces::flipDirection
bool flipDirection()
step over intersection
Definition: TargetSurfaces.h:243
Trk::TargetSurface::TargetSurface
TargetSurface(const Surface *sf, BoundaryCheck bc, SurfNavigType stype, int ind, const TrackingVolume *tVol, TVNavigType vtype)
Constructor.
Definition: TargetSurfaces.h:71
Trk::TargetSurfaces::m_nextSf
int m_nextSf
Definition: TargetSurfaces.h:227
Trk::TargetSurface::intersection
Amg::Vector3D intersection
Definition: TargetSurfaces.h:67
Trk::SensitiveLayer
@ SensitiveLayer
Definition: TargetSurfaces.h:43
Trk::TargetSurface::setStatus
void setStatus(int st)
Navigation status info.
Definition: TargetSurfaces.h:106
Trk::TargetSurfaces::fillSolutions
void fillSolutions(int index, Amg::Vector3D gp, TargetSurfaceVector &solutions)
intersections
Definition: TargetSurfaces.cxx:624
Trk::TargetSurfaces::TargetSurfaces
TargetSurfaces()=default
Constructor.
Trk::TargetSurfaces::~TargetSurfaces
~TargetSurfaces()=default
Destructor.
Trk::ExtrapolationCode
Definition: ExtrapolationCell.h:105
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
Trk::TargetSurface::fastDistanceUpdate
void fastDistanceUpdate(double step)
fast approximative update ( real distance > distance estimate )
Definition: TargetSurfaces.h:109
Trk::TargetSurfaces::updateDistance
bool updateDistance(int index, Trk::TargetSurface &tt, const Amg::Vector3D &position, const Amg::Vector3D &direction)
Definition: TargetSurfaces.cxx:286
Trk::TargetSurfaces::distanceToNext
double distanceToNext()
estimated distance along path to the nearest surface
Definition: TargetSurfaces.h:237
beamspotman.dir
string dir
Definition: beamspotman.py:623
Trk::TargetSurfaces::orderIntersections
TargetSurfaceVector orderIntersections() const
Definition: TargetSurfaces.cxx:385
Trk::BoundaryFrame
@ BoundaryFrame
Definition: TargetSurfaces.h:41
Trk::TargetSurface::status
int status
Definition: TargetSurfaces.h:68
Trk::Unknown
@ Unknown
Definition: TargetSurfaces.h:48
Trk::TargetSurfaces::m_lastStep
double m_lastStep
Definition: TargetSurfaces.h:229
EventPrimitives.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::TargetSurfaces::setDebugModeOn
void setDebugModeOn()
set debug mode
Definition: TargetSurfaces.h:189
Trk::TargetSurfaces::m_ordered
TargetSurfaceVector m_ordered
Definition: TargetSurfaces.h:222
Trk::TargetSurfaces::m_distanceToNext
double m_distanceToNext
Definition: TargetSurfaces.h:228
Trk::TargetSurfaces::initFrameVolume
bool initFrameVolume(const Amg::Vector3D &position, const Amg::Vector3D &direction, const Trk::TrackingVolume *)
update of target surfaces at input or at frame volume boundary
Definition: TargetSurfaces.cxx:117
Trk::TargetSurfaces::m_tempSurfaces
std::vector< TargetSurfaceVector > m_tempSurfaces
Definition: TargetSurfaces.h:221
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::ExCellNeutral
ExtrapolationCell< NeutralParameters > ExCellNeutral
Definition: IExtrapolationEngine.h:25
Trk::TargetSurfaces::nextSf
int nextSf()
index of nearest surface
Definition: TargetSurfaces.h:249
Trk::TargetSurfaces::setDebugModeOff
void setDebugModeOff()
set debug mode
Definition: TargetSurfaces.h:192
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::BoundaryDetached
@ BoundaryDetached
Definition: TargetSurfaces.h:42
Trk::AlignableVolume
@ AlignableVolume
Definition: TargetSurfaces.h:50
Trk::ExtrapolationCell
Definition: ExtrapolationCell.h:231
Trk::TargetSurface::volType
TVNavigType volType
Definition: TargetSurfaces.h:63
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
Trk::TargetSurfaces::evaluateInputDistance
void evaluateInputDistance(Trk::TargetSurface &tt, const Amg::Vector3D &pos, const Amg::Vector3D &dir, bool base)
Definition: TargetSurfaces.cxx:218
Trk::TargetSurfaceVector
std::vector< TargetSurface > TargetSurfaceVector
Definition: TargetSurfaces.h:121
Trk::BoundaryCheck
Definition: BoundaryCheck.h:51
Trk::TargetSurfaces::numSf
unsigned numSf()
number of intersections along path
Definition: TargetSurfaces.h:255
Trk::TargetSurface::surf
const Surface * surf
Definition: TargetSurfaces.h:58
Trk::TargetSurfaces::m_probePos
Amg::Vector3D m_probePos
Definition: TargetSurfaces.h:224
Trk::TargetSurfaces::m_flipDirection
bool m_flipDirection
Definition: TargetSurfaces.h:214
BoundaryCheck.h
Trk::TargetSurface::setPosition
void setPosition(Amg::Vector3D intPos)
Intersection info.
Definition: TargetSurfaces.h:103
Trk::TargetSurfaces
Definition: TargetSurfaces.h:126
Trk::Frame
@ Frame
Definition: TargetSurfaces.h:49
ExtrapolationCell.h
LArCellBinning.step
step
Definition: LArCellBinning.py:158
Trk::TargetSurfaces::m_tolerance
float m_tolerance
Definition: TargetSurfaces.h:217
Trk::TargetSurfaces::m_flipDistance
double m_flipDistance
Definition: TargetSurfaces.h:230
Trk::TargetSurface::distance
double distance
Definition: TargetSurfaces.h:65
Trk::MaterialLayer
Definition: MaterialLayer.h:37
Trk::TargetSurfaces::debugMode
bool debugMode()
debug mode
Definition: TargetSurfaces.h:261
Trk::TargetSurface::signAbsDist
float signAbsDist
Definition: TargetSurfaces.h:66
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
Trk::TrackingVolume
Definition: TrackingVolume.h:121
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
Trk::TargetSurfaces::orderedIntersections
TargetSurfaceVector orderedIntersections(const Trk::ExCellNeutral &, const Trk::Surface *sf, const BoundaryCheck &bc)
Ordered intersections for neutral transport, step into new frame volume.
Definition: TargetSurfaces.cxx:69
Trk::TargetSurfaces::setOnInput
Trk::ExtrapolationCode setOnInput(const Trk::ExCellCharged &, const Trk::Surface *sf, const BoundaryCheck &bc)
Extract surfaces for charged propagation, step into new frame volume.
Definition: TargetSurfaces.cxx:23
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
Trk::TargetSurfaces::m_baseSurfaces
TargetSurfaceVector m_baseSurfaces
Definition: TargetSurfaces.h:219
Trk::SurfNavigType
SurfNavigType
typedef for surface and volume navigation types
Definition: TargetSurfaces.h:39
Trk::TargetSurface::index
unsigned int index
Definition: TargetSurfaces.h:61
Trk::TargetSurfaces::m_currentFrame
const Trk::TrackingVolume * m_currentFrame
Definition: TargetSurfaces.h:232