Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4PhysListFactory Class Reference

#include <G4PhysListFactory.hh>

Public Member Functions

 G4PhysListFactory ()
 
 ~G4PhysListFactory ()
 
G4VModularPhysicsListGetReferencePhysList (const G4String &)
 
G4VModularPhysicsListReferencePhysList ()
 
G4bool IsReferencePhysList (const G4String &)
 
const std::vector< G4String > & AvailablePhysLists () const
 
const std::vector< G4String > & AvailablePhysListsEM () const
 
void SetVerbose (G4int val)
 

Detailed Description

Definition at line 44 of file G4PhysListFactory.hh.

Constructor & Destructor Documentation

G4PhysListFactory::G4PhysListFactory ( )

Definition at line 66 of file G4PhysListFactory.cc.

67  : defName("FTFP_BERT"),verbose(1)
68 {
69  nlists_hadr = 18;
70  G4String ss[18] = {
71  "FTFP_BERT","FTFP_BERT_TRV","FTFP_BERT_HP","FTFP_INCLXX",
72  "FTFP_INCLXX_HP","FTF_BIC", "LBE","QBBC",
73  "QGSP_BERT","QGSP_BERT_HP","QGSP_BIC","QGSP_BIC_HP",
74  "QGSP_FTFP_BERT","QGSP_INCLXX","QGSP_INCLXX_HP","QGS_BIC",
75  "Shielding","ShieldingLEND"};
76  for(size_t i=0; i<nlists_hadr; ++i) {
77  listnames_hadr.push_back(ss[i]);
78  }
79 
80  nlists_em = 7;
81  G4String s1[7] = {"","_EMV","_EMX","_EMY","_EMZ","_LIV","_PEN"};
82  for(size_t i=0; i<nlists_em; ++i) {
83  listnames_em.push_back(s1[i]);
84  }
85 }
G4PhysListFactory::~G4PhysListFactory ( )

Definition at line 87 of file G4PhysListFactory.cc.

88 {}

Member Function Documentation

const std::vector< G4String > & G4PhysListFactory::AvailablePhysLists ( ) const

Definition at line 214 of file G4PhysListFactory.cc.

215 {
216  return listnames_hadr;
217 }
const std::vector< G4String > & G4PhysListFactory::AvailablePhysListsEM ( ) const

Definition at line 220 of file G4PhysListFactory.cc.

221 {
222  return listnames_em;
223 }
G4VModularPhysicsList * G4PhysListFactory::GetReferencePhysList ( const G4String name)

Definition at line 111 of file G4PhysListFactory.cc.

References G4cout, G4endl, G4VModularPhysicsList::GetVerboseLevel(), n, G4VModularPhysicsList::ReplacePhysics(), and G4VModularPhysicsList::SetVerboseLevel().

Referenced by PhysicsList::AddPackage(), ML2PhysicsList::AddPackage(), main(), and ReferencePhysList().

112 {
113  // analysis on the string
114  size_t n = name.size();
115 
116  // last characters in the string
117  size_t em_opt = 0;
118  G4String em_name = "";
119 
120  // check EM options
121  if(n > 4) {
122  em_name = name.substr(n - 4, 4);
123  for(size_t i=1; i<nlists_em; ++i) {
124  if(listnames_em[i] == em_name) {
125  em_opt = i;
126  n -= 4;
127  break;
128  }
129  }
130  if(0 == em_opt) { em_name = ""; }
131  }
132 
133  // hadronic pHysics List
134  G4String had_name = name.substr(0, n);
135 
136  if(0 < verbose) {
137  G4cout << "G4PhysListFactory::GetReferencePhysList <" << had_name
138  << em_name << "> EMoption= " << em_opt << G4endl;
139  }
141  if(had_name == "FTFP_BERT") {p = new FTFP_BERT(verbose);}
142  else if(had_name == "FTFP_BERT_HP") {p = new FTFP_BERT_HP(verbose);}
143  else if(had_name == "FTFP_BERT_TRV") {p = new FTFP_BERT_TRV(verbose);}
144  else if(had_name == "FTFP_INCLXX") {p = new FTFP_INCLXX(verbose);}
145  else if(had_name == "FTFP_INCLXX_HP") {p = new FTFP_INCLXX_HP(verbose);}
146  else if(had_name == "FTF_BIC") {p = new FTF_BIC(verbose);}
147  else if(had_name == "LBE") {p = new LBE();}
148  else if(had_name == "QBBC") {p = new QBBC(verbose);}
149  else if(had_name == "QGSP_BERT") {p = new QGSP_BERT(verbose);}
150  else if(had_name == "QGSP_BERT_HP") {p = new QGSP_BERT_HP(verbose);}
151  else if(had_name == "QGSP_BIC") {p = new QGSP_BIC(verbose);}
152  else if(had_name == "QGSP_BIC_HP") {p = new QGSP_BIC_HP(verbose);}
153  else if(had_name == "QGSP_FTFP_BERT") {p = new QGSP_FTFP_BERT(verbose);}
154  else if(had_name == "QGSP_INCLXX") {p = new QGSP_INCLXX(verbose);}
155  else if(had_name == "QGSP_INCLXX_HP") {p = new QGSP_INCLXX_HP(verbose);}
156  else if(had_name == "QGS_BIC") {p = new QGS_BIC(verbose);}
157  else if(had_name == "Shielding") {p = new Shielding(verbose);}
158  else if(had_name == "ShieldingLEND") {p = new Shielding(verbose,"LEND");}
159  else {
160  G4cout << "### G4PhysListFactory WARNING: "
161  << "PhysicsList " << had_name << " is not known"
162  << G4endl;
163  }
164  if(p) {
165  G4cout << "<<< Reference Physics List " << had_name
166  << em_name << " is built" << G4endl;
167  G4int ver = p->GetVerboseLevel();
168  p->SetVerboseLevel(0);
169  if(0 < em_opt) {
170  if(1 == em_opt) {
172  } else if(2 == em_opt) {
174  } else if(3 == em_opt) {
176  } else if(4 == em_opt) {
178  } else if(5 == em_opt) {
179  p->ReplacePhysics(new G4EmLivermorePhysics(verbose));
180  } else if(6 == em_opt) {
181  p->ReplacePhysics(new G4EmPenelopePhysics(verbose));
182  }
183  }
184  p->SetVerboseLevel(ver);
185  }
186  G4cout << G4endl;
187  return p;
188 }
TQGSP_FTFP_BERT< G4VModularPhysicsList > QGSP_FTFP_BERT
TQGSP_BERT< G4VModularPhysicsList > QGSP_BERT
Definition: QGSP_BERT.hh:63
TQGSP_BIC_HP< G4VModularPhysicsList > QGSP_BIC_HP
Definition: QGSP_BIC_HP.hh:63
TFTFP_BERT_HP< G4VModularPhysicsList > FTFP_BERT_HP
Definition: FTFP_BERT_HP.hh:63
TShielding< G4VModularPhysicsList > Shielding
Definition: Shielding.hh:65
const char * p
Definition: xmltok.h:285
TLBE< G4VModularPhysicsList > LBE
Definition: LBE.hh:123
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
TQGS_BIC< G4VModularPhysicsList > QGS_BIC
Definition: QGS_BIC.hh:63
TFTFP_BERT_TRV< G4VModularPhysicsList > FTFP_BERT_TRV
const G4int n
void SetVerboseLevel(G4int value)
void ReplacePhysics(G4VPhysicsConstructor *)
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
TINCLXXPhysicsListHelper< G4VModularPhysicsList, false, true > FTFP_INCLXX
Definition: FTFP_INCLXX.hh:41
TINCLXXPhysicsListHelper< G4VModularPhysicsList, false, false > QGSP_INCLXX
TINCLXXPhysicsListHelper< G4VModularPhysicsList, true, false > QGSP_INCLXX_HP
#define G4endl
Definition: G4ios.hh:61
TQGSP_BIC< G4VModularPhysicsList > QGSP_BIC
Definition: QGSP_BIC.hh:62
TFTF_BIC< G4VModularPhysicsList > FTF_BIC
Definition: FTF_BIC.hh:62
TQGSP_BERT_HP< G4VModularPhysicsList > QGSP_BERT_HP
Definition: QGSP_BERT_HP.hh:62
Definition: QBBC.hh:44
TINCLXXPhysicsListHelper< G4VModularPhysicsList, true, true > FTFP_INCLXX_HP
G4bool G4PhysListFactory::IsReferencePhysList ( const G4String name)

Definition at line 190 of file G4PhysListFactory.cc.

References n.

Referenced by main().

191 {
192  G4bool res = false;
193  size_t n = name.size();
194  if(n > 4) {
195  G4String em_name = name.substr(n - 4, 4);
196  for(size_t i=1; i<nlists_em; ++i) {
197  if(listnames_em[i] == em_name) {
198  n -= 4;
199  break;
200  }
201  }
202  }
203  G4String had_name = name.substr(0, n);
204  for(size_t i=0; i<nlists_hadr; ++i) {
205  if(had_name == listnames_hadr[i]) {
206  res = true;
207  break;
208  }
209  }
210  return res;
211 }
bool G4bool
Definition: G4Types.hh:79
const G4int n
G4VModularPhysicsList * G4PhysListFactory::ReferencePhysList ( )

Definition at line 91 of file G4PhysListFactory.cc.

References G4cout, G4endl, and GetReferencePhysList().

Referenced by main().

92 {
93  // instantiate PhysList by environment variable "PHYSLIST"
94  G4String name = "";
95  char* path = getenv("PHYSLIST");
96  if (path) {
97  name = G4String(path);
98  } else {
99  name = defName;
100  G4cout << "### G4PhysListFactory WARNING: "
101  << " environment variable PHYSLIST is not defined"
102  << G4endl
103  << " Default Physics Lists " << name
104  << " is instantiated"
105  << G4endl;
106  }
107  return GetReferencePhysList(name);
108 }
const XML_Char * name
G4GLOB_DLL std::ostream G4cout
G4VModularPhysicsList * GetReferencePhysList(const G4String &)
#define G4endl
Definition: G4ios.hh:61
void G4PhysListFactory::SetVerbose ( G4int  val)
inline

Definition at line 67 of file G4PhysListFactory.hh.

67 { verbose = val; }

The documentation for this class was generated from the following files: