Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:53

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 //
0014 // DDDB is a detector description convention developed by the LHCb experiment.
0015 // For further information concerning the DTD, please see:
0016 // http://lhcb-comp.web.cern.ch/lhcb-comp/Frameworks/DetDesc/Documents/lhcbDtd.pdf
0017 //
0018 //==========================================================================
0019 
0020 // Framework includes
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 /// Anonymous namespace for plugins
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   /// Plugin function
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 } /* End anonymous namespace  */
0066 
0067 DECLARE_APPLY(DDDB_LogVolumeDump,dddb_dump_logical_volumes)
0068 //==========================================================================