63{
64
65
66 if ( argc > 5 ) {
68 return 1;
69 }
70
73 if ( argc == 2 ) macro = argv[1];
74 else
75 {
76 for ( G4int i=1; i<argc; i=i+2 )
77 {
78 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
79 else if (
G4String(argv[i]) ==
"-b" ) onOffBiasing = argv[i+1];
80 else
81 {
83 return 1;
84 }
85 }
86 }
87
88 if ( onOffBiasing == "" ) onOffBiasing = "on";
89
90
92 if ( macro == "" ) {
94 }
95
96
97 auto* runManager = G4RunManagerFactory::CreateRunManager();
98 runManager->SetNumberOfThreads(4);
99
100
102 runManager->SetUserInitialization(detector);
103
105
107 biasingPhysics->BeVerbose();
108 if ( onOffBiasing == "on" )
109 {
110 biasingPhysics->Bias("neutron");
111 physicsList->RegisterPhysics(biasingPhysics);
112 G4cout << " ********************************************************* "
113 << G4endl;
114 G4cout << " ********** processes are wrapped for biasing ************ "
115 << G4endl;
116 G4cout << " ********************************************************* "
117 << G4endl;
118 }
119 else
120 {
121 G4cout << " ************************************************* " << G4endl;
122 G4cout << " ********** processes are not wrapped ************ " << G4endl;
123 G4cout << " ************************************************* " << G4endl;
124 }
125 runManager->SetUserInitialization(physicsList);
126
128
129
130 runManager->Initialize();
131
132
134
135 visManager->Initialize();
136
137
138 G4UImanager* UImanager = G4UImanager::GetUIpointer();
139
140 if ( !ui )
141 {
142 G4String command =
"/control/execute ";
143 UImanager->ApplyCommand(command+macro);
144 }
145 else
146 {
147 UImanager->ApplyCommand("/control/execute vis.mac");
148
149
150 ui->SessionStart();
151 delete ui;
152 }
153
154 delete visManager;
155 delete runManager;
156
157 return 0;
158}
Action initialization class.