Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // $Id: G4VModularPhysicsList.hh 72043 2013-07-04 12:10:30Z 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 //
49 // ------------------------------------------------------------
50 #ifndef G4VModularPhysicsList_h
51 #define G4VModularPhysicsList_h 1
52 
53 #include <vector>
54 
55 #include "globals.hh"
56 #include "rundefs.hh"
57 #include "G4ios.hh"
58 
59 #include "G4VUserPhysicsList.hh"
60 #include "G4VPhysicsConstructor.hh"
61 #include "G4VUPLSplitter.hh"
62 
63 class G4VMPLData {
64  //Encapsulate the fields of class G4VModularPhysicsList
65  //that are per-thread.
66 public:
67  void initialize();
68  typedef std::vector<G4VPhysicsConstructor*> G4PhysConstVectorData;
70 };
71 
72 // The type G4VMPLManager is introduced to encapsulate the methods used by
73 // both the master thread and worker threads to allocate memory space for
74 // the fields encapsulated by the class G4VMPLData. When each thread
75 // changes the value for these fields, it refers to them using a macro
76 // definition defined below. For every G4VUserPhysicsList instance,
77 // there is a corresponding G4VMPLData instance. All G4VMPLData instances
78 // are organized by the class G4VMPLManager as an array.
79 // The field "int G4VMPLInstanceID" is added to the class G4VUserPhysicsList.
80 // The value of this field in each G4VUserPhysicsList instance is the
81 // subscript of the corresponding G44VUPLData instance.
82 // In order to use the class G44VUPLManager, we add a static member in the class
83 // G4VUserPhysicsList as follows: "static G4VMPLManager subInstanceManager".
84 // Both the master thread and worker threads change the length of the array
85 // for G44VUPLData instances mutually along with G4VUserPhysicsList
86 // instances are created.
89 
91 {
92  public:
94  virtual ~G4VModularPhysicsList();
95 
96  protected:
97  // hide copy constructor and assignment operator
100 
101  public: // with description
102  // This method will be invoked in the Construct() method.
103  // each particle type will be instantiated
104  virtual void ConstructParticle();
105 
106  // This method will be invoked in the Construct() method.
107  // each physics process will be instantiated and
108  // registered to the process manager of each particle type
109  virtual void ConstructProcess();
110 
111  public: // with description
112  // Register Physics Constructor
114 
115  const G4VPhysicsConstructor* GetPhysics(G4int index) const;
116  const G4VPhysicsConstructor* GetPhysics(const G4String& name) const;
117  const G4VPhysicsConstructor* GetPhysicsWithType(G4int physics_type) const;
118 
119  // Replace Physics Constructor
120  // The existing physics constructor with same physics_type as one of
121  // the given physics constructor is replaced
122  // (existing physics will be deleted)
123  // If a corresponding physics constructor is NOT found,
124  // the given physics constructor is just added
126 
127  // Remove Physics Constructor from the list
129  void RemovePhysics(G4int type);
130  void RemovePhysics(const G4String& name);
131 
132  /////////////////////////////////////
133  public: // with description
135  G4int GetVerboseLevel() const;
136  // set/get controle flag for output message
137  // 0: Silent
138  // 1: Warning message
139  // 2: More
140  // given verbose level is set to all physics constructors
141 
142  protected: // with description
143  // vector of pointers to G4VPhysicsConstructor
144  //typedef std::vector<G4VPhysicsConstructor*> G4PhysConstVector;
145  //static G4ThreadLocal G4PhysConstVector* physicsVector;
150  public:
151  inline G4int GetInstanceID() const;
152  static const G4VMPLManager& GetSubInstanceManager();
153 };
154 
155 inline
157 {
158  return verboseLevel;
159 }
160 
161 inline
163 {
164  return g4vmplInstanceID;
165 }
166 
167 inline
169 {
171 }
172 #endif
void RegisterPhysics(G4VPhysicsConstructor *)
G4VModularPhysicsList & operator=(const G4VModularPhysicsList &)
static const G4VMPLManager & GetSubInstanceManager()
const XML_Char * name
#define G4RUN_DLL
Definition: rundefs.hh:48
int G4int
Definition: G4Types.hh:78
G4VMPLManager G4VModularPhysicsListSubInstanceManager
const G4VPhysicsConstructor * GetPhysics(G4int index) const
std::vector< G4VPhysicsConstructor * > G4PhysConstVectorData
G4VUPLSplitter< G4VMPLData > G4VMPLManager
void SetVerboseLevel(G4int value)
const G4VPhysicsConstructor * GetPhysicsWithType(G4int physics_type) const
static G4RUN_DLL G4VMPLManager G4VMPLsubInstanceManager
void ReplacePhysics(G4VPhysicsConstructor *)
G4VMPLData::G4PhysConstVectorData G4PhysConstVector
void RemovePhysics(G4VPhysicsConstructor *)
const XML_Char int const XML_Char * value
G4PhysConstVectorData * physicsVector