14#include "Gaudi/Property.h"
15#include "GaudiKernel/IClassIDSvc.h"
36 struct DataObjIDSorter {
37 bool operator()(
const DataObjID*
a,
const DataObjID* b ) {
return a->fullKey() <
b->fullKey(); }
42 std::vector<const DataObjID*> sortedDataObjIDColl(
const DataObjIDColl& coll )
44 std::vector<const DataObjID*>
v;
45 v.reserve( coll.size() );
46 for (
const DataObjID&
id : coll )
v.push_back( &
id );
59 ISvcLocator* pSvcLocator ) :
71 auto props = getProperties();
72 for( Gaudi::Details::PropertyBase* prop : props ) {
73 if (prop->name() ==
"ExtraOutputs" || prop->name() ==
"ExtraInputs") {
74 prop->declareUpdateHandler
102 std::vector<std::string> keys =
m_IOVDbSvc->getKeyList();
104 DataObjIDColl handles_to_load;
106 for (
const std::string& key : keys) {
115 TClass::GetClass (
"coral::AttributeList",
true,
false);
119 if (
id.key() == itr.second) {
120 if (itr.second != itr.first) {
123 id.updateKey( itr.first );
128 handles_to_load.emplace(vhk.fullKey());
138 std::string pat =
"LArConditionsContainer<";
139 for (
size_t ibase = 0; ibase < nbases; ++ibase) {
142 std::string subset =
"LArConditionsSubset<" +
basename.substr (pat.size(), std::string::npos);
144 loadDict (
"LArConditionsSubset_p1");
162 std::ostringstream ost;
163 ost <<
"Adding base classes:";
164 for (
auto &e : sortedDataObjIDColl (handles_to_load)) {
166 if (e->key().empty())
continue;
168 ost <<
"\n + " << *e <<
" ->";
169 CLID clid = e->clid();
176 std::string
base(
"UNKNOWN");
178 ost <<
" " <<
base <<
" (" << clid2 <<
")";
181 m_load.value().emplace(vhk.fullKey());
192 const Gaudi::Details::PropertyBase &p = getProperty(
"Load");
194 ATH_MSG_DEBUG(
"setting prop ExtraOutputs to " << p.toString());
197 return StatusCode::FAILURE;
200 StatusCode
sc(StatusCode::SUCCESS);
201 std::ostringstream
str;
202 str <<
"Will create WriteCondHandle dependencies for the following DataObjects:";
203 for (
auto &e : sortedDataObjIDColl(
m_load)) {
204 str <<
"\n + " << *e;
205 if (e->key().empty()) {
206 sc = StatusCode::FAILURE;
207 str <<
" ERROR: empty key is not allowed!";
211 if (
m_condSvc->regHandle(
this, vhk).isFailure()) {
212 ATH_MSG_ERROR(
"Unable to register WriteCondHandle " << vhk.fullKey());
213 sc = StatusCode::FAILURE;
231 return StatusCode::SUCCESS;
254 std::string tp(
"UNKNOWN");
255 if (
m_clidSvc->getTypeNameOfID(ditr->clid(),tp).isFailure()) {
256 ATH_MSG_WARNING(
"unable to convert clid " << ditr->clid() <<
" to a classname."
257 <<
"This is a BAD sign, but will try to continue");
263 (void)TClass::GetClass (tp.c_str());
269 <<
"> clid=" << ditr->clid()
270 <<
" : no factory found");
273 ATH_MSG_INFO(
"created CondCont<" << tp <<
"> with key '"
274 << ditr->key() <<
"'");
275 if (
m_condStore->recordObject(cb, vhk.
key(),
true,
false) ==
nullptr) {
280 m_vhk.emplace_back(std::move(vhk));
284 m_vhk.emplace_back(std::move(vhk));
289 ATH_MSG_FATAL(
"Unable to setup some of the requested CondCont<T>. "
291 return StatusCode::FAILURE;
300 return StatusCode::SUCCESS;
316 if(
evtStore()->retrieve(thisEventInfo)!=StatusCode::SUCCESS) {
318 return StatusCode::FAILURE;
320 now.set_run_number(thisEventInfo->
runNumber());
321 now.set_event_number(thisEventInfo->
eventNumber());
322 now.set_lumi_block(thisEventInfo->
lumiBlock());
323 now.set_time_stamp(thisEventInfo->
timeStamp());
327 now.set_run_number(ctx.eventID().run_number());
328 now.set_event_number(ctx.eventID().event_number());
329 now.set_lumi_block(ctx.eventID().lumi_block());
330 now.set_time_stamp(ctx.eventID().time_stamp());
331 now.set_time_stamp_ns_offset(ctx.eventID().time_stamp_ns_offset());
334 EventIDBase now_event = now;
335 now.set_event_number (EventIDBase::UNDEFEVT);
341 EventIDBase::number_type conditionsRun =
343 if (conditionsRun != EventIDBase::UNDEFNUM) {
344 now.set_run_number (conditionsRun);
347 StatusCode
sc(StatusCode::SUCCESS);
349 for (
auto &vhk:
m_vhk) {
350 ATH_MSG_DEBUG(
"handling id: " << vhk.fullKey() <<
" key: " << vhk.key() );
353 if (!
m_condStore->retrieve(ccb, vhk.key()).isSuccess()) {
354 ATH_MSG_ERROR(
"unable to get CondContBase* for " << vhk.fullKey()
355 <<
" from ConditionStore" );
356 sc = StatusCode::FAILURE;
360 if (ccb->
valid(now)) {
361 ATH_MSG_DEBUG(
" CondObj " << vhk.fullKey() <<
" is still valid at " << now_event );
366 if (
m_IOVSvc->createCondObj( ccb, vhk.fullKey(), now ).isFailure()) {
367 ATH_MSG_ERROR(
"unable to create Cond object for " << vhk.fullKey() <<
" dbKey: "
369 sc = StatusCode::FAILURE;
379 std::ostringstream ost;
401 std::unique_ptr<ITPCnvBase> tpcnv =
m_tpCnvSvc->t2p_cnv_unique (name);
417 if (
m_clidSvc->getTypeNameOfID (clid, name).isSuccess()) {
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Provide an interface for finding inheritance information at run time.
Helpers for checking error return status codes and reporting errors.
uint32_t CLID
The Class ID type.
Interface to tell CondSvc to cache conditions containers.
Abstract interface to IOVDbSvc to access IOVRange and tag information.
Basic time unit for IOVSvc.
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
Handle class for reading from StoreGate.
Run a MT piece of code with an alternate root error handler.
ServiceHandle< StoreGateSvc > & evtStore()
An algorithm that can be simultaneously executed in multiple threads.
EventIDBase::number_type conditionsRun() const
Base class for all conditions containers.
virtual bool valid(const EventIDBase &t) const =0
Test to see if a given IOV time is mapped in the container.
SG::DataObjectSharedPtr< DataObject > Create(Athena::IRCUSvc &rcusvc, const CLID &clid, const std::string &key) const
static CondContFactory & Instance()
The non-template portion of the BaseInfo implementation.
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).
A property holding a SG store/key/clid from which a VarHandle is made.
CLID clid() const
Return the class ID for the referenced object.
const std::string & key() const
Return the StoreGate ID for the referenced object.
static const std::string & storeName(const StoreID::type &s)
TBaseAdapter BaseAt(size_t nth) const
uint32_t lumiBlock() const
The current event's luminosity block number.
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
uint32_t runNumber() const
The current event's run number.
uint32_t timeStampNSOffset() const
Nanosecond time offset wrt. the time stamp.
uint64_t eventNumber() const
The current event's event number.
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
CxxUtils::RefCountedPtr< T > DataObjectSharedPtr
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
EventInfo_v1 EventInfo
Definition of the latest event info version.
Filled by IIOVDbSvc::getKeyInfo.
std::string basename(std::string name)