Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VModularPhysicsList.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4VModularPhysicsList
27//
28// Class description:
29//
30// This class is a subclass of G4VUserPhysicsList.
31// The user should register his/her physics constructors by using:
32// G4VModularPhysicsList::RegsiterPhysics()
33// to construt particles and processes.
34//
35// Only one physics constructor can be registered for each "physics_type".
36// Physics constructors with same "physics_type" can be replaced using the
37// G4VModularPhysicsList::ReplacePhysics() method.
38
39// Original author: H.Kurashige (Kobe University), 12 November 2000
40// --------------------------------------------------------------------
41#ifndef G4VModularPhysicsList_hh
42#define G4VModularPhysicsList_hh 1
43
44#include <vector>
45
46#include "G4ios.hh"
47#include "globals.hh"
48#include "rundefs.hh"
49
51#include "G4VUPLSplitter.hh"
52#include "G4VUserPhysicsList.hh"
53
55{
56 // Encapsulate the fields of class G4VModularPhysicsList
57 // that are per-thread.
58
59 public:
60
61 void initialize();
62 using G4PhysConstVectorData = std::vector<G4VPhysicsConstructor*>;
63 // See: https://jira-geant4.kek.jp/browse/DEV-284
65};
66
67// The type G4VMPLManager is introduced to encapsulate the methods used by
68// both the master thread and worker threads to allocate memory space for
69// the fields encapsulated by the class G4VMPLData. When each thread
70// changes the value for these fields, it refers to them using a macro
71// definition defined below. For every G4VUserPhysicsList instance,
72// there is a corresponding G4VMPLData instance. All G4VMPLData instances
73// are organized by the class G4VMPLManager as an array.
74// The field "int G4VMPLInstanceID" is added to the class G4VUserPhysicsList.
75// The value of this field in each G4VUserPhysicsList instance is the
76// subscript of the corresponding G44VUPLData instance.
77// In order to use the class G44VUPLManager, we add a static member in the class
78// G4VUserPhysicsList as follows: "static G4VMPLManager subInstanceManager".
79// Both the master thread and worker threads change the length of the array
80// for G44VUPLData instances mutually along with G4VUserPhysicsList
81// instances are created.
82//
85
87{
88 public:
89
91 virtual ~G4VModularPhysicsList();
92
93 virtual void ConstructParticle() override;
94 // This method will be invoked in the Construct() method.
95 // Each particle type will be instantiated.
96
97 virtual void ConstructProcess() override;
98 // This method will be invoked in the Construct() method.
99 // Each physics process will be instantiated and
100 // registered to the process manager of each particle type.
101
103 // Register Physics Constructor.
104
105 const G4VPhysicsConstructor* GetPhysics(G4int index) const;
106 const G4VPhysicsConstructor* GetPhysics(const G4String& name) const;
107 const G4VPhysicsConstructor* GetPhysicsWithType(G4int physics_type) const;
108
110 // Replace the Physics Constructor.
111 // The existing physics constructor with same physics_type as one of
112 // the given physics constructor is replaced (existing physics will be
113 // deleted). If a corresponding physics constructor is NOT found,
114 // the given physics constructor is just added.
115
117 void RemovePhysics(G4int type);
118 void RemovePhysics(const G4String& name);
119 // Remove the Physics Constructor from the list.
120
121 inline G4int GetInstanceID() const;
122 static const G4VMPLManager& GetSubInstanceManager();
123 virtual void TerminateWorker() override;
124
125 void SetVerboseLevel(G4int value);
126 G4int GetVerboseLevel() const;
127 // Set/get control flag for output message
128 // 0: Silent
129 // 1: Warning message
130 // 2: More
131 // given verbose level is set to all physics constructors.
132
133 protected:
134
137 // Protected copy constructor and assignment operator.
138
140
144};
145
146// Inline methods implementations
147
149{
150 return verboseLevel;
151}
152
154{
155 return g4vmplInstanceID;
156}
157
159{
161}
162
163#endif
int G4int
Definition: G4Types.hh:85
G4VUPLSplitter< G4VMPLData > G4VMPLManager
std::vector< G4VPhysicsConstructor * > G4PhysConstVectorData
G4PhysConstVectorData * physicsVector
virtual void TerminateWorker() override
virtual void ConstructParticle() override
void SetVerboseLevel(G4int value)
G4VModularPhysicsList & operator=(const G4VModularPhysicsList &)
virtual void ConstructProcess() override
void RegisterPhysics(G4VPhysicsConstructor *)
static G4RUN_DLL G4VMPLManager G4VMPLsubInstanceManager
G4VMPLData::G4PhysConstVectorData G4PhysConstVector
void RemovePhysics(G4VPhysicsConstructor *)
const G4VPhysicsConstructor * GetPhysicsWithType(G4int physics_type) const
void ReplacePhysics(G4VPhysicsConstructor *)
static const G4VMPLManager & GetSubInstanceManager()
const G4VPhysicsConstructor * GetPhysics(G4int index) const
#define G4RUN_DLL
Definition: rundefs.hh:45