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

feat: EDM4hep IO #1260

Merged
merged 114 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
899c269
draft
andiwand May 12, 2022
158f407
draft
andiwand May 13, 2022
48a2e7a
refactor
andiwand May 13, 2022
cbd37c9
draft
andiwand May 13, 2022
f5f9b55
fix checks
andiwand May 16, 2022
303cd81
fix build
andiwand May 16, 2022
667179e
draft
andiwand May 16, 2022
1915fad
draft
andiwand May 17, 2022
82ee21c
draft
andiwand May 18, 2022
edd5dce
minor
andiwand May 18, 2022
cac4259
draft
andiwand May 18, 2022
87cbc7b
fix formatting
andiwand May 18, 2022
529b5bc
fix formatting
andiwand May 18, 2022
3369b77
update machines
andiwand May 18, 2022
50a30fb
cleanup
andiwand May 18, 2022
0a92cbd
cleanup
andiwand May 18, 2022
3f9ff9e
fix tests
andiwand May 18, 2022
7ec3e60
fix build
andiwand May 19, 2022
bd1943f
fix build
andiwand May 19, 2022
7e49304
backport for podio v00-13
andiwand May 19, 2022
2334e81
fix
andiwand May 19, 2022
09393e6
fix
andiwand May 19, 2022
97c851b
fix
andiwand May 19, 2022
b89fc8c
update macos dependencies
andiwand May 23, 2022
695e8c7
Merge branch 'main' into edm4hep
andiwand May 23, 2022
5db2345
fix
andiwand May 23, 2022
26abc35
fix
andiwand May 24, 2022
8e17a2d
trigger
andiwand May 24, 2022
255a135
remove test file
andiwand May 24, 2022
cc85d52
tmp
andiwand May 24, 2022
9315903
tmp
andiwand May 24, 2022
1e5e422
fix
andiwand May 24, 2022
24562b0
fix
andiwand May 24, 2022
9fd222a
tmp
andiwand May 24, 2022
cf89242
tmp
andiwand May 24, 2022
1b12b2e
tmp
andiwand May 24, 2022
58e383c
tmp
andiwand May 24, 2022
ba0cc23
fix
andiwand May 25, 2022
c888614
Merge branch 'main' into edm4hep
andiwand May 25, 2022
ef34a24
add missing deletes
andiwand May 25, 2022
9657d32
Merge branch 'edm4hep' of github.com:andiwand/acts into edm4hep
andiwand May 25, 2022
170533e
use ddsim
andiwand May 26, 2022
bf894ae
tmp
andiwand May 27, 2022
e1e8cac
tmp
andiwand May 27, 2022
78ca783
tmp
andiwand May 27, 2022
b36aaae
tmp
andiwand May 27, 2022
43d2547
fix
andiwand May 27, 2022
a5bb683
fix
andiwand May 27, 2022
16628b3
tmp
andiwand May 27, 2022
13d2643
tmp
andiwand May 27, 2022
00a5588
tmp
andiwand May 27, 2022
bf9c51f
fix
andiwand May 27, 2022
ef52f95
fix gitlab ci
andiwand May 31, 2022
e22f3e2
Merge branch 'main' into edm4hep
andiwand May 31, 2022
3e3da43
Merge branch 'main' into edm4hep
andiwand Jun 10, 2022
2c9699d
draft edm4hep measurement writer
andiwand Jun 7, 2022
9fbf55d
fix formatting
andiwand Jun 10, 2022
d2b56dc
fix build
andiwand Jun 10, 2022
b6da1eb
fix formatting
andiwand Jun 10, 2022
7925aec
create all reader/writer
andiwand Jun 10, 2022
4f0421b
fix build
andiwand Jun 10, 2022
3c7037d
fix build
andiwand Jun 10, 2022
004904f
fix build
andiwand Jun 10, 2022
d474da2
optional edm4hep
andiwand Jun 10, 2022
6cdf2e6
revert gitlab ci changes
andiwand Jun 10, 2022
25c0d97
draft measurement reader
andiwand Jun 10, 2022
e2018b9
wip
andiwand Jun 13, 2022
a9848a7
fix macos
andiwand Jun 13, 2022
21d143b
wip
andiwand Jun 13, 2022
a57965e
refactor
andiwand Jun 14, 2022
bb0b706
wip
andiwand Jun 14, 2022
4b51e7f
fix
andiwand Jun 15, 2022
010f4ad
tmp
andiwand Jun 15, 2022
4947417
fix
andiwand Jun 15, 2022
ac23b84
tmp
andiwand Jun 15, 2022
a2d67b7
fix
andiwand Jun 15, 2022
5484984
tmp
andiwand Jun 15, 2022
5029482
Merge branch 'main' into edm4hep
andiwand Jun 15, 2022
11361d4
fix
andiwand Jun 15, 2022
452447a
tmp
andiwand Jun 15, 2022
556661e
fix
andiwand Jun 15, 2022
c327041
measurement reader/writer
andiwand Jun 16, 2022
338cfe5
add edm4hep multi trajectory writer
andiwand Jun 17, 2022
4e623f5
add edm4hep multi trajectory writer test
andiwand Jun 17, 2022
cfc5d32
add doc; write some track state for MTW
andiwand Jun 20, 2022
7efaa4d
tan lambda; fill wrong cov
andiwand Jun 20, 2022
2596ae1
minor python formatting
andiwand Jun 20, 2022
c9814b0
doc; fix
andiwand Jun 20, 2022
7702bec
todo
andiwand Jun 20, 2022
027ac52
cleanup
andiwand Jun 20, 2022
28ae472
cleanup
andiwand Jun 20, 2022
d9e56cc
cleanup
andiwand Jun 20, 2022
6bce959
use endRun for writers to close
andiwand Jun 20, 2022
80dd402
Merge branch 'main' into edm4hep
andiwand Jun 23, 2022
fa3265a
incorporate paul's review
andiwand Jun 23, 2022
4dc55c9
incorporate paul's review
andiwand Jun 23, 2022
7180e77
incorporate paul's review
andiwand Jun 23, 2022
8bb1318
incorporate paul's review
andiwand Jun 23, 2022
f8b1e53
incorporate paul's feedback
andiwand Jun 23, 2022
2c81476
revert python changes
andiwand Jun 23, 2022
e88acd6
revert m_geometryService changes
andiwand Jun 23, 2022
f22cef7
use static_cast
andiwand Jun 23, 2022
b267054
PR feedback
andiwand Jun 23, 2022
faaa80c
fix formatting
andiwand Jun 23, 2022
0196b6c
incorporate joana's feedback
andiwand Jun 27, 2022
f7d8689
Merge branch 'main' into edm4hep
andiwand Jun 28, 2022
6450e4a
Merge branch 'main' into edm4hep
andiwand Jul 6, 2022
1151e08
Merge branch 'main' into edm4hep
andiwand Jul 6, 2022
13ba485
Merge branch 'main' into edm4hep
andiwand Jul 6, 2022
5d10517
Merge branch 'main' into edm4hep
andiwand Jul 7, 2022
61ee2f2
ping CI
andiwand Jul 7, 2022
ae25421
Merge branch 'main' into edm4hep
andiwand Jul 7, 2022
b2f1aed
revert ci change
andiwand Jul 7, 2022
cefb5b4
revert CI changes
andiwand Jul 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
jobs:
build_debug:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2004:v22
container: ghcr.io/acts-project/ubuntu2004:v24
steps:
- uses: actions/checkout@v3

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

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

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

linux_examples_test:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2004:v22
container: ghcr.io/acts-project/ubuntu2004:v24
needs: [linux_ubuntu]
env:
ACTS_LOG_FAILURE_THRESHOLD: FATAL
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:

linux_physmon:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2004:v22
container: ghcr.io/acts-project/ubuntu2004:v24
needs: [linux_ubuntu]
env:
ACTS_LOG_FAILURE_THRESHOLD: FATAL
Expand Down Expand Up @@ -411,7 +411,7 @@ jobs:
run: ./build-downstream/bin/ShowActsVersion
cuda:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu1804_cuda:v22
container: ghcr.io/acts-project/ubuntu1804_cuda:v24
steps:
- uses: actions/checkout@v2

Expand All @@ -436,7 +436,7 @@ jobs:
run: cmake --build build --
exatrkx:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2004_exatrkx:v22
container: ghcr.io/acts-project/ubuntu2004_exatrkx:v24
steps:
- uses: actions/checkout@v2

Expand All @@ -461,7 +461,7 @@ jobs:
run: cmake --build build --
sycl:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2004_oneapi:v22
container: ghcr.io/acts-project/ubuntu2004_oneapi:v24
defaults:
run:
shell: bash
Expand Down Expand Up @@ -493,7 +493,7 @@ jobs:
&& cmake --build build --
docs:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/ubuntu2004:v22
container: ghcr.io/acts-project/ubuntu2004:v24
env:
DOXYGEN_WARN_AS_ERROR: YES
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
format:
runs-on: ubuntu-latest
container: ghcr.io/acts-project/format10:v22
container: ghcr.io/acts-project/format10:v24
steps:
- uses: actions/checkout@v3
- name: Check
Expand Down
18 changes: 16 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ option(ACTS_BUILD_PLUGIN_AUTODIFF "Build the autodiff plugin" OFF)
option(ACTS_USE_SYSTEM_AUTODIFF "Use autodiff provided by the system instead of the bundled version" OFF)
option(ACTS_BUILD_PLUGIN_CUDA "Build CUDA plugin" OFF)
option(ACTS_BUILD_PLUGIN_DD4HEP "Build DD4hep plugin" OFF)
option(ACTS_BUILD_PLUGIN_EDM4HEP "Build EMD4hep plugin" OFF)
option(ACTS_BUILD_PLUGIN_EXATRKX "Build the Exa.TrkX plugin" OFF)
option(ACTS_USE_SYSTEM_ACTSDD4HEP "Use the ActsDD4hep glue library provided by the system instead of building it" OFF)
option(ACTS_BUILD_PLUGIN_IDENTIFICATION "Build Identification plugin" OFF)
Expand All @@ -50,6 +51,7 @@ option(ACTS_BUILD_ALIGNMENT "Build Alignment package" OFF)
# examples related options
option(ACTS_BUILD_EXAMPLES "Build standalone examples" OFF)
option(ACTS_BUILD_EXAMPLES_DD4HEP "Build DD4hep-based code in the examples" OFF)
option(ACTS_BUILD_EXAMPLES_EDM4HEP "Build EDM4hep-based code in the examples" OFF)
option(ACTS_BUILD_EXAMPLES_EXATRKX "Build the Exa.TrkX example code" OFF)
option(ACTS_BUILD_EXAMPLES_GEANT4 "Build Geant4-based code in the examples" OFF)
option(ACTS_BUILD_EXAMPLES_HEPMC3 "Build HepMC3-based code in the examples" OFF)
Expand Down Expand Up @@ -78,6 +80,7 @@ set_option_if(ACTS_BUILD_BENCHMARKS ACTS_BUILD_EVERYTHING)
set_option_if(ACTS_BUILD_UNITTESTS ACTS_BUILD_EVERYTHING)
set_option_if(ACTS_BUILD_INTEGRATIONTESTS ACTS_BUILD_EVERYTHING)
set_option_if(ACTS_BUILD_EXAMPLES_DD4HEP ACTS_BUILD_EVERYTHING)
set_option_if(ACTS_BUILD_EXAMPLES_EDM4HEP ACTS_BUILD_EVERYTHING)
set_option_if(ACTS_BUILD_EXAMPLES_GEANT4 ACTS_BUILD_EVERYTHING)
set_option_if(ACTS_BUILD_EXAMPLES_HEPMC3 ACTS_BUILD_EVERYTHING)
set_option_if(ACTS_BUILD_EXAMPLES_PYTHIA8 ACTS_BUILD_EVERYTHING)
Expand All @@ -89,6 +92,7 @@ set_option_if(ACTS_BUILD_ALIGNMENT ACTS_BUILD_EVERYTHING)
set_option_if(
ACTS_BUILD_EXAMPLES
ACTS_BUILD_EXAMPLES_DD4HEP
OR ACTS_BUILD_EXAMPLES_EDM4HEP
OR ACTS_BUILD_EXAMPLES_GEANT4
OR ACTS_BUILD_EXAMPLES_HEPMC3
OR ACTS_BUILD_EXAMPLES_PYTHIA8
Expand All @@ -97,7 +101,11 @@ set_option_if(
# core plugins might be required by examples or depend on each other
set_option_if(
ACTS_BUILD_PLUGIN_DD4HEP
ACTS_BUILD_EXAMPLES_DD4HEP OR ACTS_BUILD_EVERYTHING)
ACTS_BUILD_EXAMPLES_DD4HEP OR ACTS_BUILD_EVERYTHING OR
ACTS_BUILD_PLUGIN_EDM4HEP OR ACTS_BUILD_EXAMPLES_EDM4HEP)
set_option_if(
ACTS_BUILD_PLUGIN_EDM4HEP
ACTS_BUILD_EXAMPLES_EDM4HEP OR ACTS_BUILD_EVERYTHING)
set_option_if(
ACTS_BUILD_PLUGIN_TGEO
ACTS_BUILD_PLUGIN_DD4HEP OR ACTS_BUILD_EXAMPLES OR ACTS_BUILD_EVERYTHING)
Expand Down Expand Up @@ -151,6 +159,7 @@ set(_acts_autodiff_version 0.6)
set(_acts_boost_version 1.71.0)
set(_acts_dd4hep_version 1.11)
set(_acts_actsdd4hep_version 1.0.0)
set(_acts_edm4hep_version v00-04-01)
set(_acts_doxygen_version 1.8.15)
set(_acts_eigen3_version 3.3.7)
set(_acts_hepmc3_version 3.2.1)
Expand Down Expand Up @@ -244,7 +253,9 @@ if(ACTS_BUILD_PLUGIN_DD4HEP)
else()
add_subdirectory(thirdparty/actsdd4hep)
endif()

endif()
if(ACTS_BUILD_PLUGIN_EDM4HEP)
find_package(EDM4HEP REQUIRED)
endif()
if(ACTS_BUILD_PLUGIN_JSON)
if(ACTS_USE_SYSTEM_NLOHMANN_JSON)
Expand Down Expand Up @@ -295,6 +306,9 @@ if(ACTS_BUILD_EXAMPLES_DD4HEP AND ACTS_BUILD_EXAMPLES_GEANT4)
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)
endif()
if(ACTS_BUILD_EXAMPLES_GEANT4)
find_package(Geant4 REQUIRED CONFIG COMPONENTS gdml)
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,23 @@
#include <memory>
#include <vector>

struct DD4hepDetector : public ActsExamples::IBaseDetector {
namespace ActsExamples {
namespace DD4hep {

struct DD4hepDetector : public IBaseDetector {
std::shared_ptr<DD4hepGeometryService> geometryService;
andiwand marked this conversation as resolved.
Show resolved Hide resolved

void addOptions(
boost::program_options::options_description& opt) const override;

std::pair<ActsExamples::IBaseDetector::TrackingGeometryPtr, ContextDecorators>
finalize(const boost::program_options::variables_map& vm,
std::shared_ptr<const Acts::IMaterialDecorator> mdecorator) override;
std::pair<IBaseDetector::TrackingGeometryPtr, ContextDecorators> finalize(
const boost::program_options::variables_map& vm,
std::shared_ptr<const Acts::IMaterialDecorator> mdecorator) override;

std::pair<ActsExamples::IBaseDetector::TrackingGeometryPtr, ContextDecorators>
finalize(ActsExamples::DD4hep::DD4hepGeometryService::Config cfg,
std::shared_ptr<const Acts::IMaterialDecorator> mdecorator);
std::pair<IBaseDetector::TrackingGeometryPtr, ContextDecorators> finalize(
DD4hepGeometryService::Config cfg,
std::shared_ptr<const Acts::IMaterialDecorator> mdecorator);
};

} // namespace DD4hep
} // namespace ActsExamples
10 changes: 8 additions & 2 deletions Examples/Detectors/DD4hepDetector/src/DD4hepDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

#include <boost/program_options.hpp>

namespace ActsExamples {
namespace DD4hep {

void DD4hepDetector::addOptions(
boost::program_options::options_description& opt) const {
ActsExamples::Options::addDD4hepOptions(opt);
Expand All @@ -37,10 +40,10 @@ auto DD4hepDetector::finalize(
-> std::pair<TrackingGeometryPtr, ContextDecorators> {
Acts::GeometryContext dd4HepContext;
config.matDecorator = mdecorator;
auto geometrySvc =
geometryService =
std::make_shared<ActsExamples::DD4hep::DD4hepGeometryService>(config);
TrackingGeometryPtr dd4tGeometry =
geometrySvc->trackingGeometry(dd4HepContext);
geometryService->trackingGeometry(dd4HepContext);
if (!dd4tGeometry) {
throw std::runtime_error{
"Did not receive tracking geometry from DD4hep geometry service"};
Expand All @@ -50,3 +53,6 @@ auto DD4hepDetector::finalize(
return std::make_pair<TrackingGeometryPtr, ContextDecorators>(
std::move(dd4tGeometry), std::move(dd4ContextDeocrators));
}

} // namespace DD4hep
} // namespace ActsExamples
1 change: 1 addition & 0 deletions Examples/Io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_subdirectory(Csv)
add_subdirectory_if(EDM4hep ACTS_BUILD_EXAMPLES_EDM4HEP)
add_subdirectory_if(HepMC3 ACTS_BUILD_EXAMPLES_HEPMC3)
add_subdirectory(Json)
add_subdirectory(NuclearInteractions)
Expand Down
2 changes: 1 addition & 1 deletion Examples/Io/Csv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ add_library(
src/CsvSpacePointReader.cpp
src/CsvTrackingGeometryWriter.cpp
src/CsvMultiTrajectoryWriter.cpp
src/CsvSpacepointWriter.cpp)
src/CsvSpacePointWriter.cpp)
target_include_directories(
ActsExamplesIoCsv
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
Expand Down
13 changes: 13 additions & 0 deletions Examples/Io/EDM4hep/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
add_library(
ActsExamplesIoEDM4hep SHARED
src/EDM4hepSimHitReader.cpp)
target_include_directories(
ActsExamplesIoEDM4hep
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_link_libraries(
ActsExamplesIoEDM4hep
PUBLIC ActsCore ActsExamplesFramework ActsExamplesDetectorDD4hep ActsPluginEDM4hep)

install(
TARGETS ActsExamplesIoEDM4hep
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// This file is part of the Acts project.
//
// Copyright (C) 2022 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "ActsExamples/DD4hepDetector/DD4hepGeometryService.hpp"
#include "ActsExamples/Framework/IReader.hpp"

#include <memory>
#include <string>

#include "podio/EventStore.h"
#include "podio/ROOTReader.h"

namespace ActsExamples {

class EDM4hepSimHitReader final : public IReader {
public:
struct Config {
/// Where to the read input file from.
std::string inputPath;
/// Output simulated (truth) hits collection.
std::string outputSimHits;
/// DD4hep geometry service for cellID resolution.
std::shared_ptr<DD4hep::DD4hepGeometryService> dd4hepGeometryService;
};

/// Construct the simhit reader.
///
/// @param config is the configuration object
/// @param level is the logging level
EDM4hepSimHitReader(const Config& config, Acts::Logging::Level level);

std::string name() const final override;

/// Return the available events range.
std::pair<size_t, size_t> availableEvents() const final override;

/// Read out data from the input stream.
ProcessCode read(const ActsExamples::AlgorithmContext& ctx) final override;

/// Readonly access to the config
const Config& config() const { return m_cfg; }

private:
Config m_cfg;
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_simHitCollections;

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

} // namespace ActsExamples
Loading