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