Ejemplo n.º 1
0
    void SurfaceManager::initialize(Detector& description) {
      
      const std::vector<std::string>& types = description.detectorTypes() ;

      for(unsigned i=0,N=types.size();i<N;++i){

	const std::vector<DetElement>& dets = description.detectors( types[i] ) ;  

	for(unsigned j=0,M=dets.size();j<M;++j){

	  std::string name = dets[j].name() ;

	  SurfaceHelper surfH( dets[j] ) ;
	  
	  const SurfaceList& detSL = surfH.surfaceList() ;
  
	  // add an empty map for this detector in case there are no surfaces attached 
	  _map.insert(  std::make_pair( name , SurfaceMap() ) )  ;

	  for( SurfaceList::const_iterator it = detSL.begin() ; it != detSL.end() ; ++it ){
	    ISurface* surf =  *it ;
	    
	    // enter surface into map for this detector
	    _map[ name ].insert( std::make_pair( surf->id(), surf )  ) ;

	    // enter surface into map for detector type
	    _map[ types[i] ].insert( std::make_pair( surf->id(), surf )  ) ;

	    // enter surface into world map 
	    _map[ "world" ].insert( std::make_pair( surf->id(), surf )  ) ;

	  }
	}
      }

    }