ATLAS Offline Software
Loading...
Searching...
No Matches
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
11
12// AtlasDetDescr
14
15// STL
16#include <limits>
17
19ISF::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.),
25 m_rzInDet(),
28{
29 declareProperty( "ISFEnvelopeDefSvc",
31 "The ISF EnvelopeDefinition Service");
32
33 declareProperty( "Tolerance",
35 "Tolerance on coordinates.");
36
37 declareProperty( "InDetMaxExtentZ",
39 "The desired InnerDetector maximum extension in |z|");
40}
41
42
44{
45 // free memory
46 // TODO :)
47}
48
49
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 //
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
115{
116 return StatusCode::SUCCESS;
117}
118
119
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
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
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}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
std::vector< RZPair > RZPairVector
Definition RZPair.h:18
static const char * getName(int region)
RZPairVector m_rzBeamPipe
internal (r,z) representation for BeamPipe, InnerDetector and calo volumes
const RZPairVector & getRZBoundary(AtlasDetDescr::AtlasRegion region) const
return a vector of (r,z) pairs, defining the respective envelope
StatusCode finalize()
AthService finalize method.
ServiceHandle< IEnvelopeDefSvc > m_isfEnvDefSvc
ServiceHandle to the standard ISF envelope definition service.
StatusCode initialize()
AthService initialize method.
ATLFAST_EnvelopeDefSvc(const std::string &name, ISvcLocator *svc)
public AthService constructor
const RZPairVector & getRPositiveZBoundary(AtlasDetDescr::AtlasRegion region) const
return a vector of (r,z) pairs, defining the envelope on the z>0 region
RZPairVector getShiftedBoundary(AtlasDetDescr::AtlasRegion region, double shiftFromZ, double shiftToZ) const
return boundary with shifted z values
double m_tolerance
internal tolerance on coordinates
RZPairVector m_rposzBeamPipe
internal (r,z) representation for the positive z-side only, one RZPairVector for BeamPipe and InnerDe...
double m_idMaxExtentZ
maximum desired extent (halfz) of the modified inner detector volume
AtlasRegion
A simple enum of ATLAS regions and sub-detectors.
Definition AtlasRegion.h:21