Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -32,20 +32,22 @@
|
||||
#include "B4Analysis.hh"
|
||||
|
||||
#include "G4RunManagerFactory.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4SteppingVerbose.hh"
|
||||
#include "G4TScoreNtupleWriter.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
namespace {
|
||||
void PrintUsage() {
|
||||
G4cerr << " Usage: " << G4endl;
|
||||
G4cerr << " exampleB4d [-m macro ] [-u UIsession] [-t nThreads]" << G4endl;
|
||||
G4cerr << " exampleB4a [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]"
|
||||
<< G4endl;
|
||||
G4cerr << " note: -t option is available only for multi-threaded mode."
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -54,16 +56,17 @@ namespace {
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
{
|
||||
// Evaluate arguments
|
||||
//
|
||||
if ( argc > 7 ) {
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
G4String macro;
|
||||
G4String session;
|
||||
G4bool verboseBestUnits = true;
|
||||
#ifdef G4MULTITHREADED
|
||||
G4int nThreads = 0;
|
||||
#endif
|
||||
@@ -75,12 +78,16 @@ int main(int argc,char** argv)
|
||||
nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
|
||||
}
|
||||
#endif
|
||||
else if ( G4String(argv[i]) == "-vDefault" ) {
|
||||
verboseBestUnits = false;
|
||||
--i; // this option is not followed with a parameter
|
||||
}
|
||||
else {
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Detect interactive mode (if no macro provided) and define UI session
|
||||
//
|
||||
G4UIExecutive* ui = nullptr;
|
||||
@@ -89,12 +96,16 @@ int main(int argc,char** argv)
|
||||
}
|
||||
|
||||
// Optionally: choose a different Random engine...
|
||||
//
|
||||
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
|
||||
|
||||
// Construct the MT run manager
|
||||
//
|
||||
|
||||
// Use G4SteppingVerboseWithUnits
|
||||
if ( verboseBestUnits ) {
|
||||
G4int precision = 4;
|
||||
G4SteppingVerbose::UseBestUnit(precision);
|
||||
}
|
||||
|
||||
// Construct the default run manager
|
||||
//
|
||||
auto* runManager =
|
||||
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
#ifdef G4MULTITHREADED
|
||||
@@ -113,7 +124,7 @@ int main(int argc,char** argv)
|
||||
|
||||
auto actionInitialization = new B4dActionInitialization();
|
||||
runManager->SetUserInitialization(actionInitialization);
|
||||
|
||||
|
||||
// Initialize visualization
|
||||
auto visManager = new G4VisExecutive;
|
||||
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
|
||||
@@ -138,7 +149,7 @@ int main(int argc,char** argv)
|
||||
G4String command = "/control/execute ";
|
||||
UImanager->ApplyCommand(command+macro);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
// interactive mode : define UI session
|
||||
UImanager->ApplyCommand("/control/execute init_vis.mac");
|
||||
if (ui->IsGUI()) {
|
||||
@@ -150,7 +161,7 @@ int main(int argc,char** argv)
|
||||
|
||||
// Job termination
|
||||
// Free the store: user actions, physics_list and detector_description are
|
||||
// owned and deleted by the run manager, so they should not be deleted
|
||||
// owned and deleted by the run manager, so they should not be deleted
|
||||
// in the main() program !
|
||||
|
||||
delete visManager;
|
||||
|
||||
Reference in New Issue
Block a user