10 #include <TGeoVolume.h>
17 TGeoVolume *topvol,
string volnames,
bool exhaust)
25 if (topvol->GetName())
27 const char *name = topvol->GetName();
28 size_t length = strlen(name);
32 while ( (ind = volnames.find_first_of(
"+-", ind)) != std::string::npos )
35 if (ind == volnames.length())
break;
36 if ( (!(volnames.compare(ind, length, name))) &&
37 ( ((ind + length) == volnames.length()) ||
38 (volnames[(ind + length)] ==
'+') ||
39 (volnames[(ind + length)] ==
'-') ||
40 (volnames[(ind + length)] ==
' ') ) )
43 if ( volnames[(ind - 1)] ==
'+')
45 else if ( volnames[(ind - 1)] ==
'-')
53 #if defined(DEBUG_RECURSIVE_EXHAUST)
54 std::cout << topvol->GetName()
55 <<
" <" << topvol->GetMedium()->GetName() <<
">"
56 <<
" : " << exhaust <<
" :";
62 static TGeoMaterial *matVacuum = ((TGeoMaterial *)0);
63 static TGeoMedium *Vacuum = ((TGeoMedium *)0);
67 #if defined(DEBUG_RECURSIVE_EXHAUST)
68 std::cout <<
" Creating the Vaccum material and medium :";
73 if (!matVacuum) matVacuum =
new TGeoMaterial(
"Vacuum", 0.0, 0.0, 0.0);
74 if (matVacuum) Vacuum =
new TGeoMedium(
"Vacuum", 1, matVacuum);
77 if (Vacuum) topvol->SetMedium(Vacuum);
80 #if defined(DEBUG_RECURSIVE_EXHAUST)
81 std::cout <<
" <" << topvol->GetMedium()->GetName() <<
">"
86 Int_t nd = topvol->GetNdaughters();
87 for (Int_t i = 0; i < nd; i++)
90 if (topvol->GetNode(i)) {
92 topvol->GetNode(i)->GetVolume(), volnames, exhaust);
void RecursiveExhaust(TGeoVolume *topvol, string volnames, bool exhaust)