Skip to content
Snippets Groups Projects
Commit 9142cbf6 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

WriteCondHandle: Extend duplicate cond object range if possible

When recording a conditions object that already exists, try to extend
its range. This will only work for non-MIXED containers. This should
allow IOV changes during the run without any special code on the client
side (ATEAM-477).
parent 7a210d1c
No related branches found
No related tags found
No related merge requests found
/* /*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/ */
/* /*
*/ */
...@@ -57,11 +57,7 @@ StatusCode CondAlg1::execute (const EventContext& ctx) const ...@@ -57,11 +57,7 @@ StatusCode CondAlg1::execute (const EventContext& ctx) const
SG::WriteCondHandle<DMTest::S2> scond (m_scondKey, ctx); SG::WriteCondHandle<DMTest::S2> scond (m_scondKey, ctx);
auto s2 = std::make_unique<DMTest::S2> (xint*100); auto s2 = std::make_unique<DMTest::S2> (xint*100);
StatusCode sc = scond.record (range, std::move(s2)); ATH_CHECK( scond.record (range, std::move(s2) ) );
ATH_CHECK( sc );
if (CondContBase::Category::isDuplicate (sc)) {
ATH_CHECK( scond.extendLastRange (range, ctx) );
}
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
......
...@@ -63,7 +63,7 @@ namespace SG { ...@@ -63,7 +63,7 @@ namespace SG {
private: private:
const EventIDBase& m_eid; const EventContext& m_ctx;
CondCont<T>* m_cc {nullptr}; CondCont<T>* m_cc {nullptr};
const SG::WriteCondHandleKey<T>& m_hkey; const SG::WriteCondHandleKey<T>& m_hkey;
...@@ -82,7 +82,7 @@ namespace SG { ...@@ -82,7 +82,7 @@ namespace SG {
template <typename T> template <typename T>
WriteCondHandle<T>::WriteCondHandle( const SG::WriteCondHandleKey<T>& key, WriteCondHandle<T>::WriteCondHandle( const SG::WriteCondHandleKey<T>& key,
const EventContext& ctx) : const EventContext& ctx) :
m_eid(ctx.eventID()), m_ctx(ctx),
m_cc( key.getCC() ), m_cc( key.getCC() ),
m_hkey(key) m_hkey(key)
{ {
...@@ -135,6 +135,17 @@ namespace SG { ...@@ -135,6 +135,17 @@ namespace SG {
#endif #endif
sc = StatusCode::SUCCESS; sc = StatusCode::SUCCESS;
} }
// If the object exists already, try to extend it
else if (CondContBase::Category::isDuplicate (sc) &&
m_cc->keyType() != CondContBase::KeyType::MIXED) {
sc = this->extendLastRange(r, m_ctx);
if (sc.isFailure()) {
msg << MSG::ERROR
<< "WriteCondHandle::record() : cannot extend duplicate range"
<< endmsg;
return StatusCode::FAILURE;
}
}
return sc; return sc;
} }
...@@ -184,7 +195,7 @@ namespace SG { ...@@ -184,7 +195,7 @@ namespace SG {
bool bool
WriteCondHandle<T>::isValid() { WriteCondHandle<T>::isValid() {
return (m_cc->valid(m_eid)); return (m_cc->valid(m_ctx.eventID()));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment