|
ATLAS Offline Software
|
Go to the documentation of this file.
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 ) :
61 m_condStore(
"StoreGateSvc/ConditionStore",
name),
62 m_condSvc(
"CondSvc",
name),
63 m_IOVSvc(
"IOVSvc",
name),
64 m_IOVDbSvc(
"IOVDbSvc",
name),
65 m_clidSvc(
"ClassIDSvc",
name),
66 m_rcuSvc(
"Athena::RCUSvc",
name)
71 auto props = getProperties();
72 for( Gaudi::Details::PropertyBase* prop : props ) {
73 if (prop->name() ==
"ExtraOutputs" || prop->name() ==
"ExtraInputs") {
74 prop->declareUpdateHandler
104 DataObjIDColl handles_to_load;
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");
195 if (!setProperty(
"ExtraOutputs",
p).isSuccess()) {
197 return StatusCode::FAILURE;
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");
274 << ditr->key() <<
"'");
275 if (
m_condStore->recordObject(cb, vhk.
key(),
true,
false) ==
nullptr) {
280 m_vhk.push_back(vhk);
284 m_vhk.push_back(vhk);
289 ATH_MSG_FATAL(
"Unable to setup some of the requested CondCont<T>. "
291 return StatusCode::FAILURE;
300 return StatusCode::SUCCESS;
313 if (!getContext().
valid()) {
318 return StatusCode::FAILURE;
328 now.set_event_number(getContext().eventID().event_number());
329 now.set_lumi_block(getContext().eventID().lumi_block());
330 now.set_time_stamp(getContext().eventID().time_stamp());
331 now.set_time_stamp_ns_offset(getContext().eventID().time_stamp_ns_offset());
334 EventIDBase now_event =
now;
335 now.set_event_number (EventIDBase::UNDEFEVT);
343 if (conditionsRun != EventIDBase::UNDEFNUM) {
344 now.set_run_number (conditionsRun);
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;
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);
def retrieve(aClass, aKey=None)
Interface to tell CondSvc to cache conditions containers.
uint64_t eventNumber() const
The current event's event number.
Validity Range object. Holds two IOVTime instances (start and stop)
static CondContFactory & Instance()
SG::DataObjectSharedPtr< DataObject > Create(Athena::IRCUSvc &rcusvc, const CLID &clid, const std::string &key) const
EventIDBase::number_type conditionsRun() const
virtual bool valid(const EventIDBase &t) const =0
Test to see if a given IOV time is mapped in the container.
const std::string & key() const
Return the StoreGate ID for the referenced object.
uint32_t timeStampNSOffset() const
Nanosecond time offset wrt. the time stamp.
Abstract interface to IOVDbSvc to access IOVRange and tag information.
const std::vector< CLID > & get_bases() const
Return the class IDs of all known bases of T (that have class IDs).
uint32_t runNumber() const
The current event's run number.
Basic time unit for IOVSvc. Hold time as a combination of run and event numbers.
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Provide an interface for finding inheritance information at run time.
::StatusCode StatusCode
StatusCode definition for legacy code.
Base class for all conditions containers.
T getProperty(const asg::IAsgTool *interface_tool, const std::string &prop_name)
uint32_t CLID
The Class ID type.
uint32_t lumiBlock() const
The current event's luminosity block number.
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
Helpers for checking error return status codes and reporting errors.
CLID clid() const
Return the class ID for the referenced object.
A property holding a SG store/key/clid from which a VarHandle is made.
Class describing the basic event information.
Run a MT piece of code with an alternate root error handler.
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
#define ATH_MSG_WARNING(x)
virtual const std::type_info & persistentTInfo() const =0
return C++ type id of the persistent class this converter is for
The non-template portion of the BaseInfo implementation.
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
Filled by IIOVDbSvc::getKeyInfo.
Smart pointer to manage DataObject reference counts.
Handle class for reading from StoreGate.
static const std::string & storeName(const StoreID::type &s)
TBaseAdapter BaseAt(size_t nth) const