PandaRoot
PndTCAInputContainer< T > Class Template Reference

PndTCAInputContainer implementation of PndInputContainerI<T> for FairRootManager and TClonesArray. More...

#include <PndTCAInputContainer.h>

Inheritance diagram for PndTCAInputContainer< T >:
PndInputContainerI< T > PndContainerI< T >

Public Member Functions

 PndTCAInputContainer ()
 Construct a new PndTCAInputContainer object. More...
 
virtual ~PndTCAInputContainer ()
 Destroy the PndTCAInputContainer object. More...
 
virtual Bool_t Init (const TString &t_branchname) final
 Fetch the data t_branchname in form of TClonesArray * from the FairRootManager. More...
 
virtual T const * 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 PndInputContainerI< T >
 PndInputContainerI ()
 Construct a new PndInputContainerI object. More...
 
virtual T const * GetConstElementPtr (Int_t t_index) const
 Get the Element object at t_index. More...
 
std::vector< T const * > GetVector () const
 return vector of ptrs pointing at internal data, to be used to access data independent of underlying data container 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

TClonesArray * fTCA {nullptr}
 
- Protected Attributes inherited from PndContainerI< T >
TString fBranchName {""}
 

Detailed Description

template<class T>
class PndTCAInputContainer< T >

PndTCAInputContainer implementation of PndInputContainerI<T> for FairRootManager and TClonesArray.

Input data retrieved from FairRootManager is immutable (TClonesArray *)

Template Parameters
T

Definition at line 36 of file PndTCAInputContainer.h.

Constructor & Destructor Documentation

◆ PndTCAInputContainer()

template<class T>
PndTCAInputContainer< T >::PndTCAInputContainer ( )
inline

Construct a new PndTCAInputContainer object.

Definition at line 42 of file PndTCAInputContainer.h.

◆ ~PndTCAInputContainer()

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

Destroy the PndTCAInputContainer object.

Definition at line 48 of file PndTCAInputContainer.h.

48 {};

Member Function Documentation

◆ GetElement()

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

Get pointer to the t_idx-th element.

Parameters
Int_tt_idx
Returns
T const *

Implements PndInputContainerI< T >.

Definition at line 80 of file PndTCAInputContainer.h.

81  {
82  if (fTCA != nullptr) {
83  return static_cast<T *>(fTCA->At(t_idx));
84  }
85  return nullptr;
86  }

◆ GetSize()

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

Get the number of elements.

Returns
ssize_t

Implements PndContainerI< T >.

Definition at line 93 of file PndTCAInputContainer.h.

Referenced by BSEmcMCHitToTimebasedWaveforms< BSEmcBwEndcapDigiPar >::Exec().

94  {
95  if (fTCA != nullptr) {
96  return fTCA->GetEntriesFast();
97  }
98  return 0;
99  }

◆ GetTCA()

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

Get the TClonesArray address.

Returns
TClonesArray *

Definition at line 113 of file PndTCAInputContainer.h.

113 { return fTCA; }

◆ Init()

template<class T>
virtual Bool_t PndTCAInputContainer< T >::Init ( const TString &  t_branchname)
inlinefinalvirtual

Fetch the data t_branchname in form of TClonesArray * from the FairRootManager.

Parameters
constTString &t_branchname

Implements PndContainerI< T >.

Definition at line 55 of file PndTCAInputContainer.h.

Referenced by BSEmcMCHitToTimebasedWaveforms< BSEmcBwEndcapDigiPar >::Init().

56  {
57  this->fBranchName = t_branchname;
58  FairRootManager *ioman = FairRootManager::Instance();
59  if (ioman == nullptr) {
60  throw std::runtime_error("FairRootManager::Instance() returned nullptr");
61  } else {
62  this->fTCA = dynamic_cast<TClonesArray *>(ioman->GetObject(t_branchname));
63  if (this->fTCA == nullptr) {
64  // throw std::runtime_error(
65  // ("PndTCAInputContainer<" + TString{T().ClassName()} + ">::Init(" + t_branchname + "): No " + TString{T().ClassName()} + " array with name " + t_branchname + " found!")
66  // .Data());
67  LOG(error) << "PndTCAInputContainer<" << T().ClassName() << ">::Init(" << t_branchname << "): No " << T().ClassName() << " array with name " << t_branchname << " found!";
68  return kFALSE;
69  }
70  }
71  return kTRUE;
72  }
TString fBranchName
Definition: PndContainerI.h:84

◆ SetTCA()

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

Set the TClonesArray address.

Parameters
TClonesArray*t_tca

Definition at line 106 of file PndTCAInputContainer.h.

106 { fTCA = t_tca; }

Member Data Documentation

◆ fTCA


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