50#define mole UNITS::mole
54 GeoElement* Nitrogen =
55 new GeoElement(
"Nitrogen",
"N", 7.0, 14.0067 *
gr /
mole);
56 GeoElement* Oxygen =
new GeoElement(
"Oxygen",
"O", 8.0, 15.9995 *
gr /
mole);
57 GeoElement* Argon =
new GeoElement(
"Argon",
"Ar", 18.0, 39.948 *
gr /
mole);
58 GeoElement* Hydrogen =
59 new GeoElement(
"Hydrogen",
"H", 1.0, 1.00797 *
gr /
mole);
62 double densityOfAir = 0.001214 *
gr /
cm3;
63 GeoMaterial* air =
new GeoMaterial(
"Air", densityOfAir);
64 air->add(Nitrogen, 0.7494);
65 air->add(Oxygen, 0.2369);
66 air->add(Argon, 0.0129);
67 air->add(Hydrogen, 0.0008);
73 const GeoBox* worldBox =
74 new GeoBox(1000 * UNITS::cm, 1000 * UNITS::cm, 1000 * UNITS::cm);
75 const GeoLogVol* worldLog =
new GeoLogVol(
"WorldLog", worldBox, air);
76 GeoPhysVol* world =
new GeoPhysVol(worldLog);
88 ATH_MSG_INFO(
"===================================================");
90 ATH_MSG_INFO(
"===================================================");
105 "This is the Geometry TAG we are dumping: " << geoDbTag->atlasVersion());
114 std::set<std::string> managersList{};
117 managersList.insert(blub.begin(), blub.end());
120 ATH_MSG_INFO(
"List of the GeoModel Detector Managers that are being dumped: ");
121 for (
auto const& man : managersList) {
123 const GeoVDetectorManager* manager = theExpt->
getManager(man);
124 unsigned int nTreetops = manager->getNumTreeTops();
125 std::cout <<
"\t" << man <<
" [contains " << nTreetops <<
" treetops]"
127 for (
unsigned int i = 0; i < nTreetops; ++i) {
128 PVConstLink treetop(manager->getTreeTop(i));
130 const GeoVPhysVol* vol = treetop;
132 std::string volName = vol->getLogVol()->getName();
133 std::cout <<
"\t\t treetop: " << volName << std::endl;
140 std::set<std::string> user_managersList{};
148 for (
auto& userDet : user_managersList) {
149 if (!managersList.count(userDet)) {
151 "This Detector Manager you requested to dump is not in the list of "
152 "DetectorManagers for the geometry tag you are using: "
154 throw GaudiException(
155 "The Detector Manager you requested to dump is not in the list of "
157 "DumpGeo", StatusCode::FAILURE);
161 if (!(managersList.empty())) {
162 for (
auto const& mm : managersList) {
164 const GeoVDetectorManager* manager = theExpt->
getManager(mm);
167 std::string detManName = manager->getName();
171 unsigned int nTreetops = manager->getNumTreeTops();
172 ATH_MSG_INFO(
"\t" << mm <<
" - # TreeTops: " << nTreetops);
174 if ((nTreetops > 0) && user_managersList.count(detManName)) {
176 for (
unsigned int i = 0; i < nTreetops; ++i) {
178 PVConstLink treetop(manager->getTreeTop(i));
181 const GeoVPhysVol* vol = treetop;
185 GeoTransform* volXf =
new GeoTransform(vol->getDefX());
188 std::string volName = vol->getLogVol()->getName();
193 volTop->add(
new GeoNameTag(detManName));
196 volTop->add(
const_cast<GeoVPhysVol*
>(vol));
199 ATH_MSG_INFO(
"You enabled the option 'showTreetopContent', so we now print the content of the first layers of child volumes of the Treetops...");
201 GeoVolumeCursor av(treetop);
202 while (!av.atEnd()) {
204 if(1==v1)
ATH_MSG_INFO(
"first level of child volumes:");
206 ATH_MSG_INFO(
"\t\t- child's n. sub-nodes: " << av.getVolume()->getNChildNodes());
207 ATH_MSG_INFO(
"\t\t- child's n. sub-volumes: " << av.getVolume()->getNChildVols());
211 GeoVolumeCursor av2(av.getVolume());
212 while (!av2.atEnd()) {
214 if(1==v2)
ATH_MSG_INFO(
"second level of child volumes:");
215 ATH_MSG_INFO(
"\t\t\t- child's logvol's name: " << av2.getVolume()->getLogVol()->getName());
218 GeoVolumeCursor av3(av2.getVolume());
219 while (!av3.atEnd()) {
221 if(1==v3)
ATH_MSG_INFO(
"third level of child volumes:");
222 ATH_MSG_INFO(
"\t\t\t\t- child's logvol's name: " << av3.getVolume()->getLogVol()->getName());
241 "Looping over top volumes in the GeoModel tree (children of the "
242 "'World' volume)...");
243 GeoVolumeCursor av(world);
244 while (!av.atEnd()) {
245 std::string volname = av.getName();
253 ATH_MSG_FATAL(
"The name of the output SQLite file is not set!");
254 throw GaudiException(
"The name of the output SQLite file is not set!",
255 "DumpGeo", StatusCode::FAILURE);
264 std::error_code
error;
269 return StatusCode::FAILURE;
280 if (db.checkIsDBOpen())
284 throw GaudiException(
285 "The GeoModel SQLite .db file could not be opened successfully.",
286 "DumpGeo", StatusCode::FAILURE);
292 GeoModelIO::WriteGeoModel dumpGeoModelGraph(db);
295 volTop->exec(&dumpGeoModelGraph);
297 world->exec(&dumpGeoModelGraph);
301 dumpGeoModelGraph.saveToDB();
307 "Test - list of all the GeoMaterial nodes in the persistified "
309 db.printAllMaterials();
311 "Test - list of all the GeoElement nodes in the persistified "
313 db.printAllElements();
317 return StatusCode::SUCCESS;