ATLAS Offline Software
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
14 
15 // STL
16 #include <limits>
17 
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",
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  //
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 
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 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
AtlasDetDescr::fAtlasForward
@ fAtlasForward
Definition: AtlasRegion.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ATLFAST_EnvelopeDefSvc.h
RZPairVector
std::vector< RZPair > RZPairVector
Definition: RZPair.h:18
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
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
AtlasDetDescr::AtlasRegion
AtlasRegion
Definition: AtlasRegion.h:27
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ISF::ATLFAST_EnvelopeDefSvc::initialize
StatusCode initialize()
AthService initialize method.
Definition: ATLFAST_EnvelopeDefSvc.cxx:51
AtlasDetDescr::AtlasRegionHelper::getName
static const char * getName(int region)
Definition: AtlasRegionHelper.cxx:13
ISF::ATLFAST_EnvelopeDefSvc::finalize
StatusCode finalize()
AthService finalize method.
Definition: ATLFAST_EnvelopeDefSvc.cxx:114
ISF::ATLFAST_EnvelopeDefSvc::m_tolerance
double m_tolerance
internal tolerance on coordinates
Definition: ATLFAST_EnvelopeDefSvc.h:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
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::~ATLFAST_EnvelopeDefSvc
~ATLFAST_EnvelopeDefSvc()
Destructor.
Definition: ATLFAST_EnvelopeDefSvc.cxx:43
AtlasRegionHelper.h
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
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AtlasDetDescr::fAtlasID
@ fAtlasID
Definition: AtlasRegion.h:33
ISF::ATLFAST_EnvelopeDefSvc::ATLFAST_EnvelopeDefSvc
ATLFAST_EnvelopeDefSvc(const std::string &name, ISvcLocator *svc)
public AthService constructor
Definition: ATLFAST_EnvelopeDefSvc.cxx:19
ISF::ATLFAST_EnvelopeDefSvc::m_isfEnvDefSvc
ServiceHandle< IEnvelopeDefSvc > m_isfEnvDefSvc
ServiceHandle to the standard ISF envelope definition service.
Definition: ATLFAST_EnvelopeDefSvc.h:49
AtlasDetDescr::fAtlasCalo
@ fAtlasCalo
Definition: AtlasRegion.h:35
DeMoScan.first
bool first
Definition: DeMoScan.py:536
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
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14