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;
41 static bool hasHGTDGeometry;
44 static bool hasLArGeometry;
45 static bool hasTileGeometry;
46 static bool hasMuonGeometry;
47 static bool hasMuonNSWGeometry;
48 static bool hasLUCIDGeometry;
49 static bool hasBCMGeometry;
51
52 static void turnOffAll();
53};
54
56// init default values
73
74//____________________________________________________________________
76{
78 hasITkGeometry = false;
79 hasHGTDGeometry = false;
80 hasPixelGeometry = false;
81 hasSCTGeometry = false;
82 hasTRTGeometry = false;
84 hasBeamPipeGeometry = false;
85 hasLArGeometry = false;
86 hasTileGeometry = false;
87 hasMuonGeometry = false;
88 hasLUCIDGeometry = false;
89 hasBCMGeometry = false;
91}
92
93//____________________________________________________________________
95{
96 if (initialised)
97 return;
98 if (VP1Msg::verbose())
99 VP1Msg::messageVerbose("VP1JobConfigInfo initialising");
100 initialised = true;
102 VP1Msg::message("VP1JobConfigInfo ERROR: Problems initialising. "
103 "Will assume all subsystems are off in this job!");
104 turnOffAll();
105 }
106 if (VP1Msg::verbose()) {
107 VP1Msg::messageVerbose("VP1JobConfigInfo => Found job configuration:");
108 VP1Msg::messageVerbose("VP1JobConfigInfo => hasGeoModelExperiment = "+QString(hasGeoModelExperiment?"On":"Off"));
109 VP1Msg::messageVerbose("VP1JobConfigInfo => hasITkGeometry = "+QString(hasITkGeometry?"On":"Off"));
110 VP1Msg::messageVerbose("VP1JobConfigInfo => hasHGTDGeometry = "+QString(hasHGTDGeometry?"On":"Off"));
111 VP1Msg::messageVerbose("VP1JobConfigInfo => hasPixelGeometry = "+QString(hasPixelGeometry?"On":"Off"));
112 VP1Msg::messageVerbose("VP1JobConfigInfo => hasSCTGeometry = "+QString(hasSCTGeometry?"On":"Off"));
113 VP1Msg::messageVerbose("VP1JobConfigInfo => hasTRTGeometry = "+QString(hasTRTGeometry?"On":"Off"));
114 VP1Msg::messageVerbose("VP1JobConfigInfo => hasInDetServiceMaterialGeometry = "+QString(hasInDetServiceMaterialGeometry?"On":"Off"));
115 VP1Msg::messageVerbose("VP1JobConfigInfo => hasBeamPipeGeometry = "+QString(hasBeamPipeGeometry?"On":"Off"));
116 VP1Msg::messageVerbose("VP1JobConfigInfo => hasLArGeometry = "+QString(hasLArGeometry?"On":"Off"));
117 VP1Msg::messageVerbose("VP1JobConfigInfo => hasTileGeometry = "+QString(hasTileGeometry?"On":"Off"));
118 VP1Msg::messageVerbose("VP1JobConfigInfo => hasMuonGeometry = "+QString(hasMuonGeometry?"On":"Off"));
119 VP1Msg::messageVerbose("VP1JobConfigInfo => hasMuonNSWGeometry = "+QString(hasMuonNSWGeometry?"On":"Off"));
120 VP1Msg::messageVerbose("VP1JobConfigInfo => hasLUCIDGeometry = "+QString(hasLUCIDGeometry?"On":"Off"));
121 VP1Msg::messageVerbose("VP1JobConfigInfo => hasBCMGeometry = "+QString(hasBCMGeometry?"On":"Off"));
122 VP1Msg::messageVerbose("VP1JobConfigInfo => hasCavernInfraGeometry = "+QString(hasCavernInfraGeometry?"On":"Off"));
123 }
124
125}
126
127//____________________________________________________________________
143
144//____________________________________________________________________
146{
147 if (!detStore)
148 return false;
149
150 VP1SGContentsHelper sg_contents(detStore);
151 const QString geomodelkey = "ATLAS";
152 if (!sg_contents.contains<GeoModelExperiment>(geomodelkey)) {
153 if (VP1Msg::verbose())
154 VP1Msg::messageVerbose("VP1JobConfigInfo: No GeoModelExperiment in detectorStore. Concluding all subsystems are off.");
155 turnOffAll();
156 return true;
157 }
158
159 VP1SGAccessHelper sg_access(detStore);
160
161 const GeoModelExperiment * theExpt;
162 if (!sg_access.retrieve(theExpt,geomodelkey)) {
163 if (VP1Msg::verbose())
164 VP1Msg::messageVerbose("VP1JobConfigInfo: No GeoModelExperiment in detectorStore. Concluding all subsystems are off.");
165 turnOffAll();
166 return true;
167 }
168 if (VP1Msg::verbose())
169 VP1Msg::messageVerbose("VP1JobConfigInfo: Retrieved GeoModelExperiment/"+geomodelkey);
170
171 const GeoPhysVol * worldPhysVol = theExpt->getPhysVol();
172 if (!worldPhysVol) {
173 VP1Msg::message("VP1JobConfigInfo: ERROR: GeoModelExperiment has null physical volume.");
174 turnOffAll();
175 return false;
176 }
177 if (VP1Msg::verbose())
178 VP1Msg::messageVerbose("VP1JobConfigInfo: Retrieved GeoModelExperiment physical volumes");
179
181 PVConstLink world(worldPhysVol);
182
183 GeoVolumeCursor av(world);
184
185
186 while (!av.atEnd()) {
187 std::string name = av.getName();
188
189 if ( !hasITkGeometry && name=="ITkPixel") { hasITkGeometry = true; }
190 if ( !hasITkGeometry && name=="ITkStrip") { hasITkGeometry = true; }
191 if ( !hasHGTDGeometry && name=="HGTD") { hasHGTDGeometry = true; }
192 if ( !hasPixelGeometry && name=="Pixel") {
193 hasPixelGeometry = true;
194 if (not hasITkGeometry and name == "ITkPixel") {
195 VP1Msg::messageWarningAllRed("WARNING!!! --- The GeoVolume has name 'ITkPixel' but the flag 'hasITkGeometry' is false ---> CHECK IT!!");
196 }
197 if ( !hasBCMGeometry ) {
198 //Loop under the top Pixel volume to check if there are BCM volumes
199 //present in the current config:
200 GeoVolumeCursor pv(av.getVolume());
201 while (!pv.atEnd()) {
202 if (pv.getVolume()->getLogVol()->getName()=="bcmModLog") {
203 hasBCMGeometry = true;
204 break;
205 }
206 pv.next();
207 }
208 }
209 }
210 if ( !hasSCTGeometry && name=="SCT" ) {
211 hasSCTGeometry = true;
212 if (not hasITkGeometry and name == "ITkStrip") {
213 VP1Msg::messageWarningAllRed("WARNING!!! --- The GeoVolume has name 'ITkStrip' but the flag 'hasITkGeometry' is false ---> CHECK IT!!");
214 }
215 }
216 if ( !hasTRTGeometry && name=="TRT") hasTRTGeometry = true;
217 if ( !hasInDetServiceMaterialGeometry && name=="InDetServMat") hasInDetServiceMaterialGeometry = true;
218 if ( !hasBeamPipeGeometry && name=="BeamPipe") hasBeamPipeGeometry = true;
219 if ( !hasLArGeometry && name=="LArBarrel") hasLArGeometry = true;
220 if ( !hasLArGeometry && name=="LArEndcapPos") hasLArGeometry = true;
221 if ( !hasLArGeometry && name=="LArEndcapNeg") hasLArGeometry = true;
222 if ( !hasTileGeometry && name=="Tile") hasTileGeometry = true;
223 if ( !hasMuonGeometry && name=="Muon") {
224 hasMuonGeometry = true;
225 if ( !hasMuonNSWGeometry ) {
226 //Loop under the top Muon volume to check if there are NSW volumes
227 //present in the current config:
228 GeoVolumeCursor pv(av.getVolume());
229 while (!pv.atEnd()) {
230 if (pv.getVolume()->getLogVol()->getName()=="NewSmallWheel") {
231 hasMuonNSWGeometry = true;
232 break;
233 }
234 pv.next();
235 }
236 }
237 }
238 if ( !hasLUCIDGeometry && (name=="LucidSideA"||name=="LucidSideC")) hasLUCIDGeometry = true;
239 //FIXME: Look for CavernInfra as well!!!
240
241 av.next(); // increment volume cursor.
242 }
243
244 Imp::geoModelWorld = worldPhysVol;
245
246 return true;
247}
248
249//____________________________________________________________________
250const GeoPVConstLink * VP1JobConfigInfo::geoModelWorld()
251{
253 return Imp::geoModelWorld == GeoPVConstLink() ? 0 : &Imp::geoModelWorld;
254}
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 hasHGTDGeometry()
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