Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Public Member Functions | Private Attributes | List of all members
SG::WriteCondHandle< T > Class Template Reference

#include <WriteCondHandle.h>

Collaboration diagram for SG::WriteCondHandle< T >:

Public Types

typedef T * pointer_type
 
typedef const T * const_pointer_type
 
typedef T & reference_type
 
typedef const T & const_reference_type
 

Public Member Functions

 WriteCondHandle (const WriteCondHandleKey< T > &key)
 
 WriteCondHandle (const WriteCondHandleKey< T > &key, const EventContext &ctx)
 
 WriteCondHandle (SG::WriteCondHandleKey< T > &&key)=delete
 
 WriteCondHandle (SG::WriteCondHandleKey< T > &&key, const EventContext &ctx)=delete
 
 ~WriteCondHandle ()
 
const std::string & key () const
 
const DataObjID & fullKey () const
 
bool isValid () const
 
bool isValid (const EventIDBase &t) const
 
bool isValid (EventIDRange &range) const
 
bool isValid (const EventIDBase &t, EventIDRange &range) const
 
void addDependency (const EventIDRange &range)
 
template<typename R >
void addDependency (SG::ReadCondHandle< R > &rch)
 
template<typename R , typename... Args>
void addDependency (ReadCondHandle< R > &rch, Args... args)
 
StatusCode record (const EventIDRange &range, T *t)
 record handle, with explicit range DEPRECATED More...
 
StatusCode record (const EventIDRange &range, std::unique_ptr< T > t)
 
StatusCode record (std::unique_ptr< T > t)
 record handle, range must have been set by addDependency(...) More...
 
StatusCode record (T *t)
 
StatusCode extendLastRange (const EventIDRange &range, const EventContext &ctx=Gaudi::Hive::currentContext())
 Extend the range of the last IOV. More...
 
const std::string & dbKey () const
 
const EventIDRange & getRange () const
 

Private Attributes

const EventContext & m_ctx
 
CondCont< T > * m_cc {nullptr}
 
const SG::WriteCondHandleKey< T > & m_hkey
 
EventIDRange m_range {}
 
bool m_rangeSet {false}
 

Detailed Description

template<typename T>
class SG::WriteCondHandle< T >

Definition at line 26 of file WriteCondHandle.h.

Member Typedef Documentation

◆ const_pointer_type

template<typename T >
typedef const T* SG::WriteCondHandle< T >::const_pointer_type

Definition at line 30 of file WriteCondHandle.h.

◆ const_reference_type

template<typename T >
typedef const T& SG::WriteCondHandle< T >::const_reference_type

Definition at line 32 of file WriteCondHandle.h.

◆ pointer_type

template<typename T >
typedef T* SG::WriteCondHandle< T >::pointer_type

Definition at line 29 of file WriteCondHandle.h.

◆ reference_type

template<typename T >
typedef T& SG::WriteCondHandle< T >::reference_type

Definition at line 31 of file WriteCondHandle.h.

Constructor & Destructor Documentation

◆ WriteCondHandle() [1/4]

template<typename T >
SG::WriteCondHandle< T >::WriteCondHandle ( const WriteCondHandleKey< T > &  key)

Definition at line 109 of file WriteCondHandle.h.

109  :
110  WriteCondHandle( key, Gaudi::Hive::currentContext() ) {}

◆ WriteCondHandle() [2/4]

template<typename T >
SG::WriteCondHandle< T >::WriteCondHandle ( const WriteCondHandleKey< T > &  key,
const EventContext &  ctx 
)

Definition at line 115 of file WriteCondHandle.h.

116  :
117  m_ctx(ctx),
118  m_cc( key.getCC() ),
119  m_hkey(key)
120  {
121  if (m_cc == 0) {
122  MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
123  msg << MSG::ERROR
124  << "WriteCondHandle : ptr to CondCont<T> is zero"
125  << endmsg;
126  }
127 
128  if (! m_hkey.isInit()) {
129  throw SG::ExcUninitKey (key.clid(), key.key(), key.storeHandle().name(),
130  "", "WriteCond");
131  }
132 
133  }

◆ WriteCondHandle() [3/4]

template<typename T >
SG::WriteCondHandle< T >::WriteCondHandle ( SG::WriteCondHandleKey< T > &&  key)
delete

◆ WriteCondHandle() [4/4]

template<typename T >
SG::WriteCondHandle< T >::WriteCondHandle ( SG::WriteCondHandleKey< T > &&  key,
const EventContext &  ctx 
)
delete

◆ ~WriteCondHandle()

template<typename T >
SG::WriteCondHandle< T >::~WriteCondHandle ( )
inline

Definition at line 42 of file WriteCondHandle.h.

42 {};

Member Function Documentation

◆ addDependency() [1/3]

template<typename T >
void SG::WriteCondHandle< T >::addDependency ( const EventIDRange &  range)

Definition at line 279 of file WriteCondHandle.h.

279  {
280  if ( !m_rangeSet ) {
281  m_range = range;
282  } else {
284  }
285  m_rangeSet = true;
286  using KeyType = CondContBase::KeyType;
287  if (m_cc->keyType()==KeyType::RUNLBN && (range.start().isTimeStamp() || range.stop().isTimeStamp())) {
288  MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
289  msg << MSG::ERROR << "Adding a time-stamp dependency on a run-lumi indexed CondCont. Consider a mixed ConditionsContainer for type " << fullKey() << endmsg;
290  }
291  if (m_cc->keyType()==KeyType::TIMESTAMP && (range.start().isRunLumi() || range.stop().isRunLumi())) {
292  MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
293  msg << MSG::ERROR << "Adding a run-lumi dependency on a timestamp-indexed CondCont. Consider a mixed ConditionsContainer for type " << fullKey() << endmsg;
294  }
295  }

◆ addDependency() [2/3]

template<typename T >
template<typename R , typename... Args>
void SG::WriteCondHandle< T >::addDependency ( ReadCondHandle< R > &  rch,
Args...  args 
)

Definition at line 310 of file WriteCondHandle.h.

310  {
311  addDependency( rch );
312  return addDependency( args... );
313  }

◆ addDependency() [3/3]

template<typename T >
template<typename R >
void SG::WriteCondHandle< T >::addDependency ( SG::ReadCondHandle< R > &  rch)

Definition at line 301 of file WriteCondHandle.h.

301  {
302  CondContBase* dep_cc = rch.getCC();
303  dep_cc->addDep (m_cc);
304  return addDependency(rch.getRange());
305  }

◆ dbKey()

template<typename T >
const std::string& SG::WriteCondHandle< T >::dbKey ( ) const
inline

Definition at line 91 of file WriteCondHandle.h.

91 { return m_hkey.dbKey(); }

◆ extendLastRange()

template<typename T >
StatusCode SG::WriteCondHandle< T >::extendLastRange ( const EventIDRange &  r,
const EventContext &  ctx = Gaudi::Hive::currentContext() 
)

Extend the range of the last IOV.

Parameters
rangeNew validity range.
ctxEvent context.

Returns failure if the start time of range does not match the start time of the last IOV in the container. Otherwise, the end time for the last IOV is changed to the end time for range. (If the end time for range is before the end of the last IOV, then nothing is changed.)

Definition at line 232 of file WriteCondHandle.h.

233  {
234  return m_cc->extendLastRange (r, ctx);
235  }

◆ fullKey()

template<typename T >
const DataObjID& SG::WriteCondHandle< T >::fullKey ( ) const
inline

Definition at line 45 of file WriteCondHandle.h.

45 { return m_hkey.fullKey(); }

◆ getRange()

template<typename T >
const EventIDRange& SG::WriteCondHandle< T >::getRange ( ) const
inline

Definition at line 93 of file WriteCondHandle.h.

93 { return m_range; }

◆ isValid() [1/4]

template<typename T >
bool SG::WriteCondHandle< T >::isValid

Definition at line 252 of file WriteCondHandle.h.

252  {
253 
254  return (m_cc->valid(m_ctx.eventID()));
255  }

◆ isValid() [2/4]

template<typename T >
bool SG::WriteCondHandle< T >::isValid ( const EventIDBase &  t) const

Definition at line 242 of file WriteCondHandle.h.

242  {
243 
244  return (m_cc->valid(t));
245  }

◆ isValid() [3/4]

template<typename T >
bool SG::WriteCondHandle< T >::isValid ( const EventIDBase &  t,
EventIDRange &  range 
) const

Definition at line 261 of file WriteCondHandle.h.

261  {
262 
263  return (m_cc->range(t, range));
264  }

◆ isValid() [4/4]

template<typename T >
bool SG::WriteCondHandle< T >::isValid ( EventIDRange &  range) const

Definition at line 271 of file WriteCondHandle.h.

271  {
272 
273  return (m_cc->range(m_ctx.eventID(), range));
274  }

◆ key()

template<typename T >
const std::string& SG::WriteCondHandle< T >::key ( ) const
inline

Definition at line 44 of file WriteCondHandle.h.

44 { return m_hkey.key(); }

◆ record() [1/4]

template<typename T >
StatusCode SG::WriteCondHandle< T >::record ( const EventIDRange &  range,
std::unique_ptr< T >  t 
)

Definition at line 140 of file WriteCondHandle.h.

141  {
142 
143  if (m_rangeSet) {
144  MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
145  msg << MSG::ERROR
146  << "WriteCondHandle::record(EventIDRange, T*): for key "
147  << this->fullKey()
148  << " cannot use this method if range has already been set via dependencies"
149  << endmsg;
150  return StatusCode::FAILURE;
151  }
152 
153  m_range = r;
154  m_rangeSet = true;
155 
156  return record( std::move(t) );
157  }

◆ record() [2/4]

template<typename T >
StatusCode SG::WriteCondHandle< T >::record ( const EventIDRange &  range,
T *  t 
)

record handle, with explicit range DEPRECATED

Parameters
rangeIOVRange of handle
tunique_ptr to handle

Definition at line 161 of file WriteCondHandle.h.

162  {
163  return record (r, std::unique_ptr<T> (t));
164  }

◆ record() [3/4]

template<typename T >
StatusCode SG::WriteCondHandle< T >::record ( std::unique_ptr< T >  t)

record handle, range must have been set by addDependency(...)

Parameters
tunique_ptr to handle

Definition at line 174 of file WriteCondHandle.h.

174  {
175  if (! m_rangeSet) {
176  MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
177  msg << MSG::ERROR
178  << "WriteCondHandle::record() : no range defined for key "
179  << this->fullKey()
180  << endmsg;
181  return StatusCode::FAILURE;
182  }
183 
184  #ifndef NDEBUG
185  MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
186  if (msg.level() <= MSG::DEBUG) {
187  msg << MSG::DEBUG
188  << "WriteCondHandle::record() : obj at: " << t.get() << " range: "
189  << m_range << endmsg;
190  }
191  #endif
192 
193  StatusCode sc = m_cc->insert(m_range, std::move(t));
194  // Preserve sc for return, since it may be DUPLICATE.
195  if (sc.isFailure()) {
196  MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
197  msg << MSG::ERROR
198  << "WriteCondHandle::record() : unable to insert obj in CondCont<T>"
199  << endmsg;
200  return StatusCode::FAILURE;
201  } else if (CondContBase::Category::isOverlap (sc)) {
202 #if 0
203  // Temporarily disable this check until caching issues with IOVDbSvc
204  // are sorted out.
205  MsgStream msg(Athena::getMessageSvc(), "WriteCondHandle");
206  msg << MSG::ERROR
207  << "WriteCondHandle::record() : IOV ranges overlap."
208  << endmsg;
209  return StatusCode::FAILURE;
210 #endif
211  sc = StatusCode::SUCCESS;
212  }
213 
214  return sc;
215  }

◆ record() [4/4]

template<typename T >
StatusCode SG::WriteCondHandle< T >::record ( T *  t)

Definition at line 168 of file WriteCondHandle.h.

168  {
169  return record (std::unique_ptr<T> (t));
170  }

Member Data Documentation

◆ m_cc

template<typename T >
CondCont<T>* SG::WriteCondHandle< T >::m_cc {nullptr}
private

Definition at line 98 of file WriteCondHandle.h.

◆ m_ctx

template<typename T >
const EventContext& SG::WriteCondHandle< T >::m_ctx
private

Definition at line 97 of file WriteCondHandle.h.

◆ m_hkey

template<typename T >
const SG::WriteCondHandleKey<T>& SG::WriteCondHandle< T >::m_hkey
private

Definition at line 100 of file WriteCondHandle.h.

◆ m_range

template<typename T >
EventIDRange SG::WriteCondHandle< T >::m_range {}
private

Definition at line 102 of file WriteCondHandle.h.

◆ m_rangeSet

template<typename T >
bool SG::WriteCondHandle< T >::m_rangeSet {false}
private

Definition at line 103 of file WriteCondHandle.h.


The documentation for this class was generated from the following file:
beamspotman.r
def r
Definition: beamspotman.py:676
SG::ReadCondHandle::getRange
const EventIDRange & getRange()
Definition: ReadCondHandle.h:246
python.CaloAddPedShiftConfig.args
args
Definition: CaloAddPedShiftConfig.py:45
SG::ReadCondHandle::getCC
CondCont< T > * getCC()
Definition: ReadCondHandle.h:81
CondContBase::KeyType
KeyType
Type of key used for this container.
Definition: CondCont.h:180
CondContBase::addDep
void addDep(CondContBase *dep)
Declare another conditions container that depends on this one.
Definition: CondCont.cxx:696
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition: WriteCondHandle.h:161
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::WriteCondHandle::m_range
EventIDRange m_range
Definition: WriteCondHandle.h:102
SG::WriteCondHandle::m_ctx
const EventContext & m_ctx
Definition: WriteCondHandle.h:97
SG::WriteCondHandle::fullKey
const DataObjID & fullKey() const
Definition: WriteCondHandle.h:45
SG::WriteCondHandle::m_cc
CondCont< T > * m_cc
Definition: WriteCondHandle.h:98
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CondContBase
Base class for all conditions containers.
Definition: CondCont.h:140
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
SG::WriteCondHandle::m_rangeSet
bool m_rangeSet
Definition: WriteCondHandle.h:103
SG::WriteCondHandle::key
const std::string & key() const
Definition: WriteCondHandle.h:44
SG::WriteCondHandle::WriteCondHandle
WriteCondHandle(const WriteCondHandleKey< T > &key)
Definition: WriteCondHandle.h:109
CondContBase::Category::isOverlap
static bool isOverlap(code_t code)
Helper to test whether a code is OVERLAP.
Definition: CondCont.cxx:242
SG::ExcUninitKey
Exception — Tried to create a handle from an uninitialized key.
Definition: Control/StoreGate/StoreGate/exceptions.h:111
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
DEBUG
#define DEBUG
Definition: page_access.h:11
SG::WriteCondHandle::m_hkey
const SG::WriteCondHandleKey< T > & m_hkey
Definition: WriteCondHandle.h:100
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition: WriteCondHandle.h:279