17#include "FairRootManager.h"
18#include "TClonesArray.h"
34 : fBranchName(std::move(b))
35 , fClassName(T().ClassName())
42 auto ioman = FairRootManager::Instance();
45 throw std::runtime_error(
"TCAInputConnector: No FairRootManager");
47 fTCA = (TClonesArray*)ioman->GetObject(fBranchName);
50 throw std::runtime_error((
"TCAInputConnector: No TClonesArray called " + fBranchName +
51 " could be obtained from the FairRootManager")
54 if (!TString(fTCA->GetClass()->GetName()).EqualTo(fClassName))
56 throw std::runtime_error(
57 (
"TCAInputConnector: TClonesArray " + fBranchName +
" does not contain elements of type " + fClassName)
67 throw std::runtime_error(
68 (
"TCAInputConnector: TClonesArray " + fBranchName +
" of " + fClassName +
"s not available").Data());
71 const Int_t n = fTCA->GetEntries();
73 for (Int_t i = 0; i < n; i++)
75 fV.emplace_back((T*)fTCA->At(i));
85 throw std::runtime_error(
86 (
"TCAInputConnector: TClonesArray " + fBranchName +
" of " + fClassName +
"s not available").Data());
89 const Int_t n = fTCA->GetEntries();
91 for (Int_t i = 0; i < n; i++)
93 fV.emplace_back(*(T*)fTCA->At(i));
109 : fBranchName(std::move(b))
110 , fClassName(T().ClassName())
117 auto ioman = FairRootManager::Instance();
118 if (ioman ==
nullptr)
120 throw std::runtime_error(
"TCAInputConnector: No FairRootManager");
122 fTCA = (TClonesArray*)ioman->GetObject(fBranchName);
123 if (fTCA !=
nullptr && !TString(fTCA->GetClass()->GetName()).EqualTo(fClassName))
125 throw std::runtime_error(
126 (
"TCAInputConnector: TClonesArray " + fBranchName +
" does not contain elements of type " + fClassName)
139 const Int_t n = fTCA->GetEntries();
141 for (Int_t i = 0; i < n; i++)
143 fV.emplace_back((T*)fTCA->At(i));
156 const Int_t n = fTCA->GetEntries();
158 for (Int_t i = 0; i < n; i++)
160 fV.emplace_back(*(T*)fTCA->At(i));
176 : fBranchName(std::move(b))
177 , fClassName(T().ClassName())
184 auto ioman = FairRootManager::Instance();
185 if (ioman ==
nullptr)
187 throw std::runtime_error(
"TCAOutputConnector: No FairRootManager");
189 fTCA = ioman->Register(fBranchName, fClassName,
"", kTRUE);
193 throw std::runtime_error((
"TCAOutputConnector: TClonesArray " + fBranchName +
" of " + fClassName +
194 "s could not be provided by the FairRootManager")
203 throw std::runtime_error(
204 (
"TCAOutputConnector: TClonesArray " + fBranchName +
" of " + fClassName +
"s not available").Data());
213 throw std::runtime_error(
214 (
"TCAOutputConnector: TClonesArray " + fBranchName +
" of " + fClassName +
"s not available").Data());
216 return fTCA->GetEntries();
223 throw std::runtime_error(
224 (
"TCAOutputConnector: TClonesArray " + fBranchName +
" of " + fClassName +
"s not available").Data());
226 new ((*fTCA)[fTCA->GetEntries()]) T(std::move(t));
233 throw std::runtime_error(
234 (
"TCAOutputConnector: TClonesArray " + fBranchName +
" of " + fClassName +
"s not available").Data());
238 new ((*fTCA)[fTCA->GetEntries()]) T(*t);
246 throw std::runtime_error(
247 (
"TCAOutputConnector: TClonesArray " + fBranchName +
" of " + fClassName +
"s not available").Data());
251 new ((*fTCA)[fTCA->GetEntries()]) T(std::move(o));
void Insert(std::vector< T > &v)
TCAOutputConnector(TString b)