Skip to content

Commit

Permalink
Merge branch 'master' into paths06012025
Browse files Browse the repository at this point in the history
  • Loading branch information
andriish authored Jan 26, 2025
2 parents 7b7dad3 + 4114265 commit 793e0c6
Show file tree
Hide file tree
Showing 34 changed files with 1,044 additions and 528 deletions.
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
5 changes: 5 additions & 0 deletions DDCore/include/DD4hep/Segmentations.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ namespace dd4hep {
* \return vector<double> in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
*/
std::vector<double> cellDimensions(const CellID& cellID) const;
/// Return true if this segmentation can have cells that span multiple
/// volumes. That is, points from multiple distinct volumes may
/// be assigned to the same cell.
/// In that case, a working volumeID() implementation is required.
bool cellsSpanVolumes() const;

/// Access to the base DDSegmentation object. WARNING: Deprecated call!
DDSegmentation::Segmentation* segmentation() const;
Expand Down
8 changes: 8 additions & 0 deletions DDCore/include/DDSegmentation/Segmentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ namespace dd4hep {
\return vector<double> in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
*/
virtual std::vector<double> cellDimensions(const CellID& cellID) const;
/// Return true if this segmentation can have cells that span multiple
/// volumes. That is, points from multiple distinct volumes may
/// be assigned to the same cell.
/// In that case, a working volumeID() implementation is required.
virtual bool cellsSpanVolumes() const
{
return false;
}

protected:
/// Default constructor used by derived classes passing the encoding string
Expand Down
8 changes: 8 additions & 0 deletions DDCore/src/Segmentations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ std::vector<double> Segmentation::cellDimensions(const CellID& cell) const {
return access()->segmentation->cellDimensions(cell);
}

/// Return true if this segmentation can have cells that span multiple
/// volumes. That is, points from multiple distinct volumes may
/// be assigned to the same cell.
bool Segmentation::cellsSpanVolumes() const
{
return access()->segmentation->cellsSpanVolumes();
}

/// Access to the base DDSegmentation object. WARNING: Deprecated call!
DDSegmentation::Segmentation* Segmentation::segmentation() const {
return access()->segmentation;
Expand Down
14 changes: 12 additions & 2 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 @@ -202,7 +209,6 @@ namespace dd4hep {
mcp.setGeneratorStatus( p.getGeneratorStatus() );
mcp.setSimulatorStatus( p.getSimulatorStatus() );
mcp.setSpin(p.getSpin());
mcp.setColorFlow(p.getColorFlow());
}

template <> template <>
Expand Down Expand Up @@ -552,8 +558,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 Expand Up @@ -588,7 +599,6 @@ namespace dd4hep {
mcp.setGeneratorStatus( 0 );

mcp.setSpin(p.spin);
mcp.setColorFlow(p.colorFlow);
}

template <> template <>
Expand Down
14 changes: 12 additions & 2 deletions DDG4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,22 @@ ENDIF()

IF(TARGET EDM4HEP::edm4hep)
dd4hep_add_plugin(DDG4EDM4HEP
SOURCES edm4hep/*.cpp
SOURCES edm4hep/Geant4Output2EDM4hep.cpp
USES DD4hep::DDG4 EDM4HEP::edm4hep EDM4HEP::edm4hepDict podio::podio podio::podioDict podio::podioRootIO
)
install(TARGETS DDG4EDM4HEP EXPORT DD4hep LIBRARY DESTINATION lib)
set_target_properties(DDG4EDM4HEP PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION})

if(TARGET podio::podioIO)
dd4hep_add_plugin(DDG4EDM4HEPReader
SOURCES edm4hep/EDM4hepFileReader.cpp
USES DD4hep::DDG4 EDM4HEP::edm4hep EDM4HEP::edm4hepDict podio::podio podio::podioDict podio::podioIO
)
install(TARGETS DDG4EDM4HEPReader EXPORT DD4hep LIBRARY DESTINATION lib)
set_target_properties(DDG4EDM4HEPReader PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION})
MESSAGE(STATUS "EDM4hepFileReader enabled")
else()
MESSAGE(STATUS "EDM4hepFileReader requires at least PODIO 1.0, disabled")
endif()
ENDIF()

IF(DD4HEP_USE_HEPMC3)
Expand Down
Loading

0 comments on commit 793e0c6

Please sign in to comment.