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