ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtTabBase.h
Go to the documentation of this file.
1 #ifndef ATTABBASE_H
2 #define ATTABBASE_H
3 
4 #include "AtTabInfo.h" // IWYU pragma: keep
5 
6 #include <Rtypes.h>
7 #include <TString.h> // for TString
8 
9 #include <memory>
10 #include <string> // for string
11 #include <utility> // for move
12 
13 class TBuffer;
14 class TMemberInspector;
15 class TClass;
16 class TEveWindowSlot;
17 
27 class AtTabBase {
28 protected:
29  static int fNumTabs; //< Number of tab objects created
30  Int_t fTabId{0}; //< Unique ID for tab
31  TString fTabName; //< Name for the tab
32 
33  std::unique_ptr<AtTabInfo> fTabInfo{std::make_unique<AtTabInfo>()};
34 
35 public:
36  AtTabBase(TString tabName);
37  virtual ~AtTabBase() = default;
38 
40  void Init();
41 
43  virtual void Exec() = 0;
44 
45  AtTabInfo *GetTabInfo() { return fTabInfo.get(); }
46  void SetTabName(TString name) { fTabName = std::move(name); }
47 
48 protected:
51  virtual void InitTab() = 0;
52 
56  virtual void MakeTab(TEveWindowSlot *slot) = 0;
57 
62  template <typename T>
63  T *GetFairRootInfo(std::string infoName = T::Class_Name())
64  {
65  return dynamic_cast<AtTabInfoFairRoot<T> *>(fTabInfo->GetAugment(infoName).get())->GetInfo();
66  }
67 
68  ClassDef(AtTabBase, 1)
69 };
70 
71 #endif
AtTabBase::SetTabName
void SetTabName(TString name)
Definition: AtTabBase.h:46
AtTabInfo
Contains all the data needed by an AtTab.
Definition: AtTabInfo.h:51
AtTabBase::Exec
virtual void Exec()=0
Called after the run's Exec() to update tab.
AtTabBase::fNumTabs
static int fNumTabs
Definition: AtTabBase.h:29
AtTabBase::MakeTab
virtual void MakeTab(TEveWindowSlot *slot)=0
Create the gui components of the tab in the passed window slot.
AtTabBase::Init
void Init()
Called in the init stage of the run.
Definition: AtTabBase.cxx:16
AtTabBase::InitTab
virtual void InitTab()=0
AtTabBase::fTabId
Int_t fTabId
Definition: AtTabBase.h:30
AtTabBase::GetTabInfo
AtTabInfo * GetTabInfo()
Definition: AtTabBase.h:45
AtTabBase
Definition: AtTabBase.h:27
AtTabBase::~AtTabBase
virtual ~AtTabBase()=default
AtTabInfoFairRoot
Class for tracking the information from a branch of the FairRoot source tree.
Definition: AtTabInfo.h:88
AtTabBase::GetFairRootInfo
T * GetFairRootInfo(std::string infoName=T::Class_Name())
Definition: AtTabBase.h:63
AtTabBase::AtTabBase
AtTabBase(TString tabName)
Definition: AtTabBase.cxx:10
AtTabBase::fTabName
TString fTabName
Definition: AtTabBase.h:31
AtTabInfo.h
AtTabBase::fTabInfo
std::unique_ptr< AtTabInfo > fTabInfo
Definition: AtTabBase.h:33