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;
671 std::string linkedAttr =
674 ::TBranch* lbr =
m_inTree->GetBranch(linkedBranch.c_str());
675 const std::type_info* lti =
nullptr;
681 *lti, linkedAttr,
"",
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},
"",
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;
838 return m_impl->m_basketSize;
844 m_impl->m_basketSize = value;
850 return m_impl->m_splitLevel;
856 m_impl->m_splitLevel = value;
872 m_impl->m_missingBranches.clear();
882 assert(
m_impl->m_inTree !=
nullptr);
883 TBranch* br =
m_impl->m_inTree->GetBranch(
m_data.m_prefix.data());
887 return StatusCode::SUCCESS;
892 if ((br->GetSplitLevel() != 1) &&
m_data.m_topStore && printWarnings) {
893 ::Warning(
"xAOD::TAuxStore::readFrom",
894 "Static branch (%s) with split level %i discovered",
895 m_data.m_prefix.data(), br->GetSplitLevel());
896 ::Warning(
"xAOD::TAuxStore::readFrom",
897 "The reading of complex variables from it may/will fail!");
901 return StatusCode::SUCCESS;
928 return StatusCode::SUCCESS;
943 if (
m_data.m_transientStore && (getall != 99)) {
945 m_data.m_auxIDs -=
m_data.m_transientStore->getAuxIDs();
946 m_data.m_decorIDs -=
m_data.m_transientStore->getDecorIDs();
948 m_data.m_transientStore.reset();
954 if (!
m_data.m_isDecoration[auxid]) {
957 m_data.m_auxIDs.erase(auxid);
958 m_data.m_decorIDs.erase(auxid);
969 for (
auto& branchHandle :
m_impl->m_branches) {
971 bytesRead += branchHandle->getEntry();
981 for (
auto& branchHandle :
m_impl->m_branches) {
983 branchHandle->reset();
986 m_impl->m_inputScanned =
false;
992 return ((
m_impl->m_branches.size() > auxid) &&
m_impl->m_branches[auxid]);
998 assert(
m_impl->m_branches.size() > auxid);
999 assert(
m_impl->m_branches[auxid]);
1000 const ::Int_t readBytes =
m_impl->m_branches[auxid]->getEntry();
1001 if (readBytes < 0) {
1002 ::Error(
"xAOD::TAuxStore::getEntryFor",
1005 return StatusCode::FAILURE;
1007 return StatusCode::SUCCESS;
1013 return (
m_impl->m_outTree !=
nullptr);
1031 if ((auxid < m_impl->m_missingBranches.size()) &&
1032 m_impl->m_missingBranches[auxid]) {
1033 return StatusCode::RECOVERABLE;
1037 if (
m_data.m_vecs.size() <= auxid) {
1038 m_data.m_vecs.resize(auxid + 1);
1040 if (
m_impl->m_branches.size() <= auxid) {
1041 m_impl->m_branches.resize(auxid + 1);
1045 if (
m_data.m_vecs[auxid] &&
m_impl->m_branches[auxid]) {
1046 return StatusCode::SUCCESS;
1050 if (
m_impl->m_inTree ==
nullptr) {
1051 ::Error(
"xAOD::TAuxStore::setupInputData",
1053 return StatusCode::FAILURE;
1057 if (
m_data.m_vecs[auxid] ||
m_impl->m_branches[auxid]) {
1058 ::Error(
"xAOD::TAuxStore::setupInputData",
1060 return StatusCode::FAILURE;
1067 const TString statBrName =
1068 std::format(
"{}{}",
m_data.m_prefix,
r.getName(auxid));
1069 const TString dynBrName =
1070 std::format(
"{}{}",
m_data.m_dynPrefix,
r.getName(auxid));
1073 Bool_t staticBranch =
true;
1074 TString brName = statBrName;
1076 TBranch* br =
m_impl->m_inTree->GetBranch(statBrName);
1078 br =
m_impl->m_inTree->GetBranch(dynBrName);
1082 if (
m_impl->m_missingBranches.size() <= auxid) {
1083 m_impl->m_missingBranches.resize(auxid + 1);
1085 m_impl->m_missingBranches[auxid] =
true;
1088 return StatusCode::RECOVERABLE;
1091 staticBranch =
false;
1096 const Bool_t primitiveBranch = isPrimitiveBranch(*br);
1098 const Bool_t containerBranch =
1099 (primitiveBranch ? false : isContainerBranch(*br, auxid));
1108 if ((containerBranch &&
1110 !
r.isLinked(auxid)) ||
1111 ((!containerBranch) &&
1113 ::Error(
"xAOD::TAuxStore::setupInputData",
1114 XAOD_MESSAGE(
"Branch type and requested structure mode "
1115 "differ for branch: %s"),
1117 return StatusCode::FAILURE;
1121 ::TClass* clDummy = 0;
1122 ::EDataType dType = kOther_t;
1123 if (br->GetExpectedType(clDummy, dType)) {
1124 ::Error(
"xAOD::TAuxStore::setupInputData",
1125 XAOD_MESSAGE(
"Couldn't determine the type of branch \"%s\""),
1127 return StatusCode::FAILURE;
1131 const std::type_info* brType = 0;
1134 brType = (containerBranch ?
r.getVecType(auxid) :
r.getType(auxid));
1140 ::Error(
"xAOD::TAuxStore::setupInputData",
1141 XAOD_MESSAGE(
"Can't read/copy variable %s (%s)"), brName.Data(),
1142 clDummy->GetName());
1143 return StatusCode::RECOVERABLE;
1148 ::TClass* brClass = 0;
1149 if (!primitiveBranch) {
1151 brClass = ::TClass::GetClass(*brType,
true,
true);
1153 brClass = ::TClass::GetClass(brTypeName);
1156 ::Error(
"xAOD::TAuxStore::setupInputData",
1157 XAOD_MESSAGE(
"No dictionary available for class \"%s\""),
1159 return StatusCode::FAILURE;
1165 m_data.m_vecs[auxid] =
r.makeVector(auxid, (
size_t)0, (
size_t)0);
1166 if (!containerBranch) {
1167 m_data.m_vecs[auxid]->resize(1);
1170 strncmp(clDummy->GetName(),
"SG::PackedContainer<", 20) == 0) {
1171 std::unique_ptr<SG::IAuxTypeVector> packed =
1172 m_data.m_vecs[auxid]->toPacked();
1176 ::Error(
"xAOD::TAuxStore::setupInputData",
1178 "variable %s (%i)"),
1179 brName.Data(),
static_cast<int>(auxid));
1180 return StatusCode::FAILURE;
1184 const std::type_info* objType = brType;
1185 if (containerBranch) {
1186 objType =
m_data.m_vecs[auxid]->objType();
1188 objType =
r.getType(auxid);
1190 m_impl->m_branches[auxid] = std::make_unique<TBranchHandle>(
1191 staticBranch, primitiveBranch, objType,
1192 (containerBranch ?
m_data.m_vecs[auxid]->toVector()
1193 :
m_data.m_vecs[auxid]->toPtr()),
1203 if (clDummy && ::TString(clDummy->GetName()).Contains(
"basic_string<char>")) {
1210 status =
m_impl->m_inTree->SetBranchAddress(
1211 brName,
m_impl->m_branches[auxid]->inputObjectPtr(),
1212 m_impl->m_branches[auxid]->branchPtr());
1214 status =
m_impl->m_inTree->SetBranchAddress(
1215 brName,
m_impl->m_branches[auxid]->inputObjectPtr(),
1216 m_impl->m_branches[auxid]->branchPtr(), brClass, dType,
1217 ((!staticBranch) && (!primitiveBranch)));
1220 ::Error(
"xAOD::TAuxStore::setupInputData",
1221 XAOD_MESSAGE(
"Coulnd't connect to branch \"%s\""), brName.Data());
1222 ::Error(
"xAOD::TAuxStore::setupInputData",
XAOD_MESSAGE(
"Return code: %i"),
1224 m_data.m_vecs[auxid].reset();
1225 m_impl->m_branches[auxid].reset();
1226 return StatusCode::FAILURE;
1230 m_impl->m_branches[auxid]->getEntry();
1233 m_data.m_auxIDs.insert(auxid);
1238 const std::string auxname =
r.getName(auxid);
1250 const std::string testname =
r.getName(i);
1252 if (testname != auxname) {
1257 ::Error(
"xAOD::TAuxStore::setupInputData",
1262 m_data.m_vecs[i].reset();
1263 m_impl->m_branches[i].reset();
1264 m_data.m_auxIDs.erase(i);
1274 return StatusCode::SUCCESS;
1291 if (!
m_impl->m_outTree) {
1292 return StatusCode::SUCCESS;
1297 return StatusCode::SUCCESS;
1301 if (
m_data.m_vecs.size() <= auxid) {
1302 m_data.m_vecs.resize(auxid + 1);
1304 if (
m_impl->m_branches.size() <= auxid) {
1305 m_impl->m_branches.resize(auxid + 1);
1307 if (
m_impl->m_branchesWritten.size() <= auxid) {
1308 m_impl->m_branchesWritten.resize(auxid + 1);
1312 if (
m_impl->m_branchesWritten[auxid]) {
1313 return StatusCode::SUCCESS;
1321 if ((!
m_data.m_vecs[auxid]) &&
m_data.m_transientStore &&
1322 (
m_data.m_transientStore->getAuxIDs().test(auxid))) {
1325 const void* pptr =
m_data.m_transientStore->getData(auxid);
1327 ::Fatal(
"xAOD::TAuxStore::setupOutputData",
1329 return StatusCode::FAILURE;
1334 void* ptr =
m_data.m_vecs[auxid]->toPtr();
1336 ::Error(
"xAOD::TAuxStore::setupOutputData",
1339 return StatusCode::FAILURE;
1343 const std::type_info*
type = reg.getType(auxid);
1345 ::Error(
"xAOD::TAuxStore::setupOutputData",
1348 static_cast<int>(auxid));
1349 return StatusCode::FAILURE;
1354 ::Error(
"xAOD::TAuxStore::setupOutputData",
1355 XAOD_MESSAGE(
"No factory found for transient variable "
1357 static_cast<int>(auxid));
1358 return StatusCode::FAILURE;
1362 if (
m_data.m_isDecoration.size() <= auxid) {
1363 m_data.m_isDecoration.resize(auxid + 1);
1365 m_data.m_isDecoration[auxid] =
true;
1375 if ((
m_data.m_auxIDs.test(auxid)) && (!
m_data.m_vecs[auxid]) &&
1376 (!
m_impl->m_branches[auxid])) {
1383 ::Error(
"xAOD::TAuxStore::setupOutputData",
1384 XAOD_MESSAGE(
"Structure mode unknown for variable %s"),
1386 return StatusCode::FAILURE;
1390 if (!
m_data.m_vecs[auxid]) {
1394 m_data.m_vecs[auxid]->resize(1);
1399 if (!
m_impl->m_branches[auxid]) {
1401 const std::type_info* brType =
1406 bool primitiveBranch = (strlen(brType->name()) == 1);
1407 m_impl->m_branches[auxid] = std::make_unique<TBranchHandle>(
1408 false, (strlen(brType->name()) == 1),
1409 (primitiveBranch ? brType :
m_data.m_vecs[auxid]->objType()),
1411 ?
m_data.m_vecs[auxid]->toPtr()
1412 :
m_data.m_vecs[auxid]->toVector()),
1417 const TString brName =
1418 std::format(
"{}{}",
m_data.m_dynPrefix,
1423 ::TBranch* br =
m_impl->m_outTree->GetBranch(brName);
1428 br->SetAddress(
m_impl->m_branches[auxid]->outputObjectPtr());
1432 m_impl->m_branchesWritten[auxid] =
true;
1434 return StatusCode::SUCCESS;
1438 const std::type_info* brType =
m_impl->m_branches[auxid]->typeInfo();
1440 ::Error(
"xAOD::TAuxStore::setupOutputData",
1443 return StatusCode::FAILURE;
1448 const Bool_t primitiveBranch = (strlen(brType->name()) == 1);
1451 if (primitiveBranch) {
1455 if (rootType ==
'\0') {
1456 ::Error(
"xAOD::TAuxStore::setupOutputData",
1459 brName.Data(), brTypeName.c_str());
1460 return StatusCode::FAILURE;
1464 std::ostringstream typeDesc;
1465 typeDesc << brName <<
"/" << rootType;
1468 br =
m_impl->m_outTree->Branch(
1469 brName,
m_impl->m_branches[auxid]->outputObjectPtr(),
1470 typeDesc.str().c_str(),
m_impl->m_basketSize);
1475 TClass* cl = TClass::GetClass(*brType);
1477 cl = TClass::GetClass(brTypeName.c_str());
1480 ::Error(
"xAOD::TAuxStore::setupOutputData",
1482 brTypeName.c_str());
1483 return StatusCode::FAILURE;
1485 if (!cl->GetStreamerInfo()) {
1486 ::Error(
"xAOD::TAuxStore::setupOutputData",
1487 XAOD_MESSAGE(
"No streamer info available for type %s"),
1489 return StatusCode::FAILURE;
1493 br =
m_impl->m_outTree->Branch(brName, cl->GetName(),
1494 m_impl->m_branches[auxid]->outputObjectPtr(),
1500 ::Error(
"xAOD::TAuxStore::setupOutputData",
1503 brName.Data(), brTypeName.c_str());
1504 return StatusCode::FAILURE;
1509 for (Long64_t i = 0; i <
m_impl->m_outTree->GetEntries(); ++i) {
1514 m_impl->m_branchesWritten[auxid] =
true;
1517 m_data.m_auxIDs.insert(auxid);
1520 return StatusCode::SUCCESS;
1526 assert(
m_impl->m_branches.size() > auxid);
1527 assert(
m_impl->m_branches[auxid]);
1528 return m_impl->m_branches[auxid]->objectPtr();
1534 assert(
m_impl->m_branches.size() > auxid);
1535 assert(
m_impl->m_branches[auxid]);
1536 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.
constexpr std::enable_if_t< is_bitmask_v< E >, E & > reset(E &lhs, E rhs)
Convenience function to clear bits in a class enum bitmask.
Error
The different types of error that can be flagged in the L1TopoRDO.
AuxVarFlags
Additional flags to qualify an auxiliary variable.
@ Linked
Mark that this variable is linked to another one.
static const auxid_t null_auxid
To signal no aux data item.
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.