BmnRoot
Loading...
Searching...
No Matches
MpdEventManager.h
Go to the documentation of this file.
1//MpdEventManager: class for event management and navigation
2
3#ifndef MPDEVENTMANAGER_H
4#define MPDEVENTMANAGER_H
5
6#include "FairRunAna.h"
7#include "FairTask.h"
8#include "MpdXMLNode.h"
9
10#include <TEveViewer.h>
11#include "TEveEventManager.h"
12#include <TEveScene.h>
13#include <TGeoNode.h>
14#include <TEveProjectionManager.h>
15#include "TGListTree.h"
16#include <TEveProjectionAxes.h>
17
18#include <vector>
19#include <unordered_set>
20
21using namespace std;
22
23enum ElementList {MCPointList, MCTrackList, RecoPointList, RecoTrackList}; // enum for Event Element lists
24
26class MpdEventManager : public TEveEventManager
27{
28 public:
30 {
35
39
40 structSelectedColoring(TString det_name, TString det_color, int det_transparency, bool isRecursive)
41 {
42 detector_name = det_name;
43 detector_color = det_color;
44 detector_transparency = det_transparency;
45 isRecursiveColoring = isRecursive;
46 }
47 };
48
50 {
51 TString fill_color;
55
59
60 structLevelColoring(TString fill, bool isLine, bool vis, int transp)
61 {
62 fill_color = fill;
63 isFillLine = isLine;
64 visibility = vis;
65 transparency = transp;
66 }
67 };
68
69 static MpdEventManager* Instance();
71 virtual ~MpdEventManager();
72
73 virtual void Open();
74 virtual void GotoEvent(Int_t event); // *MENU*
75 virtual void NextEvent(); // *MENU*
76 virtual void PrevEvent(); // *MENU*
77 virtual void DisplaySettings(); // *Menu*
78 virtual void Close();
79 void UpdateEditor();
80
81 virtual void Init(Int_t visopt = 1, Int_t vislvl = 3, Int_t maxvisnds = 10000);
82 void SetEventEditor(MpdEventManagerEditor* event_editor) { fEventEditor = event_editor; }
83 MpdEventManagerEditor* GetEventEditor() { return fEventEditor; }
84
85 // FairRunAna to init and to execute visualization tasks
86 FairRunAna* fRunAna;
87 void AddTask(FairTask* t) { fRunAna->AddTask(t); }
88
89 // assign different colors for differrent particles
90 // return integer value of color for track by particle pdg (default, white)
91 virtual Int_t Color(Int_t pdg);
92 virtual void AddParticlesToPdgDataBase();
93
94 virtual void SetCurrentEvent(Int_t event_number) { iCurrentEvent = event_number; }
95 virtual Int_t GetCurrentEvent() { return iCurrentEvent; }
96
97 virtual void SetPriOnly(Bool_t Pri) { fPriOnly = Pri; }
98 virtual Bool_t IsPriOnly() { return fPriOnly; }
99
100 virtual void SetMinEnergyLimit(Float_t min) { fMinEnergyLimit = min; }
101 virtual void SetMaxEnergyLimit(Float_t max) { fMaxEnergyLimit = max; }
102 virtual void SetMinEnergyCut(Float_t min) { fMinEnergyCut = min; }
103 virtual void SetMaxEnergyCut(Float_t max) { fMaxEnergyCut = max; }
104 virtual Float_t GetMinEnergyLimit() { return fMinEnergyLimit; }
105 virtual Float_t GetMaxEnergyLimit() { return fMaxEnergyLimit; }
106 virtual Float_t GetMinEnergyCut() { return fMinEnergyCut; }
107 virtual Float_t GetMaxEnergyCut() { return fMaxEnergyCut; }
108 // extend energy limits and modify sliders for energy cut if 'check_energy' is out of the limits
109 virtual void ExpandEnergyLimits(Float_t check_energy, float add_multiplier = 1);
110
111 TEveScene* GetRPhiScene() { return fRPhiGeomScene; }
112 TEveScene* GetRhoZScene() { return fRhoZGeomScene; }
113 virtual void SetRPhiPlane(Double_t a, Double_t b, Double_t c, Double_t d)
114 { fRPhiPlane[0] = a; fRPhiPlane[1] = b; fRPhiPlane[2] = c; fRPhiPlane[3] = d; }
115 virtual void SetRhoZPlane(Double_t a, Double_t b, Double_t c, Double_t d)
116 { fRhoZPlane[0] = a; fRhoZPlane[1] = b; fRhoZPlane[2] = c; fRhoZPlane[3] = d; }
117
118 // Event Elements of Event Scene
120 void AddEventElement(TEveElement* element, ElementList element_list);
121
122 // coloring method
125 // set high transparency for detector geometry
126 void SetTransparentGeometry(bool is_on);
127 virtual void SetXMLConfig(TString xml_config) { fXMLConfig = xml_config; }
128
129 // background color of EVE Viewers
131 // whether background color is dark
133 // whether Online of Offline mode
135 // data source: 0 - simulation data; 1 - raw detector data
137
138 // ZDC module visibility flags. NULL if there are no ZDC modules to show
140 // current value of "mc points", "reco points", "reco tracks" checkbox - FOR CALORIMETER TOWERS
144 // require event redraw after "mc points", "reco points", "reco tracks" checkbox value is changed - FOR CALORIMETER TOWERS
146
147 unordered_set<Int_t> fCurrentPDG;
148
149 protected:
150 TEveViewer* GetRPhiView() const { return fRPhiView; }
151 TEveViewer* GetRhoZView() const { return fRhoZView; }
152 TEveViewer* GetMultiView() const { return fMulti3DView; }
153 TEveViewer* GetMultiRPhiView() const { return fMultiRPhiView; }
154 TEveViewer* GetMultiRhoZView() const { return fMultiRhoZView; }
155 TEveProjectionManager* GetRhoZProjManager() const { return fRhoZMng; }
156 TEveProjectionManager* GetRPhiProjManager() const { return fRPhiMng; }
157 TEveProjectionAxes* GetRPhiAxes() const { return fAxesPhi; }
158 TEveProjectionAxes* GetRhoZAxes() const { return fAxesRho; }
159
160 virtual void LoadXMLSettings();
161 void LoadXMLDetector(TGeoNode *node, MpdXMLNode *xml, Int_t depth=0);
162
163 private:
164 MpdEventManagerEditor* fEventEditor;
165 // skeleton Singleton Instance
166 static MpdEventManager* fgRinstance;
167
168 MpdEventManager(const MpdEventManager&) = delete;
169 MpdEventManager& operator=(const MpdEventManager&) = delete;
170
171 // VIEWERS for RPhi and RPhoZ projections, 3D view in multi-viewer, RPhi and RPhoZ projections in multi-viewer
172 TEveViewer *fRPhiView, *fRhoZView, *fMulti3DView, *fMultiRPhiView, *fMultiRhoZView;
173 // projection managers for RPhi and Rho views
174 TEveProjectionManager *fRPhiMng, *fRhoZMng;
175 // scenes for geometry presentation in RPhi plane and RPhoZ plane
176 TEveScene *fRPhiGeomScene, *fRhoZGeomScene;
177 TEveProjectionAxes *fAxesPhi, *fAxesRho;
178 Double_t fRPhiPlane[4]; Double_t fRhoZPlane[4];
179
180 TGListTreeItem* fEvent;
181 // current event number
182 Int_t iCurrentEvent;
183 Bool_t fPriOnly;
184 // the most minimum particle energy for selected event
185 Float_t fMinEnergyLimit;
186 // the most maximum particle energy for selected event
187 Float_t fMaxEnergyLimit;
188 // minimum energy to cut particles by energy in selected event
189 Float_t fMinEnergyCut;
190 // maximum energy to cut particles by energy in selected event
191 Float_t fMaxEnergyCut;
192
193 // the last color indice of Color Creating from rgb triple
194 Int_t fLastUsedColor;
195
196 TString fXMLConfig;
197 map<int,int> fPDGToColor;
198
199 // arrays with color sturctures for detector and hierarchical coloring
200 vector<structSelectedColoring*> vecSelectedColoring;
201 vector<structLevelColoring*> vecLevelColoring;
202
203 void SetViewers(TEveViewer* RPhi, TEveViewer* RhoZ);
204
205 // changing color and visibility of geometry nodes
206 void InitColorStructure();
207 // get color id by color name or RGB triple
208 Int_t StringToColor(TString color);
209 // returns loaded xml if successful of NULL if validation failed
210 bool ValidateXml(const char *XMLFileName, const char *XSDFileName);
211 void LevelChangeNodeProperty(TGeoNode* node, size_t level);
212 void SelectedGeometryColoring();
213 void RecursiveChangeNodeProperty(TGeoNode* parentNode, Int_t color, int transparency);
214 void RecursiveChangeNodeTransparent(TGeoNode* parentNode, int transparency);
215
216 ClassDef(MpdEventManager,1);
217};
218
219#endif
const Float_t d
Z-ccordinate of the first GEM-station.
Definition BmnMwpcHit.cxx:7
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition P4_F32vec4.h:30
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition P4_F32vec4.h:31
TEveProjectionManager * GetRPhiProjManager() const
virtual void SetMinEnergyLimit(Float_t min)
virtual void SetCurrentEvent(Int_t event_number)
virtual void SetXMLConfig(TString xml_config)
TEveElementList * EveRecoPoints
virtual void Init(Int_t visopt=1, Int_t vislvl=3, Int_t maxvisnds=10000)
FairRunAna * fRunAna
TEveProjectionManager * GetRhoZProjManager() const
virtual void SetMaxEnergyCut(Float_t max)
TEveViewer * GetMultiView() const
virtual void NextEvent()
VisualizationColoring gVisualizationColoring
virtual void ExpandEnergyLimits(Float_t check_energy, float add_multiplier=1)
virtual void SetMinEnergyCut(Float_t min)
TEveProjectionAxes * GetRPhiAxes() const
virtual Bool_t IsPriOnly()
virtual void SetPriOnly(Bool_t Pri)
static MpdEventManager * Instance()
MpdEventManagerEditor * GetEventEditor()
TEveProjectionAxes * GetRhoZAxes() const
TEveElementList * EveRecoTracks
virtual void GotoEvent(Int_t event)
virtual void Open()
virtual void SetRhoZPlane(Double_t a, Double_t b, Double_t c, Double_t d)
TEveViewer * GetRhoZView() const
TEveElementList * EveMCTracks
TEveViewer * GetMultiRhoZView() const
TEveViewer * GetRPhiView() const
virtual void SetRPhiPlane(Double_t a, Double_t b, Double_t c, Double_t d)
virtual void Close()
void SetEventEditor(MpdEventManagerEditor *event_editor)
TEveScene * GetRPhiScene()
void SetTransparentGeometry(bool is_on)
TEveViewer * GetMultiRPhiView() const
virtual Int_t GetCurrentEvent()
virtual Float_t GetMinEnergyLimit()
void LoadXMLDetector(TGeoNode *node, MpdXMLNode *xml, Int_t depth=0)
virtual void PrevEvent()
unordered_set< Int_t > fCurrentPDG
virtual void AddParticlesToPdgDataBase()
void AddEventElement(TEveElement *element, ElementList element_list)
virtual Int_t Color(Int_t pdg)
void AddTask(FairTask *t)
virtual void LoadXMLSettings()
virtual Float_t GetMinEnergyCut()
TEveScene * GetRhoZScene()
virtual Float_t GetMaxEnergyCut()
TEveElementList * EveMCPoints
virtual void DisplaySettings()
virtual void SetMaxEnergyLimit(Float_t max)
virtual Float_t GetMaxEnergyLimit()
ElementList
@ RecoPointList
@ MCPointList
@ MCTrackList
@ RecoTrackList
ElementList
STL namespace.
structLevelColoring(TString fill, bool isLine, bool vis, int transp)
structSelectedColoring(TString det_name, TString det_color, int det_transparency, bool isRecursive)