PandaRoot
PndOutputContainer< T > Class Template Reference

#include <PndOutputContainer.h>

Inheritance diagram for PndOutputContainer< T >:
PndOutputContainerI< T > PndContainerI< T >

Public Member Functions

 PndOutputContainer (const TString &t_foldername="", Bool_t t_persistency=kTRUE)
 Construct a new PndOutputContainer object. More...
 
virtual ~PndOutputContainer ()
 Destroy the PndOutputContainer object. More...
 
virtual Bool_t Init (const TString &t_branchname)
 Init internal data. More...
 
Bool_t TrySTD (const TString &t_branchname)
 Create a std::vector based outputcontainer and register/init it with the FairRootManager. More...
 
Bool_t TryTCA (const TString &t_branchname)
 Create a TClonesArray based outputcontainer and register/init it with the FairRootManager. More...
 
virtual void Reset () final
 Reset data. More...
 
virtual T * CreateCopy (const T &t_data) final
 Create a copy of t_data in internal data and return ptr to it. More...
 
virtual void RemoveAt (Int_t t_index) final
 Delete object at t_index in internal data. More...
 
virtual ssize_t GetSize () const final
 Get the number of members in internal data. More...
 
virtual T * GetElement (Int_t t_index) const final
 Get the Element object at t_index. More...
 
virtual void Compress ()
 Compress. More...
 
- Public Member Functions inherited from PndOutputContainerI< T >
 PndOutputContainerI (const TString &t_foldername="", Bool_t t_persistency=kTRUE)
 Construct a new PndOutputContainerI object. More...
 
 fFolderName (t_foldername)
 
 fPersistency (t_persistency)
 
virtual ~PndOutputContainerI ()
 Destroy the PndOutputContainerI object. More...
 
virtual T const * GetConstElementPtr (Int_t t_index) const
 Get the Element object at t_index. More...
 
std::vector< T * > GetVector () const
 return vector of ptrs pointing at internal data, to be used to access data independent of underlying data container More...
 
void SetFolderName (const TString &t_foldername)
 Set the FolderName. More...
 
void SetPersistency (Bool_t t_persistency)
 Set the Persistency of the data. More...
 
const TString & GetFolderName () const
 Get the Folder Name. More...
 
Bool_t GetPersistency () const
 Get the Persistency of the data. More...
 
- Public Member Functions inherited from PndContainerI< T >
 PndContainerI ()
 Construct a new PndContainerI object. More...
 
virtual ~PndContainerI ()
 Destroy the PndContainerI object. More...
 
std::vector< T const * > GetVectorOfPtrToConst () const
 return vector of const ptrs pointing at internal data, to be used to access data independent of underlying data container More...
 
const TString & GetBranchName () const
 Get the BranchName. More...
 

Protected Attributes

std::unique_ptr< PndOutputContainerI< T > > fImp {nullptr}
 
- Protected Attributes inherited from PndOutputContainerI< T >
TString fFolderName {""}
 
Bool_t fPersistency {kFALSE}
 
- Protected Attributes inherited from PndContainerI< T >
TString fBranchName {""}
 

Detailed Description

template<class T>
class PndOutputContainer< T >

Definition at line 24 of file PndOutputContainer.h.

Constructor & Destructor Documentation

◆ PndOutputContainer()

template<class T>
PndOutputContainer< T >::PndOutputContainer ( const TString &  t_foldername = "",
Bool_t  t_persistency = kTRUE 
)
inline

Construct a new PndOutputContainer object.

Parameters
constTString &t_foldername : Name of folder
Bool_tt_persistency : Should date be stored to file

Definition at line 33 of file PndOutputContainer.h.

33 : PndOutputContainerI<T>(t_foldername, t_persistency) {}

◆ ~PndOutputContainer()

template<class T>
virtual PndOutputContainer< T >::~PndOutputContainer ( )
inlinevirtual

Destroy the PndOutputContainer object.

Definition at line 39 of file PndOutputContainer.h.

39 {};

Member Function Documentation

◆ Compress()

template<class T>
virtual void PndOutputContainer< T >::Compress ( )
inlinevirtual

Compress.

Reimplemented from PndOutputContainerI< T >.

Definition at line 165 of file PndOutputContainer.h.

166  {
167  if (this->fImp != nullptr) {
168  this->fImp->Compress();
169  }
170  }
std::unique_ptr< PndOutputContainerI< T > > fImp

◆ CreateCopy()

template<class T>
virtual T* PndOutputContainer< T >::CreateCopy ( const T &  t_data)
inlinefinalvirtual

Create a copy of t_data in internal data and return ptr to it.

Parameters
t_data
Returns
T*

Implements PndOutputContainerI< T >.

Definition at line 114 of file PndOutputContainer.h.

Referenced by TestOutTask::Exec().

115  {
116  if (this->fImp != nullptr) {
117  return this->fImp->CreateCopy(t_data);
118  }
119  return nullptr;
120  }
std::unique_ptr< PndOutputContainerI< T > > fImp

◆ GetElement()

template<class T>
virtual T* PndOutputContainer< T >::GetElement ( Int_t  t_index) const
inlinefinalvirtual

Get the Element object at t_index.

Parameters
t_index
Returns
T*

Implements PndOutputContainerI< T >.

Definition at line 153 of file PndOutputContainer.h.

154  {
155  if (this->fImp != nullptr) {
156  return this->fImp->GetElement(t_index);
157  }
158  return nullptr;
159  }
std::unique_ptr< PndOutputContainerI< T > > fImp

◆ GetSize()

template<class T>
virtual ssize_t PndOutputContainer< T >::GetSize ( ) const
inlinefinalvirtual

Get the number of members in internal data.

Returns
ssize_t

Implements PndContainerI< T >.

Definition at line 139 of file PndOutputContainer.h.

140  {
141  if (this->fImp != nullptr) {
142  return this->fImp->GetSize();
143  }
144  return 0;
145  }
std::unique_ptr< PndOutputContainerI< T > > fImp

◆ Init()

template<class T>
virtual Bool_t PndOutputContainer< T >::Init ( const TString &  t_branchname)
inlinevirtual

Init internal data.

We do not call it final

Parameters
constTString &t_branchname - Name of databranch that is to be fetched, will always get a PndSTDOutputContainer

Implements PndContainerI< T >.

Definition at line 46 of file PndOutputContainer.h.

Referenced by TestOutTask::Init().

47  {
48  this->fBranchName = t_branchname;
49  Bool_t success = TryTCA(t_branchname);
50  if (!success) {
51  success = TrySTD(t_branchname);
52  }
53  return success;
54  }
TString fBranchName
Definition: PndContainerI.h:84
Bool_t TrySTD(const TString &t_branchname)
Create a std::vector based outputcontainer and register/init it with the FairRootManager.
Bool_t TryTCA(const TString &t_branchname)
Create a TClonesArray based outputcontainer and register/init it with the FairRootManager.

◆ RemoveAt()

template<class T>
virtual void PndOutputContainer< T >::RemoveAt ( Int_t  t_index)
inlinefinalvirtual

Delete object at t_index in internal data.

Parameters
t_index

Implements PndOutputContainerI< T >.

Definition at line 127 of file PndOutputContainer.h.

128  {
129  if (this->fImp != nullptr) {
130  this->fImp->RemoveAt(t_index);
131  }
132  }
std::unique_ptr< PndOutputContainerI< T > > fImp

◆ Reset()

template<class T>
virtual void PndOutputContainer< T >::Reset ( )
inlinefinalvirtual

Reset data.

Should delete current data

Implements PndOutputContainerI< T >.

Definition at line 101 of file PndOutputContainer.h.

Referenced by TestOutTask::Exec().

102  {
103  if (this->fImp != nullptr) {
104  this->fImp->Reset();
105  }
106  }
std::unique_ptr< PndOutputContainerI< T > > fImp

◆ TrySTD()

template<class T>
Bool_t PndOutputContainer< T >::TrySTD ( const TString &  t_branchname)
inline

Create a std::vector based outputcontainer and register/init it with the FairRootManager.

Parameters
t_branchname
Returns
Bool_t

Definition at line 62 of file PndOutputContainer.h.

Referenced by PndOutputContainer< BSEmcMultiWaveform >::Init().

63  {
64  this->fImp.reset(new PndSTDOutputContainer<T>{this->fFolderName, this->fPersistency});
65  Bool_t success = this->fImp->Init(t_branchname);
66  if (!success) {
67  LOG(debug) << "No std::vector<T> branch called " << t_branchname << " registered with the FairRootManager.";
68  this->fImp.reset(nullptr);
69  } else {
70  LOG(debug) << "Found std::vector<T> branch called " << t_branchname << " registered with the FairRootManager. ";
71  }
72  return success;
73  }
std::unique_ptr< PndOutputContainerI< T > > fImp
PndSTDOutputContainer implementation of PndOutputContainerI<T> for FairRootManager and std::vector<T>...

◆ TryTCA()

template<class T>
Bool_t PndOutputContainer< T >::TryTCA ( const TString &  t_branchname)
inline

Create a TClonesArray based outputcontainer and register/init it with the FairRootManager.

Parameters
t_branchname
Returns
Bool_t

Definition at line 81 of file PndOutputContainer.h.

Referenced by PndOutputContainer< BSEmcMultiWaveform >::Init().

82  {
83  this->fImp.reset(new PndTCAOutputContainer<T>{this->fFolderName, this->fPersistency});
84  Bool_t success = this->fImp->Init(t_branchname);
85  if (!success) {
86  LOG(debug) << "No TClonesArray branch called " << t_branchname << " registered with the FairRootManager either. !";
87  this->fImp.reset(nullptr);
88  // abort();
89  } else {
90  LOG(debug) << "Found TClonesArray branch called " << t_branchname << " registered with the FairRootManager. ";
91  }
92  return success;
93  }
std::unique_ptr< PndOutputContainerI< T > > fImp
PndTCAOutputContainer implementation of PndOutputContainerI<T> for FairRootManager and TClonesArray...

Member Data Documentation

◆ fImp


The documentation for this class was generated from the following file: