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

#include <IOVSvc.h>

Inheritance diagram for IOVSvc:
Collaboration diagram for IOVSvc:

Public Member Functions

 IOVSvc (const std::string &name, ISvcLocator *svc)
 
virtual ~IOVSvc ()
 
virtual StatusCode initialize () override
 
virtual StatusCode reinitialize () override
 
virtual StatusCode finalize () override
 
virtual StatusCode createIOVTool (const std::string &storeName) override
 
virtual std::vector< std::string > getStoreNames () const override
 
virtual StatusCode regFcn (SG::DataProxy *dp, const CallBackID &c, const IOVSvcCallBackFcn &fcn, bool trigger=false) override
 register callback functions More...
 
virtual StatusCode regFcn (const CallBackID &c1, const CallBackID &c2, const IOVSvcCallBackFcn &fcn2, bool trigger) override
 
virtual StatusCode regFcn (const std::string &toolName, const CallBackID &c2, const IOVSvcCallBackFcn &fcn2, bool trigger) override
 
virtual StatusCode setRange (const CLID &clid, const std::string &key, IOVRange &) override
 Update Range from dB. More...
 
virtual StatusCode setRange (const CLID &clid, const std::string &key, IOVRange &io, const std::string &storeName) override
 
virtual StatusCode getRange (const CLID &clid, const std::string &key, IOVRange &io) const override
 
virtual StatusCode regProxy (SG::DataProxy *proxy, const std::string &key, const std::string &storeName) override
 Subscribe method for DataProxy. key StoreGate key. More...
 
virtual StatusCode replaceProxy (SG::DataProxy *pOld, SG::DataProxy *pNew, const std::string &storeName) override
 replace a registered DataProxy with a new version More...
 
virtual StatusCode regProxy (const CLID &clid, const std::string &key, const std::string &storeName) override
 Another way to subscribe. More...
 
virtual StatusCode deregProxy (SG::DataProxy *proxy) override
 Deregister a DataProxy with the service. More...
 
virtual StatusCode deregProxy (const CLID &clid, const std::string &key) override
 Deregister a DataProxy with the service. More...
 
virtual StatusCode getRangeFromDB (const CLID &clid, const std::string &key, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa) const override
 Get IOVRange from db for current event. More...
 
virtual StatusCode getRangeFromDB (const CLID &clid, const std::string &key, const IOVTime &time, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa) const override
 Get IOVRange from db for a particular event. More...
 
virtual StatusCode setRangeInDB (const CLID &clid, const std::string &key, const IOVRange &range, const std::string &tag) override
 Set a particular IOVRange in db (and memory) More...
 
virtual StatusCode dropObjectFromDB (const CLID &clid, const std::string &key, const std::string &storeName) override
 Drop the associated object from the db and trigger reload. More...
 
virtual StatusCode preLoadTAD (const SG::TransientAddress *, const std::string &storeName) override
 supply a list of TADs whose proxies will be preloaded More...
 
virtual StatusCode preLoadDataTAD (const SG::TransientAddress *, const std::string &storeName) override
 supply a list of TADs whose data will be preloaded More...
 
virtual StatusCode getTriggeredTools (const std::string &key, std::set< std::string > &tools, const std::string &storeName) override
 return list of tools (or functions) that have been triggered by key will return FAILURE if no tools found, or no key found More...
 
virtual void resetAllProxies () override
 
virtual void ignoreProxy (const CLID &clid, const std::string &key, const std::string &storeName) override
 ignore proxy More...
 
virtual StatusCode createCondObj (CondContBase *, const DataObjID &, const EventIDBase &) override
 

Private Types

typedef std::map< std::string, IIOVSvcTool * > toolMap
 

Private Member Functions

StatusCode createIOVTool (const std::string &storeName, IIOVSvcTool *&tool)
 
IIOVSvcToolgetTool (const std::string &storeName, bool createIF=true)
 
IIOVSvcToolgetTool (const CLID &clid, const std::string &key) const
 
IIOVSvcToolgetTool (SG::DataProxy *proxy) const
 
IIOVSvcToolgetTool (const CallBackID &c1) const
 
IIOVSvcToolgetTool (const IAlgTool *ia) const
 
std::string fullProxyName (const SG::DataProxy *proxy) const
 
std::string fullProxyName (const CLID &clid, const std::string &key) const
 

Private Attributes

toolMap m_toolMap
 
BooleanProperty m_preLoadRanges
 
BooleanProperty m_preLoadData
 
BooleanProperty m_partialPreLoadData
 
BooleanProperty m_preLoadExtensibleFolders
 
BooleanProperty m_sortKeys
 
BooleanProperty m_forceReset
 
std::string m_updateInterval
 
ServiceHandle< IToolSvc > p_toolSvc
 
ServiceHandle< IClassIDSvc > p_CLIDSvc
 
ServiceHandle< StoreGateSvcp_sgs
 
ServiceHandle< StoreGateSvcp_detStore
 
ServiceHandle< ICondSvc > p_condSvc
 
std::recursive_mutex m_lock
 

Detailed Description

Definition at line 53 of file IOVSvc.h.

Member Typedef Documentation

◆ toolMap

typedef std::map< std::string, IIOVSvcTool* > IOVSvc::toolMap
private

Definition at line 169 of file IOVSvc.h.

Constructor & Destructor Documentation

◆ IOVSvc()

IOVSvc::IOVSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Definition at line 66 of file IOVSvc.cxx.

67  : base_class( name, svc ),
68  p_toolSvc("ToolSvc",name),
69  p_CLIDSvc("ClassIDSvc",name),
70  p_sgs("StoreGateSvc",name),
71  p_detStore("StoreGateSvc/DetectorStore",name),
72  p_condSvc("CondSvc",name)
73 {
74 
75  declareProperty("preLoadRanges",m_preLoadRanges=false);
76  declareProperty("preLoadData",m_preLoadData=false);
77  declareProperty("partialPreLoadData",m_partialPreLoadData=true);
78  declareProperty("preLoadExtensibleFolders", m_preLoadExtensibleFolders=true);
79  declareProperty("updateInterval", m_updateInterval="Event");
80  declareProperty("sortKeys",m_sortKeys=true);
81  declareProperty("forceResetAtBeginRun", m_forceReset=false);
82 
83 }

◆ ~IOVSvc()

IOVSvc::~IOVSvc ( )
virtual

Definition at line 87 of file IOVSvc.cxx.

87  {
88 
89 }

Member Function Documentation

◆ createCondObj()

StatusCode IOVSvc::createCondObj ( CondContBase ccb,
const DataObjID &  id,
const EventIDBase &  now 
)
overridevirtual

Definition at line 834 of file IOVSvc.cxx.

835  {
836 
837  ATH_MSG_DEBUG("createCondObj: id: " << id << " t: " << now << " valid: "
838  << ccb->valid(now));
839 
840  if (ccb->valid(now)) {
841  if (msgLvl(MSG::DEBUG)) {
842  EventIDRange r;
843  ccb->range(now,r);
844  ATH_MSG_DEBUG( " range " << r << " for " << id
845  << " is still valid at " << now );
846  }
847  return StatusCode::SUCCESS;
848  }
849 
850  IOVTime t(now.run_number(), now.lumi_block(), (long long)now.time_stamp()*1000000000+now.time_stamp_ns_offset());
851  IOVRange range;
852  std::string tag;
853  // remove storename from key
854  std::string sgKey = id.key();
855  auto sep = sgKey.find('+');
856  if (sep != std::string::npos) {
857  sgKey.erase(0,sep+1);
858  }
859 
860  std::unique_ptr<IOpaqueAddress> ioa;
861  if (getRangeFromDB(id.clid(), sgKey, t, range, tag, ioa).isFailure()) {
862  ATH_MSG_ERROR( "unable to get range from db for "
863  << id.clid() << " " << sgKey );
864  return StatusCode::FAILURE;
865  }
866 
867  //In case the conditons-container is a 'mixed' type, we need both run/lb and time-stamps in the range.
868  //Assume infinite IOV in the other dimension
869  EventIDRange eidRange(range);
870  if (ccb->keyType()==CondContBase::KeyType::MIXED) {
872  }
873  ATH_MSG_DEBUG( " new range for ID " << id << " : " << range
874  << " IOA: " << ioa.get());
875 
876  // If the start of the new range matches the start of the last range, then
877  // extend the last range rather than trying to insert a new range.
878  // This can happen when a folder is tagged as `extensible' in IOVDbSvc.
879  EventIDRange r;
880  if (ccb->range (eidRange.start(), r) &&
881  eventIDMatch (r.start(), eidRange.start()))
882  {
883  if (ccb->extendLastRange (eidRange).isSuccess()) {
884  return StatusCode::SUCCESS;
885  }
886  }
887 
888  if (ccb->proxy() == nullptr) {
889  // nb. We don't want to be holding the IOVSvc lock here,
890  // as SGImplSvc can call to IOVSvc with the store lock held.
891  SG::DataProxy* dp = p_detStore->proxy (id.clid(), sgKey);
892  ATH_MSG_DEBUG( " found DataProxy " << dp << " for " << id );
893  ccb->setProxy(dp);
894  }
895 
896  // this will talk to the IOVDbSvc, get current run/event from EventInfo
897  // object, load
898  SG::DataProxy* dp = ccb->proxy();
899  DataObject* dobj(0);
900  void* v(0);
901 
902  if (dp->store()->createObj(dp->loader(), ioa.get(), dobj).isFailure()) {
903  ATH_MSG_ERROR(" could not create a new DataObject ");
904  return StatusCode::FAILURE;
905  } else {
906  ATH_MSG_DEBUG(" created new obj at " << dobj );
907 
908  v = SG::Storable_cast(dobj, id.clid());
909  }
910 
911  // Free the DataBucket that was created along with the object we read.
912  if (DataBucketBase* dbb = dynamic_cast<DataBucketBase*> (dobj)) {
913  dbb->relinquish();
914  delete dobj;
915  dobj = 0;
916  }
917 
918  // Some data objects may be reference counted by the address.
919  // CondCont will take ownership of the object, but doesn't
920  // do refcounting. We'll have gotten a reference via the Storable_cast
921  // above, so it should be ok ... unless CondCont deletes
922  // the new object immediately instead of inserting.
923  // In that case, when we delete the address, it will
924  // follow an invalid pointer. So be sure to delete
925  // the address before the object is added to CondCont.
926  ioa.reset();
927 
928  // DataObject *d2 = static_cast<DataObject*>(v);
929 
930  ATH_MSG_DEBUG( " SG::Storable_cast to obj: " << v );
931 
932  StatusCode sc = ccb->typelessInsert (eidRange, v);
933  if (!sc.isSuccess()) {
934  ATH_MSG_ERROR("unable to insert Object at " << v << " into CondCont "
935  << ccb->id() << " for range " << eidRange );
936  return StatusCode::FAILURE;
937  }
939  // Disable this for now... IOVDbSvc can sometimes produce overlapping
940  // ranges.
941  //ATH_MSG_ERROR ("IOV range overlap.");
942  //return StatusCode::FAILURE;
943  }
944 
945  return sc;
946 
947 }

◆ createIOVTool() [1/2]

StatusCode IOVSvc::createIOVTool ( const std::string &  storeName)
overridevirtual

Definition at line 660 of file IOVSvc.cxx.

661 {
662  IIOVSvcTool* ist = nullptr;
663  return createIOVTool (storeName, ist);
664 }

◆ createIOVTool() [2/2]

StatusCode IOVSvc::createIOVTool ( const std::string &  storeName,
IIOVSvcTool *&  tool 
)
private

Definition at line 622 of file IOVSvc.cxx.

622  {
623 
624  std::string store(storeName);
625  std::string toolName("IOVSvcTool");
626  if (storeName == "default") store = defaultStore;
627 
628  // Append the store name if not default
629  if (store != defaultStore) {
630  toolName += '_';
631  toolName += store;
632  }
633 
634  ATH_MSG_DEBUG( "Creating " << toolName << " associated with store \"" << store
635  << "\"" );
636 
637  toolMap::iterator itr = m_toolMap.find( store );
638  if ( itr == m_toolMap.end() ) {
639  ist = nullptr;
640  if (p_toolSvc->retrieveTool( "IOVSvcTool/" + toolName, ist, this ).isFailure()) {
641  ATH_MSG_ERROR( "Unable to create IOVSvcTool associated with store \""
642  << store << "\"" );
643  return StatusCode::FAILURE;
644  } else {
645  m_toolMap[ store ] = ist;
646  ist->setStoreName( store );
647  return StatusCode::SUCCESS;
648  }
649  } else {
650  ATH_MSG_INFO( "an IOVSvcTool already exists associated with store \""
651  << store << "\"" );
652  ist = itr->second;
653  return StatusCode::SUCCESS;
654  }
655 
656 }

◆ deregProxy() [1/2]

StatusCode IOVSvc::deregProxy ( const CLID clid,
const std::string &  key 
)
overridevirtual

Deregister a DataProxy with the service.

Definition at line 226 of file IOVSvc.cxx.

226  {
227 
228 
229  std::lock_guard<std::recursive_mutex> lock(m_lock);
230  IIOVSvcTool *ist = getTool( clid, key );
231  if (ist == 0) {
232  ATH_MSG_ERROR( "deregProxy: no IOVSvcTool found for proxy "
233  << fullProxyName(clid,key) );
234  return StatusCode::FAILURE;
235  }
236 
237  return ist->deregProxy( clid, key );
238 
239 }

◆ deregProxy() [2/2]

StatusCode IOVSvc::deregProxy ( SG::DataProxy proxy)
overridevirtual

Deregister a DataProxy with the service.

Definition at line 205 of file IOVSvc.cxx.

205  {
206 
207 
208  std::lock_guard<std::recursive_mutex> lock(m_lock);
209  IIOVSvcTool *ist = getTool( proxy );
210  if (ist == 0) {
211  ATH_MSG_ERROR( "deregProxy: no IOVSvcTool found for proxy "
212  << fullProxyName( proxy ) );
213  return (StatusCode::FAILURE);
214  }
215 
216  return ist->deregProxy( proxy );
217 
218 }

◆ dropObjectFromDB()

StatusCode IOVSvc::dropObjectFromDB ( const CLID clid,
const std::string &  key,
const std::string &  storeName 
)
overridevirtual

Drop the associated object from the db and trigger reload.

Definition at line 389 of file IOVSvc.cxx.

390  {
391 
392  std::lock_guard<std::recursive_mutex> lock(m_lock);
393 
394  IIOVSvcTool *ist = getTool( clid, key );
395  if (ist == nullptr) {
396  ATH_MSG_ERROR( "dropObjectFromDB: no IOVSvcTool associated with store "
397  << storeName << " and failed to create one." );
398  return StatusCode::FAILURE;
399  }
400 
401  DataProxy* proxy = p_detStore->proxy(clid, key);
402  if (proxy == nullptr) {
403  ATH_MSG_DEBUG("Proxy for (clid: " << clid << " key: " << key << ") in store " << storeName
404  << " does not exist. Cannot drop associated object.");
405  return StatusCode::SUCCESS;
406  }
407 
408  // Set IOV in the past to trigger reload on next range check
409  IOVRange iovr(IOVTime(0, 0), IOVTime(0, 0));
410  ATH_CHECK( ist->setRange(clid, key, iovr) );
411 
412  IIOVDbSvc *iovDB = dynamic_cast<IIOVDbSvc*>(proxy->provider());
413  if (iovDB != nullptr) {
414  ATH_MSG_DEBUG("Dropping " << key << "via IOVDBSvc");
415  ATH_CHECK( iovDB->dropObject(key, /*resetCache=*/true) );
416  } else {
417  ATH_MSG_ERROR("dropObjectFromDB: Provider for " << key << " is not an IIOVDbSvc.");
418  return StatusCode::FAILURE;
419  }
420 
421  return StatusCode::SUCCESS;
422 }

◆ finalize()

StatusCode IOVSvc::finalize ( )
overridevirtual

Definition at line 118 of file IOVSvc.cxx.

119 {
120  ATH_MSG_DEBUG( "Service finalised successfully" );
121  return StatusCode::SUCCESS;
122 }

◆ fullProxyName() [1/2]

std::string IOVSvc::fullProxyName ( const CLID clid,
const std::string &  key 
) const
private

Definition at line 778 of file IOVSvc.cxx.

778  {
779 
780  std::string fullname, tname;
781  if (p_CLIDSvc->getTypeNameOfID( clid, tname ).isFailure()) {
782  fullname = "[";
783  fullname += std::to_string(clid);
784  fullname += '/';
785  fullname += key;
786  fullname += ']';
787  } else {
788  fullname = "[";
789  fullname += tname;
790  fullname += ':';
791  fullname += std::to_string(clid);
792  fullname += '/';
793  fullname += key;
794  fullname += ']';
795  }
796 
797  return fullname;
798 }

◆ fullProxyName() [2/2]

std::string IOVSvc::fullProxyName ( const SG::DataProxy proxy) const
private

Definition at line 769 of file IOVSvc.cxx.

769  {
770 
771  return fullProxyName(dp->clID(), dp->name());
772 
773 }

◆ getRange()

StatusCode IOVSvc::getRange ( const CLID clid,
const std::string &  key,
IOVRange io 
) const
overridevirtual

Definition at line 428 of file IOVSvc.cxx.

429  {
430 
431 
432  IIOVSvcTool *ist = getTool( clid, key );
433  if (ist == 0) {
434  ATH_MSG_ERROR( "getRange: proxy for " << fullProxyName(clid,key)
435  << " not registered" );
436  return StatusCode::FAILURE;
437  } else {
438  return ist->getRange( clid, key, iov );
439  }
440 
441 }

◆ getRangeFromDB() [1/2]

StatusCode IOVSvc::getRangeFromDB ( const CLID clid,
const std::string &  key,
const IOVTime time,
IOVRange range,
std::string &  tag,
std::unique_ptr< IOpaqueAddress > &  ioa 
) const
overridevirtual

Get IOVRange from db for a particular event.

Definition at line 478 of file IOVSvc.cxx.

481  {
482 
483  std::lock_guard<std::recursive_mutex> lock(m_lock);
484 
485  IIOVSvcTool *ist = getTool( clid, key );
486  if (ist == 0) {
487  ATH_MSG_ERROR( "getRangeFromDB: proxy for "
488  << fullProxyName(clid, key) << " not registered" );
489  return StatusCode::FAILURE;
490  } else {
491  return ist->getRangeFromDB( clid, key, time, range, tag, ioa );
492  }
493 
494 }

◆ getRangeFromDB() [2/2]

StatusCode IOVSvc::getRangeFromDB ( const CLID clid,
const std::string &  key,
IOVRange range,
std::string &  tag,
std::unique_ptr< IOpaqueAddress > &  ioa 
) const
overridevirtual

Get IOVRange from db for current event.

Definition at line 446 of file IOVSvc.cxx.

448  {
449 
450  std::lock_guard<std::recursive_mutex> lock(m_lock);
451 
452  IIOVSvcTool *ist = getTool( clid, key );
453  if (ist == 0) {
454  ATH_MSG_ERROR( "getRangeFromDB: proxy for "
455  << fullProxyName(clid,key) << " not registered" );
456  return StatusCode::FAILURE;
457  } else {
458 
459  //Get current time form thread-local context
460  const EventContext& context = Gaudi::Hive::currentContext();
461  const EventIDBase& eventID = context.eventID();
462  uint32_t event = eventID.lumi_block();
463  uint32_t run = eventID.run_number();
464  IOVTime curTime;
465  curTime.setRunEvent(run,event);
466  // get ns timestamp from event
467  curTime.setTimestamp(1000000000L*(uint64_t)eventID.time_stamp() + eventID.time_stamp_ns_offset());
468 
469 
470  return ist->getRangeFromDB( clid, key, range, tag, ioa, curTime );
471  }
472 
473 }

◆ getStoreNames()

std::vector< std::string > IOVSvc::getStoreNames ( ) const
overridevirtual

Definition at line 803 of file IOVSvc.cxx.

803  {
804 
805  std::vector<std::string> stores;
806 
807  toolMap::const_iterator itr = m_toolMap.begin();
808  for( ; itr!=m_toolMap.end(); ++itr) {
809  stores.push_back( itr->first );
810  }
811 
812  return stores;
813 
814 }

◆ getTool() [1/5]

IIOVSvcTool * IOVSvc::getTool ( const CallBackID c1) const
private

Definition at line 734 of file IOVSvc.cxx.

734  {
735 
736  IIOVSvcTool *ist(0);
737  toolMap::const_iterator itr = m_toolMap.begin();
738  for (; itr != m_toolMap.end(); ++itr) {
739  if (itr->second->holdsCallback( c1 )) {
740  ist = itr->second;
741  return ist;
742  }
743  }
744 
745  return ist;
746 
747 }

◆ getTool() [2/5]

IIOVSvcTool * IOVSvc::getTool ( const CLID clid,
const std::string &  key 
) const
private

Definition at line 716 of file IOVSvc.cxx.

716  {
717 
718  IIOVSvcTool *ist(0);
719  toolMap::const_iterator itr = m_toolMap.begin();
720  for (; itr != m_toolMap.end(); ++itr) {
721  if (itr->second->holdsProxy( clid, key )) {
722  ist = itr->second;
723  return ist;
724  }
725  }
726 
727  return ist;
728 
729 }

◆ getTool() [3/5]

IIOVSvcTool * IOVSvc::getTool ( const IAlgTool *  ia) const
private

Definition at line 751 of file IOVSvc.cxx.

751  {
752 
753  IIOVSvcTool *ist(0);
754  toolMap::const_iterator itr = m_toolMap.begin();
755  for (; itr != m_toolMap.end(); ++itr) {
756  if (itr->second->holdsAlgTool( ia )) {
757  ist = itr->second;
758  return ist;
759  }
760  }
761 
762  return ist;
763 
764 }

◆ getTool() [4/5]

IIOVSvcTool * IOVSvc::getTool ( const std::string &  storeName,
bool  createIF = true 
)
private

Definition at line 670 of file IOVSvc.cxx.

670  {
671 
672  std::string store(storeName);
673  if (storeName == "default") {
675  }
676 
677  toolMap::const_iterator itr = m_toolMap.find( store );
678  IIOVSvcTool *ist(0);
679  if ( itr == m_toolMap.end() ) {
680  ATH_MSG_INFO( "No IOVSvcTool associated with store \"" << store
681  << "\"" );
682 
683  if (createIF) {
684  createIOVTool(store, ist).ignore();
685  }
686 
687  } else {
688  ist = itr->second;
689  }
690 
691  return ist;
692 }

◆ getTool() [5/5]

IIOVSvcTool * IOVSvc::getTool ( SG::DataProxy proxy) const
private

Definition at line 697 of file IOVSvc.cxx.

697  {
698 
699 
700  IIOVSvcTool *ist(0);
701  toolMap::const_iterator itr = m_toolMap.begin();
702  for (; itr != m_toolMap.end(); ++itr) {
703  if (itr->second->holdsProxy( proxy )) {
704  ist = itr->second;
705  return ist;
706  }
707  }
708 
709  return ist;
710 
711 }

◆ getTriggeredTools()

StatusCode IOVSvc::getTriggeredTools ( const std::string &  key,
std::set< std::string > &  tools,
const std::string &  storeName 
)
overridevirtual

return list of tools (or functions) that have been triggered by key will return FAILURE if no tools found, or no key found

Definition at line 586 of file IOVSvc.cxx.

588  {
589 
590  IIOVSvcTool *ist = getTool( storeName, false );
591  if (ist == 0) {
592  ATH_MSG_ERROR( "getTriggeredTools: no store \"" << storeName
593  << "\" associated with any IOVSvcTool" );
594  return StatusCode::FAILURE;
595  } else {
596  return ist->getTriggeredTools(key, tools);
597  }
598 
599 }

◆ ignoreProxy()

void IOVSvc::ignoreProxy ( const CLID clid,
const std::string &  key,
const std::string &  storeName 
)
overridevirtual

ignore proxy

Definition at line 247 of file IOVSvc.cxx.

248  {
249 
250 
251  IIOVSvcTool *ist = getTool( storeName );
252  if (ist == 0) {
253  ATH_MSG_ERROR( "ignoreProxy: no IOVSvcTool found for store "
254  << storeName << " and failed to create one" );
255  return;
256  }
257 
258  return ist->ignoreProxy( clid, key );
259 }

◆ initialize()

StatusCode IOVSvc::initialize ( )
overridevirtual

Definition at line 93 of file IOVSvc.cxx.

93  {
94 
95  msg().setLevel( m_outputLevel.value() );
96  ATH_MSG_DEBUG( "Initializing IOVSvc" );
97 
98  if (!p_sgs.isValid()) {
99  ATH_MSG_ERROR("could not get the Event Store");
100  return StatusCode::FAILURE;
101  }
102 
103  if (!p_detStore.isValid()) {
104  ATH_MSG_ERROR("could not get the Detector Store");
105  return StatusCode::FAILURE;
106  }
107 
108  if (!p_condSvc.isValid()) {
109  ATH_MSG_ERROR("could not get the ConditionSvc");
110  return StatusCode::FAILURE;
111  }
112 
113  return StatusCode::SUCCESS;
114 }

◆ preLoadDataTAD()

StatusCode IOVSvc::preLoadDataTAD ( const SG::TransientAddress tad,
const std::string &  storeName 
)
overridevirtual

supply a list of TADs whose data will be preloaded

add to a set of TADs that who's data will be preLoaded

Definition at line 311 of file IOVSvc.cxx.

312  {
313 
314  IIOVSvcTool *ist = getTool( storeName );
315  if (ist == 0) {
316  ATH_MSG_ERROR( "preLoadDataTAD: no IOVSvcTool associated with store \""
317  << storeName << "\" and failed to create one." );
318  return StatusCode::FAILURE;
319  } else {
320  return ist->preLoadDataTAD( tad );
321  }
322 
323 }

◆ preLoadTAD()

StatusCode IOVSvc::preLoadTAD ( const SG::TransientAddress tad,
const std::string &  storeName 
)
overridevirtual

supply a list of TADs whose proxies will be preloaded

add to a set of TADs that will be registered at start of first event

Definition at line 290 of file IOVSvc.cxx.

291  {
292 
293 
294  IIOVSvcTool *ist = getTool( storeName );
295  if (ist == 0) {
296  ATH_MSG_ERROR( "preLoadTAD: no IOVSvcTool associated with store \""
297  << storeName << "\" and failed to create one." );
298  return StatusCode::FAILURE;
299  } else {
300  return ist->preLoadTAD( tad );
301  }
302 
303 }

◆ regFcn() [1/3]

StatusCode IOVSvc::regFcn ( const CallBackID c1,
const CallBackID c2,
const IOVSvcCallBackFcn fcn2,
bool  trigger 
)
overridevirtual

Definition at line 535 of file IOVSvc.cxx.

537  {
538 
539 
540  if (c1 == c2) {
541  ATH_MSG_ERROR( "Cannot register 2nd callback function and assocaited"
542  << " object with itself" );
543  return StatusCode::FAILURE;
544  }
545 
546 
547  IIOVSvcTool *ist = getTool( c1 );
548  if (ist == 0) {
549  ATH_MSG_ERROR( "CallBack function \"" << c2.name()
550  << "\" cannot be registered since function \"" << c1.name()
551  << "\" has not been registered first" );
552  return StatusCode::FAILURE;
553  } else {
554  return ist->regFcn(c1, c2, fcn2, trigger);
555  }
556 
557 }

◆ regFcn() [2/3]

StatusCode IOVSvc::regFcn ( const std::string &  toolName,
const CallBackID c2,
const IOVSvcCallBackFcn fcn2,
bool  trigger 
)
overridevirtual

Definition at line 562 of file IOVSvc.cxx.

564  {
565 
566  IAlgTool *ia;
567  if ( p_toolSvc->retrieveTool(toolName, ia, 0, false).isFailure() ) {
568  ATH_MSG_ERROR( "AlgTool " << toolName << " has not yet been created"
569  << " and thus cannot be registered" );
570  return StatusCode::FAILURE;
571  }
572 
573  IIOVSvcTool *ist = getTool( ia );
574  if (ist == 0) {
575  ATH_MSG_ERROR( "No callback registered with AlgTool " << toolName );
576  return StatusCode::FAILURE;
577  } else {
578  return ist->regFcn(ia, c2, fcn2, trigger);
579  }
580 
581 }

◆ regFcn() [3/3]

StatusCode IOVSvc::regFcn ( SG::DataProxy dp,
const CallBackID c,
const IOVSvcCallBackFcn fcn,
bool  trigger = false 
)
overridevirtual

register callback functions

Definition at line 516 of file IOVSvc.cxx.

519  {
520 
521  IIOVSvcTool *ist = getTool( dp );
522  if (ist == 0) {
523  ATH_MSG_ERROR( "regFcn: no IOVSvcTool found containing DataProxy "
524  << fullProxyName( dp )
525  << "-> Need to bind DataHandle first" );
526  return StatusCode::FAILURE;
527  } else {
528  return ist->regFcn( dp, c, fcn, trigger );
529  }
530 
531 }

◆ regProxy() [1/2]

StatusCode IOVSvc::regProxy ( const CLID clid,
const std::string &  key,
const std::string &  storeName 
)
overridevirtual

Another way to subscribe.

Register a DataProxy with the service.

Definition at line 167 of file IOVSvc.cxx.

168  {
169 
170  std::lock_guard<std::recursive_mutex> lock(m_lock);
171  IIOVSvcTool *ist = getTool( storeName );
172  if (ist == 0) {
173  ATH_MSG_ERROR( "regProxy: no IOVSvcTool associated with store \""
174  << storeName << "\" and failed to create one." );
175  return (StatusCode::FAILURE);
176  }
177 
178  IIOVSvcTool *ist2 = getTool( clid, key );
179  if (ist2 != 0) {
180  if (ist2 != ist) {
181  ATH_MSG_ERROR( "regProxy: when registering proxy for "
182  << fullProxyName(clid,key)
183  << " with store " << storeName
184  << ", it is already registered with store \""
185  << ist2->getStoreName() << "\"" );
186  return StatusCode::FAILURE;
187  } else {
188  ATH_MSG_DEBUG( "regProxy: proxy for " << fullProxyName(clid,key)
189  << " already registered with store \"" << storeName << "\""
190  );
191  return StatusCode::SUCCESS;
192  }
193  }
194 
195  return ist->regProxy( clid, key );
196 
197 }

◆ regProxy() [2/2]

StatusCode IOVSvc::regProxy ( SG::DataProxy proxy,
const std::string &  key,
const std::string &  storeName 
)
overridevirtual

Subscribe method for DataProxy. key StoreGate key.

Register a DataProxy with the service.

Definition at line 130 of file IOVSvc.cxx.

131  {
132 
133  std::lock_guard<std::recursive_mutex> lock(m_lock);
134  IIOVSvcTool *ist = getTool( storeName );
135  if (ist == 0) {
136  ATH_MSG_ERROR( "regProxy: no IOVSvcTool associated with store \""
137  << storeName << "\" and failed to create one" );
138  return (StatusCode::FAILURE);
139  }
140 
141  IIOVSvcTool *ist2 = getTool( proxy );
142  if (ist2 != 0) {
143  if (ist2 != ist) {
144  ATH_MSG_ERROR( "regProxy: when registering proxy for "
145  << fullProxyName(proxy) << " with store \"" << storeName
146  << "\", it is already registered with store \""
147  << ist2->getStoreName() << "\"" );
148  return StatusCode::FAILURE;
149  } else {
150  ATH_MSG_DEBUG( "regProxy: proxy for " << fullProxyName(proxy)
151  << " already registered with store \"" << storeName << "\""
152  );
153  return StatusCode::SUCCESS;
154  }
155  }
156 
157  return ist->regProxy( proxy, key );
158 
159 }

◆ reinitialize()

StatusCode IOVSvc::reinitialize ( )
overridevirtual

Definition at line 605 of file IOVSvc.cxx.

606 {
607  // Set flag to reset all proxies
608  StatusCode sc;
609  toolMap::iterator itr = m_toolMap.begin();
610  for ( ; itr!=m_toolMap.end(); ++itr) {
611  sc &= itr->second->reinitialize();
612  }
613  return sc;
614 
615 }

◆ replaceProxy()

StatusCode IOVSvc::replaceProxy ( SG::DataProxy pOld,
SG::DataProxy pNew,
const std::string &  storeName 
)
overridevirtual

replace a registered DataProxy with a new version

Replace a registered DataProxy with a new version.

Definition at line 268 of file IOVSvc.cxx.

269  {
270 
271  StatusCode sc(StatusCode::FAILURE);
272  IIOVSvcTool *ist = getTool( storeName );
273  if (0 != ist) {
274  sc = ist->replaceProxy(pOld, pNew);
275  } else {
276  ATH_MSG_ERROR( "regProxy: no IOVSvcTool associated with store \""
277  << storeName << "\" and failed to create one." );
278  }
279  return sc;
280 }

◆ resetAllProxies()

void IOVSvc::resetAllProxies ( )
overridevirtual

Definition at line 819 of file IOVSvc.cxx.

819  {
820 
821  toolMap::iterator itr = m_toolMap.begin();
822  for (; itr!= m_toolMap.end(); ++itr) {
823  IIOVSvcTool* ist = itr->second;
824  ATH_MSG_DEBUG( "resetting all proxies for store \""
825  << ist->getStoreName() << "\"" );
826  ist->resetAllProxies();
827  }
828 
829 }

◆ setRange() [1/2]

StatusCode IOVSvc::setRange ( const CLID clid,
const std::string &  key,
IOVRange iovr 
)
overridevirtual

Update Range from dB.

Definition at line 328 of file IOVSvc.cxx.

329  {
330 
331  std::lock_guard<std::recursive_mutex> lock(m_lock);
332 
333  IIOVSvcTool *ist = getTool( clid, key );
334  if (ist == 0) {
335 
336  // FIXME - this should be eliminated once the IOVDbSvc is set up to
337  // use store names. There should be no default store for setRange
338 
339  ATH_MSG_WARNING( "setRange(CLID,key,range) for unregistered proxies "
340  << "is deprecated - you need to specify a store! "
341  << "This will be an ERROR soon!" );
342 
343  return setRange(clid,key,iovr, defaultStore );
344 
345  } else {
346  return ist->setRange( clid, key, iovr );
347  }
348 
349 }

◆ setRange() [2/2]

StatusCode IOVSvc::setRange ( const CLID clid,
const std::string &  key,
IOVRange io,
const std::string &  storeName 
)
overridevirtual

Definition at line 354 of file IOVSvc.cxx.

355  {
356 
357  std::lock_guard<std::recursive_mutex> lock(m_lock);
358 
359  IIOVSvcTool *ist = getTool( storeName );
360  if (ist == 0) {
361  ATH_MSG_ERROR( "setRange: no IOVSvcTool associated with store \""
362  << storeName << "\" and failed to create one." );
363  return StatusCode::FAILURE;
364  }
365 
366  IIOVSvcTool *ist2 = getTool( clid, key );
367  if (ist2 == 0) {
368  ATH_MSG_INFO( "setRange: proxy for " << fullProxyName(clid,key)
369  << " not registered with store \"" << storeName << "\". Doing it now"
370  );
371  if (ist->regProxy(clid, key).isFailure()) {
372  return StatusCode::FAILURE;
373  }
374  } else if (ist2 != ist) {
375  ATH_MSG_INFO( "setRange: when registering proxy (clid: "
376  << clid << " key: " << key << ") with store \"" << storeName
377  << "\" --> already registered with store \"" << ist2->getStoreName()
378  << "\"" );
379  return StatusCode::FAILURE;
380  }
381 
382  return ist->setRange( clid, key, iovr );
383 
384 }

◆ setRangeInDB()

StatusCode IOVSvc::setRangeInDB ( const CLID clid,
const std::string &  key,
const IOVRange range,
const std::string &  tag 
)
overridevirtual

Set a particular IOVRange in db (and memory)

Definition at line 499 of file IOVSvc.cxx.

500  {
501 
502  IIOVSvcTool *ist = getTool( clid, key );
503  if (ist == 0) {
504  ATH_MSG_ERROR( "setRangeInDB: proxy for "
505  << fullProxyName(clid,key) << " not registered" );
506  return StatusCode::FAILURE;
507  } else {
508  return ist->setRangeInDB( clid, key, range, tag );
509  }
510 
511 }

Member Data Documentation

◆ m_forceReset

BooleanProperty IOVSvc::m_forceReset
private

Definition at line 174 of file IOVSvc.h.

◆ m_lock

std::recursive_mutex IOVSvc::m_lock
mutableprivate

Definition at line 184 of file IOVSvc.h.

◆ m_partialPreLoadData

BooleanProperty IOVSvc::m_partialPreLoadData
private

Definition at line 173 of file IOVSvc.h.

◆ m_preLoadData

BooleanProperty IOVSvc::m_preLoadData
private

Definition at line 173 of file IOVSvc.h.

◆ m_preLoadExtensibleFolders

BooleanProperty IOVSvc::m_preLoadExtensibleFolders
private

Definition at line 173 of file IOVSvc.h.

◆ m_preLoadRanges

BooleanProperty IOVSvc::m_preLoadRanges
private

Definition at line 173 of file IOVSvc.h.

◆ m_sortKeys

BooleanProperty IOVSvc::m_sortKeys
private

Definition at line 174 of file IOVSvc.h.

◆ m_toolMap

toolMap IOVSvc::m_toolMap
private

Definition at line 170 of file IOVSvc.h.

◆ m_updateInterval

std::string IOVSvc::m_updateInterval
private

Definition at line 175 of file IOVSvc.h.

◆ p_CLIDSvc

ServiceHandle<IClassIDSvc> IOVSvc::p_CLIDSvc
private

Definition at line 178 of file IOVSvc.h.

◆ p_condSvc

ServiceHandle<ICondSvc> IOVSvc::p_condSvc
private

Definition at line 180 of file IOVSvc.h.

◆ p_detStore

ServiceHandle<StoreGateSvc> IOVSvc::p_detStore
private

Definition at line 179 of file IOVSvc.h.

◆ p_sgs

ServiceHandle<StoreGateSvc> IOVSvc::p_sgs
private

Definition at line 179 of file IOVSvc.h.

◆ p_toolSvc

ServiceHandle<IToolSvc> IOVSvc::p_toolSvc
private

Definition at line 177 of file IOVSvc.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
beamspotman.r
def r
Definition: beamspotman.py:676
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:71
TileDCSDataPlotter.dp
dp
Definition: TileDCSDataPlotter.py:840
CondContBase::typelessInsert
virtual StatusCode typelessInsert(const EventIDRange &r, void *obj, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Insert a new conditions object.
IIOVSvcTool::preLoadTAD
virtual StatusCode preLoadTAD(const SG::TransientAddress *)=0
IIOVSvcTool::setRangeInDB
virtual StatusCode setRangeInDB(const CLID &clid, const std::string &key, const IOVRange &range, const std::string &tag)=0
dqt_zlumi_alleff_HIST.iov
iov
Definition: dqt_zlumi_alleff_HIST.py:119
IOVRange
Validity Range object. Holds two IOVTimes (start and stop)
Definition: IOVRange.h:30
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DataBucketBase
A non-templated base class for DataBucket, allows to access the transient object address as a void*.
Definition: DataBucketBase.h:24
IOVSvc::m_partialPreLoadData
BooleanProperty m_partialPreLoadData
Definition: IOVSvc.h:173
IOVSvc::getTool
IIOVSvcTool * getTool(const std::string &storeName, bool createIF=true)
Definition: IOVSvc.cxx:670
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
IOVSvc::p_detStore
ServiceHandle< StoreGateSvc > p_detStore
Definition: IOVSvc.h:179
defaultStore
const std::string defaultStore
Definition: IOVSvc.cxx:33
extractSporadic.c1
c1
Definition: extractSporadic.py:134
IOVInfiniteRange::infiniteMixed
static EventIDRange infiniteMixed()
Produces an mixed EventIDRange that is infinite in Time and RunLumi.
Definition: IOVInfiniteRange.h:55
IOVSvc::m_lock
std::recursive_mutex m_lock
Definition: IOVSvc.h:184
CondContBase::keyType
KeyType keyType() const
Return the key type for this container.
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
CondContBase::valid
virtual bool valid(const EventIDBase &t) const =0
Test to see if a given IOV time is mapped in the container.
IIOVDbSvc
Abstract interface to IOVDbSvc to access IOVRange and tag information.
Definition: IIOVDbSvc.h:38
IOVSvc::m_toolMap
toolMap m_toolMap
Definition: IOVSvc.h:170
IOVSvc::m_preLoadData
BooleanProperty m_preLoadData
Definition: IOVSvc.h:173
IIOVSvcTool::ignoreProxy
virtual void ignoreProxy(SG::DataProxy *proxy)=0
IIOVSvcTool::getTriggeredTools
virtual StatusCode getTriggeredTools(const std::string &key, std::set< std::string > &tools)=0
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
IIOVSvcTool::deregProxy
virtual StatusCode deregProxy(SG::DataProxy *proxy)=0
IOVSvc::m_updateInterval
std::string m_updateInterval
Definition: IOVSvc.h:175
IIOVSvcTool
Definition: IIOVSvcTool.h:27
IOVTime
Basic time unit for IOVSvc. Hold time as a combination of run and event numbers.
Definition: IOVTime.h:33
IOVSvc::m_sortKeys
BooleanProperty m_sortKeys
Definition: IOVSvc.h:174
IOVSvc::p_toolSvc
ServiceHandle< IToolSvc > p_toolSvc
Definition: IOVSvc.h:177
python.handimod.now
now
Definition: handimod.py:675
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
IOVSvc::getRangeFromDB
virtual StatusCode getRangeFromDB(const CLID &clid, const std::string &key, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa) const override
Get IOVRange from db for current event.
Definition: IOVSvc.cxx:446
IOVSvc::m_forceReset
BooleanProperty m_forceReset
Definition: IOVSvc.h:174
IIOVSvcTool::resetAllProxies
virtual void resetAllProxies()=0
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
CondContBase::range
virtual bool range(const EventIDBase &t, EventIDRange &r) const =0
Return the mapped validity range for an IOV time.
CondContBase::id
const DataObjID & id() const
Return CLID/key corresponding to this container.
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
IOVSvc::fullProxyName
std::string fullProxyName(const SG::DataProxy *proxy) const
Definition: IOVSvc.cxx:769
IIOVSvcTool::getStoreName
virtual const std::string & getStoreName() const =0
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
IOVSvc::p_CLIDSvc
ServiceHandle< IClassIDSvc > p_CLIDSvc
Definition: IOVSvc.h:178
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IIOVDbSvc::dropObject
virtual bool dropObject(const std::string &key, const bool resetCache=false)=0
run
Definition: run.py:1
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
IOVTime::setTimestamp
void setTimestamp(uint64_t timestamp) noexcept
Definition: IOVTime.cxx:72
IIOVSvcTool::replaceProxy
virtual StatusCode replaceProxy(SG::DataProxy *pOld, SG::DataProxy *pNew)=0
IIOVSvcTool::getRangeFromDB
virtual StatusCode getRangeFromDB(const CLID &clid, const std::string &key, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa, const IOVTime &curTime) const =0
IOVSvc::setRange
virtual StatusCode setRange(const CLID &clid, const std::string &key, IOVRange &) override
Update Range from dB.
Definition: IOVSvc.cxx:328
grepfile.sep
sep
Definition: grepfile.py:38
tools
Definition: DataQuality/ZLumiScripts/python/tools/__init__.py:1
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
CondContBase::extendLastRange
virtual StatusCode extendLastRange(const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Extend the range of the last IOV.
CondContBase::KeyType::MIXED
@ MIXED
Mixed Run+lbn / timestamp container.
CondContBase::Category::isOverlap
static bool isOverlap(code_t code)
Helper to test whether a code is OVERLAP.
Definition: CondCont.cxx:242
IIOVSvcTool::getRange
virtual StatusCode getRange(const CLID &clid, const std::string &key, IOVRange &iov) const =0
IOVSvc::p_sgs
ServiceHandle< StoreGateSvc > p_sgs
Definition: IOVSvc.h:179
python.PyAthena.v
v
Definition: PyAthena.py:154
python.DataFormatRates.c2
c2
Definition: DataFormatRates.py:123
IOVSvc::p_condSvc
ServiceHandle< ICondSvc > p_condSvc
Definition: IOVSvc.h:180
SG::Storable_cast
T * Storable_cast(DataObject *pDObj, bool quiet=true, IRegisterTransient *irt=0, bool isConst=true)
Definition: StorableConversions.h:47
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
Amg::intersect
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point of closest approach of two lines.
Definition: GeoPrimitivesHelpers.h:325
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
IIOVSvcTool::regFcn
virtual StatusCode regFcn(SG::DataProxy *dp, const CallBackID &c, const IOVSvcCallBackFcn &fcn, bool trigger)=0
DEBUG
#define DEBUG
Definition: page_access.h:11
IOVTime::setRunEvent
void setRunEvent(uint32_t run, uint32_t event) noexcept
Definition: IOVTime.cxx:96
IOVSvc::m_preLoadExtensibleFolders
BooleanProperty m_preLoadExtensibleFolders
Definition: IOVSvc.h:173
IIOVSvcTool::preLoadDataTAD
virtual StatusCode preLoadDataTAD(const SG::TransientAddress *)=0
CondContBase::setProxy
void setProxy(SG::DataProxy *)
Set the associated DataProxy.
Definition: CondCont.cxx:276
IIOVSvcTool::regProxy
virtual StatusCode regProxy(SG::DataProxy *proxy, const std::string &key)=0
CondContBase::proxy
SG::DataProxy * proxy()
Return the associated DataProxy, if any.
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
IOVSvc::createIOVTool
virtual StatusCode createIOVTool(const std::string &storeName) override
Definition: IOVSvc.cxx:660
SG::DataProxy
Definition: DataProxy.h:44
IOVSvc::m_preLoadRanges
BooleanProperty m_preLoadRanges
Definition: IOVSvc.h:173
python.compressB64.c
def c
Definition: compressB64.py:93
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
IIOVSvcTool::setRange
virtual StatusCode setRange(const CLID &clid, const std::string &key, IOVRange &)=0
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37