Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -0,0 +1,156 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
//---------------------------------------------------------------------------
//
// ClassName: G4GenericBiasingPhysics
//
// Author: M. Verderi (Sept.10.2013)
//
// Modified:
//
//----------------------------------------------------------------------------
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4GenericBiasingPhysics.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4BiasingHelper.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
//
G4_DECLARE_PHYSCONSTR_FACTORY(G4GenericBiasingPhysics);
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4GenericBiasingPhysics::G4GenericBiasingPhysics(const G4String& name)
: G4VPhysicsConstructor(name)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4GenericBiasingPhysics::~G4GenericBiasingPhysics()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4GenericBiasingPhysics::PhysicsBias(const G4String& particleName)
{
fBiasedParticles.push_back(particleName);
std::vector< G4String > dummy;
fBiasedProcesses.push_back(dummy);
fBiasAllProcesses.push_back(true);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4GenericBiasingPhysics::PhysicsBias(const G4String& particleName, const std::vector< G4String >& processNames)
{
fBiasedParticles.push_back(particleName);
fBiasedProcesses.push_back(processNames);
fBiasAllProcesses.push_back(false);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4GenericBiasingPhysics::NonPhysicsBias(const G4String& particleName)
{
fNonPhysBiasedParticles.push_back(particleName);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4GenericBiasingPhysics::Bias(const G4String& particleName)
{
PhysicsBias(particleName);
NonPhysicsBias(particleName);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4GenericBiasingPhysics::Bias(const G4String& particleName, const std::vector< G4String >& processNames)
{
PhysicsBias(particleName, processNames);
NonPhysicsBias(particleName);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4GenericBiasingPhysics::ConstructParticle()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4GenericBiasingPhysics::ConstructProcess()
{
aParticleIterator->reset();
while( (*aParticleIterator)() )
{
G4ParticleDefinition* particle = aParticleIterator->value();
G4String particleName = particle->GetParticleName();
// -- include non physics process interface for biasing:
if ( std::find(fNonPhysBiasedParticles.begin(),
fNonPhysBiasedParticles.end(),
particleName ) != fNonPhysBiasedParticles.end() )
{
G4ProcessManager* pmanager = particle->GetProcessManager();
G4BiasingHelper::ActivateNonPhysicsBiasing(pmanager);
}
if ( std::find(fBiasedParticles.begin(),
fBiasedParticles.end(),
particleName ) == fBiasedParticles.end() ) continue;
G4ProcessManager* pmanager = particle->GetProcessManager();
G4ProcessVector* vprocess = pmanager->GetProcessList();
G4bool restartLoop(true);
while ( restartLoop )
{
for (G4int ip = 0 ; ip < vprocess->size() ; ip++)
{
G4VProcess* process = (*vprocess)[ip];
G4bool activ = G4BiasingHelper::ActivatePhysicsBiasing(pmanager, process->GetProcessName());
restartLoop = activ;
if ( restartLoop ) break;
}
}
}
}
@@ -0,0 +1,113 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
//---------------------------------------------------------------------------
//
// ClassName: G4ImportanceBiasing
//
// Author: A. Howard (Nov.09.2013)
//
// Modified:
//
//----------------------------------------------------------------------------
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ImportanceBiasing.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4TransportationManager.hh"
//#include "G4ParallelWorldProcess.hh"
#include "G4ImportanceProcess.hh"
#include "G4IStore.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
//
G4_DECLARE_PHYSCONSTR_FACTORY(G4ImportanceBiasing);
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ImportanceBiasing::G4ImportanceBiasing(const G4String& name)
: G4VPhysicsConstructor(name), fGeomSampler(0), paraFlag(false)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ImportanceBiasing::G4ImportanceBiasing(G4GeometrySampler* mgs, const G4String& name)
: G4VPhysicsConstructor(name), fGeomSampler(mgs), paraFlag(false), paraName(name)
{
if(name != "NoParallelWP") {
paraFlag = true;
paraName = name;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ImportanceBiasing::~G4ImportanceBiasing()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4ImportanceBiasing::ConstructParticle()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4ImportanceBiasing::ConstructProcess()
{
G4cout << " paraFlag: " << paraFlag << G4endl;
static G4bool first = true;
if(first) {
G4cout << " Preparing Importance Sampling " << G4endl;
fGeomSampler->SetParallel(paraFlag);
if(paraFlag) {
fGeomSampler->PrepareImportanceSampling(G4IStore::GetInstance(paraName), 0);
} else {
fGeomSampler->PrepareImportanceSampling(G4IStore::GetInstance(), 0);
}
}
if(first) {
fGeomSampler->Configure();
first = false;
}
#ifdef G4MULTITHREADED
fGeomSampler->AddProcess();
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,99 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// --------------------------------------------------------------
// GEANT 4
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// by A. Howard and H. Araujo
// (27th November 2001)
//
// G4MaxTimeCuts program
// --------------------------------------------------------------
#include "G4MaxTimeCuts.hh"
#include "G4PhysicalConstants.hh"
#include "G4Step.hh"
#include "G4UserLimits.hh"
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
G4MaxTimeCuts::G4MaxTimeCuts(const G4String& aName)
: G4SpecialCuts(aName)
{
if (verboseLevel>1) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
SetProcessType(fUserDefined);
}
G4MaxTimeCuts::~G4MaxTimeCuts()
{}
G4MaxTimeCuts::G4MaxTimeCuts(G4MaxTimeCuts& ) : G4SpecialCuts()
{}
G4double G4MaxTimeCuts::PostStepGetPhysicalInteractionLength(
const G4Track& aTrack,
G4double ,
G4ForceCondition* condition
)
{
// condition is set to "Not Forced"
*condition = NotForced;
G4double proposedStep = DBL_MAX;
// get the pointer to UserLimits
G4UserLimits* pUserLimits = aTrack.GetVolume()->GetLogicalVolume()->GetUserLimits();
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
// can apply cuts for specific particles - use if(particleDef):
// G4ParticleDefinition* aParticleDef = aTrack.GetDefinition();
// G4cout << " Time: " << pUserLimits->GetUserMaxTime(aTrack) << G4endl;
if (pUserLimits) {
G4double temp = DBL_MAX;
//max time limit
G4double dTime= (pUserLimits->GetUserMaxTime(aTrack) - aTrack.GetGlobalTime());
if (dTime < 0. ) {
proposedStep = 0.;
} else {
G4double beta = (aParticle->GetTotalMomentum())/(aParticle->GetTotalEnergy());
temp = beta*c_light*dTime;
if (proposedStep > temp) proposedStep = temp;
}
}
return proposedStep;
}
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
// --------------------------------------------------------------
// 15 April 1998 M.Maire
// --------------------------------------------------------------
#include "G4MinEkineCuts.hh"
#include "G4Step.hh"
#include "G4UserLimits.hh"
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
G4MinEkineCuts::G4MinEkineCuts(const G4String& aName)
: G4SpecialCuts(aName)
{
if (verboseLevel>1) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
SetProcessType(fUserDefined);
}
G4MinEkineCuts::~G4MinEkineCuts()
{}
G4MinEkineCuts::G4MinEkineCuts(G4MinEkineCuts& ) : G4SpecialCuts()
{}
G4double G4MinEkineCuts::PostStepGetPhysicalInteractionLength(
const G4Track& aTrack,
G4double ,
G4ForceCondition* condition
)
{
// condition is set to "Not Forced"
*condition = NotForced;
G4double proposedStep = DBL_MAX;
// get the pointer to UserLimits
G4UserLimits* pUserLimits = aTrack.GetVolume()->GetLogicalVolume()->GetUserLimits();
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
G4ParticleDefinition* aParticleDef = aTrack.GetDefinition();
if (pUserLimits && aParticleDef->GetPDGCharge() != 0.0) {
//min kinetic energy
G4double temp = DBL_MAX;
G4double eKine = aParticle->GetKineticEnergy();
const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
G4double eMin = pUserLimits->GetUserMinEkine(aTrack);
G4double rangeNow = DBL_MAX;
rangeNow = G4EnergyLossTables::GetRange(aParticleDef,eKine,couple);
if (eKine < eMin ) {
proposedStep = 0.;
} else {
// charged particles only
G4double rangeMin = G4EnergyLossTables::GetRange(aParticleDef,eMin,couple);
temp = rangeNow - rangeMin;
if (proposedStep > temp) proposedStep = temp;
}
}
return proposedStep;
}
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4NeutronTrackingCut.cc 71040 2013-06-10 09:25:30Z gcosmo $
//
//---------------------------------------------------------------------------
//
// ClassName: G4NeutronTrackingCut
//
// Author: Nov 2006 G.Folger
//
//
//----------------------------------------------------------------------------
//
#include "G4NeutronTrackingCut.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4Neutron.hh"
#include "G4NeutronKiller.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
//
G4_DECLARE_PHYSCONSTR_FACTORY(G4NeutronTrackingCut);
//
G4ThreadLocal G4bool G4NeutronTrackingCut::wasActivated = false;
G4NeutronTrackingCut::G4NeutronTrackingCut(G4int ver)
: G4VPhysicsConstructor("neutronTrackingCut")
, verbose(ver)
{
timeLimit = 10.*microsecond;
kineticEnergyLimit = 0.0;
//pNeutronKiller = 0;
}
G4NeutronTrackingCut::G4NeutronTrackingCut(const G4String& name, G4int ver)
: G4VPhysicsConstructor(name), verbose(ver)
{
timeLimit = 10.*microsecond;
kineticEnergyLimit = 0.0;
//pNeutronKiller = 0;
}
G4NeutronTrackingCut::~G4NeutronTrackingCut()
{
//delete pNeutronKiller;
}
void G4NeutronTrackingCut::ConstructParticle()
{
G4Neutron::NeutronDefinition();
}
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()
<< " TimeCut(ns)= " << timeLimit/ns
<< " KinEnergyCut(MeV)= " << kineticEnergyLimit/MeV
<< G4endl;
}
pmanager -> AddDiscreteProcess(pNeutronKiller);
pNeutronKiller->SetKinEnergyLimit(kineticEnergyLimit);
pNeutronKiller->SetTimeLimit(timeLimit);
}
@@ -0,0 +1,97 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
//---------------------------------------------------------------------------
//
// ClassName: G4ParallelWorldPhysics
//
// Author: M. Asai (May.15.2013)
//
// Modified:
//
//----------------------------------------------------------------------------
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ParallelWorldPhysics.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4TransportationManager.hh"
#include "G4ParallelWorldProcess.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
//
G4_DECLARE_PHYSCONSTR_FACTORY(G4ParallelWorldPhysics);
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ParallelWorldPhysics::G4ParallelWorldPhysics(const G4String& name, G4bool layeredMass)
: G4VPhysicsConstructor(name), fLayeredMass(layeredMass)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ParallelWorldPhysics::~G4ParallelWorldPhysics()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4ParallelWorldPhysics::ConstructParticle()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4ParallelWorldPhysics::ConstructProcess()
{
// Make sure the parallel world registered
G4TransportationManager::GetTransportationManager()
->GetParallelWorld(namePhysics);
// Add parallel world process
G4ParallelWorldProcess* theParallelWorldProcess
= new G4ParallelWorldProcess(namePhysics);
theParallelWorldProcess->SetParallelWorld(namePhysics);
theParallelWorldProcess->SetLayeredMaterialFlag(fLayeredMass);
aParticleIterator->reset();
while( (*aParticleIterator)() ){
G4ParticleDefinition* particle = aParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
pmanager->AddProcess(theParallelWorldProcess);
if(theParallelWorldProcess->IsAtRestRequired(particle))
{pmanager->SetProcessOrdering(theParallelWorldProcess, idxAtRest, 9999);}
pmanager->SetProcessOrdering(theParallelWorldProcess, idxAlongStep, 1);
pmanager->SetProcessOrdering(theParallelWorldProcess, idxPostStep, 9999);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// --------------------------------------------------------------
// GEANT 4
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// by A. Howard and H. Araujo
// (27th November 2001)
//
// G4SpecialCuts program
// --------------------------------------------------------------
#include "G4SpecialCuts.hh"
#include "G4VParticleChange.hh"
#include "G4Track.hh"
#include "G4Step.hh"
G4SpecialCuts::G4SpecialCuts(const G4String& aName)
: G4VProcess(aName)
{
if (verboseLevel>1) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
}
G4SpecialCuts::~G4SpecialCuts()
{
}
G4VParticleChange* G4SpecialCuts::PostStepDoIt(
const G4Track& aTrack,
const G4Step&
)
//
// Stop the current particle, if requested by G4UserLimits
//
{
aParticleChange.Initialize(aTrack);
aParticleChange.ProposeEnergy(0.) ;
aParticleChange.ProposeLocalEnergyDeposit (aTrack.GetKineticEnergy()) ;
aParticleChange.ProposeTrackStatus(fStopButAlive);
return &aParticleChange;
}
G4double G4SpecialCuts::PostStepGetPhysicalInteractionLength(
const G4Track& /* track*/,
G4double /* previousStepSize */,
G4ForceCondition* /* condition */
)
{
return DBL_MAX;
}
@@ -0,0 +1,100 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
//---------------------------------------------------------------------------
//
// ClassName: G4StepLimiterPhysics
//
// Author: V.Ivanchenko 24.11.2004
//
// Modified:
//
//----------------------------------------------------------------------------
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4StepLimiterPhysics.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4StepLimiter.hh"
#include "G4UserSpecialCuts.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
//
G4_DECLARE_PHYSCONSTR_FACTORY(G4StepLimiterPhysics);
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4StepLimiterPhysics::G4StepLimiterPhysics(const G4String& name)
: G4VPhysicsConstructor(name)
{;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4StepLimiterPhysics::~G4StepLimiterPhysics()
{;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4StepLimiterPhysics::ConstructParticle()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4StepLimiterPhysics::ConstructProcess()
{
aParticleIterator->reset();
G4StepLimiter* fStepLimiter = new G4StepLimiter();
G4UserSpecialCuts* fUserSpecialCuts = new G4UserSpecialCuts();
while ((*aParticleIterator)()) {
G4ParticleDefinition* particle = aParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4double charge = particle->GetPDGCharge();
if(!particle->IsShortLived()) {
if (charge != 0.0) {
// All charged particles should have a step limiter
// to make sure that the steps do not get too long.
pmanager->AddDiscreteProcess(fStepLimiter);
pmanager->AddDiscreteProcess(fUserSpecialCuts);
} else {
// Energy cuts for all other neutral particles
pmanager->AddDiscreteProcess(fUserSpecialCuts);
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,113 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
//---------------------------------------------------------------------------
//
// ClassName: G4WeightWindowBiasing
//
// Author: A. Howard (Nov.22.2013)
//
// Modified:
//
//----------------------------------------------------------------------------
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4WeightWindowBiasing.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4TransportationManager.hh"
//#include "G4ParallelWorldProcess.hh"
#include "G4WeightWindowProcess.hh"
#include "G4WeightWindowStore.hh"
// factory
#include "G4PhysicsConstructorFactory.hh"
//
G4_DECLARE_PHYSCONSTR_FACTORY(G4WeightWindowBiasing);
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4WeightWindowBiasing::G4WeightWindowBiasing(const G4String& name)
: G4VPhysicsConstructor(name), fGeomSampler(0), paraFlag(false)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4WeightWindowBiasing::G4WeightWindowBiasing(G4GeometrySampler* mgs, G4VWeightWindowAlgorithm* wwAlg, G4PlaceOfAction placeOfAction, const G4String& name)
: G4VPhysicsConstructor(name), fGeomSampler(mgs), fWWalg(wwAlg), fPlaceOfAction(placeOfAction), paraFlag(false), paraName(name)
{
if(name != "NoParallelWP") {
paraFlag = true;
paraName = name;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4WeightWindowBiasing::~G4WeightWindowBiasing()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4WeightWindowBiasing::ConstructParticle()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4WeightWindowBiasing::ConstructProcess()
{
G4cout << " paraFlag: " << paraFlag << G4endl;
static G4bool first = true;
if(first) {
G4cout << " Preparing WeightWindow Sampling " << G4endl;
fGeomSampler->SetParallel(paraFlag);
if(paraFlag) {
fGeomSampler->PrepareWeightWindow(G4WeightWindowStore::GetInstance(paraName), fWWalg, fPlaceOfAction);
} else {
fGeomSampler->PrepareWeightWindow(G4WeightWindowStore::GetInstance(), fWWalg, fPlaceOfAction);
}
}
if(first) {
fGeomSampler->Configure();
first = false;
}
#ifdef G4MULTITHREADED
fGeomSampler->AddProcess();
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......