ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
xAODRootAccess
Root
IOUtils.cxx
Go to the documentation of this file.
1
// Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3
// Local include(s).
4
#include "
IOUtils.h
"
5
6
// Framework include(s).
7
#include "
AthContainers/AuxElement.h
"
8
#include "
AthContainers/AuxVectorBase.h
"
9
#include "
AthContainers/DataVector.h
"
10
#include "
AthContainersInterfaces/IAuxElement.h
"
11
#include "
AthContainersInterfaces/IAuxStoreHolder.h
"
12
#include "
AthContainersInterfaces/IConstAuxStore.h
"
13
14
// System include(s).
15
#include <stdexcept>
16
17
namespace
{
18
21
class
ForceTrackIndices :
public
SG::AuxVectorBase
{
22
public
:
23
using
SG::AuxVectorBase::initAuxVectorBase
;
24
};
// class ForceTrackIndices
25
26
}
// anonymous namespace
27
28
namespace
xAOD::Details
{
29
30
void
forceTrackIndices
NO_SANITIZE_UNDEFINED
(
SG::AuxVectorBase
&
vec
) {
31
32
// Treat the received object like it would be of type @c ForceTrackIndices
33
ForceTrackIndices& xvec =
static_cast<
ForceTrackIndices&
>
(
vec
);
34
35
// Which would allow us to call a protected function on it.
36
xvec.initAuxVectorBase<
DataVector<SG::IAuxElement>
>(
37
SG::OWN_ELEMENTS
,
SG::ALWAYS_TRACK_INDICES
);
38
}
39
40
bool
hasAuxStore
(
const
TClass& cl) {
41
42
// The classes whose children can have an auxiliary store attached
43
// to them.
44
static
const
TClass*
const
dvClass =
45
::TClass::GetClass(
typeid
(
SG::AuxVectorBase
));
46
static
const
TClass*
const
aeClass =
47
::TClass::GetClass(
typeid
(
SG::AuxElement
));
48
49
// Do the check.
50
return
(cl.InheritsFrom(dvClass) || cl.InheritsFrom(aeClass));
51
}
52
53
bool
isAuxStore
(
const
TClass& cl) {
54
55
// The classes whose children are considered auxiliary stores.
56
static
const
TClass*
const
storeClass =
57
::TClass::GetClass(
typeid
(SG::IConstAuxStore));
58
static
const
TClass*
const
storeHolderClass =
59
::TClass::GetClass(
typeid
(
SG::IAuxStoreHolder
));
60
61
// Do the check.
62
return
(cl.InheritsFrom(storeClass) || cl.InheritsFrom(storeHolderClass));
63
}
64
65
bool
isStandalone
(
const
TClass& cl) {
66
67
// The classes whose children can have an auxiliary store attached
68
// to them:
69
static
const
TClass*
const
dvClass =
70
TClass::GetClass(
typeid
(
SG::AuxVectorBase
));
71
static
const
TClass*
const
aeClass = TClass::GetClass(
typeid
(
SG::AuxElement
));
72
73
// Do the check:
74
if
(cl.InheritsFrom(aeClass)) {
75
return
kTRUE;
76
}
else
if
(cl.InheritsFrom(dvClass)) {
77
return
kFALSE;
78
}
79
80
// Some logic error happened.
81
throw
std::runtime_error(
"A logic error happened in the code"
);
82
}
83
84
}
// namespace xAOD::Details
AuxElement.h
Base class for elements of a container that can have aux data.
AuxVectorBase.h
Manage index tracking and synchronization of auxiliary data.
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
IAuxElement.h
Flag that a class may have auxiliary data associated with it.
IAuxStoreHolder.h
IConstAuxStore.h
Interface for const operations on an auxiliary store.
IOUtils.h
DataVector
Derived DataVector<T>.
Definition
DataVector.h:795
SG::AuxVectorBase
Manage index tracking and synchronization of auxiliary data.
Definition
AuxVectorBase.h:98
SG::AuxVectorBase::initAuxVectorBase
void initAuxVectorBase(SG::OwnershipPolicy ownPolicy, SG::IndexTrackingPolicy indexTrackingPolicy)
Initialize index tracking mode.
SG::IAuxStoreHolder
Interface for objects taking part in direct ROOT I/O.
Definition
IAuxStoreHolder.h:38
SG::AuxElement
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.
SG::ALWAYS_TRACK_INDICES
@ ALWAYS_TRACK_INDICES
Always track indices, regardless of the setting of the ownership policy.
Definition
IndexTrackingPolicy.h:43
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition
OwnershipPolicy.h:17
xAOD::Details
Definition
IObjectManager.cxx:6
xAOD::Details::hasAuxStore
bool hasAuxStore(const TClass &cl)
Helper function deciding if a given type "has an auxiliary store".
Definition
IOUtils.cxx:40
xAOD::Details::isAuxStore
bool isAuxStore(const TClass &cl)
Helper function deciding if a given type "is an auxiliary store".
Definition
IOUtils.cxx:53
xAOD::Details::isStandalone
bool isStandalone(const TClass &cl)
Helper function deciding if a given type "is a standalone object".
Definition
IOUtils.cxx:65
NO_SANITIZE_UNDEFINED
#define NO_SANITIZE_UNDEFINED
Definition
no_sanitize_undefined.h:28
Generated on
for ATLAS Offline Software by
1.17.0