14 #ifndef PNDTCAOUTPUTCONTAINER_HH    15 #define PNDTCAOUTPUTCONTAINER_HH    20 #include "TClonesArray.h"    23 #include "FairLogger.h"    24 #include "FairRootManager.h"    57   virtual Bool_t 
Init(
const TString &t_branchname) 
final    60     FairRootManager *ioman = FairRootManager::Instance();
    61     if (ioman == 
nullptr) {
    62       throw std::runtime_error(
"FairRootManager::Instance() returned nullptr");
    64       if (ioman->CheckBranch(t_branchname) == 0) {
    65         LOG(debug) << 
"Attempting to register " << t_branchname << 
" as a container for " << T().ClassName() << 
" in folder " << this->
fFolderName;
    68         this->
fTCA = 
dynamic_cast<TClonesArray *
>(ioman->GetObject(t_branchname));
    69         if (this->
fTCA == 
nullptr) {
    74           LOG(error) << 
"PndTCAOutputContainer<" << T().ClassName() << 
">::Init(" << t_branchname << 
"): No " << T().ClassName() << 
" array with name " << t_branchname
    75                      << 
" already exists but could not be fetched!";
    79         LOG(debug) << 
"Found a branch already called " << t_branchname << 
". Using this for container for " << T().ClassName() << 
" in folder " << this->
fFolderName;
    91     if (this->
fTCA != 
nullptr) {
   103     if (
fTCA != 
nullptr) {
   104       new ((*fTCA)[
fTCA->GetEntriesFast()]) T{t_element};
   106       LOG(ERROR) << 
"PndTCAOutputContainer::CreateCopy() no underlying std::vector";
   119     if (this->
fTCA != 
nullptr) {
   120       this->
fTCA->RemoveAt(t_index);
   130     if (this->
fTCA != 
nullptr) {
   131       this->
fTCA->Compress();
   143     if (
fTCA != 
nullptr) {
   144       return static_cast<T *
>(
fTCA->At(t_idx));
   156     if (
fTCA != 
nullptr) {
   157       return fTCA->GetEntriesFast();
 virtual Bool_t Init(const TString &t_branchname) final
Register the data t_branchname in form of TClonesArray * with the FairRootManager. 
 
virtual void Compress()
Compress. 
 
void SetTCA(TClonesArray *t_tca)
Set the TClonesArray address. 
 
virtual T * CreateCopy(const T &t_element)
Create a copy of t_element in the TClonesArray and return a pointer to it. 
 
virtual void Reset() final
Delete all elements. 
 
virtual void RemoveAt(Int_t t_index)
remove the t_index-th element 
 
PndTCAOutputContainer(const TString &t_foldername="", Bool_t t_persistency=kTRUE)
Construct a new PndTCAOutputContainer object. 
 
PndTCAOutputContainer implementation of PndOutputContainerI<T> for FairRootManager and TClonesArray...
 
virtual ssize_t GetSize() const final
Get the number of elements. 
 
virtual ~PndTCAOutputContainer()
Destroy the PndTCAOutput Container object. 
 
virtual T * GetElement(Int_t t_idx) const final
Get pointer to the t_idx-th element. 
 
TClonesArray * GetTCA()
Get the TClonesArray address.