62 fPhysBiasAllCharged(false), fNonPhysBiasAllCharged(false),
63 fPhysBiasAllChargedISL(false), fNonPhysBiasAllChargedISL(false),
64 fPhysBiasAllNeutral(false), fNonPhysBiasAllNeutral(false),
65 fPhysBiasAllNeutralISL(false), fNonPhysBiasAllNeutralISL(false),
79 fBiasedParticles.push_back(particleName);
80 std::vector< G4String > dummy;
81 fBiasedProcesses.push_back(dummy);
82 fBiasAllProcesses.push_back(
true);
89 fBiasedParticles.push_back(particleName);
90 fBiasedProcesses.push_back(processNames);
91 fBiasAllProcesses.push_back(
false);
98 fNonPhysBiasedParticles.push_back(particleName);
120 if ( PDGlow > PDGhigh )
G4cout <<
" G4GenericBiasingPhysics::PhysicsBiasAddPDGRange(...) : PDGlow > PDGhigh, call ignored." <<
G4endl;
121 fPhysBiasByPDGRangeLow .push_back( PDGlow );
122 fPhysBiasByPDGRangeHigh.push_back( PDGhigh );
123 if ( includeAntiParticle )
125 fPhysBiasByPDGRangeLow .push_back( -PDGhigh );
126 fPhysBiasByPDGRangeHigh.push_back( -PDGlow );
133 if ( PDGlow > PDGhigh )
G4cout <<
" G4GenericBiasingPhysics::NonPhysicsBiasAddPDGRange(...) : PDGlow > PDGhigh, call ignored." <<
G4endl;
134 fNonPhysBiasByPDGRangeLow .push_back( PDGlow );
135 fNonPhysBiasByPDGRangeHigh.push_back( PDGhigh );
136 if ( includeAntiParticle )
138 fNonPhysBiasByPDGRangeLow .push_back( -PDGhigh );
139 fNonPhysBiasByPDGRangeHigh.push_back( -PDGlow );
147 if ( PDGlow > PDGhigh )
G4cout <<
" G4GenericBiasingPhysics::BiasAddPDGRange(...) : PDGlow > PDGhigh, call ignored." <<
G4endl;
154 fPhysBiasAllCharged =
true;
155 fPhysBiasAllChargedISL = includeShortLived;
159 fNonPhysBiasAllCharged =
true;
160 fNonPhysBiasAllChargedISL = includeShortLived;
164 fPhysBiasAllCharged =
true;
165 fNonPhysBiasAllCharged =
true;
166 fPhysBiasAllChargedISL = includeShortLived;
167 fNonPhysBiasAllChargedISL = includeShortLived;
171 fPhysBiasAllNeutral =
true;
172 fPhysBiasAllNeutralISL = includeShortLived;
176 fNonPhysBiasAllNeutral =
true;
177 fNonPhysBiasAllNeutralISL = includeShortLived;
181 fPhysBiasAllNeutral =
true;
182 fNonPhysBiasAllNeutral =
true;
183 fPhysBiasAllNeutralISL = includeShortLived;
184 fNonPhysBiasAllNeutralISL = includeShortLived;
192 for (
G4String knownParticle : fParticlesWithParallelGeometries )
194 if ( knownParticle == particleName )
202 if ( !isKnown ) fParticlesWithParallelGeometries.push_back( particleName );
203 std::vector< G4String >& geometries = fParallelGeometriesForParticle[particleName];
206 for (
G4String knownGeometry : geometries )
208 if ( knownGeometry == parallelGeometryName )
214 if ( !isKnown ) geometries.push_back( parallelGeometryName );
225 if ( PDGlow > PDGhigh )
227 G4cout <<
"G4GenericBiasingPhysics::AddParallelGeometry( G4int PDGlow, G4int PDGhigh, const G4String& parallelGeometryName , G4bool includeAntiParticle = true ), PDGlow > PDGhigh : call ignored" <<
G4endl;
231 fPDGlowParallelGeometries .push_back( PDGlow );
232 fPDGhighParallelGeometries.push_back( PDGhigh );
233 G4int rangeIndex = fPDGlowParallelGeometries.size() - 1;
234 fPDGrangeParallelGeometries[rangeIndex].push_back( parallelGeometryName );
236 if ( includeAntiParticle )
238 fPDGlowParallelGeometries .push_back( -PDGhigh );
239 fPDGhighParallelGeometries.push_back( -PDGlow );
240 rangeIndex = fPDGlowParallelGeometries.size() - 1;
241 fPDGrangeParallelGeometries[rangeIndex].push_back( parallelGeometryName );
248 if ( PDGlow > PDGhigh )
250 G4cout <<
"G4GenericBiasingPhysics::AddParallelGeometry( G4int PDGlow, G4int PDGhigh, const std::vector< G4String >& parallelGeometryNames, G4bool includeAntiParticle = true ), PDGlow > PDGhigh : call ignored" <<
G4endl;
260 for (
G4String geometry : fParallelGeometriesForCharged )
262 if ( geometry == parallelGeometryName )
270 fParallelGeometriesForCharged .push_back( parallelGeometryName );
271 fAllChargedParallelGeometriesISL.push_back( includeShortLived );
283 for (
G4String geometry : fParallelGeometriesForNeutral )
285 if ( geometry == parallelGeometryName )
293 fParallelGeometriesForNeutral .push_back( parallelGeometryName );
294 fAllNeutralParallelGeometriesISL.push_back( includeShortLived );
326 if ( std::find(fNonPhysBiasedParticles.begin(),
327 fNonPhysBiasedParticles.end(),
328 particleName ) != fNonPhysBiasedParticles.end() )
334 std::vector< G4String >::const_iterator particleIt =
335 std::find(fBiasedParticles.begin(),
336 fBiasedParticles.end(),
338 if ( particleIt == fBiasedParticles.end() )
continue;
340 std::vector < G4String >& biasedProcesses = fBiasedProcesses [ particleIt - fBiasedParticles.begin() ];
341 G4bool biasAll = fBiasAllProcesses[ particleIt - fBiasedParticles.begin() ];
346 for (
G4int ip = 0 ; ip < vprocess->
size() ; ip++)
354 while ( restartLoop )
356 for (std::size_t ip = 0 ; ip < biasedProcesses.size() ; ip++)
360 if ( restartLoop )
break;
377 if ( std::find( fNonPhysBiasedParticles.begin(),
378 fNonPhysBiasedParticles.end(),
379 particleName ) != fNonPhysBiasedParticles.end() )
continue;
381 if ( std::find( fBiasedParticles.begin(),
382 fBiasedParticles.end(),
383 particleName ) != fBiasedParticles.end() )
continue;
386 G4bool physBias(
false), nonPhysBias(
false);
391 for (
size_t i = 0 ; i < fPhysBiasByPDGRangeLow.size() ; i++ )
392 if ( ( PDG >= fPhysBiasByPDGRangeLow[i] ) && ( PDG <= fPhysBiasByPDGRangeHigh[i] ) )
397 for (
size_t i = 0 ; i < fNonPhysBiasByPDGRangeLow.size() ; i++ )
398 if ( ( PDG >= fNonPhysBiasByPDGRangeLow[i] ) && ( PDG <= fNonPhysBiasByPDGRangeHigh[i] ) )
405 if ( ( physBias ==
false ) && ( nonPhysBias == false ) )
409 if ( fPhysBiasAllCharged )
if ( fPhysBiasAllChargedISL || !particle->
IsShortLived() ) physBias =
true;
410 if ( fNonPhysBiasAllCharged )
if ( fNonPhysBiasAllChargedISL || !particle->
IsShortLived() ) nonPhysBias =
true;
414 if ( fPhysBiasAllNeutral )
if ( fPhysBiasAllNeutralISL || !particle->
IsShortLived() ) physBias =
true;
415 if ( fNonPhysBiasAllNeutral )
if ( fNonPhysBiasAllNeutralISL || !particle->
IsShortLived() ) nonPhysBias =
true;
424 std::vector < G4String > biasedProcesses;
426 for (
G4int ip = 0 ; ip < vprocess->
size() ; ip++)
433 while ( restartLoop )
435 for (std::size_t ip = 0 ; ip < biasedProcesses.size() ; ip++)
439 if ( restartLoop )
break;
449 AssociateParallelGeometries();
469 for (
G4int ip = 0 ; ip < vprocess->
size() ; ip++)
483 processNames +=
"\n ";
494 G4cout << std::setw(14) << particleName <<
" **** : " << processNames <<
G4endl;
496 G4cout << std::setw(18) << particleName <<
" : " << processNames <<
G4endl;
504 void G4GenericBiasingPhysics::AssociateParallelGeometries()
518 for (
G4String requestedParticles : fParticlesWithParallelGeometries )
520 if ( requestedParticles == particleName )
532 std::vector< G4String >& parallelWorlds = fParallelGeometriesForParticle[ particleName ];
541 for (
G4int PDGlow : fPDGlowParallelGeometries )
543 G4int PDGhigh = fPDGhighParallelGeometries[i];
544 auto & geometries = fPDGrangeParallelGeometries[i];
554 if ( ( particlePDG >= PDGlow ) && ( particlePDG <= PDGhigh ) )
virtual void ConstructParticle()
void BiasAllCharged(G4bool includeShortLived=false)
virtual void ConstructProcess()
void PhysicsBiasAllNeutral(G4bool includeShortLived=false)
void NonPhysicsBiasAllCharged(G4bool includeShortLived=false)
void PhysicsBias(const G4String &particleName)
G4int GetPDGEncoding() const
void AddParallelGeometry(const G4String &particleName, const G4String ¶llelGeometryName)
static void ActivateNonPhysicsBiasing(G4ProcessManager *pmanager, G4String nonPhysicsProcessName="")
const G4String & GetParticleName() const
void AddParallelWorld(const G4String ¶llelWorldName)
void NonPhysicsBiasAddPDGRange(G4int PDGlow, G4int PDGhigh, G4bool includeAntiParticle=true)
void PhysicsBiasAllCharged(G4bool includeShortLived=false)
virtual ~G4GenericBiasingPhysics()
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const
G4GLOB_DLL std::ostream G4cout
G4GenericBiasingPhysics(const G4String &name="BiasingP")
static G4bool ActivatePhysicsBiasing(G4ProcessManager *pmanager, G4String physicsProcessToBias, G4String wrappedName="")
static G4ParallelGeometriesLimiterProcess * AddLimiterProcess(G4ProcessManager *pmanager, const G4String &processName="biasLimiter")
const G4String & GetProcessName() const
void PhysicsBiasAddPDGRange(G4int PDGlow, G4int PDGhigh, G4bool includeAntiParticle=true)
void AddParallelGeometryAllCharged(const G4String ¶llelGeometryName, G4bool includeShortLived=false)
G4bool IsShortLived() const
void BiasAddPDGRange(G4int PDGlow, G4int PDGhigh, G4bool includeAntiParticle=true)
G4ProcessManager * GetProcessManager() const
void NonPhysicsBiasAllNeutral(G4bool includeShortLived=false)
std::vector< G4InuclElementaryParticle >::iterator particleIterator
void BiasAllNeutral(G4bool includeShortLived=false)
G4double GetPDGCharge() const
void NonPhysicsBias(const G4String &particleName)
G4ProcessVector * GetProcessList() const
void AddParallelGeometryAllNeutral(const G4String ¶llelGeometryName, G4bool includeShortLived=false)
#define G4_DECLARE_PHYSCONSTR_FACTORY(physics_constructor)
void Bias(const G4String &particleName)