|
ATLAS Offline Software
|
Go to the documentation of this file.
16 const std::string &methodName)
19 TClass *
cls = TClass::GetClass(elementTypeinfo);
25 m_methodCall.setProto (
cls, methodName,
"");
27 m_valid = m_methodCall.call() !=
nullptr;
36 TMethodCall*
mc = m_methodCall.call();
38 switch (
mc->ReturnType()) {
39 case TMethodCall::kLong:
41 case TMethodCall::kDouble:
43 case TMethodCall::kString:
44 case TMethodCall::kOther:
45 case TMethodCall::kNone:
64 m_methodCall.call()->Execute(aux_nc, retLong);
72 m_methodCall.call()->Execute(aux_nc, retDouble);
78 throw std::runtime_error(
"TMethodWrapper doesn't deal with containers");
83 throw std::runtime_error(
"TMethodWrapper doesn't deal with containers");
90 const std::string &methodName)
91 : m_collectionProxy(nullptr),
94 TClass *containerClass = TClass::GetClass(containerTypeinfo);
95 if (!containerClass) {
97 if (!containerClass)
return;
104 if (!elementClass)
return;
106 m_methodCall.setProto (elementClass, methodName,
"");
108 m_valid = m_methodCall.call() !=
nullptr;
117 TMethodCall*
mc = m_methodCall.call();
119 switch (
mc->ReturnType()) {
120 case TMethodCall::kLong:
122 case TMethodCall::kDouble:
124 case TMethodCall::kString:
125 case TMethodCall::kOther:
126 case TMethodCall::kNone:
143 throw std::runtime_error(
"TMethodCollectionWrapper doesn't deal with scalars");
148 throw std::runtime_error(
"TMethodCollectionWrapper doesn't deal with scalars");
158 for (UInt_t
i = 0;
i <
N; ++
i) {
159 void *element = (*m_collectionProxy)[
i];
160 m_methodCall.call()->Execute(element, retLong);
174 for (UInt_t
i = 0;
i <
N; ++
i) {
175 void *element = (*m_collectionProxy)[
i];
176 m_methodCall.call()->Execute(element, retDouble);
198 for (
auto x : m_accessorCache)
delete x.second;
202 template <
class TYPE,
class AUX>
205 if (*ti ==
typeid(
TYPE)) {
206 auto accWrap = std::make_unique<AccessorWrapper<TYPE>>(
varname);
207 if (accWrap && accWrap->isValid(
data)) {
208 m_accessorCache.insert_or_assign(
varname, accWrap.release());
210 }
else if (accWrap) {
213 throw std::runtime_error(
"Unsupported aux element type '"+
r.getTypeName(auxid)+
"' for '"+
varname+
"'");
225 if (auxid != SG::null_auxid) {
226 const std::type_info *ti =
r.getType(auxid);
250 : m_auxElement(auxElement)
263 const std::type_info &containerTypeinfo =
typeid(*container);
264 TClass *containerClass = TClass::GetClass(containerTypeinfo);
265 if (!containerClass) {
268 if (containerClass) {
269 std::unique_ptr<TMethodWrapper> accWrap;
270 if( !strcmp(containerClass->GetName(),
"SG::AuxElementStandaloneData") ) {
273 TVirtualCollectionProxy* collProxy = containerClass->GetCollectionProxy();
275 const std::type_info &elementTypeinfo = *(collProxy->GetValueClass()->GetTypeInfo());
276 accWrap = std::make_unique<TMethodWrapper>(elementTypeinfo,
varname);
281 m_accessorCache.insert_or_assign(
varname, accWrap.release());
301 throw std::runtime_error(
"xAODElementProxyLoader can't load vector types");
306 throw std::runtime_error(
"xAODElementProxyLoader can't load vector types");
313 : m_auxVectorData(auxVectorData)
327 m_accessorCache.insert_or_assign(
varname, accWrap.release());
348 throw std::runtime_error(
"xAODVectorProxyLoader can't load scalar types");
353 throw std::runtime_error(
"xAODVectorProxyLoader can't load scalar types");
virtual ~TMethodCollectionWrapper()
char data[hepevt_bytes_allocation_ATLAS]
virtual double getDoubleValue(const SG::AuxElement *auxElement) const
virtual std::vector< int > loadVecIntVariableFromString(const std::string &varname) const
static AuxTypeRegistry & instance()
Return the singleton registry instance.
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
RootUtils::TSMethodCall m_methodCall ATLAS_THREAD_SAFE
Base class for elements of a container that can have aux data.
TMethodCollectionWrapper(const std::type_info &containerTypeinfo, const std::string &methodName)
bool try_type(const std::string &varname, const std::type_info *ti, const AUX *data) const
IProxyLoader::VariableType variableType()
virtual std::vector< int > getVecIntValue(const SG::AuxVectorData *auxVectorData)
virtual std::vector< double > getVecDoubleValue(const SG::AuxVectorData *auxVectorData)
virtual IProxyLoader::VariableType variableTypeFromString(const std::string &varname) const
void setData(const SG::AuxElement *auxElement)
const SG::AuxVectorData * m_auxVectorData
IProxyLoader::VariableType variableType()
virtual bool isValid(const SG::AuxElement *auxElement) const
xAODVectorProxyLoader()=default
virtual std::vector< double > getVecDoubleValue(const SG::AuxVectorData *auxVectorData)
RootUtils::TSMethodCall m_methodCall ATLAS_THREAD_SAFE
Handle mappings between names and auxid_t.
size_t auxid_t
Identifier for a particular aux data item.
virtual bool isValid(const SG::AuxElement *auxElement) const
const SG::AuxElement * m_auxElement
virtual ~TMethodWrapper()
IProxyLoader::VariableType try_all_known_types(const std::string &varname, const AUX *data, bool isVector) const
virtual std::vector< int > loadVecIntVariableFromString(const std::string &varname) const
Namespace holding all the expression evaluation code.
virtual double loadDoubleVariableFromString(const std::string &varname) const
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
virtual int loadIntVariableFromString(const std::string &varname) const
virtual int loadIntVariableFromString(const std::string &varname) const
#define TYPE(CODE, TYP, IOTYP)
CxxUtils::ConcurrentStrMap< BaseAccessorWrapper *, CxxUtils::SimpleUpdater > accessorCache_t
TVirtualCollectionProxy * m_collectionProxy
xAODElementProxyLoader()=default
virtual std::vector< int > getVecIntValue(const SG::AuxVectorData *auxVectorData)
virtual double loadDoubleVariableFromString(const std::string &varname) const
virtual std::vector< double > loadVecDoubleVariableFromString(const std::string &varname) const
virtual int getIntValue(const SG::AuxElement *auxElement) const
void setData(const SG::AuxVectorData *auxElement)
virtual IProxyLoader::VariableType variableTypeFromString(const std::string &varname) const
virtual double getDoubleValue(const SG::AuxElement *auxElement) const
Manage lookup of vectors of auxiliary data.
const SG::AuxVectorData * container() const
Return the container holding this element.
Define macros for attributes used to control the static checker.
virtual std::vector< double > loadVecDoubleVariableFromString(const std::string &varname) const
TMethodWrapper(const std::type_info &elementTypeinfo, const std::string &methodName)
virtual ~xAODProxyLoader()
virtual int getIntValue(const SG::AuxElement *auxElement) const
virtual size_t size_v() const =0
Return the size of the container.