PandaRoot
PndTCAConstContainer.h
Go to the documentation of this file.
1 
15 #ifndef PNDTCACONSTCONTAINER_HH
16 #define PNDTCACONSTCONTAINER_HH
17 
18 #include <stdexcept>
19 #include <vector>
20 
21 #include "TClonesArray.h"
22 #include "TString.h"
23 
24 #include "FairLogger.h"
25 #include "FairRootManager.h"
26 
27 #include "PndConstContainerI.h"
28 
37 template <class T>
39  public:
45 
50  virtual ~PndTCAConstContainer(){};
51 
58  virtual T const *GetElement(Int_t t_idx) const final
59  {
60  if (fTCA != nullptr) {
61  return static_cast<T *>(fTCA->At(t_idx));
62  }
63  return nullptr;
64  }
65 
71  virtual ssize_t GetSize() const final
72  {
73  if (fTCA != nullptr) {
74  return fTCA->GetEntriesFast();
75  }
76  return 0;
77  }
78 
84  void SetTCA(TClonesArray *t_tca) { fTCA = t_tca; }
85 
91  TClonesArray *GetTCA() { return fTCA; }
92 
93  protected:
94  TClonesArray *fTCA{nullptr};
95 };
96 
97 #endif /*PNDTCAConstContainer_HH*/
PndTCAConstContainer()
Construct a new PndTCAConstContainer object.
void SetTCA(TClonesArray *t_tca)
Set the TClonesArray address.
virtual ~PndTCAConstContainer()
Destroy the PndTCAConstContainer object.
virtual ssize_t GetSize() const final
Get the number of elements.
TClonesArray * GetTCA()
Get the TClonesArray address.
PndTCAConstContainer implementation of PndConstContainerI<T> for FairRootManager and TClonesArray...
virtual T const * GetElement(Int_t t_idx) const final
Get pointer to the t_idx-th element.