Skip to content

Commit

Permalink
refactor: Update edm4hep IO code to use frame model (#2001)
Browse files Browse the repository at this point in the history
podio switched to recommending this model, and the store based model we used before is deprecated.
  • Loading branch information
paulgessinger committed Apr 4, 2023
1 parent d6e8fe6 commit 0681a23
Show file tree
Hide file tree
Showing 20 changed files with 155 additions and 186 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:
jobs:
build_debug:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2204:v36
container: ghcr.io/acts-project/ubuntu2204:v41
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:

build_performance:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2204:v36
container: ghcr.io/acts-project/ubuntu2204:v41
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
jobs:
lcg:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/${{ matrix.image }}:v36
container: ghcr.io/acts-project/${{ matrix.image }}:v41
strategy:
matrix:
image:
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:

linux_ubuntu:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2204:v36
container: ghcr.io/acts-project/ubuntu2204:v41
env:
INSTALL_DIR: ${{ github.workspace }}/install
ACTS_LOG_FAILURE_THRESHOLD: WARNING
Expand Down Expand Up @@ -208,7 +208,7 @@ jobs:

linux_examples_test:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2204:v36
container: ghcr.io/acts-project/ubuntu2204:v41
needs: [linux_ubuntu]
steps:
- name: Install git lfs
Expand Down Expand Up @@ -247,7 +247,7 @@ jobs:
linux_physmon:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2204:v36
container: ghcr.io/acts-project/ubuntu2204:v41
needs: [linux_ubuntu]

steps:
Expand Down Expand Up @@ -310,7 +310,7 @@ jobs:
std: 17
- image: ubuntu2004
std: 20
container: ghcr.io/acts-project/${{ matrix.image }}:v36
container: ghcr.io/acts-project/${{ matrix.image }}:v41
env:
INSTALL_DIR: ${{ github.workspace }}/install
ACTS_LOG_FAILURE_THRESHOLD: WARNING
Expand Down Expand Up @@ -385,7 +385,7 @@ jobs:

linux-nodeps:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/${{ matrix.image }}:v36
container: ghcr.io/acts-project/${{ matrix.image }}:v41
strategy:
matrix:
image:
Expand Down Expand Up @@ -500,7 +500,7 @@ jobs:
brew install cmake eigen ninja ccache
&& sudo mkdir /usr/local/acts
&& sudo chown $USER /usr/local/acts
&& wget --verbose --progress=dot:giga --continue --retry-connrefused --tries=5 --timeout=2 -O deps.tar.gz https://acts.web.cern.ch/ci/macOS/deps.ce7b5a4.tar.gz
&& wget --verbose --progress=dot:giga --continue --retry-connrefused --tries=5 --timeout=2 -O deps.tar.gz https://acts.web.cern.ch/ACTS/ci/macOS/deps.67dd08d.tar.gz
&& tar -xf deps.tar.gz -C /usr/local/acts
- name: Cache build
Expand Down Expand Up @@ -559,7 +559,7 @@ jobs:

cuda:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu1804_cuda:v36
container: ghcr.io/acts-project/ubuntu1804_cuda:v41
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -589,7 +589,7 @@ jobs:

sycl:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2004_oneapi:v36
container: ghcr.io/acts-project/ubuntu2004_oneapi:v41
defaults:
run:
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
jobs:
format:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/format10:v29
container: ghcr.io/acts-project/format10:v41
steps:
- uses: actions/checkout@v3
- name: Check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
jobs:
docs:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2204:v36
container: ghcr.io/acts-project/ubuntu2204:v41
env:
DOXYGEN_WARN_AS_ERROR: FAIL_ON_WARNINGS
steps:
Expand Down
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
clang_tidy:
stage: build
image: ghcr.io/acts-project/ubuntu2004:v29
image: ghcr.io/acts-project/ubuntu2004:v41
artifacts:
paths:
- src/clang-tidy/
Expand Down Expand Up @@ -55,7 +55,7 @@ clang_tidy:

build:
stage: build
image: ghcr.io/acts-project/ubuntu2004_exatrkx:v34
image: ghcr.io/acts-project/ubuntu2004_exatrkx:v41
tags:
- docker
variables:
Expand Down Expand Up @@ -103,7 +103,7 @@ test:
stage: test
needs:
- build
image: ghcr.io/acts-project/ubuntu2004_exatrkx:v34
image: ghcr.io/acts-project/ubuntu2004_exatrkx:v41
tags:
- docker-gpu-nvidia
script:
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ endif()
set(_acts_autodiff_version 0.6)
set(_acts_boost_version 1.71.0)
set(_acts_dd4hep_version 1.21)
set(_acts_edm4hep_version v00-04-01)
set(_acts_edm4hep_version 0.7)
set(_acts_podio_version 0.6)
set(_acts_doxygen_version 1.9.4)
set(_acts_eigen3_version 3.3.7)
set(_acts_hepmc3_version 3.2.1)
Expand Down Expand Up @@ -337,7 +338,8 @@ elseif(ACTS_BUILD_EXAMPLES_DD4HEP)
find_package(DD4hep ${_acts_dd4hep_version} REQUIRED CONFIG COMPONENTS DDCore DDDetectors)
endif()
if(ACTS_BUILD_EXAMPLES_EDM4HEP)
find_package(EDM4HEP REQUIRED CONFIG)
find_package(podio ${_acts_podio_version} REQUIRED CONFIG)
find_package(EDM4HEP ${_acts_edm4hep_version} REQUIRED CONFIG)
endif()
if(ACTS_BUILD_EXAMPLES_GEANT4)
find_package(Geant4 REQUIRED CONFIG COMPONENTS gdml)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
#include <memory>
#include <string>

#include "edm4hep/TrackerHitCollection.h"
#include "edm4hep/TrackerHitPlaneCollection.h"
#include "podio/EventStore.h"
#include "podio/ROOTReader.h"
#include <podio/ROOTFrameReader.h>

namespace ActsExamples {

Expand Down Expand Up @@ -70,11 +67,7 @@ class EDM4hepMeasurementReader final : public IReader {
std::pair<size_t, size_t> m_eventsRange;
std::unique_ptr<const Acts::Logger> m_logger;

podio::ROOTReader m_reader;
podio::EventStore m_store;

const edm4hep::TrackerHitPlaneCollection* m_trackerHitPlaneCollection;
const edm4hep::TrackerHitCollection* m_trackerHitRawCollection;
podio::ROOTFrameReader m_reader;

WriteDataHandle<MeasurementContainer> m_outputMeasurements{
this, "OutputMeasurements"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@

#include <string>

#include "edm4hep/TrackerHitCollection.h"
#include "edm4hep/TrackerHitPlaneCollection.h"
#include "podio/EventStore.h"
#include "podio/ROOTWriter.h"
#include <edm4hep/TrackerHitCollection.h>
#include <edm4hep/TrackerHitPlaneCollection.h>
#include <podio/ROOTFrameWriter.h>

namespace ActsExamples {

Expand Down Expand Up @@ -65,11 +64,7 @@ class EDM4hepMeasurementWriter final : public WriterT<MeasurementContainer> {
private:
Config m_cfg;

podio::ROOTWriter m_writer;
podio::EventStore m_store;

edm4hep::TrackerHitPlaneCollection* m_trackerHitPlaneCollection;
edm4hep::TrackerHitCollection* m_trackerHitRawCollection;
podio::ROOTFrameWriter m_writer;

ReadDataHandle<ClusterContainer> m_inputClusters{this, "InputClusters"};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

#include <string>

#include "edm4hep/TrackCollection.h"
#include "podio/EventStore.h"
#include "podio/ROOTWriter.h"
#include <podio/ROOTFrameWriter.h>

namespace ActsExamples {

Expand Down Expand Up @@ -65,10 +63,7 @@ class EDM4hepMultiTrajectoryWriter : public WriterT<TrajectoriesContainer> {
private:
Config m_cfg;

podio::ROOTWriter m_writer;
podio::EventStore m_store;

edm4hep::TrackCollection* m_trackCollection;
podio::ROOTFrameWriter m_writer;

ReadDataHandle<IndexMultimap<ActsFatras::Barcode>>
m_inputMeasurementParticlesMap{this, "InputMeasurementParticlesMaps"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
#include <memory>
#include <string>

#include "edm4hep/MCParticleCollection.h"
#include "podio/EventStore.h"
#include "podio/ROOTReader.h"
#include <edm4hep/MCParticleCollection.h>
#include <podio/ROOTFrameReader.h>

namespace ActsExamples {

Expand Down Expand Up @@ -60,10 +59,7 @@ class EDM4hepParticleReader final : public IReader {
std::pair<size_t, size_t> m_eventsRange;
std::unique_ptr<const Acts::Logger> m_logger;

podio::ROOTReader m_reader;
podio::EventStore m_store;

const edm4hep::MCParticleCollection* m_mcParticleCollection;
podio::ROOTFrameReader m_reader;

WriteDataHandle<SimParticleContainer> m_outputParticles{this,
"OutputParticles"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

#include <string>

#include "edm4hep/MCParticleCollection.h"
#include "podio/EventStore.h"
#include "podio/ROOTWriter.h"
#include <podio/ROOTFrameWriter.h>

namespace ActsExamples {

Expand Down Expand Up @@ -57,10 +55,7 @@ class EDM4hepParticleWriter final : public WriterT<SimParticleContainer> {
private:
Config m_cfg;

podio::ROOTWriter m_writer;
podio::EventStore m_store;

edm4hep::MCParticleCollection* m_mcParticleCollection;
podio::ROOTFrameWriter m_writer;
};

} // namespace ActsExamples
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
#include <memory>
#include <string>

#include "edm4hep/MCParticleCollection.h"
#include "podio/EventStore.h"
#include "podio/ROOTReader.h"
#include <edm4hep/MCParticleCollection.h>
#include <podio/ROOTFrameReader.h>

namespace ActsExamples {

Expand All @@ -38,6 +37,8 @@ class EDM4hepSimHitReader final : public IReader {
std::string inputPath;
/// Name of the particle collection in EDM4hep.
std::string inputParticles = "MCParticles";
/// Name of the sim tracker hit collection in EDM4hep
std::string inputSimTrackerHits = "ActsSimTrackerHits";
/// Which particle collection to read into.
std::string outputParticles;
/// Output simulated (truth) hits collection.
Expand Down Expand Up @@ -68,12 +69,7 @@ class EDM4hepSimHitReader final : public IReader {
std::pair<size_t, size_t> m_eventsRange;
std::unique_ptr<const Acts::Logger> m_logger;

podio::ROOTReader m_reader;
podio::EventStore m_store;

std::vector<std::string> m_collections;

const edm4hep::MCParticleCollection* m_mcParticleCollection;
podio::ROOTFrameReader m_reader;

const Acts::Logger& logger() const { return *m_logger; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@

#include <string>

#include "edm4hep/MCParticleCollection.h"
#include "edm4hep/SimTrackerHitCollection.h"
#include "podio/EventStore.h"
#include "podio/ROOTWriter.h"
#include <edm4hep/MCParticleCollection.h>
#include <edm4hep/SimTrackerHitCollection.h>
#include <podio/ROOTFrameWriter.h>

namespace ActsExamples {

Expand All @@ -40,7 +39,7 @@ class EDM4hepSimHitWriter final : public WriterT<SimHitContainer> {
std::string outputPath;
/// Name of the particle collection in EDM4hep.
std::string outputParticles = "MCParticles";
/// Name of the particle collection in EDM4hep.
/// Name of the sim tracker hit collection in EDM4hep
std::string outputSimTrackerHits = "ActsSimTrackerHits";
};

Expand All @@ -66,11 +65,7 @@ class EDM4hepSimHitWriter final : public WriterT<SimHitContainer> {
private:
Config m_cfg;

podio::ROOTWriter m_writer;
podio::EventStore m_store;

edm4hep::MCParticleCollection* m_mcParticleCollection;
edm4hep::SimTrackerHitCollection* m_simTrackerHitCollection;
podio::ROOTFrameWriter m_writer;

ReadDataHandle<SimParticleContainer> m_inputParticles{this, "InputParticles"};
};
Expand Down

0 comments on commit 0681a23

Please sign in to comment.