CbmRoot
Loading...
Searching...
No Matches
CbmTimesliceManager.h
Go to the documentation of this file.
1/* Copyright (C) 2023 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau[committer], Norbert Herrmann */
4
5#ifndef CbmTimesliceManager_H
6#define CbmTimesliceManager_H
7
9
10#include "FairRunAna.h" // for FairRunAna
11
12#include <Rtypes.h> // for Float_t, Int_t, Bool_t, etc
13#include <TEveEventManager.h> // for TEveEventManager
14#include <TEveProjectionAxes.h>
15#include <TGLViewer.h>
16
17#include <map>
18
19class FairRootManager;
20class FairRunAna;
21class FairTask;
22class FairXMLNode;
23
24class TClonesArray;
25class TEveProjectionAxes;
26class TEveProjectionManager;
27class TEveScene;
28class TEveText;
29class TEveViewer;
30class TGeoNode;
31class TGLAnnotation;
32class TGListTreeItem;
33
39class CbmTimesliceManager : public TEveEventManager {
40public:
43 virtual ~CbmTimesliceManager() = default;
44
47
52 virtual void SetXMLConfig(TString xml_config) { fXMLConfig = xml_config; }
60 void SetDisplayCbmMuon();
64 void SetDisplayMcbm(bool bLowRate = true, bool bMuch = false);
74 virtual void SetTransparency(Bool_t use_xml, Int_t trans);
79 virtual void SwitchBackground(Bool_t /*light*/);
80
85 void SwitchPdgColorTrack(Bool_t pdg_color);
86
87 virtual void Init(Int_t visopt = 1, Int_t vislvl = 3, Int_t maxvisnds = 10000);
88 void AddTask(FairTask* t) { fRunAna->AddTask(t); }
89
90 virtual void Open();
91 void UpdateEditor();
92 virtual void Close();
93 virtual Int_t Color(Int_t pdg);
94 virtual void DisplaySettings(); // *MENU*
95 virtual void GotoTimeslice(uint32_t timeslice); // *MENU*
96 virtual void NextTimeslice(); // *MENU*
97 virtual void PrevTimeslice(); // *MENU*
98 virtual void GotoEvent(Int_t event); // *MENU*
99 virtual void NextEvent(); // *MENU*
100 virtual void PrevEvent(); // *MENU*
101
102 bool GetMcbmViewersMode() const { return fbMcbmViewersEna; }
103 virtual uint32_t GetCurrentTimeslice() const { return fTimesliceIdx; }
104 virtual Int_t GetCurrentEvent() const { return fEventIdx; }
105 double_t GetTimesliceTime();
106 double_t GetEventTime();
107
108 virtual void SetTsTimeText(Double_t time);
109 virtual void SetTsNumberText(Int_t tsNumber);
110 virtual void SetEvtTimeText(Double_t time);
111 virtual void SetEvtNumberText(Int_t evtNumber);
112
113 void SetClearHandler(Bool_t val) { fClearHandler = val; }
114 Bool_t GetClearHandler() const { return fClearHandler; }
115
121 void MakeScreenshot(CbmTsEveAnimationControl::eScreenshotType screenshotType, TString def_path = "");
122
123protected:
124 virtual void LoadXMLSettings();
125 void LoadXMLDetector(TGeoNode* node, FairXMLNode* xml, Int_t depth = 0);
126 Int_t StringToColor(TString color) const;
127
128private:
130
131 FairRunAna* fRunAna = nullptr;
132 FairRootManager* fRootManager = nullptr;
133
134 TString fXMLConfig = "";
135 std::map<int, int> fPDGToColor = {};
137 void InitPdgColorMap();
138 void SetTransparencyForLayer(TGeoNode* node, Int_t depth, Char_t transparency);
139
140 Bool_t fClearHandler = kFALSE;
141
142 TGListTreeItem* fEvent = nullptr;
143 Int_t fEntry = 0;
144 TClonesArray* fCbmEvents = nullptr;
145 uint32_t fTimesliceIdx = 0;
146 uint32_t fEventIdx = 0;
147 double_t fTimeTimeslice = -1;
148 double_t fTimeEvent = -1;
149
150 TGLAnnotation* fTimesliceTimeText = nullptr;
151 TGLAnnotation* fTimesliceNumberText = nullptr;
152 TGLAnnotation* fEventTimeText = nullptr;
153 TGLAnnotation* fEventNumberText = nullptr;
154
155 TGLViewer::ECameraType fRphiCam = TGLViewer::kCameraOrthoXOY;
156 TGLViewer::ECameraType fRhoCam = TGLViewer::kCameraOrthoZOY;
157 TGLViewer::ECameraType fCamZY = TGLViewer::kCameraOrthoZnOX;
158 TGLViewer::ECameraType fCamZX = TGLViewer::kCameraOrthoZOY;
159
161 TEveViewer* fRPhiView = nullptr;
162 TEveViewer* fRhoZView = nullptr;
163 TEveViewer* fMultiView = nullptr;
164 TEveViewer* fMultiRPhiView = nullptr;
165 TEveViewer* fMultiRhoZView = nullptr;
166 TEveScene* fRPhiScene = nullptr;
167 TEveScene* fRhoZScene = nullptr;
168 TEveProjectionManager* fRPhiProjManager = nullptr;
169 TEveProjectionManager* fRhoZProjManager = nullptr;
170 TEveProjectionAxes* fAxesPhi = nullptr;
171 TEveProjectionAxes* fAxesRho = nullptr;
172
174 bool fbMcbmViewersEna = false;
175 TEveViewer* fViewZY = nullptr;
176 TEveViewer* fViewZX = nullptr;
177 TEveViewer* fMcbmView = nullptr;
178 TEveViewer* fMcbmViewZY = nullptr;
179 TEveViewer* fMcbmViewZX = nullptr;
180 TEveScene* fSceneZY = nullptr;
181 TEveScene* fSceneZX = nullptr;
182 TEveProjectionManager* fProjManagerZY = nullptr;
183 TEveProjectionManager* fProjManagerZX = nullptr;
184 TEveProjectionAxes* fAxesZY = nullptr;
185 TEveProjectionAxes* fAxesZX = nullptr;
186
187 bool InitializeMainView(Int_t visopt, Int_t vislvl, Int_t maxvisnds);
188 void InitializeViewsCbm();
189 void SetViewers(TEveViewer* RPhi, TEveViewer* RhoZ);
190 void InitializeViewsMcbm();
191 void SetMcbmViewers(TEveViewer* ZY, TEveViewer* ZX);
192
194};
195
196#endif // CbmTimesliceManager_H
TBrowser Event display for Timeslices as Tree entry with CbmEvents in container. Function as unique I...
virtual ~CbmTimesliceManager()=default
void SetMcbmViewers(TEveViewer *ZY, TEveViewer *ZX)
TEveProjectionAxes * fAxesZX
void LoadXMLDetector(TGeoNode *node, FairXMLNode *xml, Int_t depth=0)
void SetDisplayMcbm(bool bLowRate=true, bool bMuch=false)
Select/add default set of views and some Hit and Tracks drawing classes for the mCBM 2022+ setups.
FairRootManager * fRootManager
Int_t StringToColor(TString color) const
TEveViewer * fRPhiView
CBM views.
TGLAnnotation * fTimesliceNumberText
virtual void GotoTimeslice(uint32_t timeslice)
TEveProjectionAxes * fAxesRho
TEveProjectionManager * fProjManagerZY
virtual void SetEvtNumberText(Int_t evtNumber)
TGLAnnotation * fEventTimeText
void SwitchPdgColorTrack(Bool_t pdg_color)
Bool_t GetClearHandler() const
Used to indicate to subtask that they should reset.
TGLViewer::ECameraType fCamZX
TGLAnnotation * fEventNumberText
bool InitializeMainView(Int_t visopt, Int_t vislvl, Int_t maxvisnds)
void SetTransparencyForLayer(TGeoNode *node, Int_t depth, Char_t transparency)
virtual uint32_t GetCurrentTimeslice() const
void SetDisplayCbmMuon()
Select/add default set of views and some Hit and Tracks drawing classes for the CBM SIS100 muon setup...
TEveProjectionManager * fRhoZProjManager
bool fbMcbmViewersEna
mCBM views
virtual Int_t Color(Int_t pdg)
virtual void SwitchBackground(Bool_t)
ClassDef(CbmTimesliceManager, 1)
TEveProjectionManager * fRPhiProjManager
void SetDisplayTofCosmicsHd()
Select/add default set of views and some Hit and Tracks drawing classes for the HD 2023+ cosmics setu...
CbmTimesliceManager & operator=(const CbmTimesliceManager &)=delete
virtual Int_t GetCurrentEvent() const
TEveProjectionManager * fProjManagerZX
TGLViewer::ECameraType fCamZY
void SetDisplayCbmElectron()
Select/add default set of views and some Hit and Tracks drawing classes for the CBM SIS100 electron s...
void AddTask(FairTask *t)
virtual void SetTsNumberText(Int_t tsNumber)
virtual void GotoEvent(Int_t event)
void SetViewers(TEveViewer *RPhi, TEveViewer *RhoZ)
virtual void SetEvtTimeText(Double_t time)
virtual void SetTransparency(Bool_t use_xml, Int_t trans)
static CbmTimesliceManager * gRinstanceTsMan
static CbmTimesliceManager * Instance()
TGLViewer::ECameraType fRhoCam
void SetClearHandler(Bool_t val)
Used to indicate to subtask that they should reset.
double_t GetTimesliceTime()
current time in ns to display in the event display.
virtual void Init(Int_t visopt=1, Int_t vislvl=3, Int_t maxvisnds=10000)
TGLViewer::ECameraType fRphiCam
TEveProjectionAxes * fAxesPhi
void MakeScreenshot(CbmTsEveAnimationControl::eScreenshotType screenshotType, TString def_path="")
Screenshot(s) generation: to be called by GUI element.
double_t GetEventTime()
current time in ns to display in the event display.
std::map< int, int > fPDGToColor
CbmTimesliceManager(const CbmTimesliceManager &)=delete
virtual void SetTsTimeText(Double_t time)
TEveProjectionAxes * fAxesZY
virtual void SetXMLConfig(TString xml_config)
Set path to xml configuration file for control of transparency and visibility of individual geometry ...
TGLAnnotation * fTimesliceTimeText