33 #ifdef G4MULTITHREADED 34 #include "G4MTRunManager.hh" 36 #include "G4RunManager.hh" 38 #include "GB07ActionInitialization.hh" 40 #include "G4UImanager.hh" 42 #include "GB07DetectorConstruction.hh" 43 #include "GB07PrimaryGeneratorAction.hh" 45 #include "FTFP_BERT.hh" 46 #include "G4GenericBiasingPhysics.hh" 48 #include "G4VisExecutive.hh" 49 #include "G4UIExecutive.hh" 55 G4cerr <<
" Usage: " << G4endl;
56 G4cerr <<
" ./exampleGB07 [-m macro ] " 57 <<
" [-b biasing {'on','off'}]" 58 <<
"\n or\n ./exampleGB07 [macro.mac]" 65 int main(
int argc,
char** argv)
76 if ( argc == 2 ) macro = argv[1];
79 for ( G4int i=1; i<argc; i=i+2 )
81 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
82 else if (
G4String(argv[i]) ==
"-b" ) onOffBiasing = argv[i+1];
91 if ( onOffBiasing ==
"" ) onOffBiasing =
"on";
94 G4UIExecutive* ui =
nullptr;
96 ui =
new G4UIExecutive(argc, argv);
100 #ifdef G4MULTITHREADED 101 G4MTRunManager * runManager =
new G4MTRunManager;
102 G4cout <<
" ********** Run Manager constructed in MT mode ************ " << G4endl;
104 runManager->SetNumberOfThreads(4);
106 G4RunManager * runManager =
new G4RunManager;
107 G4cout <<
" ********** Run Manager constructed in sequential mode ************ " << G4endl;
111 GB07DetectorConstruction* detector =
new GB07DetectorConstruction();
112 runManager->SetUserInitialization(detector);
114 FTFP_BERT* physicsList =
new FTFP_BERT;
116 G4GenericBiasingPhysics* biasingPhysics =
new G4GenericBiasingPhysics();
117 if ( onOffBiasing ==
"on" )
121 std::vector< G4String >
122 piPlusProcessesToBias, piMinusProcessesToBias,
123 protonProcessesToBias, antiProtonProcessesToBias,
124 neutronProcessesToBias, antiNeutronProcessesToBias;
125 piPlusProcessesToBias .push_back(
"pi+Inelastic");
126 piMinusProcessesToBias .push_back(
"pi-Inelastic");
127 protonProcessesToBias .push_back(
"protonInelastic");
128 antiProtonProcessesToBias .push_back(
"anti_protonInelastic");
129 neutronProcessesToBias .push_back(
"neutronInelastic");
130 neutronProcessesToBias .push_back(
"nCapture" );
131 antiNeutronProcessesToBias.push_back(
"anti_neutronInelastic");
132 biasingPhysics->PhysicsBias(
"pi+", piPlusProcessesToBias);
133 biasingPhysics->PhysicsBias(
"pi-", piMinusProcessesToBias);
134 biasingPhysics->PhysicsBias(
"proton", protonProcessesToBias);
135 biasingPhysics->PhysicsBias(
"anti_proton", antiProtonProcessesToBias);
136 biasingPhysics->PhysicsBias(
"neutron", neutronProcessesToBias);
137 biasingPhysics->PhysicsBias(
"anti_neutron", antiNeutronProcessesToBias);
140 std::vector< G4String > gammaProcessesToBias,
141 electronProcessesToBias, positronProcessesToBias;
142 gammaProcessesToBias .push_back(
"conv" );
143 gammaProcessesToBias .push_back(
"photonNuclear" );
144 electronProcessesToBias .push_back(
"electronNuclear" );
145 positronProcessesToBias .push_back(
"annihil" );
146 positronProcessesToBias .push_back(
"positronNuclear" );
147 biasingPhysics->PhysicsBias(
"gamma", gammaProcessesToBias);
148 biasingPhysics->PhysicsBias(
"e-", electronProcessesToBias);
149 biasingPhysics->PhysicsBias(
"e+", positronProcessesToBias);
151 std::vector< G4String > pi0ProcessesToBias;
152 pi0ProcessesToBias .push_back(
"Decay" );
153 biasingPhysics->PhysicsBias(
"pi0", pi0ProcessesToBias);
155 physicsList->RegisterPhysics(biasingPhysics);
156 G4cout <<
" ********************************************************* " << G4endl;
157 G4cout <<
" ********** processes are wrapped for biasing ************ " << G4endl;
158 G4cout <<
" ********************************************************* " << G4endl;
162 G4cout <<
" ************************************************* " << G4endl;
163 G4cout <<
" ********** processes are not wrapped ************ " << G4endl;
164 G4cout <<
" ************************************************* " << G4endl;
166 runManager->SetUserInitialization(physicsList);
168 runManager->SetUserInitialization(
new GB07ActionInitialization);
171 runManager->Initialize();
174 G4VisManager* visManager =
new G4VisExecutive;
176 visManager->Initialize();
179 G4UImanager* UImanager = G4UImanager::GetUIpointer();
183 G4String command =
"/control/execute ";
184 UImanager->ApplyCommand(command+macro);
188 UImanager->ApplyCommand(
"/control/execute vis.mac");
int main(int argc, char **argv)