14#include "Gaudi/Property.h"
24 struct DataObjIDSorter {
25 bool operator()(
const DataObjID*
a,
const DataObjID* b ) {
return a->fullKey() <
b->fullKey(); }
30 std::vector<const DataObjID*> sortedDataObjIDColl(
const DataObjIDColl& coll )
32 std::vector<const DataObjID*>
v;
33 v.reserve( coll.size() );
34 for (
const DataObjID&
id : coll )
v.push_back( &
id );
43 ISvcLocator* pSvcLocator ) :
66 StatusCode
sc(StatusCode::SUCCESS);
69 std::ostringstream
str;
70 str <<
"Will explicitly preload the following DataObjects:";
73 if (e.key().empty()) {
74 sc = StatusCode::FAILURE;
75 str <<
" ERROR: empty key is not allowed!";
91 return StatusCode::SUCCESS;
99 StatusCode
sc(StatusCode::SUCCESS);
106 for (DataObjID obj : outputDataObjs() ) {
108 std::string::size_type ppos = obj.key().find (
'.');
109 if (ppos < obj.key().size()-1) {
115 m_load.emplace (std::move(obj));
120 DataObjIDColl toLoad;
121 for (
const DataObjID* obj : sortedDataObjIDColl (
m_load)) {
124 ATH_MSG_DEBUG(obj->key() <<
" is in ExtraOutputs and will not be loaded");
126 }
else if(std::string::size_type ppos = obj->key().find (
'.'); ppos < obj->key().size()-1) {
129 DataObjID objcopy(*obj);
130 objcopy.updateKey(obj->key().substr (0, ppos));
132 ATH_MSG_DEBUG(obj->key() <<
"'s object/container is in ExtraOutputs and will not be loaded");
138 toLoad.emplace(*obj);
143 return StatusCode::FAILURE;
146 ATH_MSG_DEBUG(
"Will not auto-load proxy for non-EventStore object: "
150 m_load = std::move(toLoad);
162 ATH_MSG_ERROR(
"autoload of objects failed. aborting event processing");
163 sc = StatusCode::FAILURE;
176 DataObjIDColl toLoad;
181 obj.updateKey( vhk.objKey() );
183 if(!outputDataObjs().
count(obj)) { addDependency(obj,Gaudi::DataHandle::Writer); }
185 m_load = std::move(toLoad);
196 for (
auto &obj: objs) {
198 std::string::size_type ppos = obj.key().substr(0,obj.key().size()-1).find(
'.');
202 SG::VarHandleKey vhk(obj.clid(),obj.key().substr(0,ppos),Gaudi::DataHandle::Reader);
210 if(ppos==std::string::npos) {
211 ATH_MSG_ERROR(
" obj " << obj <<
" has no provider, and is only Transient - indicative of a missing output declaration" );
214 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.
virtual const DataObjIDColl & extraOutputDeps() const override
Return the list of extra output dependencies.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
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.