Import Geant4 10.3.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile 94085 2015-11-05 15:07:50Z gcosmo $
|
||||
# $Id: GNUmakefile 101161 2016-11-08 08:31:49Z gcosmo $
|
||||
# ---------------------------------------------------------------------------
|
||||
# GNUmakefile for physics_lists/constructors/factory library.
|
||||
# Gunter Folger 10-Jan-2012.
|
||||
@@ -49,6 +49,7 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/processes/cuts/include \
|
||||
-I$(G4BASE)/processes/biasing/generic/include \
|
||||
-I$(G4BASE)/processes/biasing/importance/include \
|
||||
-I$(G4BASE)/processes/parameterisation/include \
|
||||
-I$(G4BASE)/processes/hadronic/cross_sections/include \
|
||||
-I$(G4BASE)/processes/hadronic/stopping/include \
|
||||
-I$(G4BASE)/processes/hadronic/management/include \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History 95196 2016-01-29 08:26:36Z gcosmo $
|
||||
$Id: History 101161 2016-11-08 08:31:49Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -14,6 +14,43 @@ introduced in the code and keeptrack of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
07-Nov-2016, M. Verderi (phys-ctor-limiters-V10-02-08)
|
||||
- restore G4FastSimulationPhysics utility.
|
||||
- requires param-V10-02-01
|
||||
- reintroduce granular dependence on G4parameterisation.
|
||||
|
||||
04-Nov-2016, M. Verderi (phys-ctor-limiters-V10-02-07)
|
||||
- temporarily reverting changes related to G4FastSimulationPhysics
|
||||
to complete removal of aParticleIterator.
|
||||
|
||||
12-October-2016 G.Folger (phys-ctor-limiters-V10-02-06)
|
||||
- replace remaining direct use of aParticleIterator by GetParticleIterator().
|
||||
|
||||
03-Nov-2016, M. Verderi (phys-ctor-limiters-V10-02-05)
|
||||
- Add G4FastSimulationPhysics to configure physics list for activating
|
||||
fast simulation. It uses the G4FastSimulationHelper utility in
|
||||
processes/parameterisation, introduced in param-V10-02-01.
|
||||
- Granular dependence on G4parameterisation is added.
|
||||
|
||||
27-Oct-2016, M. Verderi (phys-ctor-limiters-V10-02-04)
|
||||
- G4GenericBiasingPhysics : add methods to configure physics lists
|
||||
to activate the parallel geometry functionnality introduced in
|
||||
the generic biasing (proc-biasgen-V10-02-04).
|
||||
- Add a README file to document the constructors (README did not look
|
||||
present, despite Michel's tag, problem ?).
|
||||
|
||||
16-October-2016 M.Maire (phys-ctor-limiters-V10-02-03)
|
||||
- add README
|
||||
|
||||
12-October-2016 G.Folger (phys-ctor-limiters-V10-02-02)
|
||||
- replace direct use of aParticleIterator by GetParticleIterator().
|
||||
fix required by clang39 on Windows and MAC
|
||||
|
||||
18-Jul-2016, I. Hrivnacova (phys-ctor-limiters-V10-02-01)
|
||||
- G4StepLimiterPhysics:
|
||||
Added an option which allows to apply the step limit to all particles
|
||||
(by default the step limit is applied to charged particles only).
|
||||
|
||||
27-Jan-2016, M. Asai (phys-ctor-limiters-V10-02-00)
|
||||
- G4ParallelWorldPhysics: change process order index of
|
||||
G4ParallelWorldProcess to 9900 to make sure it is registered
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
contructors/limiters
|
||||
--------------------
|
||||
|
||||
This directory contains "technical" constructors in the sense they do not
|
||||
add processes with physics content but add processes or modify physics lists to
|
||||
allow for step limitation in parallel geometries, biasing, etc.
|
||||
|
||||
|
||||
G4FastSimulationPhysics:
|
||||
------------------------
|
||||
|
||||
Constructor that modifies a given physics list to allow for fast simulation.
|
||||
|
||||
One, or several, G4FastSimulationManagerProcess objects are added to the
|
||||
process manager of particles for which a fast simulation is requested.
|
||||
|
||||
The fast simulation may be associated to regions in the mass geometry, in
|
||||
what case a call like fastSimPhys->ActivateFastSimulation("e-") must be
|
||||
done to allow for fast simulation of electrons.
|
||||
Parallel geometries can be used also in what case the geometry is specified
|
||||
by its name like fastSimPhys->ActivateFastSimulation("e-","parallelGeom") to
|
||||
allow for fast simulation of electrons, with fast simulation models attached
|
||||
to regions in "parallelGeom".
|
||||
|
||||
|
||||
G4GenericBiasingPhysics:
|
||||
------------------------
|
||||
|
||||
Constructor that modifies a given physics list to allow for generic biasing.
|
||||
|
||||
It provides three type of functionnalities:
|
||||
- wrap physics processes with G4BiasingProcessInterface processes to
|
||||
make the generic biasing to control them (allowing change of
|
||||
interaction law, change of final state generation).
|
||||
- add G4BiasingProcessInterface processes, but without wrapping a
|
||||
physics process, in what case these processes will be used for
|
||||
"non-physics based biasing" : ie, spliting and killing
|
||||
- add G4ParallelGeometriesLimiterProcess process (at most one per
|
||||
process manager) that provides step limitation on the parallel
|
||||
geometries used in generic biasing. A process can handle several
|
||||
parallel geometries associated to one particle type.
|
||||
|
||||
Various methods are provided to activate these functionnalities per
|
||||
particle, set of particles, to activate physics-based only or
|
||||
non-physics-based only or both functionnalities, and to activate the
|
||||
parallel geometry functionnality.
|
||||
This is documented in include/G4GenericBiasingPhysics.hh .
|
||||
|
||||
|
||||
G4ImportanceBiasing:
|
||||
-------------------
|
||||
|
||||
G4MaxTimeCuts:
|
||||
--------------
|
||||
|
||||
G4MinEkineCuts:
|
||||
---------------
|
||||
|
||||
G4NeutronTrackingCut:
|
||||
---------------------
|
||||
|
||||
G4ParallelWorldPhysics:
|
||||
-----------------------
|
||||
|
||||
G4SpecialCuts:
|
||||
--------------
|
||||
|
||||
G4StepLimiterPhysics:
|
||||
---------------------
|
||||
|
||||
G4WeightWindowBiasing:
|
||||
----------------------
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef G4FastSimulationPhysics_h
|
||||
#define G4FastSimulationPhysics_h 1
|
||||
|
||||
#include "G4VPhysicsConstructor.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class G4FastSimulationPhysics : public G4VPhysicsConstructor
|
||||
{
|
||||
public:
|
||||
|
||||
G4FastSimulationPhysics(const G4String& name = "FastSimP");
|
||||
virtual ~G4FastSimulationPhysics();
|
||||
|
||||
public:
|
||||
// --------------------------------------
|
||||
// -- Fast simulation activation methods:
|
||||
// --------------------------------------
|
||||
// -- Used to select particles for which fast simulation has to be activated:
|
||||
// ---- Activate fast simulation for one particle with fast simulation attached to mass geometry:
|
||||
void ActivateFastSimulation(const G4String& particleName);
|
||||
// ---- Activate fast simulation for one particle with fast simulation attached to a parallel geometry:
|
||||
void ActivateFastSimulation(const G4String& particleName, const G4String& parallelGeometryName);
|
||||
|
||||
// -- Information about particles under fast simulation:
|
||||
void BeVerbose() { fVerbose = true; }
|
||||
|
||||
public:
|
||||
|
||||
// This method is dummy for physics
|
||||
virtual void ConstructParticle();
|
||||
|
||||
// This method will be invoked in the Construct() method.
|
||||
// each physics process will be instantiated and
|
||||
// registered to the process manager of each particle type
|
||||
virtual void ConstructProcess();
|
||||
|
||||
private:
|
||||
|
||||
// hide assignment operator
|
||||
G4FastSimulationPhysics & operator=(const G4FastSimulationPhysics &right);
|
||||
G4FastSimulationPhysics(const G4FastSimulationPhysics&);
|
||||
|
||||
// -- Particles under fast simulation:
|
||||
std::vector< G4String > fParticlesUnderFastSimulation;
|
||||
// -- And their related possible parallel geometries:
|
||||
std::vector< G4String > fGeometries;
|
||||
|
||||
// -- Report:
|
||||
G4bool fVerbose;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -47,6 +47,9 @@ public:
|
||||
virtual ~G4GenericBiasingPhysics();
|
||||
|
||||
public:
|
||||
// ------------------------------
|
||||
// -- Biasing activation methods:
|
||||
// ------------------------------
|
||||
// -- Used to select particles and processes to be under biasing:
|
||||
// ---- Put under biasing all physics processes of given particleName:
|
||||
void PhysicsBias(const G4String& particleName);
|
||||
@@ -77,6 +80,28 @@ public:
|
||||
void NonPhysicsBiasAllNeutral( G4bool includeShortLived = false );
|
||||
void BiasAllNeutral( G4bool includeShortLived = false );
|
||||
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// -- Activation of parallel geometries used by generic biasing:
|
||||
// -------------------------------------------------------------
|
||||
// -- Each method can be called several times:
|
||||
// -- - on a same particle type :
|
||||
// -- myBiasingPhysics->AddParallelGeometry("neutron", "geometry1");
|
||||
// -- myBiasingPhysics->AddParallelGeometry("neutron", "geometry2");
|
||||
// -- - on a range of PDG particle:
|
||||
// -- myBiasingPhysics->AddParallelGeometry(PDG1, PDG2, "geometryXX");
|
||||
// -- myBiasingPhysics->AddParallelGeometry(PDG3, PDG4, vectorOfGeometries);
|
||||
// -- etc.
|
||||
void AddParallelGeometry( const G4String& particleName, const G4String& parallelGeometryName );
|
||||
void AddParallelGeometry( const G4String& particleName, const std::vector< G4String >& parallelGeometryNames );
|
||||
void AddParallelGeometry( G4int PDGlow, G4int PDGhigh, const G4String& parallelGeometryName , G4bool includeAntiParticle = true );
|
||||
void AddParallelGeometry( G4int PDGlow, G4int PDGhigh, const std::vector< G4String >& parallelGeometryNames, G4bool includeAntiParticle = true );
|
||||
void AddParallelGeometryAllCharged( const G4String& parallelGeometryName , G4bool includeShortLived = false );
|
||||
void AddParallelGeometryAllCharged( const std::vector< G4String >& parallelGeometryNames, G4bool includeShortLived = false );
|
||||
void AddParallelGeometryAllNeutral( const G4String& parallelGeometryName , G4bool includeShortLived = false );
|
||||
void AddParallelGeometryAllNeutral( const std::vector< G4String >& parallelGeometryNames, G4bool includeShortLived = false );
|
||||
|
||||
|
||||
|
||||
// -- Information about biased particles:
|
||||
void BeVerbose() { fVerbose = true; }
|
||||
@@ -110,8 +135,21 @@ private:
|
||||
std::vector< G4int > fNonPhysBiasByPDGRangeLow, fNonPhysBiasByPDGRangeHigh;
|
||||
G4bool fPhysBiasAllCharged, fNonPhysBiasAllCharged;
|
||||
G4bool fPhysBiasAllChargedISL, fNonPhysBiasAllChargedISL;
|
||||
G4bool fPhysBiasAllNeutral, fNonPhysBiasAllNeutral;
|
||||
G4bool fPhysBiasAllNeutral, fNonPhysBiasAllNeutral;
|
||||
G4bool fPhysBiasAllNeutralISL, fNonPhysBiasAllNeutralISL;
|
||||
|
||||
|
||||
// -- Particles associated with parallel geometries:
|
||||
std::vector< G4String > fParticlesWithParallelGeometries;
|
||||
std::map< G4String, std::vector< G4String > > fParallelGeometriesForParticle;
|
||||
std::vector< G4int > fPDGlowParallelGeometries, fPDGhighParallelGeometries;
|
||||
std::map< G4int, std::vector< G4String > > fPDGrangeParallelGeometries;
|
||||
std::vector< G4String > fParallelGeometriesForCharged, fParallelGeometriesForNeutral;
|
||||
std::vector< G4bool > fAllChargedParallelGeometriesISL, fAllNeutralParallelGeometriesISL;
|
||||
|
||||
|
||||
void AssociateParallelGeometries();
|
||||
|
||||
|
||||
// -- Report:
|
||||
G4bool fVerbose;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4StepLimiterPhysics.hh 81367 2014-05-27 12:59:27Z gcosmo $
|
||||
// $Id: G4StepLimiterPhysics.hh 98777 2016-08-09 14:37:59Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -57,6 +57,11 @@ public:
|
||||
// registered to the process manager of each particle type
|
||||
virtual void ConstructProcess();
|
||||
|
||||
// Option to apply the step limit to all particles
|
||||
// (by default the step limit is applied to charged particles only)
|
||||
void SetApplyToAll(G4bool option) { fApplyToAll= option; }
|
||||
G4bool GetApplyToAll() const { return fApplyToAll; }
|
||||
|
||||
private:
|
||||
|
||||
// hide assignment operator
|
||||
@@ -65,7 +70,7 @@ private:
|
||||
|
||||
G4StepLimiter* fStepLimiter;
|
||||
G4UserSpecialCuts* fUserSpecialCuts;
|
||||
|
||||
G4bool fApplyToAll;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# Generated on : 10/01/2013
|
||||
#
|
||||
# $Id: sources.cmake 94085 2015-11-05 15:07:50Z gcosmo $
|
||||
# $Id: sources.cmake 101161 2016-11-08 08:31:49Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -49,6 +49,7 @@ include_directories(${CMAKE_SOURCE_DIR}/source/processes/cuts/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/scoring/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/biasing/generic/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/biasing/importance/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/parameterisation/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/cross_sections/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/stopping/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/management/include)
|
||||
@@ -92,6 +93,7 @@ GEANT4_DEFINE_MODULE(NAME G4phys_ctor_limiters
|
||||
G4ImportanceBiasing.hh
|
||||
G4WeightWindowBiasing.hh
|
||||
G4GenericBiasingPhysics.hh
|
||||
G4FastSimulationPhysics.hh
|
||||
G4MaxTimeCuts.hh
|
||||
G4MinEkineCuts.hh
|
||||
G4NeutronTrackingCut.hh
|
||||
@@ -102,6 +104,7 @@ GEANT4_DEFINE_MODULE(NAME G4phys_ctor_limiters
|
||||
G4ImportanceBiasing.cc
|
||||
G4WeightWindowBiasing.cc
|
||||
G4GenericBiasingPhysics.cc
|
||||
G4FastSimulationPhysics.cc
|
||||
G4MaxTimeCuts.cc
|
||||
G4MinEkineCuts.cc
|
||||
G4NeutronTrackingCut.cc
|
||||
@@ -114,6 +117,7 @@ GEANT4_DEFINE_MODULE(NAME G4phys_ctor_limiters
|
||||
G4cuts
|
||||
G4scoring
|
||||
G4biasing
|
||||
G4parameterisation
|
||||
G4decay
|
||||
G4digits
|
||||
G4emhighenergy
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4FastSimulationPhysics
|
||||
//
|
||||
// Author: M. Verderi (Nov.03.2016)
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4FastSimulationPhysics.hh"
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
|
||||
#include "G4FastSimulationHelper.hh"
|
||||
#include "G4FastSimulationManagerProcess.hh"
|
||||
|
||||
// factory
|
||||
#include "G4PhysicsConstructorFactory.hh"
|
||||
//
|
||||
G4_DECLARE_PHYSCONSTR_FACTORY(G4FastSimulationPhysics);
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4FastSimulationPhysics::G4FastSimulationPhysics(const G4String& name)
|
||||
: G4VPhysicsConstructor(name),
|
||||
fVerbose(false)
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4FastSimulationPhysics::~G4FastSimulationPhysics()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4FastSimulationPhysics::ActivateFastSimulation(const G4String& particleName)
|
||||
{
|
||||
fParticlesUnderFastSimulation.push_back(particleName);
|
||||
fGeometries .push_back("");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4FastSimulationPhysics::ActivateFastSimulation(const G4String& particleName, const G4String& parallelGeometryName)
|
||||
{
|
||||
fParticlesUnderFastSimulation.push_back(particleName);
|
||||
fGeometries .push_back(parallelGeometryName);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4FastSimulationPhysics::ConstructParticle()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4FastSimulationPhysics::ConstructProcess()
|
||||
{
|
||||
|
||||
auto myParticleIterator = GetParticleIterator();
|
||||
myParticleIterator->reset();
|
||||
|
||||
while ( (*myParticleIterator)() )
|
||||
{
|
||||
G4ParticleDefinition* particle = myParticleIterator->value();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
// -- include fast simulation manager process interface:
|
||||
auto itr = std::find( fParticlesUnderFastSimulation.begin(),
|
||||
fParticlesUnderFastSimulation.end(),
|
||||
particleName );
|
||||
|
||||
if ( itr != fParticlesUnderFastSimulation.end() )
|
||||
{
|
||||
size_t ipos = itr - fParticlesUnderFastSimulation.begin();
|
||||
G4String geometry = fGeometries[ipos];
|
||||
if ( geometry == "" ) G4FastSimulationHelper::ActivateFastSimulation(pmanager);
|
||||
else G4FastSimulationHelper::ActivateFastSimulation(pmanager, geometry);
|
||||
}
|
||||
}
|
||||
|
||||
// -- tells what is done:
|
||||
if ( fVerbose )
|
||||
{
|
||||
// -- print:
|
||||
myParticleIterator->reset();
|
||||
|
||||
while ( (*myParticleIterator)() )
|
||||
{
|
||||
G4ParticleDefinition* particle = myParticleIterator->value();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
G4bool isUnderFastSimulation(false);
|
||||
G4String processAndGeometryNames;
|
||||
G4int icount(0);
|
||||
|
||||
G4ProcessVector* vprocess = pmanager->GetProcessList();
|
||||
for (G4int ip = 0 ; ip < vprocess->size() ; ip++)
|
||||
{
|
||||
G4VProcess* process = (*vprocess)[ip];
|
||||
G4FastSimulationManagerProcess* pb = dynamic_cast< G4FastSimulationManagerProcess* >(process);
|
||||
if ( pb != nullptr )
|
||||
{
|
||||
isUnderFastSimulation = true;
|
||||
if ( icount < 3 )
|
||||
{
|
||||
processAndGeometryNames += pb->GetProcessName();
|
||||
processAndGeometryNames += "[geom:";
|
||||
processAndGeometryNames += pb->GetWorldVolume()->GetName();
|
||||
processAndGeometryNames += "] ";
|
||||
}
|
||||
else
|
||||
{
|
||||
processAndGeometryNames += "\n ";
|
||||
processAndGeometryNames += pb->GetProcessName();
|
||||
processAndGeometryNames += "[geom:";
|
||||
processAndGeometryNames += pb->GetWorldVolume()->GetName();
|
||||
processAndGeometryNames += "] ";
|
||||
icount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( isUnderFastSimulation ) G4cout << std::setw(14) << particleName << " : " << processAndGeometryNames << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,8 @@
|
||||
|
||||
#include "G4BiasingHelper.hh"
|
||||
#include "G4BiasingProcessInterface.hh"
|
||||
#include "G4ParallelGeometriesLimiterProcess.hh"
|
||||
|
||||
|
||||
// factory
|
||||
#include "G4PhysicsConstructorFactory.hh"
|
||||
@@ -183,6 +185,122 @@ void G4GenericBiasingPhysics::BiasAllNeutral( G4bool includeShortLived )
|
||||
}
|
||||
|
||||
|
||||
void G4GenericBiasingPhysics::AddParallelGeometry( const G4String& particleName, const G4String& parallelGeometryName )
|
||||
{
|
||||
// -- add particle, caring of possible duplication:
|
||||
G4bool isKnown = false;
|
||||
for ( G4String knownParticle : fParticlesWithParallelGeometries )
|
||||
{
|
||||
if ( knownParticle == particleName )
|
||||
{
|
||||
isKnown = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// -- add the geometry, caring for possible duplication of this geometry, for this particle:
|
||||
if ( !isKnown ) fParticlesWithParallelGeometries.push_back( particleName );
|
||||
std::vector< G4String >& geometries = fParallelGeometriesForParticle[particleName];
|
||||
|
||||
isKnown = false;
|
||||
for ( G4String knownGeometry : geometries )
|
||||
{
|
||||
if ( knownGeometry == parallelGeometryName )
|
||||
{
|
||||
isKnown = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !isKnown ) geometries.push_back( parallelGeometryName );
|
||||
|
||||
}
|
||||
|
||||
void G4GenericBiasingPhysics::AddParallelGeometry( const G4String& particleName, const std::vector< G4String >& parallelGeometryNames )
|
||||
{
|
||||
for ( G4String geometry : parallelGeometryNames ) AddParallelGeometry( particleName, geometry );
|
||||
}
|
||||
|
||||
void G4GenericBiasingPhysics::AddParallelGeometry( G4int PDGlow, G4int PDGhigh, const G4String& parallelGeometryName , G4bool includeAntiParticle )
|
||||
{
|
||||
if ( PDGlow > PDGhigh )
|
||||
{
|
||||
G4cout << "G4GenericBiasingPhysics::AddParallelGeometry( G4int PDGlow, G4int PDGhigh, const G4String& parallelGeometryName , G4bool includeAntiParticle = true ), PDGlow > PDGhigh : call ignored" << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
fPDGlowParallelGeometries .push_back( PDGlow );
|
||||
fPDGhighParallelGeometries.push_back( PDGhigh );
|
||||
G4int rangeIndex = fPDGlowParallelGeometries.size() - 1;
|
||||
fPDGrangeParallelGeometries[rangeIndex].push_back( parallelGeometryName );
|
||||
|
||||
if ( includeAntiParticle )
|
||||
{
|
||||
fPDGlowParallelGeometries .push_back( -PDGhigh );
|
||||
fPDGhighParallelGeometries.push_back( -PDGlow );
|
||||
rangeIndex = fPDGlowParallelGeometries.size() - 1;
|
||||
fPDGrangeParallelGeometries[rangeIndex].push_back( parallelGeometryName );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void G4GenericBiasingPhysics::AddParallelGeometry( G4int PDGlow, G4int PDGhigh, const std::vector< G4String >& parallelGeometryNames, G4bool includeAntiParticle )
|
||||
{
|
||||
if ( PDGlow > PDGhigh )
|
||||
{
|
||||
G4cout << "G4GenericBiasingPhysics::AddParallelGeometry( G4int PDGlow, G4int PDGhigh, const std::vector< G4String >& parallelGeometryNames, G4bool includeAntiParticle = true ), PDGlow > PDGhigh : call ignored" << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for ( G4String geometry : parallelGeometryNames ) AddParallelGeometry( PDGlow, PDGhigh, geometry, includeAntiParticle );
|
||||
}
|
||||
|
||||
void G4GenericBiasingPhysics::AddParallelGeometryAllCharged( const G4String& parallelGeometryName , G4bool includeShortLived )
|
||||
{
|
||||
G4bool isKnown = false;
|
||||
for ( G4String geometry : fParallelGeometriesForCharged )
|
||||
{
|
||||
if ( geometry == parallelGeometryName )
|
||||
{
|
||||
isKnown = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !isKnown )
|
||||
{
|
||||
fParallelGeometriesForCharged .push_back( parallelGeometryName );
|
||||
fAllChargedParallelGeometriesISL.push_back( includeShortLived );
|
||||
}
|
||||
}
|
||||
|
||||
void G4GenericBiasingPhysics::AddParallelGeometryAllCharged( const std::vector< G4String >& parallelGeometryNames, G4bool includeShortLived )
|
||||
{
|
||||
for ( G4String geometry : parallelGeometryNames ) AddParallelGeometryAllCharged( geometry, includeShortLived );
|
||||
}
|
||||
|
||||
void G4GenericBiasingPhysics::AddParallelGeometryAllNeutral( const G4String& parallelGeometryName , G4bool includeShortLived )
|
||||
{
|
||||
G4bool isKnown = false;
|
||||
for ( G4String geometry : fParallelGeometriesForNeutral )
|
||||
{
|
||||
if ( geometry == parallelGeometryName )
|
||||
{
|
||||
isKnown = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !isKnown )
|
||||
{
|
||||
fParallelGeometriesForNeutral .push_back( parallelGeometryName );
|
||||
fAllNeutralParallelGeometriesISL.push_back( includeShortLived );
|
||||
}
|
||||
}
|
||||
|
||||
void G4GenericBiasingPhysics::AddParallelGeometryAllNeutral( const std::vector< G4String >& parallelGeometryNames, G4bool includeShortLived )
|
||||
{
|
||||
for ( G4String geometry : parallelGeometryNames ) AddParallelGeometryAllNeutral( geometry, includeShortLived );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -195,11 +313,12 @@ void G4GenericBiasingPhysics::ConstructProcess()
|
||||
{
|
||||
|
||||
// -- bias setup per individual particle name:
|
||||
aParticleIterator->reset();
|
||||
auto particleIterator=GetParticleIterator();
|
||||
particleIterator->reset();
|
||||
|
||||
while( (*aParticleIterator)() )
|
||||
while( (*particleIterator)() )
|
||||
{
|
||||
G4ParticleDefinition* particle = aParticleIterator->value();
|
||||
G4ParticleDefinition* particle = particleIterator->value();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
@@ -246,11 +365,11 @@ void G4GenericBiasingPhysics::ConstructProcess()
|
||||
|
||||
|
||||
// -- bias setup per group:
|
||||
aParticleIterator->reset();
|
||||
particleIterator->reset();
|
||||
|
||||
while( (*aParticleIterator)() )
|
||||
while( (*particleIterator)() )
|
||||
{
|
||||
G4ParticleDefinition* particle = aParticleIterator->value();
|
||||
G4ParticleDefinition* particle = particleIterator->value();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
@@ -325,15 +444,20 @@ void G4GenericBiasingPhysics::ConstructProcess()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -- Associate parallel geometries:
|
||||
AssociateParallelGeometries();
|
||||
|
||||
|
||||
// -- tells what is done:
|
||||
if ( fVerbose )
|
||||
{
|
||||
// -- print:
|
||||
aParticleIterator->reset();
|
||||
particleIterator->reset();
|
||||
|
||||
while( (*aParticleIterator)() )
|
||||
while( (*particleIterator)() )
|
||||
{
|
||||
G4ParticleDefinition* particle = aParticleIterator->value();
|
||||
G4ParticleDefinition* particle = particleIterator->value();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
@@ -375,3 +499,76 @@ void G4GenericBiasingPhysics::ConstructProcess()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void G4GenericBiasingPhysics::AssociateParallelGeometries()
|
||||
{
|
||||
|
||||
// -- parallel geometries for individual particles:
|
||||
auto particleIterator=GetParticleIterator();
|
||||
particleIterator->reset();
|
||||
|
||||
while( (*particleIterator)() )
|
||||
{
|
||||
G4ParticleDefinition* particle = particleIterator->value();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
G4bool requested = false;
|
||||
for ( G4String requestedParticles : fParticlesWithParallelGeometries )
|
||||
{
|
||||
if ( requestedParticles == particleName )
|
||||
{
|
||||
requested = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( requested )
|
||||
{
|
||||
// -- insert biasing process for handling parallel geometries:
|
||||
G4ParallelGeometriesLimiterProcess* limiter = G4BiasingHelper::AddLimiterProcess(pmanager);
|
||||
|
||||
// -- attach the requested worlds to this process:
|
||||
std::vector< G4String >& parallelWorlds = fParallelGeometriesForParticle[ particleName ];
|
||||
for ( G4String world : parallelWorlds ) limiter->AddParallelWorld( world );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// -- parallel geometries for particles in PDG ranges:
|
||||
G4int i = 0; // -- index for PDG range
|
||||
for ( G4int PDGlow : fPDGlowParallelGeometries )
|
||||
{
|
||||
G4int PDGhigh = fPDGhighParallelGeometries[i];
|
||||
auto & geometries = fPDGrangeParallelGeometries[i];
|
||||
|
||||
particleIterator->reset();
|
||||
|
||||
while( (*particleIterator)() )
|
||||
{
|
||||
G4ParticleDefinition* particle = particleIterator->value();
|
||||
G4int particlePDG = particle->GetPDGEncoding();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
if ( ( particlePDG >= PDGlow ) && ( particlePDG <= PDGhigh ) )
|
||||
{
|
||||
// -- §§ exclude particles from individual list ?
|
||||
// -- insert biasing process for handling parallel geometries:
|
||||
G4ParallelGeometriesLimiterProcess* limiter = G4BiasingHelper::AddLimiterProcess(pmanager);
|
||||
|
||||
// -- attached the requested worlds to this process:
|
||||
for ( auto geometry : geometries ) limiter->AddParallelWorld( geometry );
|
||||
}
|
||||
}
|
||||
// -- increment index for next PDG range:
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
// -- parallel geometries for all charged particles:
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -82,9 +82,10 @@ void G4ParallelWorldPhysics::ConstructProcess()
|
||||
theParallelWorldProcess->SetParallelWorld(namePhysics);
|
||||
theParallelWorldProcess->SetLayeredMaterialFlag(fLayeredMass);
|
||||
|
||||
aParticleIterator->reset();
|
||||
while( (*aParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = aParticleIterator->value();
|
||||
auto myParticleIterator=GetParticleIterator();
|
||||
myParticleIterator->reset();
|
||||
while( (*myParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = myParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
pmanager->AddProcess(theParallelWorldProcess);
|
||||
if(theParallelWorldProcess->IsAtRestRequired(particle))
|
||||
|
||||
@@ -55,7 +55,8 @@ G4_DECLARE_PHYSCONSTR_FACTORY(G4StepLimiterPhysics);
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4StepLimiterPhysics::G4StepLimiterPhysics(const G4String& name)
|
||||
: G4VPhysicsConstructor(name),fStepLimiter(0),fUserSpecialCuts(0)
|
||||
: G4VPhysicsConstructor(name),fStepLimiter(0),fUserSpecialCuts(0),
|
||||
fApplyToAll(false)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -75,24 +76,25 @@ void G4StepLimiterPhysics::ConstructParticle()
|
||||
|
||||
void G4StepLimiterPhysics::ConstructProcess()
|
||||
{
|
||||
aParticleIterator->reset();
|
||||
auto myParticleIterator=GetParticleIterator();
|
||||
myParticleIterator->reset();
|
||||
|
||||
fStepLimiter = new G4StepLimiter();
|
||||
fUserSpecialCuts = new G4UserSpecialCuts();
|
||||
while ((*aParticleIterator)()) {
|
||||
G4ParticleDefinition* particle = aParticleIterator->value();
|
||||
while ((*myParticleIterator)()) {
|
||||
G4ParticleDefinition* particle = myParticleIterator->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);
|
||||
if (charge != 0.0 || fApplyToAll) {
|
||||
// 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);
|
||||
// Energy cuts for all other neutral particles
|
||||
pmanager->AddDiscreteProcess(fUserSpecialCuts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user