HerdSoftware  0.1.1
HWMainWindow.h
Go to the documentation of this file.
1 /*
2  * HWMainWindow.h
3  *
4  * Created on: 02 Jan 2019
5  * Author: Valerio Formato
6  */
7 
8 #ifndef HWMainWindow_H_
9 #define HWMainWindow_H_
10 
11 #include "RQ_OBJECT.h"
12 
13 // HERD headers
19 #include "common/RefFrame.h"
20 #include "dataobjects/CaloHits.h"
21 #include "dataobjects/MCTruth.h"
26 #include "dataobjects/Track2D.h"
27 
28 // EA headers
29 #include "analysis/EventLoopProxy.h"
30 #include "core/ObserverPtr.h"
31 
32 // ROOT headers
33 #include "TApplication.h"
34 #include "TEveBoxSet.h"
35 #include "TEveGeoNode.h"
36 #include "TEveManager.h"
37 #include "TEvePointSet.h"
38 #include "TEveProjectionManager.h"
39 #include "TEveScene.h"
40 #include "TEveTrack.h"
41 #include "TEveTrackPropagator.h"
42 #include "TEveViewer.h"
43 #include "TEveWindow.h"
44 #include "TGNumberEntry.h"
45 
46 namespace Herd {
47 class HERDward;
48 class HWProjections;
49 
50 class HWMainWindow : public TApplication, public TEveManager {
51  RQ_OBJECT("HWMainWindow")
52 
53  friend class HERDward;
54 
55 public:
56  HWMainWindow();
57  ~HWMainWindow() { Terminate(); };
58 
59  void SetReturnFromRun(bool ret) { TApplication::SetReturnFromRun(ret); };
60  bool ReturnFromRun() { return TApplication::ReturnFromRun(); };
61  void ExitFromLoop();
62  void PrevEvent();
63  void NextEvent();
64  void LoadEvent();
65  void SetEventNumber(const char *text);
66  void SetDisplayDetector(const char *text);
67  void SetGeoTransparency(int transp);
68  void Terminate(int status = 0);
69 
70 private:
71  int m_evNo;
73 
74  TGNumberEntryField *m_evField;
75 
76  std::unique_ptr<TEveWindowSlot> m_slot;
77  std::unique_ptr<TEveWindowPack> m_pack;
78 
79  std::unique_ptr<HWProjections> m_projections;
80 
81  void LoadGeometry();
82  void SetSceneTransparency(TEveGeoNode *node, int transp);
83  void MakeTransparentScene(TEveGeoNode *node, int transp);
84 
91 
92  template <class TrackingGeoParams>
93  void SetTrackingClusters(const ClustersColl &clColl, const SidesArray<std::vector<TrackingGeoParams>> &geoParamsColl,
95 
96  void SetCaloHits(const CaloHits &caloHits, const CaloGeoParams &caloParams);
97  void SetPSDHits(const PsdHitsColl &psdColl, const PsdGeoParamsColl &geoParamsColl);
98  void SetHoughTracks(const std::array<std::vector<Track2D>, 3> &tracks);
99  void SetMCTruth(const MCTruth &mcTruth);
100  void SetTrackerName(std::string name) { m_trackerDisp.SetName(std::move(name)); }
101 
102  std::unordered_map<std::string, bool> m_detEnableMap;
103  TGMainFrame *m_frmMain;
104  TGVerticalFrame *m_frmMainVertical;
105  TGGroupFrame *m_hitGroup;
106 
107  void ClearScene();
108  void MakeGui();
109  void AddGUIHitButtons();
110  void AddGUITranspSlide();
111 
112  // Event loop stuff
113  EA::observer_ptr<EA::EventLoopProxy> m_evLoopProxy;
114  void SetEventNumber(int evNo);
115  void SetNumberOfEvents(int totEvents) { m_totEvents = totEvents; };
116  void UpdateDetectorStatus();
117 
118  ClassDef(HWMainWindow, 1)
119 };
120 
122 public:
123  HWProjections();
124 
125  std::unique_ptr<TEveWindowPack> Init(std::unique_ptr<TEveWindowPack> _pack);
126  void AdjustCameras();
127  void ClearScene();
128  void DrawMCTruth(const HWMCTruthDisplay &mcTruthDisp);
129  void DrawCaloHits(const HWCaloEventDisplay &caloDisp);
130  void DrawPSDHits(const HWPSDEventDisplay &psdDisp);
131  void DrawTrackingDetectorClusters(const HWTrackingDetectorEventDisplay &stkDisp);
132  void DrawTracks(const HWHoughTrackEventDisplay &trackDisp);
133  void LoadGeometryScene();
134 
135  char GetSceneTransparency() { return m_mainTransparency; }
136  void SetGeoTransparency(char transp);
137 
138 private:
139  void FillScene(RefFrame::View view, TEveElement *parent, const std::vector<std::string> &excluded,
140  unsigned int depth);
141 
142  void SetSceneTransparency(TEveElement *scene, char transp);
143 
144  char m_mainTransparency = 95;
145 
146  std::unique_ptr<TEveViewer> _XZView;
147  std::unique_ptr<TEveViewer> _YZView;
148  std::unique_ptr<TEveViewer> _XYView;
149 
150  std::unique_ptr<TEveScene> _XZGeomScene;
151  std::unique_ptr<TEveScene> _YZGeomScene;
152  std::unique_ptr<TEveScene> _XYGeomScene;
153 
154  std::unique_ptr<TEveScene> _XZEventScene;
155  std::unique_ptr<TEveScene> _YZEventScene;
156  std::unique_ptr<TEveScene> _XYEventScene;
157 };
158 } // namespace Herd
159 
160 #endif
std::unique_ptr< TEveScene > _XYGeomScene
Definition: HWMainWindow.h:152
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
HWPSDEventDisplay m_psdDisp
Definition: HWMainWindow.h:90
void LoadEvent()
Definition: HWMainWindow.cpp:196
TGGroupFrame * m_hitGroup
Definition: HWMainWindow.h:105
void SetTrackerName(std::string name)
Definition: HWMainWindow.h:100
Displays tracks from HoughFinder algorithms.
Definition: HERDward.h:58
Definition: HWMCTruthDisplay.h:20
int m_evNo
Definition: HWMainWindow.h:71
std::unique_ptr< TEveWindowSlot > m_slot
Definition: HWMainWindow.h:76
std::unordered_map< std::string, bool > m_detEnableMap
Definition: HWMainWindow.h:102
void ExitFromLoop()
Definition: HWMainWindow.cpp:168
std::unique_ptr< TEveViewer > _YZView
Definition: HWMainWindow.h:147
Definition: HWMainWindow.h:121
void SetTrackingClusters(const ClustersColl &clColl, const SidesArray< std::vector< TrackingGeoParams >> &geoParamsColl, HWTrackingDetectorEventDisplay &_disp)
Definition: HWMainWindow.hpp:8
void AddGUIHitButtons()
Definition: HWMainWindowGUI.cpp:124
std::unique_ptr< TEveViewer > _XYView
Definition: HWMainWindow.h:148
Definition: HWHoughTrackEventDisplay.h:22
std::unique_ptr< TEveViewer > _XZView
Definition: HWMainWindow.h:146
HWTrackingDetectorEventDisplay m_trackerDisp
Definition: HWMainWindow.h:87
void SetDisplayDetector(const char *text)
Definition: HWMainWindow.cpp:206
void ClearScene()
Definition: HWMainWindow.cpp:149
void SetCaloHits(const CaloHits &caloHits, const CaloGeoParams &caloParams)
Definition: HWMainWindow.cpp:62
TGNumberEntryField * m_evField
Definition: HWMainWindow.h:74
std::unique_ptr< TEveScene > _YZEventScene
Definition: HWMainWindow.h:155
int m_totEvents
Definition: HWMainWindow.h:72
std::unique_ptr< TEveWindowPack > m_pack
Definition: HWMainWindow.h:77
TGVerticalFrame * m_frmMainVertical
Definition: HWMainWindow.h:104
void UpdateDetectorStatus()
void MakeGui()
Definition: HWMainWindowGUI.cpp:29
Data structure for the Calo geometry parameters.
Definition: CaloGeoParams.h:29
void SetSceneTransparency(TEveGeoNode *node, int transp)
Definition: HWMainWindow.cpp:129
Definition: HWCaloEventDisplay.h:24
void LoadGeometry()
Definition: HWMainWindow.cpp:101
std::unique_ptr< TEveScene > _XZGeomScene
Definition: HWMainWindow.h:150
HWTrackingDetectorEventDisplay m_scdDisp
Definition: HWMainWindow.h:88
void SetMCTruth(const MCTruth &mcTruth)
Definition: HWMainWindow.cpp:52
void SetGeoTransparency(int transp)
Definition: HWMainWindow.cpp:144
std::unique_ptr< TEveScene > _YZGeomScene
Definition: HWMainWindow.h:151
bool ReturnFromRun()
Definition: HWMainWindow.h:60
HWHoughTrackEventDisplay m_houghDisp
Definition: HWMainWindow.h:89
EA::observer_ptr< EA::EventLoopProxy > m_evLoopProxy
Definition: HWMainWindow.h:113
void SetNumberOfEvents(int totEvents)
Definition: HWMainWindow.h:115
Definition: HWPSDEventDisplay.h:25
An array that accepts side as subscripts.
Definition: SidesArray.h:72
void SetName(std::string name)
Definition: HWBaseEventDisplay.h:24
void PrevEvent()
Definition: HWMainWindow.cpp:175
std::unique_ptr< TEveScene > _XZEventScene
Definition: HWMainWindow.h:154
std::unique_ptr< HWProjections > m_projections
Definition: HWMainWindow.h:79
void Terminate(int status=0)
Definition: HWMainWindow.cpp:247
void SetHoughTracks(const std::array< std::vector< Track2D >, 3 > &tracks)
Definition: HWMainWindow.cpp:84
std::unique_ptr< TEveScene > _XYEventScene
Definition: HWMainWindow.h:156
void NextEvent()
Definition: HWMainWindow.cpp:185
void MakeTransparentScene(TEveGeoNode *node, int transp)
Definition: HWMainWindow.cpp:151
Data structure for the Monte Carlo truth of each event.
Definition: MCTruth.h:24
void SetEventNumber(const char *text)
Definition: HWMainWindow.cpp:161
TGMainFrame * m_frmMain
Definition: HWMainWindow.h:103
HWMCTruthDisplay m_mcTruthDisp
Definition: HWMainWindow.h:85
char GetSceneTransparency()
Definition: HWMainWindow.h:135
Definition: HWTrackingDetectorEventDisplay.h:22
void SetReturnFromRun(bool ret)
Definition: HWMainWindow.h:59
void SetPSDHits(const PsdHitsColl &psdColl, const PsdGeoParamsColl &geoParamsColl)
Definition: HWMainWindow.cpp:74
View
Aliases for the three 2D projection planes. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:88
Container for the hits of a single CALO detector.
HWCaloEventDisplay m_caloDisp
Definition: HWMainWindow.h:86
Definition: HWMainWindow.h:50