Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4VUserPhysicsList.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$
28//
29//
30// ------------------------------------------------------------
31// GEANT 4 class header file
32// Class Description:
33// This class is an abstract class for
34// constructing particles and processes.
35// User must implement following three virtual methods
36// in his/her own concrete class derived from this class.
37// G4VUserPhysicsList::ConstructParticle()
38// Construct particles
39// G4VUserPhysicsList::ConstructProcess()
40// Construct procesess and register them to particles
41//
42// -------------------------------------------
43// History
44// first version 09 Jan. 1998 by H.Kurashige
45// modified 24 Jan. 1998 by H.Kurashige
46// rename DumpCutValues/DumpCutValuesTable
47// change SetCuts method
48// add SetCutsWithDefault method
49// modified 06 June 1998 by H.Kurashige
50// add AddProcessManager
51// add BuildPhysicsTable
52// modified 29 June 1998 by H.Kurashige
53// add AddProcessManager
54// modified 05 Dec. 1998 by H.Kurashige
55// add ConstructAllParticles()
56// modified 14, Apr 1999 by H.Kurashige
57// change BuildPhysicsTable as public
58// removed ConstructAllParticles() and related methods
59// changed SetCuts method argument
60// modified 08, Nov 2000 by H.Kurashige
61// added Retrieve/StorePhysicsTable and related methods
62// modified 08, Mar 2001 by H.Kurashige
63// added binary mode for Retrieve/StorePhysicsTable
64// added RetrieveCutValues and related
65// added Set/ResetStoredInAscii() to switch on ascii mode
66// for Retrieve/StorePhysicsTable
67// modified for CUTS per REGION 10, Oct 2002 by H.Kurashige
68// removed following methods
69// void ReCalcCutValue()
70// void SetCutValueForOthers()
71// void SetCutValueForOtherThan()
72// void ReCalcCutValueForOthers()
73// virtual G4bool StoreMaterialInfo()
74// virtual G4bool StoreCutValues()
75// virtual G4bool RetrieveCutValues()
76// virtual G4bool CheckForRetrievePhysicsTable()
77// virtual G4bool CheckMaterialInfo()
78// added void BuildPhysicsTable()
79// Added PhysicsListHelper 29 Apr. 2011 H.Kurashige
80// Added default impelmentation of SetCuts 10 June 2011 H.Kurashige
81// SetCuts is not 'pure virtual' any more
82// ------------------------------------------------------------
83#ifndef G4VUserPhysicsList_h
84#define G4VUserPhysicsList_h 1
85#include "globals.hh"
86#include "G4ios.hh"
87
88#include "G4ParticleTable.hh"
91
94class G4VProcess;
95
97{
98 public:
100 virtual ~G4VUserPhysicsList();
101
102 // copy constructor and assignment operator
105
106 public: // with description
107 // Each particle type will be instantiated
108 // This method is invoked by the RunManger
109 virtual void ConstructParticle() = 0;
110
111 // By calling the "Construct" method,
112 // process manager and processes are created.
113 void Construct();
114
115 // Each physics process will be instantiated and
116 // registered to the process manager of each particle type
117 // This method is invoked in Construct method
118 virtual void ConstructProcess() = 0;
119
120 protected: // with description
121 // User must invoke this method in his ConstructProcess()
122 // implementation in order to insures particle transportation.
123 void AddTransportation();
124
125 //Register a process to the particle type
126 // according to the ordering parameter table
127 // 'true' is returned if the process is registerd successfully
129 G4ParticleDefinition* particle);
130
131 public:
132 void UseCoupledTransportation(G4bool vl=true);
133
134 /////////////////////////////////////////////////////////////////
135 public: // with description
136 // "SetCuts" method sets a cut value for all particle types
137 // in the particle table
138 virtual void SetCuts();
139
140 public: // with description
141 // set/get the default cut value
142 // Calling SetDefaultCutValue causes re-calcuration of cut values
143 // and physics tables just before the next event loop
144 void SetDefaultCutValue(G4double newCutValue);
146
147 /////////////////////////////////////////////////////////////////////
148 public: // with description
149 // Invoke BuildPhysicsTable for all processes for all particles
150 // In case of "Retrieve" flag is ON, PhysicsTable will be
151 // retrieved from files
152 void BuildPhysicsTable();
153
154 // do PreparePhysicsTable for specified particle type
156
157 // do BuildPhysicsTable for specified particle type
159
160 // Store PhysicsTable together with both material and cut value
161 // information in files under the specified directory.
162 // (return true if files are sucessfully created)
163 G4bool StorePhysicsTable(const G4String& directory = ".");
164
165 // Return true if "Retrieve" flag is ON.
166 // (i.e. PhysicsTable will be retrieved from files)
168 G4bool IsStoredInAscii() const;
169
170 // Get directory path for physics table files.
171 const G4String& GetPhysicsTableDirectory() const;
172
173 // Set "Retrieve" flag
174 // Directory path can be set together.
175 // Null string (default) means directory is not changed
176 // from the current value
177 void SetPhysicsTableRetrieved(const G4String& directory = "");
178 void SetStoredInAscii();
179
180 // Reset "Retrieve" flag
182 void ResetStoredInAscii();
183
184 ///////////////////////////////////////////////////////////////////////
185 public: // with description
186 // Print out the List of registered particles types
187 void DumpList() const;
188
189 public: // with description
190 // Request to print out information of cut values
191 // Printing will be performed when all tables are made
192 void DumpCutValuesTable(G4int flag =1);
193
194 // The following method actually trigger the print-out requested
195 // by the above method. This method must be invoked by RunManager
196 // at the proper moment.
198
199 public: // with description
200 void SetVerboseLevel(G4int value);
201 G4int GetVerboseLevel() const;
202 // set/get controle flag for output message
203 // 0: Silent
204 // 1: Warning message
205 // 2: More
206
207 ///////////////////////////////////////////////////////////////////////////
208 public: // with description
209 // "SetCutsWithDefault" method invokes default SetCuts method
210 // Note: Cut values will not be overwriten with this method
211 // Using default SetCuts method is recommended
212 // (i.e You do not need to implement SetCuts method)
213 void SetCutsWithDefault();
214
215 // Following are utility methods for SetCuts
216
217 // SetCutValue sets a cut value for a particle type for the default region
218 void SetCutValue(G4double aCut, const G4String& pname);
219
220 // GetCutValue sets a cut value for a particle type for the default region
221 G4double GetCutValue(const G4String& pname) const;
222
223 // SetCutValue sets a cut value for a particle type for a region
224 void SetCutValue(G4double aCut, const G4String& pname, const G4String& rname);
225
226 // Invoke SetCuts for specified particle for a region
227 // If the pointer to the region is NULL, the default region is used
228 // In case of "Retrieve" flag is ON,
229 // Cut values will be retrieved from files
230 void SetParticleCuts(G4double cut,G4ParticleDefinition* particle,G4Region* region=0);
231 void SetParticleCuts( G4double cut, const G4String& particleName, G4Region* region=0);
232
233 // Invoke SetCuts for all particles in a region
234 void SetCutsForRegion(G4double aCut, const G4String& rname);
235
236 // Following are utility methods are obsolete
237 void ResetCuts();
238
239///////////////////////////////////////////////////////////////////
240 public:
241 // Get/SetApplyCuts gets/sets the flag for ApplyCuts
242 void SetApplyCuts(G4bool value, const G4String& name);
243 G4bool GetApplyCuts(const G4String& name) const;
244
245///////////////////////////////////////////////////////////////////////////////
246 protected:
247 // do BuildPhysicsTable for make the integral schema
249
250
251 protected:
252 // Retrieve PhysicsTable from files for proccess belongng the particle.
253 // Normal BuildPhysics procedure of processes will be invoked,
254 // if it fails (in case of Process's RetrievePhysicsTable returns false)
256 const G4String& directory,
257 G4bool ascii = false);
258
259 /////////////////////////////////////////////////////////////////
260 protected:
261 // adds new ProcessManager to all particles in the Particle Table
262 // this routine is used in Construct()
264
265 public: // with description
266 // remove and delete ProcessManagers for all particles in tha Particle Table
267 // this routine is invoked from RunManager
269
270 public: // with description
271 // add process manager for particles created on-the-fly
272 void AddProcessManager(G4ParticleDefinition* newParticle,
273 G4ProcessManager* newManager = 0 );
274
275 /////////////////////////////////////////////////////////////////
276 public:
277 // check consistencies of list of particles
278
279 void CheckParticleList();
280
282
283 ////////////////////////////////////////////////////////////////////////
284 protected:
285 // the particle table has the complete List of existing particle types
288
289 protected:
290 // pointer to G4UserPhysicsListMessenger
292
293 protected:
295
296 protected:
297 // this is the default cut value for all particles
300
301 protected:
302 // pointer to ProductionCutsTable
304
305 // flag to determine physics table will be build from file or not
308
311
312 // directory name for physics table files
314
315 // flag for displaying the range cuts & energy thresholds
317
318 // flag for Physics Table has been built
320
321 // flag for CheckParticleList
323
324 // PhysicsListHelper
326
327 private:
328 enum { FixedStringLengthForStore = 32 };
329
330
331};
332
334{
335#ifdef G4VERBOSE
336 if (verboseLevel >1) G4cout << "G4VUserPhysicsList::Construct()" << G4endl;
337#endif
338
340
341#ifdef G4VERBOSE
342 if (verboseLevel >1) G4cout << "Construct processes " << G4endl;
343#endif
345
346}
347
349{
350 return defaultCutValue;
351}
352
353
355{
356 return verboseLevel;
357}
358
359inline
361{
362 return fRetrievePhysicsTable;
363}
364
365inline
367{
368 return fStoredInAscii;
369}
370
371inline
373{
374 return directoryPhysicsTable;
375}
376
377inline
379{
380 fStoredInAscii = true;
381}
382
383
384inline
386{
387 fRetrievePhysicsTable = false;
388 fIsRestoredCutValues = false;
390}
391
392
393inline
395{
396 fStoredInAscii = false;
397}
398
399inline
401{
403}
404
405#endif
406
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4double GetCutValue(const G4String &pname) const
void SetDefaultCutValue(G4double newCutValue)
G4UserPhysicsListMessenger * theMessenger
void SetPhysicsTableRetrieved(const G4String &directory="")
virtual void ConstructProcess()=0
G4VUserPhysicsList & operator=(const G4VUserPhysicsList &)
void PreparePhysicsTable(G4ParticleDefinition *)
void SetCutValue(G4double aCut, const G4String &pname)
G4bool RegisterProcess(G4VProcess *process, G4ParticleDefinition *particle)
void UseCoupledTransportation(G4bool vl=true)
G4bool IsStoredInAscii() const
void SetCutsForRegion(G4double aCut, const G4String &rname)
G4ProductionCutsTable * fCutsTable
virtual void ConstructParticle()=0
G4bool StorePhysicsTable(const G4String &directory=".")
G4ParticleTable * theParticleTable
void SetVerboseLevel(G4int value)
G4int GetVerboseLevel() const
void SetApplyCuts(G4bool value, const G4String &name)
const G4String & GetPhysicsTableDirectory() const
G4bool IsPhysicsTableRetrieved() const
void SetParticleCuts(G4double cut, G4ParticleDefinition *particle, G4Region *region=0)
virtual void RetrievePhysicsTable(G4ParticleDefinition *, const G4String &directory, G4bool ascii=false)
void ResetCuts()
obsolete methods
G4bool fIsCheckedForRetrievePhysicsTable
void DumpCutValuesTable(G4int flag=1)
G4bool GetApplyCuts(const G4String &name) const
void AddProcessManager(G4ParticleDefinition *newParticle, G4ProcessManager *newManager=0)
void BuildIntegralPhysicsTable(G4VProcess *, G4ParticleDefinition *)
G4ParticleTable::G4PTblDicIterator * theParticleIterator
G4double GetDefaultCutValue() const
G4PhysicsListHelper * thePLHelper