65{
66
67
68 if ( argc > 5 ) {
70 return 1;
71 }
72
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 {
85 return 1;
86 }
87 }
88 }
89
90 if ( onOffBiasing == "" ) onOffBiasing = "on";
91
92
94 if ( macro == "" ) {
96 }
97
98
99 auto* runManager = G4RunManagerFactory::CreateRunManager();
100 runManager->SetNumberOfThreads(4);
101
102
103
104
105
107
110
111 detector->RegisterParallelWorld( parallelWorld );
112 runManager->SetUserInitialization(detector);
113
114
116
118 biasingPhysics->BeVerbose();
119 if ( onOffBiasing == "on" )
120 {
121
122
123
124 biasingPhysics->NonPhysicsBias("neutron");
125
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
145
146
147 runManager->Initialize();
148
149
151
152 visManager->Initialize();
153
154
155 G4UImanager* UImanager = G4UImanager::GetUIpointer();
156
157 if ( macro != "" )
158 {
159 G4String command =
"/control/execute ";
160 UImanager->ApplyCommand(command+macro);
161 }
162 else
163 {
164 UImanager->ApplyCommand("/control/execute vis.mac");
165
166
167 ui->SessionStart();
168 delete ui;
169 }
170
171 delete visManager;
172 delete runManager;
173
174 return 0;
175}
Action initialization class.