File indexing completed on 2025-01-18 09:14:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include "DD4hep/Detector.h"
0022 #include "DD4hep/Plugins.h"
0023 #include "DD4hep/Printout.h"
0024 #include "DD4hep/Factories.h"
0025 #include "DD4hep/detail/DetectorInterna.h"
0026
0027 using namespace std;
0028 using namespace dd4hep;
0029 using namespace dd4hep::detail;
0030
0031
0032 namespace {
0033 class VolumeScan {
0034 std::set<TGeoVolume*> scanned_vols;
0035 public:
0036 VolumeScan() {}
0037 int scan_daughters(TGeoVolume* vol, string path) {
0038 int count = 0;
0039 auto ivol = scanned_vols.find(vol);
0040 if ( ivol == scanned_vols.end() ) {
0041 int num_dau = vol->GetNdaughters();
0042 scanned_vols.insert(vol);
0043 path += "/";
0044 path += vol->GetName();
0045 printout(INFO,"DDDB_vol_dump","%s",path.c_str());
0046 ++count;
0047 for(int i=0; i<num_dau; ++i) {
0048 TGeoNode* n = vol->GetNode(i);
0049 TGeoVolume* v = n->GetVolume();
0050 count += scan_daughters(v,path);
0051 }
0052 }
0053 return count;
0054 }
0055 };
0056
0057
0058 long dddb_dump_logical_volumes(Detector& description, int , char** ) {
0059 VolumeScan scan;
0060 Volume world_vol = description.worldVolume();
0061 int count = scan.scan_daughters(world_vol,string());
0062 printout(INFO,"DDDB_vol_dump","Found %d unique logical volumes.",count);
0063 return 1;
0064 }
0065 }
0066
0067 DECLARE_APPLY(DDDB_LogVolumeDump,dddb_dump_logical_volumes)
0068