Skip to content

Commit 268d065

Browse files
committed
Remove unnecessary track keeping of id:name mapping
1 parent 8bd53ff commit 268d065

5 files changed

Lines changed: 3 additions & 23 deletions

File tree

k4MarlinWrapper/k4MarlinWrapper/converters/EDM4hep2Lcio.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class EDM4hep2LcioTool : public AlgTool, virtual public IEDMConverter {
7979
/// A (caching) "map" of original to new collection names that will be populated
8080
/// during the first conversion
8181
std::unordered_map<std::string, std::string> m_collsToConvert{};
82-
std::map<uint32_t, std::string> m_idToName;
8382

8483
void convertTracks(TrackMap& tracks_vec, const std::string& e4h_coll_name, const std::string& lcio_coll_name,
8584
lcio::LCEventImpl* lcio_event);

k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,10 @@ StatusCode EDM4hep2LcioTool::convertCollections(lcio::LCEventImpl* lcio_event) {
532532
// Always check the contents of the TES because algorithms that do not use
533533
// the PodioDataSvc (e.g. all Functional ones) go to the TES directly and
534534
// the PodioDataSvc Frame doesn't now about them.
535-
std::optional<std::map<uint32_t, std::string>> idToNameOpt(std::move(m_idToName));
536-
for (const auto& name : getAvailableCollectionsFromStore(this, idToNameOpt)) {
535+
for (const auto& name : getAvailableCollectionsFromStore(this)) {
537536
const auto& [_, inserted] = collNameMapping.emplace(name, name);
538537
debug() << fmt::format("Adding '{}' from TES to conversion? {}", name, inserted) << endmsg;
539538
}
540-
m_idToName = std::move(idToNameOpt.value());
541539

542540
for (auto&& [origName, newName] : collNameMapping) {
543541
m_collsToConvert.emplace(std::move(origName), std::move(newName));

k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ bool Lcio2EDM4hepTool::collectionExist(const std::string& collection_name) {
7474
if (m_podioDataSvc) {
7575
collections = m_podioDataSvc->getEventFrame().getAvailableCollections();
7676
} else {
77-
std::optional<std::map<uint32_t, std::string>> dummy = std::nullopt;
78-
collections = getAvailableCollectionsFromStore(this, dummy, true);
77+
collections = getAvailableCollectionsFromStore(this, true);
7978
}
8079
if (std::find(collections.begin(), collections.end(), collection_name) != collections.end()) {
8180
debug() << "Collection named " << collection_name << " already registered, skipping conversion." << endmsg;

k4MarlinWrapper/src/components/StoreUtils.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@
3939
// store that can be found in Writer.cpp in k4FWCore with some modifications
4040
// that are specific to the usage of this function in the converters, like
4141
// returning also a map from collection ID to collection name
42-
std::vector<std::string> getAvailableCollectionsFromStore(const AlgTool* thisClass,
43-
std::optional<std::map<uint32_t, std::string>>& idToName,
44-
bool returnFrameCollections) {
42+
std::vector<std::string> getAvailableCollectionsFromStore(const AlgTool* thisClass, bool returnFrameCollections) {
4543
std::vector<std::string> collectionNames;
4644

4745
SmartIF<IDataManagerSvc> mgr;
@@ -98,19 +96,6 @@ std::vector<std::string> getAvailableCollectionsFromStore(const AlgTool* thisCla
9896
auto name = pReg->name().substr(1, pReg->name().size() - 1);
9997
thisClass->verbose() << "Adding '" << name << "' as collection name obtained from TES" << endmsg;
10098
collectionNames.push_back(name);
101-
if (idToName) {
102-
if (functionalWrapper) {
103-
thisClass->verbose() << fmt::format("Retrieving id for '{}': {:0>8x}", name,
104-
functionalWrapper->getData()->getID())
105-
<< endmsg;
106-
idToName->emplace(functionalWrapper->getData()->getID(), std::move(name));
107-
} else {
108-
thisClass->verbose() << fmt::format("Retrieving id for '{}': {:0>8x}", name,
109-
algorithmWrapper->collectionBase()->getID())
110-
<< endmsg;
111-
idToName->emplace(algorithmWrapper->collectionBase()->getID(), std::move(name));
112-
}
113-
}
11499
}
115100
return collectionNames;
116101
}

k4MarlinWrapper/src/components/StoreUtils.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
// here with some additions to make it useful for converting both from EDM4hep
2828
// to LCIO and vice versa
2929
std::vector<std::string> getAvailableCollectionsFromStore(const AlgTool* thisClass,
30-
std::optional<std::map<uint32_t, std::string>>& idToName,
3130
bool returnFrameCollections = false);
3231

3332
k4MarlinWrapper::GlobalConvertedObjectsMap& getGlobalObjectMap(AlgTool* thisTool);

0 commit comments

Comments
 (0)