|
ATLAS Offline Software
|
Go to the documentation of this file.
18 #include "GaudiKernel/ISvcLocator.h"
19 #include "GaudiKernel/IAlgTool.h"
20 #include "GaudiKernel/IToolSvc.h"
21 #include "GaudiKernel/IClassIDSvc.h"
22 #include "GaudiKernel/IConversionSvc.h"
44 bool eventIDMatch (
const EventIDBase&
e1,
const EventIDBase&
e2)
47 if (
e1.run_number() !=
e2.run_number())
return false;
48 if (
e1.lumi_block() !=
e2.lumi_block())
return false;
50 if (
e1.isTimeStamp()) {
51 if (
e1.time_stamp() !=
e2.time_stamp())
return false;
52 if (
e1.time_stamp_ns_offset() !=
e2.time_stamp_ns_offset())
return false;
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)
81 declareProperty(
"forceResetAtBeginRun",
m_forceReset=
false);
95 msg().setLevel( m_outputLevel.value() );
98 if (!
p_sgs.isValid()) {
100 return StatusCode::FAILURE;
105 return StatusCode::FAILURE;
110 return StatusCode::FAILURE;
113 return StatusCode::SUCCESS;
121 return StatusCode::SUCCESS;
131 const std::string& storeName ) {
133 std::lock_guard<std::recursive_mutex> lock(
m_lock);
136 ATH_MSG_ERROR(
"regProxy: no IOVSvcTool associated with store \""
137 << storeName <<
"\" and failed to create one" );
138 return (StatusCode::FAILURE);
146 <<
"\", it is already registered with store \""
148 return StatusCode::FAILURE;
151 <<
" already registered with store \"" << storeName <<
"\""
153 return StatusCode::SUCCESS;
168 const std::string& storeName ) {
170 std::lock_guard<std::recursive_mutex> lock(
m_lock);
173 ATH_MSG_ERROR(
"regProxy: no IOVSvcTool associated with store \""
174 << storeName <<
"\" and failed to create one." );
175 return (StatusCode::FAILURE);
183 <<
" with store " << storeName
184 <<
", it is already registered with store \""
186 return StatusCode::FAILURE;
189 <<
" already registered with store \"" << storeName <<
"\""
191 return StatusCode::SUCCESS;
208 std::lock_guard<std::recursive_mutex> lock(
m_lock);
213 return (StatusCode::FAILURE);
229 std::lock_guard<std::recursive_mutex> lock(
m_lock);
234 return StatusCode::FAILURE;
248 const std::string& storeName ) {
254 << storeName <<
" and failed to create one" );
269 const std::string& storeName ) {
276 ATH_MSG_ERROR(
"regProxy: no IOVSvcTool associated with store \""
277 << storeName <<
"\" and failed to create one." );
291 const std::string& storeName ) {
296 ATH_MSG_ERROR(
"preLoadTAD: no IOVSvcTool associated with store \""
297 << storeName <<
"\" and failed to create one." );
298 return StatusCode::FAILURE;
312 const std::string& storeName ) {
316 ATH_MSG_ERROR(
"preLoadDataTAD: no IOVSvcTool associated with store \""
317 << storeName <<
"\" and failed to create one." );
318 return StatusCode::FAILURE;
331 std::lock_guard<std::recursive_mutex> lock(
m_lock);
340 <<
"is deprecated - you need to specify a store! "
341 <<
"This will be an ERROR soon!" );
355 IOVRange& iovr,
const std::string& storeName) {
357 std::lock_guard<std::recursive_mutex> lock(
m_lock);
361 ATH_MSG_ERROR(
"setRange: no IOVSvcTool associated with store \""
362 << storeName <<
"\" and failed to create one." );
363 return StatusCode::FAILURE;
369 <<
" not registered with store \"" << storeName <<
"\". Doing it now"
372 return StatusCode::FAILURE;
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()
379 return StatusCode::FAILURE;
390 const std::string& storeName) {
392 std::lock_guard<std::recursive_mutex> lock(
m_lock);
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;
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;
413 if (iovDB !=
nullptr) {
417 ATH_MSG_ERROR(
"dropObjectFromDB: Provider for " <<
key <<
" is not an IIOVDbSvc.");
418 return StatusCode::FAILURE;
421 return StatusCode::SUCCESS;
435 <<
" not registered" );
436 return StatusCode::FAILURE;
448 std::unique_ptr<IOpaqueAddress>& ioa)
const {
450 std::lock_guard<std::recursive_mutex> lock(
m_lock);
456 return StatusCode::FAILURE;
460 const EventContext& context = Gaudi::Hive::currentContext();
461 const EventIDBase& eventID = context.eventID();
462 uint32_t event = eventID.lumi_block();
467 curTime.
setTimestamp(1000000000L*(
uint64_t)eventID.time_stamp() + eventID.time_stamp_ns_offset());
481 std::unique_ptr<IOpaqueAddress>& ioa)
const {
483 std::lock_guard<std::recursive_mutex> lock(
m_lock);
489 return StatusCode::FAILURE;
506 return StatusCode::FAILURE;
523 ATH_MSG_ERROR(
"regFcn: no IOVSvcTool found containing DataProxy "
525 <<
"-> Need to bind DataHandle first" );
526 return StatusCode::FAILURE;
528 return ist->
regFcn(
dp,
c, fcn, trigger );
541 ATH_MSG_ERROR(
"Cannot register 2nd callback function and assocaited"
542 <<
" object with itself" );
543 return StatusCode::FAILURE;
550 <<
"\" cannot be registered since function \"" <<
c1.name()
551 <<
"\" has not been registered first" );
552 return StatusCode::FAILURE;
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;
575 ATH_MSG_ERROR(
"No callback registered with AlgTool " << toolName );
576 return StatusCode::FAILURE;
578 return ist->
regFcn(ia,
c2, fcn2, trigger);
587 std::set<std::string>&
tools,
588 const std::string& storeName) {
593 <<
"\" associated with any IOVSvcTool" );
594 return StatusCode::FAILURE;
611 sc &= itr->second->reinitialize();
624 std::string
store(storeName);
625 std::string toolName(
"IOVSvcTool");
640 if (
p_toolSvc->retrieveTool(
"IOVSvcTool/" + toolName, ist,
this ).isFailure()) {
641 ATH_MSG_ERROR(
"Unable to create IOVSvcTool associated with store \""
643 return StatusCode::FAILURE;
647 return StatusCode::SUCCESS;
650 ATH_MSG_INFO(
"an IOVSvcTool already exists associated with store \""
653 return StatusCode::SUCCESS;
672 std::string
store(storeName);
673 if (storeName ==
"default") {
701 toolMap::const_iterator itr =
m_toolMap.begin();
703 if (itr->second->holdsProxy(
proxy )) {
719 toolMap::const_iterator itr =
m_toolMap.begin();
721 if (itr->second->holdsProxy( clid,
key )) {
737 toolMap::const_iterator itr =
m_toolMap.begin();
739 if (itr->second->holdsCallback(
c1 )) {
754 toolMap::const_iterator itr =
m_toolMap.begin();
756 if (itr->second->holdsAlgTool( ia )) {
780 std::string fullname, tname;
781 if (
p_CLIDSvc->getTypeNameOfID( clid, tname ).isFailure()) {
802 std::vector<std::string>
805 std::vector<std::string> stores;
807 toolMap::const_iterator itr =
m_toolMap.begin();
809 stores.push_back( itr->first );
835 const EventIDBase&
now) {
845 <<
" is still valid at " <<
now );
847 return StatusCode::SUCCESS;
850 IOVTime t(
now.run_number(),
now.lumi_block(), (
long long)
now.time_stamp()*1000000000+
now.time_stamp_ns_offset());
854 std::string sgKey =
id.key();
855 auto sep = sgKey.find(
'+');
856 if (
sep != std::string::npos) {
857 sgKey.erase(0,
sep+1);
860 std::unique_ptr<IOpaqueAddress> ioa;
863 <<
id.clid() <<
" " << sgKey );
864 return StatusCode::FAILURE;
869 EventIDRange eidRange(
range);
874 <<
" IOA: " << ioa.get());
880 if (ccb->
range (eidRange.start(),
r) &&
881 eventIDMatch (
r.start(), eidRange.start()))
884 return StatusCode::SUCCESS;
888 if (ccb->
proxy() ==
nullptr) {
902 if (
dp->store()->createObj(
dp->loader(), ioa.get(), dobj).isFailure()) {
904 return StatusCode::FAILURE;
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;
JetConstituentVector::iterator iterator
virtual StatusCode typelessInsert(const EventIDRange &r, void *obj, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Insert a new conditions object.
Validity Range object. Holds two IOVTimes (start and stop)
A non-templated base class for DataBucket, allows to access the transient object address as a void*.
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)
BooleanProperty m_partialPreLoadData
IIOVSvcTool * getTool(const std::string &storeName, bool createIF=true)
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling
ServiceHandle< StoreGateSvc > p_detStore
virtual StatusCode createCondObj(CondContBase *, const DataObjID &, const EventIDBase &) override
const std::string defaultStore
static EventIDRange infiniteMixed()
Produces an mixed EventIDRange that is infinite in Time and RunLumi.
std::recursive_mutex m_lock
virtual StatusCode reinitialize() override
KeyType keyType() const
Return the key type for this container.
virtual bool valid(const EventIDBase &t) const =0
Test to see if a given IOV time is mapped in the container.
Abstract interface to IOVDbSvc to access IOVRange and tag information.
Abstract interface to IOVDbSvc to access IOVRange and tag information.
BooleanProperty m_preLoadData
virtual StatusCode getRange(const CLID &clid, const std::string &key, IOVRange &io) const override
virtual StatusCode regFcn(SG::DataProxy *dp, const CallBackID &c, const IOVSvcCallBackFcn &fcn, bool trigger=false) override
register callback functions
virtual StatusCode initialize() override
std::string m_updateInterval
Basic time unit for IOVSvc. Hold time as a combination of run and event numbers.
BooleanProperty m_sortKeys
ServiceHandle< IToolSvc > p_toolSvc
virtual std::vector< std::string > getStoreNames() const override
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 f...
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.
BooleanProperty m_forceReset
POOL::TEvent event(POOL::TEvent::kClassAccess)
virtual bool range(const EventIDBase &t, EventIDRange &r) const =0
Return the mapped validity range for an IOV time.
const DataObjID & id() const
Return CLID/key corresponding to this container.
::StatusCode StatusCode
StatusCode definition for legacy code.
std::string fullProxyName(const SG::DataProxy *proxy) const
Base class for all conditions containers.
boost::function< StatusCode(IOVSVC_CALLBACK_ARGS) > IOVSvcCallBackFcn
the type of an IOVSvc call back: it wraps both the method and the object the method is called on
ServiceHandle< IClassIDSvc > p_CLIDSvc
virtual StatusCode preLoadDataTAD(const SG::TransientAddress *, const std::string &storeName) override
supply a list of TADs whose data will be preloaded
virtual bool dropObject(const std::string &key, const bool resetCache=false)=0
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.
AthROOTErrorHandlerSvc * svc
void setTimestamp(uint64_t timestamp) noexcept
uint32_t CLID
The Class ID type.
virtual StatusCode setRange(const CLID &clid, const std::string &key, IOVRange &) override
Update Range from dB.
std::string to_string(const DetectorType &type)
virtual StatusCode extendLastRange(const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Extend the range of the last IOV.
@ MIXED
Mixed Run+lbn / timestamp container.
static bool isOverlap(code_t code)
Helper to test whether a code is OVERLAP.
ServiceHandle< StoreGateSvc > p_sgs
virtual StatusCode regProxy(SG::DataProxy *proxy, const std::string &key, const std::string &storeName) override
Subscribe method for DataProxy. key StoreGate key.
ServiceHandle< ICondSvc > p_condSvc
T * Storable_cast(DataObject *pDObj, bool quiet=true, IRegisterTransient *irt=0, bool isConst=true)
def time(flags, cells_name, *args, **kw)
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
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.
IOVSvc(const std::string &name, ISvcLocator *svc)
#define ATH_MSG_WARNING(x)
virtual StatusCode finalize() override
void setRunEvent(uint32_t run, uint32_t event) noexcept
BooleanProperty m_preLoadExtensibleFolders
virtual StatusCode deregProxy(SG::DataProxy *proxy) override
Deregister a DataProxy with the service.
void setProxy(SG::DataProxy *)
Set the associated DataProxy.
virtual void resetAllProxies() override
SG::DataProxy * proxy()
Return the associated DataProxy, if any.
virtual StatusCode createIOVTool(const std::string &storeName) override
virtual StatusCode replaceProxy(SG::DataProxy *pOld, SG::DataProxy *pNew, const std::string &storeName) override
replace a registered DataProxy with a new version
BooleanProperty m_preLoadRanges
virtual StatusCode preLoadTAD(const SG::TransientAddress *, const std::string &storeName) override
supply a list of TADs whose proxies will be preloaded
virtual void ignoreProxy(const CLID &clid, const std::string &key, const std::string &storeName) override
ignore proxy