25#include <TBranchElement.h>
29#include <TStreamerElement.h>
30#include <TStreamerInfo.h>
33#include <TVirtualCollectionProxy.h>
44bool isPrimitiveBranch(TBranch& br) {
47 ::TClass*
cl =
nullptr;
48 ::EDataType dType = kOther_t;
51 if (
br.GetExpectedType(cl, dType)) {
52 ::Error(
"::isPrimitiveBranch",
60 return ((dType != kOther_t) && (dType != kNoType_t) && (dType != kVoid_t));
80bool isContainerBranch(TBranch& br,
SG::auxid_t auxid) {
89 ::TClass*
cl =
nullptr;
90 ::EDataType dType = kOther_t;
93 if (
br.GetExpectedType(cl, dType)) {
94 ::Error(
"::isContainerBranch",
95 XAOD_MESSAGE(
"Couldn't determine the type of branch \"%s\""),
108 const std::type_info* root_ti =
cl->GetTypeInfo();
116 typeName.ReplaceAll(
"basic_string<char>",
"string");
117 ::TClass* newCl = ::TClass::GetClass(typeName);
119 root_ti = newCl->GetTypeInfo();
123 ::Error(
"::isContainerBranch",
124 XAOD_MESSAGE(
"Couldn't get an std::type_info object out of "
125 "branch \"%s\" of type \"%s\""),
126 br.GetName(),
cl->GetName());
131 const std::type_info* aux_obj_ti =
134 ::Error(
"::isContainerBranch",
137 static_cast<int>(auxid));
140 const std::type_info* aux_vec_ti =
143 ::Error(
"::isContainerBranch",
146 static_cast<int>(auxid));
151 if (*root_ti == *aux_obj_ti) {
154 }
else if (*root_ti == *aux_vec_ti) {
162 if (
cl->GetCollectionProxy() && (*aux_vec_ti ==
typeid(std::vector<int>))) {
168 if (*cl2->GetTypeInfo() == *aux_vec_ti) {
184 aux_vec_cl->GetConversionStreamerInfo(cl,
cl->GetClassVersion())) {
190 aux_obj_cl->GetConversionStreamerInfo(cl,
cl->GetClassVersion())) {
195 ::Error(
"::isContainerBranch",
196 XAOD_MESSAGE(
"Couldn't determine if branch describes a single "
197 "object or a container"));
198 ::Error(
"::isContainerBranch",
XAOD_MESSAGE(
"ROOT type : %s"),
200 ::Error(
":isContainerBranch",
XAOD_MESSAGE(
"Object type: %s"),
202 ::Error(
"::isContainerBranch",
XAOD_MESSAGE(
"Vector type: %s"),
216 TBranchHandle(
bool staticBranch,
bool primitiveBranch,
217 const std::type_info* ti,
void* obj,
SG::auxid_t auxid,
218 std::string_view prefix)
222 m_static(staticBranch),
223 m_primitive(primitiveBranch),
251 if (!m_branch->GetTree()) {
253 "xAOD::TAuxStore::TBranchHandle::getEntry",
254 XAOD_MESSAGE(
"Branch=%s is not associated to any tree while reading "
255 "of branches within this class relies on that"),
256 m_branch->GetName());
266 ::Long64_t
entry = m_branch->GetTree()->GetReadEntry();
274 Error(
"xAOD::TAuxStore::TBranchHandle::getEntry",
276 "Entry to read is not set for branch=%s from tree=%s. "
277 "It is either because TTree::LoadTree(entry) was not called "
278 "beforehand in the TEvent class OR "
279 "the entry requested to be read for the main tree is not "
280 "corresponding to an event for the friend tree"),
281 m_branch->GetName(), m_branch->GetTree()->GetName());
286 if ((entry == m_entry) && (!m_needsRead)) {
292 if ((m_branch->GetMakeClass() != m_static) &&
293 (!m_branch->SetMakeClass(m_static))) {
294 ::Error(
"xAOD::TAuxStore::TBranchHandle::getEntry",
297 static_cast<int>(m_static), m_branch->GetName());
303 const ::Int_t nbytes = m_branch->GetEntry(entry);
324 ::TBranch** branchPtr() {
return &m_branch; }
334 void* objectPtr() {
return m_object; }
353 void* inputObjectPtr() {
355 if (m_static || m_primitive) {
372 void* outputObjectPtr() {
381 const std::type_info* typeInfo()
const {
return m_typeInfo; }
395 void reset() { m_needsRead =
true; }
409 const std::type_info* m_typeInfo;
415 std::string_view m_prefix;
447 return StatusCode::SUCCESS;
452 return StatusCode::SUCCESS;
456 TObjArray* branches =
m_inTree->GetListOfBranches();
459 for (Int_t i = 0; i < branches->GetEntriesFast(); ++i) {
462 const TString brName = branches->At(i)->GetName();
465 TBranch* br =
dynamic_cast<TBranch*
>(branches->At(i));
467 ::Fatal(
"xAOD::TAuxStore::impl::scanInputTree",
479 TObjArray* sbranches = br->GetListOfBranches();
482 for (Int_t j = 0; j < sbranches->GetEntriesFast(); ++j) {
485 const TString brName = sbranches->At(j)->GetName();
488 const TString auxName =
489 brName(brName.Index(
".") + 1, brName.Length());
492 if (auxName.BeginsWith(
"xAOD::") || auxName.BeginsWith(
"SG::") ||
493 (auxName ==
"ILockable")) {
498 ::TBranch* sbr =
dynamic_cast< ::TBranch*
>(sbranches->At(j));
500 ::Fatal(
"xAOD::TAuxStore::impl::scanInputTree",
515 if (!brName.BeginsWith(
m_data.m_dynPrefix.data())) {
521 if (brName ==
m_data.m_dynPrefix) {
522 ::Warning(
"xAOD::TAuxStore::impl::scanInputTree",
523 "Dynamic branch with empty name found on container: %s",
529 const TString auxName = brName(brName.Index(
".") + 1, brName.Length());
541 return StatusCode::SUCCESS;
546 ::TBranch& br, std::string_view auxName,
bool staticBranch,
547 std::string* expectedClassName =
nullptr) {
550 ::TClass* expectedClass =
nullptr;
551 ::EDataType expectedType = kOther_t;
552 if (br.GetExpectedType(expectedClass, expectedType) &&
553 ((!staticBranch) || (!auxName.starts_with(
"m_")))) {
554 ::Warning(
"xAOD::TAuxStore::impl::auxBranchType",
555 "Couldn't get the type of branch \"%s\"", br.GetName());
563 if (TBranchElement* bre =
dynamic_cast<TBranchElement*
>(&br)) {
564 TClass* newClass = bre->GetCurrentClass();
565 if (newClass && newClass != expectedClass) {
566 expectedClass = newClass;
569 if (expectedClassName) {
570 *expectedClassName = expectedClass->GetName();
576 if ((!expectedClass) &&
582 const std::type_info* ti =
nullptr;
585 ti = expectedClass->GetTypeInfo();
590 if (!expectedClass) {
591 if ((!staticBranch) || (!auxName.starts_with(
"m_"))) {
592 ::Warning(
"xAOD::TAuxStore::impl::auxBranchType",
593 "Couldn't get the type of branch \"%s\"", br.GetName());
596 ::TVirtualCollectionProxy* prox = expectedClass->GetCollectionProxy();
601 prox = cl2->GetCollectionProxy();
606 if ((!staticBranch) || (!auxName.starts_with(
"m_"))) {
607 ::Warning(
"xAOD::TAuxStore::impl::auxBranchType",
608 "Couldn't get the type of branch \"%s\"", br.GetName());
611 if (prox->GetValueClass()) {
612 ti = prox->GetValueClass()->GetTypeInfo();
645 std::string expectedClassName;
646 const std::type_info* ti =
647 auxBranchType(br, auxName, staticBranch, &expectedClassName);
650 return StatusCode::SUCCESS;
661 m_data.m_auxIDs.insert(regAuxid);
662 return StatusCode::SUCCESS;
669 flags |= SG::AuxVarFlags::Linked;
671 std::string linkedAttr =
674 ::TBranch* lbr =
m_inTree->GetBranch(linkedBranch.c_str());
675 const std::type_info* lti =
nullptr;
681 *lti, linkedAttr,
"",
682 SG::AuxVarFlags::SkipNameCheck | SG::AuxVarFlags::Linked);
685 ::Error(
"xAOD::TAuxStore::impl::setupAuxBranch",
686 "Could not find linked variable for %s type %s", auxName.data(),
687 expectedClassName.c_str());
693 registry.
getAuxID(*ti, std::string{auxName},
"", flags, linked_auxid);
704 if (tn.starts_with(
"std::vector<")) {
707 std::string fac_class_name =
708 "SG::AuxTypeVectorFactory<" + tn +
",allocator<" + tn;
709 if (fac_class_name[fac_class_name.size() - 1] ==
'>') {
710 fac_class_name +=
' ';
712 fac_class_name +=
"> >";
715 ::TClass* fac_class = TClass::GetClass(fac_class_name.c_str());
716 if (fac_class && fac_class->IsLoaded()) {
717 ::TClass* base_class = ::TClass::GetClass(
"SG::IAuxTypeVectorFactory");
718 if (base_class && base_class->IsLoaded()) {
719 const Int_t offs = fac_class->GetBaseClassOffset(base_class);
721 void* fac_vp = fac_class->New();
724 reinterpret_cast<unsigned long>(fac_vp) + offs;
729 std::unique_ptr<SG::IAuxTypeVectorFactory>(fac));
730 auxid = registry.
getAuxID(*ti, std::string{auxName},
"", flags,
743 if (vec_class_name[vec_class_name.size() - 1] ==
'>') {
744 vec_class_name +=
' ';
746 vec_class_name +=
'>';
749 ::TClass* vec_class = ::TClass::GetClass(vec_class_name.c_str());
750 if (vec_class && vec_class->IsLoaded()) {
751 auto fac = std::make_unique<TAuxVectorFactory>(vec_class);
752 if (fac->tiAlloc()) {
753 const std::type_info* tiAlloc = fac->tiAlloc();
754 registry.
addFactory(*ti, *tiAlloc, std::move(fac));
756 std::string tiAllocName = fac->tiAllocName();
757 registry.
addFactory(*ti, tiAllocName, std::move(fac));
759 auxid = registry.
getAuxID(*ti, std::string{auxName},
"",
760 SG::AuxVarFlags::SkipNameCheck);
762 ::Warning(
"xAOD::TAuxStore::impl::setupAuxBranch",
763 "Couldn't find dictionary for type: %s",
764 vec_class_name.c_str());
771 ::Error(
"xAOD::TAuxStore::impl::setupAuxBranch",
772 XAOD_MESSAGE(
"Dynamic ROOT vector factory not implemented for "
773 "linked types; branch "
777 ::Error(
"xAOD::TAuxStore::impl::setupAuxBranch",
782 return StatusCode::FAILURE;
786 m_data.m_auxIDs.insert(auxid);
787 return StatusCode::SUCCESS;
839 return m_impl->m_basketSize;
845 m_impl->m_basketSize = value;
851 return m_impl->m_splitLevel;
857 m_impl->m_splitLevel = value;
873 m_impl->m_missingBranches.clear();
883 assert(
m_impl->m_inTree !=
nullptr);
884 TBranch* br =
m_impl->m_inTree->GetBranch(
m_data.m_prefix.data());
888 return StatusCode::SUCCESS;
893 if ((br->GetSplitLevel() != 1) &&
m_data.m_topStore && printWarnings) {
894 ::Warning(
"xAOD::TAuxStore::readFrom",
895 "Static branch (%s) with split level %i discovered",
896 m_data.m_prefix.data(), br->GetSplitLevel());
897 ::Warning(
"xAOD::TAuxStore::readFrom",
898 "The reading of complex variables from it may/will fail!");
902 return StatusCode::SUCCESS;
929 return StatusCode::SUCCESS;
944 if (
m_data.m_transientStore && (getall != 99)) {
946 m_data.m_auxIDs -=
m_data.m_transientStore->getAuxIDs();
947 m_data.m_decorIDs -=
m_data.m_transientStore->getDecorIDs();
949 m_data.m_transientStore.reset();
955 if (!
m_data.m_isDecoration[auxid]) {
958 m_data.m_auxIDs.erase(auxid);
959 m_data.m_decorIDs.erase(auxid);
970 for (
auto& branchHandle :
m_impl->m_branches) {
972 bytesRead += branchHandle->getEntry();
982 for (
auto& branchHandle :
m_impl->m_branches) {
984 branchHandle->reset();
987 m_impl->m_inputScanned =
false;
993 return ((
m_impl->m_branches.size() > auxid) &&
m_impl->m_branches[auxid]);
999 assert(
m_impl->m_branches.size() > auxid);
1000 assert(
m_impl->m_branches[auxid]);
1001 const ::Int_t readBytes =
m_impl->m_branches[auxid]->getEntry();
1002 if (readBytes < 0) {
1003 ::Error(
"xAOD::TAuxStore::getEntryFor",
1006 return StatusCode::FAILURE;
1008 return StatusCode::SUCCESS;
1014 return (
m_impl->m_outTree !=
nullptr);
1032 if ((auxid < m_impl->m_missingBranches.size()) &&
1033 m_impl->m_missingBranches[auxid]) {
1034 return StatusCode::RECOVERABLE;
1038 if (
m_data.m_vecs.size() <= auxid) {
1039 m_data.m_vecs.resize(auxid + 1);
1041 if (
m_impl->m_branches.size() <= auxid) {
1042 m_impl->m_branches.resize(auxid + 1);
1046 if (
m_data.m_vecs[auxid] &&
m_impl->m_branches[auxid]) {
1047 return StatusCode::SUCCESS;
1051 if (
m_impl->m_inTree ==
nullptr) {
1052 ::Error(
"xAOD::TAuxStore::setupInputData",
1054 return StatusCode::FAILURE;
1058 if (
m_data.m_vecs[auxid] ||
m_impl->m_branches[auxid]) {
1059 ::Error(
"xAOD::TAuxStore::setupInputData",
1061 return StatusCode::FAILURE;
1068 const TString statBrName =
1069 std::format(
"{}{}",
m_data.m_prefix,
r.getName(auxid));
1070 const TString dynBrName =
1071 std::format(
"{}{}",
m_data.m_dynPrefix,
r.getName(auxid));
1074 Bool_t staticBranch =
true;
1075 TString brName = statBrName;
1077 TBranch* br =
m_impl->m_inTree->GetBranch(statBrName);
1079 br =
m_impl->m_inTree->GetBranch(dynBrName);
1083 if (
m_impl->m_missingBranches.size() <= auxid) {
1084 m_impl->m_missingBranches.resize(auxid + 1);
1086 m_impl->m_missingBranches[auxid] =
true;
1089 return StatusCode::RECOVERABLE;
1092 staticBranch =
false;
1097 const Bool_t primitiveBranch = isPrimitiveBranch(*br);
1099 const Bool_t containerBranch =
1100 (primitiveBranch ? false : isContainerBranch(*br, auxid));
1109 if ((containerBranch &&
1111 !
r.isLinked(auxid)) ||
1112 ((!containerBranch) &&
1114 ::Error(
"xAOD::TAuxStore::setupInputData",
1115 XAOD_MESSAGE(
"Branch type and requested structure mode "
1116 "differ for branch: %s"),
1118 return StatusCode::FAILURE;
1122 ::TClass* clDummy = 0;
1123 ::EDataType dType = kOther_t;
1124 if (br->GetExpectedType(clDummy, dType)) {
1125 ::Error(
"xAOD::TAuxStore::setupInputData",
1126 XAOD_MESSAGE(
"Couldn't determine the type of branch \"%s\""),
1128 return StatusCode::FAILURE;
1132 const std::type_info* brType = 0;
1135 brType = (containerBranch ?
r.getVecType(auxid) :
r.getType(auxid));
1141 ::Error(
"xAOD::TAuxStore::setupInputData",
1142 XAOD_MESSAGE(
"Can't read/copy variable %s (%s)"), brName.Data(),
1143 clDummy->GetName());
1144 return StatusCode::RECOVERABLE;
1149 ::TClass* brClass = 0;
1150 if (!primitiveBranch) {
1152 brClass = ::TClass::GetClass(*brType,
true,
true);
1154 brClass = ::TClass::GetClass(brTypeName);
1157 ::Error(
"xAOD::TAuxStore::setupInputData",
1158 XAOD_MESSAGE(
"No dictionary available for class \"%s\""),
1160 return StatusCode::FAILURE;
1166 m_data.m_vecs[auxid] =
r.makeVector(auxid, (
size_t)0, (
size_t)0);
1167 if (!containerBranch) {
1168 m_data.m_vecs[auxid]->resize(1);
1171 strncmp(clDummy->GetName(),
"SG::PackedContainer<", 20) == 0) {
1172 std::unique_ptr<SG::IAuxTypeVector> packed =
1173 m_data.m_vecs[auxid]->toPacked();
1177 ::Error(
"xAOD::TAuxStore::setupInputData",
1179 "variable %s (%i)"),
1180 brName.Data(),
static_cast<int>(auxid));
1181 return StatusCode::FAILURE;
1185 const std::type_info* objType = brType;
1186 if (containerBranch) {
1187 objType =
m_data.m_vecs[auxid]->objType();
1189 objType =
r.getType(auxid);
1191 m_impl->m_branches[auxid] = std::make_unique<TBranchHandle>(
1192 staticBranch, primitiveBranch, objType,
1193 (containerBranch ?
m_data.m_vecs[auxid]->toVector()
1194 :
m_data.m_vecs[auxid]->toPtr()),
1204 if (clDummy && ::TString(clDummy->GetName()).Contains(
"basic_string<char>")) {
1211 status =
m_impl->m_inTree->SetBranchAddress(
1212 brName,
m_impl->m_branches[auxid]->inputObjectPtr(),
1213 m_impl->m_branches[auxid]->branchPtr());
1215 status =
m_impl->m_inTree->SetBranchAddress(
1216 brName,
m_impl->m_branches[auxid]->inputObjectPtr(),
1217 m_impl->m_branches[auxid]->branchPtr(), brClass, dType,
1218 ((!staticBranch) && (!primitiveBranch)));
1221 ::Error(
"xAOD::TAuxStore::setupInputData",
1222 XAOD_MESSAGE(
"Coulnd't connect to branch \"%s\""), brName.Data());
1223 ::Error(
"xAOD::TAuxStore::setupInputData",
XAOD_MESSAGE(
"Return code: %i"),
1225 m_data.m_vecs[auxid].reset();
1226 m_impl->m_branches[auxid].reset();
1227 return StatusCode::FAILURE;
1231 m_impl->m_branches[auxid]->getEntry();
1234 m_data.m_auxIDs.insert(auxid);
1239 const std::string auxname =
r.getName(auxid);
1251 const std::string testname =
r.getName(i);
1253 if (testname != auxname) {
1258 ::Error(
"xAOD::TAuxStore::setupInputData",
1263 m_data.m_vecs[i].reset();
1264 m_impl->m_branches[i].reset();
1265 m_data.m_auxIDs.erase(i);
1275 return StatusCode::SUCCESS;
1292 if (!
m_impl->m_outTree) {
1293 return StatusCode::SUCCESS;
1298 return StatusCode::SUCCESS;
1302 if (
m_data.m_vecs.size() <= auxid) {
1303 m_data.m_vecs.resize(auxid + 1);
1305 if (
m_impl->m_branches.size() <= auxid) {
1306 m_impl->m_branches.resize(auxid + 1);
1308 if (
m_impl->m_branchesWritten.size() <= auxid) {
1309 m_impl->m_branchesWritten.resize(auxid + 1);
1313 if (
m_impl->m_branchesWritten[auxid]) {
1314 return StatusCode::SUCCESS;
1322 if ((!
m_data.m_vecs[auxid]) &&
m_data.m_transientStore &&
1323 (
m_data.m_transientStore->getAuxIDs().test(auxid))) {
1326 const void* pptr =
m_data.m_transientStore->getData(auxid);
1328 ::Fatal(
"xAOD::TAuxStore::setupOutputData",
1330 return StatusCode::FAILURE;
1335 void* ptr =
m_data.m_vecs[auxid]->toPtr();
1337 ::Error(
"xAOD::TAuxStore::setupOutputData",
1340 return StatusCode::FAILURE;
1344 const std::type_info*
type = reg.getType(auxid);
1346 ::Error(
"xAOD::TAuxStore::setupOutputData",
1349 static_cast<int>(auxid));
1350 return StatusCode::FAILURE;
1355 ::Error(
"xAOD::TAuxStore::setupOutputData",
1356 XAOD_MESSAGE(
"No factory found for transient variable "
1358 static_cast<int>(auxid));
1359 return StatusCode::FAILURE;
1363 if (
m_data.m_isDecoration.size() <= auxid) {
1364 m_data.m_isDecoration.resize(auxid + 1);
1366 m_data.m_isDecoration[auxid] =
true;
1376 if ((
m_data.m_auxIDs.test(auxid)) && (!
m_data.m_vecs[auxid]) &&
1377 (!
m_impl->m_branches[auxid])) {
1384 ::Error(
"xAOD::TAuxStore::setupOutputData",
1385 XAOD_MESSAGE(
"Structure mode unknown for variable %s"),
1387 return StatusCode::FAILURE;
1391 if (!
m_data.m_vecs[auxid]) {
1395 m_data.m_vecs[auxid]->resize(1);
1400 if (!
m_impl->m_branches[auxid]) {
1402 const std::type_info* brType =
1407 bool primitiveBranch = (strlen(brType->name()) == 1);
1408 m_impl->m_branches[auxid] = std::make_unique<TBranchHandle>(
1409 false, (strlen(brType->name()) == 1),
1410 (primitiveBranch ? brType :
m_data.m_vecs[auxid]->objType()),
1412 ?
m_data.m_vecs[auxid]->toPtr()
1413 :
m_data.m_vecs[auxid]->toVector()),
1418 const TString brName =
1419 std::format(
"{}{}",
m_data.m_dynPrefix,
1424 ::TBranch* br =
m_impl->m_outTree->GetBranch(brName);
1429 br->SetAddress(
m_impl->m_branches[auxid]->outputObjectPtr());
1433 m_impl->m_branchesWritten[auxid] =
true;
1435 return StatusCode::SUCCESS;
1439 const std::type_info* brType =
m_impl->m_branches[auxid]->typeInfo();
1441 ::Error(
"xAOD::TAuxStore::setupOutputData",
1444 return StatusCode::FAILURE;
1449 const Bool_t primitiveBranch = (strlen(brType->name()) == 1);
1452 if (primitiveBranch) {
1456 if (rootType ==
'\0') {
1457 ::Error(
"xAOD::TAuxStore::setupOutputData",
1460 brName.Data(), brTypeName.c_str());
1461 return StatusCode::FAILURE;
1465 std::ostringstream typeDesc;
1466 typeDesc << brName <<
"/" << rootType;
1469 br =
m_impl->m_outTree->Branch(
1470 brName,
m_impl->m_branches[auxid]->outputObjectPtr(),
1471 typeDesc.str().c_str(),
m_impl->m_basketSize);
1476 TClass* cl = TClass::GetClass(*brType);
1478 cl = TClass::GetClass(brTypeName.c_str());
1481 ::Error(
"xAOD::TAuxStore::setupOutputData",
1483 brTypeName.c_str());
1484 return StatusCode::FAILURE;
1486 if (!cl->GetStreamerInfo()) {
1487 ::Error(
"xAOD::TAuxStore::setupOutputData",
1488 XAOD_MESSAGE(
"No streamer info available for type %s"),
1490 return StatusCode::FAILURE;
1494 br =
m_impl->m_outTree->Branch(brName, cl->GetName(),
1495 m_impl->m_branches[auxid]->outputObjectPtr(),
1501 ::Error(
"xAOD::TAuxStore::setupOutputData",
1504 brName.Data(), brTypeName.c_str());
1505 return StatusCode::FAILURE;
1510 for (Long64_t i = 0; i <
m_impl->m_outTree->GetEntries(); ++i) {
1515 m_impl->m_branchesWritten[auxid] =
true;
1518 m_data.m_auxIDs.insert(auxid);
1521 return StatusCode::SUCCESS;
1527 assert(
m_impl->m_branches.size() > auxid);
1528 assert(
m_impl->m_branches[auxid]);
1529 return m_impl->m_branches[auxid]->objectPtr();
1535 assert(
m_impl->m_branches.size() > auxid);
1536 assert(
m_impl->m_branches[auxid]);
1537 return m_impl->m_branches[auxid]->typeInfo();
An auxiliary data store that holds data internally.
Handle mappings between names and auxid_t.
Make an AuxVectorData object from either a raw vector or an aux store.
Exceptions that can be thrown from AthContainers.
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
Helper for getting a const version of a pointer.
Define macros for attributes used to control the static checker.
Handle mappings between names and auxid_t.
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
SG::auxid_t getAuxID(const std::string &name, const std::string &clsname="", const Flags flags=Flags::None, const SG::auxid_t linkedVariable=SG::null_auxid)
Look up a name -> auxid_t mapping.
SG::auxid_t findAuxID(const std::string &name, const std::string &clsname="") const
Look up a name -> auxid_t mapping.
static bool isLinkedName(const std::string &name)
Test if a variable name corresponds to a linked variable.
static std::string linkedName(const std::string &name)
Given a variable name, return the name of the corresponding linked variable.
const std::type_info * getVecType(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
static bool classNameHasLink(const std::string &className)
Test to see if a class name corresponds to a class with a linked variable.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
const IAuxTypeVectorFactory * addFactory(const std::type_info &ti, const std::type_info &ti_alloc, std::unique_ptr< const IAuxTypeVectorFactory > factory)
Add a new type -> factory mapping.
std::unique_ptr< IAuxTypeVector > makeVector(SG::auxid_t auxid, size_t size, size_t capacity) const
Construct a new vector to hold an aux item.
Make an AuxVectorData object from either a raw array or an aux store.
Interface for factory objects that create vectors.
virtual const std::type_info * tiAlloc() const =0
Return the type_info of the vector allocator.
virtual void copy(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const =0
Copy elements between vectors.
A set of aux data identifiers.
ReadStats & stats()
Access the object belonging to the current thread.
static IOStats & instance()
Singleton object accessor.
void readBranch(const std::string &prefix, SG::auxid_t auxid)
Function incrementing the read counter on a specific branch.
int getEntry(int getall=0)
Read the values from the TTree entry that was loaded with TTree::LoadTree().
virtual ~TAuxStore()
Destructor.
virtual const std::type_info * getInputType(SG::auxid_t auxid) const override
Get the type of an input object, for getIOType().
virtual void reset() override
Tell the object that all branches will need to be re-read.
virtual bool hasEntryFor(SG::auxid_t auxid) const override
Check if a given variable is available from the input.
virtual bool hasOutput() const override
Check if an output is being written by the object.
void setSplitLevel(int value)
Set the split level of the output branches.
TAuxStore(std::string_view prefix="", bool topStore=true, EStructMode mode=EStructMode::kUndefinedStore, int basketSize=2048, int splitLevel=0)
Constructor.
virtual StatusCode setupInputData(SG::auxid_t auxid) override
Connect a variable to the input.
StatusCode readFrom(::TTree &tree, bool printWarnings=true)
Connect the object to an input TTree.
int splitLevel() const
Get the split level of the output branches.
virtual StatusCode setupOutputData(SG::auxid_t auxid) override
Connect a variable to the output.
virtual void setPrefix(std::string_view prefix) override
Set the object name prefix.
StatusCode writeTo(::TTree &tree)
Connect the object to an output TTree.
virtual StatusCode getEntryFor(SG::auxid_t auxid) override
Load a single variable from the input.
std::unique_ptr< impl > m_impl
Pointer to the internal object.
void setBasketSize(int value)
Set the size of the baskets created for the output branches.
int basketSize() const
Get the size of the baskets created for the output branches.
virtual const void * getInputObject(SG::auxid_t auxid) const override
Get a pointer to an input object, as it is in memory, for getIOData().
const std::string & prefix() const
Get the currently configured object name prefix.
bool isAuxIDSelected(SG::auxid_t auxid) const
Check if an auxiliary variable is selected for ouput writing.
virtual SG::auxid_set_t getSelectedAuxIDs() const override
Get the IDs of the selected aux variables.
AthContainers_detail::mutex mutex_t
Mutex type for multithread synchronization.
EStructMode
"Structural" modes of the object
@ kUndefinedStore
The structure mode is not defined.
@ kObjectStore
The object describes a single object.
@ kContainerStore
The object describes an entire container.
AuxStoreBase(bool topStore=true, EStructMode mode=EStructMode::kUndefinedStore)
Constructor.
Members m_data
Member variables of the base class.
AthContainers_detail::lock_guard< mutex_t > guard_t
Guard type for multithreaded synchronisation.
Error
The different types of error that can be flagged in the L1TopoRDO.
AuxVarFlags
Additional flags to qualify an auxiliary variable.
static const auxid_t null_auxid
To signal no aux data item.
SG::auxid_t auxid() const
Return the aux id for this variable.
virtual void reset() override
Free all allocated elements.
size_t auxid_t
Identifier for a particular aux data item.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
const std::type_info & getTypeInfo(EDataType type)
This function is used when reading a primitive branch from an input file without the user explicitly ...
std::string dynBranchPrefix(const std::string &key)
This function is used to figure out what to name dynamic auxiliary branches coming from a container c...
char rootType(char typeidType)
This function is used internally in the code when creating primitive dynamic auxiliary branches.
std::string getTypeName(const std::type_info &ti)
This function is necessary in order to create type names that ROOT can understand.
TClass * lookupVectorType(TClass &cl)
Internal function used by xAOD::TAuxStore and xAOD::RAuxStore.
bool isRegisteredType(SG::auxid_t auxid)
Check if the auxiliary variable has a registered type.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
int m_basketSize
The basket size for the output branches.
Members & m_data
Variables coming from AuxStoreBase.
StatusCode setupAuxBranch(::TBranch &br, std::string_view auxName, bool staticBranch)
Register one input branch as an available auxiliary variable.
std::vector< bool > m_branchesWritten
"Write status" of the different variables
std::vector< bool > m_missingBranches
Mark branches we've found to be missing.
StatusCode scanInputTree()
Scan the input TTree for auxiliary branches.
::TTree * m_inTree
The TTree being read from.
std::vector< std::unique_ptr< TBranchHandle > > m_branches
Branches reading the various auxiliary variables.
mutex_t m_mutex
Mutex object used for multithreaded synchronisation.
const std::type_info * auxBranchType(::TBranch &br, std::string_view auxName, bool staticBranch, std::string *expectedClassName=nullptr)
Find the type_info to use as the aux type for a given branch.
bool m_inputScanned
"Scan status" of the input TTree
::TTree * m_outTree
The TTree being written to.
int m_splitLevel
The split level for the output branches.
Struct collecting all member variables of this base class.