#include <G4PhysicsListHelper.hh>
Public Member Functions | |
G4bool | RegisterProcess (G4VProcess *process, G4ParticleDefinition *particle) |
void | AddTransportation () |
void | UseCoupledTransportation (G4bool vl=true) |
void | CheckParticleList () const |
void | DumpOrdingParameterTable (G4int subType=-1) const |
G4PhysicsListOrderingParameter | GetOrdingParameter (G4int subType) const |
void | SetVerboseLevel (G4int value) |
G4int | GetVerboseLevel () const |
Static Public Member Functions | |
static G4PhysicsListHelper * | GetPhysicsListHelper () |
Definition at line 50 of file G4PhysicsListHelper.hh.
void G4PhysicsListHelper::AddTransportation | ( | ) |
Definition at line 205 of file G4PhysicsListHelper.cc.
References G4ProcessManager::AddProcess(), FatalException, G4cout, G4endl, G4Exception(), G4RunManagerKernel::GetNumberOfParallelWorld(), G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetProcessManager(), G4RunManagerKernel::GetRunManagerKernel(), G4ScoringManager::GetScoringManagerIfExist(), idxAlongStep, idxPostStep, G4ParticleTableIterator< K, V >::reset(), G4ProcessManager::SetProcessOrderingToFirst(), and G4ParticleTableIterator< K, V >::value().
Referenced by G4VUserPhysicsList::AddTransportation().
00206 { 00207 G4int verboseLevelTransport = 0; 00208 00209 #ifdef G4VERBOSE 00210 if (verboseLevel >2){ 00211 G4cout << "G4PhysicsListHelper::AddTransportation() "<< G4endl; 00212 } 00213 #endif 00214 00215 G4int nParaWorld = 00216 G4RunManagerKernel::GetRunManagerKernel()->GetNumberOfParallelWorld(); 00217 00218 if ( nParaWorld>0 || 00219 useCoupledTransportation || 00220 G4ScoringManager::GetScoringManagerIfExist()) { 00221 #ifdef G4VERBOSE 00222 if (verboseLevel >0) { 00223 G4cout << " G4PhysicsListHelper::AddTransportation()" 00224 << "--- G4CoupledTransportation is used " 00225 << G4endl; 00226 } 00227 #endif 00228 theTransportationProcess = new G4CoupledTransportation(verboseLevelTransport); 00229 } else { 00230 theTransportationProcess = new G4Transportation(verboseLevelTransport); 00231 } 00232 00233 // loop over all particles in G4ParticleTable 00234 theParticleIterator->reset(); 00235 while( (*theParticleIterator)() ){ 00236 G4ParticleDefinition* particle = theParticleIterator->value(); 00237 G4ProcessManager* pmanager = particle->GetProcessManager(); 00238 // Add transportation process for all particles 00239 if ( pmanager == 0) { 00240 // Error !! no process manager 00241 #ifdef G4VERBOSE 00242 if (verboseLevel>0){ 00243 G4cout << "G4PhysicsListHelper::AddTransportation " 00244 <<" : No Process Manager for " 00245 << particle->GetParticleName() << G4endl; 00246 } 00247 #endif 00248 G4Exception("G4PhysicsListHelper::AddTransportation", 00249 "Run0104", FatalException, 00250 "No process manager"); 00251 continue; 00252 } 00253 // add transportation with ordering = ( -1, "first", "first" ) 00254 pmanager ->AddProcess(theTransportationProcess); 00255 pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxAlongStep); 00256 pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxPostStep); 00257 } 00258 }
void G4PhysicsListHelper::CheckParticleList | ( | ) | const |
Definition at line 97 of file G4PhysicsListHelper.cc.
References FatalException, fElectromagnetic, G4cout, G4endl, G4Exception(), G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetParticleType(), G4ParticleDefinition::GetPDGCharge(), G4ProcessManager::GetProcessList(), G4ParticleDefinition::GetProcessManager(), G4ParticleTableIterator< K, V >::reset(), G4ProcessVector::size(), and G4ParticleTableIterator< K, V >::value().
Referenced by G4VUserPhysicsList::CheckParticleList().
00098 { 00099 bool isElectron = false; 00100 bool isPositron = false; 00101 bool isGamma = false; 00102 bool isProton = false; 00103 bool isGenericIon = false; 00104 bool isAnyIon = false; 00105 bool isAnyChargedBaryon = false; 00106 bool isEmProc = false; 00107 00108 // loop over all particles in G4ParticleTable 00109 theParticleIterator->reset(); 00110 while( (*theParticleIterator)() ){ 00111 G4ParticleDefinition* particle = theParticleIterator->value(); 00112 G4String name = particle->GetParticleName(); 00113 // check if any EM process exists 00114 if (!isEmProc) { 00115 G4ProcessVector* list = particle->GetProcessManager()->GetProcessList(); 00116 for (int idx=0; idx<list->size(); idx++){ 00117 isEmProc = ((*list)[idx])->GetProcessType() == fElectromagnetic; 00118 if (isEmProc) break; 00119 } 00120 } 00121 00122 if ( name == "e-") isElectron = true; 00123 else if ( name == "e+") isPositron = true; 00124 else if ( name == "gamma") isGamma = true; 00125 else if ( name == "GenericIon") isGenericIon = true; 00126 else if ( name == "proton") isProton = true; 00127 else if ( particle->GetParticleType() == "nucleus") isAnyIon = true; 00128 else if ( particle->GetParticleType() == "baryon") { 00129 if ( particle->GetPDGCharge() != 0.0 ) isAnyChargedBaryon = true; 00130 } 00131 } 00132 00133 if (!isEmProc) return; 00134 00135 // RULE 1 00136 // e+, e- and gamma should exist 00137 // if one of them exist 00138 bool isEmBasic = isElectron || isPositron || isGamma; 00139 bool isMissingEmBasic = !isElectron || !isPositron || !isGamma; 00140 if (isEmBasic && isMissingEmBasic) { 00141 G4String missingName=""; 00142 if (!isElectron) missingName += "e- "; 00143 if (!isPositron) missingName += "e+ "; 00144 if (!isGamma) missingName += "gamma "; 00145 00146 #ifdef G4VERBOSE 00147 if (verboseLevel >0){ 00148 G4cout << "G4PhysicsListHelper::CheckParticleList: " 00149 << missingName << " do not exist " << G4endl; 00150 G4cout << " These particle are necessary for basic EM processes" 00151 << G4endl; 00152 } 00153 #endif 00154 G4Exception("G4PhysicsListHelper::CheckParticleList", 00155 "Run0101", FatalException, 00156 "Missing EM basic particle"); 00157 } 00158 00159 // RULE 2 00160 // proton should exist 00161 // if any other charged baryon exist 00162 if (!isProton && isAnyChargedBaryon) { 00163 G4String missingName="proton "; 00164 00165 #ifdef G4VERBOSE 00166 if (verboseLevel >0){ 00167 G4cout << "G4PhysicsListHelper::CheckParticleList: " 00168 << missingName << " does not exist "<< G4endl; 00169 G4cout << " Proton is necessary for EM baryon processes" << G4endl; 00170 } 00171 #endif 00172 missingName += " should be created "; 00173 G4Exception("G4PhysicsListHelper::CheckParticleList", 00174 "Run0102", FatalException, 00175 "Missing Proton"); 00176 } 00177 00178 // RULE 3 00179 // GenericIonn should exist 00180 // if any other ion exist 00181 if (!isGenericIon && isAnyIon) { 00182 G4String missingName="GenericIon "; 00183 00184 #ifdef G4VERBOSE 00185 if (verboseLevel >0){ 00186 G4cout << "G4PhysicsListHelper::CheckParticleList: " 00187 << missingName << " does not exist "<< G4endl; 00188 G4cout << " GenericIon should be created if any ion is necessary" << G4endl; 00189 } 00190 #endif 00191 G4Exception("G4PhysicsListHelper::CheckParticleList", 00192 "Run0103", FatalException, 00193 "Missing GenericIon"); 00194 } 00195 00196 }
void G4PhysicsListHelper::DumpOrdingParameterTable | ( | G4int | subType = -1 |
) | const |
Definition at line 340 of file G4PhysicsListHelper.cc.
References G4cout, and G4endl.
Referenced by G4UserPhysicsListMessenger::SetNewValue().
00341 { 00342 if (theTable==0) { 00343 #ifdef G4VERBOSE 00344 if (verboseLevel >0) { 00345 G4cout << "G4PhysicsListHelper::DumpOrdingParameterTable " 00346 << " No ordering parameter table : " << ordParamFileName 00347 << G4endl; 00348 } 00349 #endif 00350 return; 00351 } 00352 G4cout << "G4PhysicsListHelper::DumpOrdingParameterTable : " 00353 << ordParamFileName << G4endl; 00354 G4cout << " TypeName " 00355 << " ProcessType" << " SubType" 00356 << " AtRest" << " AlongStep" << " PostStep" 00357 << " Duplicable" << G4endl; 00358 for (int i=0; i<sizeOfTable ; i++){ 00359 G4PhysicsListOrderingParameter* tmp=&(theTable->at(i)); 00360 if ((subType>=0) && (subType!=tmp->processSubType)) continue; 00361 G4cout << std::setw(18) << tmp->processTypeName 00362 << std::setw(15) << tmp->processType 00363 << std::setw(15) << tmp->processSubType 00364 << std::setw(15) << tmp->ordering[0] 00365 << std::setw(15) << tmp->ordering[1] 00366 << std::setw(15) << tmp->ordering[2]; 00367 if (tmp->isDuplicable) { 00368 G4cout << " true"; 00369 } else { 00370 G4cout << " false"; 00371 } 00372 G4cout <<G4endl; 00373 } 00374 }
G4PhysicsListOrderingParameter G4PhysicsListHelper::GetOrdingParameter | ( | G4int | subType | ) | const |
Definition at line 377 of file G4PhysicsListHelper.cc.
References G4cout, G4endl, G4PhysicsListOrderingParameter::isDuplicable, G4PhysicsListOrderingParameter::ordering, G4PhysicsListOrderingParameter::processSubType, G4PhysicsListOrderingParameter::processType, and G4PhysicsListOrderingParameter::processTypeName.
00378 { 00379 G4PhysicsListOrderingParameter value; 00380 00381 if (theTable==0) { 00382 #ifdef G4VERBOSE 00383 if (verboseLevel >0) { 00384 G4cout << "G4PhysicsListHelper::GetOrderingParameter : " 00385 << " No ordering parameter table : " << ordParamFileName 00386 << G4endl; 00387 } 00388 #endif 00389 return value; 00390 } 00391 00392 for (int i=0; i<sizeOfTable ; i++){ 00393 G4PhysicsListOrderingParameter* tmp=&(theTable->at(i)); 00394 if (subType == tmp->processSubType){ 00395 value.processTypeName = tmp->processTypeName; 00396 value.processType = tmp->processType; 00397 value.processSubType = tmp->processSubType; 00398 value.ordering[0] = tmp->ordering[0]; 00399 value.ordering[1] = tmp->ordering[1]; 00400 value.ordering[2] = tmp->ordering[2]; 00401 value.isDuplicable = tmp->isDuplicable; 00402 } 00403 } 00404 return value; 00405 }
G4PhysicsListHelper * G4PhysicsListHelper::GetPhysicsListHelper | ( | ) | [static] |
Definition at line 89 of file G4PhysicsListHelper.cc.
Referenced by G4RadioactiveDecayPhysics::ConstructProcess(), G4EmStandardPhysics_option4::ConstructProcess(), G4EmStandardPhysics_option3::ConstructProcess(), G4EmStandardPhysics_option2::ConstructProcess(), G4EmStandardPhysics_option1::ConstructProcess(), G4EmStandardPhysics::ConstructProcess(), G4EmPenelopePhysics::ConstructProcess(), G4EmLowEPPhysics::ConstructProcess(), G4EmLivermorePolarizedPhysics::ConstructProcess(), G4EmLivermorePhysics::ConstructProcess(), G4EmDNAPhysicsChemistry::ConstructProcess(), G4EmDNAPhysics::ConstructProcess(), G4DecayPhysics::ConstructProcess(), G4VPhysicsConstructor::G4VPhysicsConstructor(), G4VUserPhysicsList::G4VUserPhysicsList(), and G4UserPhysicsListMessenger::SetNewValue().
00090 { 00091 static G4PhysicsListHelper thePLHelper; 00092 if (pPLHelper == 0) pPLHelper = &thePLHelper; 00093 return pPLHelper; 00094 }
G4int G4PhysicsListHelper::GetVerboseLevel | ( | ) | const [inline] |
G4bool G4PhysicsListHelper::RegisterProcess | ( | G4VProcess * | process, | |
G4ParticleDefinition * | particle | |||
) |
Definition at line 408 of file G4PhysicsListHelper.cc.
References G4ProcessManager::AddProcess(), FatalException, G4cout, G4endl, G4Exception(), G4ParticleDefinition::GetParticleName(), G4ProcessManager::GetProcessList(), G4ParticleDefinition::GetProcessManager(), G4VProcess::GetProcessName(), G4VProcess::GetProcessSubType(), G4VProcess::GetProcessType(), G4PhysicsListOrderingParameter::isDuplicable, JustWarning, G4PhysicsListOrderingParameter::ordering, G4PhysicsListOrderingParameter::processSubType, G4PhysicsListOrderingParameter::processType, G4PhysicsListOrderingParameter::processTypeName, G4ProcessManager::SetProcessOrdering(), G4ProcessManager::SetProcessOrderingToFirst(), G4ProcessManager::SetProcessOrderingToLast(), and G4ProcessVector::size().
Referenced by G4EmStandardPhysics_option4::ConstructProcess(), G4EmStandardPhysics_option3::ConstructProcess(), G4EmStandardPhysics_option2::ConstructProcess(), G4EmStandardPhysics_option1::ConstructProcess(), G4EmStandardPhysics::ConstructProcess(), G4EmPenelopePhysics::ConstructProcess(), G4EmLowEPPhysics::ConstructProcess(), G4EmLivermorePolarizedPhysics::ConstructProcess(), G4EmLivermorePhysics::ConstructProcess(), G4EmDNAPhysicsChemistry::ConstructProcess(), G4EmDNAPhysics::ConstructProcess(), G4DecayPhysics::ConstructProcess(), G4VUserPhysicsList::RegisterProcess(), and G4VPhysicsConstructor::RegisterProcess().
00410 { 00411 if (theTable==0) { 00412 #ifdef G4VERBOSE 00413 if (verboseLevel >0) { 00414 G4cout << "G4PhysicsListHelper::RegisterProcess :" 00415 << " No ordering parameter table : " << ordParamFileName 00416 << G4endl; 00417 } 00418 #endif 00419 G4Exception("G4PhysicsListHelper::RegisterPorcess", 00420 "Run0107", FatalException, 00421 "No Ordering Parameter Table"); 00422 return false; 00423 } 00424 00425 const G4String pName = process->GetProcessName(); 00426 const G4int pType = process->GetProcessType(); 00427 const G4int pSubType = process->GetProcessSubType(); 00428 00429 #ifdef G4VERBOSE 00430 if (verboseLevel >2) { 00431 G4cout << "G4PhysicsListHelper::RegisterProcess :" 00432 << pName << " Process Type = " << pType 00433 << " SubType = "<< pSubType 00434 << " to " << particle->GetParticleName() 00435 << G4endl; 00436 } 00437 #endif 00438 00439 // Check Process Type/SubType 00440 if ((pType <1)||(pSubType<1)) { 00441 #ifdef G4VERBOSE 00442 if (verboseLevel >0) { 00443 G4cout << "G4PhysicsListHelper::RegisterProcess :" 00444 << pName << " for " << particle->GetParticleName() 00445 << " has illegal Process Type = " << pType 00446 << " SubType = "<< pSubType << G4endl; 00447 } 00448 #endif 00449 G4Exception("G4PhysicsListHelper::RegisterPorcess", 00450 "Run0108", FatalException, 00451 "No Matching process Type/SubType"); 00452 return false; 00453 } 00454 00455 G4bool isFound = false; 00456 G4int ord[3]; 00457 G4bool duplicable = false; 00458 for (int i=0; i<sizeOfTable ; i++){ 00459 G4PhysicsListOrderingParameter* tmp=&(theTable->at(i)); 00460 if ((tmp->processType==pType)&&(tmp->processSubType==pSubType)){ 00461 ord[0] = tmp->ordering[0]; 00462 ord[1] = tmp->ordering[1]; 00463 ord[2] = tmp->ordering[2]; 00464 duplicable = tmp->isDuplicable; 00465 isFound = true; 00466 break; 00467 } 00468 } 00469 if (!isFound) { 00470 #ifdef G4VERBOSE 00471 if (verboseLevel >0) { 00472 G4cout << "G4PhysicsListHelper::RegisterProcess :" 00473 << pName << " for " << particle->GetParticleName() 00474 << " with type/subtype =" 00475 << pType << "/" << pSubType 00476 << " is not reigstered in OrdingParameterTable " 00477 << G4endl; 00478 } 00479 #endif 00480 G4Exception("G4PhysicsListHelper::RegisterPorcess", 00481 "Run0109", FatalException, 00482 "No Matching process Type/SubType"); 00483 return false; 00484 } 00485 00486 // Check Process Manager 00487 G4ProcessManager* pManager = particle->GetProcessManager(); 00488 if ( pManager == 0) { 00489 // Error !! no process manager 00490 #ifdef G4VERBOSE 00491 if (verboseLevel>0){ 00492 G4cout << "G4PhysicsListHelper::RegisterProcess " 00493 <<" : No Process Manager for " 00494 << particle->GetParticleName() << G4endl; 00495 } 00496 #endif 00497 G4Exception("G4PhysicsListHelper::RegisterProcess ", 00498 "Riun0110", FatalException, 00499 "No process manager"); 00500 return false; 00501 } 00502 00503 // Check Duplication 00504 if (!duplicable){ 00505 G4bool duplicated = false; 00506 G4ProcessVector* pList = pManager->GetProcessList(); 00507 for (G4int idx=0; idx<pList->size(); idx++) { 00508 const G4VProcess* p = (*pList)[idx]; 00509 if ((p->GetProcessType()== pType) && 00510 (p->GetProcessSubType()== pSubType)){ 00511 duplicated = true; 00512 #ifdef G4VERBOSE 00513 if (verboseLevel >0) { 00514 G4cout << "G4PhysicsListHelper::RegisterProcess :" 00515 << pName << " for " << particle->GetParticleName() 00516 << " with type/subtype =" 00517 << pType << "/" << pSubType 00518 << " is has same subType as " 00519 << p->GetProcessName() 00520 << " for " << particle->GetParticleName() 00521 << G4endl; 00522 G4cout << "It will not be added !!" << G4endl; 00523 } 00524 #endif 00525 G4Exception("G4PhysicsListHelper::RegisterPorcess", 00526 "Run0111", JustWarning, 00527 "Duplication of processes"); 00528 } 00529 } 00530 if (duplicated) return false; 00531 } 00532 00533 // Add Process 00534 G4int code = pManager ->AddProcess(process); 00535 if (code <0) return false; 00536 00537 // Set Ordering Parameter 00538 for(G4int idx=0; idx<3; idx++){ 00539 G4ProcessVectorDoItIndex idxOrd = static_cast<G4ProcessVectorDoItIndex>(idx); 00540 if (ord[idx]<0) { 00541 // Do Nothing because NO DOIT 00542 } else if (ord[idx]==0) { 00543 pManager->SetProcessOrderingToFirst( process, idxOrd ); 00544 } else if (ord[idx]<9999) { 00545 pManager->SetProcessOrdering( process, idxOrd , ord[idx]); 00546 } else { 00547 pManager->SetProcessOrderingToLast( process, idxOrd ); 00548 } 00549 } 00550 #ifdef G4VERBOSE 00551 if (verboseLevel >1) { 00552 G4cout << "G4PhysicsListHelper::RegisterProcess :" 00553 << pName << " for " << particle->GetParticleName() 00554 << " with type/subtype =" 00555 << pType << "/" << pSubType 00556 << " is sucessfully registered with ordering parameters " 00557 << ord[0] << ":" << ord[1] << ":" << ord[2] 00558 << G4endl; 00559 } 00560 #endif 00561 return true; 00562 }
void G4PhysicsListHelper::SetVerboseLevel | ( | G4int | value | ) | [inline] |
Definition at line 126 of file G4PhysicsListHelper.hh.
Referenced by G4VUserPhysicsList::G4VUserPhysicsList(), and G4VUserPhysicsList::SetVerboseLevel().
void G4PhysicsListHelper::UseCoupledTransportation | ( | G4bool | vl = true |
) | [inline] |
Definition at line 120 of file G4PhysicsListHelper.hh.
Referenced by G4VUserPhysicsList::UseCoupledTransportation().