Skip to content
Snippets Groups Projects
Commit 771a8fe4 authored by Frank Gaede's avatar Frank Gaede
Browse files

- modified to use SurfaceManager class

   (up to now now real test - just prints all surfaces ...)
parent 2a3e38cb
No related branches found
No related tags found
No related merge requests found
#include "DD4hep/LCDD.h" #include "DD4hep/LCDD.h"
#include "DD4hep/TGeoUnits.h"
#include "DD4hep/Detector.h"
#include "DD4hep/Volumes.h"
#include "DDRec/Surface.h" #include "DDRec/Surface.h"
#include "DDRec/DetectorSurfaces.h"
#include "DDRec/SurfaceManager.h"
// // #include "TGeoManager.h" // #include "DD4hep/TGeoUnits.h"
// //---- GEAR ---- // #include "DD4hep/Detector.h"
// #include "gear/GEAR.h" // #include "DD4hep/Volumes.h"
// #include "gearxml/GearXML.h"
// #include "gearimpl/Util.h"
// #include "gearimpl/ConstantBField.h"
// #include "gearimpl/GearMgrImpl.h"
// #include "geartgeo/TGeoGearPointProperties.h"
// #include "geartgeo/TGeoGearDistanceProperties.h"
#include <list>
using namespace std ; using namespace std ;
using namespace DD4hep ; using namespace DD4hep ;
...@@ -23,7 +15,7 @@ using namespace DD4hep::Geometry; ...@@ -23,7 +15,7 @@ using namespace DD4hep::Geometry;
using namespace DD4hep::DDRec ; using namespace DD4hep::DDRec ;
using namespace DDSurfaces ; using namespace DDSurfaces ;
using namespace tgeo ; //using namespace tgeo ;
//============================================================================= //=============================================================================
...@@ -40,66 +32,25 @@ int main(int argc, char** argv ){ ...@@ -40,66 +32,25 @@ int main(int argc, char** argv ){
lcdd.fromCompact( inFile ); lcdd.fromCompact( inFile );
// gear::GearMgr* gearMgr = createGearMgr( lcdd ) ;
DetElement world = lcdd.world() ; DetElement world = lcdd.world() ;
std::cout << " **** detector " << lcdd.header().name() << " to Gear \n"
<< " Iterating over all DetElements: " << std::endl ;
// create a list of all surfaces in the detector:
SurfaceManager surfMan( world ) ;
const SurfaceList& sL = surfMan.surfaceList() ;
//------------------ breadth first tree traversal ---------
std::list< DetElement > dets ;
std::list< DetElement > daugs ;
std::list< DetElement > gdaugs ;
daugs.push_back( world ) ;
while( ! daugs.empty() ) {
for( std::list< DetElement >::iterator li=daugs.begin() ; li != daugs.end() ; ++li ){
DetElement dau = *li ;
DetElement::Children chMap = dau.children() ;
for ( DetElement::Children::const_iterator it=chMap.begin() ; it != chMap.end() ; ++it ){
DetElement de = (*it).second ;
gdaugs.push_back( de ) ;
}
}
dets.splice( dets.end() , daugs ) ;
daugs.splice( daugs.end() , gdaugs ) ;
}
//------------------ end tree traversal ---------
std::cout << " **** # DetElements found " << dets.size() << std::endl ;
for( std::list< DetElement >::iterator li=dets.begin() ; li != dets.end() ; ++li ) { for( SurfaceList::const_iterator it = sL.begin() ; it != sL.end() ; ++it ){
DetElement det = (*li) ; Surface& surf = **it ;
if( ! volSurfaceList(det)->empty() ) { std::cout << " ------------------------- "
<< " surface: " << surf << std::endl
std::cout << " detector " << det.name() << " id: " << det.id() << " has " << volSurfaceList(det)->size() << " surfaces " << std::endl ; << " ------------------------- " << std::endl ;
// take first surface for now :
VolSurface volSurf = volSurfaceList(det)->front() ;
Surface* surf = new Surface( det, volSurf ) ;
std::cout << " ------------------------- "
<< " surface: " << *surf << std::endl
<< " ------------------------- " << std::endl ;
}
} }
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment