Loading...
Searching...
No Matches
Functions
exampleGB06.cc File Reference

Main program of the GB06 example. More...

#include "G4Types.hh"
#include "G4RunManagerFactory.hh"
#include "GB06ActionInitialization.hh"
#include "G4UImanager.hh"
#include "GB06DetectorConstruction.hh"
#include "GB06ParallelWorldForSlices.hh"
#include "GB06PrimaryGeneratorAction.hh"
#include "FTFP_BERT.hh"
#include "G4GenericBiasingPhysics.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the GB06 example.

Definition in file exampleGB06.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 64 of file exampleGB06.cc.

65{
66 // Evaluate arguments
67 //
68 if ( argc > 5 ) {
69 PrintUsage();
70 return 1;
71 }
72
73 G4String macro("");
74 G4String onOffBiasing("");
75 if ( argc == 2 ) macro = argv[1];
76 else
77 {
78 for ( G4int i=1; i<argc; i=i+2 )
79 {
80 if ( G4String(argv[i]) == "-m" ) macro = argv[i+1];
81 else if ( G4String(argv[i]) == "-b" ) onOffBiasing = argv[i+1];
82 else
83 {
84 PrintUsage();
85 return 1;
86 }
87 }
88 }
89
90 if ( onOffBiasing == "" ) onOffBiasing = "on";
91
92 // Instantiate G4UIExecutive if interactive mode
93 G4UIExecutive* ui = nullptr;
94 if ( macro == "" ) {
95 ui = new G4UIExecutive(argc, argv);
96 }
97
98 // -- Construct the run manager : MT or sequential one
99 auto* runManager = G4RunManagerFactory::CreateRunManager();
100 runManager->SetNumberOfThreads(4);
101
102
103 // -- Set mandatory initialization classes
104
105 // -- Create geometry:
107 // -- Create parallel world:
108 GB06ParallelWorldForSlices* parallelWorld =
109 new GB06ParallelWorldForSlices("parallelWorldForSlices");
110 // -- and "augment" detector geometry with the parallelWorld one:
111 detector->RegisterParallelWorld( parallelWorld );
112 runManager->SetUserInitialization(detector);
113
114 // -- Select a physics list:
115 FTFP_BERT* physicsList = new FTFP_BERT;
116 // -- and augment it with biasing facilities:
117 G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics();
118 biasingPhysics->BeVerbose();
119 if ( onOffBiasing == "on" )
120 {
121 // -- We use only the "non physics biasing" functionnality (ie, the ones which don't
122 // -- alter physics processes behavior), and hence we equipe the physics list
123 // -- accordingly:
124 biasingPhysics->NonPhysicsBias("neutron");
125 // -- we activate and configure the parallel geometry facility:
126 biasingPhysics->AddParallelGeometry("neutron","parallelWorldForSlices");
127 physicsList->RegisterPhysics(biasingPhysics);
128 G4cout << " ********************************************************* "
129 << G4endl;
130 G4cout << " ********** processes are wrapped for biasing ************ "
131 << G4endl;
132 G4cout << " ********************************************************* "
133 << G4endl;
134 }
135 else
136 {
137 G4cout << " ************************************************* " << G4endl;
138 G4cout << " ********** processes are not wrapped ************ " << G4endl;
139 G4cout << " ************************************************* " << G4endl;
140 }
141 runManager->SetUserInitialization(physicsList);
142
143 // -- Action initialization:
144 runManager->SetUserInitialization(new GB06ActionInitialization);
145
146 // Initialize G4 kernel
147 runManager->Initialize();
148
149 // Initialize visualization
150 G4VisManager* visManager = new G4VisExecutive;
151 // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
152 visManager->Initialize();
153
154 // Get the pointer to the User Interface manager
155 G4UImanager* UImanager = G4UImanager::GetUIpointer();
156
157 if ( macro != "" ) // batch mode
158 {
159 G4String command = "/control/execute ";
160 UImanager->ApplyCommand(command+macro);
161 }
162 else
163 { // interactive mode : define UI session
164 UImanager->ApplyCommand("/control/execute vis.mac");
165 // if (ui->IsGUI())
166 // UImanager->ApplyCommand("/control/execute gui.mac");
167 ui->SessionStart();
168 delete ui;
169 }
170
171 delete visManager;
172 delete runManager;
173
174 return 0;
175}
Action initialization class.
void PrintUsage()

Applications | User Support | Publications | Collaboration