Geant4 10.7.0
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//
27//
28//
29// ------------------------------------------------------------
30// GEANT 4 class header file
31//
32// Class Description:
33// This class is a subclass of G4VUserPhysicsList.
34// The user should register his/her physics constructors
35// by using
36// G4VModularPhysicsList::RegsiterPhysics()
37// to construt particles and processes.
38//
39// Only one physics constructor can be registered for each "physics_type".
40// Physics constructors with same "physics_type" can be replaced by
41// G4VModularPhysicsList::ReplacePhysics() method
42//
43// ------------------------------------------------------------
44// History
45// - first version 12 Nov 2000 by H.Kurashige
46// - Add ReplacePhysics 14 Mar 2011 by H.Kurashige
47// - Add Worker cleanup 21 Apr 2017 by A.Dotti
48//
49// ------------------------------------------------------------
50#ifndef G4VModularPhysicsList_h
51#define G4VModularPhysicsList_h 1
52
53#include <vector>
54
55#include "G4ios.hh"
56#include "globals.hh"
57#include "rundefs.hh"
58
60#include "G4VUPLSplitter.hh"
61#include "G4VUserPhysicsList.hh"
62
64{
65 // Encapsulate the fields of class G4VModularPhysicsList
66 // that are per-thread.
67 public:
68 void initialize();
69 typedef std::vector<G4VPhysicsConstructor*> G4PhysConstVectorData;
70 // TODO: understand this
71 // See: https://jira-geant4.kek.jp/browse/DEV-284
73};
74
75// The type G4VMPLManager is introduced to encapsulate the methods used by
76// both the master thread and worker threads to allocate memory space for
77// the fields encapsulated by the class G4VMPLData. When each thread
78// changes the value for these fields, it refers to them using a macro
79// definition defined below. For every G4VUserPhysicsList instance,
80// there is a corresponding G4VMPLData instance. All G4VMPLData instances
81// are organized by the class G4VMPLManager as an array.
82// The field "int G4VMPLInstanceID" is added to the class G4VUserPhysicsList.
83// The value of this field in each G4VUserPhysicsList instance is the
84// subscript of the corresponding G44VUPLData instance.
85// In order to use the class G44VUPLManager, we add a static member in the class
86// G4VUserPhysicsList as follows: "static G4VMPLManager subInstanceManager".
87// Both the master thread and worker threads change the length of the array
88// for G44VUPLData instances mutually along with G4VUserPhysicsList
89// instances are created.
92
94{
95 public:
97 virtual ~G4VModularPhysicsList();
98
99 protected:
100 // hide copy constructor and assignment operator
103
104 public: // with description
105 // This method will be invoked in the Construct() method.
106 // each particle type will be instantiated
107 virtual void ConstructParticle() override;
108
109 // This method will be invoked in the Construct() method.
110 // each physics process will be instantiated and
111 // registered to the process manager of each particle type
112 virtual void ConstructProcess() override;
113
114 public: // with description
115 // Register Physics Constructor
117
118 const G4VPhysicsConstructor* GetPhysics(G4int index) const;
119 const G4VPhysicsConstructor* GetPhysics(const G4String& name) const;
120 const G4VPhysicsConstructor* GetPhysicsWithType(G4int physics_type) const;
121
122 // Replace Physics Constructor
123 // The existing physics constructor with same physics_type as one of
124 // the given physics constructor is replaced
125 // (existing physics will be deleted)
126 // If a corresponding physics constructor is NOT found,
127 // the given physics constructor is just added
129
130 // Remove Physics Constructor from the list
132 void RemovePhysics(G4int type);
133 void RemovePhysics(const G4String& name);
134
135 /////////////////////////////////////
136 public: // with description
137 void SetVerboseLevel(G4int value);
138 G4int GetVerboseLevel() const;
139 // set/get controle flag for output message
140 // 0: Silent
141 // 1: Warning message
142 // 2: More
143 // given verbose level is set to all physics constructors
144
145 protected: // with description
150
151 public:
152 inline G4int GetInstanceID() const;
153 static const G4VMPLManager& GetSubInstanceManager();
154 virtual void TerminateWorker() override;
155};
156
158{
159 return verboseLevel;
160}
161
163{
164 return g4vmplInstanceID;
165}
166
168{
170}
171#endif
int G4int
Definition: G4Types.hh:85
G4VMPLManager G4VModularPhysicsListSubInstanceManager
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 &)
G4VMPLData::G4PhysConstVectorData G4PhysConstVector
virtual void ConstructProcess() override
void RegisterPhysics(G4VPhysicsConstructor *)
static G4RUN_DLL G4VMPLManager G4VMPLsubInstanceManager
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:47