ATLAS Offline Software
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Private Types | Private Attributes | Static Private Attributes | List of all members
CondContBase Class Referenceabstract

Base class for all conditions containers. More...

#include <CondCont.h>

Inheritance diagram for CondContBase:
Collaboration diagram for CondContBase:

Classes

class  Category
 Status code category for ContCont. More...
 
struct  Compare
 Comparison object needed by ConcurrentRangeMap. More...
 
struct  RangeKey
 Range object to store in ConcurrentRangeMap. More...
 

Public Types

enum  KeyType { KeyType::SINGLE, KeyType::TIMESTAMP, KeyType::RUNLBN, KeyType::MIXED }
 Type of key used for this container. More...
 
typedef void Payload
 Payload type held by this class. More...
 
typedef uint64_t key_type
 Type used to store an IOV time internally. More...
 

Public Member Functions

virtual ~CondContBase ()
 Destructor. More...
 
CLID clid () const
 Return the CLID of the most-derived CondCont. More...
 
KeyType keyType () const
 Return the key type for this container. More...
 
const DataObjID & id () const
 Return CLID/key corresponding to this container. More...
 
SG::DataProxyproxy ()
 Return the associated DataProxy, if any. More...
 
const SG::DataProxyproxy () const
 Return the associated DataProxy, if any. More...
 
void setProxy (SG::DataProxy *)
 Set the associated DataProxy. More...
 
virtual void list (std::ostream &ost) const =0
 Dump the container contents for debugging. More...
 
void print () const
 Dump the container to cout. More...
 
virtual size_t entries () const
 Return the number of conditions objects in the container. More...
 
virtual std::vector< EventIDRange > ranges () const =0
 Return all IOV validity ranges defined in this container. More...
 
virtual StatusCode typelessInsert (const EventIDRange &r, void *obj, const EventContext &ctx=Gaudi::Hive::currentContext())=0
 Insert a new conditions object. More...
 
virtual bool valid (const EventIDBase &t) const =0
 Test to see if a given IOV time is mapped in the container. More...
 
virtual bool range (const EventIDBase &t, EventIDRange &r) const =0
 Return the mapped validity range for an IOV time. More...
 
virtual StatusCode erase (const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext())=0
 Erase the first element not less than t. More...
 
virtual size_t trim (const std::vector< key_type > &runLbnKeys, const std::vector< key_type > &TSKeys)
 Remove unused entries from the front of the list. More...
 
void clear ()
 Remove all entries in the container. More...
 
void quiescent (const EventContext &ctx=Gaudi::Hive::currentContext())
 Mark that this thread is no longer accessing data from this container. More...
 
size_t nInserts () const
 Return the number times an item was inserted into the map. More...
 
size_t maxSize () const
 Return the maximum size of the map. More...
 
virtual StatusCode extendLastRange (const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())=0
 Extend the range of the last IOV. More...
 
void addDep (CondContBase *dep)
 Declare another conditions container that depends on this one. More...
 
std::vector< CondContBase * > getDeps ()
 Return the list of conditions containers that depend on this one. More...
 

Static Public Member Functions

static key_type keyFromRunLBN (const EventIDBase &b)
 Make a run+lbn key from an EventIDBase. More...
 
static key_type keyFromTimestamp (const EventIDBase &b)
 Make a timestamp key from an EventIDBase. More...
 
static void setCleanerSvcName ATLAS_NOT_THREAD_SAFE (const std::string &name)
 Allow overriding the name of the global conditions cleaner service (for testing purposes). More...
 

Protected Types

typedef CxxUtils::ConcurrentRangeMap< RangeKey, key_type, void, Compare, Athena::RCUUpdaterCondContSet
 
typedef CondContSet::Updater_t Updater_t
 
typedef CondContSet::delete_function delete_function
 

Protected Member Functions

 CondContBase (Athena::IRCUSvc &rcusvc, KeyType keytype, CLID clid, const DataObjID &id, SG::DataProxy *proxy, std::shared_ptr< CondContSet::IPayloadDeleter > payloadDeleter, size_t capacity)
 Internal constructor. More...
 
StatusCode insertBase (const EventIDRange &r, CondContSet::payload_unique_ptr t, const EventContext &ctx=Gaudi::Hive::currentContext())
 Insert a new conditions object. More...
 
StatusCode eraseBase (const EventIDBase &t, const EventContext &ctx=Gaudi::Hive::currentContext())
 Erase the first element not less than t. More...
 
StatusCode extendLastRangeBase (const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())
 Extend the range of the last IOV. More...
 
const void * findBase (const EventIDBase &t, EventIDRange const **r) const
 Internal lookup function. More...
 
const void * cast (CLID clid, const void *ptr) const
 Do pointer conversion for the payload type. More...
 
virtual const void * doCast (CLID clid, const void *ptr) const =0
 Do pointer conversion for the payload type. More...
 
template<class FUNC >
void forEach (const FUNC &func) const
 Call func on each entry in the container. More...
 
StatusCode inserted (const EventContext &ctx)
 Tell the cleaner that a new object was added to the container. More...
 
void insertError (CLID usedCLID) const
 Helper to report an error due to using a base class for insertion. More...
 
delete_functiondelfcn () const
 Return the deletion function for this container. More...
 
std::string title () const
 Description of this container to use for MsgStream. More...
 

Private Types

using DepSet = CxxUtils::ConcurrentPtrSet< CondContBase, CxxUtils::SimpleUpdater >
 Other conditions dependencies that depend on this one, as inferred by addDependency calls. More...
 

Private Attributes

std::atomic< KeyTypem_keyType
 Key type of this container. More...
 
CLID m_clid
 CLID of the most-derived CondCont. More...
 
DataObjID m_id
 CLID+key for this container. More...
 
SG::DataProxym_proxy
 Associated DataProxy. More...
 
CondContSet m_condSet
 Set of mapped objects. More...
 
ServiceHandle< Athena::IConditionsCleanerSvcm_cleanerSvc
 Handle to the cleaner service. More...
 
DepSet m_deps
 

Static Private Attributes

static std::string s_cleanerSvcName ATLAS_THREAD_SAFE
 Name of the global conditions cleaner service. More...
 

Detailed Description

Base class for all conditions containers.

Definition at line 139 of file CondCont.h.

Member Typedef Documentation

◆ CondContSet

typedef CxxUtils::ConcurrentRangeMap<RangeKey, key_type, void, Compare, Athena::RCUUpdater> CondContBase::CondContSet
protected

Definition at line 517 of file CondCont.h.

◆ delete_function

typedef CondContSet::delete_function CondContBase::delete_function
protected

Definition at line 520 of file CondCont.h.

◆ DepSet

Other conditions dependencies that depend on this one, as inferred by addDependency calls.

There should only be a few of them.

Definition at line 682 of file CondCont.h.

◆ key_type

typedef uint64_t CondContBase::key_type

Type used to store an IOV time internally.

For efficiency, we pack two 32-bit words into a 64-bit word Can be either run+lbn or a timestamp.

Definition at line 204 of file CondCont.h.

◆ Payload

typedef void CondContBase::Payload

Payload type held by this class.

Need to define this here for cast() to work properly.

Definition at line 198 of file CondCont.h.

◆ Updater_t

typedef CondContSet::Updater_t CondContBase::Updater_t
protected

Definition at line 519 of file CondCont.h.

Member Enumeration Documentation

◆ KeyType

enum CondContBase::KeyType
strong

Type of key used for this container.

Enumerator
SINGLE 

Either TIMESTAMP or RUNLBN, but nothing's been put in the container yet, so we don't know which one.

TIMESTAMP 

Container uses timestamp keys.

RUNLBN 

Container uses run+lbn keys.

MIXED 

Mixed Run+lbn / timestamp container.

Definition at line 179 of file CondCont.h.

180  {
183  SINGLE,
184 
186  TIMESTAMP,
187 
189  RUNLBN,
190 
192  MIXED,
193  };

Constructor & Destructor Documentation

◆ ~CondContBase()

virtual CondContBase::~CondContBase ( )
inlinevirtual

Destructor.

Definition at line 208 of file CondCont.h.

208 {};

◆ CondContBase()

CondContBase::CondContBase ( Athena::IRCUSvc rcusvc,
KeyType  keyType,
CLID  clid,
const DataObjID &  id,
SG::DataProxy proxy,
std::shared_ptr< CondContSet::IPayloadDeleter >  payloadDeleter,
size_t  capacity 
)
protected

Internal constructor.

Parameters
rcusvcRCU service instance.
keyTypeKey type for this container.
CLIDof the most-derived CondCont.
idCLID+key for this object.
proxyDataProxy for this object.
payloadDeleterObject for deleting payload objects.
capacityInitial capacity of the container.

Definition at line 409 of file CondCont.cxx.

416  : m_keyType (keyType),
417  m_clid (clid),
418  m_id (id),
419  m_proxy (proxy),
420  m_condSet (Updater_t (rcusvc), payloadDeleter, capacity),
421  m_cleanerSvc (s_cleanerSvcName, "CondContBase"),
422  m_deps (DepSet::Updater_t(), 16)
423 {
424  if (!m_cleanerSvc.retrieve().isSuccess()) {
425  std::abort();
426  }
427 }

Member Function Documentation

◆ addDep()

void CondContBase::addDep ( CondContBase dep)

Declare another conditions container that depends on this one.

Parameters
depConditions container that depends on this one.

Definition at line 696 of file CondCont.cxx.

697 {
698  m_deps.insert (dep);
699 }

◆ ATLAS_NOT_THREAD_SAFE()

static void setCleanerSvcName CondContBase::ATLAS_NOT_THREAD_SAFE ( const std::string &  name)
static

Allow overriding the name of the global conditions cleaner service (for testing purposes).

Parameters
nameThe name of the global conditions cleaner service.

◆ cast()

const void* CondContBase::cast ( CLID  clid,
const void *  ptr 
) const
protected

Do pointer conversion for the payload type.

Parameters
clidCLID for the desired pointer type.
ptrPointer of type T*.

Converts ptr from T* to a pointer to the type given by clid. Returns nullptr if the conversion is not possible.

◆ clear()

void CondContBase::clear ( )

Remove all entries in the container.

Mostly for testing — should not normally be used.

Definition at line 361 of file CondCont.cxx.

362 {
363  m_condSet.clear();
364 }

◆ clid()

CLID CondContBase::clid ( ) const

Return the CLID of the most-derived CondCont.

◆ delfcn()

CondContBase::delete_function * CondContBase::delfcn ( ) const
protected

Return the deletion function for this container.

Definition at line 740 of file CondCont.cxx.

741 {
742  return m_condSet.deleter().delfcn();
743 }

◆ doCast()

virtual const void* CondContBase::doCast ( CLID  clid,
const void *  ptr 
) const
protectedpure virtual

Do pointer conversion for the payload type.

Parameters
clidCLID for the desired pointer type.
ptrPointer of type T*.

Converts ptr from T* to a pointer to the type given by clid. Returns nullptr if the conversion is not possible.

This is a virtual function that calls cast from the most-derived class of the hierarchy.

◆ entries()

size_t CondContBase::entries ( ) const
virtual

Return the number of conditions objects in the container.

Reimplemented in CondContMixedBase.

Definition at line 294 of file CondCont.cxx.

295 {
296  return m_condSet.size();
297 }

◆ erase()

virtual StatusCode CondContBase::erase ( const EventIDBase &  t,
const EventContext &  ctx = Gaudi::Hive::currentContext() 
)
pure virtual

Erase the first element not less than t.

Parameters
IOVtime of element to erase.
ctxEvent context for the current thread.

Implemented in CondContMixedBase, and CondContSingleBase.

◆ eraseBase()

StatusCode CondContBase::eraseBase ( const EventIDBase &  t,
const EventContext &  ctx = Gaudi::Hive::currentContext() 
)
protected

Erase the first element not less than t.

Parameters
IOVtime of element to erase.
ctxEvent context for the current thread.

Definition at line 539 of file CondCont.cxx.

541 {
542  switch (m_keyType) {
543  case KeyType::RUNLBN:
544  if (!t.isRunLumi()) {
545  MsgStream msg (Athena::getMessageSvc(), title());
546  msg << MSG::ERROR << "CondContBase::erase: "
547  << "Non-Run/LBN key used in Run/LBN container."
548  << endmsg;
549  return StatusCode::FAILURE;
550  }
551  m_condSet.erase (CondContBase::keyFromRunLBN (t), ctx);
552  break;
553  case KeyType::TIMESTAMP:
554  if (!t.isTimeStamp()) {
555  MsgStream msg (Athena::getMessageSvc(), title());
556  msg << MSG::ERROR << "CondContBase::erase: "
557  << "Non-Timestamp key used in timestamp container."
558  << endmsg;
559  return StatusCode::FAILURE;
560  }
562  break;
563  case KeyType::SINGLE:
564  break;
565  default:
566  std::abort();
567  }
568  return StatusCode::SUCCESS;
569 }

◆ extendLastRange()

virtual StatusCode CondContBase::extendLastRange ( const EventIDRange &  newRange,
const EventContext &  ctx = Gaudi::Hive::currentContext() 
)
pure virtual

Extend the range of the last IOV.

Parameters
newRangeNew validity range.
ctxEvent context.

Returns failure if the start time of newRange 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 newRange. (If the end time for newRange is before the end of the last IOV, then nothing is changed.)

Implemented in CondContMixedBase, and CondContSingleBase.

◆ extendLastRangeBase()

StatusCode CondContBase::extendLastRangeBase ( const EventIDRange &  newRange,
const EventContext &  ctx = Gaudi::Hive::currentContext() 
)
protected

Extend the range of the last IOV.

Parameters
newRangeNew validity range.
ctxEvent context.

Returns failure if the start time of newRange 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 newRange. (If the end time for newRange is before the end of the last IOV, then nothing is changed.)

Definition at line 583 of file CondCont.cxx.

585 {
586  key_type start;
587  key_type stop;
588  switch (m_keyType) {
589  case KeyType::RUNLBN:
590  case KeyType::MIXED: // To handle the extension case of insertMixed().
591  if (!newRange.start().isRunLumi()) {
592  MsgStream msg (Athena::getMessageSvc(), title());
593  msg << MSG::ERROR << "CondContBase::extendLastRange: "
594  << "Non-Run/LBN range used in Run/LBN container."
595  << endmsg;
596  return StatusCode::FAILURE;
597  }
598  start = keyFromRunLBN (newRange.start());
599  stop = keyFromRunLBN (newRange.stop());
600  break;
601  case KeyType::TIMESTAMP:
602  if (!newRange.start().isTimeStamp()) {
603  MsgStream msg (Athena::getMessageSvc(), title());
604  msg << MSG::ERROR << "CondContBase::extendLastRange: "
605  << "Non-timestamp range used in timestamp container."
606  << endmsg;
607  return StatusCode::FAILURE;
608  }
609  start = keyFromTimestamp (newRange.start());
610  stop = keyFromTimestamp (newRange.stop());
611  break;
612  case KeyType::SINGLE:
613  // Empty container.
614  return StatusCode::FAILURE;
615  default:
616  std::abort();
617  }
618 
619  if (m_condSet.extendLastRange (RangeKey (newRange, start, stop), ctx) >= 0)
620  {
621  return StatusCode::SUCCESS;
622  }
623  return StatusCode::FAILURE;
624 }

◆ findBase()

const void * CondContBase::findBase ( const EventIDBase &  t,
EventIDRange const **  r 
) const
protected

Internal lookup function.

Parameters
tIOV time to find.
rIf non-null, copy validity range of the object here.

Looks up the conditions object corresponding to the IOV time t. If found, return the pointer (as a pointer to the payload type of the most-derived CondCont). Otherwise, return nullptr.

Parameters
clidCLID for the desired pointer type.
tIOV time to find.
rIf non-null, copy validity range of the object here.

Looks up the conditions object corresponding to the IOV time t. If found, convert the pointer to a pointer to the type identified by CLID and return it. Otherwise, return nullptr.

Definition at line 637 of file CondCont.cxx.

639 {
640  const void* ptr = nullptr;
641  key_type key;
642  switch (m_keyType) {
643  case KeyType::RUNLBN:
644  case KeyType::MIXED:
645  if (ATH_UNLIKELY (!t.isRunLumi())) {
646  MsgStream msg (Athena::getMessageSvc(), title());
647  msg << MSG::ERROR << "CondContBase::findBase: "
648  << "Non-Run/LBN key used in Run/LBN container."
649  << endmsg;
650  return nullptr;
651  }
652  key = keyFromRunLBN (t);
653  break;
654  case KeyType::TIMESTAMP:
655  if (ATH_UNLIKELY (!t.isTimeStamp())) {
656  MsgStream msg (Athena::getMessageSvc(), title());
657  msg << MSG::ERROR << "CondContBase::findBase: "
658  << "Non-timestamp key used in timestamp container."
659  << endmsg;
660  return nullptr;
661  }
662  key = keyFromTimestamp (t);
663  break;
664  case KeyType::SINGLE:
665  // Empty container.
666  return nullptr;
667  default:
668  std::abort();
669  }
670 
671  CondContSet::const_iterator it = m_condSet.find (key);
672  if (it && key < it->first.m_stop) {
673  if (r) {
674  *r = &it->first.m_range;
675  }
676  ptr = it->second;
677  }
678 
679  return ptr;
680 }

◆ forEach()

template<class FUNC >
void CondContBase::forEach ( const FUNC &  func) const
protected

Call func on each entry in the container.

Parameters
funcFunctional to call on each entry.

func will be called on each container element (being passed const CondContSet::value_type&).

◆ getDeps()

std::vector< CondContBase * > CondContBase::getDeps ( )

Return the list of conditions containers that depend on this one.

Definition at line 705 of file CondCont.cxx.

706 {
707  return std::vector<CondContBase*> (m_deps.begin(), m_deps.end());
708 }

◆ id()

const DataObjID& CondContBase::id ( ) const

Return CLID/key corresponding to this container.

◆ insertBase()

StatusCode CondContBase::insertBase ( const EventIDRange &  r,
CondContSet::payload_unique_ptr  t,
const EventContext &  ctx = Gaudi::Hive::currentContext() 
)
protected

Insert a new conditions object.

Parameters
rRange of validity of this object.
tPointer to the object being inserted.
ctxEvent context for the current thread.

Returns SUCCESS if the object was successfully inserted; EXTENDED if the last existing range in the container was extended to match the new range; OVERLAP if the object was inserted but the range partially overlaps with an existing one; DUPLICATE if the object wasn't inserted because the range duplicates an existing one, and FAILURE otherwise (ownership of the object will be taken in any case).

Definition at line 446 of file CondCont.cxx.

449 {
450  EventIDBase start = r.start();
451  EventIDBase stop = r.stop();
452 
453  key_type start_key, stop_key;
454 
455  if (m_keyType == KeyType::MIXED) {
456  if (start.run_number() == EventIDBase::UNDEFNUM ||
457  stop.run_number() == EventIDBase::UNDEFNUM)
458  {
459  MsgStream msg (Athena::getMessageSvc(), title());
460  msg << MSG::ERROR << "CondContBase::insertBase: "
461  << "Run part of range invalid in mixed container."
462  << endmsg;
463  return StatusCode::FAILURE;
464  }
465 
466  start_key = keyFromRunLBN (start);
467  stop_key = keyFromRunLBN (stop);
468  }
469  else if (start.isTimeStamp() && stop.isTimeStamp()) {
470  if (m_keyType == KeyType::SINGLE) {
472  }
473  else if (m_keyType != KeyType::TIMESTAMP) {
474  MsgStream msg (Athena::getMessageSvc(), title());
475  msg << MSG::ERROR << "CondContBase::insertBase: "
476  << "Timestamp key used in non-timestamp container."
477  << endmsg;
478  return StatusCode::FAILURE;
479  }
480 
481  start_key = keyFromTimestamp (start);
482  stop_key = keyFromTimestamp (stop);
483  }
484 
485  else if (start.run_number() != EventIDBase::UNDEFNUM &&
486  stop.run_number() != EventIDBase::UNDEFNUM)
487  {
488  if (m_keyType == KeyType::SINGLE) {
490  }
491  else if (m_keyType != KeyType::RUNLBN) {
492  MsgStream msg (Athena::getMessageSvc(), title());
493  msg << MSG::ERROR << "CondContBase::insertBase: "
494  << "Run/LBN key used in non-Run/LBN container."
495  << endmsg;
496  return StatusCode::FAILURE;
497  }
498 
499  start_key = keyFromRunLBN (start);
500  stop_key = keyFromRunLBN (stop);
501  }
502 
503  else {
504  MsgStream msg (Athena::getMessageSvc(), title());
505  msg << MSG::ERROR << "CondContBase::insertBase: EventIDRange " << r
506  << " is neither fully RunEvent nor TimeStamp"
507  << endmsg;
508  return StatusCode::FAILURE;
509  }
510 
511  CondContSet::EmplaceResult reslt =
512  m_condSet.emplace( RangeKey(r, start_key, stop_key),
513  std::move(t),
515  ctx );
516 
517  if (reslt == CondContSet::EmplaceResult::DUPLICATE)
518  {
520  }
521  else if (reslt == CondContSet::EmplaceResult::EXTENDED)
522  {
524  }
525  else if (reslt == CondContSet::EmplaceResult::OVERLAP) {
527  }
528 
529  return this->inserted (ctx);
530 }

◆ inserted()

StatusCode CondContBase::inserted ( const EventContext &  ctx)
protected

Tell the cleaner that a new object was added to the container.

Definition at line 686 of file CondCont.cxx.

687 {
688  return m_cleanerSvc->condObjAdded (ctx, *this);
689 }

◆ insertError()

void CondContBase::insertError ( CLID  usedCLID) const
protected

Helper to report an error due to using a base class for insertion.

Parameters
usedCLIDCLID of the class used for insertion.

Definition at line 727 of file CondCont.cxx.

728 {
729  MsgStream msg (Athena::getMessageSvc(), title());
730  msg << MSG::ERROR << "CondCont<T>::insert: Not most-derived class; "
731  << "CLID used: " << usedCLID
732  << "; container CLID: " << m_clid
733  << endmsg;
734 }

◆ keyFromRunLBN()

static key_type CondContBase::keyFromRunLBN ( const EventIDBase &  b)
static

Make a run+lbn key from an EventIDBase.

Parameters
EventID to convert.

◆ keyFromTimestamp()

static key_type CondContBase::keyFromTimestamp ( const EventIDBase &  b)
static

Make a timestamp key from an EventIDBase.

Parameters
EventID to convert.

◆ keyType()

KeyType CondContBase::keyType ( ) const

Return the key type for this container.

◆ list()

virtual void CondContBase::list ( std::ostream &  ost) const
pure virtual

Dump the container contents for debugging.

Parameters
ostStream to which to write the dump.

Implemented in CondContMixedBase, and CondContSingleBase.

◆ maxSize()

size_t CondContBase::maxSize ( ) const

Return the maximum size of the map.

Definition at line 393 of file CondCont.cxx.

394 {
395  return m_condSet.maxSize();
396 }

◆ nInserts()

size_t CondContBase::nInserts ( ) const

Return the number times an item was inserted into the map.

Definition at line 384 of file CondCont.cxx.

385 {
386  return m_condSet.nInserts();
387 }

◆ print()

void CondContBase::print ( ) const

Dump the container to cout.

For calling from the debugger.

Definition at line 285 of file CondCont.cxx.

286 {
287  list (std::cout);
288 }

◆ proxy() [1/2]

SG::DataProxy* CondContBase::proxy ( )

Return the associated DataProxy, if any.

◆ proxy() [2/2]

const SG::DataProxy* CondContBase::proxy ( ) const

Return the associated DataProxy, if any.

◆ quiescent()

void CondContBase::quiescent ( const EventContext &  ctx = Gaudi::Hive::currentContext())

Mark that this thread is no longer accessing data from this container.

Parameters
ctxEvent context for the current thread.

This would normally be done through RCU service. Defined here for purposes of testing.

Definition at line 375 of file CondCont.cxx.

376 {
377  m_condSet.quiescent (ctx);
378 }

◆ range()

virtual bool CondContBase::range ( const EventIDBase &  t,
EventIDRange &  r 
) const
pure virtual

Return the mapped validity range for an IOV time.

Parameters
tIOV time to check.
r[out]The range containing t.

Returns true if t is mapped; false otherwise.

Implemented in CondContMixedBase, and CondContSingleBase.

◆ ranges()

virtual std::vector<EventIDRange> CondContBase::ranges ( ) const
pure virtual

Return all IOV validity ranges defined in this container.

Implemented in CondContMixedBase, and CondContSingleBase.

◆ setProxy()

void CondContBase::setProxy ( SG::DataProxy proxy)

Set the associated DataProxy.

Parameters
proxyThe proxy to set.

Definition at line 276 of file CondCont.cxx.

277 {
278  m_proxy = proxy;
279 }

◆ title()

std::string CondContBase::title ( ) const
protected

Description of this container to use for MsgStream.

Definition at line 749 of file CondCont.cxx.

750 {
751  return m_id.fullKey();
752 }

◆ trim()

size_t CondContBase::trim ( const std::vector< key_type > &  runLbnKeys,
const std::vector< key_type > &  TSKeys 
)
virtual

Remove unused entries from the front of the list.

Parameters
runLbnKeysList of Run-Lumi keys that may still be in use. (Must be sorted.)
TSKeysList of time-stamp keys that may still be in use. (Must be sorted.)

We examine the objects in the container, starting with the earliest one. If none of the keys in keys match the range for this object, then it is removed from the container. We stop when we either find an object with a range matching a key in keys or when there is only one object left. Mixed containers are trimmed recursivly.

The list runLbnKeys should contain keys as computed by keyFromRunLBN, the list TSKey should contain keys from keyFromTimestamp. Depending on the type (RUNLUMI, TIMESTAMP, MIXED) only one of the lists or both are used. The list must be sorted.

Removed objects are queued for deletion once all slots have been marked as quiescent.

Returns the number of objects that were removed.

Parameters
keysList of keys that may still be in use. (Must be sorted.)

We examine the objects in the container, starting with the earliest one. If none of the keys in keys match the range for this object, then it is removed from the container. We stop when we either find an object with a range matching a key in keys or when there is only one object left.

The list keys should contain keys as computed by keyFromRunLBN or keyFromTimestamp, as appropriate for the container's key type (as returned from keyType()). The list must be sorted.

Removed objects are queued for deletion once all slots have been marked as quiescent.

Returns the number of objects that were removed.

Definition at line 320 of file CondCont.cxx.

321 {
322  if (m_keyType == KeyType::RUNLBN) {
323  return m_condSet.trim (runLbnKeys);
324  }
325 
326  if (m_keyType == KeyType::TIMESTAMP) {
327  return m_condSet.trim ( TSKeys );
328  }
329 
330 
331  if (m_keyType == KeyType::MIXED) {
332  //For mixed containers, first trim inner container based in TimeStamps
333  size_t nTrimmed=0;
334  for (const typename CondContSet::value_type& ent : m_condSet.range()) {
335  const CondContSet* tsmap = reinterpret_cast<const CondContSet*> (ent.second);
336  //size_t before=tsmap->size();
337  CondContSet* tsmap_nc ATLAS_THREAD_SAFE = const_cast<CondContSet*>(tsmap);
338  // Trim inner containers, allowing the removal of all elements.
339  // See ATLASRECTS-7421.
340  size_t ntrim=tsmap_nc->trim (TSKeys, true);
341  nTrimmed+=ntrim;
342  //std::cout << "WL: Trimming inner container for clid " << m_clid << " (" << ntrim << " out of " << before << ", nKeys= " << TSKeys.size() << ")" << std::endl;
343  }
344  // Then trim outer container based on run-LB.
345  size_t outerTrimmed=m_condSet.trim(runLbnKeys);
346  //std::cout << "WL: Removing outer sets " << outerTrimmed << ", remaining " << m_condSet.size() << std::endl;
347  //FIXME: The number returned may be inaccurate, only correct if the outer container
348  //has exactly one element left by the time it gets removed.
349  return nTrimmed+outerTrimmed;
350  }
351 
352 //Arrive here for KeyType::SINGLE .. do nothing.
353  return 0;
354 }

◆ typelessInsert()

virtual StatusCode CondContBase::typelessInsert ( const EventIDRange &  r,
void *  obj,
const EventContext &  ctx = Gaudi::Hive::currentContext() 
)
pure virtual

Insert a new conditions object.

Parameters
rRange of validity of this object.
objPointer to the object being inserted.
ctxEvent context for the current thread.

obj must point to an object of type T, except in the case of inheritance, where the type of obj must correspond to the most-derived CondCont type. The container will take ownership of this object.

Returns SUCCESS if the object was successfully inserted; EXTENDED if the last existing range in the container was extended to match the new range; OVERLAP if the object was inserted but the range partially overlaps with an existing one; DUPLICATE if the object wasn't inserted because the range duplicates an existing one, and FAILURE otherwise (ownership of the object will be taken in any case).

Implemented in CondContMixedBase, and CondContSingleBase.

◆ valid()

virtual bool CondContBase::valid ( const EventIDBase &  t) const
pure virtual

Test to see if a given IOV time is mapped in the container.

Parameters
tIOV time to check.

Implemented in CondContMixedBase, and CondContSingleBase.

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::string s_cleanerSvcName CondContBase::ATLAS_THREAD_SAFE
staticprivate

Name of the global conditions cleaner service.

Definition at line 686 of file CondCont.h.

◆ m_cleanerSvc

ServiceHandle<Athena::IConditionsCleanerSvc> CondContBase::m_cleanerSvc
private

Handle to the cleaner service.

Definition at line 678 of file CondCont.h.

◆ m_clid

CLID CondContBase::m_clid
private

CLID of the most-derived CondCont.

Definition at line 666 of file CondCont.h.

◆ m_condSet

CondContSet CondContBase::m_condSet
private

Set of mapped objects.

Definition at line 675 of file CondCont.h.

◆ m_deps

DepSet CondContBase::m_deps
private

Definition at line 683 of file CondCont.h.

◆ m_id

DataObjID CondContBase::m_id
private

CLID+key for this container.

Definition at line 669 of file CondCont.h.

◆ m_keyType

std::atomic<KeyType> CondContBase::m_keyType
private

Key type of this container.

Definition at line 663 of file CondCont.h.

◆ m_proxy

SG::DataProxy* CondContBase::m_proxy
private

Associated DataProxy.

Definition at line 672 of file CondCont.h.


The documentation for this class was generated from the following files:
beamspotman.r
def r
Definition: beamspotman.py:676
CondContBase::keyFromTimestamp
static key_type keyFromTimestamp(const EventIDBase &b)
Make a timestamp key from an EventIDBase.
CondContBase::KeyType::RUNLBN
@ RUNLBN
Container uses run+lbn keys.
CondContBase::keyFromRunLBN
static key_type keyFromRunLBN(const EventIDBase &b)
Make a run+lbn key from an EventIDBase.
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
skel.it
it
Definition: skel.GENtoEVGEN.py:423
CondContBase::Updater_t
CondContSet::Updater_t Updater_t
Definition: CondCont.h:519
ATH_UNLIKELY
#define ATH_UNLIKELY(x)
Definition: AthUnlikelyMacros.h:17
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
CondContBase::keyType
KeyType keyType() const
Return the key type for this container.
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
CondContBase::list
virtual void list(std::ostream &ost) const =0
Dump the container contents for debugging.
CondContBase::m_id
DataObjID m_id
CLID+key for this container.
Definition: CondCont.h:669
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
CondContBase::inserted
StatusCode inserted(const EventContext &ctx)
Tell the cleaner that a new object was added to the container.
Definition: CondCont.cxx:686
CondContStatusCode::DUPLICATE
@ DUPLICATE
CondContStatusCode::OVERLAP
@ OVERLAP
CxxUtils::ConcurrentPtrSet::insert
std::pair< const_iterator, bool > insert(const key_type p)
Add an element to the set.
CxxUtils::ConcurrentPtrSet< CondContBase, CxxUtils::SimpleUpdater >::Updater_t
typename Impl_t::Updater_t Updater_t
Updater object.
Definition: ConcurrentPtrSet.h:93
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
CxxUtils::ConcurrentPtrSet::end
const_iterator end() const
Iterator at the end of the set.
CondContBase::m_clid
CLID m_clid
CLID of the most-derived CondCont.
Definition: CondCont.h:666
CondContBase::KeyType::TIMESTAMP
@ TIMESTAMP
Container uses timestamp keys.
CondContBase::m_proxy
SG::DataProxy * m_proxy
Associated DataProxy.
Definition: CondCont.h:672
CxxUtils::ConcurrentPtrSet::begin
const_iterator begin() const
Iterator at the start of the set.
jet::JetTopology::MIXED
@ MIXED
Definition: UncertaintyEnum.h:214
CondContBase::CondContSet
CxxUtils::ConcurrentRangeMap< RangeKey, key_type, void, Compare, Athena::RCUUpdater > CondContSet
Definition: CondCont.h:517
CondContBase::KeyType::MIXED
@ MIXED
Mixed Run+lbn / timestamp container.
CondContBase::ATLAS_THREAD_SAFE
static std::string s_cleanerSvcName ATLAS_THREAD_SAFE
Name of the global conditions cleaner service.
Definition: CondCont.h:686
CondContBase::m_cleanerSvc
ServiceHandle< Athena::IConditionsCleanerSvc > m_cleanerSvc
Handle to the cleaner service.
Definition: CondCont.h:678
CondContBase::title
std::string title() const
Description of this container to use for MsgStream.
Definition: CondCont.cxx:749
DeMoScan.first
bool first
Definition: DeMoScan.py:534
CondContBase::clid
CLID clid() const
Return the CLID of the most-derived CondCont.
CondContBase::key_type
uint64_t key_type
Type used to store an IOV time internally.
Definition: CondCont.h:204
CondContBase::m_condSet
CondContSet m_condSet
Set of mapped objects.
Definition: CondCont.h:675
CondContBase::proxy
SG::DataProxy * proxy()
Return the associated DataProxy, if any.
CondContBase::m_deps
DepSet m_deps
Definition: CondCont.h:683
CondContStatusCode::EXTENDED
@ EXTENDED
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
CondContBase::KeyType::SINGLE
@ SINGLE
Either TIMESTAMP or RUNLBN, but nothing's been put in the container yet, so we don't know which one.
CondContBase::m_keyType
std::atomic< KeyType > m_keyType
Key type of this container.
Definition: CondCont.h:663
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37