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,19 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4physlist_ctor_factory
# Package: Geant4.src.G4physicslists.G4phys_ctors.G4phys_ctor_factory
#
# CMakeLists.txt for building a single granular library.
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt 66241 2012-12-13 18:34:42Z gunter $
#
#------------------------------------------------------------------------------
if(GEANT4_BUILD_GRANULAR_LIBS)
include(Geant4MacroLibraryTargets)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
endif()
@@ -0,0 +1,97 @@
# $Id: GNUmakefile 77567 2013-11-26 09:40:31Z gcosmo $
# ---------------------------------------------------------------------------
# GNUmakefile for physics_lists/constructors/factory library.
# Gunter Folger 10-Jan-2012.
# ---------------------------------------------------------------------------
name := G4phys_ctor_factory
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/magneticfield/include \
-I$(G4BASE)/geometry/navigation/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/particles/shortlived/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/run/include \
-I$(G4BASE)/physics_lists/builders/include \
-I$(G4BASE)/physics_lists/constructors/decay/include \
-I$(G4BASE)/physics_lists/constructors/electromagnetic/include \
-I$(G4BASE)/physics_lists/constructors/gamma_lepto_nuclear/include \
-I$(G4BASE)/physics_lists/constructors/hadron_elastic/include \
-I$(G4BASE)/physics_lists/constructors/hadron_inelastic/include \
-I$(G4BASE)/physics_lists/constructors/limiters/include \
-I$(G4BASE)/physics_lists/constructors/ions/include \
-I$(G4BASE)/physics_lists/constructors/stopping/include \
-I$(G4BASE)/physics_lists/util/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/transportation/include \
-I$(G4BASE)/processes/decay/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/processes/optical/include \
-I$(G4BASE)/processes/electromagnetic/highenergy/include \
-I$(G4BASE)/processes/electromagnetic/standard/include \
-I$(G4BASE)/processes/electromagnetic/muons/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/processes/electromagnetic/xrays/include \
-I$(G4BASE)/processes/electromagnetic/lowenergy/include \
-I$(G4BASE)/processes/electromagnetic/dna/management/include \
-I$(G4BASE)/processes/electromagnetic/dna/molecules/management/include \
-I$(G4BASE)/processes/electromagnetic/dna/molecules/types/include \
-I$(G4BASE)/processes/electromagnetic/dna/models/include \
-I$(G4BASE)/processes/electromagnetic/dna/processes/include \
-I$(G4BASE)/processes/electromagnetic/dna/utils/include \
-I$(G4BASE)/processes/hadronic/cross_sections/include \
-I$(G4BASE)/processes/hadronic/stopping/include \
-I$(G4BASE)/processes/hadronic/management/include \
-I$(G4BASE)/processes/hadronic/processes/include \
-I$(G4BASE)/processes/hadronic/util/include \
-I$(G4BASE)/processes/hadronic/models/management/include \
-I$(G4BASE)/processes/hadronic/models/util/include \
-I$(G4BASE)/processes/hadronic/models/binary_cascade/include \
-I$(G4BASE)/processes/hadronic/models/cascade/cascade/include \
-I$(G4BASE)/processes/hadronic/models/qmd/include \
-I$(G4BASE)/processes/hadronic/models/coherent_elastic/include \
-I$(G4BASE)/processes/hadronic/models/de_excitation/evaporation/include \
-I$(G4BASE)/processes/hadronic/models/de_excitation/fermi_breakup/include \
-I$(G4BASE)/processes/hadronic/models/de_excitation/handler/include \
-I$(G4BASE)/processes/hadronic/models/de_excitation/management/include \
-I$(G4BASE)/processes/hadronic/models/de_excitation/multifragmentation/include \
-I$(G4BASE)/processes/hadronic/models/de_excitation/photon_evaporation/include \
-I$(G4BASE)/processes/hadronic/models/de_excitation/util/include \
-I$(G4BASE)/processes/hadronic/models/im_r_matrix/include \
-I$(G4BASE)/processes/hadronic/models/inclxx/utils/include \
-I$(G4BASE)/processes/hadronic/models/inclxx/incl_physics/include \
-I$(G4BASE)/processes/hadronic/models/inclxx/interface/include \
-I$(G4BASE)/processes/hadronic/models/lend/include \
-I$(G4BASE)/processes/hadronic/models/lepto_nuclear/include \
-I$(G4BASE)/processes/hadronic/models/neutron_hp/include \
-I$(G4BASE)/processes/hadronic/models/parton_string/diffraction/include \
-I$(G4BASE)/processes/hadronic/models/parton_string/hadronization/include \
-I$(G4BASE)/processes/hadronic/models/parton_string/management/include \
-I$(G4BASE)/processes/hadronic/models/parton_string/qgsm/include \
-I$(G4BASE)/processes/hadronic/models/photolepton_hadron/muon_nuclear/include \
-I$(G4BASE)/processes/hadronic/models/pre_equilibrium/exciton_model/include \
-I$(G4BASE)/processes/hadronic/models/radioactive_decay/include \
-I$(G4BASE)/processes/hadronic/models/theo_high_energy/include \
-I$(G4BASE)/processes/hadronic/util/include \
-I$(G4BASE)/materials/include
include $(G4INSTALL)/config/common.gmk
@@ -0,0 +1,28 @@
$Id: History 66241 2012-12-13 18:34:42Z gunter $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Hadronic physics-list/constructors/factory History
--------------------------------------------------
This file should be used to briefly summarize all major modifications
introduced in the code and keeptrack of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
07-Nov-2013, Alberto Ribon (phys-ctor-fact-V09-06-03)
- Removed low_energy and high_energy from sources.cmake and GNUmakefile.
29-Jan-2013, Gunter Folger (phys-ctor-fact-V09-06-02)
- fix sources.cmake for moved files
29-Jan-2013, Gunter Folger (phys-ctor-fact-V09-06-01)
- move G4PhysListFactory from constructor/factory to lists.
10-Jan-2012, Gunter Folger (phys-ctor-fact-V09-06-00)
- new directory structure introduced.
constructors/factory classes
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef G4PhysicsConstructorFactory_h
#define G4PhysicsConstructorFactory_h 1
#include "globals.hh"
#include "G4PhysicsConstructorRegistry.hh"
#include "G4VPhysicsConstructor.hh"
class G4VBasePhysConstrFactory
{
public:
virtual G4VPhysicsConstructor* Instantiate() = 0;
};
template <typename T> class G4PhysicsConstructorFactory : public G4VBasePhysConstrFactory
{
public:
G4PhysicsConstructorFactory(const G4String& name)
{
G4PhysicsConstructorRegistry::Instance()->AddFactory(name, this);
}
virtual G4VPhysicsConstructor* Instantiate()
{
return new T();
}
};
#define G4_DECLARE_PHYSCONSTR_FACTORY(physics_constructor) \
const G4PhysicsConstructorFactory<physics_constructor>& physics_constructor##Factory = G4PhysicsConstructorFactory<physics_constructor>(#physics_constructor)
#define G4_REFERENCE_PHYSCONSTR_FACTORY(physics_constructor) \
class physics_constructor; \
extern const G4PhysicsConstructorFactory<physics_constructor>& physics_constructor##Factory; \
const G4PhysicsConstructorFactory<physics_constructor>& physics_constructor##FactoryRef = physics_constructor##Factory
#endif
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * 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:
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4PhysicsConstructorRegistry
//
// Author W. Pokorski 21.09.2012
//
// Modifications:
//
//
// Class Description
// This is a singleton keeping pointers to all physics constructors
// Class Description - End
#ifndef G4PhysicsConstructorRegistry_h
#define G4PhysicsConstructorRegistry_h 1
#include <vector>
#include <map>
#include "globals.hh"
class G4VPhysicsConstructor;
class G4VBasePhysConstrFactory;
class G4PhysicsConstructorRegistry
{
public:
static G4PhysicsConstructorRegistry* Instance();
// access
~G4PhysicsConstructorRegistry();
void Register(G4VPhysicsConstructor*);
//register new physics constructors
void DeRegister(G4VPhysicsConstructor*);
//deregister physics constructors
void Clean();
//clean the store
void AddFactory(G4String, G4VBasePhysConstrFactory*);
G4VPhysicsConstructor* GetPhysicsConstructor(const G4String& name);
private:
G4PhysicsConstructorRegistry();
static G4ThreadLocal G4PhysicsConstructorRegistry* theInstance;
std::vector <G4VPhysicsConstructor*> physConstr;
std::map <G4String, G4VBasePhysConstrFactory*> factories;
};
#endif
@@ -0,0 +1,199 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4phys_ctor_factory
# Package: Geant4.src.G4physicslists.G4physlist_ctors.G4physlist_ctor_factory
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 10/01/2013
#
# $Id: sources.cmake 66241 2012-12-13 18:34:42Z gunter $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/digits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/event/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/magneticfield/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/navigation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/bosons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/hadrons/barions/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/hadrons/ions/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/hadrons/mesons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/leptons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/shortlived/include)
include_directories(${CMAKE_SOURCE_DIR}/source/physics_lists/builders/include)
include_directories(${CMAKE_SOURCE_DIR}/source/physics_lists/constructors/decay/include)
include_directories(${CMAKE_SOURCE_DIR}/source/physics_lists/constructors/electromagnetic/include)
include_directories(${CMAKE_SOURCE_DIR}/source/physics_lists/constructors/gamma_lepto_nuclear/include)
include_directories(${CMAKE_SOURCE_DIR}/source/physics_lists/constructors/hadron_elastic/include)
include_directories(${CMAKE_SOURCE_DIR}/source/physics_lists/constructors/hadron_inelastic/include)
include_directories(${CMAKE_SOURCE_DIR}/source/physics_lists/constructors/limiters/include)
include_directories(${CMAKE_SOURCE_DIR}/source/physics_lists/constructors/ions/include)
include_directories(${CMAKE_SOURCE_DIR}/source/physics_lists/constructors/stopping/include)
include_directories(${CMAKE_SOURCE_DIR}/source/physics_lists/util/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/cuts/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/decay/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/electromagnetic/dna/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/electromagnetic/highenergy/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/electromagnetic/lowenergy/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/electromagnetic/muons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/electromagnetic/standard/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/electromagnetic/utils/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/electromagnetic/xrays/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/cross_sections/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/binary_cascade/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/cascade/cascade/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/cascade/evaporation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/cascade/utils/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/coherent_elastic/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/evaporation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/fermi_breakup/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/fission/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/gem_evaporation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/handler/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/multifragmentation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/photon_evaporation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/util/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/im_r_matrix/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/inclxx/utils/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/inclxx/incl_physics/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/inclxx/interface/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/isotope_production/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/lend/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/lepto_nuclear/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/neutron_hp/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/parton_string/diffraction/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/parton_string/hadronization/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/parton_string/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/parton_string/qgsm/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/pre_equilibrium/exciton_model/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/radioactive_decay/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/theo_high_energy/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/util/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/processes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/stopping/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/util/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/util/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/optical/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/transportation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/run/include)
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
include_directories(${CMAKE_SOURCE_DIR}/source/tracking/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4phys_ctor_factory
HEADERS
G4PhysicsConstructorFactory.hh
G4PhysicsConstructorRegistry.hh
SOURCES
G4PhysicsConstructorRegistry.cc
GRANULAR_DEPENDENCIES
G4baryons
G4bosons
G4cuts
G4decay
G4digits
G4emhighenergy
G4emlowenergy
G4emstandard
G4emutils
G4event
G4geometrymng
G4globman
G4had_im_r_matrix
G4had_lend
G4had_mod_man
G4had_mod_util
G4had_lept_nuclear
G4had_neu_hp
G4had_preequ_exciton
G4had_string_diff
G4had_string_frag
G4had_string_man
G4had_theo_max
G4hadronic_HE
G4hadronic_LE
G4hadronic_bert_cascade
G4hadronic_binary
G4hadronic_coherent_elastic
G4hadronic_deex_evaporation
G4hadronic_deex_fermi_breakup
G4hadronic_deex_fission
G4hadronic_deex_gem_evaporation
G4hadronic_deex_handler
G4hadronic_deex_management
G4hadronic_deex_multifragmentation
G4hadronic_deex_photon_evaporation
G4hadronic_deex_util
G4hadronic_inclxx_interface
G4hadronic_inclxx_physics
G4hadronic_inclxx_utils
G4hadronic_mgt
G4hadronic_proc
G4hadronic_qgstring
G4hadronic_radioactivedecay
G4hadronic_stop
G4hadronic_util
G4hadronic_xsect
G4hits
G4intercoms
G4ions
G4leptons
G4magneticfield
G4materials
G4mesons
G4muons
G4navigation
G4optical
G4partman
G4phys_builders
G4procman
G4run
G4shortlived
G4track
G4tracking
G4transportation
G4volumes
G4xrays
GLOBAL_DEPENDENCIES
G4digits_hits
G4event
G4geometry
G4global
G4intercoms
G4materials
G4particles
G4processes
G4run
G4track
G4tracking
LINK_LIBRARIES
)
# List any source specific properties here
@@ -0,0 +1,131 @@
//
// ********************************************************************
// * 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:
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4PhysicsConstructorRegistry
//
// Author W. Pokorski 21.09.2012
//
// Modifications:
//
#include "G4ios.hh"
#include "G4PhysicsConstructorRegistry.hh"
#include "G4VPhysicsConstructor.hh"
#include "G4PhysicsConstructorFactory.hh"
G4ThreadLocal G4PhysicsConstructorRegistry* G4PhysicsConstructorRegistry::theInstance = 0;
G4PhysicsConstructorRegistry* G4PhysicsConstructorRegistry::Instance()
{
if(0 == theInstance) {
static G4ThreadLocal G4PhysicsConstructorRegistry *manager_G4MT_TLS_ = 0 ; if (!manager_G4MT_TLS_) manager_G4MT_TLS_ = new G4PhysicsConstructorRegistry ; G4PhysicsConstructorRegistry &manager = *manager_G4MT_TLS_;
theInstance = &manager;
}
return theInstance;
}
G4PhysicsConstructorRegistry::G4PhysicsConstructorRegistry()
{}
G4PhysicsConstructorRegistry::~G4PhysicsConstructorRegistry()
{
Clean();
}
void G4PhysicsConstructorRegistry::Clean()
{
size_t n = physConstr.size();
if(n > 0) {
for (size_t i=0; i<n; ++i) {
if(physConstr[i]) {
G4VPhysicsConstructor* p = physConstr[i];
physConstr[i] = 0;
delete p;
}
}
physConstr.clear();
}
}
void G4PhysicsConstructorRegistry::Register(G4VPhysicsConstructor* p)
{
if(!p) return;
size_t n = physConstr.size();
if(n > 0) {
for (size_t i=0; i<n; ++i) {
if(physConstr[i] == p) { return; }
}
}
physConstr.push_back(p);
}
void G4PhysicsConstructorRegistry::DeRegister(G4VPhysicsConstructor* p)
{
if(!p) return;
size_t n = physConstr.size();
if(n > 0) {
for (size_t i=0; i<n; ++i) {
if(physConstr[i] == p) {
physConstr[i] = 0;
return;
}
}
}
}
void G4PhysicsConstructorRegistry::AddFactory(G4String name, G4VBasePhysConstrFactory* factory)
{
factories[name] = factory;
}
G4VPhysicsConstructor* G4PhysicsConstructorRegistry::GetPhysicsConstructor(const G4String& name)
{
// check if factory exists...
//
if (factories.find(name)!=factories.end())
{
// we could store the list of called factories in some vector and
// before returning we can could first check if this physics constructor was already instantiated
// if yes, we can throw an exception saying that this physics can been already registered
return factories[name]->Instantiate();
}
else
{
G4ExceptionDescription ED;
ED << "The factory for the physics constructor ["<< name << "] does not exist!" << G4endl;
G4Exception("G4PhysicsConstructorRegistry::GetPhysicsConstructor", "PhysicsList001", FatalException, ED);
return 0;
}
}