ATLAS Offline Software
SGxAODProxyLoader.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // SGxAODProxyLoader.cxx, (c) ATLAS Detector software
8 // Author: Thomas Gillam (thomas.gillam@cern.ch)
9 // ExpressionParsing library
11 // for debugging : #define DEBUG_VARIABLE_LOADING
12 
17 #include "AthenaKernel/BaseInfo.h"
19 #include "GaudiKernel/ThreadLocalContext.h"
20 
21 
22 #include "Utils.h"
23 #include "DebugUtils.h"
24 #include "BaseAccessor.h"
25 #include "xAODAccessor.h"
26 #include "MethodAccessor.h"
27 #include "PlainAccessor.h"
28 
29 namespace {
30  void popRenounced(const std::vector<std::string> &renounce,
31  std::vector<Gaudi::DataHandle *> &new_input_handles) {
32  for (const std::string &a_key : renounce) {
33  if (new_input_handles.back()->objKey() == a_key ) {
34  new_input_handles.pop_back();
35  break;
36  }
37  }
38  }
39 }
40 
41 namespace ExpressionParsing {
42  SGxAODProxyLoader::SGxAODProxyLoader(StoreGateSvc_t &evtStore, bool verbose) : m_evtStore(evtStore), m_emptyVectorAccessor(std::make_unique<EmptyVectorAccessor>()),m_verbose(verbose) { }
43 
45  {
46  }
47 
49  m_decorKeys.clear();
50  m_readKeys.clear();
51  m_accessor.clear();
52  }
53 
54  void SGxAODProxyLoader::splitVarnameIntoContainerAndMethod(const std::string &varname, std::string &containerName, std::string &methodName) const
55  {
56  size_t dotPosition = varname.find('.');
57  containerName = varname.substr(0, dotPosition);
58  methodName = varname.substr(dotPosition + 1);
59  }
60 
61  std::pair<RootUtils::TSMethodCall, TVirtualCollectionProxy *>
62  SGxAODProxyLoader::getMethodCallAccessor(const std::string &method_name, const std::type_info &info) const {
63  if (m_verbose) {
64  std::cout << "DEBUG SGxAODProxyLoader search for " << method_name << " in type " << info.name() << std::endl;
65  }
66  TClass *containerClass = TClass::GetClass(info);
67  if (!containerClass) {
68  if (m_verbose) {
69  std::cout << "DEBUG SGxAODProxyLoader search for " << method_name << " in normalisze type " << SG::normalizedTypeinfoName(info) << std::endl;
70  }
71  containerClass = TClass::GetClass(SG::normalizedTypeinfoName(info).c_str());
72  if (!containerClass) {
73  std::stringstream msg;
74  msg << "No dictionary for " << info.name() << std::endl;
75  throw std::runtime_error(msg.str());
76  }
77  }
78  TClass *elementClass=nullptr;
79  TVirtualCollectionProxy *collection_proxy=nullptr;
80  if( strcmp(containerClass->GetName(),"SG::AuxElementStandaloneData")==0 ) {
81  elementClass=containerClass;
82  }
83  else {
84  collection_proxy = containerClass->GetCollectionProxy();
85  elementClass = (collection_proxy ? collection_proxy->GetValueClass() : nullptr);
86  if (!elementClass) {
87  std::stringstream msg;
88  msg << "No collection proxy or element class for " << info.name() << std::endl;
89  throw std::runtime_error(msg.str());
90  }
91  }
92  RootUtils::TSMethodCall method_call;
93  method_call.setProto (elementClass, method_name, "",
94  ROOT::kConversionMatch);
95  if (!method_call.call() || !method_call.call()->IsValid()) {
96  std::stringstream msg;
97  msg << "No valid method " << method_name << " for " << info.name() << std::endl;
98  throw std::runtime_error(msg.str());
99  }
100  if (m_verbose && method_call.call()->GetMethod()) {
101  // @TODO check signature "() const
102  std::cout << "DEBUG SGxAODProxyLoader got method " << " . " << method_name << " : "
103  << method_call.call()->GetMethod()->GetReturnTypeNormalizedName ()
104  << " proto=" << method_call.call()->GetProto()
105  << " signature=" << method_call.call()->GetMethod()->GetSignature ()
106  << " proto=" << method_call.call()->GetMethod()->GetPrototype()
107  << std::endl;
108  }
109  return std::make_pair( method_call, collection_proxy);
110  }
111 
112 
113  template <class T_Aux>
114  std::unique_ptr<IAccessor> SGxAODProxyLoader::createAccessor(const EventContext& ctx,
116  const SG::ReadDecorHandleKey<T_Aux> *decor_key,
117  SG::auxid_t method_id,
118  const std::string &method_name) const
119  {
120  SG::ReadHandle<T_Aux> handle(key, ctx);
121  if (!handle.isValid()) {
122  std::stringstream msg;
123  msg << "Failed to get " << key.key();
124  throw std::runtime_error(msg.str());
125  }
126  if (getContainerSize(*handle)==0) {
127  return std::unique_ptr<IAccessor>();
128  }
129  if (!isAvailable(*handle,method_id)) {
130  std::pair<RootUtils::TSMethodCall,TVirtualCollectionProxy *> method = getMethodCallAccessor(method_name, typeid(*handle));
131  return MethodAccessorFactory::instance().create( key, std::move(method.first), method.second);
132  }
133  else {
134  return ExpressionParsing::AccessorFactory::instance().create( key, method_id , decor_key );
135  }
136  }
137 
139  std::unordered_map<std::string, CxxUtils::CachedUniquePtrT<IAccessor> >::const_iterator accessor_iter,
140  const std::string &varname) const
141  {
142  const IProxyDict *proxy = Atlas::getExtendedEventContext( ctx ).proxy();
143  (void) proxy;
144  std::string container_name;
145  std::string method_name;
146  splitVarnameIntoContainerAndMethod(varname,container_name, method_name);
147  ReadHandleMap::const_iterator key_iter = m_readKeys.find(container_name);
148  if (key_iter == m_readKeys.end()) {
149  std::stringstream msg;
150  msg << "No read handle key for " << container_name;
151  throw std::runtime_error(msg.str());
152  }
153  SG::auxid_t method_id = SG::null_auxid;
154  ReadDecorHandleMap::const_iterator decor_key_iter = m_decorKeys.end();
155  if (ReadHandleMap::isVector(key_iter->second) || ReadHandleMap::isElement(key_iter->second)) {
156  method_id = SG::AuxTypeRegistry::instance().findAuxID(method_name,"");
157  if (method_id != SG::null_auxid) {
158  decor_key_iter=m_decorKeys.find(varname);
159  }
160  }
161  std::unique_ptr<IAccessor> accessor;
162  if (ReadHandleMap::isVector(key_iter->second)) {
163  if (m_verbose) { std::cout << "DEBUG SGxAODProxyLoader::computeClassForVarname is Vector: " << varname << std::endl; }
164  accessor = createAccessor(ctx,
165  ReadHandleMap::vectorKey(key_iter->second),
166  (decor_key_iter != m_decorKeys.end() ? &ReadDecorHandleMap::vectorKey(decor_key_iter->second) : nullptr),
167  method_id,
168  method_name);
169  }
170  else if (ReadHandleMap::isElement(key_iter->second)) {
171  if (m_verbose) { std::cout << "DEBUG SGxAODProxyLoader::computeClassForVarname is element: " << varname << std::endl; }
172  accessor = createAccessor(ctx,
173  ReadHandleMap::elementKey(key_iter->second),
174  (decor_key_iter != m_decorKeys.end() ? &ReadDecorHandleMap::elementKey(decor_key_iter->second) : nullptr),
175  method_id,
176  method_name);
177  }
178  else {
179  if (m_verbose) { std::cout << "DEBUG SGxAODProxyLoader::computeClassForVarname try to create plain type accessor for " << varname << std::endl; }
181  }
182  if (!accessor) {
183  return *m_emptyVectorAccessor;
184  }
185  IAccessor* accessorPlainPtr = accessor.get();//avoid Wpotentially-evaluated-expression from typeid
186  if (m_verbose) {
187  std::cout << "DEBUG SGxAODProxyLoader use accessor "
188  << typeid(*accessorPlainPtr).name() << " for " << varname
189  << std::endl;
190  }
191  accessor_iter->second.set(std::move(accessor));
192  return *(accessor_iter->second);
193  }
194 
196  const EventContext& ctx = Gaudi::Hive::currentContext();
197  return getAccessor(ctx, varname).variableType();
198  }
199 
200  namespace {
201  template <typename T>
202  std::ostream &operator<<(std::ostream &out, const std::vector<T> &vec) {
203  for (auto elm : vec) {
204  std::cout << " " << elm;
205  }
206  return out;
207  }
208  template<class T>
209  T dump(const std::string &varname, T val) {
210  (void) varname;
211 #ifdef DEBUG_VARIABLE_LOADING
212  std::cout << "DEBUG SGxAODProxyLoader::dump " << varname << val << std::endl;
213 #endif
214  return val;
215  }
216  }
217 
219  {
220  const EventContext& ctx = Gaudi::Hive::currentContext();
221  return dump(varname,getAccessor(ctx, varname).loadInt(ctx));
222  }
223 
225  {
226  const EventContext& ctx = Gaudi::Hive::currentContext();
227  return dump(varname,getAccessor(ctx, varname).loadDouble(ctx));
228  }
229 
230  std::vector<int> SGxAODProxyLoader::loadVecIntVariableFromString(const std::string &varname) const
231  {
232  const EventContext& ctx = Gaudi::Hive::currentContext();
233  return dump(varname,getAccessor(ctx, varname).loadVecInt(ctx));
234  }
235 
236  std::vector<double> SGxAODProxyLoader::loadVecDoubleVariableFromString(const std::string &varname) const
237  {
238  const EventContext& ctx = Gaudi::Hive::currentContext();
239  return dump(varname,getAccessor(ctx, varname).loadVec(ctx));
240  }
241 
243  const std::vector<std::string> &var_names,
244  const std::vector<std::string> &renounce,
245  const std::vector<const DataObjID *> &input_data_in,
246  const std::vector<const DataObjID *> &output_data_in,
247  std::vector<Gaudi::DataHandle *> &new_input_handles,
248  std::vector<Gaudi::DataHandle *> &new_output_handles)
249  {
250  (void) new_output_handles;
251  std::size_t initial_size=m_decorKeys.size()+m_readKeys.size();
252  for (const std::string &var_name : var_names) {
253  if ( m_decorKeys.find(var_name)!= m_decorKeys.end()) continue;
254  std::string container_name;
255  std::string method_name;
256  splitVarnameIntoContainerAndMethod(var_name,container_name, method_name);
257  if (m_verbose) {
258  std::cout << "DEBUG SGxAODProxyLoader::updateDataDependencies var " << var_name << " -> " << container_name << " . " << method_name
259  << " i:" << input_data_in.size() << " o:" << output_data_in.size()
260  << std::endl;
261  }
262  const DataObjID *container_data_id=nullptr;
263  const DataObjID *method_data_id=nullptr;
264  bool verbose = m_verbose;
265 
266  // Decide whether a variable just needs a container read handle key or a read decor handle key.
267  // Search in data handles for data handles and decor handles:
268  // decor handle : "container_name.decoration_name"
269  // data handle : "container_name"
270  // if a decor handle is found assume that it is a decoration, otherwise assume that it is either a default aux item
271  // or refers to a method call
272  auto set_ids = [&method_data_id,&container_data_id,&var_name,&container_name,verbose](const DataObjID *obj_data_id) -> bool {
273  std::string_view handle_key(obj_data_id->key());
274  std::string::size_type pos=obj_data_id->key().find('+');
275  pos = (pos==std::string::npos ? 0 : pos+1);
276  handle_key=handle_key.substr(pos,handle_key.size()-pos);
277  if (verbose && (handle_key == container_name || handle_key == var_name)) {
278  const SG::BaseInfoBase* base_info = SG::BaseInfoBase::find (obj_data_id->clid());
279  std::cout << "DEBUG SGxAODProxyLoader::updateDataDependencies " << handle_key << " matches " << var_name << " ? "
280  << (handle_key == var_name ? " method " : "")
281  << (handle_key == container_name ? " container " : "")
282  << "-> " << (base_info ? base_info->typeinfo().name() : "")
283  << std::endl;
284  }
285  if (handle_key == var_name) {
286  method_data_id = obj_data_id;
287  if (container_data_id) return true;
288  }
289  else if (handle_key == container_name ) {
290  container_data_id = obj_data_id;
291  if (method_data_id) return true;
292  }
293  return false;
294  };
295  // start with output handles which are expected to contain the decorator handles
296  for( std::vector<const DataObjID *>::const_iterator elm_iter = output_data_in.begin(); elm_iter != output_data_in.end() && !set_ids(*elm_iter); ++elm_iter) {}
297  if (!method_data_id) {
298  for( std::vector<const DataObjID *>::const_iterator elm_iter = input_data_in.begin(); elm_iter != input_data_in.end() && !set_ids(*elm_iter); ++elm_iter) {}
299  }
300  if (method_data_id) {
301  if (!container_data_id) {
302  container_data_id=method_data_id;
303  }
304  }
305  // ---DEBUG
306  if (m_verbose && method_data_id && method_data_id != container_data_id) {
307  std::cout << "DEBUG SGxAODProxyLoader method_clid " << method_data_id->clid() << std::endl;
308  }
309  if (m_verbose && container_data_id) {
310  std::cout << "DEBUG SGxAODProxyLoader container_clid " << container_data_id->clid() << std::endl;
311  }
312  // ___DEBUG
313 
314  if (container_data_id) {
315  m_accessor.insert( std::make_pair(var_name, CxxUtils::CachedUniquePtrT<IAccessor>()));
316  bool have_container_read_key = m_readKeys.find(container_name) != m_readKeys.end();
317  if (have_container_read_key && !method_data_id) continue;
318 
319  auto clid = container_data_id->clid();
320  (void) clid;
321  const SG::BaseInfoBase* base_info = (container_data_id ? SG::BaseInfoBase::find (container_data_id->clid()) : nullptr);
322  if (!base_info) {
323  std::stringstream msg;
324  msg << "Missing type information about container " << container_name << ".";
325  if (container_data_id) {
326  msg << " It seems that inheritance information is missing for " << container_data_id->className() << "."
327  << " Only container which inherit from SG::AuxVectorBase or data inheriting from SG::AuxElement "
328  << " are supported by the SGxAODProxyLoader loader.";
329  }
330  else {
331  msg << " This problem may occur if the container is read from the input"
332  << " file and not accessed anywhere in the job via read handles. ";
333  }
334  throw std::runtime_error(msg.str());
335  }
336  // ---DEBUG
337  if (m_verbose && base_info) {
338  std::cout << "DEBUG SGxAODProxyLoader " << container_name << " -> " << base_info->typeinfo().name() << std::endl;
339  for ( CLID clid : base_info->get_bases ()) {
340  const SG::BaseInfoBase* a_base_info = SG::BaseInfoBase::find (clid);
341  std::cout << "DEBUG SGxAODProxyLoader " << container_name << " base: " << a_base_info->typeinfo().name() << std::endl;
342  }
343  }
344  // ___DEBUG
345 
346 
347  std::any read_key;
348  std::any decor_key;
350  if (!have_container_read_key) {
351  read_key = std::make_any<SG::ReadHandleKey<SG::AuxVectorBase> >(container_name);
352  }
353  if (method_data_id) {
354  decor_key = std::make_any<SG::ReadDecorHandleKey<SG::AuxVectorBase> >(var_name);
355  }
356  }
357  else if (base_info->is_base(ClassID_traits<SG::AuxElement>::ID())) {
358  if (!have_container_read_key) {
359  read_key = std::make_any<SG::ReadHandleKey<SG::AuxElement> >(container_name);
360  }
361  if (method_data_id) {
362  decor_key = std::make_any<SG::ReadDecorHandleKey<SG::AuxElement> >(var_name);
363  }
364  }
365  else {
366  if (method_data_id && method_data_id != container_data_id && method_data_id->clid() != container_data_id->clid()) {
367  std::stringstream msg;
368  msg << "Did not expect a \"method\" handle for the plain type " << var_name;
369  throw std::logic_error(msg.str());
370  }
371  bool registered_key = PlainAccessorFactory::instance().registerReadKey(m_readKeys, base_info->typeinfo(), parent, var_name, new_input_handles, m_verbose);
372  if (registered_key) {
373  popRenounced(renounce, new_input_handles);
374  continue;
375  }
376  }
377 
378  if (!have_container_read_key) {
379  if (!read_key.has_value()) {
380  std::stringstream msg;
381  msg << "Container " << container_name << " is of unsupported type " << base_info->typeinfo().name()
382  << " expected a type derived from SG::AuxVectorBase or SG::AuxElement";
383  throw std::runtime_error(msg.str());
384  }
385  std::pair<ReadHandleMap::iterator, bool> ret = m_readKeys.insert(std::make_pair(container_name, std::move(read_key)));
386  if (ret.second) {
387  if ( (ReadHandleMap::isVector(ret.first->second) && parent.declare(ReadHandleMap::vectorKey(ret.first->second)).isFailure())
388  || (ReadHandleMap::isElement(ret.first->second) && parent.declare(ReadHandleMap::elementKey(ret.first->second)).isFailure())) {
389  std::stringstream msg;
390  msg << "Failed to add read handle key for " << container_name;
391  throw std::runtime_error(msg.str());
392  }
393  if (m_verbose) {
394  if (ReadHandleMap::isVector(ret.first->second)) dumpDeclare(&ReadHandleMap::vectorKey(ret.first->second) );
395  else dumpDeclare(&ReadHandleMap::elementKey(ret.first->second));
396  }
397  if (ReadHandleMap::isVector(ret.first->second)) initializeHandle(&ReadHandleMap::vectorKey(ret.first->second), new_input_handles);
398  else initializeHandle(&ReadHandleMap::elementKey(ret.first->second),new_input_handles);
399  popRenounced(renounce, new_input_handles);
400 
401  }
402  }
403  if (method_data_id) {
404  if (!decor_key.has_value()) {
405  std::stringstream msg;
406  msg << "Container " << container_name << " is of unsupported type " << base_info->typeinfo().name()
407  << " expected a type derived from SG::AuxVectorBase or SG::AuxElement";
408  throw std::runtime_error(msg.str());
409  }
410  std::pair<ReadDecorHandleMap::iterator, bool> ret = m_decorKeys.insert(std::make_pair(var_name,std::move(decor_key)));
411  if (ret.second) {
412  if ( (ReadDecorHandleMap::isVector(ret.first->second) && parent.declare(ReadDecorHandleMap::vectorKey(ret.first->second)).isFailure())
413  || (!ReadDecorHandleMap::isVector(ret.first->second) && parent.declare(ReadDecorHandleMap::elementKey(ret.first->second)).isFailure())) {
414  std::stringstream msg;
415  msg << "Failed to add read decor handle key for " << var_name;
416  throw std::runtime_error(msg.str());
417  }
418  if (m_verbose) {
419  if (ReadDecorHandleMap::isVector(ret.first->second)) dumpDeclare(&ReadDecorHandleMap::vectorKey(ret.first->second) );
420  else dumpDeclare(&ReadDecorHandleMap::elementKey(ret.first->second));
421  }
422  if (ReadDecorHandleMap::isVector(ret.first->second)) initializeHandle(&ReadDecorHandleMap::vectorKey(ret.first->second),new_input_handles );
423  else initializeHandle(&ReadDecorHandleMap::elementKey(ret.first->second),new_input_handles);
424  popRenounced(renounce, new_input_handles);
425  }
426  }
427  }
428  }
429  return initial_size != m_decorKeys.size()+m_readKeys.size();
430  }
431 }
RunTileTBRec.method
method
Definition: RunTileTBRec.py:73
grepfile.info
info
Definition: grepfile.py:38
ExpressionParsing::PlainAccessorFactory::registerReadKey
static bool registerReadKey(std::unordered_map< std::string, std::any > &read_keys, SGxAODProxyLoader::IParentHelper &parent, const std::string &var_name, std::vector< Gaudi::DataHandle * > &new_input_handles, bool verbose)
Definition: PlainAccessor.h:112
ExpressionParsing::SGxAODProxyLoader::loadIntVariableFromString
virtual int loadIntVariableFromString(const std::string &varname) const
Definition: SGxAODProxyLoader.cxx:218
SGxAODProxyLoader.h
ExpressionParsing::SGxAODProxyLoader::variableTypeFromString
virtual IProxyLoader::VariableType variableTypeFromString(const std::string &varname) const
Definition: SGxAODProxyLoader.cxx:195
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
ExpressionParsing::SGxAODProxyLoader::m_verbose
bool m_verbose
Definition: SGxAODProxyLoader.h:217
PlainAccessor.h
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:639
SG::AuxTypeRegistry::findAuxID
SG::auxid_t findAuxID(const std::string &name, const std::string &clsname="") const
Look up a name -> auxid_t mapping.
Definition: AuxTypeRegistry.cxx:756
ExpressionParsing::SGxAODProxyLoader::IParentHelper
Interface of an auxiliary class to pass the parent, e.g.
Definition: SGxAODProxyLoader.h:64
SG::normalizedTypeinfoName
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...
Definition: normalizedTypeinfoName.cxx:120
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
CheckAppliedSFs.var_name
var_name
Definition: CheckAppliedSFs.py:241
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
ExpressionParsing::SGxAODProxyLoader::loadVecIntVariableFromString
virtual std::vector< int > loadVecIntVariableFromString(const std::string &varname) const
Definition: SGxAODProxyLoader.cxx:230
ExpressionParsing::SGxAODProxyLoader::~SGxAODProxyLoader
virtual ~SGxAODProxyLoader()
Definition: SGxAODProxyLoader.cxx:44
ExtendedEventContext.h
CxxUtils::CachedUniquePtrT
Cached pointer with atomic update.
Definition: CachedUniquePtr.h:54
ExpressionParsing::SGxAODProxyLoader::splitVarnameIntoContainerAndMethod
void splitVarnameIntoContainerAndMethod(const std::string &varname, std::string &containerName, std::string &methodName) const
Definition: SGxAODProxyLoader.cxx:54
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
ExpressionParsing::SGxAODProxyLoader::ReadHandleMapTmpl< SG::ReadHandleKey< SG::AuxElement >, SG::ReadHandleKey< SG::AuxVectorBase > >::elementKey
static SG::ReadHandleKey< SG::AuxElement > & elementKey(std::any &anything)
Get a reference to the element object referred to by any or throw an exception.
Definition: SGxAODProxyLoader.h:189
ExpressionParsing::SGxAODProxyLoader::getMethodCallAccessor
std::pair< RootUtils::TSMethodCall, TVirtualCollectionProxy * > getMethodCallAccessor(const std::string &method_name, const std::type_info &info) const
Auxiliary method to create a TMethodCall and eventually also a collection proxy to call the given met...
Definition: SGxAODProxyLoader.cxx:62
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
ExpressionParsing::AccessorFactory::create
std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxElement > &key, SG::auxid_t auxid, const SG::ReadDecorHandleKey< SG::AuxElement > *decor_key=nullptr) const
create an accessor for the specified content of an AuxElement.
Definition: xAODAccessor.h:198
DebugUtils.h
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
SG::BaseInfoBase::get_bases
const std::vector< CLID > & get_bases() const
Return the class IDs of all known bases of T (that have class IDs).
Definition: BaseInfo.cxx:304
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:47
AuxVectorBase.h
Manage index tracking and synchronization of auxiliary data.
ExpressionParsing::SGxAODProxyLoader::m_readKeys
ReadHandleMap m_readKeys
Definition: SGxAODProxyLoader.h:201
ExpressionParsing::Singleton< MethodAccessorFactory >::instance
static MethodAccessorFactory & instance()
Definition: PhysicsAnalysis/CommonTools/ExpressionEvaluation/src/Utils.h:90
ExpressionParsing::SGxAODProxyLoader::reset
virtual void reset()
Definition: SGxAODProxyLoader.cxx:48
ExpressionParsing::SGxAODProxyLoader::SGxAODProxyLoader
SGxAODProxyLoader(StoreGateSvc_t &evtStore, bool verbose=false)
Definition: SGxAODProxyLoader.cxx:42
ExpressionParsing::isAvailable
bool isAvailable(const T_Aux &cont, SG::auxid_t auxid)
run_Egamma1_LArStrip_Fex.dump
dump
Definition: run_Egamma1_LArStrip_Fex.py:88
RootUtils::TSMethodCall
Helper for making a thread-safe function call.
Definition: TSMethodCall.h:33
Atlas::getExtendedEventContext
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
Definition: ExtendedEventContext.cxx:32
ExpressionParsing::SGxAODProxyLoader::m_accessor
std::unordered_map< std::string, CxxUtils::CachedUniquePtrT< IAccessor > > m_accessor
Association of variable names to accessors for corresponding xAOD object content.
Definition: SGxAODProxyLoader.h:208
ExpressionParsing::IProxyLoader::VariableType
VariableType
Definition: IProxyLoader.h:21
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
ExpressionParsing::MethodAccessorFactory::create
std::unique_ptr< IAccessor > create(const SG::ReadHandleKey< SG::AuxElement > &key, RootUtils::TSMethodCall &&method_call, TVirtualCollectionProxy *proxy=nullptr) const
Create an accessor which calls the specified method of an AuxElement.
Definition: MethodAccessor.h:224
ExpressionParsing::SGxAODProxyLoader::loadVecDoubleVariableFromString
virtual std::vector< double > loadVecDoubleVariableFromString(const std::string &varname) const
Definition: SGxAODProxyLoader.cxx:236
BaseInfo.h
Provide an interface for finding inheritance information at run time.
Utils.h
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
ExpressionParsing
Namespace holding all the expression evaluation code.
Definition: ExpressionParser.h:26
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ExpressionParsing::SGxAODProxyLoader::ReadHandleMapTmpl< SG::ReadHandleKey< SG::AuxElement >, SG::ReadHandleKey< SG::AuxVectorBase > >::isVector
static bool isVector(const std::any &anything)
Check whether the given any is the "vector" object.
Definition: SGxAODProxyLoader.h:185
RootUtils::TSMethodCall::call
TMethodCall * call()
Return a pointer to the thread-specific TMethodCall.
Definition: TSMethodCall.cxx:109
ExpressionParsing::PlainAccessorFactory::createAccessor
std::unique_ptr< IAccessor > createAccessor(const std::any &handle_key) const
Definition: PlainAccessor.h:208
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
xAODAccessor.h
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ExpressionParsing::IAccessor::variableType
virtual IProxyLoader::VariableType variableType() const =0
ExpressionParsing::operator<<
std::ostream & operator<<(std::ostream &os, const StackElement &el)
Declare an output operator for StackElement objects.
Definition: StackElement.cxx:775
ExpressionParsing::SGxAODProxyLoader::updateDataDependencies
bool updateDataDependencies(SGxAODProxyLoader::IParentHelper &parent, const std::vector< std::string > &var_names, const std::vector< std::string > &renounce, const std::vector< const DataObjID * > &input_data_in, const std::vector< const DataObjID * > &output_data_in, std::vector< Gaudi::DataHandle * > &new_input_handles, std::vector< Gaudi::DataHandle * > &new_output_handles)
Create extra data dependencies arising eventually from the given variables.
Definition: SGxAODProxyLoader.cxx:242
ExpressionParsing::SGxAODProxyLoader::m_decorKeys
ReadDecorHandleMap m_decorKeys
Definition: SGxAODProxyLoader.h:202
ExpressionParsing::SGxAODProxyLoader::getAccessor
IAccessor & getAccessor(const EventContext &ctx, const std::string &varname) const
Get an existing or create a new accessor for the given variable name.
Definition: SGxAODProxyLoader.h:138
SG::BaseInfoBase::find
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
Definition: BaseInfo.cxx:569
RootUtils::TSMethodCall::setProto
void setProto(TClass *cls, const std::string &fname, const std::string &args, ROOT::EFunctionMatchMode mode=ROOT::kExactMatch)
Set the function that we're to call.
Definition: TSMethodCall.cxx:90
xAOD::JetAttributeAccessor::accessor
const AccessorWrapper< T > * accessor(xAOD::JetAttribute::AttributeID id)
Returns an attribute accessor corresponding to an AttributeID.
Definition: JetAccessorMap.h:26
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
ExpressionParsing::getContainerSize
std::size_t getContainerSize(const T &cont)
Definition: PhysicsAnalysis/CommonTools/ExpressionEvaluation/src/Utils.h:73
ExpressionParsing::IAccessor
Interface of auxiliary classes to access xAOD object content.
Definition: IAccessor.h:13
ExpressionParsing::SGxAODProxyLoader::ReadHandleMapTmpl< SG::ReadHandleKey< SG::AuxElement >, SG::ReadHandleKey< SG::AuxVectorBase > >::vectorKey
static SG::ReadHandleKey< SG::AuxVectorBase > & vectorKey(std::any &anything)
Get a reference to the vector object referred to by any or throw an exception.
Definition: SGxAODProxyLoader.h:191
LArG4AODNtuplePlotter.varname
def varname(hname)
Definition: LArG4AODNtuplePlotter.py:37
MethodAccessor.h
ExpressionParsing::dumpDeclare
void dumpDeclare(const T *key)
Function for debugging which dumps information about newly declared data handles.
Definition: DebugUtils.h:65
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
ExpressionParsing::SGxAODProxyLoader::createAccessor
std::unique_ptr< IAccessor > createAccessor(const EventContext &ctx, const SG::ReadHandleKey< T_Aux > &key, const SG::ReadDecorHandleKey< T_Aux > *decor_key, SG::auxid_t method_id, const std::string &method_name) const
Auxiliary method to create an accessor for the given method_name.
Definition: SGxAODProxyLoader.cxx:114
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
SG::BaseInfoBase
The non-template portion of the BaseInfo implementation.
Definition: Control/AthenaKernel/AthenaKernel/BaseInfo.h:451
ExpressionParsing::SGxAODProxyLoader::ReadHandleMapTmpl< SG::ReadHandleKey< SG::AuxElement >, SG::ReadHandleKey< SG::AuxVectorBase > >::isElement
static bool isElement(const std::any &anything)
Check whether the given any is the "element" object.
Definition: SGxAODProxyLoader.h:187
ExpressionParsing::SGxAODProxyLoader::loadDoubleVariableFromString
virtual double loadDoubleVariableFromString(const std::string &varname) const
Definition: SGxAODProxyLoader.cxx:224
ReadDecorHandle.h
Handle class for reading a decoration on an object.
ExpressionParsing::SGxAODProxyLoader::computeClassForVarname
IAccessor & computeClassForVarname(const EventContext &ctx, std::unordered_map< std::string, CxxUtils::CachedUniquePtrT< IAccessor > >::const_iterator accessor_iter, const std::string &varname) const
Auxiliary method to create an xAOD object content accessor for the given variable name.
Definition: SGxAODProxyLoader.cxx:138
ExpressionParsing::SGxAODProxyLoader::m_emptyVectorAccessor
std::unique_ptr< IAccessor > m_emptyVectorAccessor
Special accessor to handle empty vectors Accessor are constructed at time of first evaluation.
Definition: SGxAODProxyLoader.h:216
BaseAccessor.h
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
SG::BaseInfoBase::typeinfo
const std::type_info & typeinfo() const
Return the std::type_info for this class.
Definition: BaseInfo.cxx:151
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
ExpressionParsing::EmptyVectorAccessor
Special accessor to handle empty containers until the correct accessor can be created.
Definition: BaseAccessor.h:40
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
ExpressionParsing::initializeHandle
void initializeHandle(T_Key *key, std::vector< Gaudi::DataHandle * > &new_input_handles)
Auxiliary function to initialize newly create data handles.
Definition: PhysicsAnalysis/CommonTools/ExpressionEvaluation/src/Utils.h:17
ServiceHandle< StoreGateSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
SG::BaseInfoBase::is_base
bool is_base(CLID clid) const
Return true if clid is the ID of a class that is known to be a base of T.
Definition: BaseInfo.cxx:344