83 {
85
86 ATH_MSG_INFO(
"===================================================");
88 ATH_MSG_INFO(
"===================================================");
89
91 const GeoModelExperiment* theExpt = nullptr;
93
94
96
99
100 ServiceHandle<IGeoDbTagSvc> geoDbTag(
"GeoDbTagSvc",
name());
103 "This is the Geometry TAG we are dumping: " << geoDbTag->atlasVersion());
104
106
107
108
109
110
112 std::set<std::string> managersList{};
113 {
115 managersList.insert(blub.begin(), blub.end());
116 }
118 ATH_MSG_INFO(
"List of the GeoModel Detector Managers that are being dumped: ");
119 for (auto const& man : managersList) {
120
122 unsigned int nTreetops =
manager->getNumTreeTops();
123 std::cout << "\t" << man << " [contains " << nTreetops << " treetops]"
124 << std::endl;
125 for (
unsigned int i = 0;
i < nTreetops; ++
i) {
126 PVConstLink treetop(
manager->getTreeTop(i));
127
128 const GeoVPhysVol* vol = treetop;
129
130 std::string volName = vol->getLogVol()->getName();
131 std::cout << "\t\t treetop: " << volName << std::endl;
132 }
133 }
134 }
135
137
138 std::set<std::string> user_managersList{};
139 {
142 }
143
144
145
146 for (auto& userDet : user_managersList) {
147 if (!managersList.count(userDet)) {
149 "This Detector Manager you requested to dump is not in the list of "
150 "DetectorManagers for the geometry tag you are using: "
151 << userDet);
152 throw GaudiException(
153 "The Detector Manager you requested to dump is not in the list of "
154 "DetectorManagers.",
155 "DumpGeo", StatusCode::FAILURE);
156 }
157 }
158
159 if (!(managersList.empty())) {
160 for (auto const& mm : managersList) {
161
163
164
165 std::string detManName =
manager->getName();
167
168
169 unsigned int nTreetops =
manager->getNumTreeTops();
170 ATH_MSG_INFO(
"\t" << mm <<
" - # TreeTops: " << nTreetops);
171
172 if ((nTreetops > 0) && user_managersList.count(detManName)) {
173
174 for (
unsigned int i = 0;
i < nTreetops; ++
i) {
175
176 PVConstLink treetop(
manager->getTreeTop(i));
177
178
179 const GeoVPhysVol* vol = treetop;
180
181
182
183 GeoTransform* volXf = new GeoTransform(vol->getDefX());
184
185
186 std::string volName = vol->getLogVol()->getName();
188
189
190
191 volTop->add(new GeoNameTag(detManName));
192
193 volTop->add(volXf);
194 volTop->add(const_cast<GeoVPhysVol*>(vol));
195
197 ATH_MSG_INFO(
"You enabled the option 'showTreetopContent', so we now print the content of the first layers of child volumes of the Treetops...");
198 unsigned v1{0};
199 GeoVolumeCursor av(treetop);
200 while (!av.atEnd()) {
201 ++v1;
202 if(1==v1)
ATH_MSG_INFO(
"first level of child volumes:");
204 ATH_MSG_INFO(
"\t\t- child's n. sub-nodes: " << av.getVolume()->getNChildNodes());
205 ATH_MSG_INFO(
"\t\t- child's n. sub-volumes: " << av.getVolume()->getNChildVols());
206
207
209 GeoVolumeCursor av2(av.getVolume());
210 while (!av2.atEnd()) {
212 if(1==v2)
ATH_MSG_INFO(
"second level of child volumes:");
213 ATH_MSG_INFO(
"\t\t\t- child's logvol's name: " << av2.getVolume()->getLogVol()->getName());
214
215 unsigned v3{0};
216 GeoVolumeCursor av3(av2.getVolume());
217 while (!av3.atEnd()) {
218 ++v3;
219 if(1==v3)
ATH_MSG_INFO(
"third level of child volumes:");
220 ATH_MSG_INFO(
"\t\t\t\t- child's logvol's name: " << av3.getVolume()->getLogVol()->getName());
221 av3.next();
222 }
223
224 av2.next();
225 }
226
227 av.next();
228 }
229 }
230 }
231 }
232 }
233 }
234 }
235
236
239 "Looping over top volumes in the GeoModel tree (children of the "
240 "'World' volume)...");
241 GeoVolumeCursor av(world);
242 while (!av.atEnd()) {
243 std::string volname = av.getName();
245 av.next();
246 }
247 }
248
251 ATH_MSG_FATAL(
"The name of the output SQLite file is not set!");
252 throw GaudiException("The name of the output SQLite file is not set!",
253 "DumpGeo", StatusCode::FAILURE);
254 }
256
257
259
260
261 if (
db.checkIsDBOpen())
263 else {
265 throw GaudiException(
266 "The GeoModel SQLite .db file could not be opened successfully.",
267 "DumpGeo", StatusCode::FAILURE);
268 }
269
271
272
273 GeoModelIO::WriteGeoModel dumpGeoModelGraph(db);
274
276 volTop->exec(&dumpGeoModelGraph);
277 } else {
278 world->exec(&dumpGeoModelGraph);
279 }
281
282 dumpGeoModelGraph.saveToDB();
284
285
288 "Test - list of all the GeoMaterial nodes in the persistified "
289 "geometry:");
290 db.printAllMaterials();
292 "Test - list of all the GeoElement nodes in the persistified "
293 "geometry:");
294 db.printAllElements();
295 }
296
298 return StatusCode::SUCCESS;
299}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ALWAYS(x)
GeoPhysVol * createTheWorld()
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
Gaudi::Property< bool > m_showTreetopContent
Gaudi::Property< std::vector< std::string > > m_user_filterDetManagersList
Gaudi::Property< std::string > m_outFileName
const GeoVDetectorManager * getManager(const std::string &name) const
GeoPhysVol * getPhysVol()
Destructor.
std::vector< std::string > getListOfManagers() const
retrieve(aClass, aKey=None)