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 // G4tgrVolumeMgr implementation << 27 // 26 // 28 // Author: P.Arce, CIEMAT (November 2007) << 27 // $Id: G4tgrVolumeMgr.cc,v 1.10 2010-10-13 07:56:56 gcosmo Exp $ 29 // ------------------------------------------- << 28 // GEANT4 tag $Name: geant4-09-04-patch-02 $ >> 29 // >> 30 // >> 31 // class G4tgrVolumeMgr >> 32 >> 33 // History: >> 34 // - Created. P.Arce, CIEMAT (November 2007) >> 35 // ------------------------------------------------------------------------- 30 36 31 #include "G4tgrVolumeMgr.hh" 37 #include "G4tgrVolumeMgr.hh" 32 #include "G4tgrUtils.hh" 38 #include "G4tgrUtils.hh" 33 #include "G4tgrMaterialFactory.hh" 39 #include "G4tgrMaterialFactory.hh" 34 #include "G4tgrRotationMatrixFactory.hh" 40 #include "G4tgrRotationMatrixFactory.hh" 35 #include "G4tgrFileReader.hh" 41 #include "G4tgrFileReader.hh" 36 #include "G4tgrMessenger.hh" 42 #include "G4tgrMessenger.hh" 37 #include "G4tgrSolid.hh" 43 #include "G4tgrSolid.hh" 38 #include "G4tgrSolidBoolean.hh" 44 #include "G4tgrSolidBoolean.hh" 39 #include "G4tgrSolidMultiUnion.hh" << 40 #include "G4tgrSolidScaled.hh" << 41 45 42 G4ThreadLocal G4tgrVolumeMgr* G4tgrVolumeMgr:: << 43 46 44 // ------------------------------------------- << 47 G4tgrVolumeMgr* G4tgrVolumeMgr::theInstance = 0; >> 48 >> 49 >> 50 //------------------------------------------------------------- 45 G4tgrVolumeMgr::G4tgrVolumeMgr() 51 G4tgrVolumeMgr::G4tgrVolumeMgr() 46 { 52 { 47 } 53 } 48 54 49 // ------------------------------------------- << 55 >> 56 //------------------------------------------------------------- 50 G4tgrVolumeMgr::~G4tgrVolumeMgr() 57 G4tgrVolumeMgr::~G4tgrVolumeMgr() 51 { << 58 { 52 delete theInstance; 59 delete theInstance; 53 } 60 } 54 61 55 // ------------------------------------------- << 62 >> 63 //------------------------------------------------------------- 56 G4tgrVolumeMgr* G4tgrVolumeMgr::GetInstance() 64 G4tgrVolumeMgr* G4tgrVolumeMgr::GetInstance() 57 { 65 { 58 if(theInstance == nullptr) << 66 if( !theInstance ) 59 { 67 { 60 theInstance = new G4tgrVolumeMgr; 68 theInstance = new G4tgrVolumeMgr; 61 } 69 } 62 return theInstance; 70 return theInstance; 63 } 71 } 64 72 65 // ------------------------------------------- << 73 66 G4tgrSolid* G4tgrVolumeMgr::CreateSolid(const << 74 //------------------------------------------------------------------- 67 G4bool << 75 G4tgrSolid* >> 76 G4tgrVolumeMgr::CreateSolid( const std::vector<G4String>& wl, G4bool bVOLUtag ) 68 { 77 { 69 G4tgrSolid* sol = FindSolid(wl[1]); << 78 G4tgrSolid* sol = FindSolid( wl[1] ); 70 if(sol != nullptr) << 79 if( sol ) 71 { 80 { 72 G4String ErrMessage = "Solid already exist 81 G4String ErrMessage = "Solid already exists... " + wl[1]; 73 G4Exception("G4tgrVolumeMgr::CreateSolid() << 82 G4Exception("G4tgrVolumeMgr::CreateSolid()", "InvalidSetup", 74 ErrMessage); << 83 FatalException, ErrMessage); 75 } << 84 } 76 << 85 77 std::vector<G4String> wlc = wl; 86 std::vector<G4String> wlc = wl; 78 if(bVOLUtag) << 87 if( bVOLUtag ) { wlc.pop_back(); } 79 { << 80 wlc.pop_back(); << 81 } << 82 88 83 G4String wl2 = wlc[2]; 89 G4String wl2 = wlc[2]; 84 for(G4int ii = 0; ii < (G4int)wl2.length(); << 90 for( size_t ii = 0; ii < wl2.length(); ii++ ) 85 { 91 { 86 wl2[ii] = (char)std::toupper(wl2[ii]); << 92 wl2[ii] = toupper( wl2[ii] ); 87 } 93 } 88 if((wl2 == "UNION") || (wl2 == "SUBTRACTION" << 94 if( (wl2 == "UNION") || (wl2 == "SUBTRACTION") || (wl2 == "INTERSECTION") ) 89 { 95 { 90 //---------- Boolean solid 96 //---------- Boolean solid 91 //---------- Create G4tgrSolidBoolean and 97 //---------- Create G4tgrSolidBoolean and fill the solid params 92 sol = new G4tgrSolidBoolean(wlc); << 98 sol = new G4tgrSolidBoolean( wlc ); 93 } << 94 else if(wl2 == "SCALED") << 95 { << 96 //---------- Create G4tgrSolidScaled and f << 97 sol = new G4tgrSolidScaled(wlc); << 98 } << 99 else if(wl2 == "MULTIUNION") << 100 { << 101 //---------- Create G4tgrSolidMultiUnion a << 102 sol = new G4tgrSolidMultiUnion(wlc); << 103 } 99 } 104 else 100 else 105 { 101 { 106 //---------- Create G4tgrSolidSimple and f 102 //---------- Create G4tgrSolidSimple and fill the solid params 107 sol = new G4tgrSolid(wlc); << 103 sol = new G4tgrSolid( wlc ); 108 } 104 } 109 105 110 return sol; 106 return sol; 111 } 107 } 112 108 113 // ------------------------------------------- << 109 //------------------------------------------------------------------- 114 void G4tgrVolumeMgr::RegisterMe(G4tgrSolid* so << 110 void G4tgrVolumeMgr::RegisterMe( G4tgrSolid* sol) 115 { 111 { 116 if(theG4tgrSolidMap.find(sol->GetName()) != << 112 if( theG4tgrSolidMap.find( sol->GetName() ) != theG4tgrSolidMap.end() ) 117 { 113 { 118 G4String ErrMessage = << 114 G4String ErrMessage = "Cannot be two solids with the same name... " 119 "Cannot be two solids with the same name << 115 + sol->GetName(); 120 G4Exception("G4tgrVolumeMgr::RegisterMe()" << 116 G4Exception("G4tgrVolumeMgr::RegisterMe()", "InvalidSetup", 121 ErrMessage); << 117 FatalException, ErrMessage); 122 } 118 } 123 theG4tgrSolidMap.insert(G4mapssol::value_typ << 119 theG4tgrSolidMap.insert(G4mapssol::value_type(sol->GetName(), sol) ); 124 } 120 } 125 121 126 // ------------------------------------------- << 122 127 void G4tgrVolumeMgr::UnRegisterMe(G4tgrSolid* << 123 //------------------------------------------------------------- >> 124 void G4tgrVolumeMgr::UnRegisterMe( G4tgrSolid* sol ) 128 { 125 { 129 if(theG4tgrSolidMap.find(sol->GetName()) != << 126 if( theG4tgrSolidMap.find( sol->GetName() ) != theG4tgrSolidMap.end() ) 130 { << 127 { 131 G4String ErrMessage = << 128 G4String ErrMessage = "Cannot unregister a solid that is not registered... " 132 "Cannot unregister a solid that is not r << 129 + sol->GetName(); 133 G4Exception("G4tgrSolidMgr::unRegisterMe() << 130 G4Exception("G4tgrSolidMgr::unRegisterMe()", "InvalidSetup", 134 ErrMessage); << 131 FatalException, ErrMessage); 135 } 132 } 136 else 133 else 137 { 134 { 138 theG4tgrSolidMap.erase(theG4tgrSolidMap.fi << 135 theG4tgrSolidMap.erase( theG4tgrSolidMap.find( sol->GetName() ) ); 139 } 136 } 140 } 137 } 141 138 142 // ------------------------------------------- << 139 143 void G4tgrVolumeMgr::RegisterMe(G4tgrVolume* v << 140 //------------------------------------------------------------- >> 141 void G4tgrVolumeMgr::RegisterMe( G4tgrVolume* vol) 144 { 142 { 145 theG4tgrVolumeList.push_back(vol); << 143 theG4tgrVolumeList.push_back( vol ); 146 if(theG4tgrVolumeMap.find(vol->GetName()) != << 144 if( theG4tgrVolumeMap.find( vol->GetName() ) != theG4tgrVolumeMap.end() ) 147 { 145 { 148 G4String ErrMessage = << 146 G4String ErrMessage = "Cannot be two volumes with the same name... " 149 "Cannot be two volumes with the same nam << 147 + vol->GetName(); 150 G4Exception("G4tgrVolumeMgr::RegisterMe()" << 148 G4Exception("G4tgrVolumeMgr::RegisterMe()", "InvalidSetup", 151 ErrMessage); << 149 FatalException, ErrMessage); 152 } 150 } 153 theG4tgrVolumeMap.insert(G4mapsvol::value_ty << 151 theG4tgrVolumeMap.insert(G4mapsvol::value_type(vol->GetName(), vol) ); 154 } 152 } 155 153 156 // ------------------------------------------- << 154 157 void G4tgrVolumeMgr::UnRegisterMe(G4tgrVolume* << 155 //------------------------------------------------------------- >> 156 void G4tgrVolumeMgr::UnRegisterMe( G4tgrVolume* vol ) 158 { 157 { 159 std::vector<G4tgrVolume*>::const_iterator it << 158 std::vector<G4tgrVolume*>::iterator ite; 160 for(ite = theG4tgrVolumeList.cbegin(); << 159 for(ite = theG4tgrVolumeList.begin(); ite != theG4tgrVolumeList.end(); ite++) 161 ite != theG4tgrVolumeList.cend(); ++ite) << 162 { 160 { 163 if((*ite) == vol) << 161 if((*ite) == vol ) { break; } 164 { << 165 break; << 166 } << 167 } 162 } 168 if(ite == theG4tgrVolumeList.cend()) << 163 if( ite == theG4tgrVolumeList.end() ) 169 { << 164 { 170 G4String ErrMessage = << 165 G4String ErrMessage = "Cannot unregister a volume not registered... " 171 "Cannot unregister a volume not register << 166 + vol->GetName(); 172 G4Exception("G4tgrVolumeMgr::unRegisterMe( 167 G4Exception("G4tgrVolumeMgr::unRegisterMe()", "InvalidSetup", 173 FatalException, ErrMessage); 168 FatalException, ErrMessage); 174 } 169 } 175 else 170 else 176 { 171 { 177 theG4tgrVolumeList.erase(ite); << 172 theG4tgrVolumeList.erase( ite ); 178 } 173 } 179 theG4tgrVolumeMap.erase(theG4tgrVolumeMap.fi << 174 theG4tgrVolumeMap.erase( theG4tgrVolumeMap.find( vol->GetName() ) ); 180 } 175 } 181 176 182 // ------------------------------------------- << 177 183 void G4tgrVolumeMgr::RegisterParentChild(const << 178 //------------------------------------------------------------- 184 const << 179 185 { << 180 void G4tgrVolumeMgr::RegisterParentChild( const G4String& parentName, 186 theG4tgrVolumeTree.insert(G4mmapspl::value_t << 181 const G4tgrPlace* pl ) >> 182 { >> 183 theG4tgrVolumeTree.insert(G4mmapspl::value_type(parentName, pl) ); 187 } 184 } 188 185 189 // ------------------------------------------- << 190 G4tgrSolid* G4tgrVolumeMgr::FindSolid(const G4 << 191 { << 192 G4tgrSolid* vol = nullptr; << 193 186 194 G4mapssol::const_iterator svite = theG4tgrSo << 187 //------------------------------------------------------------- 195 if(svite == theG4tgrSolidMap.cend()) << 188 G4tgrSolid* G4tgrVolumeMgr::FindSolid( const G4String& volname, G4bool exists ) >> 189 { >> 190 G4tgrSolid* vol = 0; >> 191 >> 192 G4mapssol::iterator svite = theG4tgrSolidMap.find( volname ); >> 193 if( svite == theG4tgrSolidMap.end() ) 196 { 194 { 197 if(exists) << 195 if( exists ) 198 { 196 { 199 for(svite = theG4tgrSolidMap.cbegin(); << 197 for( svite = theG4tgrSolidMap.begin(); 200 svite != theG4tgrSolidMap.cend(); ++ << 198 svite != theG4tgrSolidMap.end(); svite++ ) 201 { 199 { 202 G4cerr << " VOL:" << (*svite).first << 200 G4cerr << " VOL:" << (*svite).first << G4endl; 203 } 201 } 204 G4String ErrMessage = "Solid not found.. 202 G4String ErrMessage = "Solid not found... " + volname; 205 G4Exception("G4tgrVolumeMgr::FindSolid() << 203 G4Exception("G4tgrVolumeMgr::FindSolid()", "InvalidSetup", 206 ErrMessage); << 204 FatalException, ErrMessage); 207 } 205 } 208 } 206 } 209 else 207 else 210 { 208 { 211 vol = const_cast<G4tgrSolid*>((*svite).sec 209 vol = const_cast<G4tgrSolid*>((*svite).second); 212 } 210 } 213 211 214 return vol; 212 return vol; 215 } 213 } 216 214 217 // ------------------------------------------- << 218 G4tgrVolume* G4tgrVolumeMgr::FindVolume(const << 219 { << 220 G4tgrVolume* vol = nullptr; << 221 215 222 G4mapsvol::const_iterator svite = theG4tgrVo << 216 //------------------------------------------------------------- 223 if(svite == theG4tgrVolumeMap.cend()) << 217 G4tgrVolume* >> 218 G4tgrVolumeMgr::FindVolume( const G4String& volname, G4bool exists ) >> 219 { >> 220 G4tgrVolume* vol = 0; >> 221 >> 222 G4mapsvol::iterator svite = theG4tgrVolumeMap.find( volname ); >> 223 if( svite == theG4tgrVolumeMap.end() ) 224 { 224 { 225 if(exists) << 225 if( exists ) 226 { 226 { 227 for(svite = theG4tgrVolumeMap.cbegin(); << 227 for( svite = theG4tgrVolumeMap.begin(); 228 svite != theG4tgrVolumeMap.cend(); + << 228 svite != theG4tgrVolumeMap.end(); svite++ ) 229 { 229 { 230 G4cerr << " VOL:" << (*svite).first << 230 G4cerr << " VOL:" << (*svite).first << G4endl; 231 } 231 } 232 G4String ErrMessage = "Volume not found. 232 G4String ErrMessage = "Volume not found... " + volname; 233 G4Exception("G4tgrVolumeMgr::FindVolume( 233 G4Exception("G4tgrVolumeMgr::FindVolume()", "InvalidSetup", 234 FatalException, ErrMessage); 234 FatalException, ErrMessage); 235 } 235 } 236 else 236 else 237 { 237 { 238 G4String WarMessage = "Volume does not e 238 G4String WarMessage = "Volume does not exists... " + volname; 239 G4Exception("G4tgrVolumeMgr::FindVolume( << 239 G4Exception("G4tgrVolumeMgr::FindVolume()", "SearchFailed", 240 WarMessage); << 240 JustWarning, WarMessage); 241 } 241 } 242 } 242 } 243 else 243 else 244 { 244 { 245 vol = const_cast<G4tgrVolume*>((*svite).se 245 vol = const_cast<G4tgrVolume*>((*svite).second); 246 } 246 } 247 247 248 return vol; 248 return vol; 249 } 249 } 250 250 251 // ------------------------------------------- << 251 //------------------------------------------------------------- 252 std::vector<G4tgrVolume*> G4tgrVolumeMgr::Find << 252 std::vector<G4tgrVolume*> 253 << 253 G4tgrVolumeMgr::FindVolumes( const G4String& volname, G4bool exists ) 254 { 254 { 255 std::vector<G4tgrVolume*> vols; 255 std::vector<G4tgrVolume*> vols; 256 << 256 257 G4mapsvol::const_iterator svite; << 257 G4mapsvol::iterator svite; 258 for(svite = theG4tgrVolumeMap.cbegin(); << 258 for( svite = theG4tgrVolumeMap.begin(); 259 svite != theG4tgrVolumeMap.cend(); ++svi << 259 svite != theG4tgrVolumeMap.end(); svite++ ) 260 { 260 { 261 if(G4tgrUtils::AreWordsEquivalent(volname, << 261 if( G4tgrUtils::AreWordsEquivalent( volname, (*svite).second->GetName()) ) 262 { 262 { 263 vols.push_back(const_cast<G4tgrVolume*>( << 263 vols.push_back(const_cast<G4tgrVolume*>((*svite).second) ); 264 } 264 } 265 } 265 } 266 266 267 if(vols.size() == 0) << 267 if( vols.size() == 0 ) 268 { 268 { 269 if(exists) << 269 if( exists ) 270 { 270 { 271 for(svite = theG4tgrVolumeMap.cbegin(); << 271 for( svite = theG4tgrVolumeMap.begin(); 272 svite != theG4tgrVolumeMap.cend(); + << 272 svite != theG4tgrVolumeMap.end(); svite++ ) 273 { 273 { 274 G4cerr << " VOL:" << (*svite).first << 274 G4cerr << " VOL:" << (*svite).first << G4endl; 275 } 275 } 276 G4String ErrMessage = "Volume not found. 276 G4String ErrMessage = "Volume not found... " + volname; 277 G4Exception("G4tgrVolumeMgr::FindVolumes 277 G4Exception("G4tgrVolumeMgr::FindVolumes()", "InvalidSetup", 278 FatalException, ErrMessage); 278 FatalException, ErrMessage); 279 } 279 } 280 else 280 else 281 { 281 { 282 G4String WarMessage = "Volume does not e 282 G4String WarMessage = "Volume does not exists... " + volname; 283 G4Exception("G4tgrVolumeMgr::FindVolumes << 283 G4Exception("G4tgrVolumeMgr::FindVolumes()", "SearchFailed", 284 WarMessage); << 284 JustWarning, WarMessage); 285 } 285 } 286 } 286 } 287 287 288 return vols; 288 return vols; 289 } 289 } 290 290 291 // ------------------------------------------- << 291 >> 292 //------------------------------------------------------------- 292 const G4tgrVolume* G4tgrVolumeMgr::GetTopVolum 293 const G4tgrVolume* G4tgrVolumeMgr::GetTopVolume() 293 { 294 { 294 //--- Start from any G4tgrVolume and go upwa 295 //--- Start from any G4tgrVolume and go upwards until you get to the top. 295 // Check that indeed all volumes drive to << 296 // Check that indeed all volumes drive to the same top volume 296 297 297 const G4tgrVolume* topVol = nullptr; << 298 const G4tgrVolume* topVol = 0; 298 for(auto itetv = theG4tgrVolumeMap.cbegin(); << 299 G4mapsvol::const_iterator itetv; 299 itetv != theG4tgrVolumeMap.cend(); << 300 for( itetv = theG4tgrVolumeMap.begin(); >> 301 itetv != theG4tgrVolumeMap.end(); itetv++ ) 300 { 302 { 301 const G4tgrVolume* vol = (*itetv).second; 303 const G4tgrVolume* vol = (*itetv).second; 302 #ifdef G4VERBOSE 304 #ifdef G4VERBOSE 303 if(G4tgrMessenger::GetVerboseLevel() >= 3) << 305 if( G4tgrMessenger::GetVerboseLevel() >= 3 ) 304 { 306 { 305 G4cout << " G4tgrVolumeMgr::GetTopVolume << 307 G4cout << " G4tgrVolumeMgr::GetTopVolume() - Vol: " 306 << " no place = " << vol->GetPlac << 308 << vol->GetName() << " no place = " >> 309 << vol->GetPlacements().size() << G4endl; 307 } 310 } 308 #endif 311 #endif 309 << 312 310 while(vol->GetPlacements().size() != 0) << 313 while( vol->GetPlacements().size() != 0 ) 311 { 314 { 312 vol = FindVolume((*(vol->GetPlacements() << 315 vol = FindVolume((*(vol->GetPlacements()).begin())->GetParentName(), 1); 313 #ifdef G4VERBOSE 316 #ifdef G4VERBOSE 314 if(G4tgrMessenger::GetVerboseLevel() >= << 317 if( G4tgrMessenger::GetVerboseLevel() >= 3 ) 315 { 318 { 316 G4cout << " G4tgrVolumeMgr::GetTopVolu << 319 G4cout << " G4tgrVolumeMgr::GetTopVolume() - Vol: " 317 << " N place = " << vol->GetPla << 320 << vol->GetName()<< " N place = " >> 321 << vol->GetPlacements().size() << G4endl; 318 } 322 } 319 #endif 323 #endif 320 } 324 } 321 if((topVol != nullptr) && (topVol != vol) << 325 if ( (topVol != 0) && (topVol != vol) 322 (topVol->GetType() != "VOLDivision") && << 326 && (topVol->GetType() != "VOLDivision") 323 (vol->GetType() != "VOLDivision")) << 327 && (vol->GetType() != "VOLDivision") ) 324 { 328 { 325 G4Exception("G4tgrVolumeMgr::GetTopVolum 329 G4Exception("G4tgrVolumeMgr::GetTopVolume()", 326 "Two world volumes found, se 330 "Two world volumes found, second will be taken", JustWarning, 327 (G4String("Both volumes are << 331 (G4String("Both volumes are at the top of a hierarchy: ") 328 topVol->GetName() + " & " + << 332 + topVol->GetName() + " & " + vol->GetName() ).c_str()); 329 .c_str()); << 330 } 333 } 331 topVol = vol; 334 topVol = vol; 332 } 335 } 333 336 334 return topVol; 337 return topVol; 335 } 338 } 336 339 337 // ------------------------------------------- << 340 >> 341 //------------------------------------------------------------- 338 std::pair<G4mmapspl::iterator, G4mmapspl::iter 342 std::pair<G4mmapspl::iterator, G4mmapspl::iterator> 339 G4tgrVolumeMgr::GetChildren(const G4String& na << 343 G4tgrVolumeMgr::GetChildren( const G4String& name ) 340 { 344 { 341 std::pair<G4mmapspl::iterator, G4mmapspl::it 345 std::pair<G4mmapspl::iterator, G4mmapspl::iterator> dite; 342 dite = theG4tgrVolumeTree.equal_range(name); << 346 dite = theG4tgrVolumeTree.equal_range( name ); 343 return dite; 347 return dite; 344 } 348 } 345 349 346 // ------------------------------------------- << 350 >> 351 //------------------------------------------------------------- 347 void G4tgrVolumeMgr::DumpVolumeTree() 352 void G4tgrVolumeMgr::DumpVolumeTree() 348 { 353 { 349 G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrVo 354 G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrVolume's Tree " << G4endl; 350 355 351 const G4tgrVolume* vol = GetTopVolume(); 356 const G4tgrVolume* vol = GetTopVolume(); 352 357 353 DumpVolumeLeaf(vol, 0, 0); << 358 DumpVolumeLeaf( vol, 0, 0); 354 } 359 } 355 360 356 // ------------------------------------------- << 361 357 void G4tgrVolumeMgr::DumpVolumeLeaf(const G4tg << 362 //------------------------------------------------------------- 358 unsigned i << 363 void G4tgrVolumeMgr::DumpVolumeLeaf( const G4tgrVolume* vol, >> 364 unsigned int copyNo, >> 365 unsigned int leafDepth) 359 { 366 { 360 for(std::size_t ii = 0; ii < leafDepth; ++ii << 367 for( size_t ii=0; ii < leafDepth; ii++ ) 361 { 368 { 362 G4cout << " "; 369 G4cout << " "; 363 } 370 } 364 G4cout << " VOL:(" << leafDepth << ")" << vo << 371 G4cout << " VOL:(" << leafDepth << ")" << vol->GetName() 365 << copyNo << G4endl; << 372 << " copy No " << copyNo << G4endl; 366 373 367 //---------- construct the children of this 374 //---------- construct the children of this VOL 368 std::pair<G4mmapspl::iterator, G4mmapspl::it << 375 std::pair<G4mmapspl::iterator, G4mmapspl::iterator> children 369 GetChildren(vol->GetName()); << 376 = GetChildren( vol->GetName() ); 370 G4mmapspl::const_iterator cite; << 377 G4mmapspl::const_iterator cite; 371 378 372 ++leafDepth; << 379 leafDepth++; 373 for(cite = children.first; cite != children. << 380 for( cite = children.first; cite != children.second; cite++ ) 374 { 381 { 375 //---- find G4tgrVolume pointed by G4tgrPl 382 //---- find G4tgrVolume pointed by G4tgrPlace 376 const G4tgrPlace* pla = (*cite).seco << 383 const G4tgrPlace* pla = (*cite).second; 377 const G4tgrVolume* volchild = pla->GetVolu 384 const G4tgrVolume* volchild = pla->GetVolume(); 378 //--- find copyNo 385 //--- find copyNo 379 unsigned int cn = pla->GetCopyNo(); 386 unsigned int cn = pla->GetCopyNo(); 380 DumpVolumeLeaf(volchild, cn, leafDepth); << 387 DumpVolumeLeaf( volchild, cn, leafDepth ); 381 } 388 } 382 } 389 } 383 390 384 // ------------------------------------------- << 391 >> 392 //------------------------------------------------------------- 385 void G4tgrVolumeMgr::DumpSummary() 393 void G4tgrVolumeMgr::DumpSummary() 386 { 394 { 387 //---------- Dump number of objects of each 395 //---------- Dump number of objects of each class 388 G4cout << " @@@@@@@@@@@@@@@@@@ Dumping Detec 396 G4cout << " @@@@@@@@@@@@@@@@@@ Dumping Detector Summary " << G4endl; 389 G4cout << " @@@ Geometry built inside world 397 G4cout << " @@@ Geometry built inside world volume: " 390 << GetTopVolume()->GetName() << G4end 398 << GetTopVolume()->GetName() << G4endl; 391 G4cout << " Number of G4tgrVolume's: " << th << 399 G4cout << " Number of G4tgrVolume's: " >> 400 << theG4tgrVolumeMap.size() << G4endl; >> 401 G4mapsvol::const_iterator cite; 392 unsigned int nPlace = 0; 402 unsigned int nPlace = 0; 393 for(auto cite = theG4tgrVolumeMap.cbegin(); << 403 for( cite = theG4tgrVolumeMap.begin(); 394 cite != theG4tgrVolumeMap.cend(); ++cite << 404 cite != theG4tgrVolumeMap.end(); cite++ ) 395 { 405 { 396 nPlace += ((*cite).second)->GetPlacements( 406 nPlace += ((*cite).second)->GetPlacements().size(); 397 } 407 } 398 G4cout << " Number of G4tgrPlace's: " << nPl 408 G4cout << " Number of G4tgrPlace's: " << nPlace << G4endl; 399 409 400 G4tgrMaterialFactory* matef = G4tgrMaterialF 410 G4tgrMaterialFactory* matef = G4tgrMaterialFactory::GetInstance(); 401 G4cout << " Number of G4tgrIsotope's: " << m << 411 G4cout << " Number of G4tgrIsotope's: " 402 << G4endl; << 412 << matef->GetIsotopeList().size() << G4endl; 403 G4cout << " Number of G4tgrElement's: " << m << 413 G4cout << " Number of G4tgrElement's: " 404 << G4endl; << 414 << matef->GetElementList().size() << G4endl; 405 G4cout << " Number of G4tgrMaterial's: " << << 415 G4cout << " Number of G4tgrMaterial's: " 406 << G4endl; << 416 << matef->GetMaterialList().size() << G4endl; 407 417 408 G4tgrRotationMatrixFactory* rotmf = G4tgrRot 418 G4tgrRotationMatrixFactory* rotmf = G4tgrRotationMatrixFactory::GetInstance(); 409 G4cout << " Number of G4tgrRotationMatrix's: 419 G4cout << " Number of G4tgrRotationMatrix's: " 410 << rotmf->GetRotMatList().size() << G 420 << rotmf->GetRotMatList().size() << G4endl; 411 421 >> 422 412 //---------- Dump detail list of objects of 423 //---------- Dump detail list of objects of each class 413 DumpVolumeTree(); 424 DumpVolumeTree(); 414 << 425 415 matef->DumpIsotopeList(); 426 matef->DumpIsotopeList(); 416 matef->DumpElementList(); 427 matef->DumpElementList(); 417 matef->DumpMaterialList(); 428 matef->DumpMaterialList(); 418 rotmf->DumpRotmList(); 429 rotmf->DumpRotmList(); 419 } 430 } 420 431