ATLAS Offline Software
Loading...
Searching...
No Matches
VP1JobConfigInfo.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Implementation of class VP1JobConfigInfo //
9// //
10// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11// Initial version: March 2008 //
12// //
14
16#include "VP1Utils/VP1DetInfo.h"
19#include "VP1Base/IVP1System.h"
20#include "VP1Base/VP1Msg.h"
22
23#include "GeoModelKernel/GeoVolumeCursor.h"
25
26#include <QString>
27
28//____________________________________________________________________
30public:
31 static void ensureInit();
32 static bool actualInit(StoreGateSvc* detStore);
33 static bool initialised;
34
35 static GeoPVConstLink geoModelWorld;
37 static bool hasITkGeometry;
38 static bool hasPixelGeometry;
39 static bool hasSCTGeometry;
40 static bool hasTRTGeometry;
43 static bool hasLArGeometry;
44 static bool hasTileGeometry;
45 static bool hasMuonGeometry;
46 static bool hasMuonNSWGeometry;
47 static bool hasLUCIDGeometry;
48 static bool hasBCMGeometry;
50
51 static void turnOffAll();
52};
53
55// init default values
71
72//____________________________________________________________________
74{
76 hasITkGeometry = false;
77 hasPixelGeometry = false;
78 hasSCTGeometry = false;
79 hasTRTGeometry = false;
81 hasBeamPipeGeometry = false;
82 hasLArGeometry = false;
83 hasTileGeometry = false;
84 hasMuonGeometry = false;
85 hasLUCIDGeometry = false;
86 hasBCMGeometry = false;
88}
89
90//____________________________________________________________________
92{
93 if (initialised)
94 return;
95 if (VP1Msg::verbose())
96 VP1Msg::messageVerbose("VP1JobConfigInfo initialising");
97 initialised = true;
99 VP1Msg::message("VP1JobConfigInfo ERROR: Problems initialising. "
100 "Will assume all subsystems are off in this job!");
101 turnOffAll();
102 }
103 if (VP1Msg::verbose()) {
104 VP1Msg::messageVerbose("VP1JobConfigInfo => Found job configuration:");
105 VP1Msg::messageVerbose("VP1JobConfigInfo => hasGeoModelExperiment = "+QString(hasGeoModelExperiment?"On":"Off"));
106 VP1Msg::messageVerbose("VP1JobConfigInfo => hasITkGeometry = "+QString(hasITkGeometry?"On":"Off"));
107 VP1Msg::messageVerbose("VP1JobConfigInfo => hasPixelGeometry = "+QString(hasPixelGeometry?"On":"Off"));
108 VP1Msg::messageVerbose("VP1JobConfigInfo => hasSCTGeometry = "+QString(hasSCTGeometry?"On":"Off"));
109 VP1Msg::messageVerbose("VP1JobConfigInfo => hasTRTGeometry = "+QString(hasTRTGeometry?"On":"Off"));
110 VP1Msg::messageVerbose("VP1JobConfigInfo => hasInDetServiceMaterialGeometry = "+QString(hasInDetServiceMaterialGeometry?"On":"Off"));
111 VP1Msg::messageVerbose("VP1JobConfigInfo => hasBeamPipeGeometry = "+QString(hasBeamPipeGeometry?"On":"Off"));
112 VP1Msg::messageVerbose("VP1JobConfigInfo => hasLArGeometry = "+QString(hasLArGeometry?"On":"Off"));
113 VP1Msg::messageVerbose("VP1JobConfigInfo => hasTileGeometry = "+QString(hasTileGeometry?"On":"Off"));
114 VP1Msg::messageVerbose("VP1JobConfigInfo => hasMuonGeometry = "+QString(hasMuonGeometry?"On":"Off"));
115 VP1Msg::messageVerbose("VP1JobConfigInfo => hasMuonNSWGeometry = "+QString(hasMuonNSWGeometry?"On":"Off"));
116 VP1Msg::messageVerbose("VP1JobConfigInfo => hasLUCIDGeometry = "+QString(hasLUCIDGeometry?"On":"Off"));
117 VP1Msg::messageVerbose("VP1JobConfigInfo => hasBCMGeometry = "+QString(hasBCMGeometry?"On":"Off"));
118 VP1Msg::messageVerbose("VP1JobConfigInfo => hasCavernInfraGeometry = "+QString(hasCavernInfraGeometry?"On":"Off"));
119 }
120
121}
122
123//____________________________________________________________________
138
139//____________________________________________________________________
141{
142 if (!detStore)
143 return false;
144
145 VP1SGContentsHelper sg_contents(detStore);
146 const QString geomodelkey = "ATLAS";
147 if (!sg_contents.contains<GeoModelExperiment>(geomodelkey)) {
148 if (VP1Msg::verbose())
149 VP1Msg::messageVerbose("VP1JobConfigInfo: No GeoModelExperiment in detectorStore. Concluding all subsystems are off.");
150 turnOffAll();
151 return true;
152 }
153
154 VP1SGAccessHelper sg_access(detStore);
155
156 const GeoModelExperiment * theExpt;
157 if (!sg_access.retrieve(theExpt,geomodelkey)) {
158 if (VP1Msg::verbose())
159 VP1Msg::messageVerbose("VP1JobConfigInfo: No GeoModelExperiment in detectorStore. Concluding all subsystems are off.");
160 turnOffAll();
161 return true;
162 }
163 if (VP1Msg::verbose())
164 VP1Msg::messageVerbose("VP1JobConfigInfo: Retrieved GeoModelExperiment/"+geomodelkey);
165
166 const GeoPhysVol * worldPhysVol = theExpt->getPhysVol();
167 if (!worldPhysVol) {
168 VP1Msg::message("VP1JobConfigInfo: ERROR: GeoModelExperiment has null physical volume.");
169 turnOffAll();
170 return false;
171 }
172 if (VP1Msg::verbose())
173 VP1Msg::messageVerbose("VP1JobConfigInfo: Retrieved GeoModelExperiment physical volumes");
174
176 PVConstLink world(worldPhysVol);
177
178 GeoVolumeCursor av(world);
179
180
181 while (!av.atEnd()) {
182 std::string name = av.getName();
183
184 if ( !hasITkGeometry && name=="ITkPixel") { hasITkGeometry = true; }
185 if ( !hasITkGeometry && name=="ITkStrip") { hasITkGeometry = true; }
186 if ( !hasPixelGeometry && name=="Pixel") {
187 hasPixelGeometry = true;
188 if (not hasITkGeometry and name == "ITkPixel") {
189 VP1Msg::messageWarningAllRed("WARNING!!! --- The GeoVolume has name 'ITkPixel' but the flag 'hasITkGeometry' is false ---> CHECK IT!!");
190 }
191 if ( !hasBCMGeometry ) {
192 //Loop under the top Pixel volume to check if there are BCM volumes
193 //present in the current config:
194 GeoVolumeCursor pv(av.getVolume());
195 while (!pv.atEnd()) {
196 if (pv.getVolume()->getLogVol()->getName()=="bcmModLog") {
197 hasBCMGeometry = true;
198 break;
199 }
200 pv.next();
201 }
202 }
203 }
204 if ( !hasSCTGeometry && name=="SCT" ) {
205 hasSCTGeometry = true;
206 if (not hasITkGeometry and name == "ITkStrip") {
207 VP1Msg::messageWarningAllRed("WARNING!!! --- The GeoVolume has name 'ITkStrip' but the flag 'hasITkGeometry' is false ---> CHECK IT!!");
208 }
209 }
210 if ( !hasTRTGeometry && name=="TRT") hasTRTGeometry = true;
211 if ( !hasInDetServiceMaterialGeometry && name=="InDetServMat") hasInDetServiceMaterialGeometry = true;
212 if ( !hasBeamPipeGeometry && name=="BeamPipe") hasBeamPipeGeometry = true;
213 if ( !hasLArGeometry && name=="LArBarrel") hasLArGeometry = true;
214 if ( !hasLArGeometry && name=="LArEndcapPos") hasLArGeometry = true;
215 if ( !hasLArGeometry && name=="LArEndcapNeg") hasLArGeometry = true;
216 if ( !hasTileGeometry && name=="Tile") hasTileGeometry = true;
217 if ( !hasMuonGeometry && name=="Muon") {
218 hasMuonGeometry = true;
219 if ( !hasMuonNSWGeometry ) {
220 //Loop under the top Muon volume to check if there are NSW volumes
221 //present in the current config:
222 GeoVolumeCursor pv(av.getVolume());
223 while (!pv.atEnd()) {
224 if (pv.getVolume()->getLogVol()->getName()=="NewSmallWheel") {
225 hasMuonNSWGeometry = true;
226 break;
227 }
228 pv.next();
229 }
230 }
231 }
232 if ( !hasLUCIDGeometry && (name=="LucidSideA"||name=="LucidSideC")) hasLUCIDGeometry = true;
233 //FIXME: Look for CavernInfra as well!!!
234
235 av.next(); // increment volume cursor.
236 }
237
238 Imp::geoModelWorld = worldPhysVol;
239
240 return true;
241}
242
243//____________________________________________________________________
244const GeoPVConstLink * VP1JobConfigInfo::geoModelWorld()
245{
247 return Imp::geoModelWorld == GeoPVConstLink() ? 0 : &Imp::geoModelWorld;
248}
GeoPhysVol * getPhysVol()
Destructor.
The Athena Transient Store API.
static StoreGateSvc * detectorStore()
static bool hasInDetServiceMaterialGeometry
static bool actualInit(StoreGateSvc *detStore)
static GeoPVConstLink geoModelWorld
static bool hasTileGeometry()
static bool hasTRTGeometry()
static bool hasInDetServiceMaterialGeometry()
static bool hasMuonNSWGeometry()
static bool hasLArGeometry()
static bool hasLUCIDGeometry()
static bool hasBCMGeometry()
static bool hasGeoModelExperiment()
static bool hasPixelGeometry()
static bool hasSCTGeometry()
static bool hasCavernInfraGeometry()
static bool hasITkGeometry()
static bool hasMuonGeometry()
static bool hasBeamPipeGeometry()
static const GeoPVConstLink * geoModelWorld()
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static bool verbose()
Definition VP1Msg.h:31
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30
static void messageWarningAllRed(const QString &str, IVP1System *sys=0)
Definition VP1Msg.cxx:70
bool retrieve(const T *&, const QString &key) const
bool contains(const QString &key) const