ATLAS Offline Software
VP1JobConfigInfo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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"
21 #include "VP1Base/VP1AthenaPtrs.h"
22 
23 #include "GeoModelKernel/GeoVolumeCursor.h"
25 #include "StoreGate/DataHandle.h"
26 
27 #include <QString>
28 
29 //____________________________________________________________________
31 public:
32  static void ensureInit();
33  static bool actualInit(StoreGateSvc* detStore);
34  static bool initialised;
35 
36  static GeoPVConstLink geoModelWorld;
37  static bool hasGeoModelExperiment;
38  static bool hasITkGeometry;
39  static bool hasPixelGeometry;
40  static bool hasSCTGeometry;
41  static bool hasTRTGeometry;
43  static bool hasBeamPipeGeometry;
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
72 
73 //____________________________________________________________________
75 {
76  hasGeoModelExperiment = false;
77  hasITkGeometry = false;
78  hasPixelGeometry = false;
79  hasSCTGeometry = false;
80  hasTRTGeometry = false;
82  hasBeamPipeGeometry = false;
83  hasLArGeometry = false;
84  hasTileGeometry = false;
85  hasMuonGeometry = false;
86  hasLUCIDGeometry = false;
87  hasBCMGeometry = false;
88  hasCavernInfraGeometry = false;
89 }
90 
91 //____________________________________________________________________
93 {
94  if (initialised)
95  return;
96  if (VP1Msg::verbose())
97  VP1Msg::messageVerbose("VP1JobConfigInfo initialising");
98  initialised = true;
99  if (!actualInit(VP1AthenaPtrs::detectorStore())) {
100  VP1Msg::message("VP1JobConfigInfo ERROR: Problems initialising. "
101  "Will assume all subsystems are off in this job!");
102  turnOffAll();
103  }
104  if (VP1Msg::verbose()) {
105  VP1Msg::messageVerbose("VP1JobConfigInfo => Found job configuration:");
106  VP1Msg::messageVerbose("VP1JobConfigInfo => hasGeoModelExperiment = "+QString(hasGeoModelExperiment?"On":"Off"));
107  VP1Msg::messageVerbose("VP1JobConfigInfo => hasITkGeometry = "+QString(hasITkGeometry?"On":"Off"));
108  VP1Msg::messageVerbose("VP1JobConfigInfo => hasPixelGeometry = "+QString(hasPixelGeometry?"On":"Off"));
109  VP1Msg::messageVerbose("VP1JobConfigInfo => hasSCTGeometry = "+QString(hasSCTGeometry?"On":"Off"));
110  VP1Msg::messageVerbose("VP1JobConfigInfo => hasTRTGeometry = "+QString(hasTRTGeometry?"On":"Off"));
111  VP1Msg::messageVerbose("VP1JobConfigInfo => hasInDetServiceMaterialGeometry = "+QString(hasInDetServiceMaterialGeometry?"On":"Off"));
112  VP1Msg::messageVerbose("VP1JobConfigInfo => hasBeamPipeGeometry = "+QString(hasBeamPipeGeometry?"On":"Off"));
113  VP1Msg::messageVerbose("VP1JobConfigInfo => hasLArGeometry = "+QString(hasLArGeometry?"On":"Off"));
114  VP1Msg::messageVerbose("VP1JobConfigInfo => hasTileGeometry = "+QString(hasTileGeometry?"On":"Off"));
115  VP1Msg::messageVerbose("VP1JobConfigInfo => hasMuonGeometry = "+QString(hasMuonGeometry?"On":"Off"));
116  VP1Msg::messageVerbose("VP1JobConfigInfo => hasMuonNSWGeometry = "+QString(hasMuonNSWGeometry?"On":"Off"));
117  VP1Msg::messageVerbose("VP1JobConfigInfo => hasLUCIDGeometry = "+QString(hasLUCIDGeometry?"On":"Off"));
118  VP1Msg::messageVerbose("VP1JobConfigInfo => hasBCMGeometry = "+QString(hasBCMGeometry?"On":"Off"));
119  VP1Msg::messageVerbose("VP1JobConfigInfo => hasCavernInfraGeometry = "+QString(hasCavernInfraGeometry?"On":"Off"));
120  }
121 
122 }
123 
124 //____________________________________________________________________
139 
140 //____________________________________________________________________
142 {
143  if (!detStore)
144  return false;
145 
146  VP1SGContentsHelper sg_contents(detStore);
147  const QString geomodelkey = "ATLAS";
148  if (!sg_contents.contains<GeoModelExperiment>(geomodelkey)) {
149  if (VP1Msg::verbose())
150  VP1Msg::messageVerbose("VP1JobConfigInfo: No GeoModelExperiment in detectorStore. Concluding all subsystems are off.");
151  turnOffAll();
152  return true;
153  }
154 
155  VP1SGAccessHelper sg_access(detStore);
156 
157  const GeoModelExperiment * theExpt;
158  if (!sg_access.retrieve(theExpt,geomodelkey)) {
159  if (VP1Msg::verbose())
160  VP1Msg::messageVerbose("VP1JobConfigInfo: No GeoModelExperiment in detectorStore. Concluding all subsystems are off.");
161  turnOffAll();
162  return true;
163  }
164  if (VP1Msg::verbose())
165  VP1Msg::messageVerbose("VP1JobConfigInfo: Retrieved GeoModelExperiment/"+geomodelkey);
166 
167  const GeoPhysVol * worldPhysVol = theExpt->getPhysVol();
168  if (!worldPhysVol) {
169  VP1Msg::message("VP1JobConfigInfo: ERROR: GeoModelExperiment has null physical volume.");
170  turnOffAll();
171  return false;
172  }
173  if (VP1Msg::verbose())
174  VP1Msg::messageVerbose("VP1JobConfigInfo: Retrieved GeoModelExperiment physical volumes");
175 
176  hasGeoModelExperiment = true;
177  PVConstLink world(worldPhysVol);
178 
179  GeoVolumeCursor av(world);
180 
181 
182  while (!av.atEnd()) {
183  std::string name = av.getName();
184  if ( !hasPixelGeometry && (name=="Pixel" or name=="ITkPixel")) {
185  hasPixelGeometry = true;
186  if (not hasITkGeometry and name == "ITkPixel")
187  hasITkGeometry = true;
188  if ( !hasBCMGeometry ) {
189  //Loop under the top Pixel volume to check if there are BCM volumes
190  //present in the current config:
191  GeoVolumeCursor pv(av.getVolume());
192  while (!pv.atEnd()) {
193  if (pv.getVolume()->getLogVol()->getName()=="bcmModLog") {
194  hasBCMGeometry = true;
195  break;
196  }
197  pv.next();
198  }
199  }
200  }
201  if ( !hasSCTGeometry && (name=="SCT" or name=="ITkStrip")) {
202  hasSCTGeometry = true;
203  if (not hasITkGeometry and name == "ITkStrip")
204  hasITkGeometry = true;
205  }
206  if ( !hasTRTGeometry && name=="TRT") hasTRTGeometry = true;
208  if ( !hasBeamPipeGeometry && name=="BeamPipe") hasBeamPipeGeometry = true;
209  if ( !hasLArGeometry && name=="LArBarrel") hasLArGeometry = true;
210  if ( !hasLArGeometry && name=="LArEndcapPos") hasLArGeometry = true;
211  if ( !hasLArGeometry && name=="LArEndcapNeg") hasLArGeometry = true;
212  if ( !hasTileGeometry && name=="Tile") hasTileGeometry = true;
213  if ( !hasMuonGeometry && name=="Muon") {
214  hasMuonGeometry = true;
215  if ( !hasMuonNSWGeometry ) {
216  //Loop under the top Muon volume to check if there are NSW volumes
217  //present in the current config:
218  GeoVolumeCursor pv(av.getVolume());
219  while (!pv.atEnd()) {
220  if (pv.getVolume()->getLogVol()->getName()=="NewSmallWheel") {
221  hasMuonNSWGeometry = true;
222  break;
223  }
224  pv.next();
225  }
226  }
227  }
228  if ( !hasLUCIDGeometry && (name=="LucidSideA"||name=="LucidSideC")) hasLUCIDGeometry = true;
229  //FIXME: Look for CavernInfra as well!!!
230 
231  av.next(); // increment volume cursor.
232  }
233 
234  Imp::geoModelWorld = worldPhysVol;
235 
236  return true;
237 }
238 
239 //____________________________________________________________________
240 const GeoPVConstLink * VP1JobConfigInfo::geoModelWorld()
241 {
242  Imp::ensureInit();
243  return Imp::geoModelWorld == GeoPVConstLink() ? 0 : &Imp::geoModelWorld;
244 }
VP1JobConfigInfo::Imp::initialised
static bool initialised
Definition: VP1JobConfigInfo.cxx:34
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition: GeoModelExperiment.cxx:21
VP1JobConfigInfo::Imp::hasBeamPipeGeometry
static bool hasBeamPipeGeometry
Definition: VP1JobConfigInfo.cxx:43
VP1JobConfigInfo::Imp::hasSCTGeometry
static bool hasSCTGeometry
Definition: VP1JobConfigInfo.cxx:40
VP1Msg.h
VP1JobConfigInfo::hasTileGeometry
static bool hasTileGeometry()
Definition: VP1JobConfigInfo.cxx:133
VP1JobConfigInfo::Imp::hasLArGeometry
static bool hasLArGeometry
Definition: VP1JobConfigInfo.cxx:44
VP1JobConfigInfo::hasLArGeometry
static bool hasLArGeometry()
Definition: VP1JobConfigInfo.cxx:132
VP1JobConfigInfo::Imp::hasCavernInfraGeometry
static bool hasCavernInfraGeometry
Definition: VP1JobConfigInfo.cxx:50
GeoModelExperiment
Definition: GeoModelExperiment.h:32
VP1JobConfigInfo::Imp::hasInDetServiceMaterialGeometry
static bool hasInDetServiceMaterialGeometry
Definition: VP1JobConfigInfo.cxx:42
VP1JobConfigInfo::Imp
Definition: VP1JobConfigInfo.cxx:30
VP1JobConfigInfo::Imp::hasMuonGeometry
static bool hasMuonGeometry
Definition: VP1JobConfigInfo.cxx:46
DataHandle.h
VP1AthenaPtrs.h
VP1JobConfigInfo::hasCavernInfraGeometry
static bool hasCavernInfraGeometry()
Definition: VP1JobConfigInfo.cxx:138
VP1JobConfigInfo::Imp::turnOffAll
static void turnOffAll()
Definition: VP1JobConfigInfo.cxx:74
VP1DetInfo.h
GeoModelExperiment.h
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
VP1JobConfigInfo::Imp::hasITkGeometry
static bool hasITkGeometry
Definition: VP1JobConfigInfo.cxx:38
VP1JobConfigInfo::geoModelWorld
static const GeoPVConstLink * geoModelWorld()
Definition: VP1JobConfigInfo.cxx:240
VP1JobConfigInfo::Imp::actualInit
static bool actualInit(StoreGateSvc *detStore)
Definition: VP1JobConfigInfo.cxx:141
VP1JobConfigInfo::hasLUCIDGeometry
static bool hasLUCIDGeometry()
Definition: VP1JobConfigInfo.cxx:136
VP1JobConfigInfo::Imp::hasGeoModelExperiment
static bool hasGeoModelExperiment
Definition: VP1JobConfigInfo.cxx:37
VP1JobConfigInfo::hasSCTGeometry
static bool hasSCTGeometry()
Definition: VP1JobConfigInfo.cxx:128
VP1JobConfigInfo::hasTRTGeometry
static bool hasTRTGeometry()
Definition: VP1JobConfigInfo.cxx:129
VP1JobConfigInfo::Imp::hasBCMGeometry
static bool hasBCMGeometry
Definition: VP1JobConfigInfo.cxx:49
VP1SGAccessHelper::retrieve
bool retrieve(const T *&, const QString &key) const
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
VP1JobConfigInfo::hasInDetServiceMaterialGeometry
static bool hasInDetServiceMaterialGeometry()
Definition: VP1JobConfigInfo.cxx:130
VP1JobConfigInfo::Imp::hasLUCIDGeometry
static bool hasLUCIDGeometry
Definition: VP1JobConfigInfo.cxx:48
VP1JobConfigInfo::hasBeamPipeGeometry
static bool hasBeamPipeGeometry()
Definition: VP1JobConfigInfo.cxx:131
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
VP1SGContentsHelper
Definition: VP1SGContentsHelper.h:26
VP1SGContentsHelper::contains
bool contains(const QString &key) const
Definition: VP1SGContentsHelper.h:61
VP1JobConfigInfo::Imp::hasPixelGeometry
static bool hasPixelGeometry
Definition: VP1JobConfigInfo.cxx:39
VP1JobConfigInfo::hasBCMGeometry
static bool hasBCMGeometry()
Definition: VP1JobConfigInfo.cxx:137
VP1Msg::message
static void message(const QString &, IVP1System *sys=0)
Definition: VP1Msg.cxx:30
VP1JobConfigInfo::Imp::ensureInit
static void ensureInit()
Definition: VP1JobConfigInfo.cxx:92
VP1JobConfigInfo::Imp::geoModelWorld
static GeoPVConstLink geoModelWorld
Definition: VP1JobConfigInfo.cxx:36
python.changerun.pv
pv
Definition: changerun.py:81
VP1JobConfigInfo::Imp::hasMuonNSWGeometry
static bool hasMuonNSWGeometry
Definition: VP1JobConfigInfo.cxx:47
VP1JobConfigInfo::hasITkGeometry
static bool hasITkGeometry()
Definition: VP1JobConfigInfo.cxx:126
VP1JobConfigInfo.h
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
VP1SGAccessHelper
Definition: VP1SGAccessHelper.h:25
VP1JobConfigInfo::hasMuonNSWGeometry
static bool hasMuonNSWGeometry()
Definition: VP1JobConfigInfo.cxx:135
VP1JobConfigInfo::hasPixelGeometry
static bool hasPixelGeometry()
Definition: VP1JobConfigInfo.cxx:127
VP1AthenaPtrs::detectorStore
static StoreGateSvc * detectorStore()
Definition: VP1AthenaPtrs.h:28
VP1JobConfigInfo::hasMuonGeometry
static bool hasMuonGeometry()
Definition: VP1JobConfigInfo.cxx:134
VP1SGAccessHelper.h
IVP1System.h
VP1JobConfigInfo::hasGeoModelExperiment
static bool hasGeoModelExperiment()
Definition: VP1JobConfigInfo.cxx:125
VP1SGContentsHelper.h
VP1JobConfigInfo::Imp::hasTRTGeometry
static bool hasTRTGeometry
Definition: VP1JobConfigInfo.cxx:41
VP1JobConfigInfo::Imp::hasTileGeometry
static bool hasTileGeometry
Definition: VP1JobConfigInfo.cxx:45