ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
xAODMaker::AuxStoreWrapper Class Reference

Algorithm preparing auxiliary store objects for slimming. More...

#include <AuxStoreWrapper.h>

Inheritance diagram for xAODMaker::AuxStoreWrapper:
Collaboration diagram for xAODMaker::AuxStoreWrapper:

Public Member Functions

 AuxStoreWrapper (const std::string &name, ISvcLocator *svcLoc)
 Regular Algorithm constructor. More...
 
virtual StatusCode initialize ()
 Function initialising the algorithm. More...
 
virtual StatusCode execute ()
 Function executing the algorithm. More...
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode changeContainer (const SG::IAuxStore *store, const std::string &name)
 Create a new container store. More...
 
StatusCode changeElement (const SG::IAuxStore *store, const std::string &name)
 Create a new element store. More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

std::vector< std::string > m_keys
 StoreGate keys of the store objects to be wrapped. More...
 
std::set< std::string > m_keysSet
 Keys of the objects to be wrapped, in a set container. More...
 
bool m_cachesSet
 Flag specifying whether the internal caches were set already. More...
 
std::set< std::string > m_toConvert
 Keys of the auxiliary stores that need to be converted in the end. More...
 
std::map< std::string, CLIDm_clids
 Keys and CLIDs of the interface containers touched. More...
 
ServiceHandle< ::IClassIDSvc > m_clidSvc
 Handle to the Class ID service. More...
 
DataObjIDColl m_extendedExtraObjects
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Algorithm preparing auxiliary store objects for slimming.

   This algorithm can be used to update some or all of the auxiliary
   store objects in StoreGate to save all of their auxiliary
   variables as separate branches in the output TTree.
Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 41 of file AuxStoreWrapper.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ AuxStoreWrapper()

xAODMaker::AuxStoreWrapper::AuxStoreWrapper ( const std::string &  name,
ISvcLocator *  svcLoc 
)

Regular Algorithm constructor.

Definition at line 49 of file AuxStoreWrapper.cxx.

51  : AthAlgorithm( name, svcLoc ), m_cachesSet( false ),
52  m_clidSvc( "ClassIDSvc", name ) {
53 
54  declareProperty( "SGKeys", m_keys,
55  "StoreGate keys of the store objects to be wrapped" );
56  declareProperty( "ClassIDSvc", m_clidSvc, "Service providing CLID info" );
57  }

Member Function Documentation

◆ changeContainer()

StatusCode xAODMaker::AuxStoreWrapper::changeContainer ( const SG::IAuxStore store,
const std::string &  name 
)
private

Create a new container store.

Definition at line 187 of file AuxStoreWrapper.cxx.

188  {
189 
190  // Make StoreGate forget about this object:
191  auto aux_clid_itr = m_clids.find( name );
192  if( aux_clid_itr == m_clids.end() ) {
193  ATH_MSG_FATAL( "Didn't find a CLID for key: " << name );
194  ATH_MSG_FATAL( "This is an internal logic error" );
195  return StatusCode::FAILURE;
196  }
197  evtStore()->releaseObject( aux_clid_itr->second, name );
198  ATH_MSG_VERBOSE( "Released object with CLID " << aux_clid_itr->second
199  << " and name \"" << name << "\"" );
200 
201  // Get the pointer for the proxy of the auxiliary store:
202  SG::DataProxy* storeProxy =
204  if( ! storeProxy ) {
205  ATH_MSG_FATAL( "Couldn't get proxy for the "
206  "SG::IAuxStore base class of: " << name );
207  return StatusCode::FAILURE;
208  }
209  // Now make StoreGate forget about this proxy completely:
210  CHECK( evtStore()->removeProxy( storeProxy, nullptr, true ) );
211 
212  // Create the new object as a wrapper around the original:
214  holder->setStore( const_cast< SG::IAuxStore* >( store ) );
215 
216  // Record the new container with the same key:
217  CHECK( evtStore()->overwrite( holder, name, false, true ) );
218 
219  ATH_MSG_DEBUG( "Overwrote store object with key \""
220  << name << "\" with an xAOD::AuxContainerBase "
221  << "object" );
222 
223  // The key of the interface container:
224  const std::string intName = name.substr( 0, name.size() - 4 );
225 
226  // The CLID for the interface container:
227  CLID intId = 0;
228  auto clid_itr = m_clids.find( intName );
229  if( clid_itr == m_clids.end() ) {
230  ATH_MSG_WARNING( "Didn't cache a CLID for key: " << intName );
231  ATH_MSG_WARNING( "Interface container can't be updated, the job will "
232  "likely crash" );
233  return StatusCode::SUCCESS;
234  }
235  intId = clid_itr->second;
236 
237  // Try to access the proxy for the interface container:
238  SG::DataProxy* proxy = evtStore()->proxy( intId, intName );
239  if( ! proxy ) {
240  // If there is none, return at this point:
241  ATH_MSG_VERBOSE( "Interface container with key \"" << intName
242  << "\" not available" );
243  return StatusCode::SUCCESS;
244  }
245 
246  // Get the raw pointer to the object:
247  void* ptr = SG::DataProxy_cast( proxy, intId );
248  if( ! ptr ) {
249  REPORT_ERROR( StatusCode::FAILURE )
250  << "Couldn't retrieve raw pointer to interface container";
251  return StatusCode::FAILURE;
252  }
253 
254  // Since all the "wrapped" objects should be xAOD objects, for which
255  // the interface containers all implement a straight inheritance tree
256  // back to SG::AuxVectorBase, the following ugly operation should be
257  // safe:
258  SG::AuxVectorBase* interface =
259  reinterpret_cast< SG::AuxVectorBase* >( ptr );
260 
261  // And now connect the interface to the store depending on the const-ness
262  // of the interface:
263  if( proxy->isConst() ) {
264  interface->setConstStore( holder );
265  } else {
266  interface->setStore( holder );
267  }
268 
269  ATH_MSG_DEBUG( "Interface container with key \"" << intName
270  << "\" updated" );
271 
272  // Return gracefully:
273  return StatusCode::SUCCESS;
274  }

◆ changeElement()

StatusCode xAODMaker::AuxStoreWrapper::changeElement ( const SG::IAuxStore store,
const std::string &  name 
)
private

Create a new element store.

Definition at line 276 of file AuxStoreWrapper.cxx.

277  {
278 
279  // Make StoreGate forget about this object:
280  auto aux_clid_itr = m_clids.find( name );
281  if( aux_clid_itr == m_clids.end() ) {
282  ATH_MSG_FATAL( "Didn't find a CLID for key: " << name );
283  ATH_MSG_FATAL( "This is an internal logic error" );
284  return StatusCode::FAILURE;
285  }
286  evtStore()->releaseObject( aux_clid_itr->second, name );
287  ATH_MSG_VERBOSE( "Released object with CLID " << aux_clid_itr->second
288  << " and name \"" << name << "\"" );
289 
290  // Create the new as a wrapper around the original:
291  xAOD::AuxInfoBase* holder = new xAOD::AuxInfoBase();
292  holder->setStore( const_cast< SG::IAuxStore* >( store ) );
293 
294  // Record the new container with a different key:
295  CHECK( evtStore()->overwrite( holder, name, false, true ) );
296 
297  ATH_MSG_DEBUG( "Wrapped store object with key \""
298  << name << "\" into xAOD::AuxInfoBase "
299  << "object" );
300 
301  // The key of the interface object:
302  const std::string intName = name.substr( 0, name.size() - 4 );
303 
304  // The CLID for the interface object:
305  CLID intId = 0;
306  auto clid_itr = m_clids.find( intName );
307  if( clid_itr == m_clids.end() ) {
308  ATH_MSG_WARNING( "Didn't cache a CLID for key: " << intName );
309  ATH_MSG_WARNING( "Interface object can't be updated, the job will "
310  "likely crash" );
311  return StatusCode::SUCCESS;
312  }
313  intId = clid_itr->second;
314 
315  // Try to access the proxy for the interface object:
316  SG::DataProxy* proxy = evtStore()->proxy( intId, intName );
317  if( ! proxy ) {
318  // If there is none, return at this point:
319  ATH_MSG_VERBOSE( "Interface object with key \"" << intName
320  << "\" not available" );
321  return StatusCode::SUCCESS;
322  }
323 
324  // Get the raw pointer to the object:
325  void* ptr = SG::DataProxy_cast( proxy, intId );
326  if( ! ptr ) {
327  REPORT_ERROR( StatusCode::FAILURE )
328  << "Couldn't retrieve raw pointer to interface object";
329  return StatusCode::FAILURE;
330  }
331 
332  // Since all the "wrapped" objects should be xAOD objects, for which
333  // the interface objects all implement a straight inheritance tree
334  // back to SG::AuxElement, the following ugly operation should be
335  // safe:
336  SG::AuxElement* interface =
337  reinterpret_cast< SG::AuxElement* >( ptr );
338 
339  // And now connect the interface to the store depending on the const-ness
340  // of the interface:
341  if( proxy->isConst() ) {
342  interface->setConstStore( holder );
343  } else {
344  interface->setStore( holder );
345  }
346 
347  ATH_MSG_DEBUG( "Interface object with key \"" << intName
348  << "\" updated" );
349 
350  // Return gracefully:
351  return StatusCode::SUCCESS;
352  }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ execute()

StatusCode xAODMaker::AuxStoreWrapper::execute ( )
virtual

Function executing the algorithm.

Definition at line 80 of file AuxStoreWrapper.cxx.

80  {
81 
82  // The StoreGate content before the object wrapping:
83  ATH_MSG_VERBOSE( "Event store before wrapping:\n" << evtStore()->dump() );
84 
85  // If we don't have a list of keys to be converted yet, get one now:
86  if( ! m_cachesSet ) {
87 
88  // Ask StoreGate for all the objects that it's holding on to:
89  const std::vector< const SG::DataProxy* > proxies =
90  evtStore()->proxies();
91 
92  // Loop over them:
93  for( const SG::DataProxy* proxy : proxies ) {
94 
95  ATH_MSG_VERBOSE( "Evaluating object with name \"" << proxy->name()
96  << "\" and CLID " << proxy->clID() );
97 
98  // Check if we need to worry about this object:
99  if( !m_keysSet.empty() ) {
100  if( m_keysSet.find( proxy->name() ) == m_keysSet.end() ) {
101  // This SG key was not mentioned in the jobOptions...
102  ATH_MSG_VERBOSE( "Conversion for this key was not "
103  "requested" );
104  // But if this is a proxy for an interface container for which
105  // we wrap the auxiliary container, then let's remember it.
106  if( m_keysSet.find( proxy->name() + "Aux." ) !=
107  m_keysSet.end() ) {
108  std::string typeName;
109  ATH_CHECK( m_clidSvc->getTypeNameOfID( proxy->clID(),
110  typeName ) );
111  if( typeName.compare( 0, 6, "xAOD::" ) == 0) {
112  m_clids[ proxy->name() ] = proxy->clID();
113  }
114  }
115  continue;
116  }
117  }
118  ATH_MSG_VERBOSE( "The wrapping of this object was requested" );
119 
120  // Remember the CLID of this type, if it's an xAOD type:
121  std::string typeName;
122  ATH_CHECK( m_clidSvc->getTypeNameOfID( proxy->clID(),
123  typeName ) );
124  if( ( typeName.compare( 0, 6 , "xAOD::") == 0) &&
125  ( typeName != "xAOD::ByteStreamAuxContainer_v1" ) ) {
126  m_clids[ proxy->name() ] = proxy->clID();
127  }
128 
129  // Check if the key of the object looks like it is an auxiliary
130  // store. (To try to avoid unnecessary warnings.)
131  if( proxy->name().find( "Aux." ) !=
132  ( proxy->name().size() - 4 ) ) {
133  ATH_MSG_VERBOSE( "Key doesn't look like that of an auxiliary "
134  << "store" );
135  continue;
136  }
137  ATH_MSG_VERBOSE( "StoreGate key looks like that of an auxiliary "
138  << "store..." );
139 
140  // This object/container will be converted:
141  m_toConvert.insert( proxy->name() );
142  }
143 
144  // The caches are now set:
145  m_cachesSet = true;
146  }
147 
148  // Now do the wrapping on the selected objects/containers:
149  for( const std::string& name : m_toConvert ) {
150 
151  // Tell the user what's happening:
152  ATH_MSG_VERBOSE( "Now wrapping object: " << name );
153 
154  // Access the object with an SG::IAuxStore pointer:
155  const SG::IAuxStore* original = nullptr;
156  if( ! evtStore()->retrieve( original, name ).isSuccess() ) {
157  ATH_MSG_WARNING( "Couldn't retrieve object \"" << name << "\" "
158  << "with interface SG::IAuxStore" );
159  continue;
160  }
161 
162  // Check if the object implements the IAuxStoreHolder interface
163  // as well.
164  const SG::IAuxStoreHolder* holder =
165  dynamic_cast< const SG::IAuxStoreHolder* >( original );
166  if( ! holder ) {
167  // If not, let's just assume that it describes a container.
168  CHECK( changeContainer( original, name ) );
169  continue;
170  }
171 
172  // Decide how to replace it exactly:
174  CHECK( changeElement( original, name ) );
175  } else {
176  CHECK( changeContainer( original, name ) );
177  }
178  }
179 
180  // The StoreGate content before the object wrapping:
181  ATH_MSG_VERBOSE( "Event store after wrapping:\n" << evtStore()->dump() );
182 
183  // Return gracefully:
184  return StatusCode::SUCCESS;
185  }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51 {
52  // If we didn't find any symlinks to add, just return the collection
53  // from the base class. Otherwise, return the extended collection.
54  if (!m_extendedExtraObjects.empty()) {
56  }
57  return Algorithm::extraOutputDeps();
58 }

◆ initialize()

StatusCode xAODMaker::AuxStoreWrapper::initialize ( )
virtual

Function initialising the algorithm.

Definition at line 59 of file AuxStoreWrapper.cxx.

59  {
60 
61  ATH_MSG_INFO( "Initialising" );
62  ATH_MSG_DEBUG( " StoreGate keys: " << m_keys );
63 
64  // Retrieve the needed component(s):
65  ATH_CHECK( m_clidSvc.retrieve() );
66 
67  // Pack the SG keys into a structure that's more efficient during
68  // event processing:
69  m_keysSet.insert( m_keys.begin(), m_keys.end() );
70 
71  // Reset the caches:
72  m_cachesSet = false;
73  m_toConvert.clear();
74  m_clids.clear();
75 
76  // Return gracefully:
77  return StatusCode::SUCCESS;
78  }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg() [1/2]

MsgStream& AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Algorithm >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, PyAthena::Alg, and AthHistogramAlgorithm.

Definition at line 66 of file AthAlgorithm.cxx.

66  {
68 
69  if (sc.isFailure()) {
70  return sc;
71  }
72  ServiceHandle<ICondSvc> cs("CondSvc",name());
73  for (auto h : outputHandles()) {
74  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75  // do this inside the loop so we don't create the CondSvc until needed
76  if ( cs.retrieve().isFailure() ) {
77  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78  return StatusCode::SUCCESS;
79  }
80  if (cs->regHandle(this,*h).isFailure()) {
81  sc = StatusCode::FAILURE;
82  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83  << " with CondSvc");
84  }
85  }
86  }
87  return sc;
88 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_cachesSet

bool xAODMaker::AuxStoreWrapper::m_cachesSet
private

Flag specifying whether the internal caches were set already.

Definition at line 66 of file AuxStoreWrapper.h.

◆ m_clids

std::map< std::string, CLID > xAODMaker::AuxStoreWrapper::m_clids
private

Keys and CLIDs of the interface containers touched.

Definition at line 70 of file AuxStoreWrapper.h.

◆ m_clidSvc

ServiceHandle< ::IClassIDSvc > xAODMaker::AuxStoreWrapper::m_clidSvc
private

Handle to the Class ID service.

Definition at line 73 of file AuxStoreWrapper.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_keys

std::vector< std::string > xAODMaker::AuxStoreWrapper::m_keys
private

StoreGate keys of the store objects to be wrapped.

Definition at line 61 of file AuxStoreWrapper.h.

◆ m_keysSet

std::set< std::string > xAODMaker::AuxStoreWrapper::m_keysSet
private

Keys of the objects to be wrapped, in a set container.

Definition at line 63 of file AuxStoreWrapper.h.

◆ m_toConvert

std::set< std::string > xAODMaker::AuxStoreWrapper::m_toConvert
private

Keys of the auxiliary stores that need to be converted in the end.

Definition at line 68 of file AuxStoreWrapper.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
xAOD::AuxInfoBase
Common base class for auxiliary info objects.
Definition: AuxInfoBase.h:49
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::AuxContainerBase::setStore
virtual void setStore(SG::IAuxStore *store) override
Set a different internal store object.
Definition: AuxContainerBase.cxx:194
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:71
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
REPORT_ERROR
#define REPORT_ERROR(SC)
Report an error.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:355
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
SG::IAuxStoreHolder::getStoreType
virtual AuxStoreType getStoreType() const =0
Return the type of the store object.
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:472
xAOD::AuxContainerBase
Common base class for the auxiliary containers.
Definition: AuxContainerBase.h:59
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
xAODMaker::AuxStoreWrapper::m_keysSet
std::set< std::string > m_keysSet
Keys of the objects to be wrapped, in a set container.
Definition: AuxStoreWrapper.h:63
SG::AuxVectorBase
Manage index tracking and synchronization of auxiliary data.
Definition: AuxVectorBase.h:98
xAODMaker::AuxStoreWrapper::changeContainer
StatusCode changeContainer(const SG::IAuxStore *store, const std::string &name)
Create a new container store.
Definition: AuxStoreWrapper.cxx:187
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
run_Egamma1_LArStrip_Fex.dump
dump
Definition: run_Egamma1_LArStrip_Fex.py:88
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAODMaker::AuxStoreWrapper::m_clids
std::map< std::string, CLID > m_clids
Keys and CLIDs of the interface containers touched.
Definition: AuxStoreWrapper.h:70
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
xAODMaker::AuxStoreWrapper::m_toConvert
std::set< std::string > m_toConvert
Keys of the auxiliary stores that need to be converted in the end.
Definition: AuxStoreWrapper.h:68
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
xAODMaker::AuxStoreWrapper::changeElement
StatusCode changeElement(const SG::IAuxStore *store, const std::string &name)
Create a new element store.
Definition: AuxStoreWrapper.cxx:276
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
xAOD::AuxInfoBase::setStore
virtual void setStore(SG::IAuxStore *store) override
Set a different internal store object.
Definition: AuxInfoBase.cxx:160
SG::DataProxy_cast
DATA * DataProxy_cast(DataProxy *proxy)
cast the proxy into the concrete data object it proxies
xAODMaker::AuxStoreWrapper::m_clidSvc
ServiceHandle< ::IClassIDSvc > m_clidSvc
Handle to the Class ID service.
Definition: AuxStoreWrapper.h:73
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
xAODMaker::AuxStoreWrapper::m_cachesSet
bool m_cachesSet
Flag specifying whether the internal caches were set already.
Definition: AuxStoreWrapper.h:66
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
ReadCalibFromCool.typeName
typeName
Definition: ReadCalibFromCool.py:477
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
xAODMaker::AuxStoreWrapper::m_keys
std::vector< std::string > m_keys
StoreGate keys of the store objects to be wrapped.
Definition: AuxStoreWrapper.h:61
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
SG::DataProxy
Definition: DataProxy.h:44
SG::IAuxStoreHolder::AST_ObjectStore
@ AST_ObjectStore
The store describes a single object.
Definition: IAuxStoreHolder.h:67
SG::IAuxStoreHolder
Interface for objects taking part in direct ROOT I/O.
Definition: IAuxStoreHolder.h:36
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
ServiceHandle< ICondSvc >