Import Geant4 10.1.0 source tree
This commit is contained in:
@@ -30,8 +30,9 @@
|
||||
// ClassName: G4GenericBiasingPhysics
|
||||
//
|
||||
// Author: M. Verderi (Sept.10.2013)
|
||||
//
|
||||
// Modified:
|
||||
// 07/11/2014, M. Verderi : fix bug of PhysicsBias(...) which was not taking
|
||||
// into account the vector of processes passed, but biasing all.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
@@ -121,31 +122,42 @@ void G4GenericBiasingPhysics::ConstructProcess()
|
||||
{
|
||||
G4ParticleDefinition* particle = aParticleIterator->value();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
// -- include non physics process interface for biasing:
|
||||
if ( std::find(fNonPhysBiasedParticles.begin(),
|
||||
fNonPhysBiasedParticles.end(),
|
||||
particleName ) != fNonPhysBiasedParticles.end() )
|
||||
{
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4BiasingHelper::ActivateNonPhysicsBiasing(pmanager);
|
||||
}
|
||||
|
||||
// -- wrap biased physics processes, all processes or only user selected:
|
||||
std::vector< G4String >::const_iterator particleIt =
|
||||
std::find(fBiasedParticles.begin(),
|
||||
fBiasedParticles.end(),
|
||||
particleName );
|
||||
if ( particleIt == fBiasedParticles.end() ) continue;
|
||||
|
||||
if ( std::find(fBiasedParticles.begin(),
|
||||
fBiasedParticles.end(),
|
||||
particleName ) == fBiasedParticles.end() ) continue;
|
||||
std::vector < G4String >& biasedProcesses = fBiasedProcesses [ particleIt - fBiasedParticles.begin() ];
|
||||
G4bool biasAll = fBiasAllProcesses[ particleIt - fBiasedParticles.begin() ];
|
||||
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4ProcessVector* vprocess = pmanager->GetProcessList();
|
||||
if ( biasAll )
|
||||
{
|
||||
G4ProcessVector* vprocess = pmanager->GetProcessList();
|
||||
for (G4int ip = 0 ; ip < vprocess->size() ; ip++)
|
||||
{
|
||||
G4VProcess* process = (*vprocess)[ip];
|
||||
biasedProcesses.push_back( process->GetProcessName() );
|
||||
}
|
||||
}
|
||||
|
||||
G4bool restartLoop(true);
|
||||
while ( restartLoop )
|
||||
{
|
||||
for (G4int ip = 0 ; ip < vprocess->size() ; ip++)
|
||||
for (std::size_t ip = 0 ; ip < biasedProcesses.size() ; ip++)
|
||||
{
|
||||
G4VProcess* process = (*vprocess)[ip];
|
||||
G4bool activ = G4BiasingHelper::ActivatePhysicsBiasing(pmanager, process->GetProcessName());
|
||||
G4bool activ = G4BiasingHelper::ActivatePhysicsBiasing(pmanager, biasedProcesses[ip] );
|
||||
restartLoop = activ;
|
||||
if ( restartLoop ) break;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4NeutronTrackingCut.cc 71040 2013-06-10 09:25:30Z gcosmo $
|
||||
// $Id: G4NeutronTrackingCut.cc 83417 2014-08-21 15:29:32Z gcosmo $
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
@@ -43,13 +43,13 @@
|
||||
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4NeutronKiller.hh"
|
||||
#include "G4HadronicProcessStore.hh"
|
||||
|
||||
// factory
|
||||
#include "G4PhysicsConstructorFactory.hh"
|
||||
//
|
||||
G4_DECLARE_PHYSCONSTR_FACTORY(G4NeutronTrackingCut);
|
||||
//
|
||||
G4ThreadLocal G4bool G4NeutronTrackingCut::wasActivated = false;
|
||||
|
||||
G4NeutronTrackingCut::G4NeutronTrackingCut(G4int ver)
|
||||
: G4VPhysicsConstructor("neutronTrackingCut")
|
||||
@@ -57,7 +57,6 @@ G4NeutronTrackingCut::G4NeutronTrackingCut(G4int ver)
|
||||
{
|
||||
timeLimit = 10.*microsecond;
|
||||
kineticEnergyLimit = 0.0;
|
||||
//pNeutronKiller = 0;
|
||||
}
|
||||
|
||||
G4NeutronTrackingCut::G4NeutronTrackingCut(const G4String& name, G4int ver)
|
||||
@@ -65,13 +64,10 @@ G4NeutronTrackingCut::G4NeutronTrackingCut(const G4String& name, G4int ver)
|
||||
{
|
||||
timeLimit = 10.*microsecond;
|
||||
kineticEnergyLimit = 0.0;
|
||||
//pNeutronKiller = 0;
|
||||
}
|
||||
|
||||
G4NeutronTrackingCut::~G4NeutronTrackingCut()
|
||||
{
|
||||
//delete pNeutronKiller;
|
||||
}
|
||||
{}
|
||||
|
||||
void G4NeutronTrackingCut::ConstructParticle()
|
||||
{
|
||||
@@ -80,17 +76,14 @@ void G4NeutronTrackingCut::ConstructParticle()
|
||||
|
||||
void G4NeutronTrackingCut::ConstructProcess()
|
||||
{
|
||||
if(wasActivated) return;
|
||||
wasActivated = true;
|
||||
|
||||
// Add Process
|
||||
|
||||
G4NeutronKiller* pNeutronKiller = new G4NeutronKiller();
|
||||
G4ParticleDefinition * particle = G4Neutron::Neutron();
|
||||
G4ProcessManager * pmanager = particle->GetProcessManager();
|
||||
|
||||
if(verbose > 0) {
|
||||
G4cout << "### Adding tracking cuts for " << particle->GetParticleName()
|
||||
G4String pn = particle->GetParticleName();//Avoid data-race when passing
|
||||
//this string to G4MTcout
|
||||
G4cout << "### Adding tracking cuts for " << pn
|
||||
<< " TimeCut(ns)= " << timeLimit/ns
|
||||
<< " KinEnergyCut(MeV)= " << kineticEnergyLimit/MeV
|
||||
<< G4endl;
|
||||
@@ -98,6 +91,9 @@ void G4NeutronTrackingCut::ConstructProcess()
|
||||
pmanager -> AddDiscreteProcess(pNeutronKiller);
|
||||
pNeutronKiller->SetKinEnergyLimit(kineticEnergyLimit);
|
||||
pNeutronKiller->SetTimeLimit(timeLimit);
|
||||
|
||||
G4HadronicProcessStore::Instance()->RegisterExtraProcess(pNeutronKiller);
|
||||
G4HadronicProcessStore::Instance()->RegisterParticleForExtraProcess(pNeutronKiller, particle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -55,14 +55,15 @@ G4_DECLARE_PHYSCONSTR_FACTORY(G4StepLimiterPhysics);
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4StepLimiterPhysics::G4StepLimiterPhysics(const G4String& name)
|
||||
: G4VPhysicsConstructor(name)
|
||||
{;
|
||||
}
|
||||
: G4VPhysicsConstructor(name),fStepLimiter(0),fUserSpecialCuts(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4StepLimiterPhysics::~G4StepLimiterPhysics()
|
||||
{;
|
||||
{
|
||||
delete fStepLimiter;
|
||||
delete fUserSpecialCuts;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -76,8 +77,8 @@ void G4StepLimiterPhysics::ConstructProcess()
|
||||
{
|
||||
aParticleIterator->reset();
|
||||
|
||||
G4StepLimiter* fStepLimiter = new G4StepLimiter();
|
||||
G4UserSpecialCuts* fUserSpecialCuts = new G4UserSpecialCuts();
|
||||
fStepLimiter = new G4StepLimiter();
|
||||
fUserSpecialCuts = new G4UserSpecialCuts();
|
||||
while ((*aParticleIterator)()) {
|
||||
G4ParticleDefinition* particle = aParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
Reference in New Issue
Block a user