-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Simple.h
358 lines (238 loc) · 9.19 KB
/
Simple.h
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
#ifndef SIMPLE_H
#define SIMPLE_H
// File modified by Deepak Samuel on 25 Sep 2019
#include <QMainWindow>
#include <G4RunManager.hh>
#include <G4MTRunManager.hh>
#include <G4VisManager.hh>
#include <G4VisExecutive.hh>
#include <G4UImanager.hh>
#include <G4UIExecutive.hh>
#include <G4ScoringManager.hh>
#include <SimpleDatabaseManager.h>
#include <SimpleAction.h>
#include <QFileDialog>
#include <QDebug>
#include <QSqlTableModel>
#include <G4VBasicShell.hh>
#include <G4VInteractiveSession.hh>
#include <QStandardItem>
#include <QStandardItemModel>
#include <G4UIcommandTree.hh>
#include <QCompleter>
#include <SimpleObject.h>
#include <QTreeWidgetItem>
#include <SimpleObjectTableModel.h>
#include <SimpleMeshTableModel.h>
#include <QSettings>
#include <TROOT.h>
#include <TStyle.h>
#include <TApplication.h>
#include <iROOTWorksheet.h>
#include <QGLWidget>
#include <QFileSystemModel>
#include <QJsonArray>
#include <SimpleMaterialBuilder.h>
#include <SimpleMaterialPropertyBuilder.h>
#include <iCanvas.h>
namespace Ui {
class Simple;
}
class Simple : public QMainWindow, public G4VBasicShell, public G4VInteractiveSession
{
Q_OBJECT
public:
explicit Simple(int argc, char *argv[], QWidget *parent = nullptr);
void InitRoot();
void InitGeant4(int argc, char *argv[]);
int InitDB();
void InitUI();
void InitEnvVars();
void InitMaterials();
void InitPhysicsLists();
void CreateMenus();
void OpenFile(QString fileName);
void output(QString content, QString type="");
QStringList refPhysicsNames;
QStringList refPhysicsHints;
SimpleAction* gsact;
G4UIsession* SessionStart();
virtual void PauseSessionStart(const G4String&);
virtual G4bool GetHelpChoice(G4int&){return true;}
virtual void ExitHelp() const{}
virtual G4int ReceiveG4cout(const G4String&);
virtual G4int ReceiveG4cerr(const G4String&);
QStandardItemModel* CreateCompleterModel(G4String aCmd);
void UpdateCommandCompleter();
void AddObject(SimpleObject *obj);
void AddObjects (QList <SimpleObject*> objects);
void AddObject(SimpleMesh *mesh);
void AddObject(QJsonObject obj);
void AddObjects(QList <SimpleMesh *> mesh);
void AddG4Widget(QWidget *w);
QWidget* GetSceneTreeWidget();
void UpdateGeometry();
void Execute(QString command);
void Execute(QStringList commands);
QStringList CreateParticleSource(QString particle, QString sourceType, QString sourceShape, QVector3D sourceCentre, QList <float> sourceDims, QString angularType, QString energyDist, QList <float> eSpectParams, float eMin, float eMax, QVector3D directions, QVector3D pol);
SimpleObject* MakeCopy(SimpleObject* obj, int alongaxis, float sep);
void InitRecordParameters();
void InitScoringParameters();
void InitViewer();
void UpdateViewer();
void SetRecordParameters(QJsonObject jsonObject);
void SetGunParameters(QJsonObject jsonObject);
void SetUIParameters(QJsonObject jsonObject);
void SaveProject(QString fileName);
void IncrementRunId();
void GetOutputDirectory();
void HandleOutputFiles();
QStringList GetRecentFileList();
QString GetPhysicsList(QString fileName);// physics list of recent files
bool AddTabWidget(QWidget* w,const QString s);
QTabWidget* GetViewerTabWidget();
QJsonArray gunParams();
~Simple();
private slots:
void delete_current_mesh();
void plot_mesh_projection();
void plot_mesh_column();
void on_add_envVar_clicked();
void on_del_env_var_clicked();
void on_update_env_var_clicked();
void on_fCommandArea_returnPressed();
void on_addObject_clicked();
void on_shapesList_currentIndexChanged(int index);
//void on_hide_clicked();
void on_objectTree_itemClicked(QTreeWidgetItem *item, int column);
void UpdateObject(SimpleObject *obj, int index);
void on_objectTree_itemSelectionChanged();
void on_duplicate_clicked();
void on_delete_object_clicked();
void on_db_type_currentIndexChanged(const QString &arg1);
void on_objectTree_customContextMenuRequested(const QPoint &pos);
void on_isWireframe_stateChanged(int arg1);
void on_objectPropertiesTable_entered(const QModelIndex &index);
void on_hide_gunStack_clicked();
void on_sel_sourceType_clicked();
//void on_sel_sourceShape_clicked();
void on_sel_angDist_clicked();
void on_sel_energyDist_clicked();
//void on_sel_pol_clicked();
void on_particleSource_toggled(bool checked);
void on_sourceShape_currentIndexChanged(const QString &arg1);
void on_eSpectType_currentIndexChanged(const QString &arg1);
void on_shoot_clicked();
//void on_nthreads_valueChanged(const QString &arg1);
//void on_g4_verbosity_currentIndexChanged(const QString &arg1);
void on_clearOutput_clicked();
void on_shapesList_currentIndexChanged(const QString &arg1);
void on_export_dataframe_clicked();
void on_filterDataframe_clicked();
void on_filterString_editingFinished();
void on_plot_clicked();
void on_plotString_returnPressed();
void on_cutString_returnPressed();
void on_plot_options_returnPressed();
//void on_pushButton_clicked();
//void on_createMesh_clicked();
//void on_clear_scoring_commands_clicked();
//void on_meshShape_itemClicked(QTreeWidgetItem *item, int column);
void on_add_box_mesh_clicked();
void on_add_cylindrical_mesh_clicked();
void on_meshes_itemClicked(QTreeWidgetItem *item, int column);
void on_meshes_customContextMenuRequested(const QPoint &pos);
void on_setLogX_clicked(bool checked);
void on_setLogY_clicked(bool checked);
void on_run_macro_clicked();
void on_clear_all_mesh_clicked();
void on_fileDirectoryView_doubleClicked(const QModelIndex &index);
void on_actionSave_triggered();
void on_actionOpen_triggered();
void on_download_g4_data_files_clicked();
void on_actionSave_as_triggered();
void on_actionExit_2_triggered();
void on_actionBox_triggered();
void on_actionCylinder_triggered();
void on_actionSphere_triggered();
void on_actionWedge_triggered();
void on_actionBox_Mesh_triggered();
void on_actionCylinder_Mesh_triggered();
void on_actionShoot_beam_triggered();
void on_actionMacro_triggered();
void on_actionEnvironment_variables_triggered();
void on_actionMaterial_list_triggered();
void on_actionDetecor_view_triggered();
void on_actionPlots_triggered();
void on_actionScene_Object_Window_triggered();
void on_actionMesh_Window_triggered();
void on_actionProperty_Editor_triggered();
void on_actionOutput_file_settings_triggered();
void on_actionSource_Type_triggered();
void on_actionBeam_energy_settings_triggered();
void on_actionBeam_type_settings_triggered();
void on_actionBeam_angular_distribution_triggered();
void on_actionHelp_triggered();
//void on_build_from_materials_toggled(bool checked);
void on_addNewMaterial_clicked();
void on_actionNew_Material_triggered();
void on_actionMaterial_property_triggered();
void on_switch_off_mag_fields_stateChanged(int arg1);
void on_auto_search_g4variables_clicked();
void on_actionExport_triggered();
void on_show_file_explorer_clicked();
void on_auto_search_cvmfs_clicked();
void set_output_directory(QString s);
void on_select_directory_clicked();
void on_db_type_currentIndexChanged(int index);
void on_show_output_directory_clicked();
//void on_clear_output_directory_clicked();
void on_fileList_currentIndexChanged(const QString &arg1);
void on_fit_clicked();
void on_show_plot_window_toggled(bool checked);
private:
Ui::Simple *ui;
G4UImanager* UImanager;
G4MTRunManager * runManager;
G4ScoringManager * scManager;
SimpleDatabaseManager* dbManager;
QCompleter* fCompleter;
bool g4started;
QString currentPhysicsList;
G4VUserPhysicsList *physicsList; // if user chooses a customized physics list.
QStringList materials;
QList <SimpleObject*> objectList;
QList <SimpleMesh*> meshList, used_meshList;
//QList <SimpleObject*> scoringObjects; // these will be used for scoring
//QList <SimpleObject*> detectorObjects; // these will be used by detector construction
SimpleObjectTableModel *object_table_model;
SimpleMeshTableModel *mesh_table_model;
DBTableModel *db_table_model;
SimpleMaterialBuilder *mat_builder;
QMenu *objectMenu;
QMenu *meshMenu;
QAction *object_delete_action;
QAction *object_duplicate_action;
QAction *mesh_delete_action;
QAction *mesh_plot_projection_action;
QAction *mesh_plot_column_action;
QAction *mesh_dump_qty_action;
int nThreads;
TApplication* iRootApp;
IROOTWorksheet* worksheet;
int mesh_id;
QFileSystemModel *fileSystemModel;
QString last_opened_file;
bool is_user_physics_list;
bool is_vis_disabled;
bool is_first_time_use;
bool is_gdml;
int run_id;
QString output_directory;
QString output_filename;// this will change for every run
QString mesh_file_prefix;
QStringList output_filelist;
QString recent_file; // the file that user opened from the recent list
iCanvas* canvas;
};
#endif // SIMPLE_H