Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4VModularPhysicsList.hh
이 파일의 문서화 페이지로 가기
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 // $Id: G4VModularPhysicsList.hh 103803 2017-04-27 14:03:05Z gcosmo $
28 //
29 //
30 // ------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 // Class Description:
34 // This class is a subclass of G4VUserPhysicsList.
35 // The user should register his/her physics constructors
36 // by using
37 // G4VModularPhysicsList::RegsiterPhysics()
38 // to construt particles and processes.
39 //
40 // Only one physics constructor can be registered for each "physics_type".
41 // Physics constructors with same "physics_type" can be replaced by
42 // G4VModularPhysicsList::ReplacePhysics() method
43 //
44 // ------------------------------------------------------------
45 // History
46 // - first version 12 Nov 2000 by H.Kurashige
47 // - Add ReplacePhysics 14 Mar 2011 by H.Kurashige
48 // - Add Worker cleanup 21 Apr 2017 by A.Dotti
49 //
50 // ------------------------------------------------------------
51 #ifndef G4VModularPhysicsList_h
52 #define G4VModularPhysicsList_h 1
53 
54 #include <vector>
55 
56 #include "globals.hh"
57 #include "rundefs.hh"
58 #include "G4ios.hh"
59 
60 #include "G4VUserPhysicsList.hh"
61 #include "G4VPhysicsConstructor.hh"
62 #include "G4VUPLSplitter.hh"
63 
64 class G4VMPLData {
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 
136  public: // with description
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  public:
151  inline G4int GetInstanceID() const;
152  static const G4VMPLManager& GetSubInstanceManager();
153  virtual void TerminateWorker() override;
154 };
155 
156 inline
158 {
159  return verboseLevel;
160 }
161 
162 inline
164 {
165  return g4vmplInstanceID;
166 }
167 
168 inline
170 {
172 }
173 #endif
const XML_Char * name
Definition: expat.h:151
virtual void ConstructParticle() override
#define G4RUN_DLL
Definition: rundefs.hh:48
static const G4VMPLManager & GetSubInstanceManager()
G4VMPLData::G4PhysConstVectorData G4PhysConstVector
void RemovePhysics(G4VPhysicsConstructor *)
const G4VPhysicsConstructor * GetPhysics(G4int index) const
const XML_Char int const XML_Char * value
Definition: expat.h:331
void RegisterPhysics(G4VPhysicsConstructor *)
void ReplacePhysics(G4VPhysicsConstructor *)
int G4int
Definition: G4Types.hh:78
G4PhysConstVectorData * physicsVector
std::vector< G4VPhysicsConstructor * > G4PhysConstVectorData
virtual void TerminateWorker() override
static G4RUN_DLL G4VMPLManager G4VMPLsubInstanceManager
const G4VPhysicsConstructor * GetPhysicsWithType(G4int physics_type) const
G4VUPLSplitter< G4VMPLData > G4VMPLManager
G4VModularPhysicsList & operator=(const G4VModularPhysicsList &)
G4VMPLManager G4VModularPhysicsListSubInstanceManager
virtual void ConstructProcess() override
void SetVerboseLevel(G4int value)