GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
MainWindow.h
1 /*
2  * MainWindow.h
3  *
4  * Created on: 16 Mar 2017
5  * Author: Valerio Formato
6  */
7 
8 /*
9  * A simple class to manage Eve. Inherits from TEveManager. Takes care of
10  * displaying the event and the geometry. Most of the heavy lifting is done here.
11  */
12 
13 #include <unordered_map>
14 
15 #include "TEveGeoNode.h"
16 #include "TEveManager.h"
17 #include "TEveTrack.h"
18 #include "TGButton.h"
19 #include "TGFileDialog.h"
20 #include "TGLAnnotation.h"
21 #include "TGLabel.h"
22 #include "TGNumberEntry.h"
23 #include "TGProgressBar.h"
24 #include "TGTab.h"
25 #include "TGTextEntry.h"
26 
27 #include "application/event/GGSFileManager.h"
28 #include "application/gui/DetectorHit.h"
29 #include "application/gui/VPalette.h"
30 
31 #ifndef _EDMAINWINDOW_
32 #define _EDMAINWINDOW_
33 
34 typedef std::unordered_map<std::string, TEveGeoShape *>::iterator UOMIterator;
35 
36 class MainWindow : public TEveManager {
37 
38 public:
39  MainWindow(UInt_t w = _defWidth, UInt_t h = _defHeight);
40  virtual ~MainWindow(){};
41  void CreateMaps();
42  void GenerateHashTable(TEveGeoNode *list);
43  void MakeTransparentScene(int transp);
44  void LoadEvent();
45 
46  void SetEventNumber(UInt_t evt);
47  void UpdateFileEntries();
48  void SetFileName(TString filename);
49  void SpawnFileDialog();
50 
51  void SetDisplayDetector(TString det, Bool_t s);
52  void SetDetectorHitType(TString det, DetectorHit::hitType type);
53  void SetDetectorHitThreshold(TString det, Float_t thr);
54  void SetDetectorHitColor(TString det, Color_t col);
55  void SetDisplayPartHits(Bool_t s);
56 
57  DetectorHit::hitType GetDetectorHitType(TString det) { return _DetectorHitMap[det.Data()]->GetType(); };
58  float GetDetectorHitThreshold(TString det) { return _DetectorHitMap[det.Data()]->GetThreshold(); };
59  Color_t GetDetectorHitColor(TString det) { return _DetectorHitMap[det.Data()]->GetColor(); };
60 
61  void AddControlTab();
62  void AddHitControls();
63  void AddHitOptions();
64 
65 private:
66  bool _firstLoad;
67 
68  void SetDetectorHits(TString det, GGSTHitsReader *reader);
69  void SetMCTruth(GGSTMCTruthReader *reader);
70  void CrossPTree();
71 
72  static const int _defWidth;
73  static const int _defHeight;
74  static const Option_t *_defOpt;
75 
76  TEvePointSet *_PSDPointSet;
77  TEvePointSet *_DEBUGPointSet;
78  TEveElementList *_MCTruthList;
79  TEveElementList *_MCPartHitList;
80  TGLAnnotation *_MCTruthShortInfo;
81 
82  std::unordered_map<std::string, TEveGeoNode *> _TEveGeoNodeMap;
83  std::unordered_map<std::string, TEveGeoShape *> _TEveGeoShapeMap_World;
84 
85  std::unordered_map<std::string, DetectorHit *> _DetectorHitMap;
86 
87  TGMainFrame *_frmMain;
88  TGVerticalFrame *_frmMainVertical;
89  TGHorizontalFrame *_evNumbersFrame;
90  TGNumberEntryField *_evField;
91  TGLabel *_evFileText;
92  TGTextEntry *_fileField;
93  TGHProgressBar *_progressBar;
94 };
95 
96 #endif
Class for reading output of GGSHitsAction.
Class for reading output of GGSMCTruthAction.