Geant4-11
G4PhysListRegistry.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//
31// GEANT4 Class header file
32//
33//
34// File name: G4PhysListRegistry
35//
36// Author R. Hatcher 2014-10-15
37//
38// Modifications: based on G4PhysicsConstructorRegistry
39//
40//
41// Class Description
42// This is a singleton keeping pointers to all physics lists
43// Class Description - End
44
45#ifndef G4PhysListRegistry_hh
46#define G4PhysListRegistry_hh 1
47
48#include <vector>
49#include <map>
50#include "globals.hh"
51
52
55
57{
58public:
59
61 // access
62
64
67 // mapping from extension name to actual physics contructor process name
68
71
73
74 const std::vector<G4String>& AvailablePhysLists() const;
75 const std::vector<G4String>& AvailablePhysicsExtensions() const;
76 const std::vector<G4String>& AvailablePhysListsEM() const;
77
78 void PrintAvailablePhysLists() const;
79
81 std::vector<G4String>& physExt,
82 std::vector<G4int>& replace,
83 G4int verbose=0) const;
84
85 G4bool FindLongestMatch(const G4String& workName,
86 const G4String& searchName,
87 const std::vector<G4String>& validNames,
88 G4String& bestMatch,
89 G4int verbose=0) const;
90
91 inline void SetVerbose(G4int val) { verbose = val; }
92 inline G4int GetVerbose() const { return verbose; }
93
94 inline void SetUnknownFatal(G4int val) { unknownFatal = val; }
95 inline G4int GetUnknownFatal() const { return unknownFatal; }
96
97 void SetUserDefaultPhysList(const G4String& name="");
98 inline G4String GetUserDefaultPhysList() const { return userDefault; }
99 // set a prefered list in case where $PHYSLIST isn't defined
100 // if not set (or called with "") this falls back to system default
101
103
104private:
105
107
109
110 std::map <G4String, G4VBasePhysListStamper*> factories;
111 std::map <G4String, G4String> physicsExtensions;
112
118
119 // Make these mutable and update them on each request because the map might
120 // have been updated by the addition of new entries
121 // The only reason to have them at all is that that original interface
122 // returned a const reference and so we can't pass back a local object
123 // created upon the call of the method
124 mutable std::vector<G4String> availBasePhysLists;
125 mutable std::vector<G4String> availExtensions;
126
127};
128
129#endif
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
void PrintAvailablePhysLists() const
G4VModularPhysicsList * GetModularPhysicsListFromEnv()
void SetUnknownFatal(G4int val)
static G4ThreadLocal G4PhysListRegistry * theInstance
G4String userDefault
throw an exception if unsatisfiable?
const std::vector< G4String > & AvailablePhysLists() const
std::vector< G4String > availExtensions
void AddFactory(G4String name, G4VBasePhysListStamper *)
std::map< G4String, G4VBasePhysListStamper * > factories
std::vector< G4String > availBasePhysLists
void SetUserDefaultPhysList(const G4String &name="")
G4int GetUnknownFatal() const
const std::vector< G4String > & AvailablePhysListsEM() const
const std::vector< G4String > & AvailablePhysicsExtensions() const
void SetVerbose(G4int val)
static G4PhysListRegistry * Instance()
G4bool DeconstructPhysListName(const G4String &name, G4String &plBase, std::vector< G4String > &physExt, std::vector< G4int > &replace, G4int verbose=0) const
G4bool IsReferencePhysList(G4String nam) const
G4String GetUserDefaultPhysList() const
G4int GetVerbose() const
G4VModularPhysicsList * GetModularPhysicsList(const G4String &name)
G4String systemDefault
use this if $PHYSLIST isn't set
G4String GetSystemDefaultPhysList() const
void AddPhysicsExtension(G4String name, G4String procname)
G4bool FindLongestMatch(const G4String &workName, const G4String &searchName, const std::vector< G4String > &validNames, G4String &bestMatch, G4int verbose=0) const
std::map< G4String, G4String > physicsExtensions
const char * name(G4int ptype)
#define G4ThreadLocal
Definition: tls.hh:77