|
ATLAS Offline Software
|
This class provides the interface to the LCG POOL persistency software.
More...
#include <AddressRemappingSvc.h>
This class provides the interface to the LCG POOL persistency software.
Definition at line 39 of file AddressRemappingSvc.h.
◆ InputRenameMap_t
Map of sgkey->sgkey for input renames.
This object is exported via inputRenameMap and is synchronized via RCU.
Definition at line 112 of file AddressRemappingSvc.h.
◆ InputRenameRCU_t
◆ AddressRemappingSvc()
AddressRemappingSvc::AddressRemappingSvc |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ ~AddressRemappingSvc()
AddressRemappingSvc::~AddressRemappingSvc |
( |
| ) |
|
|
virtual |
◆ addInputRenames()
Merge in additional input rename mappings.
- Parameters
-
Additional sgkey->sgkey input rename mappings are merged into the rename map, using RCU synchronization.
Definition at line 115 of file AddressRemappingSvc.cxx.
117 if (toadd.empty())
return;
121 auto newmap = std::make_unique<InputRenameMap_t> (*
u);
122 for (
const auto&
p : toadd)
124 u.update (std::move (newmap));
◆ ATLAS_NOT_THREAD_SAFE() [1/2]
StatusCode initInputRenames AddressRemappingSvc::ATLAS_NOT_THREAD_SAFE |
( |
| ) |
|
|
private |
Set up input rename mappings during initialization.
◆ ATLAS_NOT_THREAD_SAFE() [2/2]
virtual StatusCode initialize AddressRemappingSvc::ATLAS_NOT_THREAD_SAFE |
( |
| ) |
|
|
overridevirtual |
Required of all Gaudi services:
◆ finalize()
StatusCode AddressRemappingSvc::finalize |
( |
| ) |
|
|
overridevirtual |
◆ getClid()
CLID AddressRemappingSvc::getClid |
( |
std::string |
type | ) |
const |
|
private |
◆ initDeletes()
void AddressRemappingSvc::initDeletes |
( |
| ) |
|
|
private |
Definition at line 498 of file AddressRemappingSvc.cxx.
508 for (IAlgorithm* ialg :
algs) {
509 if (Gaudi::Algorithm*
alg =
dynamic_cast<Gaudi::Algorithm*
> (ialg)) {
512 if (
alg->name() ==
"SGInputLoader")
continue;
515 if (
alg->type() ==
"AthViews::ViewDataVerifier" )
continue;
517 for (
const DataObjID& dobj :
alg->outputDataObjs()) {
518 static const std::string
pref =
"StoreGateSvc+";
519 if (dobj.key().rfind(pref, 0) != std::string::npos) {
520 std::string
key = dobj.key().substr (
pref.size());
527 if (dobj.fullKey().find (
"xAOD") != std::string::npos ||
528 dobj.fullKey().find (
"cinfo") != std::string::npos)
◆ inputRenameMap()
Retrieve a pointer to the input rename map.
May return null if no renaming is to be done.
Definition at line 491 of file AddressRemappingSvc.cxx.
◆ isDeleted()
◆ loadAddresses()
◆ loadAddressesConst()
Definition at line 241 of file AddressRemappingSvc.cxx.
245 return StatusCode::SUCCESS;
248 std::vector<SG::TransientAddress> oldTadsCleaned =
m_oldTads;
249 std::vector<SG::TransientAddress> newTadsCleaned =
m_newTads;
253 if (!
status.isSuccess()) {
258 newIter = newTadsCleaned.begin(), oldIterEnd = oldTadsCleaned.end();
259 oldIter != oldIterEnd; ++oldIter, ++newIter)
261 CLID goodCLID = newIter->clID();
263 std::set<CLID> clidToKeep (clidvec.begin(), clidvec.end());
268 clidToKeep.erase(goodCLID);
273 dataProxy =
m_proxyDict->proxy(goodCLID, newIter->name());
275 clidToKeep.erase(goodCLID);
279 ATH_MSG_DEBUG(
"Remapping " << oldIter->clID() <<
"#" << oldIter->name() <<
" to base-class CLID: " << goodCLID <<
"#" << newIter->name());
285 ATH_MSG_INFO(
"Skipping remapping of " << oldIter->clID() <<
"#" << oldIter->name() <<
" because no suitable remapping found");
291 for(
auto tIter = clidToKeep.begin(); tIter != clidToKeep.end(); ++tIter) {
292 if(goodCLID == *tIter)
continue;
296 if(oldIter->clID()!=tadd->
clID()) {
299 tads.push_back(tadd);
300 m_proxyDict->stringToKey(oldIter->name(), oldIter->clID());
301 m_proxyDict->stringToKey(newIter->name(), newIter->clID());
309 return StatusCode::SUCCESS;
◆ preLoadAddresses()
Get all addresses from provider.
Called before begin event.
- Parameters
-
storeID | [IN] store ID, this function only preloads detector store addresses. |
tads | [OUT] list of the transient addresses which were preloaded. |
Definition at line 185 of file AddressRemappingSvc.cxx.
◆ preLoadAddressesConst()
Definition at line 190 of file AddressRemappingSvc.cxx.
197 const std::vector<SG::TransientAddress>* oldTads =
nullptr;
198 const std::vector<SG::TransientAddress>* newTads =
nullptr;
204 return StatusCode::SUCCESS;
216 if (!
status.isSuccess()) {
220 for (std::vector<SG::TransientAddress>::const_iterator oldIter = oldTads->begin(),
221 newIter = newTads->begin(), oldIterEnd = oldTads->end();
222 oldIter != oldIterEnd; ++oldIter, ++newIter) {
224 tads.push_back(tadd);
225 m_proxyDict->stringToKey(oldIter->name(), oldIter->clID());
226 m_proxyDict->stringToKey(newIter->name(), newIter->clID());
228 return(StatusCode::SUCCESS);
◆ renameTads()
Scan TAD list and carry out any requested renamings.
- Parameters
-
tads | list of TADs from previous providers. |
Definition at line 365 of file AddressRemappingSvc.cxx.
374 if (
r->empty() &&
m_deletes.empty())
return StatusCode::SUCCESS;
391 if (
it !=
r->end()) {
392 const std::string& name_renamed =
it->second.m_key;
395 auto tad_new = std::make_unique<SG::TransientAddress>
396 (tad_clid, name_renamed,
399 if (clid == tad_clid)
continue;
400 tad_new->setTransientID (clid);
402 if (
r->find(from_key) ==
r->end()) {
408 size_t namelen = tad->
name().size();
410 for (
const std::string&
a : tad->
alias()) {
411 std::string a_renamed =
a;
414 auto it_a =
r->find (from_key);
415 if (it_a !=
r->end()) {
416 a_renamed = it_a->second.m_key;
419 if (strncmp (a_renamed.c_str(), tad->
name().c_str(), namelen) == 0 &&
420 a_renamed[namelen] ==
'.')
422 a_renamed = name_renamed + a_renamed.substr (namelen, std::string::npos);
425 newAliases.insert (a_renamed);
427 tad_new->setAlias (newAliases);
432 tad = tad_new.release();
440 auto tad_new = std::make_unique<SG::TransientAddress>
441 (tad->
clID(), tad->
name() +
"_DELETED",
445 for (
const std::string&
a : tad->
alias()) {
446 tad_new->setAlias (
a +
"_DELETED");
450 tad = tad_new.release();
458 for (
const std::string&
a : aset) {
460 auto it_a =
r->find (from_key);
461 if (it_a !=
r->end()) {
462 const std::string&
s = it_a->second.m_key;
475 return StatusCode::SUCCESS;
◆ updateAddress()
Update a transient address.
Do mapping from one address to another
- Parameters
-
tad | [IN] transient address to be updated. |
Definition at line 313 of file AddressRemappingSvc.cxx.
◆ updateAddressConst()
Definition at line 319 of file AddressRemappingSvc.cxx.
323 const std::vector<SG::TransientAddress>* oldTads =
nullptr;
324 const std::vector<SG::TransientAddress>* newTads =
nullptr;
336 for (std::vector<SG::TransientAddress>::const_iterator oldIter = oldTads->begin(),
337 newIter = newTads->begin(), oldIterEnd = oldTads->end();
338 oldIter != oldIterEnd; ++oldIter, ++newIter) {
339 if (oldIter->transientID(tad->clID())
340 && (oldIter->name() == tad->name() || oldIter->alias().find(tad->name()) != oldIter->alias().end())) {
341 ATH_MSG_DEBUG(
"Overwrite for: " << tad->clID() <<
"#" << tad->name() <<
" -> " << newIter->clID() <<
"#" << newIter->name());
343 if (dataProxy == 0) {
344 ATH_MSG_WARNING(
"Cannot get proxy for: " << newIter->clID() <<
"#" << newIter->name());
345 return(StatusCode::FAILURE);
347 GenericAddress* newGadd = 0;
348 if (dataProxy->isValidAddress()) newGadd =
dynamic_cast<GenericAddress*
>(dataProxy->address());
350 ATH_MSG_WARNING(
"Cannot get GenericAddress for: " << newIter->clID() <<
"#" << newIter->name());
351 return(StatusCode::FAILURE);
353 GenericAddress* oldGadd =
new GenericAddress(newGadd->svcType(), tad->clID(), *newGadd->par(), tad->name(), *newGadd->ipar());
354 tad->setAddress(oldGadd);
355 return(StatusCode::SUCCESS);
358 return(StatusCode::FAILURE);
◆ m_algResourcePool
ServiceHandle<IAlgResourcePool> AddressRemappingSvc::m_algResourcePool |
|
private |
Initial value:{this,"AlgResourcePool","AlgResourcePool",
"Algorithm resource pool service."}
Definition at line 85 of file AddressRemappingSvc.h.
◆ m_clidSvc
◆ m_deletes
std::unordered_multimap<std::string, CLID> AddressRemappingSvc::m_deletes |
|
private |
◆ m_deletesMutex
std::mutex AddressRemappingSvc::m_deletesMutex |
|
mutableprivate |
◆ m_haveDeletes
std::atomic<bool> AddressRemappingSvc::m_haveDeletes =false |
|
private |
◆ m_inputRenames
◆ m_newTads
◆ m_newTadsCleaned
◆ m_oldTads
◆ m_oldTadsCleaned
◆ m_overwriteMaps
StringArrayProperty AddressRemappingSvc::m_overwriteMaps {this,"TypeKeyOverwriteMaps",{},"","OrderedSet<std::string>"} |
|
private |
◆ m_proxyDict
Initial value:{this,"ProxyDict","StoreGateSvc",
"the IProxyDict we want to apply the remapping to (by default the event store)"}
Definition at line 82 of file AddressRemappingSvc.h.
◆ m_RCUSvc
◆ m_skipBadRemappings
Gaudi::Property<bool> AddressRemappingSvc::m_skipBadRemappings |
|
private |
Initial value:{this,"SkipBadRemappings",false,
"If true, will delay the remapping setup until the first load, and will check against the given file"}
Definition at line 116 of file AddressRemappingSvc.h.
◆ m_typeKeyRenameMaps
Gaudi::Property<std::vector<std::string> > AddressRemappingSvc::m_typeKeyRenameMaps |
|
private |
Initial value:{this,"TypeKeyRenameMaps",{},
"List of renamings to apply to input objects. This is distinct from the "
"mappings given by TypeKeyOverwriteMaps in that objects listed under "
"TypeKeyOverwriteMaps are accessible by both the old and new names; "
"while for TypeKeyRenameMaps, only the new names are visible (so the old names "
"may be rewritten). Overwriting may also change the visible type of an object, "
"while renaming may not. Format of list elements is OLDNAME#TYPE->NEWNAME.","OrderedSet<std::string>"}
Property: list of requested input renames.
Definition at line 101 of file AddressRemappingSvc.h.
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
bool isDeleted(const SG::TransientAddress &tad) const
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Gaudi::Property< bool > m_skipBadRemappings
const T * ptr() const
Return a pointer to the cached value.
Helper to update data in a RCUObject.
StoreID::type storeID() const
void addInputRenames(const InputRenameMap_t &toadd) const
Merge in additional input rename mappings.
bool isValid() const
Test to see if the value is valid.
std::unique_ptr< InputRenameRCU_t > m_inputRenames
void setAlias(const std::string &key)
set alias'
std::vector< SG::TransientAddress > m_oldTads
CxxUtils::CachedValue< std::vector< SG::TransientAddress > > m_oldTadsCleaned
std::vector< CLID > TransientClidSet
Strictly a set, but there shouldn't be more than a handful of entries, so store it as a sorted vector...
bool removeAlias(const std::string &key)
remove alias from proxy
std::atomic< bool > m_haveDeletes
const std::vector< CLID > & get_bases() const
Return the class IDs of all known bases of T (that have class IDs).
@ u
Enums for curvilinear frames.
ServiceHandle< IClassIDSvc > m_clidSvc
const std::string & name() const
Get the primary (hashed) SG key.
CxxUtils::CachedValue< std::vector< SG::TransientAddress > > m_newTadsCleaned
Type of the input rename map: sgkey_t -> sgkey_t.
const TransientAliasSet & alias() const
set the clearAddress flag: IOA will not be deleted in proxy
StatusCode renameTads(IAddressProvider::tadList &tads) const
Scan TAD list and carry out any requested renamings.
IAddressProvider * provider()
ServiceHandle< IAlgResourcePool > m_algResourcePool
::StatusCode StatusCode
StatusCode definition for legacy code.
Helper to read data from a RCUObject.
CLID clID() const
Retrieve string key:
Default, invalid implementation of ClassID_traits.
Athena::InputRenameMap_t InputRenameMap_t
Map of sgkey->sgkey for input renames.
uint32_t CLID
The Class ID type.
ServiceHandle< Athena::IRCUSvc > m_RCUSvc
std::unordered_multimap< std::string, CLID > m_deletes
static const BaseInfoBase * find(CLID clid)
Find the BaseInfoBase instance for clid.
void setTransientID(CLID id)
get transient CLID's
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
void set(const T &val) const
Set the value, assuming it is currently invalid.
StatusCode preLoadAddressesConst(StoreID::type storeID, IAddressProvider::tadList &tads) const
ServiceHandle< IProxyDict > m_proxyDict
#define ATH_MSG_WARNING(x)
The non-template portion of the BaseInfo implementation.
StatusCode updateAddressConst(StoreID::type, SG::TransientAddress *pTad, const EventContext &ctx) const
Gaudi::Property< std::vector< std::string > > m_typeKeyRenameMaps
Property: list of requested input renames.
StatusCode loadAddressesConst(IAddressProvider::tadList &tads) const
void clearAddress(const bool &flag)
Return the clearAddress flag.
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Athena::IInputRename::InputRenameRCU_t InputRenameRCU_t
#define ATLAS_THREAD_SAFE
std::set< std::string > TransientAliasSet
bool transientID(CLID id) const
set transient CLID's
std::mutex m_deletesMutex
std::vector< SG::TransientAddress > m_newTads