ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDetDescr
InDetServMatGeoModel
src
Route.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
Route.h
"
6
#include "
ServiceVolume.h
"
7
#include <iostream>
8
using namespace
std
;
9
10
ServiceVolume
*
Route::entryVolume
(
double
pos,
bool
ascending, MsgStream&
msg
)
const
11
{
12
if
(
msg
.level() <= MSG::DEBUG) {
13
msg
<< MSG::DEBUG <<
"entering entryVolume with ascending = "
<< ascending
14
<<
" and pos = "
<< pos <<
endmsg
;
15
}
16
if
(
volumes
().
empty
())
return
nullptr
;
17
18
// if (volumes().front()->contains(pos)) return volumes().front();
19
// else if (volumes().back()->contains(pos)) return volumes().back();
20
// else {
21
//should iterate to find exit volume
22
if
( ascending) {
23
for
(VolumeContainer::const_iterator i=
volumes
().begin(); i!=
volumes
().end(); ++i) {
24
25
if
(
msg
.level() <= MSG::DEBUG) {
26
msg
<< MSG::DEBUG <<
"Comparing "
<< pos <<
" and "
<< (**i).position() <<
endmsg
;
27
}
28
if
(pos < (**i).position()) {
29
if
(
msg
.level() <= MSG::DEBUG) {
30
msg
<< MSG::DEBUG <<
"volume at pos "
<< (**i).radius()
31
<<
", "
<< (**i).zPos() <<
" contains exit point"
<<
endmsg
;
32
}
33
return
*i;
34
}
35
else
if
(
msg
.level() <= MSG::DEBUG) {
36
msg
<< MSG::DEBUG <<
"volume at pos "
<< (**i).radius()
37
<<
", "
<< (**i).zPos() <<
" does not contain exit point"
<<
endmsg
;
38
}
39
}
40
return
volumes
().front();
// catch-all
41
}
42
else
{
43
for
(VolumeContainer::const_reverse_iterator i=
volumes
().rbegin(); i!=
volumes
().rend(); ++i) {
44
if
((**i).contains(pos))
return
*i;
45
}
46
return
volumes
().back();
// catch-all
47
}
48
//}
49
}
50
51
ServiceVolume
*
Route::exitVolume
(
bool
ascending, MsgStream&
msg
)
const
52
{
53
if
(
msg
.level() <= MSG::DEBUG) {
54
msg
<< MSG::DEBUG <<
"entering exitVolume with ascending = "
<< ascending
55
<<
" and route.exit() = "
<<
exit
() <<
endmsg
;
56
}
57
if
(
m_exitVolume
!=
nullptr
)
return
m_exitVolume
;
58
59
// returns the volume closest to the exit point, coming from the given direction
60
if
(
volumes
().
empty
())
return
nullptr
;
61
if
( ascending) {
62
for
(VolumeContainer::const_iterator i=
volumes
().begin(); i!=
volumes
().end(); ++i) {
63
if
((**i).contains(
exit
()))
return
*i;
64
else
if
(
msg
.level() <= MSG::DEBUG) {
65
msg
<< MSG::DEBUG <<
"volume at pos "
<< (**i).radius()
66
<<
", "
<< (**i).zPos() <<
" does not contain exit point"
<<
endmsg
;
67
}
68
}
69
return
volumes
().back();
// catch-all
70
}
71
else
{
72
for
(VolumeContainer::const_reverse_iterator i=
volumes
().rbegin(); i!=
volumes
().rend(); ++i) {
73
if
((**i).contains(
exit
()))
return
*i;
74
}
75
return
volumes
().front();
// catch-all
76
}
77
}
78
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ServiceVolume.h
Route.h
empty
static const Attributes_t empty
Definition
XmlStreamer.cxx:16
Route::m_exitVolume
ServiceVolume * m_exitVolume
Definition
Route.h:57
Route::entryVolume
virtual ServiceVolume * entryVolume(double pos, bool ascending, MsgStream &msg) const
Definition
Route.cxx:10
Route::exitVolume
virtual ServiceVolume * exitVolume(bool ascending, MsgStream &msg) const
Definition
Route.cxx:51
Route::exit
virtual double exit() const =0
Route::volumes
virtual const VolumeContainer & volumes() const =0
ServiceVolume
Definition
InDetServMatGeoModel/src/ServiceVolume.h:14
std
STL namespace.
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0