ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VModularPhysicsList.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 //
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 "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;
69  //TODO: understand this
70  //See: https://jira-geant4.kek.jp/browse/DEV-284
72 };
73 
74 // The type G4VMPLManager is introduced to encapsulate the methods used by
75 // both the master thread and worker threads to allocate memory space for
76 // the fields encapsulated by the class G4VMPLData. When each thread
77 // changes the value for these fields, it refers to them using a macro
78 // definition defined below. For every G4VUserPhysicsList instance,
79 // there is a corresponding G4VMPLData instance. All G4VMPLData instances
80 // are organized by the class G4VMPLManager as an array.
81 // The field "int G4VMPLInstanceID" is added to the class G4VUserPhysicsList.
82 // The value of this field in each G4VUserPhysicsList instance is the
83 // subscript of the corresponding G44VUPLData instance.
84 // In order to use the class G44VUPLManager, we add a static member in the class
85 // G4VUserPhysicsList as follows: "static G4VMPLManager subInstanceManager".
86 // Both the master thread and worker threads change the length of the array
87 // for G44VUPLData instances mutually along with G4VUserPhysicsList
88 // instances are created.
91 
93 {
94  public:
96  virtual ~G4VModularPhysicsList();
97 
98  protected:
99  // hide copy constructor and assignment operator
102 
103  public: // with description
104  // This method will be invoked in the Construct() method.
105  // each particle type will be instantiated
106  virtual void ConstructParticle() override;
107 
108  // This method will be invoked in the Construct() method.
109  // each physics process will be instantiated and
110  // registered to the process manager of each particle type
111  virtual void ConstructProcess() override;
112 
113  public: // with description
114  // Register Physics Constructor
116 
117  const G4VPhysicsConstructor* GetPhysics(G4int index) const;
118  const G4VPhysicsConstructor* GetPhysics(const G4String& name) const;
119  const G4VPhysicsConstructor* GetPhysicsWithType(G4int physics_type) const;
120 
121  // Replace Physics Constructor
122  // The existing physics constructor with same physics_type as one of
123  // the given physics constructor is replaced
124  // (existing physics will be deleted)
125  // If a corresponding physics constructor is NOT found,
126  // the given physics constructor is just added
128 
129  // Remove Physics Constructor from the list
131  void RemovePhysics(G4int type);
132  void RemovePhysics(const G4String& name);
133 
135  public: // with description
137  G4int GetVerboseLevel() const;
138  // set/get controle flag for output message
139  // 0: Silent
140  // 1: Warning message
141  // 2: More
142  // given verbose level is set to all physics constructors
143 
144  protected: // with description
149  public:
150  inline G4int GetInstanceID() const;
151  static const G4VMPLManager& GetSubInstanceManager();
152  virtual void TerminateWorker() override;
153 };
154 
155 inline
157 {
158  return verboseLevel;
159 }
160 
161 inline
163 {
164  return g4vmplInstanceID;
165 }
166 
167 inline
169 {
171 }
172 #endif