--------------------------------------------------------------------
| 198 | |
| 199 | // -------------------------------------------------------------------- |
| 200 | void G4VUserPhysicsList::InitializeProcessManager() |
| 201 | { |
| 202 | // Request lock for particle table access. Some changes are inside |
| 203 | // this critical region. |
| 204 | #ifdef G4MULTITHREADED |
| 205 | G4MUTEXLOCK(&G4ParticleTable::particleTableMutex()); |
| 206 | G4ParticleTable::lockCount()++; |
| 207 | #endif |
| 208 | G4ParticleDefinition* gion = G4ParticleTable::GetParticleTable()->GetGenericIon(); |
| 209 | |
| 210 | // loop over all particles in G4ParticleTable |
| 211 | theParticleIterator->reset(); |
| 212 | while ((*theParticleIterator)()) { |
| 213 | G4ParticleDefinition* particle = theParticleIterator->value(); |
| 214 | G4ProcessManager* pmanager = particle->GetProcessManager(); |
| 215 | |
| 216 | if (pmanager == nullptr) { |
| 217 | // create process manager if the particle does not have its own. |
| 218 | pmanager = new G4ProcessManager(particle); |
| 219 | particle->SetProcessManager(pmanager); |
| 220 | if (particle->GetMasterProcessManager() == nullptr) |
| 221 | particle->SetMasterProcessManager(pmanager); |
| 222 | #ifdef G4VERBOSE |
| 223 | if (verboseLevel > 2) { |
| 224 | G4cout << "G4VUserPhysicsList::InitializeProcessManager: creating " |
| 225 | "ProcessManager to " |
| 226 | << particle->GetParticleName() << G4endl; |
| 227 | } |
| 228 | #endif |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | if (gion != nullptr) { |
| 233 | G4ProcessManager* gionPM = gion->GetProcessManager(); |
| 234 | // loop over all particles once again (this time, with all general ions) |
| 235 | theParticleIterator->reset(false); |
| 236 | while ((*theParticleIterator)()) { |
| 237 | G4ParticleDefinition* particle = theParticleIterator->value(); |
| 238 | if (particle->IsGeneralIon()) { |
| 239 | particle->SetProcessManager(gionPM); |
| 240 | #ifdef G4VERBOSE |
| 241 | if (verboseLevel > 2) { |
| 242 | G4cout << "G4VUserPhysicsList::InitializeProcessManager: copying " |
| 243 | "ProcessManager to " |
| 244 | << particle->GetParticleName() << G4endl; |
| 245 | } |
| 246 | #endif |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | // release lock for particle table access |
| 252 | #ifdef G4MULTITHREADED |
| 253 | G4MUTEXUNLOCK(&G4ParticleTable::particleTableMutex()); |
| 254 | #endif |
| 255 | } |
| 256 | |
| 257 | // -------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected