Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore compatibility with EDM4hep 0.10 #1380

Merged
merged 11 commits into from
Jan 16, 2025
6 changes: 6 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
"LCG_102/x86_64-centos9-gcc11-opt", # g4 11
"LCG_104/x86_64-el9-gcc13-opt", # g4 11
"LCG_105/x86_64-ubuntu2204-gcc11-opt", # g4 11
"LCG_106/x86_64-el9-gcc13-opt", # g4 11
"dev3/x86_64-el9-gcc13-opt",
"dev3/x86_64-el9-clang16-opt", # g4 11
"dev4/x86_64-el9-gcc13-opt"]
Expand Down Expand Up @@ -67,6 +68,11 @@ jobs:
echo "::group::CMakeConfig 2"
cmake -DDD4HEP_HEPMC3_COMPRESSION_SUPPORT=ON ..
fi
# Make sure DD4hep can be built with an older version of EDM4hep, 0.10.5 for LCG_106
if [[ ${{ matrix.LCG }} =~ 106 ]]; then
echo "::group::CMakeConfig Enable EDM4hep"
cmake -DDD4HEP_USE_EDM4HEP=ON ..
fi
echo "::group::Compile"
ninja install
. ../bin/thisdd4hep.sh
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ if(DD4HEP_USE_LCIO)
endif()

if(DD4HEP_USE_EDM4HEP)
find_package(EDM4HEP REQUIRED)
find_package(EDM4HEP 0.10.5 REQUIRED)
# we need podio with Frame support (>=0.16.3)
# podio is "SameMajorVersion" compatible
find_package(podio 0.16.3) # this will not find 1.0 and newer
find_package(podio 0.16.7) # this will not find 1.0 and newer
if(NOT podio_FOUND)
# we try to find a newer version now
find_package(podio 1.0 REQUIRED)
Expand Down
12 changes: 12 additions & 0 deletions DDDigi/io/DigiIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <DD4hep/Printout.h>
#include "DigiIO.h"


/// C/C++ include files
#include <limits>

Expand All @@ -40,6 +41,7 @@ namespace edm4hep {
#include <edm4hep/CalorimeterHitCollection.h>
#include <edm4hep/SimCalorimeterHitCollection.h>
#include <edm4hep/EventHeaderCollection.h>
#include <edm4hep/EDM4hepVersion.h>
#include <podio/GenericParameters.h>

/// Namespace for the AIDA detector description toolkit
Expand Down Expand Up @@ -171,8 +173,13 @@ namespace dd4hep {
mcp.setCharge(3.0*p.charge);
mcp.setVertex( _toVectorD(p.start_position) );
mcp.setEndpoint( _toVectorD(p.end_position) );
#if EDM4HEP_BUILD_VERSION < EDM4HEP_VERSION(0, 99, 0)
mcp.setMomentum( _toVectorF(p.momentum) );
mcp.setMomentumAtEndpoint( _toVectorF(p.momentum) );
#else
mcp.setMomentum( _toVectorD(p.momentum) );
mcp.setMomentumAtEndpoint( _toVectorD(p.momentum) );
#endif
}

template <> template <>
Expand Down Expand Up @@ -552,8 +559,13 @@ namespace dd4hep {
const PropertyMask mask(status);
mcp.setPDG(p.pdgID);

#if EDM4HEP_BUILD_VERSION < EDM4HEP_VERSION(0, 99, 0)
mcp.setMomentum( _toVectorF( { p.psx, p.psy, p.psz } ) );
mcp.setMomentumAtEndpoint( _toVectorF( {p.pex, p.pey, p.pez} ) );
#else
mcp.setMomentum( _toVectorD( { p.psx, p.psy, p.psz } ) );
mcp.setMomentumAtEndpoint( _toVectorD( {p.pex, p.pey, p.pez} ) );
#endif
mcp.setVertex( _toVectorD( { p.vsx, p.vsy, p.vsz } ) );
mcp.setEndpoint( _toVectorD( { p.vex, p.vey, p.vez } ) );

Expand Down
12 changes: 10 additions & 2 deletions DDG4/edm4hep/Geant4Output2EDM4hep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@
#include <edm4hep/CaloHitContributionCollection.h>
#include <edm4hep/SimCalorimeterHitCollection.h>
#include <edm4hep/EDM4hepVersion.h>
#include <edm4hep/Constants.h>
#if EDM4HEP_BUILD_VERSION <= EDM4HEP_VERSION(0, 10, 2)
constexpr const char* CellIDEncoding = "CellIDEncoding";
#elif EDM4HEP_BUILD_VERSION < EDM4HEP_VERSION(0, 99, 0)
#include <edm4hep/Constants.h>
using edm4hep::CellIDEncoding;
#else
#include <edm4hep/Constants.h>
using edm4hep::labels::CellIDEncoding;
#endif
/// podio include files
#include <podio/CollectionBase.h>
#include <podio/podioVersion.h>
Expand Down Expand Up @@ -269,7 +277,7 @@ void Geant4Output2EDM4hep::endRun(const G4Run* run) {
void Geant4Output2EDM4hep::saveFileMetaData() {
podio::Frame metaFrame{};
for (const auto& [name, encodingStr] : m_cellIDEncodingStrings) {
metaFrame.putParameter(podio::collMetadataParamName(name, edm4hep::labels::CellIDEncoding), encodingStr);
metaFrame.putParameter(podio::collMetadataParamName(name, CellIDEncoding), encodingStr);
}

m_file->writeFrame(metaFrame, "metadata");
Expand Down
Loading