Set up the physics list for Geant4, and pass it to Geant4's run manager. Without a physics list, Geant4 won't do anything. G4 comes with a number of pre-constructed lists, and for now I plan to use "QGSP_BERT". It has the following properties:
if we decide that QGSP_BERT is not what we want, then we will have to write a new physics list class that derives from G4VUserPhysicsList that does what we want.
163 G4VUserPhysicsList* physics = 0;
166 bool list_known_procs =
true;
171 std::vector< std::string > pstrings;
174 boost::token_compress_on );
176 for (
unsigned int j=0; j < pstrings.size(); ++j )
179 if ( pstrings.size() < 1 ) pstrings.push_back(
"");
187 #ifdef TRY_NEW_PL_FACTORY 190 factoryname =
"alt::G4PhysListFactory";
209 G4PhysListFactory factory;
213 if ( factory.IsReferencePhysList(phListName) ) {
214 bywhom = factoryname;
219 if ( phListName !=
"" ) {
221 <<
" failed to find ReferencePhysList \"" 223 #ifdef TRY_NEW_PL_FACTORY 224 factory.PrintAvailablePhysLists();
226 std::vector<G4String> list = factory.AvailablePhysLists();
228 <<
"For reference: PhysicsLists in G4PhysListFactory are: ";
229 for (
size_t indx=0; indx < list.size(); ++indx ) {
232 <<
"\"" << list[indx] <<
"\"";
241 <<
"G4PhysListFactory could not construct \"" 245 <<
"fall back to using QGSP_BERT";
247 physics =
new QGSP_BERT;
248 phListName =
"QGSP_BERT";
253 <<
" constructed G4VUserPhysicsList \"" 264 for (
unsigned int k=1;
k < pstrings.size(); ++
k ) {
268 std::vector< std::string > physProcParts;
270 boost::is_any_of(
"(,)"),
271 boost::token_compress_on );
273 for (
unsigned int j=0; j < physProcParts.size(); ++j )
278 if ( physProcName ==
"" )
continue;
284 <<
"G4PhysicsProcessFactorySingleton could not " 289 if ( ! list_known_procs )
continue;
290 list_known_procs =
false;
293 <<
"For reference: PhysicsProcesses in " 294 <<
"G4PhysicsProcessFactorySingleton are: ";
298 <<
" ... no registered processes";
300 for (
size_t indx=0; indx < list.size(); ++indx ) {
303 <<
"\"" << list[indx] <<
"\"";
312 <<
"\" physics process to \"" 320 G4VModularPhysicsList* mpl =
dynamic_cast<G4VModularPhysicsList*
>(physics);
321 if ( ! pctor )
MF_LOG_VERBATIM(
"G4Helper") <<
" ... failed with null pointer";
322 else if ( ! mpl )
MF_LOG_VERBATIM(
"G4Helper") <<
" ... failed, physics list wasn't a G4VModularPhysicsList";
323 else mpl->RegisterPhysics(pctor);
329 for (
unsigned int i=1; i < physProcParts.size(); ++i ) {
330 if ( physProcParts[i] ==
"" )
continue;
342 auto mpl =
dynamic_cast<G4VModularPhysicsList*
>(physics);
343 if(mpl) mpl->RegisterPhysics(
new G4StepLimiterPhysics());
346 <<
"Step limits requested, but unable to register G4StepLimiterPhysics" 347 <<
"\n NO STEP LIMITS WILL BE APPLIED";
static std::string trim(const std::string &str, const std::string &whitespace=" \t")
#define MF_LOG_ERROR(category)
const std::vector< G4String > & AvailablePhysicsProcesses() const
G4VModularPhysicsList * GetReferencePhysList(const G4String &)
static G4PhysicsProcessFactorySingleton & Instance()
Q_EXPORT QTSManip setw(int w)
G4bool IsKnownPhysicsProcess(const G4String &)
#define MF_LOG_VERBATIM(category)
G4RunManager * fRunManager
Geant4's run manager.
void split(std::string const &s, char c, OutIter dest)
bool fUseStepLimits
Set in SetVolumeStepLimit.
#define MF_LOG_WARNING(category)
G4VPhysicsConstructor * GetPhysicsProcess(const G4String &)
QTextStream & endl(QTextStream &s)
G4UImanager * fUIManager
Geant4's user-interface manager.