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 // G4MTRunManagerKernel implementation << 27 // << 28 // Author: M.Asai - July 2013 << 29 // ------------------------------------------- << 30 #include "G4MTRunManagerKernel.hh" << 31 26 32 #include "G4AutoLock.hh" << 27 #include "G4MTRunManagerKernel.hh" 33 #include "G4DecayTable.hh" << 34 #include "G4LogicalVolume.hh" << 35 #include "G4Material.hh" << 36 #include "G4MaterialTable.hh" << 37 #include "G4PVParameterised.hh" << 38 #include "G4PVReplica.hh" << 39 #include "G4ParticleDefinition.hh" << 40 #include "G4ParticleTable.hh" << 41 #include "G4ParticleTableIterator.hh" << 42 #include "G4PhysicalVolumeStore.hh" << 43 #include "G4PhysicsVector.hh" << 44 #include "G4PolyconeSide.hh" << 45 #include "G4PolyhedraSide.hh" << 46 #include "G4Region.hh" << 47 #include "G4RegionStore.hh" 28 #include "G4RegionStore.hh" 48 #include "G4StateManager.hh" 29 #include "G4StateManager.hh" 49 #include "G4UImanager.hh" << 30 #include "G4AutoLock.hh" 50 #include "G4UserWorkerInitialization.hh" << 51 #include "G4UserWorkerThreadInitialization.hh" << 52 #include "G4VDecayChannel.hh" << 53 #include "G4VModularPhysicsList.hh" << 54 #include "G4VPhysicalVolume.hh" << 55 #include "G4VPhysicsConstructor.hh" << 56 #include "G4VUserActionInitialization.hh" << 57 #include "G4VUserPhysicsList.hh" << 58 #include "G4WorkerRunManager.hh" << 59 #include "G4WorkerThread.hh" << 60 << 61 std::vector<G4WorkerRunManager*>* G4MTRunManag << 62 31 63 G4ThreadLocal G4WorkerThread* G4MTRunManagerKe << 32 std::vector<G4WorkerRunManager*>* G4MTRunManagerKernel::workerRMvector = 0; 64 33 65 // ------------------------------------------- << 34 namespace { 66 namespace << 35 G4Mutex workerRMMutex = G4MUTEX_INITIALIZER; 67 { << 68 G4Mutex workerRMMutex = G4MUTEX_INITIALIZER; << 69 } 36 } 70 37 71 // ------------------------------------------- << 72 G4MTRunManagerKernel::G4MTRunManagerKernel() : 38 G4MTRunManagerKernel::G4MTRunManagerKernel() : G4RunManagerKernel(masterRMK) 73 { 39 { 74 // This version of the constructor should ne << 40 //This version of the constructor should never be called in sequential mode! 75 #ifndef G4MULTITHREADED 41 #ifndef G4MULTITHREADED 76 G4ExceptionDescription msg; << 42 G4ExceptionDescription msg; 77 msg << "Geant4 code is compiled without mult << 43 msg<<"Geant4 code is compiled without multi-threading support (-DG4MULTITHREADED is set to off)."; 78 "(-DG4MULTITHREADED " << 44 msg<<" This type of RunManager can only be used in mult-threaded applications."; 79 "is set to off)."; << 45 G4Exception("G4RunManagerKernel::G4RunManagerKernel()","Run0035",FatalException,msg); 80 msg << " This type of RunManager can only be << 81 "applications."; << 82 G4Exception("G4RunManagerKernel::G4RunManage << 83 #endif 46 #endif 84 G4AutoLock l(&workerRMMutex); << 47 if(!workerRMvector) workerRMvector = new std::vector<G4WorkerRunManager*>; 85 if (workerRMvector == nullptr) workerRMvecto << 86 l.unlock(); << 87 // Set flag that a MT-type kernel has been i << 88 G4Threading::SetMultithreadedApplication(tru << 89 } 48 } 90 49 91 // ------------------------------------------- << 92 G4MTRunManagerKernel::~G4MTRunManagerKernel() 50 G4MTRunManagerKernel::~G4MTRunManagerKernel() 93 { 51 { 94 G4AutoLock l(&workerRMMutex); << 52 if(!workerRMvector) 95 if (workerRMvector != nullptr) { << 53 { 96 if (!workerRMvector->empty()) { << 54 if(workerRMvector->size()>0) 97 G4ExceptionDescription msg; << 55 { 98 msg << "G4MTRunManagerKernel is to be de << 56 G4ExceptionDescription msg; 99 << " G4WorkerRunManager are still al << 57 msg<<"G4MTRunManagerKernel is to be deleted while " 100 G4Exception("G4RunManagerKernel::~G4RunM << 58 <<workerRMvector->size()<<" G4WorkerRunManager are still alive."; 101 } << 59 G4Exception("G4RunManagerKernel::~G4RunManagerKernel()", 102 delete workerRMvector; << 60 "Run10035",FatalException,msg); 103 workerRMvector = nullptr; << 61 } 104 } << 62 delete workerRMvector; >> 63 workerRMvector = 0; >> 64 } 105 } 65 } 106 66 107 // ------------------------------------------- << 108 void G4MTRunManagerKernel::SetupShadowProcess( 67 void G4MTRunManagerKernel::SetupShadowProcess() const 109 { 68 { 110 // Behavior is the same as base class (seque << 69 //Behavior is the same as base class (sequential mode) 111 // ShadowProcess pointer == process poitner << 70 //ShadowProcess pointer == process poitner 112 G4RunManagerKernel::SetupShadowProcess(); << 71 G4RunManagerKernel::SetupShadowProcess(); 113 } 72 } 114 73 115 // ------------------------------------------- << 74 #include "G4WorkerRunManager.hh" 116 G4WorkerThread* G4MTRunManagerKernel::GetWorke << 75 #include "G4UserWorkerInitialization.hh" 117 { << 76 #include "G4UserWorkerThreadInitialization.hh" 118 return wThreadContext; << 77 #include "G4VUserActionInitialization.hh" 119 } << 78 #include "G4WorkerThread.hh" >> 79 #include "G4UImanager.hh" >> 80 #include "G4LogicalVolume.hh" >> 81 #include "G4VPhysicalVolume.hh" >> 82 #include "G4PVReplica.hh" >> 83 #include "G4Region.hh" >> 84 #include "G4Material.hh" >> 85 #include "G4PhysicsVector.hh" >> 86 #include "G4VDecayChannel.hh" >> 87 #include "G4PhysicalVolumeStore.hh" >> 88 #include "G4MaterialTable.hh" >> 89 #include "G4PolyconeSide.hh" >> 90 #include "G4PolyhedraSide.hh" >> 91 #include "G4PVParameterised.hh" >> 92 #include "G4VUserPhysicsList.hh" >> 93 #include "G4VPhysicsConstructor.hh" >> 94 #include "G4VModularPhysicsList.hh" >> 95 >> 96 G4ThreadLocal G4WorkerThread* G4MTRunManagerKernel::wThreadContext = 0; >> 97 G4WorkerThread* G4MTRunManagerKernel::GetWorkerThread() >> 98 { return wThreadContext; } 120 99 121 // ------------------------------------------- << 100 void* G4MTRunManagerKernel::StartThread(void* context) 122 void G4MTRunManagerKernel::StartThread(G4Worke << 123 { 101 { 124 //!!!!!!!!!!!!!!!!!!!!!!!!!! 102 //!!!!!!!!!!!!!!!!!!!!!!!!!! 125 //!!!!!! IMPORTANT !!!!!!!!! 103 //!!!!!! IMPORTANT !!!!!!!!! 126 //!!!!!!!!!!!!!!!!!!!!!!!!!! 104 //!!!!!!!!!!!!!!!!!!!!!!!!!! 127 // Here is not sequential anymore and G4User 105 // Here is not sequential anymore and G4UserWorkerThreadInitialization is 128 // a shared user initialization class. << 106 // a shared user initialization class 129 // This means this method cannot use data me << 107 // This means this method cannot use data memebers of G4RunManagerKernel 130 // unless they are invariant ("read-only") a 108 // unless they are invariant ("read-only") and can be safely shared. 131 // All the rest that is not invariant should << 109 // All the rest that is not invariant should be incapsualted into 132 // the context (or, as for wThreadContext be << 110 // the context (or, as for wThreadContext be G4ThreadLocal) 133 //!!!!!!!!!!!!!!!!!!!!!!!!!! 111 //!!!!!!!!!!!!!!!!!!!!!!!!!! 134 // #ifdef G4MULTITHREADED << 112 //#ifdef G4MULTITHREADED 135 // turnontpmalloc(); << 113 // turnontpmalloc(); 136 // #endif << 114 //#endif 137 G4Threading::WorkerThreadJoinsPool(); << 115 138 wThreadContext = context; << 116 wThreadContext = static_cast<G4WorkerThread*>(context); 139 G4MTRunManager* masterRM = G4MTRunManager::G 117 G4MTRunManager* masterRM = G4MTRunManager::GetMasterRunManager(); 140 118 141 //============================ 119 //============================ 142 // Step-0: Thread ID << 120 //Step-0: Thread ID 143 //============================ 121 //============================ 144 // Initialise per-thread stream-output << 122 //Initliazie per-thread stream-output 145 // The following line is needed before we ac << 123 //The following line is needed before we actually do IO initialization 146 // because the constructor of UI manager res << 124 //becasue the constructor of UI manager resets the IO destination. 147 G4int thisID = wThreadContext->GetThreadId() 125 G4int thisID = wThreadContext->GetThreadId(); 148 G4Threading::G4SetThreadId(thisID); 126 G4Threading::G4SetThreadId(thisID); 149 G4UImanager::GetUIpointer()->SetUpForAThread 127 G4UImanager::GetUIpointer()->SetUpForAThread(thisID); 150 128 151 //============================ 129 //============================ 152 // Optimization: optional << 130 //Step-1: Random number engine 153 //============================ << 154 // Enforce thread affinity if requested << 155 wThreadContext->SetPinAffinity(masterRM->Get << 156 << 157 //============================ << 158 // Step-1: Random number engine << 159 //============================ 131 //============================ 160 // RNG Engine needs to be initialised by "cl << 132 //RNG Engine needs to be initialized by "cloning" the master one. 161 const CLHEP::HepRandomEngine* masterEngine = 133 const CLHEP::HepRandomEngine* masterEngine = masterRM->getMasterRandomEngine(); 162 masterRM->GetUserWorkerThreadInitialization( 134 masterRM->GetUserWorkerThreadInitialization()->SetupRNGEngine(masterEngine); 163 135 164 //============================ 136 //============================ 165 // Step-2: Initialise worker thread << 137 //Step-2: Initialize worker thread 166 //============================ 138 //============================ 167 if (masterRM->GetUserWorkerInitialization() << 139 if(masterRM->GetUserWorkerInitialization()) 168 masterRM->GetUserWorkerInitialization()->W << 140 { masterRM->GetUserWorkerInitialization()->WorkerInitialize(); } 169 } << 141 if(masterRM->GetUserActionInitialization()) 170 if (masterRM->GetUserActionInitialization() << 142 { 171 G4VSteppingVerbose* sv = masterRM->GetUser << 143 G4VSteppingVerbose* sv = masterRM->GetUserActionInitialization()->InitializeSteppingVerbose(); 172 if (sv != nullptr) { << 144 if ( sv ) { G4VSteppingVerbose::SetInstance(sv); } 173 G4VSteppingVerbose::SetInstance(sv); << 174 } << 175 } 145 } 176 // Now initialise worker part of shared obje << 146 //Now initialize worker part of shared objects (geometry/physics) 177 G4WorkerThread::BuildGeometryAndPhysicsVecto << 147 wThreadContext->BuildGeometryAndPhysicsVector(); 178 G4WorkerRunManager* wrm = masterRM->GetUserW << 148 G4WorkerRunManager* wrm >> 149 = masterRM->GetUserWorkerThreadInitialization()->CreateWorkerRunManager(); 179 wrm->SetWorkerThread(wThreadContext); 150 wrm->SetWorkerThread(wThreadContext); 180 G4AutoLock wrmm(&workerRMMutex); 151 G4AutoLock wrmm(&workerRMMutex); 181 workerRMvector->push_back(wrm); 152 workerRMvector->push_back(wrm); 182 wrmm.unlock(); 153 wrmm.unlock(); 183 154 184 //================================ 155 //================================ 185 // Step-3: Setup worker run manager << 156 //Step-3: Setup worker run manager 186 //================================ 157 //================================ 187 // Set the detector and physics list to the 158 // Set the detector and physics list to the worker thread. Share with master 188 const G4VUserDetectorConstruction* detector 159 const G4VUserDetectorConstruction* detector = masterRM->GetUserDetectorConstruction(); 189 wrm->G4RunManager::SetUserInitialization(con 160 wrm->G4RunManager::SetUserInitialization(const_cast<G4VUserDetectorConstruction*>(detector)); 190 const G4VUserPhysicsList* physicslist = mast 161 const G4VUserPhysicsList* physicslist = masterRM->GetUserPhysicsList(); 191 wrm->SetUserInitialization(const_cast<G4VUse 162 wrm->SetUserInitialization(const_cast<G4VUserPhysicsList*>(physicslist)); 192 163 193 //================================ 164 //================================ 194 // Step-4: Initialise worker run manager << 165 //Step-4: Initialize worker run manager 195 //================================ 166 //================================ 196 if (masterRM->GetUserActionInitialization() << 167 if(masterRM->GetUserActionInitialization()) 197 masterRM->GetNonConstUserActionInitializat << 168 { masterRM->GetNonConstUserActionInitialization()->Build(); } 198 } << 169 if(masterRM->GetUserWorkerInitialization()) 199 if (masterRM->GetUserWorkerInitialization() << 170 { masterRM->GetUserWorkerInitialization()->WorkerStart(); } 200 masterRM->GetUserWorkerInitialization()->W << 201 } << 202 wrm->Initialize(); 171 wrm->Initialize(); 203 172 204 //================================ 173 //================================ 205 // Step5: Loop over requests from the master << 174 //Step5: Loop over requests from the master thread 206 //================================ 175 //================================ 207 // This function should enter a loop process << 176 G4MTRunManager::WorkerActionRequest nextAction = masterRM->ThisWorkerWaitForNextAction(); 208 // requests from master. It should block unt << 177 while( nextAction != G4MTRunManager::ENDWORKER ) 209 // to terminate << 178 { 210 wrm->DoWork(); << 179 if( nextAction == G4MTRunManager::NEXTITERATION ) // start the next run >> 180 { >> 181 //The following code deals with changing materials between runs >> 182 static G4ThreadLocal G4bool skipInitialization = true; >> 183 if(skipInitialization) >> 184 { >> 185 // re-initialization is not necessary for the first run >> 186 skipInitialization = false; >> 187 } >> 188 else >> 189 { >> 190 // ReinitializeGeometry(); >> 191 wThreadContext->UpdateGeometryAndPhysicsVectorFromMaster(); >> 192 } >> 193 >> 194 // Execute UI commands stored in the masther UI manager >> 195 std::vector<G4String> cmds = masterRM->GetCommandStack(); >> 196 G4UImanager* uimgr = G4UImanager::GetUIpointer(); //TLS instance >> 197 std::vector<G4String>::const_iterator it = cmds.begin(); >> 198 for(;it!=cmds.end();it++) >> 199 { uimgr->ApplyCommand(*it); } >> 200 //Start this run >> 201 G4int numevents = masterRM->GetNumberOfEventsToBeProcessed(); >> 202 G4String macroFile = masterRM->GetSelectMacro(); >> 203 G4int numSelect = masterRM->GetNumberOfSelectEvents(); >> 204 if ( macroFile == "" || macroFile == " " ) >> 205 { >> 206 wrm->BeamOn(numevents,0,numSelect); >> 207 } >> 208 else >> 209 { >> 210 wrm->BeamOn(numevents,macroFile,numSelect); >> 211 } >> 212 } >> 213 else >> 214 { >> 215 G4ExceptionDescription d; >> 216 d<<"Cannot continue, this worker has been requested an unknwon action: " >> 217 <<nextAction<<" expecting: ENDWORKER(=" <<G4MTRunManager::ENDWORKER >> 218 <<") or NEXTITERATION(="<<G4MTRunManager::NEXTITERATION<<")"; >> 219 G4Exception("G4MTRunManagerKernel::StartThread","Run0035",FatalException,d); >> 220 } >> 221 >> 222 //Now wait for master thread to signal new action to be performed >> 223 nextAction = masterRM->ThisWorkerWaitForNextAction(); >> 224 } //No more actions to perform 211 225 212 //=============================== 226 //=============================== 213 // Step-6: Terminate worker thread << 227 //Step-6: Terminate worker thread 214 //=============================== 228 //=============================== 215 if (masterRM->GetUserWorkerInitialization() << 229 if(masterRM->GetUserWorkerInitialization()) 216 masterRM->GetUserWorkerInitialization()->W << 230 { masterRM->GetUserWorkerInitialization()->WorkerStop(); } 217 } << 218 231 219 wrmm.lock(); 232 wrmm.lock(); 220 for (auto itrWrm = workerRMvector->cbegin(); << 233 std::vector<G4WorkerRunManager*>::iterator itrWrm = workerRMvector->begin(); 221 if ((*itrWrm) == wrm) { << 234 for(;itrWrm!=workerRMvector->end();itrWrm++) >> 235 { >> 236 if((*itrWrm)==wrm) >> 237 { 222 workerRMvector->erase(itrWrm); 238 workerRMvector->erase(itrWrm); 223 break; 239 break; 224 } 240 } 225 } 241 } 226 wrmm.unlock(); 242 wrmm.unlock(); 227 delete wrm; 243 delete wrm; >> 244 wThreadContext->DestroyGeometryAndPhysicsVector(); >> 245 wThreadContext = 0; 228 246 229 //=============================== << 247 return static_cast<void*>(0); 230 // Step-7: Cleanup split classes << 231 //=============================== << 232 G4WorkerThread::DestroyGeometryAndPhysicsVec << 233 wThreadContext = nullptr; << 234 << 235 G4Threading::WorkerThreadLeavesPool(); << 236 } 248 } 237 249 238 // ------------------------------------------- << 250 //Now moved to G4WorkerThread >> 251 //void G4MTRunManagerKernel::ReinitializeGeometry() >> 252 //{ >> 253 // G4AutoLock wrmm(&workerRMMutex); >> 254 // //================================================= >> 255 // //Step-0: keep sensitive detector and field manager >> 256 // //================================================= >> 257 // typedef std::map<G4LogicalVolume*,std::pair<G4VSensitiveDetector*,G4FieldManager*> > LV2SDFM; >> 258 // LV2SDFM lvmap; >> 259 // G4PhysicalVolumeStore* mphysVolStore = G4PhysicalVolumeStore::GetInstance(); >> 260 // for(size_t ip=0;ip<mphysVolStore->size();ip++) >> 261 // { >> 262 // G4VPhysicalVolume* pv = (*mphysVolStore)[ip]; >> 263 // G4LogicalVolume *lv = pv->GetLogicalVolume(); >> 264 // G4VSensitiveDetector* sd = lv->GetSensitiveDetector(); >> 265 // G4FieldManager* fm = lv->GetFieldManager(); >> 266 // if(sd||fm) lvmap[lv] = std::make_pair(sd,fm); >> 267 // } >> 268 // >> 269 // //=========================== >> 270 // //Step-1: Clean the instances >> 271 // //=========================== >> 272 // const_cast<G4LVManager&>(G4LogicalVolume::GetSubInstanceManager()).FreeSlave(); >> 273 // const_cast<G4PVManager&>(G4VPhysicalVolume::GetSubInstanceManager()).FreeSlave(); >> 274 // const_cast<G4PVRManager&>(G4PVReplica::GetSubInstanceManager()).FreeSlave(); >> 275 // const_cast<G4RegionManager&>(G4Region::GetSubInstanceManager()).FreeSlave(); >> 276 // const_cast<G4PlSideManager&>(G4PolyconeSide::GetSubInstanceManager()).FreeSlave(); >> 277 // const_cast<G4PhSideManager&>(G4PolyhedraSide::GetSubInstanceManager()).FreeSlave(); >> 278 // >> 279 // //=========================== >> 280 // //Step-2: Re-create instances >> 281 // //=========================== >> 282 // const_cast<G4LVManager&>(G4LogicalVolume::GetSubInstanceManager()).SlaveCopySubInstanceArray(); >> 283 // const_cast<G4PVManager&>(G4VPhysicalVolume::GetSubInstanceManager()).SlaveCopySubInstanceArray(); >> 284 // const_cast<G4PVRManager&>(G4PVReplica::GetSubInstanceManager()).SlaveCopySubInstanceArray(); >> 285 // const_cast<G4RegionManager&>(G4Region::GetSubInstanceManager()).SlaveInitializeSubInstance(); >> 286 // const_cast<G4PlSideManager&>(G4PolyconeSide::GetSubInstanceManager()).SlaveInitializeSubInstance(); >> 287 // const_cast<G4PhSideManager&>(G4PolyhedraSide::GetSubInstanceManager()).SlaveInitializeSubInstance(); >> 288 // >> 289 // //=============================== >> 290 // //Step-3: Re-initialize instances >> 291 // //=============================== >> 292 // for(size_t ip=0;ip<mphysVolStore->size();ip++) >> 293 // { >> 294 // G4VPhysicalVolume* physVol = (*mphysVolStore)[ip]; >> 295 // G4LogicalVolume* g4LogicalVolume = physVol->GetLogicalVolume(); >> 296 // G4VSolid* g4VSolid = g4LogicalVolume->GetMasterSolid(); // shadow pointer >> 297 // G4PVReplica* g4PVReplica = 0; >> 298 // g4PVReplica = dynamic_cast<G4PVReplica*>(physVol); >> 299 // if(g4PVReplica) // if the volume is a replica >> 300 // { >> 301 // G4VSolid *slaveg4VSolid = g4VSolid->Clone(); >> 302 // g4LogicalVolume->InitialiseWorker(g4LogicalVolume,slaveg4VSolid,0); >> 303 // } >> 304 // else >> 305 // { g4LogicalVolume->InitialiseWorker(g4LogicalVolume,g4VSolid,0); } >> 306 // } >> 307 // >> 308 // //=================================================== >> 309 // //Step-4: Restore sensitive detector and field manaer >> 310 // //=================================================== >> 311 // LV2SDFM::const_iterator it = lvmap.begin(); >> 312 // for(; it!=lvmap.end() ; ++it ) >> 313 // { >> 314 // G4LogicalVolume* lv = it->first; >> 315 // G4VSensitiveDetector* sd = (it->second).first; >> 316 // G4FieldManager* fm = (it->second).second; >> 317 // lv->SetFieldManager(fm, false); >> 318 // lv->SetSensitiveDetector(sd); >> 319 // } >> 320 // wrmm.unlock(); >> 321 //} >> 322 >> 323 #include "G4ParticleDefinition.hh" >> 324 #include "G4ParticleTable.hh" >> 325 #include "G4ParticleTableIterator.hh" >> 326 #include "G4DecayTable.hh" >> 327 #include "G4VDecayChannel.hh" >> 328 239 void G4MTRunManagerKernel::SetUpDecayChannels( 329 void G4MTRunManagerKernel::SetUpDecayChannels() 240 { 330 { 241 auto pItr = G4ParticleTable::GetParticleTabl << 331 G4ParticleTable::G4PTblDicIterator* pItr >> 332 = G4ParticleTable::GetParticleTable()->GetIterator(); 242 pItr->reset(); 333 pItr->reset(); 243 while ((*pItr)()) { << 334 while((*pItr)()) >> 335 { 244 G4DecayTable* dt = pItr->value()->GetDecay 336 G4DecayTable* dt = pItr->value()->GetDecayTable(); 245 if (dt != nullptr) { << 337 if(dt) >> 338 { 246 G4int nCh = dt->entries(); 339 G4int nCh = dt->entries(); 247 for (G4int i = 0; i < nCh; ++i) { << 340 for(G4int i=0;i<nCh;i++) 248 dt->GetDecayChannel(i)->GetDaughter(0) << 341 { dt->GetDecayChannel(i)->GetDaughter(0); } 249 } << 250 } 342 } 251 } 343 } 252 } 344 } 253 345 254 // ------------------------------------------- << 255 void G4MTRunManagerKernel::BroadcastAbortRun(G 346 void G4MTRunManagerKernel::BroadcastAbortRun(G4bool softAbort) 256 { 347 { 257 G4AutoLock wrmm(&workerRMMutex); 348 G4AutoLock wrmm(&workerRMMutex); 258 << 349 std::vector<G4WorkerRunManager*>::iterator itr = workerRMvector->begin(); 259 for (const auto& itr : *workerRMvector) { << 350 for(;itr!=workerRMvector->end();itr++) 260 itr->AbortRun(softAbort); << 351 { (*itr)->AbortRun(softAbort); } 261 } << 262 } 352 } >> 353 263 354