#include <CondSvc.h>
|
| | CondSvc (const std::string &name, ISvcLocator *svc) |
| virtual StatusCode | initialize () override |
| virtual StatusCode | start () override |
| virtual StatusCode | stop () override |
| virtual StatusCode | regHandle (IAlgorithm *alg, const Gaudi::DataHandle &id) override |
| virtual bool | isValidID (const EventContext &, const DataObjID &) const override |
| virtual const std::set< IAlgorithm * > & | condAlgs () const override |
| virtual bool | isRegistered (const DataObjID &id) const override |
| virtual bool | isRegistered (IAlgorithm *ialg) const override |
| virtual const DataObjIDColl & | conditionIDs () const override |
| virtual StatusCode | validRanges (std::vector< EventIDRange > &ranges, const DataObjID &id) const override |
| virtual void | dump (std::ostream &) const override |
| virtual StatusCode | setupDone () override |
| | To be called after changes to the set of conditions containers in the conditions store.
|
| virtual ConditionSlotFuture * | startConditionSetup (const EventContext &) override |
| | unimplemented interfaces
|
| virtual StatusCode | registerConditionIOSvc (IConditionIOSvc *) override |
| | register an IConditionIOSvc (alternative to Algorithm processing of Conditions)
|
|
| StatusCode | regHandle_i (IAlgorithm *alg, const Gaudi::DataHandle &id) |
Definition at line 22 of file CondSvc.h.
◆ CondSvc()
| CondSvc::CondSvc |
( |
const std::string & | name, |
|
|
ISvcLocator * | svc ) |
Definition at line 13 of file CondSvc.cxx.
13 :
14 base_class(name,svcLoc),
15 m_sgs(
"StoreGateSvc/ConditionStore", name)
16{
17}
ServiceHandle< StoreGateSvc > m_sgs
◆ condAlgs()
| virtual const std::set< IAlgorithm * > & CondSvc::condAlgs |
( |
| ) |
const |
|
inlineoverridevirtual |
Definition at line 35 of file CondSvc.h.
std::set< IAlgorithm * > m_condAlgs
◆ conditionIDs()
| virtual const DataObjIDColl & CondSvc::conditionIDs |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ dump()
| void CondSvc::dump |
( |
std::ostream & | ost | ) |
const |
|
overridevirtual |
Definition at line 53 of file CondSvc.cxx.
53 {
54
55 std::scoped_lock lock(
m_lock);
56
57 ost <<
"CondSvc::dump()";
58
59 ost <<
"\ndumping id->alg map\n";
60 for (
const auto& [
id, alg] :
m_idMap) {
61 ost <<
"\n + " <<
id <<
" : " <<
alg->name();
62 }
63
64 ost <<
"\n\ndumping ConditionStore:\n\n";
65
66 SG::ConstIterator<CondContBase> cib,cie;
67 if (
m_sgs->retrieve(cib,cie).isSuccess()) {
68 while (cib != cie) {
70 cib->list(ost);
71 ++cib;
72 }
73 }
74
76
77}
std::unordered_map< DataObjID, IAlgorithm *, DataObjID_Hasher > m_idMap
Map from DataObjID to Algorithm to avoid duplicates.
◆ initialize()
| StatusCode CondSvc::initialize |
( |
| ) |
|
|
overridevirtual |
Definition at line 42 of file CondSvc.cxx.
42 {
43
45
46 return StatusCode::SUCCESS;
47
48}
#define ATH_CHECK
Evaluate an expression and check for errors.
◆ isRegistered() [1/2]
| virtual bool CondSvc::isRegistered |
( |
const DataObjID & | id | ) |
const |
|
inlineoverridevirtual |
◆ isRegistered() [2/2]
| virtual bool CondSvc::isRegistered |
( |
IAlgorithm * | ialg | ) |
const |
|
inlineoverridevirtual |
◆ isValidID()
| bool CondSvc::isValidID |
( |
const EventContext & | ctx, |
|
|
const DataObjID & | id ) const |
|
overridevirtual |
Definition at line 166 of file CondSvc.cxx.
166 {
167
168
169
170
171
174 const bool valid =
it->second->valid (ctx.eventID());
175 ATH_MSG_VERBOSE(
"CondSvc::isValidID: now: " << ctx.eventID() <<
" id : "
176 << id << (valid ? ": T" : ": F") );
178 }
179 else {
181 }
182
183 return false;
184
185}
#define ATH_MSG_VERBOSE(x)
std::unordered_map< DataObjID, const CondContBase *, DataObjID_Hasher > m_condConts
Map from DataObjID to CondContBase (populated in setupDone)
◆ regHandle()
| StatusCode CondSvc::regHandle |
( |
IAlgorithm * | alg, |
|
|
const Gaudi::DataHandle & | id ) |
|
overridevirtual |
Definition at line 109 of file CondSvc.cxx.
109 {
110
111 std::scoped_lock lock(
m_lock);
113
114}
StatusCode regHandle_i(IAlgorithm *alg, const Gaudi::DataHandle &id)
◆ regHandle_i()
| StatusCode CondSvc::regHandle_i |
( |
IAlgorithm * | alg, |
|
|
const Gaudi::DataHandle & | id ) |
|
private |
Definition at line 120 of file CondSvc.cxx.
120 {
121
124
125 if (
dh.mode() != Gaudi::DataHandle::Writer) {
126 ATH_MSG_DEBUG(
dh.fullKey() <<
" is a ReadHandle. No need to register.");
127 return StatusCode::SUCCESS;
128 }
129
130 const auto [itr, success] =
m_idMap.try_emplace(
dh.fullKey(), alg);
131 if (!success) {
132 const IAlgorithm *ia = itr->second;
133 if (ia->name() !=
alg->name()) {
135 << " is already registered against a different Algorithm "
136 << ia->name()
137 << ". This is not allowed.");
138 return StatusCode::FAILURE;
139 }
140 }
141
144
146
147 const CLID clid =
dh.fullKey().clid();
149 if ( bib ) {
151 if (clid2 != clid) {
152 SG::VarHandleKey vhk(clid2,
dh.objKey(),Gaudi::DataHandle::Writer,
155 }
156 }
157 }
158
160}
uint32_t CLID
The Class ID type.
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
const std::vector< CLID > & get_bases() const
Return the class IDs of all known bases of T (that have class IDs).
static const std::string & storeName(const StoreID::type &s)
::StatusCode StatusCode
StatusCode definition for legacy code.
◆ registerConditionIOSvc()
| virtual StatusCode CondSvc::registerConditionIOSvc |
( |
IConditionIOSvc * | | ) |
|
|
inlineoverridevirtual |
register an IConditionIOSvc (alternative to Algorithm processing of Conditions)
Definition at line 60 of file CondSvc.h.
60 {
61 return StatusCode::FAILURE;
62 }
◆ setupDone()
| StatusCode CondSvc::setupDone |
( |
| ) |
|
|
overridevirtual |
To be called after changes to the set of conditions containers in the conditions store.
Create DataObjID -> CondCont map for usage in isValidID.
May not be called concurrently with any other methods of this class.
As some conditions are looked up via their base class, we need to register each CondCont key against all its possible bases.
Definition at line 195 of file CondSvc.cxx.
196{
197 std::scoped_lock lock(
m_lock);
198
199
201
202 SG::ConstIterator<CondContBase> cib, cie;
203 if (
m_sgs->retrieve(cib,cie).isSuccess()) {
204 while(cib != cie) {
205
206 CLID clid = cib->id().clid();
208 if ( !bib ) {
209
210 m_condConts.try_emplace( DataObjID(clid, storePrefix + cib.
key()), &*cib );
211 }
212 else {
213
215 m_condConts.try_emplace( DataObjID(clid2, storePrefix + cib.
key()), &*cib );
216 }
217 }
218 ++cib;
219 }
220 }
221
222 return StatusCode::SUCCESS;
223}
const std::string & key() const
Get the key string with which the current object was stored.
◆ start()
| StatusCode CondSvc::start |
( |
| ) |
|
|
overridevirtual |
Definition at line 82 of file CondSvc.cxx.
83{
84
86 return StatusCode::SUCCESS;
87}
virtual StatusCode setupDone() override
To be called after changes to the set of conditions containers in the conditions store.
◆ startConditionSetup()
| virtual ConditionSlotFuture * CondSvc::startConditionSetup |
( |
const EventContext & | | ) |
|
|
inlineoverridevirtual |
unimplemented interfaces
Asynchronously setup conditions
Definition at line 54 of file CondSvc.h.
54 {
55 return nullptr;
56 }
◆ stop()
| StatusCode CondSvc::stop |
( |
| ) |
|
|
overridevirtual |
Definition at line 91 of file CondSvc.cxx.
91 {
92
94
95 if (msgLvl(MSG::DEBUG)) {
96 std::ostringstream
ost;
98
100 }
101
102 return StatusCode::SUCCESS;
103
104}
virtual void dump(std::ostream &) const override
◆ validRanges()
| StatusCode CondSvc::validRanges |
( |
std::vector< EventIDRange > & | ranges, |
|
|
const DataObjID & | id ) const |
|
overridevirtual |
Definition at line 22 of file CondSvc.cxx.
23{
24
25 SG::ConstIterator< CondContBase > cib, cie;
27 if (
sc.isSuccess() ) {
28 while ( cib != cie ) {
29 if ( cib->id() == id ) {
31 }
32 ++cib;
33 }
34 }
35
37}
◆ m_condAlgs
| std::set<IAlgorithm*> CondSvc::m_condAlgs |
|
private |
◆ m_condConts
| std::unordered_map<DataObjID, const CondContBase*, DataObjID_Hasher> CondSvc::m_condConts |
|
private |
◆ m_condIDs
| DataObjIDColl CondSvc::m_condIDs |
|
private |
◆ m_idMap
| std::unordered_map<DataObjID, IAlgorithm*, DataObjID_Hasher> CondSvc::m_idMap |
|
private |
Map from DataObjID to Algorithm to avoid duplicates.
Definition at line 76 of file CondSvc.h.
◆ m_lock
| std::mutex CondSvc::m_lock |
|
mutableprivate |
◆ m_sgs
The documentation for this class was generated from the following files: