FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairEventManager.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
12 #ifndef FairEventManager_H
13 #define FairEventManager_H
14 
16 #include "FairRunAna.h" // for FairRunAna
17 
18 #include <Rtypes.h> // for Float_t, Int_t, Bool_t, etc
19 #include <TEveEventManager.h> // for TEveEventManager
20 #include <TEveProjectionAxes.h>
21 #include <TGLViewer.h>
22 #include <map>
23 
24 class TVector3;
25 
26 class FairRootManager; // does not work with streamer, reason unclear
27 class FairTask;
28 class FairXMLNode;
29 
30 class TEveProjectionManager;
31 class TEveScene;
32 class TEveViewer;
33 class TEveText;
34 class TGeoNode;
35 class TGListTreeItem;
36 
37 class FairEventManager : public TEveEventManager
38 {
39  public:
40  static FairEventManager *Instance();
42  virtual ~FairEventManager();
43  virtual void SetXMLConfig(TString xml_config) { fXMLConfig = xml_config; };
44  virtual void Open();
45  virtual void GotoEvent(Int_t event); // *MENU*
46  virtual void NextEvent(); // *MENU*
47  virtual void PrevEvent(); // *MENU*
48  virtual void Close();
49  virtual void DisplaySettings(); // *Menu*
50  virtual Int_t Color(Int_t pdg);
51  void AddTask(FairTask *t) { fRunAna->AddTask(t); }
52  virtual void Init(Int_t visopt = 1, Int_t vislvl = 3, Int_t maxvisnds = 10000);
53  virtual Int_t GetCurrentEvent() { return fEntry; }
62  virtual void SetRPhiPlane(Double_t a, Double_t b, Double_t c, Double_t d, TGLViewer::ECameraType camtype);
71  virtual void SetRhoZPlane(Double_t a, Double_t b, Double_t c, Double_t d, TGLViewer::ECameraType camtype);
72  void UpdateEditor();
78  void SetTimeLimits(Double_t min, Double_t max)
79  {
80  fTimeMin = min;
81  fTimeMax = max;
82  };
83  void GetTimeLimits(Double_t &min, Double_t &max)
84  {
85  min = fTimeMin;
86  max = fTimeMax;
87  };
88  virtual void AddParticlesToPdgDataBase(Int_t pdg = 0);
94  virtual void SetTransparency(Bool_t use_xml, Int_t trans);
99  virtual void SwitchBackground(Bool_t light);
100  /* functions below are obsolete **/
101  virtual void SetPriOnly(Bool_t Pri) {}
102  virtual Bool_t IsPriOnly() { return kFALSE; }
103  virtual void SelectPDG(Int_t PDG) {}
104  virtual Int_t GetCurrentPDG() { return 0; }
105  virtual void SetMaxEnergy(Float_t max) {}
106  virtual void SetMinEnergy(Float_t min) {}
107  virtual void SetEvtMaxEnergy(Float_t max) {}
108  virtual void SetEvtMinEnergy(Float_t min) {}
109  virtual void SetEvtTime(Float_t time) { fTimeEvent = time; }
110  virtual void SetEvtTimeText(Double_t time);
111  virtual void SetEvtNumberText(Int_t evtNumber);
112  void SetUseTimeOfEvent(Bool_t val) { fUseTimeOfEvent = val; }
113  void SetAnimatedTracks(Bool_t val) { fAnimatedTracks = val; }
114  void SetClearHandler(Bool_t val) { fClearHandler = val; }
115  virtual Float_t GetEvtMaxEnergy() { return 1E+9; }
116  virtual Float_t GetEvtMinEnergy() { return 0; }
117  virtual Float_t GetMaxEnergy() { return 1E+9; }
118  virtual Float_t GetMinEnergy() { return 0; }
119  TVector3 GetWorldSize() const;
120  Float_t GetEvtTime();
121  Bool_t GetUseTimeOfEvent() const { return fUseTimeOfEvent; }
122  Bool_t GetDrawAnimatedTracks() const { return fAnimatedTracks; }
123  Bool_t GetClearHandler() const { return fClearHandler; }
124 
131  void MakeScreenshot(FairEveAnimationControl::eScreenshotType screen, TString def_path = "");
133 
134  protected:
135  TEveViewer *GetRPhiView() const { return fRPhiView; };
136  TEveViewer *GetRhoZView() const { return fRhoZView; };
137  TEveViewer *GetMultiView() const { return fMultiView; };
138  TEveViewer *GetMultiRPhiView() const { return fMultiRPhiView; };
139  TEveViewer *GetMultiRhoZView() const { return fMultiRhoZView; };
140  TEveScene *GetRhoZScene() const { return fRhoZScene; };
141  TEveScene *GetRPhiScene() const { return fRPhiScene; };
142  TEveProjectionManager *GetRhoZProjManager() const { return fRhoZProjManager; };
143  TEveProjectionManager *GetRPhiProjManager() const { return fRPhiProjManager; };
144  TEveProjectionAxes *GetRPhiAxes() const { return fAxesPhi; };
145  TEveProjectionAxes *GetRhoZAxes() const { return fAxesRho; };
146  virtual void LoadXMLSettings();
147  void LoadXMLDetector(TGeoNode *node, FairXMLNode *xml, Int_t depth = 0);
148  Int_t StringToColor(TString color) const;
149 
150  private:
151  FairRootManager *fRootManager;
152  Int_t fEntry;
153  Double_t fWorldSizeX, fWorldSizeY, fWorldSizeZ;
154  Double_t fTimeMin, fTimeMax;
155  Bool_t fUseTimeOfEvent;
156  Double_t fTimeEvent;
157  Bool_t fAnimatedTracks;
158  Bool_t fClearHandler;
159  FairRunAna *fRunAna;
160  TGListTreeItem *fEvent;
161  Double_t fRPhiPlane[4];
162  Double_t fRhoZPlane[4];
163  TGLViewer::ECameraType fRphiCam;
164  TGLViewer::ECameraType fRhoCam;
165  TEveViewer *fRPhiView;
166  TEveViewer *fRhoZView;
167  TEveViewer *fMultiView;
168  TEveViewer *fMultiRPhiView;
169  TEveViewer *fMultiRhoZView;
170  TEveScene *fRPhiScene;
171  TEveScene *fRhoZScene;
172  TEveProjectionManager *fRPhiProjManager;
173  TEveProjectionManager *fRhoZProjManager;
174  TEveProjectionAxes *fAxesPhi;
175  TEveProjectionAxes *fAxesRho;
176  TEveText *fEventTimeText;
177  TEveText *fEventNumberText;
178  TString fXMLConfig;
179  std::map<int, int> fPDGToColor;
180  void SetTransparencyForLayer(TGeoNode *node, Int_t depth, Char_t transparency);
181  static FairEventManager *fgRinstance;
183  FairEventManager &operator=(const FairEventManager &);
184  void SetViewers(TEveViewer *RPhi, TEveViewer *RhoZ);
185 };
186 
187 #endif
virtual void PrevEvent()
Bool_t GetClearHandler() const
virtual void SetMinEnergy(Float_t min)
virtual void SetTransparency(Bool_t use_xml, Int_t trans)
virtual void SetEvtMinEnergy(Float_t min)
void LoadXMLDetector(TGeoNode *node, FairXMLNode *xml, Int_t depth=0)
TEveViewer * GetMultiRPhiView() const
void SetUseTimeOfEvent(Bool_t val)
virtual void SetXMLConfig(TString xml_config)
virtual void SetEvtTime(Float_t time)
TEveViewer * GetRPhiView() const
virtual void SetEvtTimeText(Double_t time)
virtual void SetPriOnly(Bool_t Pri)
Float_t GetEvtTime()
current time in ns to display in the event display. Either set value or event time taken from FairRoo...
ClassDef(FairEventManager, 1)
virtual Int_t GetCurrentEvent()
Bool_t GetDrawAnimatedTracks() const
void MakeScreenshot(FairEveAnimationControl::eScreenshotType screen, TString def_path="")
virtual Float_t GetEvtMaxEnergy()
TEveProjectionAxes * GetRhoZAxes() const
TEveViewer * GetMultiRhoZView() const
virtual Int_t GetCurrentPDG()
TEveScene * GetRPhiScene() const
virtual Bool_t IsPriOnly()
virtual void SetMaxEnergy(Float_t max)
virtual void SetRPhiPlane(Double_t a, Double_t b, Double_t c, Double_t d, TGLViewer::ECameraType camtype)
virtual void Open()
virtual Float_t GetMaxEnergy()
virtual void LoadXMLSettings()
virtual Float_t GetEvtMinEnergy()
TEveProjectionManager * GetRhoZProjManager() const
virtual Int_t Color(Int_t pdg)
TEveProjectionAxes * GetRPhiAxes() const
virtual void SelectPDG(Int_t PDG)
virtual Float_t GetMinEnergy()
void SetClearHandler(Bool_t val)
void SetTimeLimits(Double_t min, Double_t max)
virtual void Init(Int_t visopt=1, Int_t vislvl=3, Int_t maxvisnds=10000)
void GetTimeLimits(Double_t &min, Double_t &max)
Int_t StringToColor(TString color) const
virtual void SwitchBackground(Bool_t light)
virtual void NextEvent()
TVector3 GetWorldSize() const
virtual void DisplaySettings()
virtual void AddParticlesToPdgDataBase(Int_t pdg=0)
static FairEventManager * Instance()
virtual void SetEvtMaxEnergy(Float_t max)
virtual void GotoEvent(Int_t event)
virtual void Close()
virtual void AddTask(FairTask *t)
Definition: FairRun.cxx:70
void SetAnimatedTracks(Bool_t val)
virtual void SetEvtNumberText(Int_t evtNumber)
virtual void SetRhoZPlane(Double_t a, Double_t b, Double_t c, Double_t d, TGLViewer::ECameraType camtype)
TEveViewer * GetRhoZView() const
TEveProjectionManager * GetRPhiProjManager() const
TEveScene * GetRhoZScene() const
Bool_t GetUseTimeOfEvent() const
void AddTask(FairTask *t)
TEveViewer * GetMultiView() const