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

#include <CondInputLoader.h>

Inheritance diagram for CondInputLoader:
Collaboration diagram for CondInputLoader:

Public Member Functions

 CondInputLoader (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters: More...
 
virtual StatusCode initialize () override
 
virtual StatusCode start () override
 
virtual StatusCode execute () override
 
virtual StatusCode finalize () override
 
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)
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

void extraDeps_update_handler (Gaudi::Details::PropertyBase &)
 
RootType loadDict (CLID clid)
 
RootType loadDict (const std::string &name)
 
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

Gaudi::Property< DataObjIDColl > m_load {this,"Load",{},"List of objects to be loaded"}
 Containers. More...
 
DataObjIDColl m_handlesToCreate
 
std::vector< SG::VarHandleKeym_vhk
 
Gaudi::Property< bool > m_dumpCondStore
 
Gaudi::Property< bool > m_dumpCondSvc
 
Gaudi::Property< bool > m_abort
 
ServiceHandle< StoreGateSvcm_condStore
 
ServiceHandle< ICondSvc > m_condSvc
 
ServiceHandle< IIOVSvcm_IOVSvc
 
ServiceHandle< IIOVDbSvcm_IOVDbSvc
 
ServiceHandle< IClassIDSvc > m_clidSvc
 
ServiceHandle< Athena::IRCUSvcm_rcuSvc
 
ServiceHandle< IDictLoaderSvcm_dictLoader { this, "DictLoaderSvc", "AthDictLoaderSvc", "" }
 
ServiceHandle< ITPCnvSvcm_tpCnvSvc { this, "TPCnvSvc", "AthTPCnvSvc", "" }
 
std::map< std::string, std::string > m_keyFolderMap
 
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

Definition at line 29 of file CondInputLoader.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

◆ CondInputLoader()

CondInputLoader::CondInputLoader ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Constructor with parameters:

Definition at line 58 of file CondInputLoader.cxx.

59  :
60  ::AthAlgorithm( name, pSvcLocator ),
61  m_condStore("StoreGateSvc/ConditionStore", name),
62  m_condSvc("CondSvc",name),
63  m_IOVSvc("IOVSvc",name),
64  m_IOVDbSvc("IOVDbSvc",name),
65  m_clidSvc("ClassIDSvc",name),
66  m_rcuSvc("Athena::RCUSvc",name)
67 {
68  //
69  // Property declaration
70  //
71  auto props = getProperties();
72  for( Gaudi::Details::PropertyBase* prop : props ) {
73  if (prop->name() == "ExtraOutputs" || prop->name() == "ExtraInputs") {
74  prop->declareUpdateHandler
76  }
77  }
78 }

Member Function Documentation

◆ 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 CondInputLoader::execute ( )
overridevirtual

Definition at line 308 of file CondInputLoader.cxx.

309 {
310  ATH_MSG_DEBUG ("Executing " << name() << "...");
311 
312  EventIDBase now;
313  if (!getContext().valid()) {
314  ATH_MSG_WARNING("EventContext not valid! This should not happen!");
315  const xAOD::EventInfo* thisEventInfo;
316  if(evtStore()->retrieve(thisEventInfo)!=StatusCode::SUCCESS) {
317  ATH_MSG_ERROR("Unable to get Event Info");
318  return StatusCode::FAILURE;
319  }
320  now.set_run_number(thisEventInfo->runNumber());
321  now.set_event_number(thisEventInfo->eventNumber());
322  now.set_lumi_block(thisEventInfo->lumiBlock());
323  now.set_time_stamp(thisEventInfo->timeStamp());
324  now.set_time_stamp_ns_offset(thisEventInfo->timeStampNSOffset());
325  }
326  else {
327  now.set_run_number(getContext().eventID().run_number());
328  now.set_event_number(getContext().eventID().event_number());
329  now.set_lumi_block(getContext().eventID().lumi_block());
330  now.set_time_stamp(getContext().eventID().time_stamp());
331  now.set_time_stamp_ns_offset(getContext().eventID().time_stamp_ns_offset());
332  }
333 
334  EventIDBase now_event = now;
335  now.set_event_number (EventIDBase::UNDEFEVT);
336 
337  // For a MC event, the run number we need to use to look up the conditions
338  // may be different from that of the event itself. Override the run
339  // number with the conditions run number from the event context,
340  // if it is defined.
341  EventIDBase::number_type conditionsRun =
343  if (conditionsRun != EventIDBase::UNDEFNUM) {
344  now.set_run_number (conditionsRun);
345  }
346 
347  StatusCode sc(StatusCode::SUCCESS);
348  std::string tag;
349  for (auto &vhk: m_vhk) {
350  ATH_MSG_DEBUG( "handling id: " << vhk.fullKey() << " key: " << vhk.key() );
351 
352  CondContBase* ccb(0);
353  if (! m_condStore->retrieve(ccb, vhk.key()).isSuccess()) {
354  ATH_MSG_ERROR( "unable to get CondContBase* for " << vhk.fullKey()
355  << " from ConditionStore" );
356  sc = StatusCode::FAILURE;
357  continue;
358  }
359 
360  if (ccb->valid(now)) {
361  ATH_MSG_DEBUG( " CondObj " << vhk.fullKey() << " is still valid at " << now_event );
362  continue;
363  }
364 
365  std::string dbKey = m_keyFolderMap[vhk.key()];
366  if (m_IOVSvc->createCondObj( ccb, vhk.fullKey(), now ).isFailure()) {
367  ATH_MSG_ERROR("unable to create Cond object for " << vhk.fullKey() << " dbKey: "
368  << dbKey);
369  sc = StatusCode::FAILURE;
370  continue;
371  }
372  }
373 
374  if (m_dumpCondStore) {
375  ATH_MSG_DEBUG(m_condStore->dump());
376  }
377 
378  if (m_dumpCondSvc) {
379  std::ostringstream ost;
380  m_condSvc->dump(ost);
381  ATH_MSG_DEBUG(ost.str());
382  }
383  return sc;
384 }

◆ extraDeps_update_handler()

void CondInputLoader::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  )
private

Definition at line 391 of file CondInputLoader.cxx.

392 {
393  // do nothing
394 }

◆ 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 }

◆ finalize()

StatusCode CondInputLoader::finalize ( )
overridevirtual

Definition at line 227 of file CondInputLoader.cxx.

228 {
229  ATH_MSG_INFO ("Finalizing " << name() << "...");
230 
231  return StatusCode::SUCCESS;
232 }

◆ initialize()

StatusCode CondInputLoader::initialize ( )
overridevirtual

Definition at line 85 of file CondInputLoader.cxx.

86 {
87  ATH_MSG_INFO ("Initializing " << name() << "...");
88 
89  ATH_CHECK( m_condSvc.retrieve() );
90  ATH_CHECK( m_condStore.retrieve() );
91  ATH_CHECK( m_clidSvc.retrieve() );
92  ATH_CHECK( m_rcuSvc.retrieve() );
93  ATH_CHECK( m_dictLoader.retrieve() );
94  ATH_CHECK( m_tpCnvSvc.retrieve() );
95 
96  // Trigger read of IOV database
97  ServiceHandle<IIOVSvc> ivs("IOVSvc",name());
98  ATH_CHECK( ivs.retrieve() );
99 
100  // Update the SG keys if different from Folder Names
101  ATH_CHECK( m_IOVDbSvc.retrieve() );
102  std::vector<std::string> keys = m_IOVDbSvc->getKeyList();
104  DataObjIDColl handles_to_load;
105 
106  for (auto key : keys) {
107  if( m_IOVDbSvc->getKeyInfo(key, info) ) {
108  m_keyFolderMap[key] = info.folderName;
109  } else {
110  ATH_MSG_WARNING("unable to retrieve keyInfo for " << key );
111  }
112  }
113 
114  // We can get warnings later if we don't get this defined first.
115  TClass::GetClass ("coral::AttributeList", true, false);
116 
117  for (const auto& itr : m_keyFolderMap) { //loop over keys of IOVDbSvc
118  for (auto id : m_load) {
119  if (id.key() == itr.second) {//CondInputLoader deals with this folder
120  if (itr.second != itr.first) {
121  ATH_MSG_DEBUG(" mapping folder " << id.key() << " to SGkey "
122  << itr.first);
123  id.updateKey( itr.first );
124  }//end if folder-name doesn't match SG key
125 
128  handles_to_load.emplace(vhk.fullKey());
129 
130  // Loading root dictionaries in a multithreaded environment
131  // is unreliable.
132  // So try to be sure all dictionaries are loaded now.
133  RootType rt = loadDict (id.clid());
134 
135  // Special case for LArConditionsSubset classes.
136  if (rt.Class()) {
137  size_t nbases = rt.BaseSize();
138  std::string pat = "LArConditionsContainer<";
139  for (size_t ibase = 0; ibase < nbases; ++ibase) {
140  std::string basename = rt.BaseAt(ibase).Name();
141  if (basename.starts_with( pat)) {
142  std::string subset = "LArConditionsSubset<" + basename.substr (pat.size(), std::string::npos);
143  loadDict (subset);
144  loadDict ("LArConditionsSubset_p1");
145  }
146  }
147  }
148 
149  break; //quit loop over m_load
150  } // end if CondInputLoader deals with this folder
151  }//end loop over m_load
152  }//end loop over m_keyFolderMap
153 
154  m_load = handles_to_load;
155  m_handlesToCreate = handles_to_load;
156 
157  // Add in all the base classes known to StoreGate, in case a handle
158  // is read via its base class. These will be added to the output deps,
159  // and also registered with the CondSvc, as the scheduler needs this
160  // info.
161 
162  std::ostringstream ost;
163  ost << "Adding base classes:";
164  for (auto &e : sortedDataObjIDColl (handles_to_load)) {
165  // ignore empty keys
166  if (e->key().empty()) continue;
167 
168  ost << "\n + " << *e << " ->";
169  CLID clid = e->clid();
170  const SG::BaseInfoBase* bib = SG::BaseInfoBase::find( clid );
171  if ( ! bib ) {
172  ost << " no bases";
173  } else {
174  for (CLID clid2 : bib->get_bases()) {
175  if (clid2 != clid) {
176  std::string base("UNKNOWN");
177  m_clidSvc->getTypeNameOfID(clid2,base).ignore();
178  ost << " " << base << " (" << clid2 << ")";
181  m_load.value().emplace(vhk.fullKey());
182  // Again, make sure all needed dictionaries are loaded.
183  m_dictLoader->load_type (clid2, true);
184  }
185  }
186  }
187  }
188  ATH_MSG_INFO(ost.str());
189 
190 
191  // Update the properties, set the ExtraOutputs for Alg deps
192  const Gaudi::Details::PropertyBase &p = getProperty("Load");
193 
194  ATH_MSG_DEBUG("setting prop ExtraOutputs to " << p.toString());
195  if (!setProperty("ExtraOutputs", p).isSuccess()) {
196  ATH_MSG_ERROR("failed setting property ExtraOutputs");
197  return StatusCode::FAILURE;
198  }
199 
200  StatusCode sc(StatusCode::SUCCESS);
201  std::ostringstream str;
202  str << "Will create WriteCondHandle dependencies for the following DataObjects:";
203  for (auto &e : sortedDataObjIDColl(m_load)) {
204  str << "\n + " << *e;
205  if (e->key().empty()) {
206  sc = StatusCode::FAILURE;
207  str << " ERROR: empty key is not allowed!";
208  } else {
209  SG::VarHandleKey vhk(e->clid(),e->key(),Gaudi::DataHandle::Writer,
211  if (m_condSvc->regHandle(this, vhk).isFailure()) {
212  ATH_MSG_ERROR("Unable to register WriteCondHandle " << vhk.fullKey());
213  sc = StatusCode::FAILURE;
214  }
215  ATH_MSG_DEBUG("Ignoring proxy: " << vhk.key());
216  m_IOVSvc->ignoreProxy(vhk.fullKey().clid(), vhk.key());
217  }
218  }
219  ATH_MSG_INFO(str.str());
220 
221  return sc;
222 }

◆ 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.

◆ loadDict() [1/2]

RootType CondInputLoader::loadDict ( CLID  clid)
private

Definition at line 414 of file CondInputLoader.cxx.

415 {
416  std::string name;
417  if (m_clidSvc->getTypeNameOfID (clid, name).isSuccess()) {
418  return loadDict (name);
419  }
420  return RootType();
421 }

◆ loadDict() [2/2]

RootType CondInputLoader::loadDict ( const std::string &  name)
private

Definition at line 398 of file CondInputLoader.cxx.

399 {
400  // First try to load the persistent class dictionary.
401  std::unique_ptr<ITPCnvBase> tpcnv = m_tpCnvSvc->t2p_cnv_unique (name);
402  if (tpcnv) {
403  RootType rtp = m_dictLoader->load_type (tpcnv->persistentTInfo());
404  if (rtp.Class()) {
405  return rtp;
406  }
407  }
408 
409  // Otherwise try to load the dictionary for the class itself.
410  return m_dictLoader->load_type (name);
411 }

◆ 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  }

◆ start()

StatusCode CondInputLoader::start ( )
overridevirtual

Definition at line 237 of file CondInputLoader.cxx.

238 {
239  //
240  // now create the CondCont<T>. This has to be done after initialize(),
241  // as we need to make sure that all Condition Objects have been instantiated
242  // so as to fill the static condition obj registry via REGISTER_CC
243  //
244  // we use a VHK to store the info instead of a DataObjIDColl, as this saves
245  // us the trouble of stripping out the storename from the key later.
246  //
247 
248  m_vhk.clear(); // in case of multiple start transitions
249 
250  bool fail(false);
251  for (const DataObjID* ditr : sortedDataObjIDColl (m_handlesToCreate)) {
252  SG::VarHandleKey vhk(ditr->clid(),ditr->key(),Gaudi::DataHandle::Writer);
253  if ( ! m_condStore->contains<CondContBase>( vhk.key() ) ){
254  std::string tp("UNKNOWN");
255  if (m_clidSvc->getTypeNameOfID(ditr->clid(),tp).isFailure()) {
256  ATH_MSG_WARNING("unable to convert clid " << ditr->clid() << " to a classname."
257  << "This is a BAD sign, but will try to continue");
258  }
260  CondContainer::CondContFactory::Instance().Create( *m_rcuSvc, ditr->clid(), ditr->key() );
261  if (cb == 0) {
262  // try to force a load of libraries using ROOT
263  (void)TClass::GetClass (tp.c_str());
264  cb =
265  CondContainer::CondContFactory::Instance().Create( *m_rcuSvc, ditr->clid(), ditr->key() );
266  }
267  if (cb == 0) {
268  ATH_MSG_ERROR("failed to create CondCont<" << tp
269  << "> clid=" << ditr->clid()
270  << " : no factory found");
271  fail = true;
272  } else {
273  ATH_MSG_INFO("created CondCont<" << tp << "> with key '"
274  << ditr->key() << "'");
275  if (m_condStore->recordObject(cb, vhk.key(), true, false) == nullptr) {
276  ATH_MSG_ERROR("while creating a CondContBase for "
277  << vhk.fullKey());
278  fail = true;
279  } else {
280  m_vhk.push_back(vhk);
281  }
282  }
283  } else {
284  m_vhk.push_back(vhk);
285  }
286  }
287 
288  if (fail && m_abort) {
289  ATH_MSG_FATAL("Unable to setup some of the requested CondCont<T>. "
290  << "Aborting");
291  return StatusCode::FAILURE;
292  }
293 
294  // Let the conditions service know that we've finished creating
295  // conditions containers.
296  ServiceHandle<ICondSvcSetupDone> condSvcDone ("CondSvc", name());
297  ATH_CHECK( condSvcDone.retrieve() );
298  ATH_CHECK( condSvcDone->setupDone() );
299 
300  return StatusCode::SUCCESS;
301 
302 }

◆ 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_abort

Gaudi::Property<bool> CondInputLoader::m_abort
private
Initial value:
{this, "AbortIfInitFails", true,
"Abort execution if unable to create the CondCont<T> in first event"}

Definition at line 63 of file CondInputLoader.h.

◆ m_clidSvc

ServiceHandle<IClassIDSvc> CondInputLoader::m_clidSvc
private

Definition at line 71 of file CondInputLoader.h.

◆ m_condStore

ServiceHandle<StoreGateSvc> CondInputLoader::m_condStore
private

Definition at line 67 of file CondInputLoader.h.

◆ m_condSvc

ServiceHandle<ICondSvc> CondInputLoader::m_condSvc
private

Definition at line 68 of file CondInputLoader.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_dictLoader

ServiceHandle<IDictLoaderSvc> CondInputLoader::m_dictLoader { this, "DictLoaderSvc", "AthDictLoaderSvc", "" }
private

Definition at line 73 of file CondInputLoader.h.

◆ m_dumpCondStore

Gaudi::Property<bool> CondInputLoader::m_dumpCondStore
private
Initial value:
{ this, "DumpCondStore", false,
"dump the ConditionStore at the end execute"}

Definition at line 59 of file CondInputLoader.h.

◆ m_dumpCondSvc

Gaudi::Property<bool> CondInputLoader::m_dumpCondSvc
private
Initial value:
{ this, "DumpCondSvc", false,
"dump the CondSvc at the end execute"}

Definition at line 61 of file CondInputLoader.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_handlesToCreate

DataObjIDColl CondInputLoader::m_handlesToCreate
private

Definition at line 56 of file CondInputLoader.h.

◆ m_IOVDbSvc

ServiceHandle<IIOVDbSvc> CondInputLoader::m_IOVDbSvc
private

Definition at line 70 of file CondInputLoader.h.

◆ m_IOVSvc

ServiceHandle<IIOVSvc> CondInputLoader::m_IOVSvc
private

Definition at line 69 of file CondInputLoader.h.

◆ m_keyFolderMap

std::map<std::string,std::string> CondInputLoader::m_keyFolderMap
private

Definition at line 78 of file CondInputLoader.h.

◆ m_load

Gaudi::Property<DataObjIDColl> CondInputLoader::m_load {this,"Load",{},"List of objects to be loaded"}
private

Containers.

Definition at line 55 of file CondInputLoader.h.

◆ m_rcuSvc

ServiceHandle<Athena::IRCUSvc> CondInputLoader::m_rcuSvc
private

Definition at line 72 of file CondInputLoader.h.

◆ m_tpCnvSvc

ServiceHandle<ITPCnvSvc> CondInputLoader::m_tpCnvSvc { this, "TPCnvSvc", "AthTPCnvSvc", "" }
private

Definition at line 75 of file CondInputLoader.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhk

std::vector< SG::VarHandleKey > CondInputLoader::m_vhk
private

Definition at line 57 of file CondInputLoader.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:
grepfile.info
info
Definition: grepfile.py:38
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CondInputLoader::m_vhk
std::vector< SG::VarHandleKey > m_vhk
Definition: CondInputLoader.h:57
base
std::string base
Definition: hcg.cxx:78
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
plotting.plot_kinematics.run_number
run_number
Definition: plot_kinematics.py:29
python.trigbs_prescaleL1.ost
ost
Definition: trigbs_prescaleL1.py:104
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
CondContainer::CondContFactory::Instance
static CondContFactory & Instance()
Definition: CondContFactory.cxx:14
CondContainer::CondContFactory::Create
SG::DataObjectSharedPtr< DataObject > Create(Athena::IRCUSvc &rcusvc, const CLID &clid, const std::string &key) const
Definition: CondContFactory.cxx:28
Atlas::ExtendedEventContext::conditionsRun
EventIDBase::number_type conditionsRun() const
Definition: ExtendedEventContext.h:38
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CondInputLoader::m_rcuSvc
ServiceHandle< Athena::IRCUSvc > m_rcuSvc
Definition: CondInputLoader.h:72
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
ParticleTest.tp
tp
Definition: ParticleTest.py:25
AtlasMcWeight::number_type
unsigned int number_type
Definition: AtlasMcWeight.h:20
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
xAOD::EventInfo_v1::timeStampNSOffset
uint32_t timeStampNSOffset() const
Nanosecond time offset wrt. the time stamp.
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
CondInputLoader::m_clidSvc
ServiceHandle< IClassIDSvc > m_clidSvc
Definition: CondInputLoader.h:71
CondInputLoader::m_tpCnvSvc
ServiceHandle< ITPCnvSvc > m_tpCnvSvc
Definition: CondInputLoader.h:76
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
RootType
TTypeAdapter RootType
Definition: RootType.h:211
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Atlas::getExtendedEventContext
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
Definition: ExtendedEventContext.cxx:32
StoreID::CONDITION_STORE
@ CONDITION_STORE
Definition: StoreID.h:28
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
calibdata.valid
list valid
Definition: calibdata.py:45
CondInputLoader::m_load
Gaudi::Property< DataObjIDColl > m_load
Containers.
Definition: CondInputLoader.h:55
python.handimod.now
now
Definition: handimod.py:675
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
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
CondContBase
Base class for all conditions containers.
Definition: CondCont.h:140
TestMuonSF::getProperty
T getProperty(const asg::IAsgTool *interface_tool, const std::string &prop_name)
Definition: MuonSFTestHelper.cxx:17
CondInputLoader::m_IOVSvc
ServiceHandle< IIOVSvc > m_IOVSvc
Definition: CondInputLoader.h:69
CondInputLoader::m_IOVDbSvc
ServiceHandle< IIOVDbSvc > m_IOVDbSvc
Definition: CondInputLoader.h:70
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
xAOD::EventInfo_v1::lumiBlock
uint32_t lumiBlock() const
The current event's luminosity block number.
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
dso-stats.pat
pat
Definition: dso-stats.py:39
CondInputLoader::m_handlesToCreate
DataObjIDColl m_handlesToCreate
Definition: CondInputLoader.h:56
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
SG::BaseInfoBase::find
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
Definition: BaseInfo.cxx:569
CondInputLoader::m_keyFolderMap
std::map< std::string, std::string > m_keyFolderMap
Definition: CondInputLoader.h:78
SG::VarHandleKey
A property holding a SG store/key/clid from which a VarHandle is made.
Definition: StoreGate/StoreGate/VarHandleKey.h:62
CondInputLoader::m_condSvc
ServiceHandle< ICondSvc > m_condSvc
Definition: CondInputLoader.h:68
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
a
TList * a
Definition: liststreamerinfos.cxx:10
h
TBaseAdapter::Name
std::string Name() const
Definition: RootType.cxx:356
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ITPCnvBase::persistentTInfo
virtual const std::type_info & persistentTInfo() const =0
return C++ type id of the persistent class this converter is for
CondInputLoader::m_dumpCondStore
Gaudi::Property< bool > m_dumpCondStore
Definition: CondInputLoader.h:59
SG::BaseInfoBase
The non-template portion of the BaseInfo implementation.
Definition: Control/AthenaKernel/AthenaKernel/BaseInfo.h:451
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
xAOD::EventInfo_v1::timeStamp
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
IIOVDbSvc::KeyInfo
Filled by IIOVDbSvc::getKeyInfo.
Definition: IIOVDbSvc.h:44
TScopeAdapter::BaseSize
size_t BaseSize() const
Definition: RootType.cxx:749
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
str
Definition: BTagTrackIpAccessor.cxx:11
CondInputLoader::loadDict
RootType loadDict(CLID clid)
Definition: CondInputLoader.cxx:414
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
CondInputLoader::m_dictLoader
ServiceHandle< IDictLoaderSvc > m_dictLoader
Definition: CondInputLoader.h:74
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
SG::DataObjectSharedPtr
Smart pointer to manage DataObject reference counts.
Definition: DataObjectSharedPtr.h:46
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
CondInputLoader::m_dumpCondSvc
Gaudi::Property< bool > m_dumpCondSvc
Definition: CondInputLoader.h:61
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
StoreID::storeName
static const std::string & storeName(const StoreID::type &s)
Definition: StoreID.cxx:77
TScopeAdapter::Class
TClass * Class() const
Definition: RootType.h:183
CondInputLoader::m_abort
Gaudi::Property< bool > m_abort
Definition: CondInputLoader.h:63
CondInputLoader::m_condStore
ServiceHandle< StoreGateSvc > m_condStore
Definition: CondInputLoader.h:67
fitman.k
k
Definition: fitman.py:528
beamspotman.fail
def fail(message)
Definition: beamspotman.py:201
CondInputLoader::extraDeps_update_handler
void extraDeps_update_handler(Gaudi::Details::PropertyBase &)
Definition: CondInputLoader.cxx:391
ServiceHandle< IIOVSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
TScopeAdapter
Definition: RootType.h:119
TScopeAdapter::BaseAt
TBaseAdapter BaseAt(size_t nth) const
Definition: RootType.cxx:773
beamspotman.basename
basename
Definition: beamspotman.py:640