65 static void printDetectorSets( std::string name,
unsigned int includeFlag,
unsigned int excludeFlag=DetType::IGNORE ){
67 Detector& description = Detector::getInstance();
69 std::cout <<
" " << name ;
70 for(
int i=0,N=dets.size();i<N;++i)
71 std::cout << dets[i].name() <<
", " ;
78 static int invoke_dump_detector(
int argc,
char** argv ){
81 std::cout <<
" usage: dumpdetector compact.xml [-s]"
82 <<
" -d : only print DetectorData objects "
83 <<
" -s : also print surfaces "
89 std::string inFile = argv[1] ;
92 bool printDetData = ( argc>2 && !strcmp( argv[2] ,
"-d" ) );
94 bool printSurfaces = ( argc>2 && !strcmp( argv[2] ,
"-s" ) );
97 Detector& description = Detector::getInstance();
104 std::cout <<
"############################################################################### " << std::endl ;
108 std::cout <<
" detector model : " << h.
name() << std::endl
109 <<
" title : " << h.
title() << std::endl
110 <<
" author : " << h.
author() << std::endl
111 <<
" status : " << h.
status() << std::endl ;
116 printDetectorSets(
" barrel trackers : " , ( DetType::TRACKER | DetType::BARREL ) , ( DetType::VERTEX) ) ;
117 printDetectorSets(
" endcap trackers : " , ( DetType::TRACKER | DetType::ENDCAP ) , ( DetType::VERTEX) ) ;
119 printDetectorSets(
" vertex barrel trackers : " , ( DetType::TRACKER | DetType::BARREL | DetType::VERTEX) ) ;
120 printDetectorSets(
" vertex endcap trackers : " , ( DetType::TRACKER | DetType::ENDCAP | DetType::VERTEX) ) ;
122 printDetectorSets(
" barrel calorimeters : " , ( DetType::CALORIMETER | DetType::BARREL ) ) ;
123 printDetectorSets(
" endcap calorimeters : " , ( DetType::CALORIMETER | DetType::ENDCAP ) ) ;
126 printDetectorSets(
" other detecors : " , ( DetType::IGNORE ) , ( DetType::CALORIMETER | DetType::TRACKER ) ) ;
133 for( dd4hep::Detector::HandleMap::const_iterator it = dets.begin() ; it != dets.end() ; ++it ){
137 std::cout <<
" ---------------------------- " <<
det.name() <<
" ----------------------------- " << std::endl ;
141 std::cout <<
" ------ " << type << std:: endl ;
143 printDetectorData(
det ) ;
147 std::cout <<
"############################################################################### " << std::endl ;
158 std::cout <<
"############################################################################### " << std::endl
159 <<
" sensitive detectors: " << std::endl ;
161 for( dd4hep::Detector::HandleMap::const_iterator it = sensDet.begin() ; it != sensDet.end() ; ++it ){
164 std::cout <<
" " << it->first <<
" : type = " << sDet.
type() << std::endl ;
168 std::cout <<
"############################################################################### " << std::endl << std::endl ;
172 std::list< DetElement > dets ;
173 std::list< DetElement > daugs ;
174 std::list< DetElement > gdaugs ;
175 daugs.emplace_back( world ) ;
176 while( ! daugs.empty() ) {
177 for( std::list< DetElement >::iterator li=daugs.begin() ; li != daugs.end() ; ++li ){
180 for ( DetElement::Children::const_iterator it=chMap.begin() ; it != chMap.end() ; ++it ){
182 gdaugs.emplace_back( de ) ;
185 dets.splice( dets.end() , daugs ) ;
186 daugs.splice( daugs.end() , gdaugs ) ;
191 for ( std::list< DetElement >::const_iterator it=dets.begin() ; it != dets.end() ; ++it ){
196 unsigned parentCount = 0 ;
198 mother = mother.
parent() ;
206 std::cout <<
"DetElement: " ;
208 for(
unsigned i=0 ; i < parentCount ; ++i ) std::cout <<
"\t" ;
210 std::cout << de.
name() <<
"[ path: "<< de.
placementPath () <<
"] (id: " << de.
id() <<
") - sens type : " << description.
sensitiveDetector( de.
name() ).
type() <<
"\t surfaces : " << ( sL.empty() ? 0 : sL.size() ) << std::endl ;
216 for( SurfaceList::const_iterator sit = sL.begin() ; sit != sL.end() ; ++sit ){
218 std::cout <<
" ------------------------- "
219 <<
" surface: " << *surf << std::endl
220 <<
" ------------------------- " << std::endl ;
225 std::cout <<
"############################################################################### " << std::endl << std::endl ;
233 int main(
int argc,
char** argv ){
235 return invoke_dump_detector(argc,argv);
238 std::cout <<
"Got uncaught exception: " << e.what() << std::endl;
241 std::cout <<
"Got UNKNOWN uncaught exception." << std::endl;