-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDoumeki_DOM.cc
More file actions
214 lines (161 loc) · 5.7 KB
/
Doumeki_DOM.cc
File metadata and controls
214 lines (161 loc) · 5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// $Id: Dominant.cc,v 1.1.1.1 2004/08/26 07:04:26 hoshina Exp $
// ====================================================================
// Dominant.cc
//
// DOM Raytrace Monte-Carlo program
//
// NOTE:
// Please contact me([email protected]) if any problem
// or questions. DO NOT bother Geant4 developpers and Geant4 Users
// Group Japan.
//
// K.Hoshina , 2004
// ====================================================================
#ifdef __USEISOCXX__
#include <sstream>
#else
#include <sstream>
#endif
#include "G4RunManager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "J4DetectorConstruction.hh"
#include "J4PhysicsList.hh"
#include "J4PrimaryGeneratorAction.hh"
#include "J4RunAction.hh"
#include "J4EventAction.hh"
#include "J4TrackingAction.hh"
#include "TBookKeeper.hh"
#include "J4ParameterListStore.hh"
#include "J4ParameterList.hh"
#define G4VIS_USE 1
#ifdef G4VIS_USE
#include "J4VisManager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#endif
//#include "CLHEP/Random/Random.h"
#include "J4DOM.hh"
#include "J4DOMHarness.hh"
#define __INSTALLDOM__
//#define __INSTALLSOL__
TBookKeeper* TBookKeeper::fgBookKeeper = new TBookKeeper();
int main(int argc, char** argv)
{
//-------------------------
// Set random engine....
//-------------------------
// if you want to change a random engine, for example, ...
#if 0
HepJamesRandom randomEngine;
//RanecuEngine randomEngine;
HepRandom::setTheEngine(&randomEngine);
#endif
//-------------------------
// Set manager
//-------------------------
// RunManager is mandatory to run Geant4
G4RunManager* runManager = new G4RunManager(); std::cout << std::endl;
// runManager->SetVerboseLevel(2);
//===========================================================
// set mandatory user initialization classes...
//*--------------------------------------------
//* ParameterList
//*--------------------------------------------
// ParameterListStore is a container of J4VParameterList.
// It keeps array of J4VParameterLists from sub-modules
J4ParameterListStore *paramlistStore = new J4ParameterListStore();
// To modify default parameters hardcoded in ParameterList classes,
// reset it here before detectors are constructed.
// Most of child class of J4VParameterLists are
// singleton and default value is set inside constructor.
// paramlist = J4DOMParameterList::GetInstance();
// paramlist->Set....
// then initialize parameter list
paramlistStore->Initialize();
//*--------------------------------------------
//* Install detector components...
//*--------------------------------------------
J4DetectorConstruction* detecptr = new J4DetectorConstruction();
//* Install detectors
#ifdef __INSTALLDOM__
J4DOM *dcptr = new J4DOM();
dcptr->SetMother(detecptr->GetEXPHall());
detecptr->AddComponent(dcptr);
J4DOMHarness *harnessptr = new J4DOMHarness();
harnessptr->SetMother(detecptr->GetEXPHall());
detecptr->AddComponent(harnessptr);
#endif
//* Solenoid Magnet (should come last)
#ifdef __INSTALLSOL__
J4SOL *solptr = new J4SOL();
solptr->SetMother(detecptr->GetEXPHall());
detecptr->AddComponent(solptr);
#endif
//*--------------------------------------------
//* Installation of detectors end
//*--------------------------------------------
runManager-> SetUserInitialization(detecptr);
// particles and physics processes
runManager-> SetUserInitialization(new J4PhysicsList);
//---------------------------------------------
// set mandatory user action class...
//* primary generator
J4PrimaryGeneratorAction* primarygenerator = new J4PrimaryGeneratorAction;
runManager-> SetUserAction(primarygenerator);
//* user action classes... (optional)
runManager-> SetUserAction(new J4RunAction);
runManager-> SetUserAction(new J4EventAction);
runManager-> SetUserAction(new J4TrackingAction);
#ifdef G4VIS_USE
// initialize visualization package
G4VisManager* visManager = new G4VisExecutive;
//G4VisManager* visManager= new J4VisManager;
visManager-> Initialize();
std::cerr << " ------------------------------- " << std::endl
<< " ---- VisManager created! ---- " << std::endl
<< " ------------------------------- " << std::endl;
std::cerr << std::endl;
#endif
//-----------------------
// user session start
//-----------------------
runManager-> Initialize();
//*--------------------------------------------
//* SwitchOn/Off your detector...
//*--------------------------------------------
//* If you wants call SwitchOn/Off recursively,
//* call virtual function with resolver, as
//* "J4VDetectorComponent::SwitchOn()".
//* SwitchOn/(Off() requires option flag
//* "recursive" or other strings, however,
//* default value is set as "recursive".
//* dc
// SwitchOn all SDs.
#ifdef __INSTALLDOM__
dcptr->J4VDetectorComponent::SwitchOn();
#endif
//*--------------------------------------------
//* Detector Switch end
//*--------------------------------------------
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4UIExecutive* ui = 0;
if (argc==1) { // interactive session, if no arguments given
ui = new G4UIExecutive(argc, argv);
UImanager->ApplyCommand("/control/execute macros/vis.mac");
ui-> SessionStart();
delete ui;
} else { // batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
//-----------------------
// terminating...
//-----------------------
#ifdef G4VIS_USE
delete visManager;
#endif
delete runManager; std::cout << std::endl;
return 0;
}