Skip to content

Commit

Permalink
Use the metadata service to put the PID parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Jan 22, 2025
1 parent 3c45aeb commit add8c80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions k4MarlinWrapper/k4MarlinWrapper/converters/Lcio2EDM4hep.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <Gaudi/Property.h>
#include <GaudiKernel/AlgTool.h>

#include "k4FWCore/IMetadataSvc.h"

#include "k4MarlinWrapper/converters/IEDMConverter.h"

#include <lcio.h>
Expand Down Expand Up @@ -59,6 +61,7 @@ class Lcio2EDM4hepTool : public AlgTool, virtual public IEDMConverter {
Gaudi::Property<bool> m_convertAll{this, "convertAll", true};

ServiceHandle<IDataProviderSvc> m_eventDataSvc;
SmartIF<IMetadataSvc> m_metadataSvc;
PodioDataSvc* m_podioDataSvc;

// **********************************
Expand Down
11 changes: 7 additions & 4 deletions k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ Lcio2EDM4hepTool::Lcio2EDM4hepTool(const std::string& type, const std::string& n
StatusCode Lcio2EDM4hepTool::initialize() {
m_podioDataSvc = dynamic_cast<PodioDataSvc*>(m_eventDataSvc.get());

m_metadataSvc = service("MetadataSvc", false);
if(!m_metadataSvc) {
error() << "Could not retrieve MetadataSvc" << endmsg;
return StatusCode::FAILURE;
}

return AlgTool::initialize();
}

Expand Down Expand Up @@ -227,10 +233,7 @@ StatusCode Lcio2EDM4hepTool::convertCollections(lcio::LCEventImpl* the_event) {
}
} else {
for (const auto& [collName, pidInfo] : pidInfos) {
k4FWCore::putParameter(podio::collMetadataParamName(collName, edm4hep::labels::PIDAlgoName), pidInfo.algoName);
k4FWCore::putParameter(podio::collMetadataParamName(collName, edm4hep::labels::PIDAlgoType), pidInfo.algoType());
k4FWCore::putParameter(podio::collMetadataParamName(collName, edm4hep::labels::PIDParameterNames),
pidInfo.paramNames);
m_metadataSvc->put(collName, pidInfo);
}
}

Expand Down

0 comments on commit add8c80

Please sign in to comment.