14#include "Gaudi/Property.h"
26 struct DataObjIDSorter {
27 bool operator()(
const DataObjID*
a,
const DataObjID* b ) {
return a->fullKey() <
b->fullKey(); }
32 std::vector<const DataObjID*> sortedDataObjIDColl(
const DataObjIDColl& coll )
34 std::vector<const DataObjID*>
v;
35 v.reserve( coll.size() );
36 for (
const DataObjID&
id : coll )
v.push_back( &
id );
45 ISvcLocator* pSvcLocator ) :
68 StatusCode
sc(StatusCode::SUCCESS);
71 std::ostringstream
str;
72 str <<
"Will explicitly preload the following DataObjects:";
75 if (e.key().empty()) {
76 sc = StatusCode::FAILURE;
77 str <<
" ERROR: empty key is not allowed!";
93 return StatusCode::SUCCESS;
101 StatusCode
sc(StatusCode::SUCCESS);
108 for (DataObjID obj : outputDataObjs() ) {
110 std::string::size_type ppos = obj.key().find (
'.');
111 if (ppos < obj.key().size()-1) {
117 m_load.emplace (std::move(obj));
122 DataObjIDColl toLoad;
123 for (
const DataObjID* obj : sortedDataObjIDColl (
m_load)) {
126 ATH_MSG_DEBUG(obj->key() <<
" is in ExtraOutputs and will not be loaded");
128 }
else if(std::string::size_type ppos = obj->key().find (
'.'); ppos < obj->key().
size()-1) {
131 DataObjID objcopy(*obj);
132 objcopy.updateKey(obj->key().substr (0, ppos));
134 ATH_MSG_DEBUG(obj->key() <<
"'s object/container is in ExtraOutputs and will not be loaded");
140 toLoad.emplace(*obj);
145 return StatusCode::FAILURE;
148 ATH_MSG_DEBUG(
"Will not auto-load proxy for non-EventStore object: "
152 m_load = std::move(toLoad);
165 if (!eventDataHeader.
isValid()) {
167 return StatusCode::FAILURE;
169 for (
const auto& element : *eventDataHeader) {
171 if (dp != 0 && dp->isValid()) {
172 if (
nullptr == dp->accessData()) {
180 ATH_MSG_ERROR(
"autoload of objects failed. aborting event processing");
181 sc = StatusCode::FAILURE;
194 DataObjIDColl toLoad;
199 obj.updateKey( vhk.objKey() );
201 if(!outputDataObjs().
count(obj)) { addDependency(obj,Gaudi::DataHandle::Writer); }
203 m_load = std::move(toLoad);
214 for (
auto &obj: objs) {
216 std::string::size_type ppos = obj.key().substr(0,obj.key().size()-1).find(
'.');
220 SG::VarHandleKey vhk(obj.clid(),obj.key().substr(0,ppos),Gaudi::DataHandle::Reader);
228 if(ppos==std::string::npos) {
229 ATH_MSG_ERROR(
" obj " << obj <<
" has no provider, and is only Transient - indicative of a missing output declaration" );
232 ATH_MSG_WARNING(
" decoration " << obj <<
" has no provider, and is only Transient - either a decoration output declaration is missing, or a ReadDecorHandleKey is being used to read a non-decoration" );
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Helpers for checking error return status codes and reporting errors.
A property holding a SG store/key/clid from which a VarHandle is made.
size_t size() const
Number of registered mappings.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
virtual const DataObjIDColl & extraOutputDeps() const override
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
virtual bool isValid() override final
Can the handle be successfully dereferenced?
A property holding a SG store/key/clid from which a VarHandle is made.
const std::string & key() const
Return the StoreGate ID for the referenced object.
const ServiceHandle< IProxyDict > & storeHandle() const
Return handle to the referenced store.
static StoreID::type findStoreID(const std::string &storeName)
std::string find(const std::string &s)
return a remapped string
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.