PandaRoot
PndTCAMutableContainer< T > Class Template Reference

PndTCAMutableContainer implementation of PndMutableContainerI<T> for FairRootManager and TClonesArray. More...

#include <PndTCAMutableContainer.h>

Inheritance diagram for PndTCAMutableContainer< T >:
PndMutableContainerI< T > PndContainerI< T > PndContainerBaseI

Public Member Functions

 PndTCAMutableContainer (const TString &t_foldername="", Bool_t t_persistency=kTRUE)
 Construct a new PndTCAMutableContainer object. More...
 
virtual ~PndTCAMutableContainer ()
 Destroy the PndTCAOutput Container object. More...
 
virtual void Reset () final
 Delete all elements. More...
 
virtual T * CreateCopy (const T &t_element)
 Create a copy of t_element in the TClonesArray and return a pointer to it. More...
 
virtual void RemoveAt (Int_t t_index)
 remove the t_index-th element More...
 
virtual void Compress ()
 Compress. More...
 
virtual T * GetElement (Int_t t_idx) const final
 Get pointer to the t_idx-th element. More...
 
virtual ssize_t GetSize () const final
 Get the number of elements. More...
 
void SetTCA (TClonesArray *t_tca)
 Set the TClonesArray address. More...
 
TClonesArray * GetTCA ()
 Get the TClonesArray address. More...
 
- Public Member Functions inherited from PndMutableContainerI< T >
 PndMutableContainerI (const TString &t_foldername="", Bool_t t_persistency=kTRUE)
 Construct a new PndMutableContainerI object. More...
 
 fFolderName (t_foldername)
 
 fPersistency (t_persistency)
 
virtual ~PndMutableContainerI ()
 Destroy the PndMutableContainerI 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...
 
TString GetClassName () const
 
- Public Member Functions inherited from PndContainerBaseI
 PndContainerBaseI ()
 Construct a new PndContainerBaseI object. More...
 
virtual ~PndContainerBaseI ()
 Destroy the PndContainerBaseI object. More...
 
const TString & GetBranchName () const
 Get the BranchName. More...
 
void SetBranchName (const TString &t_branchname)
 Set the Branch Name. More...
 

Protected Attributes

TClonesArray * fTCA {nullptr}
 
- Protected Attributes inherited from PndMutableContainerI< T >
TString fFolderName {""}
 
Bool_t fPersistency {kFALSE}
 
- Protected Attributes inherited from PndContainerBaseI
TString fBranchName {""}
 

Detailed Description

template<class T>
class PndTCAMutableContainer< T >

PndTCAMutableContainer implementation of PndMutableContainerI<T> for FairRootManager and TClonesArray.

Output data registered with FairRootManager as (TClonesArray *)

Template Parameters
T

Definition at line 38 of file PndTCAMutableContainer.h.

Constructor & Destructor Documentation

◆ PndTCAMutableContainer()

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

Construct a new PndTCAMutableContainer object.

Parameters
constTString &t_foldername = ""
Bool_tt_persistency = kTRUE

Definition at line 46 of file PndTCAMutableContainer.h.

46 : PndMutableContainerI<T>(t_foldername, t_persistency) {}

◆ ~PndTCAMutableContainer()

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

Destroy the PndTCAOutput Container object.

Definition at line 52 of file PndTCAMutableContainer.h.

52 {}

Member Function Documentation

◆ Compress()

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

Compress.

Reimplemented from PndMutableContainerI< T >.

Definition at line 97 of file PndTCAMutableContainer.h.

98  {
99  if (this->fTCA != nullptr) {
100  this->fTCA->Compress();
101  }
102  }

◆ CreateCopy()

template<class T>
virtual T* PndTCAMutableContainer< T >::CreateCopy ( const T &  t_element)
inlinevirtual

Create a copy of t_element in the TClonesArray and return a pointer to it.

Parameters
constT &t_element
Returns
T*

Implements PndMutableContainerI< T >.

Definition at line 70 of file PndTCAMutableContainer.h.

Referenced by TestOutTask::Exec(), BSEmcExtractDigisFromWaveforms< BSEmcFwEndcapDigiPar >::Exec(), and TestOutWithTCATask::Exec().

71  {
72  if (fTCA != nullptr) {
73  new ((*fTCA)[fTCA->GetEntriesFast()]) T{t_element};
74  } else {
75  LOG(error) << "PndTCAMutableContainer::CreateCopy() no underlying TClonesArray";
76  return nullptr;
77  }
78  return GetElement(GetSize() - 1);
79  }
virtual ssize_t GetSize() const final
Get the number of elements.
virtual T * GetElement(Int_t t_idx) const final
Get pointer to the t_idx-th element.

◆ GetElement()

template<class T>
virtual T* PndTCAMutableContainer< T >::GetElement ( Int_t  t_idx) const
inlinefinalvirtual

Get pointer to the t_idx-th element.

Parameters
Int_tt_idx
Returns
T*

Implements PndMutableContainerI< T >.

Definition at line 110 of file PndTCAMutableContainer.h.

Referenced by PndTCAMutableContainer< BSEmcDigi >::CreateCopy().

111  {
112  if (fTCA != nullptr) {
113  return static_cast<T *>(fTCA->At(t_idx));
114  }
115  return nullptr;
116  }

◆ GetSize()

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

Get the number of elements.

Returns
ssize_t

Implements PndContainerBaseI.

Definition at line 123 of file PndTCAMutableContainer.h.

Referenced by PndTCAMutableContainer< BSEmcDigi >::CreateCopy().

124  {
125  if (fTCA != nullptr) {
126  return fTCA->GetEntriesFast();
127  }
128  return 0;
129  }

◆ GetTCA()

template<class T>
TClonesArray* PndTCAMutableContainer< T >::GetTCA ( )
inline

Get the TClonesArray address.

Returns
TClonesArray *

Definition at line 143 of file PndTCAMutableContainer.h.

143 { return fTCA; }

◆ RemoveAt()

template<class T>
virtual void PndTCAMutableContainer< T >::RemoveAt ( Int_t  t_index)
inlinevirtual

remove the t_index-th element

Parameters
Int_tt_index

Implements PndMutableContainerI< T >.

Definition at line 86 of file PndTCAMutableContainer.h.

87  {
88  if (this->fTCA != nullptr) {
89  this->fTCA->RemoveAt(t_index);
90  }
91  }

◆ Reset()

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

Delete all elements.

Implements PndMutableContainerI< T >.

Definition at line 58 of file PndTCAMutableContainer.h.

Referenced by TestOutTask::Exec(), BSEmcExtractDigisFromWaveforms< BSEmcFwEndcapDigiPar >::Exec(), and TestOutWithTCATask::Exec().

59  {
60  if (this->fTCA != nullptr) {
61  this->fTCA->Delete();
62  }
63  }

◆ SetTCA()

template<class T>
void PndTCAMutableContainer< T >::SetTCA ( TClonesArray *  t_tca)
inline

Set the TClonesArray address.

Parameters
TClonesArray*t_tca

Definition at line 136 of file PndTCAMutableContainer.h.

Referenced by PndProcessTask::HandledRequest(), BSEmcExtractDigisFromWaveforms< BSEmcFwEndcapDigiPar >::Init(), TestOutTask::Init(), and TestOutWithTCATask::Init().

136 { fTCA = t_tca; }

Member Data Documentation

◆ fTCA


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