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)
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");
157 std::vector<int>
result(N);
158 for (UInt_t i = 0; i < N; ++i) {
159 void *element = (*m_collectionProxy)[i];
160 m_methodCall.call()->Execute(element, retLong);
161 result[i] = (int) retLong;
173 std::vector<double>
result(N);
174 for (UInt_t i = 0; i < N; ++i) {
175 void *element = (*m_collectionProxy)[i];
176 m_methodCall.call()->Execute(element, retDouble);
177 result[i] = (double) 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+
"'");
221 const AUX*
data,
bool isVector)
const
226 const std::type_info *ti =
r.getType(auxid);
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") ) {
271 accWrap = std::make_unique<TMethodWrapper>(
typeid(*
m_auxElement) , varname );
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());
291 return m_accessorCache.at(varname)->getIntValue(
m_auxElement);
296 return m_accessorCache.at(varname)->getDoubleValue(
m_auxElement);
301 throw std::runtime_error(
"xAODElementProxyLoader can't load vector types");
306 throw std::runtime_error(
"xAODElementProxyLoader can't load vector types");
324 auto accWrap = std::make_unique<TMethodCollectionWrapper>(
typeid(*
m_auxVectorData), varname);
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");
383 return m_accessorCache.at(varname)->getVecDoubleValue(
m_auxVectorData);
char data[hepevt_bytes_allocation_ATLAS]
#define TYPE(CODE, TYP, IOTYP)
Define macros for attributes used to control the static checker.
RootUtils::TSMethodCall m_methodCall ATLAS_THREAD_SAFE
virtual bool isValid(const SG::AuxElement *auxElement) const
virtual int getIntValue(const SG::AuxElement *auxElement) const
virtual ~TMethodCollectionWrapper()
virtual std::vector< int > getVecIntValue(const SG::AuxVectorData *auxVectorData)
virtual double getDoubleValue(const SG::AuxElement *auxElement) const
TVirtualCollectionProxy * m_collectionProxy
TMethodCollectionWrapper(const std::type_info &containerTypeinfo, const std::string &methodName)
IProxyLoader::VariableType variableType()
virtual std::vector< double > getVecDoubleValue(const SG::AuxVectorData *auxVectorData)
virtual std::vector< int > getVecIntValue(const SG::AuxVectorData *auxVectorData)
TMethodWrapper(const std::type_info &elementTypeinfo, const std::string &methodName)
virtual std::vector< double > getVecDoubleValue(const SG::AuxVectorData *auxVectorData)
RootUtils::TSMethodCall m_methodCall ATLAS_THREAD_SAFE
virtual ~TMethodWrapper()
virtual bool isValid(const SG::AuxElement *auxElement) const
virtual double getDoubleValue(const SG::AuxElement *auxElement) const
IProxyLoader::VariableType variableType()
virtual int getIntValue(const SG::AuxElement *auxElement) const
void setData(const SG::AuxElement *auxElement)
virtual double loadDoubleVariableFromString(const std::string &varname) const
virtual std::vector< double > loadVecDoubleVariableFromString(const std::string &varname) const
virtual int loadIntVariableFromString(const std::string &varname) const
xAODElementProxyLoader()=default
virtual std::vector< int > loadVecIntVariableFromString(const std::string &varname) const
virtual IProxyLoader::VariableType variableTypeFromString(const std::string &varname) const
const SG::AuxElement * m_auxElement
virtual ~xAODProxyLoader()
bool try_type(const std::string &varname, const std::type_info *ti, const AUX *data) const
IProxyLoader::VariableType try_all_known_types(const std::string &varname, const AUX *data, bool isVector) const
CxxUtils::ConcurrentStrMap< BaseAccessorWrapper *, CxxUtils::SimpleUpdater > accessorCache_t
virtual std::vector< int > loadVecIntVariableFromString(const std::string &varname) const
virtual IProxyLoader::VariableType variableTypeFromString(const std::string &varname) const
virtual int loadIntVariableFromString(const std::string &varname) const
xAODVectorProxyLoader()=default
virtual double loadDoubleVariableFromString(const std::string &varname) const
void setData(const SG::AuxVectorData *auxElement)
virtual std::vector< double > loadVecDoubleVariableFromString(const std::string &varname) const
const SG::AuxVectorData * m_auxVectorData
Base class for elements of a container that can have aux data.
Handle mappings between names and auxid_t.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Manage lookup of vectors of auxiliary data.
Namespace holding all the expression evaluation code.
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...
static const auxid_t null_auxid
To signal no aux data item.
size_t auxid_t
Identifier for a particular aux data item.
Convert a type_info to a normalized string representation (matching the names used in the root dictio...