| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4tgbVolumeMgr.cc,v 1.5 2008/12/18 12:59:44 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-03 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // class G4tgbVolumeMgr
|
|---|
| 32 |
|
|---|
| 33 | // History:
|
|---|
| 34 | // - Created. P.Arce, CIEMAT (November 2007)
|
|---|
| 35 | // -------------------------------------------------------------------------
|
|---|
| 36 |
|
|---|
| 37 | #include "G4tgbVolume.hh"
|
|---|
| 38 | #include "G4tgbVolumeMgr.hh"
|
|---|
| 39 | #include "G4tgbMaterialMgr.hh"
|
|---|
| 40 | #include "G4tgbRotationMatrixMgr.hh"
|
|---|
| 41 |
|
|---|
| 42 | #include "G4tgrVolumeMgr.hh"
|
|---|
| 43 | #include "G4tgrFileReader.hh"
|
|---|
| 44 | #include "G4tgrUtils.hh"
|
|---|
| 45 |
|
|---|
| 46 | #include "G4VSolid.hh"
|
|---|
| 47 | #include "G4PhysicalVolumeStore.hh"
|
|---|
| 48 | #include "G4ReflectionFactory.hh"
|
|---|
| 49 | #include "G4tgrMessenger.hh"
|
|---|
| 50 | #include "G4tgbDetectorBuilder.hh"
|
|---|
| 51 |
|
|---|
| 52 | G4tgbVolumeMgr* G4tgbVolumeMgr::theInstance = 0;
|
|---|
| 53 |
|
|---|
| 54 | //---------------------------------------------------------------------
|
|---|
| 55 | G4tgbVolumeMgr::G4tgbVolumeMgr()
|
|---|
| 56 | {
|
|---|
| 57 | G4ReflectionFactory::Instance()->SetScalePrecision(1.E-6*mm);
|
|---|
| 58 | // NOTE: problems building matrices with not enough figures,
|
|---|
| 59 | // like :ROTM RR30 0.866025 0.5 0. -0.5 0.866025 0. 0. 0 -1
|
|---|
| 60 | theDetectorBuilder = new G4tgbDetectorBuilder();
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 | //---------------------------------------------------------------------
|
|---|
| 65 | G4tgbVolumeMgr::~G4tgbVolumeMgr()
|
|---|
| 66 | {
|
|---|
| 67 | delete theDetectorBuilder;
|
|---|
| 68 | delete theInstance;
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 | //---------------------------------------------------------------------
|
|---|
| 73 | G4tgbVolumeMgr* G4tgbVolumeMgr::GetInstance()
|
|---|
| 74 | {
|
|---|
| 75 | if( !theInstance )
|
|---|
| 76 | {
|
|---|
| 77 | theInstance = new G4tgbVolumeMgr();
|
|---|
| 78 | }
|
|---|
| 79 | return theInstance;
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 | //---------------------------------------------------------------------
|
|---|
| 84 | void G4tgbVolumeMgr::AddTextFile( const G4String& fname )
|
|---|
| 85 | {
|
|---|
| 86 | G4tgrFileReader::GetInstance()->AddTextFile( fname );
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 | //---------------------------------------------------------------------
|
|---|
| 91 | G4VPhysicalVolume* G4tgbVolumeMgr::ReadAndConstructDetector()
|
|---|
| 92 | {
|
|---|
| 93 | const G4tgrVolume* tgrVoltop = theDetectorBuilder->ReadDetector();
|
|---|
| 94 | return theDetectorBuilder->ConstructDetector(tgrVoltop);
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 | //---------------------------------------------------------------------
|
|---|
| 99 | void G4tgbVolumeMgr::RegisterMe( const G4tgbVolume* vol )
|
|---|
| 100 | {
|
|---|
| 101 | theVolumeList.insert( G4mssvol::value_type( vol->GetName(),
|
|---|
| 102 | const_cast<G4tgbVolume*>(vol) ) );
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 | //---------------------------------------------------------------------
|
|---|
| 107 | void G4tgbVolumeMgr::RegisterMe( const G4VSolid* solid )
|
|---|
| 108 | {
|
|---|
| 109 | theSolids.insert( G4mmssol::value_type( solid->GetName(),
|
|---|
| 110 | const_cast<G4VSolid*>(solid) ) );
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 | //---------------------------------------------------------------------
|
|---|
| 115 | void G4tgbVolumeMgr::RegisterMe( const G4LogicalVolume* lv )
|
|---|
| 116 | {
|
|---|
| 117 | theLVs.insert( G4mmslv::value_type( lv->GetName(),
|
|---|
| 118 | const_cast<G4LogicalVolume*>(lv) ) );
|
|---|
| 119 |
|
|---|
| 120 | #ifdef G4VERBOSE
|
|---|
| 121 | if( G4tgrMessenger::GetVerboseLevel() >= 2 )
|
|---|
| 122 | {
|
|---|
| 123 | G4cout << " G4tgbVolumeMgr::RegisterMe() - Logical volume registered: "
|
|---|
| 124 | << lv->GetName() << G4endl;
|
|---|
| 125 | }
|
|---|
| 126 | #endif
|
|---|
| 127 | }
|
|---|
| 128 |
|
|---|
| 129 | //---------------------------------------------------------------------
|
|---|
| 130 | void G4tgbVolumeMgr::RegisterMe( const G4VPhysicalVolume* pv )
|
|---|
| 131 | {
|
|---|
| 132 | thePVs.insert( G4mmspv::value_type( pv->GetName(),
|
|---|
| 133 | const_cast<G4VPhysicalVolume*>(pv) ) );
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 | //---------------------------------------------------------------------
|
|---|
| 138 | void G4tgbVolumeMgr::RegisterChildParentLVs( const G4LogicalVolume* logvol,
|
|---|
| 139 | const G4LogicalVolume* parentLV )
|
|---|
| 140 | {
|
|---|
| 141 | theLVInvTree[const_cast<G4LogicalVolume*>(logvol)] =
|
|---|
| 142 | const_cast<G4LogicalVolume*>(parentLV);
|
|---|
| 143 | theLVTree[const_cast<G4LogicalVolume*>(parentLV)] =
|
|---|
| 144 | const_cast<G4LogicalVolume*>(logvol);
|
|---|
| 145 | }
|
|---|
| 146 |
|
|---|
| 147 | //---------------------------------------------------------------------
|
|---|
| 148 | void G4tgbVolumeMgr::CopyVolumes()
|
|---|
| 149 | {
|
|---|
| 150 | //--------- Loop G4tgbVolume's and create a G4tgbVolume for each DetUnit
|
|---|
| 151 | G4mapsvol::iterator cite;
|
|---|
| 152 | G4mapsvol vollist = G4tgrVolumeMgr::GetInstance()->GetVolumeMap();
|
|---|
| 153 | for(cite = vollist.begin(); cite != vollist.end(); cite++)
|
|---|
| 154 | {
|
|---|
| 155 | G4tgrVolume* tgrvol = const_cast<G4tgrVolume*>( (*cite).second );
|
|---|
| 156 | G4tgbVolume* svol = new G4tgbVolume( tgrvol );
|
|---|
| 157 | RegisterMe( svol );
|
|---|
| 158 | }
|
|---|
| 159 | }
|
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 | //---------------------------------------------------------------------
|
|---|
| 163 | G4tgbVolume* G4tgbVolumeMgr::FindVolume( const G4String& volname)
|
|---|
| 164 | {
|
|---|
| 165 | G4mssvol::const_iterator cite = theVolumeList.find( volname );
|
|---|
| 166 | if( cite == theVolumeList.end() )
|
|---|
| 167 | {
|
|---|
| 168 | G4String ErrMessage = "G4tgbVolume not found: " + volname + " !";
|
|---|
| 169 | G4Exception("G4tgbVolumeMgr::FindVolume()", "InvalidSetup",
|
|---|
| 170 | FatalException, ErrMessage);
|
|---|
| 171 | }
|
|---|
| 172 | return (*cite).second;
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 | //---------------------------------------------------------------------
|
|---|
| 177 | G4VSolid* G4tgbVolumeMgr::FindG4Solid( const G4String& name )
|
|---|
| 178 | {
|
|---|
| 179 | #ifdef G4VERBOSE
|
|---|
| 180 | if( G4tgrMessenger::GetVerboseLevel() >= 2 )
|
|---|
| 181 | {
|
|---|
| 182 | G4cout << " G4tgbVolumeMgr::FindG4Solid() - " << name << G4endl;
|
|---|
| 183 | }
|
|---|
| 184 | #endif
|
|---|
| 185 |
|
|---|
| 186 | G4VSolid* oldSolid = 0;
|
|---|
| 187 | G4mmssol::const_iterator mmsscite;
|
|---|
| 188 | std::pair<G4mmssol::iterator, G4mmssol::iterator> mmssdi;
|
|---|
| 189 | mmssdi = theSolids.equal_range( name );
|
|---|
| 190 |
|
|---|
| 191 | for( mmsscite = mmssdi.first; mmsscite != mmssdi.second; mmsscite++ )
|
|---|
| 192 | {
|
|---|
| 193 | #ifdef G4VERBOSE
|
|---|
| 194 | if( G4tgrMessenger::GetVerboseLevel() >= 2 )
|
|---|
| 195 | {
|
|---|
| 196 | G4cout << " G4tgbVolumeMgr::FindG4Solid() - Solid finding "
|
|---|
| 197 | << name << G4endl;
|
|---|
| 198 | }
|
|---|
| 199 | #endif
|
|---|
| 200 | /*
|
|---|
| 201 | G4VSolid overwrites the operator== comparing the addresses
|
|---|
| 202 | => this cannot be used !!
|
|---|
| 203 | Then just compare solids by name =>> POSP tag cannot be used
|
|---|
| 204 | for the moment ...
|
|---|
| 205 | if( solid == *( (*mmsscite).second ) )
|
|---|
| 206 | {
|
|---|
| 207 | oldSolid = (*mmsscite).second;
|
|---|
| 208 | break;
|
|---|
| 209 | }
|
|---|
| 210 | until we write operator== for each solid type, we take a solid
|
|---|
| 211 | with the same name (therefore we will not allow two solids with
|
|---|
| 212 | equal name and different parameters (POSP) )
|
|---|
| 213 | */
|
|---|
| 214 | oldSolid = (*mmsscite).second;
|
|---|
| 215 | #ifdef G4VERBOSE
|
|---|
| 216 | if( G4tgrMessenger::GetVerboseLevel() >= 1 )
|
|---|
| 217 | {
|
|---|
| 218 | G4cout << " G4tgbVolumeMgr::FindG4Solid() - Solid already found "
|
|---|
| 219 | << name << G4endl;
|
|---|
| 220 | }
|
|---|
| 221 | #endif
|
|---|
| 222 | break;
|
|---|
| 223 | }
|
|---|
| 224 |
|
|---|
| 225 | #ifdef G4VERBOSE
|
|---|
| 226 | if( G4tgrMessenger::GetVerboseLevel() >= 2 )
|
|---|
| 227 | {
|
|---|
| 228 | G4cout << " G4tgbVolumeMgr::FindG4Solid() - Old solid: "
|
|---|
| 229 | << oldSolid << G4endl;
|
|---|
| 230 | }
|
|---|
| 231 | #endif
|
|---|
| 232 | return oldSolid;
|
|---|
| 233 | }
|
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 | //---------------------------------------------------------------------
|
|---|
| 237 | G4LogicalVolume*
|
|---|
| 238 | G4tgbVolumeMgr::FindG4LogVol( const G4String& name, const G4bool exists )
|
|---|
| 239 | {
|
|---|
| 240 | G4mmslv::const_iterator mscite = theLVs.find( name );
|
|---|
| 241 | if( mscite == theLVs.end() )
|
|---|
| 242 | {
|
|---|
| 243 | if( exists )
|
|---|
| 244 | {
|
|---|
| 245 | G4String ErrMessage = "Logical volume name " + name + " not found !";
|
|---|
| 246 | G4Exception("G4tgbVolumeMgr::FindG4LogVol()", "InvalidSetup",
|
|---|
| 247 | FatalException, ErrMessage);
|
|---|
| 248 | }
|
|---|
| 249 | return 0;
|
|---|
| 250 | }
|
|---|
| 251 | else
|
|---|
| 252 | {
|
|---|
| 253 | return (*mscite).second;
|
|---|
| 254 | }
|
|---|
| 255 | }
|
|---|
| 256 |
|
|---|
| 257 | //---------------------------------------------------------------------
|
|---|
| 258 | G4VPhysicalVolume*
|
|---|
| 259 | G4tgbVolumeMgr::FindG4PhysVol( const G4String& name, const G4bool exists )
|
|---|
| 260 | {
|
|---|
| 261 | G4mmspv::const_iterator mscite = thePVs.find( name );
|
|---|
| 262 | if( mscite == thePVs.end() )
|
|---|
| 263 | {
|
|---|
| 264 | if( exists )
|
|---|
| 265 | {
|
|---|
| 266 | G4String ErrMessage = "Physical volume name " + name + " not found !";
|
|---|
| 267 | G4Exception("G4tgbVolumeMgr::FindG4PhysVol()", "InvalidSetup",
|
|---|
| 268 | FatalException, ErrMessage);
|
|---|
| 269 | }
|
|---|
| 270 | return 0;
|
|---|
| 271 | }
|
|---|
| 272 | else
|
|---|
| 273 | {
|
|---|
| 274 | return (*mscite).second;
|
|---|
| 275 | }
|
|---|
| 276 | }
|
|---|
| 277 |
|
|---|
| 278 |
|
|---|
| 279 | //---------------------------------------------------------------------
|
|---|
| 280 | G4VPhysicalVolume* G4tgbVolumeMgr::GetTopPhysVol()
|
|---|
| 281 | {
|
|---|
| 282 | G4LogicalVolume* lv = GetTopLogVol();
|
|---|
| 283 | G4VPhysicalVolume* pv = ( *(thePVs.find( lv->GetName() )) ).second;
|
|---|
| 284 |
|
|---|
| 285 | #ifdef G4VERBOSE
|
|---|
| 286 | if( G4tgrMessenger::GetVerboseLevel() >= 2 )
|
|---|
| 287 | {
|
|---|
| 288 | G4cout << " G4tgbVolumeMgr::GetTopPhysVol() - pv: "
|
|---|
| 289 | << pv->GetName() << G4endl;
|
|---|
| 290 | }
|
|---|
| 291 | #endif
|
|---|
| 292 |
|
|---|
| 293 | return pv;
|
|---|
| 294 | }
|
|---|
| 295 |
|
|---|
| 296 |
|
|---|
| 297 | //---------------------------------------------------------------------
|
|---|
| 298 | G4LogicalVolume* G4tgbVolumeMgr::GetTopLogVol()
|
|---|
| 299 | {
|
|---|
| 300 | //----------- Start from any G4LogicalVolume, because if you go upwards
|
|---|
| 301 | // you will always end at the top
|
|---|
| 302 | #ifdef G4VERBOSE
|
|---|
| 303 | if( G4tgrMessenger::GetVerboseLevel() >= 2 )
|
|---|
| 304 | {
|
|---|
| 305 | G4cout << " G4tgbVolumeMgr::GetTopLogVol theLVInvTresize "
|
|---|
| 306 | << theLVInvTree.size() << G4endl;
|
|---|
| 307 | }
|
|---|
| 308 | #endif
|
|---|
| 309 | if( theLVInvTree.size() == 0 )
|
|---|
| 310 | {
|
|---|
| 311 | G4Exception("G4tgbVolumeMgr::GetTopLogVol()", "InvalidSetup",
|
|---|
| 312 | FatalException, "theLVInvTree has no elements.");
|
|---|
| 313 | }
|
|---|
| 314 | G4LogicalVolume* lv = (*(theLVInvTree.begin())).second;
|
|---|
| 315 |
|
|---|
| 316 | //------- if first element is the top LV, its parent is 0
|
|---|
| 317 | if( lv == 0 )
|
|---|
| 318 | {
|
|---|
| 319 | lv = (*(theLVInvTree.begin())).first;
|
|---|
| 320 | }
|
|---|
| 321 | else
|
|---|
| 322 | {
|
|---|
| 323 | while( (*(theLVInvTree.find( lv ))).second != 0)
|
|---|
| 324 | {
|
|---|
| 325 | //---------- get parent of first position
|
|---|
| 326 | lv = (*(theLVInvTree.find( lv ))).second;
|
|---|
| 327 | #ifdef G4VERBOSE
|
|---|
| 328 | if( G4tgrMessenger::GetVerboseLevel() >= 2 )
|
|---|
| 329 | {
|
|---|
| 330 | G4cout << " G4tgbVolumeMgr::GetTopPhysVol: lv "
|
|---|
| 331 | << lv->GetName() << G4endl;
|
|---|
| 332 | }
|
|---|
| 333 | #endif
|
|---|
| 334 | }
|
|---|
| 335 | }
|
|---|
| 336 |
|
|---|
| 337 | return lv;
|
|---|
| 338 | }
|
|---|
| 339 |
|
|---|
| 340 |
|
|---|
| 341 | //---------------------------------------------------------------------
|
|---|
| 342 | void G4tgbVolumeMgr::BuildPhysVolTree()
|
|---|
| 343 | {
|
|---|
| 344 | /*
|
|---|
| 345 | G4PhysicalVolumeStore* pvs = G4PhysicalVolumeStore::GetInstance();
|
|---|
| 346 | std::vector<G4VPhysicalVolume*>::iterator cite;
|
|---|
| 347 | for( cite = pvs->begin(); cite != pvs->end(); cite++ )
|
|---|
| 348 | {
|
|---|
| 349 | thePVTree[ *cite ] = (*cite)->GetMother();
|
|---|
| 350 | thePVInvTree[ (*cite)->GetMother() ] = *cite;
|
|---|
| 351 | }
|
|---|
| 352 | */
|
|---|
| 353 | }
|
|---|
| 354 |
|
|---|
| 355 |
|
|---|
| 356 | //---------------------------------------------------------------------
|
|---|
| 357 | void G4tgbVolumeMgr::DumpSummary()
|
|---|
| 358 | {
|
|---|
| 359 | //---------- Dump number of objects of each class
|
|---|
| 360 | G4cout << " @@@@@@@@@@@@@ Dumping Geant4 geometry objects Summary " << G4endl;
|
|---|
| 361 | G4cout << " @@@ Geometry built inside world volume: "
|
|---|
| 362 | << GetTopPhysVol()->GetName() << G4endl;
|
|---|
| 363 | G4cout << " Number of G4VSolid's: " << theSolids.size() << G4endl;
|
|---|
| 364 | G4cout << " Number of G4LogicalVolume's: " << theLVs.size() << G4endl;
|
|---|
| 365 | G4cout << " Number of G4VPhysicalVolume's: " << thePVs.size() << G4endl;
|
|---|
| 366 |
|
|---|
| 367 | G4tgbMaterialMgr* mateMgr = G4tgbMaterialMgr::GetInstance();
|
|---|
| 368 | G4cout << " Number of G4Isotope's: "
|
|---|
| 369 | << mateMgr->GetG4IsotopeList().size() << G4endl;
|
|---|
| 370 | G4cout << " Number of G4Element's: "
|
|---|
| 371 | << mateMgr->GetG4ElementList().size() << G4endl;
|
|---|
| 372 | G4cout << " Number of G4Material's: "
|
|---|
| 373 | << mateMgr->GetG4MaterialList().size() << G4endl;
|
|---|
| 374 |
|
|---|
| 375 | G4tgbRotationMatrixMgr* rotmMgr = G4tgbRotationMatrixMgr::GetInstance();
|
|---|
| 376 | G4cout << " Number of G4RotationMatrix's: "
|
|---|
| 377 | << rotmMgr->GetG4RotMatList().size() << G4endl;
|
|---|
| 378 |
|
|---|
| 379 | //---------- Dump list of objects of each class
|
|---|
| 380 | DumpG4SolidList();
|
|---|
| 381 | DumpG4LogVolTree();
|
|---|
| 382 | DumpG4PhysVolTree();
|
|---|
| 383 | }
|
|---|
| 384 |
|
|---|
| 385 |
|
|---|
| 386 | //---------------------------------------------------------------------
|
|---|
| 387 | void G4tgbVolumeMgr::DumpG4SolidList()
|
|---|
| 388 | {
|
|---|
| 389 | G4mmssol::const_iterator cite;
|
|---|
| 390 | for( cite = theSolids.begin(); cite != theSolids.end(); cite++)
|
|---|
| 391 | {
|
|---|
| 392 | G4cout << "G4SOLID: " << (*cite).second->GetName()
|
|---|
| 393 | << " of type " << (*cite).second->GetEntityType() << G4endl;
|
|---|
| 394 | }
|
|---|
| 395 | }
|
|---|
| 396 |
|
|---|
| 397 |
|
|---|
| 398 | //---------------------------------------------------------------------
|
|---|
| 399 | void G4tgbVolumeMgr::DumpG4LogVolTree()
|
|---|
| 400 | {
|
|---|
| 401 | G4cout << " @@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree " << G4endl;
|
|---|
| 402 |
|
|---|
| 403 | G4LogicalVolume* lv = GetTopLogVol();
|
|---|
| 404 |
|
|---|
| 405 | DumpG4LogVolLeaf(lv, 0);
|
|---|
| 406 | }
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 | //---------------------------------------------------------------------
|
|---|
| 410 | void G4tgbVolumeMgr::DumpG4LogVolLeaf( const G4LogicalVolume* lv,
|
|---|
| 411 | unsigned int leafDepth)
|
|---|
| 412 | {
|
|---|
| 413 | for( size_t ii=0; ii < leafDepth; ii++ )
|
|---|
| 414 | {
|
|---|
| 415 | G4cout << " ";
|
|---|
| 416 | }
|
|---|
| 417 | G4cout << " LV:(" << leafDepth << ")" << lv->GetName() << G4endl;
|
|---|
| 418 |
|
|---|
| 419 | //---------- construct the children of this volume
|
|---|
| 420 | G4LogicalVolume* lvnc = const_cast<G4LogicalVolume*>(lv);
|
|---|
| 421 | std::pair<G4mlvlv::iterator, G4mlvlv::iterator> children
|
|---|
| 422 | = theLVTree.equal_range( lvnc );
|
|---|
| 423 |
|
|---|
| 424 | G4mlvlv::iterator cite;
|
|---|
| 425 |
|
|---|
| 426 | leafDepth++;
|
|---|
| 427 | // for( cite = children.first; cite != children.second; cite++ )
|
|---|
| 428 | // {
|
|---|
| 429 | // DumpG4LVLeaf( (*cite)->second, leafDepth );
|
|---|
| 430 | // }
|
|---|
| 431 | }
|
|---|
| 432 |
|
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 | //---------------------------------------------------------------------
|
|---|
| 436 | void G4tgbVolumeMgr::DumpG4PhysVolTree()
|
|---|
| 437 | {
|
|---|
| 438 | G4cout << " @@@@@@@@@@@@@ DUMPING G4PhysicalVolume's Tree " << G4endl;
|
|---|
| 439 |
|
|---|
| 440 | G4VPhysicalVolume* pv = GetTopPhysVol();
|
|---|
| 441 |
|
|---|
| 442 | DumpG4PhysVolLeaf(pv, 0);
|
|---|
| 443 | }
|
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 | //---------------------------------------------------------------------
|
|---|
| 447 | void G4tgbVolumeMgr::DumpG4PhysVolLeaf( const G4VPhysicalVolume* pv,
|
|---|
| 448 | unsigned int leafDepth)
|
|---|
| 449 | {
|
|---|
| 450 | for( size_t ii=0; ii < leafDepth; ii++ )
|
|---|
| 451 | {
|
|---|
| 452 | G4cout << " ";
|
|---|
| 453 | }
|
|---|
| 454 | G4cout << " PV:(" << leafDepth << ")" << pv->GetName() << G4endl;
|
|---|
| 455 |
|
|---|
| 456 | //---------- construct the children of this PV
|
|---|
| 457 | G4VPhysicalVolume* pvnc = const_cast<G4VPhysicalVolume*>(pv);
|
|---|
| 458 | std::pair<G4mpvpv::iterator, G4mpvpv::iterator> children
|
|---|
| 459 | = thePVTree.equal_range( pvnc );
|
|---|
| 460 |
|
|---|
| 461 | G4mpvpv::iterator cite;
|
|---|
| 462 |
|
|---|
| 463 | leafDepth++;
|
|---|
| 464 | // for( cite = children.first; cite != children.second; cite++ )
|
|---|
| 465 | // {
|
|---|
| 466 | // DumpG4PVLeaf( (*cite)->second, leafDepth );
|
|---|
| 467 | // }
|
|---|
| 468 | }
|
|---|