ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_Core
ISF_Services
src
ATLFAST_EnvelopeDefSvc.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// ATLFAST_EnvelopeDefSvc.cxx, (c) ATLAS Detector software
8
9
// class header include
10
#include "
ATLFAST_EnvelopeDefSvc.h
"
11
12
// AtlasDetDescr
13
#include "
AtlasDetDescr/AtlasRegionHelper.h
"
14
15
// STL
16
#include <limits>
17
19
ISF::ATLFAST_EnvelopeDefSvc::ATLFAST_EnvelopeDefSvc
(
const
std::string& name, ISvcLocator* svc) :
20
base_class(name,svc),
21
m_isfEnvDefSvc
(
"ISF_ISFEnvelopeDefSvc"
, name),
22
m_tolerance
(1e-4),
23
m_idMaxExtentZ
(3550.),
24
m_rzBeamPipe
(),
25
m_rzInDet
(),
26
m_rposzBeamPipe
(),
27
m_rposzInDet
()
28
{
29
declareProperty(
"ISFEnvelopeDefSvc"
,
30
m_isfEnvDefSvc
,
31
"The ISF EnvelopeDefinition Service"
);
32
33
declareProperty(
"Tolerance"
,
34
m_tolerance
,
35
"Tolerance on coordinates."
);
36
37
declareProperty(
"InDetMaxExtentZ"
,
38
m_idMaxExtentZ
,
39
"The desired InnerDetector maximum extension in |z|"
);
40
}
41
42
43
ISF::ATLFAST_EnvelopeDefSvc::~ATLFAST_EnvelopeDefSvc
()
44
{
45
// free memory
46
// TODO :)
47
}
48
49
51
StatusCode
ISF::ATLFAST_EnvelopeDefSvc::initialize
()
52
{
53
ATH_MSG_INFO
(
"Initializing ..."
);
54
55
// retrieve ATLAS common envelope definition service
56
if
(
m_isfEnvDefSvc
.retrieve().isFailure() ){
57
ATH_MSG_FATAL
(
"Could not retrieve EnvelopeDefinition service ('"
<<
m_isfEnvDefSvc
.typeAndName() <<
"'). Abort."
);
58
return
StatusCode::FAILURE;
59
}
60
61
//
62
// identify highest z extent in the ID volume
63
//
64
m_rposzInDet
=
m_isfEnvDefSvc
->getRPositiveZBoundary(
AtlasDetDescr::fAtlasID
);
65
double
zMax = std::numeric_limits<double>::min();
66
{
67
// find the greatest z value of the ID volume
68
for
(
unsigned
int
curPos=0; curPos<
m_rposzInDet
.size(); curPos++ ) {
69
double
curZ =
m_rposzInDet
[curPos].second;
70
71
if
(curZ > zMax) {
72
zMax = curZ;
73
}
74
}
75
}
76
77
//
78
// shift ID/BeamPipe/Calo boundaries according to the desired new ID extent
79
//
80
m_rposzInDet
=
getShiftedBoundary
(
AtlasDetDescr::fAtlasID
, zMax,
m_idMaxExtentZ
);
81
m_rposzBeamPipe
=
getShiftedBoundary
(
AtlasDetDescr::fAtlasForward
, zMax,
m_idMaxExtentZ
);
82
m_rposzCalo
=
getShiftedBoundary
(
AtlasDetDescr::fAtlasCalo
, zMax,
m_idMaxExtentZ
);
83
84
// mirror the RZPairs provided in m_rposz to describe all corner points
85
// in (r,z) space for the BeamPipe/Forward and the InnerDetector envelopes
86
mirrorRZ(
m_rposzBeamPipe
,
m_rzBeamPipe
);
87
mirrorRZ(
m_rposzInDet
,
m_rzInDet
);
88
mirrorRZ(
m_rposzCalo
,
m_rzCalo
);
89
90
91
// debugging output: print volume definitions
92
if
(msgLvl(MSG::VERBOSE)) {
93
ATH_MSG_VERBOSE
(
"Envelope: complete region="
<<
AtlasDetDescr::fAtlasForward
);
94
for
(
unsigned
int
num = 0; num<
m_rzBeamPipe
.size(); num++) {
95
ATH_MSG_VERBOSE
(
" pos="
<< num <<
" r="
<<
m_rzBeamPipe
[num].first <<
" z="
<<
m_rzBeamPipe
[num].second);
96
}
97
ATH_MSG_VERBOSE
(
"Envelope: complete region="
<<
AtlasDetDescr::fAtlasID
);
98
for
(
unsigned
int
num = 0; num<
m_rzInDet
.size(); num++) {
99
ATH_MSG_VERBOSE
(
" pos="
<< num <<
" r="
<<
m_rzInDet
[num].first <<
" z="
<<
m_rzInDet
[num].second);
100
}
101
ATH_MSG_VERBOSE
(
"Envelope: complete region="
<<
AtlasDetDescr::fAtlasCalo
);
102
for
(
unsigned
int
num = 0; num<
m_rzCalo
.size(); num++) {
103
ATH_MSG_VERBOSE
(
" pos="
<< num <<
" r="
<<
m_rzCalo
[num].first <<
" z="
<<
m_rzCalo
[num].second);
104
}
105
}
106
107
ATH_MSG_INFO
(
"Initialize successful."
);
108
109
return
StatusCode::SUCCESS;
110
}
111
112
114
StatusCode
ISF::ATLFAST_EnvelopeDefSvc::finalize
()
115
{
116
return
StatusCode::SUCCESS;
117
}
118
119
121
const
RZPairVector
&
ISF::ATLFAST_EnvelopeDefSvc::getRZBoundary
(
AtlasDetDescr::AtlasRegion
region )
const
{
122
123
// treat Forward/BeamPipe and InnerDetector regions separately
124
if
( region ==
AtlasDetDescr::fAtlasForward
)
return
m_rzBeamPipe
;
125
else
if
( region ==
AtlasDetDescr::fAtlasID
)
return
m_rzInDet
;
126
else
if
( region ==
AtlasDetDescr::fAtlasCalo
)
return
m_rzCalo
;
127
else
return
m_isfEnvDefSvc
->getRZBoundary( region );
128
129
}
130
131
133
const
RZPairVector
&
ISF::ATLFAST_EnvelopeDefSvc::getRPositiveZBoundary
(
AtlasDetDescr::AtlasRegion
region )
const
{
134
135
// treat Forward/BeamPipe and InnerDetector regions separately
136
if
( region ==
AtlasDetDescr::fAtlasForward
)
return
m_rposzBeamPipe
;
137
else
if
( region ==
AtlasDetDescr::fAtlasID
)
return
m_rposzInDet
;
138
else
if
( region ==
AtlasDetDescr::fAtlasCalo
)
return
m_rposzCalo
;
139
else
return
m_isfEnvDefSvc
->getRPositiveZBoundary( region );
140
}
141
142
144
RZPairVector
ISF::ATLFAST_EnvelopeDefSvc::getShiftedBoundary
(
AtlasDetDescr::AtlasRegion
region,
145
double
shiftFromZ,
146
double
shiftToZ )
const
{
147
148
const
char
*volName =
AtlasDetDescr::AtlasRegionHelper::getName
(region);
149
ATH_MSG_DEBUG
(
"Will shift '"
<< volName <<
"' boundary at |z|="
<<shiftFromZ<<
" to |z|="
<<shiftToZ<<
""
);
150
151
RZPairVector
rposzPairs =
m_isfEnvDefSvc
->getRPositiveZBoundary(region);
152
153
for
(
unsigned
int
curPos=0; curPos<rposzPairs.size(); curPos++ ) {
154
double
curR = rposzPairs[curPos].first;
155
double
curZ = rposzPairs[curPos].second;
156
157
// is current boundary point to be shifted?
158
if
( fabs(curZ-shiftFromZ) <
m_tolerance
) {
159
160
ATH_MSG_VERBOSE
(
"Found boundary point in '"
<< volName <<
"' volume."
<<
161
" Shifting (r,|z|)=("
<<curR<<
","
<<curZ<<
") to (r,|z|)=("
<<curR<<
","
<<shiftToZ<<
")"
);
162
163
rposzPairs[curPos].second = shiftToZ;
164
}
165
}
166
167
return
rposzPairs;
168
}
ATLFAST_EnvelopeDefSvc.h
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
AtlasRegionHelper.h
RZPairVector
std::vector< RZPair > RZPairVector
Definition
RZPair.h:18
AtlasDetDescr::AtlasRegionHelper::getName
static const char * getName(int region)
Definition
AtlasRegionHelper.cxx:13
ISF::ATLFAST_EnvelopeDefSvc::m_rzBeamPipe
RZPairVector m_rzBeamPipe
internal (r,z) representation for BeamPipe, InnerDetector and calo volumes
Definition
ATLFAST_EnvelopeDefSvc.h:58
ISF::ATLFAST_EnvelopeDefSvc::getRZBoundary
const RZPairVector & getRZBoundary(AtlasDetDescr::AtlasRegion region) const
return a vector of (r,z) pairs, defining the respective envelope
Definition
ATLFAST_EnvelopeDefSvc.cxx:121
ISF::ATLFAST_EnvelopeDefSvc::m_rposzInDet
RZPairVector m_rposzInDet
Definition
ATLFAST_EnvelopeDefSvc.h:64
ISF::ATLFAST_EnvelopeDefSvc::finalize
StatusCode finalize()
AthService finalize method.
Definition
ATLFAST_EnvelopeDefSvc.cxx:114
ISF::ATLFAST_EnvelopeDefSvc::m_isfEnvDefSvc
ServiceHandle< IEnvelopeDefSvc > m_isfEnvDefSvc
ServiceHandle to the standard ISF envelope definition service.
Definition
ATLFAST_EnvelopeDefSvc.h:49
ISF::ATLFAST_EnvelopeDefSvc::m_rposzCalo
RZPairVector m_rposzCalo
Definition
ATLFAST_EnvelopeDefSvc.h:65
ISF::ATLFAST_EnvelopeDefSvc::m_rzInDet
RZPairVector m_rzInDet
Definition
ATLFAST_EnvelopeDefSvc.h:59
ISF::ATLFAST_EnvelopeDefSvc::~ATLFAST_EnvelopeDefSvc
~ATLFAST_EnvelopeDefSvc()
Destructor.
Definition
ATLFAST_EnvelopeDefSvc.cxx:43
ISF::ATLFAST_EnvelopeDefSvc::initialize
StatusCode initialize()
AthService initialize method.
Definition
ATLFAST_EnvelopeDefSvc.cxx:51
ISF::ATLFAST_EnvelopeDefSvc::ATLFAST_EnvelopeDefSvc
ATLFAST_EnvelopeDefSvc(const std::string &name, ISvcLocator *svc)
public AthService constructor
Definition
ATLFAST_EnvelopeDefSvc.cxx:19
ISF::ATLFAST_EnvelopeDefSvc::getRPositiveZBoundary
const RZPairVector & getRPositiveZBoundary(AtlasDetDescr::AtlasRegion region) const
return a vector of (r,z) pairs, defining the envelope on the z>0 region
Definition
ATLFAST_EnvelopeDefSvc.cxx:133
ISF::ATLFAST_EnvelopeDefSvc::getShiftedBoundary
RZPairVector getShiftedBoundary(AtlasDetDescr::AtlasRegion region, double shiftFromZ, double shiftToZ) const
return boundary with shifted z values
Definition
ATLFAST_EnvelopeDefSvc.cxx:144
ISF::ATLFAST_EnvelopeDefSvc::m_tolerance
double m_tolerance
internal tolerance on coordinates
Definition
ATLFAST_EnvelopeDefSvc.h:52
ISF::ATLFAST_EnvelopeDefSvc::m_rposzBeamPipe
RZPairVector m_rposzBeamPipe
internal (r,z) representation for the positive z-side only, one RZPairVector for BeamPipe and InnerDe...
Definition
ATLFAST_EnvelopeDefSvc.h:63
ISF::ATLFAST_EnvelopeDefSvc::m_idMaxExtentZ
double m_idMaxExtentZ
maximum desired extent (halfz) of the modified inner detector volume
Definition
ATLFAST_EnvelopeDefSvc.h:55
ISF::ATLFAST_EnvelopeDefSvc::m_rzCalo
RZPairVector m_rzCalo
Definition
ATLFAST_EnvelopeDefSvc.h:60
AtlasDetDescr::AtlasRegion
AtlasRegion
A simple enum of ATLAS regions and sub-detectors.
Definition
AtlasRegion.h:21
AtlasDetDescr::fAtlasCalo
@ fAtlasCalo
Definition
AtlasRegion.h:29
AtlasDetDescr::fAtlasID
@ fAtlasID
Definition
AtlasRegion.h:27
AtlasDetDescr::fAtlasForward
@ fAtlasForward
Definition
AtlasRegion.h:28
Generated on
for ATLAS Offline Software by
1.17.0