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 EventIDBase &now) 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 170 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 832 of file IOVSvc.cxx.

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

◆ createIOVTool() [1/2]

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

Definition at line 658 of file IOVSvc.cxx.

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

◆ createIOVTool() [2/2]

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

Definition at line 620 of file IOVSvc.cxx.

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

◆ 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 776 of file IOVSvc.cxx.

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

◆ fullProxyName() [2/2]

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

Definition at line 767 of file IOVSvc.cxx.

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

◆ 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 476 of file IOVSvc.cxx.

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

◆ getRangeFromDB() [2/2]

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

Get IOVRange from db for current event.

Definition at line 446 of file IOVSvc.cxx.

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

◆ getStoreNames()

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

Definition at line 801 of file IOVSvc.cxx.

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

◆ getTool() [1/5]

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

Definition at line 732 of file IOVSvc.cxx.

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

◆ getTool() [2/5]

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

Definition at line 714 of file IOVSvc.cxx.

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

◆ getTool() [3/5]

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

Definition at line 749 of file IOVSvc.cxx.

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

◆ getTool() [4/5]

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

Definition at line 668 of file IOVSvc.cxx.

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

◆ getTool() [5/5]

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

Definition at line 695 of file IOVSvc.cxx.

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

◆ 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 584 of file IOVSvc.cxx.

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

◆ 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 533 of file IOVSvc.cxx.

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

◆ regFcn() [2/3]

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

Definition at line 560 of file IOVSvc.cxx.

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

◆ 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 514 of file IOVSvc.cxx.

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

◆ 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 603 of file IOVSvc.cxx.

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

◆ 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 817 of file IOVSvc.cxx.

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

◆ 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 497 of file IOVSvc.cxx.

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

Member Data Documentation

◆ m_forceReset

BooleanProperty IOVSvc::m_forceReset
private

Definition at line 175 of file IOVSvc.h.

◆ m_lock

std::recursive_mutex IOVSvc::m_lock
mutableprivate

Definition at line 185 of file IOVSvc.h.

◆ m_partialPreLoadData

BooleanProperty IOVSvc::m_partialPreLoadData
private

Definition at line 174 of file IOVSvc.h.

◆ m_preLoadData

BooleanProperty IOVSvc::m_preLoadData
private

Definition at line 174 of file IOVSvc.h.

◆ m_preLoadExtensibleFolders

BooleanProperty IOVSvc::m_preLoadExtensibleFolders
private

Definition at line 174 of file IOVSvc.h.

◆ m_preLoadRanges

BooleanProperty IOVSvc::m_preLoadRanges
private

Definition at line 174 of file IOVSvc.h.

◆ m_sortKeys

BooleanProperty IOVSvc::m_sortKeys
private

Definition at line 175 of file IOVSvc.h.

◆ m_toolMap

toolMap IOVSvc::m_toolMap
private

Definition at line 171 of file IOVSvc.h.

◆ m_updateInterval

std::string IOVSvc::m_updateInterval
private

Definition at line 176 of file IOVSvc.h.

◆ p_CLIDSvc

ServiceHandle<IClassIDSvc> IOVSvc::p_CLIDSvc
private

Definition at line 179 of file IOVSvc.h.

◆ p_condSvc

ServiceHandle<ICondSvc> IOVSvc::p_condSvc
private

Definition at line 181 of file IOVSvc.h.

◆ p_detStore

ServiceHandle<StoreGateSvc> IOVSvc::p_detStore
private

Definition at line 180 of file IOVSvc.h.

◆ p_sgs

ServiceHandle<StoreGateSvc> IOVSvc::p_sgs
private

Definition at line 180 of file IOVSvc.h.

◆ p_toolSvc

ServiceHandle<IToolSvc> IOVSvc::p_toolSvc
private

Definition at line 178 of file IOVSvc.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
SGTest::store
TestStore store
Definition: TestStore.cxx:23
beamspotman.r
def r
Definition: beamspotman.py:672
TileDCSDataPlotter.dp
dp
Definition: TileDCSDataPlotter.py:842
CondContBase::typelessInsert
virtual StatusCode typelessInsert(const EventIDRange &r, void *obj, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Insert a new conditions object.
IOVSvc::getRangeFromDB
virtual StatusCode getRangeFromDB(const CLID &clid, const std::string &key, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa, const EventIDBase &now) const override
Get IOVRange from db for current event.
Definition: IOVSvc.cxx:446
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:407
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:174
IOVSvc::getTool
IIOVSvcTool * getTool(const std::string &storeName, bool createIF=true)
Definition: IOVSvc.cxx:668
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
IOVSvc::p_detStore
ServiceHandle< StoreGateSvc > p_detStore
Definition: IOVSvc.h:180
defaultStore
const std::string defaultStore
Definition: IOVSvc.cxx:33
extractSporadic.c1
c1
Definition: extractSporadic.py:133
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:185
python.RatesEmulationExample.lock
lock
Definition: RatesEmulationExample.py:148
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:171
IOVSvc::m_preLoadData
BooleanProperty m_preLoadData
Definition: IOVSvc.h:174
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:176
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:175
IOVSvc::p_toolSvc
ServiceHandle< IToolSvc > p_toolSvc
Definition: IOVSvc.h:178
python.handimod.now
now
Definition: handimod.py:674
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
IOVSvc::m_forceReset
BooleanProperty m_forceReset
Definition: IOVSvc.h:175
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:767
IIOVSvcTool::getStoreName
virtual const std::string & getStoreName() const =0
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
IOVSvc::p_CLIDSvc
ServiceHandle< IClassIDSvc > p_CLIDSvc
Definition: IOVSvc.h:179
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:240
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:180
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:181
SG::Storable_cast
T * Storable_cast(DataObject *pDObj, bool quiet=true, IRegisterTransient *irt=0, bool isConst=true)
Definition: StorableConversions.h:37
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 B' along the line B that's closest to a second line A.
Definition: GeoPrimitivesHelpers.h:347
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:174
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:23
IOVSvc::createIOVTool
virtual StatusCode createIOVTool(const std::string &storeName) override
Definition: IOVSvc.cxx:658
SG::DataProxy
Definition: DataProxy.h:45
IOVSvc::m_preLoadRanges
BooleanProperty m_preLoadRanges
Definition: IOVSvc.h:174
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
python.SystemOfUnits.L
float L
Definition: SystemOfUnits.py:92
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37