ATLAS Offline Software
Loading...
Searching...
No Matches
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 class  KeyType { SINGLE , TIMESTAMP , RUNLBN , MIXED }
 Type of key used for this container. More...
typedef void Payload
 Payload type held by this class.
typedef uint64_t key_type
 Type used to store an IOV time internally.

Public Member Functions

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

Static Public Member Functions

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

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

Private Types

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

Private Attributes

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

Static Private Attributes

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

Detailed Description

Base class for all conditions containers.

Definition at line 139 of file CondCont.h.

Member Typedef Documentation

◆ CondContSet

◆ 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

Definition at line 519 of file CondCont.h.

Member Enumeration Documentation

◆ KeyType

enum class 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), std::move(payloadDeleter), capacity),
421 m_cleanerSvc (s_cleanerSvcName, "CondContBase"),
423{
424 if (!m_cleanerSvc.retrieve().isSuccess()) {
425 std::abort();
426 }
427}
CLID m_clid
CLID of the most-derived CondCont.
Definition CondCont.h:666
CondContSet::Updater_t Updater_t
Definition CondCont.h:519
std::atomic< KeyType > m_keyType
Key type of this container.
Definition CondCont.h:663
CondContSet m_condSet
Set of mapped objects.
Definition CondCont.h:675
ServiceHandle< Athena::IConditionsCleanerSvc > m_cleanerSvc
Handle to the cleaner service.
Definition CondCont.h:678
DepSet m_deps
Definition CondCont.h:683
DataObjID m_id
CLID+key for this container.
Definition CondCont.h:669
KeyType keyType() const
Return the key type for this container.
CLID clid() const
Return the CLID of the most-derived CondCont.
SG::DataProxy * m_proxy
Associated DataProxy.
Definition CondCont.h:672
SG::DataProxy * proxy()
Return the associated DataProxy, if any.

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()

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.

Implemented in CondCont< T >, CondCont< ActsTrk::ActsVolumeIdToDetectorElementCollectionMap >, CondCont< ActsTrk::DetectorAlignStore >, CondCont< ALineContainer >, CondCont< Analysis::JetTagCalibCondData >, CondCont< AthenaAttributeList >, CondCont< AtlasFieldCacheCondObj >, CondCont< AtlasFieldMapCondObj >, CondCont< BLineContainer >, CondCont< BunchCrossingAverageCondData >, CondCont< BunchCrossingCondData >, CondCont< BunchCrossingIntensityCondData >, CondCont< BunchGroupCondData >, CondCont< BunchLumisCondData >, CondCont< calib_data_t >, CondCont< CaloAffectedRegionInfoVec >, CondCont< CaloBCIDCoeffs >, CondCont< CaloBCIDLumi >, CondCont< CaloCellPedShift >, CondCont< CaloDetDescrManager >, CondCont< CaloLocalHadCoeff >, CondCont< CaloNoise >, CondCont< CaloNoiseSigmaDiff >, CondCont< CaloRec::CaloCellPositionShift >, CondCont< CaloRec::ToolConstants >, CondCont< CaloSuperCellDetDescrManager >, CondCont< CaloTowerGeometry >, CondCont< CondAttrListVec >, CondCont< CONDDATA >, CondCont< CondDataObj >, CondCont< CondDataObjY >, CondCont< CondDataObjZ >, CondCont< CondMultChanCollection< AlignableTransform > >, CondCont< CscCondDbData >, CondCont< DataVector< HGTD_DetectorElement > >, CondCont< DetCondCFloat >, CondCont< DetCondKeyTrans >, CondCont< DMTest::S1 >, CondCont< DMTest::S2 >, CondCont< DMTest::S3 >, CondCont< external_detector_element_collection_t >, CondCont< FillParamsCondData >, CondCont< GeoAlignmentStore >, CondCont< HTcalculator >, CondCont< IdentifierSet >, CondCont< ILArAutoCorr >, CondCont< ILArDAC2uA >, CondCont< ILArfSampl >, CondCont< ILArHVScaleCorr >, CondCont< ILArMinBias >, CondCont< ILArMinBiasAverage >, CondCont< ILArMphysOverMcal >, CondCont< ILArNoise >, CondCont< ILArOFC >, CondCont< ILArOFCBin >, CondCont< ILArPedestal >, CondCont< ILArRamp >, CondCont< ILArShape >, CondCont< ILAruA2MeV >, CondCont< InDet::BeamSpotData >, CondCont< InDet::SiDetectorElementStatus >, CondCont< InDet::SiDetElementBoundaryLinks_xk >, CondCont< InDet::SiElementPropertiesTable >, CondCont< InDet::SiliconPropertiesVector >, CondCont< InDet::TRT_DetElementsRoadData_xk >, CondCont< InDet::TRT_TrackSegmentsToolCondData_xk >, CondCont< InDet::TRTPIDNN >, CondCont< InDetDD::HGTD_DetectorElementCollection >, CondCont< InDetDD::SiDetectorElementCollection >, CondCont< InDetDD::TRT_DetElementContainer >, CondCont< ITk::PixelOfflineCalibData >, CondCont< ITkPixelCablingData >, CondCont< ITkStripCablingData >, CondCont< JGTowerMappingData >, CondCont< L1CaloDerivedRunParsContainer >, CondCont< L1CaloDisabledTowersContainer >, CondCont< L1CaloPpmDeadChannelsContainer >, CondCont< L1CaloPpmFineTimeRefsContainer >, CondCont< L1CaloPprChanCalibContainer >, CondCont< L1CaloPprChanDefaultsContainer >, CondCont< L1CaloPprChanStrategyContainer >, CondCont< L1CaloPprConditionsContainerRun2 >, CondCont< L1CaloPprDisabledChannelContainerRun2 >, CondCont< L1CaloReadoutConfigContainer >, CondCont< L1CaloReadoutConfigContainerJSON >, CondCont< L1CaloRunParametersContainer >, CondCont< LArADC2MeV >, CondCont< LArAutoCorrNoise >, CondCont< LArAutoCorrTotal >, CondCont< LArBadXCont< LArBadChannel > >, CondCont< LArBadXCont< LArBadFeb > >, CondCont< LArCalibLineMapping >, CondCont< LArCaliWaveContainer >, CondCont< LArDeadOTXCorrFactors >, CondCont< LArDSPThresholdsComplete >, CondCont< LArFebConfig >, CondCont< LArFebRodMapping >, CondCont< LArFEBTempData >, CondCont< LArfSamplSC >, CondCont< LArHVCorr >, CondCont< LArHVIdMapping >, CondCont< LArHVNMap >, CondCont< LArHVPathology >, CondCont< LArLATOMEMapping >, CondCont< LArMCSym >, CondCont< LArOFC >, CondCont< LArOFCweightSC >, CondCont< LArOnOffIdMapping >, CondCont< LArRinjComplete >, CondCont< LArRoIMap >, CondCont< LArXTalkWeight >, CondCont< LArXTalkWeightGlobal >, CondCont< LBDurationCondData >, CondCont< LuminosityCondData >, CondCont< LVL1::gFEXDBCondData >, CondCont< LVL1::jFEXDBCondData >, CondCont< LWTNNCollection >, CondCont< MC_t >, CondCont< MdtAsBuiltContainer >, CondCont< MdtCondDbData >, CondCont< Muon::DigitEffiData >, CondCont< Muon::mmCTPClusterCalibData >, CondCont< Muon::MuonIntersectGeoData >, CondCont< Muon::RpcCablingMap >, CondCont< Muon::TwinTubeMap >, CondCont< MuonAlignmentErrorData >, CondCont< MuonCalib::MdtCalibDataContainer >, CondCont< MuonGM::MuonDetectorManager >, CondCont< MuonMDT_CablingMap >, CondCont< Nsw_CablingMap >, CondCont< NswAsBuiltDbData >, CondCont< NswCalibDbThresholdData >, CondCont< NswCalibDbTimeChargeData >, CondCont< NswDcsDbData >, CondCont< NswErrorCalibData >, CondCont< NswPassivationDbData >, CondCont< NswT0Data >, CondCont< OnlineLumiCalibrationCondData >, CondCont< PixelCablingCondData >, CondCont< PixelCalib::PixelOfflineCalibData >, CondCont< PixelChargeCalibCondData >, CondCont< PixelDCSHVData >, CondCont< PixelDCSStateData >, CondCont< PixelDCSStatusData >, CondCont< PixelDCSTempData >, CondCont< PixelDeadMapCondData >, CondCont< PixeldEdxData >, CondCont< PixelDistortionData >, CondCont< PixelHitDiscCnfgData >, CondCont< PixelModuleData >, CondCont< PixelRadiationDamageFluenceMapData >, CondCont< PixelReadoutSpeedData >, CondCont< PixelTDAQData >, CondCont< REFCONTAINER >, CondCont< RegSelCondData< IRegSelLUT > >, CondCont< RIO_OnTrackErrorScaling >, CondCont< RpcCablingCondData >, CondCont< RpcCondDbData >, CondCont< RtRelationContainer >, CondCont< SCT_AllGoodStripInfo >, CondCont< SCT_CablingData >, CondCont< SCT_CalibDefectData >, CondCont< SCT_CondParameterData >, CondCont< SCT_ConfigurationCondData >, CondCont< SCT_DCSFloatCondData >, CondCont< SCT_DCSStatCondData >, CondCont< SCT_GainCalibData >, CondCont< SCT_MajorityCondData >, CondCont< SCT_ModuleVetoCondData >, CondCont< SCT_MonitorCondData >, CondCont< SCT_NoiseCalibData >, CondCont< SCT_SensorsCondData >, CondCont< SCT_TdaqEnabledCondData >, CondCont< SiDetElementsLayerVectors_xk >, CondCont< SiLorentzAngleCondData >, CondCont< sTGCAsBuiltData >, CondCont< StrawT0Container >, CondCont< SYM_t >, CondCont< T_DefectsData >, CondCont< T_EmulatedDefects >, CondCont< TgcCondDbData >, CondCont< TgcDigitASDposData >, CondCont< TgcDigitCrosstalkData >, CondCont< TgcDigitJitterData >, CondCont< TgcDigitThresholdData >, CondCont< TgcDigitTimeOffsetData >, CondCont< TGCTriggerData >, CondCont< TGCTriggerLUTs >, CondCont< TileBadChannels >, CondCont< TileCalibData< TileCalibDrawerFlt > >, CondCont< TileCalibData< TileCalibDrawerOfc > >, CondCont< TileDCSState >, CondCont< TileEMScale >, CondCont< TileHid2RESrcID >, CondCont< TilePulse >, CondCont< TileSampleNoise >, CondCont< TileSamplingFraction >, CondCont< TileTiming >, CondCont< TrigConf::HLTPrescalesSet >, CondCont< TrigConf::L1BunchGroupSet >, CondCont< TrigConf::L1PrescalesSet >, CondCont< TrigLiveFractionCondData >, CondCont< Trk::LayerMaterialMap >, CondCont< Trk::SolenoidParametrization >, CondCont< Trk::TrackingGeometry >, CondCont< TRTCond::ActiveFraction >, CondCont< TRTCond::AliveStraws >, CondCont< TRTCond::AverageT0 >, CondCont< TRTCond::HWMap >, CondCont< TRTCond::RtRelationMultChanContainer >, CondCont< TRTCond::StrawDxContainer >, CondCont< TRTCond::StrawStatusData >, CondCont< TRTCond::StrawStatusMultChanContainer >, CondCont< TRTCond::StrawStatusSummary >, CondCont< TRTCond::StrawT0MultChanContainer >, CondCont< TRTDedxcorrection >, CondCont< TTrainedNetworkCollection >, and CondContMixed< T >.

◆ 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;
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}
#define endmsg
@ SINGLE
Either TIMESTAMP or RUNLBN, but nothing's been put in the container yet, so we don't know which one.
Definition CondCont.h:183
@ TIMESTAMP
Container uses timestamp keys.
Definition CondCont.h:186
@ RUNLBN
Container uses run+lbn keys.
Definition CondCont.h:189
std::string title() const
Description of this container to use for MsgStream.
Definition CondCont.cxx:749
static key_type keyFromTimestamp(const EventIDBase &b)
Make a timestamp key from an EventIDBase.
static key_type keyFromRunLBN(const EventIDBase &b)
Make a run+lbn key from an EventIDBase.
IMessageSvc * getMessageSvc(bool quiet=false)
MsgStream & msg
Definition testRead.cxx:32

◆ 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{
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;
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}
@ MIXED
Mixed Run+lbn / timestamp container.
Definition CondCont.h:192
uint64_t key_type
Type used to store an IOV time internally.
Definition CondCont.h:204
Range object to store in ConcurrentRangeMap.
Definition CondCont.h:425

◆ 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;
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;
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
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}
#define ATH_UNLIKELY(x)
int r
Definition globals.cxx:22
bool first
Definition DeMoScan.py:534
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ 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
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}
StatusCode inserted(const EventContext &ctx)
Tell the cleaner that a new object was added to the container.
Definition CondCont.cxx:686

◆ 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()

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

Make a run+lbn key from an EventIDBase.

Parameters
EventID to convert.

◆ keyFromTimestamp()

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}
virtual void list(std::ostream &ost) const =0
Dump the container contents for debugging.

◆ 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
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}
static std::string s_cleanerSvcName ATLAS_THREAD_SAFE
Name of the global conditions cleaner service.
Definition CondCont.h:686
CxxUtils::ConcurrentRangeMap< RangeKey, key_type, void, Compare, Athena::RCUUpdater > CondContSet
Definition CondCont.h:517

◆ 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: