diff --git a/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MaterialMapping.hpp b/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MaterialMapping.hpp index 7161d6f154e..f1b311a8077 100644 --- a/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MaterialMapping.hpp +++ b/Examples/Algorithms/MaterialMapping/include/ActsExamples/MaterialMapping/MaterialMapping.hpp @@ -32,11 +32,6 @@ #include #include -namespace ActsExamples { -class IMaterialWriter; -struct AlgorithmContext; -} // namespace ActsExamples - namespace Acts { class TrackingGeometry; @@ -81,7 +76,7 @@ class MaterialMapping : public IAlgorithm { std::reference_wrapper magFieldContext; /// Input collection - std::string collection = "material_tracks"; + std::string inputMaterialTracks = "material_tracks"; /// The material collection to be stored std::string mappingMaterialCollection = "mapped_material_tracks"; diff --git a/Examples/Algorithms/MaterialMapping/src/MaterialMapping.cpp b/Examples/Algorithms/MaterialMapping/src/MaterialMapping.cpp index cb43f6fd553..0a6abc7d200 100644 --- a/Examples/Algorithms/MaterialMapping/src/MaterialMapping.cpp +++ b/Examples/Algorithms/MaterialMapping/src/MaterialMapping.cpp @@ -17,13 +17,10 @@ #include namespace ActsExamples { -struct AlgorithmContext; -} // namespace ActsExamples -ActsExamples::MaterialMapping::MaterialMapping( - const ActsExamples::MaterialMapping::Config& cfg, - Acts::Logging::Level level) - : ActsExamples::IAlgorithm("MaterialMapping", level), +MaterialMapping::MaterialMapping(const MaterialMapping::Config& cfg, + Acts::Logging::Level level) + : IAlgorithm("MaterialMapping", level), m_cfg(cfg), m_mappingState(cfg.geoContext, cfg.magFieldContext), m_mappingStateVol(cfg.geoContext, cfg.magFieldContext) { @@ -33,7 +30,7 @@ ActsExamples::MaterialMapping::MaterialMapping( throw std::invalid_argument("Missing tracking geometry"); } - m_inputMaterialTracks.initialize(m_cfg.collection); + m_inputMaterialTracks.initialize(m_cfg.inputMaterialTracks); m_outputMaterialTracks.initialize(m_cfg.mappingMaterialCollection); ACTS_INFO("This algorithm requires inter-event information, " @@ -51,7 +48,7 @@ ActsExamples::MaterialMapping::MaterialMapping( } } -ActsExamples::MaterialMapping::~MaterialMapping() { +MaterialMapping::~MaterialMapping() { Acts::DetectorMaterialMaps detectorMaterial; if (m_cfg.materialSurfaceMapper && m_cfg.materialVolumeMapper) { @@ -98,8 +95,7 @@ ActsExamples::MaterialMapping::~MaterialMapping() { } } -ActsExamples::ProcessCode ActsExamples::MaterialMapping::execute( - const ActsExamples::AlgorithmContext& context) const { +ProcessCode MaterialMapping::execute(const AlgorithmContext& context) const { // Take the collection from the EventStore std::unordered_map mtrackCollection = m_inputMaterialTracks(context); @@ -125,11 +121,11 @@ ActsExamples::ProcessCode ActsExamples::MaterialMapping::execute( } // Write take the collection to the EventStore m_outputMaterialTracks(context, std::move(mtrackCollection)); - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } -std::vector> -ActsExamples::MaterialMapping::scoringParameters(uint64_t surfaceID) { +std::vector> MaterialMapping::scoringParameters( + uint64_t surfaceID) { std::vector> scoringParameters; if (m_cfg.materialSurfaceMapper) { @@ -151,3 +147,5 @@ ActsExamples::MaterialMapping::scoringParameters(uint64_t surfaceID) { } return scoringParameters; } + +} // namespace ActsExamples diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootAthenaNTupleReader.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootAthenaNTupleReader.hpp index 381deccf669..5725f840c87 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootAthenaNTupleReader.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootAthenaNTupleReader.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2017-2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 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 diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialTrackReader.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialTrackReader.hpp index bb417d6fa3f..f755d0e8c5e 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialTrackReader.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialTrackReader.hpp @@ -8,13 +8,13 @@ #pragma once +#include "Acts/Definitions/Algebra.hpp" #include "Acts/Material/MaterialInteraction.hpp" +#include "Acts/Propagator/MaterialInteractor.hpp" +#include "Acts/Utilities/Logger.hpp" #include "ActsExamples/Framework/DataHandle.hpp" #include "ActsExamples/Framework/IReader.hpp" #include "ActsExamples/Framework/ProcessCode.hpp" -#include -#include -#include #include #include @@ -28,7 +28,6 @@ class TChain; namespace ActsExamples { -struct AlgorithmContext; /// @class RootMaterialTrackReader /// @@ -39,13 +38,13 @@ class RootMaterialTrackReader : public IReader { public: /// @brief The nested configuration struct struct Config { - std::string collection = - "material-tracks"; ///< material collection to read - std::string treeName = "material-tracks"; ///< name of the output tree - std::vector fileList; ///< List of input files + /// material collection to read + std::string outputMaterialTracks = "material-tracks"; + /// name of the output tree + std::string treeName = "material-tracks"; + /// List of input files + std::vector fileList; - /// Whether the events are ordered or not - bool orderedEvents = true; // Read surface information for the root file bool readCachedSurfaceInformation = false; }; @@ -104,46 +103,62 @@ class RootMaterialTrackReader : public IReader { /// multiple entries corresponding to one event number) std::vector m_entryNumbers = {}; - float m_v_x = 0; ///< start global x - float m_v_y = 0; ///< start global y - float m_v_z = 0; ///< start global z - float m_v_px = 0; ///< start global momentum x - float m_v_py = 0; ///< start global momentum y - float m_v_pz = 0; ///< start global momentum z - float m_v_phi = 0; ///< start phi direction - float m_v_eta = 0; ///< start eta direction - float m_tX0 = 0; ///< thickness in X0/L0 - float m_tL0 = 0; ///< thickness in X0/L0 - - std::vector* m_step_x = new std::vector; ///< step x position - std::vector* m_step_y = new std::vector; ///< step y position - std::vector* m_step_z = new std::vector; ///< step z position - std::vector* m_step_dx = new std::vector; ///< step x direction - std::vector* m_step_dy = new std::vector; ///< step y direction - std::vector* m_step_dz = new std::vector; ///< step z direction - std::vector* m_step_length = new std::vector; ///< step length - std::vector* m_step_X0 = new std::vector; ///< step material x0 - std::vector* m_step_L0 = new std::vector; ///< step material l0 - std::vector* m_step_A = new std::vector; ///< step material A - std::vector* m_step_Z = new std::vector; ///< step material Z - std::vector* m_step_rho = - new std::vector; ///< step material rho - - std::vector* m_sur_id = - new std::vector; ///< ID of the surface associated with - ///< the step - std::vector* m_sur_x = - new std::vector; ///< x position of the center of the surface - ///< associated with the step - std::vector* m_sur_y = - new std::vector; ///< y position of the center of the surface - ///< associated with the step - std::vector* m_sur_z = - new std::vector; ///< z position of the center of the surface - ///< associated with the step - std::vector* m_sur_pathCorrection = - new std::vector; ///< path correction when associating - ///< material to the given surface + /// start global x + float m_v_x = 0; + /// start global y + float m_v_y = 0; + /// start global z + float m_v_z = 0; + /// start global momentum x + float m_v_px = 0; + /// start global momentum y + float m_v_py = 0; + /// start global momentum z + float m_v_pz = 0; + /// start phi direction + float m_v_phi = 0; + /// start eta direction + float m_v_eta = 0; + /// thickness in X0/L0 + float m_tX0 = 0; + /// thickness in X0/L0 + float m_tL0 = 0; + + /// step x position + std::vector* m_step_x = new std::vector; + /// step y position + std::vector* m_step_y = new std::vector; + /// step z position + std::vector* m_step_z = new std::vector; + /// step x direction + std::vector* m_step_dx = new std::vector; + /// step y direction + std::vector* m_step_dy = new std::vector; + /// step z direction + std::vector* m_step_dz = new std::vector; + /// step length + std::vector* m_step_length = new std::vector; + /// step material x0 + std::vector* m_step_X0 = new std::vector; + /// step material l0 + std::vector* m_step_L0 = new std::vector; + /// step material A + std::vector* m_step_A = new std::vector; + /// step material Z + std::vector* m_step_Z = new std::vector; + /// step material rho + std::vector* m_step_rho = new std::vector; + + /// ID of the surface associated with the step + std::vector* m_sur_id = new std::vector; + /// x position of the center of the surface associated with the step + std::vector* m_sur_x = new std::vector; + /// y position of the center of the surface associated with the step + std::vector* m_sur_y = new std::vector; + /// z position of the center of the surface associated with the step + std::vector* m_sur_z = new std::vector; + /// path correction when associating material to the given surface + std::vector* m_sur_pathCorrection = new std::vector; }; } // namespace ActsExamples diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialTrackWriter.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialTrackWriter.hpp index 9c8e9978706..dc7c5044b0d 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialTrackWriter.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootMaterialTrackWriter.hpp @@ -52,11 +52,14 @@ class RootMaterialTrackWriter std::unordered_map> { public: struct Config { - std::string collection = - "material-tracks"; ///< material collection to write - std::string filePath = ""; ///< path of the output file - std::string fileMode = "RECREATE"; ///< file access mode - std::string treeName = "material-tracks"; ///< name of the output tree + /// material collection to write + std::string inputMaterialTracks = "material-tracks"; + /// path of the output file + std::string filePath = ""; + /// file access mode + std::string fileMode = "RECREATE"; + /// name of the output tree + std::string treeName = "material-tracks"; /// Re-calculate total values from individual steps (for cross-checks) bool recalculateTotals = false; @@ -110,56 +113,83 @@ class RootMaterialTrackWriter /// Event identifier. uint32_t m_eventId = 0; - float m_v_x = 0; ///< start global x - float m_v_y = 0; ///< start global y - float m_v_z = 0; ///< start global z - float m_v_px = 0; ///< start global momentum x - float m_v_py = 0; ///< start global momentum y - float m_v_pz = 0; ///< start global momentum z - float m_v_phi = 0; ///< start phi direction - float m_v_eta = 0; ///< start eta direction - float m_tX0 = 0; ///< thickness in X0/L0 - float m_tL0 = 0; ///< thickness in X0/L0 - - std::vector m_step_sx; ///< step x (start) position (optional) - std::vector m_step_sy; ///< step y (start) position (optional) - std::vector m_step_sz; ///< step z (start) position (optional) - std::vector m_step_x; ///< step x position - std::vector m_step_y; ///< step y position - std::vector m_step_z; ///< step z position - std::vector m_step_ex; ///< step x (end) position (optional) - std::vector m_step_ey; ///< step y (end) position (optional) - std::vector m_step_ez; ///< step z (end) position (optional) - std::vector m_step_dx; ///< step x direction - std::vector m_step_dy; ///< step y direction - std::vector m_step_dz; ///< step z direction - std::vector m_step_length; ///< step length - std::vector m_step_X0; ///< step material x0 - std::vector m_step_L0; ///< step material l0 - std::vector m_step_A; ///< step material A - std::vector m_step_Z; ///< step material Z - std::vector m_step_rho; ///< step material rho - - std::vector - m_sur_id; ///< ID of the surface associated with the step - std::vector - m_sur_type; ///< Type of the surface associated with the step - std::vector m_sur_x; ///< x position of the center of the surface - ///< associated with the step - std::vector m_sur_y; ///< y position of the center of the surface - ///< associated with the step - std::vector m_sur_z; ///< z position of the center of the surface - ///< associated with the step - std::vector - m_sur_pathCorrection; ///< path correction when associating - ///< material to the given surface - std::vector - m_sur_range_min; ///< Min range of the surface associated with the step - std::vector - m_sur_range_max; ///< Max range of the surface associated with the step - - std::vector - m_vol_id; ///< ID of the volume associated with the step + /// start global x + float m_v_x = 0; + /// start global y + float m_v_y = 0; + /// start global z + float m_v_z = 0; + /// start global momentum x + float m_v_px = 0; + /// start global momentum y + float m_v_py = 0; + /// start global momentum z + float m_v_pz = 0; + /// start phi direction + float m_v_phi = 0; + /// start eta direction + float m_v_eta = 0; + /// thickness in X0/L0 + float m_tX0 = 0; + /// thickness in X0/L0 + float m_tL0 = 0; + + /// step x (start) position (optional) + std::vector m_step_sx; + /// step y (start) position (optional) + std::vector m_step_sy; + /// step z (start) position (optional) + std::vector m_step_sz; + /// step x position + std::vector m_step_x; + /// step y position + std::vector m_step_y; + /// step z position + std::vector m_step_z; + /// step x (end) position (optional) + std::vector m_step_ex; + /// step y (end) position (optional) + std::vector m_step_ey; + /// step z (end) position (optional) + std::vector m_step_ez; + /// step x direction + std::vector m_step_dx; + /// step y direction + std::vector m_step_dy; + /// step z direction + std::vector m_step_dz; + /// step length + std::vector m_step_length; + /// step material x0 + std::vector m_step_X0; + /// step material l0 + std::vector m_step_L0; + /// step material A + std::vector m_step_A; + /// step material Z + std::vector m_step_Z; + /// step material rho + std::vector m_step_rho; + + /// ID of the surface associated with the step + std::vector m_sur_id; + /// Type of the surface associated with the step + std::vector m_sur_type; + /// x position of the center of the surface associated with the step + std::vector m_sur_x; + /// y position of the center of the surface associated with the step + std::vector m_sur_y; + /// z position of the center of the surface associated with the step + std::vector m_sur_z; + /// path correction when associating material to the given surface + std::vector m_sur_pathCorrection; + /// Min range of the surface associated with the step + std::vector m_sur_range_min; + /// Max range of the surface associated with the step + std::vector m_sur_range_max; + + /// ID of the volume associated with the step + std::vector m_vol_id; }; } // namespace ActsExamples diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootParticleReader.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootParticleReader.hpp index fae6750d880..064e6ad6835 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootParticleReader.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootParticleReader.hpp @@ -35,14 +35,12 @@ class RootParticleReader : public IReader { public: /// @brief The nested configuration struct struct Config { - ///< particle collection to read + /// particle collection to read std::string outputParticles = "particleCollection"; /// name of the output tree std::string treeName = "particles"; /// The name of the input file std::string filePath; - /// Whether the events are ordered or not - bool orderedEvents = true; }; /// Constructor diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootSimHitReader.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootSimHitReader.hpp index d2b00434093..2d0bde82303 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootSimHitReader.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootSimHitReader.hpp @@ -28,7 +28,6 @@ class TChain; namespace ActsExamples { -struct AlgorithmContext; /// @class RootParticleReader /// @@ -43,8 +42,6 @@ class RootSimHitReader : public IReader { std::string treeName = "hits"; ///< The name of the input file std::string filePath; - /// Whether the events are ordered or not - bool orderedEvents = true; }; RootSimHitReader(const RootSimHitReader &) = delete; diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootTrackSummaryReader.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootTrackSummaryReader.hpp index 8f39206c832..c4d145f20ee 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootTrackSummaryReader.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootTrackSummaryReader.hpp @@ -29,7 +29,6 @@ class TChain; namespace ActsExamples { -struct AlgorithmContext; /// @class RootTrackSummaryReader /// @@ -47,9 +46,6 @@ class RootTrackSummaryReader : public IReader { std::string treeName = "tracksummary"; /// The name of the input file std::string filePath; - - /// Whether the events are ordered or not - bool orderedEvents = true; }; /// Constructor diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootUtility.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootUtility.hpp new file mode 100644 index 00000000000..892d11bdfaa --- /dev/null +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootUtility.hpp @@ -0,0 +1,57 @@ +// This file is part of the Acts project. +// +// Copyright (C) 2024 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 + +#include + +namespace ActsExamples { +namespace RootUtility { + +/// @brief Sorts an array of elements and outputs the indices of the sorted elements. +/// +/// This function sorts an array `elements` containing `numElements` of generic +/// type `element_t`. It outputs an array `sortedIndices` of type `index_t` that +/// contains the indices of `elements` in sorted order. The sort order is +/// determined by the `sortDescending` flag; if `true`, the array is sorted in +/// descending order, otherwise in ascending order. +/// +/// This is a stable version of `TMath::Sort` that preserves the relative order +/// of equal elements. +/// +/// @tparam element_t The data type of the array elements to be sorted. +/// @tparam index_t The data type for indexing and counting elements in the arrays. +/// +/// @param numElements The number of elements in the `elements` array. +/// @param elements Pointer to the array of type `element_t` +/// @param sortedIndices Pointer to an array of `index_t` type where the sorted indices will be stored. +/// @param sortDescending Boolean flag indicating the sort order. `true` for descending, `false` for ascending. +/// +/// @note It is the caller's responsibility to ensure that the `sortedIndices` array is pre-allocated +/// with a length of at least `numElements`. Furthermore, the types of +/// `numElements` and `sortedIndices` must be consistent. +template +void stableSort(index_t numElements, const element_t* elements, + index_t* sortedIndices, Bool_t sortDescending) { + for (index_t i = 0; i < numElements; i++) { + sortedIndices[i] = i; + } + + if (sortDescending) { + std::stable_sort(sortedIndices, sortedIndices + numElements, + CompareDesc(elements)); + } else { + std::stable_sort(sortedIndices, sortedIndices + numElements, + CompareAsc(elements)); + } +} + +} // namespace RootUtility +} // namespace ActsExamples diff --git a/Examples/Io/Root/src/RootAthenaNTupleReader.cpp b/Examples/Io/Root/src/RootAthenaNTupleReader.cpp index b21f74f60c6..cd1183124ac 100644 --- a/Examples/Io/Root/src/RootAthenaNTupleReader.cpp +++ b/Examples/Io/Root/src/RootAthenaNTupleReader.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2017-2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 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 @@ -16,6 +16,7 @@ #include "Acts/Vertexing/Vertex.hpp" #include "ActsExamples/EventData/Track.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" +#include "ActsExamples/Io/Root/RootUtility.hpp" #include #include @@ -23,7 +24,6 @@ #include #include -#include ActsExamples::RootAthenaNTupleReader::RootAthenaNTupleReader( const ActsExamples::RootAthenaNTupleReader::Config& config, @@ -114,18 +114,6 @@ ActsExamples::RootAthenaNTupleReader::RootAthenaNTupleReader( m_events = m_inputChain->GetEntries(); ACTS_DEBUG("The full chain has " << m_events << " entries."); - - { - // The entry numbers for accessing events in increased order (there could be - // multiple entries corresponding to one event number) - std::vector m_entryNumbers; - // If the events are not in order, get the entry numbers for ordered events - m_entryNumbers.resize(m_events); - m_inputChain->Draw("EventNumber", "", "goff"); - // Sort to get the entry numbers of the ordered events - TMath::Sort(m_inputChain->GetEntries(), m_inputChain->GetV1(), - m_entryNumbers.data(), false); - } } ActsExamples::ProcessCode ActsExamples::RootAthenaNTupleReader::read( diff --git a/Examples/Io/Root/src/RootMaterialTrackReader.cpp b/Examples/Io/Root/src/RootMaterialTrackReader.cpp index 252f5e1dce5..69934cd743b 100644 --- a/Examples/Io/Root/src/RootMaterialTrackReader.cpp +++ b/Examples/Io/Root/src/RootMaterialTrackReader.cpp @@ -14,18 +14,20 @@ #include "Acts/Material/MaterialSlab.hpp" #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" +#include "ActsExamples/Io/Root/RootUtility.hpp" #include #include #include #include -#include #include -ActsExamples::RootMaterialTrackReader::RootMaterialTrackReader( - const Config& config, Acts::Logging::Level level) - : ActsExamples::IReader(), +namespace ActsExamples { + +RootMaterialTrackReader::RootMaterialTrackReader(const Config& config, + Acts::Logging::Level level) + : IReader(), m_logger{Acts::getDefaultLogger(name(), level)}, m_cfg(config) { if (m_cfg.fileList.empty()) { @@ -45,9 +47,7 @@ ActsExamples::RootMaterialTrackReader::RootMaterialTrackReader( // get the number of entries, which also loads the tree std::size_t nentries = m_inputChain->GetEntries(); - bool eventIdPresent = - (TTree::kMatch == m_inputChain->SetBranchAddress("event_id", &m_eventId)); - + m_inputChain->SetBranchAddress("event_id", &m_eventId); m_inputChain->SetBranchAddress("v_x", &m_v_x); m_inputChain->SetBranchAddress("v_y", &m_v_y); m_inputChain->SetBranchAddress("v_z", &m_v_z); @@ -78,10 +78,7 @@ ActsExamples::RootMaterialTrackReader::RootMaterialTrackReader( m_inputChain->SetBranchAddress("sur_pathCorrection", &m_sur_pathCorrection); } - m_events = - eventIdPresent - ? static_cast(m_inputChain->GetMaximum("event_id") + 1) - : nentries; + m_events = static_cast(m_inputChain->GetMaximum("event_id") + 1); m_batchSize = nentries / m_events; ACTS_DEBUG("The full chain has " << nentries << " entries for " << m_events @@ -90,23 +87,18 @@ ActsExamples::RootMaterialTrackReader::RootMaterialTrackReader( << " events this corresponds to a batch size of: " << m_batchSize << std::endl; - // If the events are not in order, get the entry numbers for ordered events - if (!m_cfg.orderedEvents) { - if (!eventIdPresent) { - throw std::invalid_argument{ - "'event_id' branch is missing in your tree. This is not compatible " - "with unordered events."}; - } + // Sort the entry numbers of the events + { m_entryNumbers.resize(nentries); m_inputChain->Draw("event_id", "", "goff"); - // Sort to get the entry numbers of the ordered events - TMath::Sort(m_inputChain->GetEntries(), m_inputChain->GetV1(), - m_entryNumbers.data(), false); + RootUtility::stableSort(m_inputChain->GetEntries(), m_inputChain->GetV1(), + m_entryNumbers.data(), false); } - m_outputMaterialTracks.initialize(m_cfg.collection); + + m_outputMaterialTracks.initialize(m_cfg.outputMaterialTracks); } -ActsExamples::RootMaterialTrackReader::~RootMaterialTrackReader() { +RootMaterialTrackReader::~RootMaterialTrackReader() { delete m_inputChain; delete m_step_x; @@ -129,108 +121,108 @@ ActsExamples::RootMaterialTrackReader::~RootMaterialTrackReader() { delete m_sur_pathCorrection; } -std::string ActsExamples::RootMaterialTrackReader::name() const { +std::string RootMaterialTrackReader::name() const { return "RootMaterialTrackReader"; } -std::pair -ActsExamples::RootMaterialTrackReader::availableEvents() const { +std::pair RootMaterialTrackReader::availableEvents() + const { return {0u, m_events}; } -ActsExamples::ProcessCode ActsExamples::RootMaterialTrackReader::read( - const ActsExamples::AlgorithmContext& context) { +ProcessCode RootMaterialTrackReader::read(const AlgorithmContext& context) { ACTS_DEBUG("Trying to read recorded material from tracks."); - // read in the material track - if (m_inputChain != nullptr && context.eventNumber < m_events) { - // lock the mutex - std::lock_guard lock(m_read_mutex); - // now read - - // The collection to be written - std::unordered_map - mtrackCollection; - - // Loop over the entries for this event - for (std::size_t ib = 0; ib < m_batchSize; ++ib) { - // Read the correct entry: startEntry + ib - auto entry = m_batchSize * context.eventNumber + ib; - if (!m_cfg.orderedEvents && entry < m_entryNumbers.size()) { - entry = m_entryNumbers[entry]; + + if (m_inputChain == nullptr || context.eventNumber >= m_events) { + return ProcessCode::SUCCESS; + } + + // lock the mutex + std::lock_guard lock(m_read_mutex); + // now read + + // The collection to be written + std::unordered_map mtrackCollection; + + // Loop over the entries for this event + for (std::size_t ib = 0; ib < m_batchSize; ++ib) { + // Read the correct entry: startEntry + ib + auto entry = m_batchSize * context.eventNumber + ib; + entry = m_entryNumbers.at(entry); + ACTS_VERBOSE("Reading event: " << context.eventNumber + << " with stored entry: " << entry); + m_inputChain->GetEntry(entry); + + Acts::RecordedMaterialTrack rmTrack; + // Fill the position and momentum + rmTrack.first.first = Acts::Vector3(m_v_x, m_v_y, m_v_z); + rmTrack.first.second = Acts::Vector3(m_v_px, m_v_py, m_v_pz); + + ACTS_VERBOSE("Track vertex: " << rmTrack.first.first); + ACTS_VERBOSE("Track momentum:" << rmTrack.first.second); + + // Fill the individual steps + std::size_t msteps = m_step_length->size(); + ACTS_VERBOSE("Reading " << msteps << " material steps."); + rmTrack.second.materialInteractions.reserve(msteps); + rmTrack.second.materialInX0 = 0.; + rmTrack.second.materialInL0 = 0.; + + for (std::size_t is = 0; is < msteps; ++is) { + ACTS_VERBOSE("===================="); + ACTS_VERBOSE("[" << is + 1 << "/" << msteps << "] STEP INFORMATION: "); + + double s = (*m_step_length)[is]; + if (s == 0) { + ACTS_VERBOSE("invalid step length... skipping!"); + continue; } - ACTS_VERBOSE("Reading event: " << context.eventNumber - << " with stored entry: " << entry); - m_inputChain->GetEntry(entry); - - Acts::RecordedMaterialTrack rmTrack; - // Fill the position and momentum - rmTrack.first.first = Acts::Vector3(m_v_x, m_v_y, m_v_z); - rmTrack.first.second = Acts::Vector3(m_v_px, m_v_py, m_v_pz); - - ACTS_VERBOSE("Track vertex: " << rmTrack.first.first); - ACTS_VERBOSE("Track momentum:" << rmTrack.first.second); - - // Fill the individual steps - std::size_t msteps = m_step_length->size(); - ACTS_VERBOSE("Reading " << msteps << " material steps."); - rmTrack.second.materialInteractions.reserve(msteps); - rmTrack.second.materialInX0 = 0.; - rmTrack.second.materialInL0 = 0.; - - for (std::size_t is = 0; is < msteps; ++is) { - ACTS_VERBOSE("===================="); - ACTS_VERBOSE("[" << is + 1 << "/" << msteps << "] STEP INFORMATION: "); - - double s = (*m_step_length)[is]; - if (s == 0) { - ACTS_VERBOSE("invalid step length... skipping!"); - continue; - } - - double mX0 = (*m_step_X0)[is]; - double mL0 = (*m_step_L0)[is]; - - rmTrack.second.materialInX0 += s / mX0; - rmTrack.second.materialInL0 += s / mL0; - /// Fill the position & the material - Acts::MaterialInteraction mInteraction; - mInteraction.position = - Acts::Vector3((*m_step_x)[is], (*m_step_y)[is], (*m_step_z)[is]); - ACTS_VERBOSE("POSITION : " << (*m_step_x)[is] << ", " << (*m_step_y)[is] - << ", " << (*m_step_z)[is]); - mInteraction.direction = - Acts::Vector3((*m_step_dx)[is], (*m_step_dy)[is], (*m_step_dz)[is]); - ACTS_VERBOSE("DIRECTION: " << (*m_step_dx)[is] << ", " - << (*m_step_dy)[is] << ", " - << (*m_step_dz)[is]); - mInteraction.materialSlab = Acts::MaterialSlab( - Acts::Material::fromMassDensity(mX0, mL0, (*m_step_A)[is], - (*m_step_Z)[is], (*m_step_rho)[is]), - s); - ACTS_VERBOSE("MATERIAL: " << mX0 << ", " << mL0 << ", " - << (*m_step_A)[is] << ", " << (*m_step_Z)[is] - << ", " << (*m_step_rho)[is]); - ACTS_VERBOSE("===================="); - - if (m_cfg.readCachedSurfaceInformation) { - // add the surface information to the interaction this allows the - // mapping to be speed up - mInteraction.intersectionID = - Acts::GeometryIdentifier((*m_sur_id)[is]); - mInteraction.intersection = - Acts::Vector3((*m_sur_x)[is], (*m_sur_y)[is], (*m_sur_z)[is]); - mInteraction.pathCorrection = (*m_sur_pathCorrection)[is]; - } else { - mInteraction.intersectionID = Acts::GeometryIdentifier(); - mInteraction.intersection = Acts::Vector3(0, 0, 0); - } - rmTrack.second.materialInteractions.push_back(std::move(mInteraction)); + + double mX0 = (*m_step_X0)[is]; + double mL0 = (*m_step_L0)[is]; + + rmTrack.second.materialInX0 += s / mX0; + rmTrack.second.materialInL0 += s / mL0; + /// Fill the position & the material + Acts::MaterialInteraction mInteraction; + mInteraction.position = + Acts::Vector3((*m_step_x)[is], (*m_step_y)[is], (*m_step_z)[is]); + ACTS_VERBOSE("POSITION : " << (*m_step_x)[is] << ", " << (*m_step_y)[is] + << ", " << (*m_step_z)[is]); + mInteraction.direction = + Acts::Vector3((*m_step_dx)[is], (*m_step_dy)[is], (*m_step_dz)[is]); + ACTS_VERBOSE("DIRECTION: " << (*m_step_dx)[is] << ", " << (*m_step_dy)[is] + << ", " << (*m_step_dz)[is]); + mInteraction.materialSlab = Acts::MaterialSlab( + Acts::Material::fromMassDensity(mX0, mL0, (*m_step_A)[is], + (*m_step_Z)[is], (*m_step_rho)[is]), + s); + ACTS_VERBOSE("MATERIAL: " << mX0 << ", " << mL0 << ", " << (*m_step_A)[is] + << ", " << (*m_step_Z)[is] << ", " + << (*m_step_rho)[is]); + ACTS_VERBOSE("===================="); + + if (m_cfg.readCachedSurfaceInformation) { + // add the surface information to the interaction this allows the + // mapping to be speed up + mInteraction.intersectionID = Acts::GeometryIdentifier((*m_sur_id)[is]); + mInteraction.intersection = + Acts::Vector3((*m_sur_x)[is], (*m_sur_y)[is], (*m_sur_z)[is]); + mInteraction.pathCorrection = (*m_sur_pathCorrection)[is]; + } else { + mInteraction.intersectionID = Acts::GeometryIdentifier(); + mInteraction.intersection = Acts::Vector3(0, 0, 0); } - mtrackCollection[ib] = (std::move(rmTrack)); + rmTrack.second.materialInteractions.push_back(std::move(mInteraction)); } - // Write to the collection to the EventStore - m_outputMaterialTracks(context, std::move(mtrackCollection)); + mtrackCollection[ib] = (std::move(rmTrack)); } + + // Write to the collection to the EventStore + m_outputMaterialTracks(context, std::move(mtrackCollection)); + // Return success flag - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } + +} // namespace ActsExamples diff --git a/Examples/Io/Root/src/RootMaterialTrackWriter.cpp b/Examples/Io/Root/src/RootMaterialTrackWriter.cpp index 29044d78b5b..0d6ed47e7fb 100644 --- a/Examples/Io/Root/src/RootMaterialTrackWriter.cpp +++ b/Examples/Io/Root/src/RootMaterialTrackWriter.cpp @@ -35,13 +35,14 @@ using Acts::VectorHelpers::eta; using Acts::VectorHelpers::perp; using Acts::VectorHelpers::phi; -ActsExamples::RootMaterialTrackWriter::RootMaterialTrackWriter( - const ActsExamples::RootMaterialTrackWriter::Config& config, - Acts::Logging::Level level) - : WriterT(config.collection, "RootMaterialTrackWriter", level), +namespace ActsExamples { + +RootMaterialTrackWriter::RootMaterialTrackWriter( + const RootMaterialTrackWriter::Config& config, Acts::Logging::Level level) + : WriterT(config.inputMaterialTracks, "RootMaterialTrackWriter", level), m_cfg(config) { // An input collection name and tree name must be specified - if (m_cfg.collection.empty()) { + if (m_cfg.inputMaterialTracks.empty()) { throw std::invalid_argument("Missing input collection"); } else if (m_cfg.treeName.empty()) { throw std::invalid_argument("Missing tree name"); @@ -108,13 +109,13 @@ ActsExamples::RootMaterialTrackWriter::RootMaterialTrackWriter( } } -ActsExamples::RootMaterialTrackWriter::~RootMaterialTrackWriter() { +RootMaterialTrackWriter::~RootMaterialTrackWriter() { if (m_outputFile != nullptr) { m_outputFile->Close(); } } -ActsExamples::ProcessCode ActsExamples::RootMaterialTrackWriter::finalize() { +ProcessCode RootMaterialTrackWriter::finalize() { // write the tree and close the file ACTS_INFO("Writing ROOT output File : " << m_cfg.filePath); @@ -122,10 +123,10 @@ ActsExamples::ProcessCode ActsExamples::RootMaterialTrackWriter::finalize() { m_outputTree->Write(); m_outputFile->Close(); - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } -ActsExamples::ProcessCode ActsExamples::RootMaterialTrackWriter::writeT( +ProcessCode RootMaterialTrackWriter::writeT( const AlgorithmContext& ctx, const std::unordered_map& materialTracks) { @@ -366,5 +367,7 @@ ActsExamples::ProcessCode ActsExamples::RootMaterialTrackWriter::writeT( } // return success - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } + +} // namespace ActsExamples diff --git a/Examples/Io/Root/src/RootParticleReader.cpp b/Examples/Io/Root/src/RootParticleReader.cpp index eb39c163ffe..34a5bd12e12 100644 --- a/Examples/Io/Root/src/RootParticleReader.cpp +++ b/Examples/Io/Root/src/RootParticleReader.cpp @@ -12,6 +12,7 @@ #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/EventData/SimParticle.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" +#include "ActsExamples/Io/Root/RootUtility.hpp" #include "ActsFatras/EventData/ProcessType.hpp" #include @@ -20,7 +21,6 @@ #include #include -#include namespace ActsExamples { @@ -73,13 +73,12 @@ RootParticleReader::RootParticleReader(const RootParticleReader::Config& config, m_events = m_inputChain->GetEntries(); ACTS_DEBUG("The full chain has " << m_events << " entries."); - // If the events are not in order, get the entry numbers for ordered events - if (!m_cfg.orderedEvents) { + // Sort the entry numbers of the events + { m_entryNumbers.resize(m_events); m_inputChain->Draw("event_id", "", "goff"); - // Sort to get the entry numbers of the ordered events - TMath::Sort(m_inputChain->GetEntries(), m_inputChain->GetV1(), - m_entryNumbers.data(), false); + RootUtility::stableSort(m_inputChain->GetEntries(), m_inputChain->GetV1(), + m_entryNumbers.data(), false); } } @@ -127,13 +126,10 @@ ProcessCode RootParticleReader::read(const AlgorithmContext& context) { SimParticleContainer particles; // Read the correct entry - auto entry = context.eventNumber; - if (!m_cfg.orderedEvents && entry < m_entryNumbers.size()) { - entry = m_entryNumbers[entry]; - } + auto entry = m_entryNumbers.at(context.eventNumber); m_inputChain->GetEntry(entry); - ACTS_INFO("Reading event: " << context.eventNumber - << " stored as entry: " << entry); + ACTS_DEBUG("Reading event: " << context.eventNumber + << " stored as entry: " << entry); unsigned int nParticles = m_particleId->size(); @@ -156,6 +152,9 @@ ProcessCode RootParticleReader::read(const AlgorithmContext& context) { particles.insert(p); } + ACTS_DEBUG("Read " << particles.size() << " particles for event " + << context.eventNumber); + // Write the collections to the EventStore m_outputParticles(context, std::move(particles)); diff --git a/Examples/Io/Root/src/RootSimHitReader.cpp b/Examples/Io/Root/src/RootSimHitReader.cpp index b115c8dc5f4..cea62954727 100644 --- a/Examples/Io/Root/src/RootSimHitReader.cpp +++ b/Examples/Io/Root/src/RootSimHitReader.cpp @@ -22,10 +22,11 @@ #include #include -ActsExamples::RootSimHitReader::RootSimHitReader( - const ActsExamples::RootSimHitReader::Config& config, - Acts::Logging::Level level) - : ActsExamples::IReader(), +namespace ActsExamples { + +RootSimHitReader::RootSimHitReader(const RootSimHitReader::Config& config, + Acts::Logging::Level level) + : IReader(), m_cfg(config), m_logger(Acts::getDefaultLogger(name(), level)) { m_inputChain = new TChain(m_cfg.treeName.c_str()); @@ -101,13 +102,11 @@ ActsExamples::RootSimHitReader::RootSimHitReader( << availableEvents().second); } -std::pair -ActsExamples::RootSimHitReader::availableEvents() const { +std::pair RootSimHitReader::availableEvents() const { return {std::get<0>(m_eventMap.front()), std::get<0>(m_eventMap.back()) + 1}; } -ActsExamples::ProcessCode ActsExamples::RootSimHitReader::read( - const ActsExamples::AlgorithmContext& context) { +ProcessCode RootSimHitReader::read(const AlgorithmContext& context) { auto it = std::find_if( m_eventMap.begin(), m_eventMap.end(), [&](const auto& a) { return std::get<0>(a) == context.eventNumber; }); @@ -125,7 +124,7 @@ ActsExamples::ProcessCode ActsExamples::RootSimHitReader::read( m_outputSimHits(context, {}); // Return success flag - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } // lock the mutex @@ -174,8 +173,13 @@ ActsExamples::ProcessCode ActsExamples::RootSimHitReader::read( hits.insert(hit); } + ACTS_DEBUG("Read " << hits.size() << " hits for event " + << context.eventNumber); + m_outputSimHits(context, std::move(hits)); // Return success flag - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } + +} // namespace ActsExamples diff --git a/Examples/Io/Root/src/RootTrackSummaryReader.cpp b/Examples/Io/Root/src/RootTrackSummaryReader.cpp index af8b7dd02e2..5ce1fee3ee8 100644 --- a/Examples/Io/Root/src/RootTrackSummaryReader.cpp +++ b/Examples/Io/Root/src/RootTrackSummaryReader.cpp @@ -16,18 +16,19 @@ #include "Acts/Utilities/Logger.hpp" #include "ActsExamples/EventData/SimParticle.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" +#include "ActsExamples/Io/Root/RootUtility.hpp" #include "ActsFatras/EventData/Particle.hpp" #include #include #include -#include -ActsExamples::RootTrackSummaryReader::RootTrackSummaryReader( - const ActsExamples::RootTrackSummaryReader::Config& config, - Acts::Logging::Level level) - : ActsExamples::IReader(), +namespace ActsExamples { + +RootTrackSummaryReader::RootTrackSummaryReader( + const RootTrackSummaryReader::Config& config, Acts::Logging::Level level) + : IReader(), m_logger{Acts::getDefaultLogger(name(), level)}, m_cfg(config) { m_inputChain = new TChain(m_cfg.treeName.c_str()); @@ -96,22 +97,21 @@ ActsExamples::RootTrackSummaryReader::RootTrackSummaryReader( m_events = m_inputChain->GetEntries(); ACTS_DEBUG("The full chain has " << m_events << " entries."); - // If the events are not in order, get the entry numbers for ordered events - if (!m_cfg.orderedEvents) { + // Sort the entry numbers of the events + { m_entryNumbers.resize(m_events); m_inputChain->Draw("event_nr", "", "goff"); - // Sort to get the entry numbers of the ordered events - TMath::Sort(m_inputChain->GetEntries(), m_inputChain->GetV1(), - m_entryNumbers.data(), false); + RootUtility::stableSort(m_inputChain->GetEntries(), m_inputChain->GetV1(), + m_entryNumbers.data(), false); } } -std::pair -ActsExamples::RootTrackSummaryReader::availableEvents() const { +std::pair RootTrackSummaryReader::availableEvents() + const { return {0u, m_events}; } -ActsExamples::RootTrackSummaryReader::~RootTrackSummaryReader() { +RootTrackSummaryReader::~RootTrackSummaryReader() { delete m_multiTrajNr; delete m_subTrajNr; delete m_nStates; @@ -155,8 +155,7 @@ ActsExamples::RootTrackSummaryReader::~RootTrackSummaryReader() { delete m_err_eT_fit; } -ActsExamples::ProcessCode ActsExamples::RootTrackSummaryReader::read( - const ActsExamples::AlgorithmContext& context) { +ProcessCode RootTrackSummaryReader::read(const AlgorithmContext& context) { ACTS_DEBUG("Trying to read recorded tracks."); // read in the fitted track parameters and particles @@ -174,10 +173,7 @@ ActsExamples::ProcessCode ActsExamples::RootTrackSummaryReader::read( SimParticleContainer truthParticleCollection; // Read the correct entry - auto entry = context.eventNumber; - if (!m_cfg.orderedEvents && entry < m_entryNumbers.size()) { - entry = m_entryNumbers[entry]; - } + auto entry = m_entryNumbers.at(context.eventNumber); m_inputChain->GetEntry(entry); ACTS_INFO("Reading event: " << context.eventNumber << " stored as entry: " << entry); @@ -229,5 +225,7 @@ ActsExamples::ProcessCode ActsExamples::RootTrackSummaryReader::read( ACTS_WARNING("Could not read in event."); } // Return success flag - return ActsExamples::ProcessCode::SUCCESS; + return ProcessCode::SUCCESS; } + +} // namespace ActsExamples diff --git a/Examples/Python/src/Input.cpp b/Examples/Python/src/Input.cpp index e22e63b6fad..850b989574d 100644 --- a/Examples/Python/src/Input.cpp +++ b/Examples/Python/src/Input.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 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 @@ -41,20 +41,19 @@ void addInput(Context& ctx) { // ROOT READERS ACTS_PYTHON_DECLARE_READER(ActsExamples::RootParticleReader, mex, "RootParticleReader", outputParticles, treeName, - filePath, orderedEvents); + filePath); ACTS_PYTHON_DECLARE_READER(ActsExamples::RootVertexReader, mex, "RootVertexReader", outputVertices, treeName, filePath, orderedEvents); ACTS_PYTHON_DECLARE_READER(ActsExamples::RootMaterialTrackReader, mex, - "RootMaterialTrackReader", collection, treeName, - fileList, orderedEvents, - readCachedSurfaceInformation); + "RootMaterialTrackReader", outputMaterialTracks, + treeName, fileList, readCachedSurfaceInformation); - ACTS_PYTHON_DECLARE_READER( - ActsExamples::RootTrackSummaryReader, mex, "RootTrackSummaryReader", - outputTracks, outputParticles, treeName, filePath, orderedEvents); + ACTS_PYTHON_DECLARE_READER(ActsExamples::RootTrackSummaryReader, mex, + "RootTrackSummaryReader", outputTracks, + outputParticles, treeName, filePath); // CSV READERS ACTS_PYTHON_DECLARE_READER(ActsExamples::CsvParticleReader, mex, diff --git a/Examples/Python/src/Material.cpp b/Examples/Python/src/Material.cpp index 9978fa0fdbd..cdabe0ff2c0 100644 --- a/Examples/Python/src/Material.cpp +++ b/Examples/Python/src/Material.cpp @@ -110,7 +110,7 @@ void addMaterial(Context& ctx) { const Acts::MagneticFieldContext&>()); ACTS_PYTHON_STRUCT_BEGIN(c, Alg::Config); - ACTS_PYTHON_MEMBER(collection); + ACTS_PYTHON_MEMBER(inputMaterialTracks); ACTS_PYTHON_MEMBER(mappingMaterialCollection); ACTS_PYTHON_MEMBER(materialSurfaceMapper); ACTS_PYTHON_MEMBER(materialVolumeMapper); diff --git a/Examples/Python/src/Output.cpp b/Examples/Python/src/Output.cpp index bb5ebaeb026..daa4c90cbe4 100644 --- a/Examples/Python/src/Output.cpp +++ b/Examples/Python/src/Output.cpp @@ -206,10 +206,10 @@ void addOutput(Context& ctx) { inputMeasurementParticlesMap, inputMeasurementSimHitsMap, filePath, treeName, fileMode); - ACTS_PYTHON_DECLARE_WRITER(ActsExamples::RootMaterialTrackWriter, mex, - "RootMaterialTrackWriter", collection, filePath, - fileMode, treeName, recalculateTotals, prePostStep, - storeSurface, storeVolume, collapseInteractions); + ACTS_PYTHON_DECLARE_WRITER( + ActsExamples::RootMaterialTrackWriter, mex, "RootMaterialTrackWriter", + inputMaterialTracks, filePath, fileMode, treeName, recalculateTotals, + prePostStep, storeSurface, storeVolume, collapseInteractions); { using Writer = ActsExamples::RootBFieldWriter; diff --git a/Examples/Python/tests/test_reader.py b/Examples/Python/tests/test_reader.py index 8cb8b3a67bd..c888453a94c 100644 --- a/Examples/Python/tests/test_reader.py +++ b/Examples/Python/tests/test_reader.py @@ -149,6 +149,7 @@ def test_root_material_track_reader(material_recording): RootMaterialTrackReader( level=acts.logging.INFO, fileList=[str(input_tracks)], + outputMaterialTracks="material-tracks", ) ) diff --git a/Examples/Scripts/Optimization/ckf.py b/Examples/Scripts/Optimization/ckf.py index 264fca80544..36ca7a634e9 100755 --- a/Examples/Scripts/Optimization/ckf.py +++ b/Examples/Scripts/Optimization/ckf.py @@ -1,16 +1,12 @@ #!/usr/bin/env python3 + from pathlib import Path -from typing import Optional, Union -from collections import namedtuple +from typing import Optional import argparse -import sys -import os - -from acts.examples import Sequencer, GenericDetector, RootParticleReader import acts - from acts import UnitConstants as u +from acts.examples import GenericDetector, RootParticleReader def getArgumentParser(): @@ -165,7 +161,6 @@ def runCKFTracks( level=acts.logging.INFO, filePath=str(inputParticlePath.resolve()), outputParticles="particles_input", - orderedEvents=False, ) ) diff --git a/Examples/Scripts/Python/Auto-tuning/Orion/material_mapping_optimisation.py b/Examples/Scripts/Python/Auto-tuning/Orion/material_mapping_optimisation.py index 8bf12c3359b..f30f7d355a8 100755 --- a/Examples/Scripts/Python/Auto-tuning/Orion/material_mapping_optimisation.py +++ b/Examples/Scripts/Python/Auto-tuning/Orion/material_mapping_optimisation.py @@ -69,7 +69,7 @@ def runMaterialMappingNoTrack( s.addReader( RootMaterialTrackReader( level=acts.logging.INFO, - collection="material-tracks", + outputMaterialTracks="material-tracks", fileList=[ os.path.join( inputDir, @@ -85,7 +85,7 @@ def runMaterialMappingNoTrack( stepper = StraightLineStepper() mmAlgCfg = MaterialMapping.Config(context.geoContext, context.magFieldContext) mmAlgCfg.trackingGeometry = trackingGeometry - mmAlgCfg.collection = "material-tracks" + mmAlgCfg.inputMaterialTracks = "material-tracks" if mapSurface: navigator = Navigator( @@ -225,7 +225,7 @@ def runMaterialMappingVariance( # Read material step information from a ROOT TTRee reader = RootMaterialTrackReader( level=acts.logging.ERROR, - collection="material-tracks", + outputMaterialTracks="material-tracks", fileList=[ os.path.join( inputPath, @@ -240,7 +240,7 @@ def runMaterialMappingVariance( stepper = StraightLineStepper() mmAlgCfg = MaterialMapping.Config(context.geoContext, context.magFieldContext) mmAlgCfg.trackingGeometry = trackingGeometryVar - mmAlgCfg.collection = "material-tracks" + mmAlgCfg.inputMaterialTracks = "material-tracks" if mapSurface: navigator = Navigator( diff --git a/Examples/Scripts/Python/ckf_tracks.py b/Examples/Scripts/Python/ckf_tracks.py index 868fd8a8404..3f2e9c5c858 100755 --- a/Examples/Scripts/Python/ckf_tracks.py +++ b/Examples/Scripts/Python/ckf_tracks.py @@ -1,13 +1,11 @@ #!/usr/bin/env python3 -from pathlib import Path -from typing import Optional, Union -from collections import namedtuple -from acts.examples import Sequencer, GenericDetector, RootParticleReader +from pathlib import Path +from typing import Optional import acts - from acts import UnitConstants as u +from acts.examples import GenericDetector, RootParticleReader def runCKFTracks( @@ -70,7 +68,6 @@ def runCKFTracks( level=acts.logging.INFO, filePath=str(inputParticlePath.resolve()), outputParticles="particles_input", - orderedEvents=False, ) ) diff --git a/Examples/Scripts/Python/digitization.py b/Examples/Scripts/Python/digitization.py index 16155a60e1a..a69a8f01c45 100755 --- a/Examples/Scripts/Python/digitization.py +++ b/Examples/Scripts/Python/digitization.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 from pathlib import Path -from typing import Optional, Union +from typing import Optional import acts import acts.examples @@ -47,9 +47,8 @@ def runDigitization( # Read input from input collection (e.g. Pythia8 output) evGen = acts.examples.RootParticleReader( level=s.config.logLevel, - outputParticles="particles_input", filePath=str(particlesInput), - orderedEvents=False, + outputParticles="particles_input", ) s.addReader(evGen) diff --git a/Examples/Scripts/Python/material_mapping.py b/Examples/Scripts/Python/material_mapping.py index 87e7595997e..ab3b0694ea5 100755 --- a/Examples/Scripts/Python/material_mapping.py +++ b/Examples/Scripts/Python/material_mapping.py @@ -53,7 +53,7 @@ def runMaterialMapping( s.addReader( RootMaterialTrackReader( level=acts.logging.INFO, - collection="material-tracks", + outputMaterialTracks="material-tracks", fileList=[ os.path.join( inputDir, @@ -70,7 +70,7 @@ def runMaterialMapping( mmAlgCfg = MaterialMapping.Config(context.geoContext, context.magFieldContext) mmAlgCfg.trackingGeometry = trackingGeometry - mmAlgCfg.collection = "material-tracks" + mmAlgCfg.inputMaterialTracks = "material-tracks" if mapSurface: navigator = Navigator( @@ -116,7 +116,7 @@ def runMaterialMapping( s.addWriter( RootMaterialTrackWriter( level=acts.logging.INFO, - collection=mmAlgCfg.mappingMaterialCollection, + inputMaterialTracks=mmAlgCfg.mappingMaterialCollection, filePath=os.path.join( outputDir, mapName + "_tracks.root", diff --git a/Examples/Scripts/Python/material_mapping_itk.py b/Examples/Scripts/Python/material_mapping_itk.py index b9bb9023037..a0414171c9f 100644 --- a/Examples/Scripts/Python/material_mapping_itk.py +++ b/Examples/Scripts/Python/material_mapping_itk.py @@ -53,7 +53,7 @@ def runMaterialMapping( s.addReader( RootMaterialTrackReader( level=acts.logging.INFO, - collection="material-tracks", + outputMaterialTracks="material-tracks", fileList=[ os.path.join( inputDir, @@ -68,7 +68,7 @@ def runMaterialMapping( mmAlgCfg = MaterialMapping.Config(context.geoContext, context.magFieldContext) mmAlgCfg.trackingGeometry = trackingGeometry - mmAlgCfg.collection = "material-tracks" + mmAlgCfg.inputMaterialTracks = "material-tracks" if mapSurface: navigator = Navigator( @@ -102,7 +102,7 @@ def runMaterialMapping( s.addWriter( RootMaterialTrackWriter( level=acts.logging.INFO, - collection=mmAlgCfg.collection, + inputMaterialTracks=mmAlgCfg.collection, filePath=os.path.join( outputDir, mapName + "_tracks.root", diff --git a/Examples/Scripts/Python/material_recording.py b/Examples/Scripts/Python/material_recording.py index 80d713732e9..ddceefc753c 100755 --- a/Examples/Scripts/Python/material_recording.py +++ b/Examples/Scripts/Python/material_recording.py @@ -78,7 +78,7 @@ def runMaterialRecording( acts.examples.RootMaterialTrackWriter( prePostStep=True, recalculateTotals=True, - collection="material_tracks", + inputMaterialTracks="material_tracks", filePath=os.path.join(outputDir, "geant4_material_tracks.root"), level=acts.logging.INFO, ) diff --git a/Examples/Scripts/Python/material_validation.py b/Examples/Scripts/Python/material_validation.py index f8c09c887e0..3234471fdb0 100755 --- a/Examples/Scripts/Python/material_validation.py +++ b/Examples/Scripts/Python/material_validation.py @@ -49,7 +49,7 @@ def runMaterialValidation( s.addWriter( RootMaterialTrackWriter( level=acts.logging.INFO, - collection=alg.config.propagationMaterialCollection, + inputMaterialTracks=alg.config.propagationMaterialCollection, filePath=os.path.join(outputDir, (outputName + ".root")), storeSurface=True, storeVolume=True, diff --git a/Examples/Scripts/Python/material_validation_itk.py b/Examples/Scripts/Python/material_validation_itk.py index 6c606daf4a2..000a6b2a0e6 100755 --- a/Examples/Scripts/Python/material_validation_itk.py +++ b/Examples/Scripts/Python/material_validation_itk.py @@ -53,7 +53,7 @@ def runMaterialValidation( s.addWriter( RootMaterialTrackWriter( level=acts.logging.INFO, - collection=alg.config.propagationMaterialCollection, + inputMaterialTracks=alg.config.propagationMaterialCollection, filePath=os.path.join(outputDir, (outputName + ".root")), storeSurface=True, storeVolume=True, diff --git a/Examples/Scripts/Python/truth_tracking_gsf.py b/Examples/Scripts/Python/truth_tracking_gsf.py index b7474cb48d4..069f31dde5f 100755 --- a/Examples/Scripts/Python/truth_tracking_gsf.py +++ b/Examples/Scripts/Python/truth_tracking_gsf.py @@ -68,7 +68,6 @@ def runTruthTrackingGsf( level=acts.logging.INFO, filePath=str(inputParticlePath.resolve()), outputParticles="particles_input", - orderedEvents=False, ) ) diff --git a/Examples/Scripts/Python/truth_tracking_gx2f.py b/Examples/Scripts/Python/truth_tracking_gx2f.py index 5d7cb5c2fe5..a94107edfc8 100644 --- a/Examples/Scripts/Python/truth_tracking_gx2f.py +++ b/Examples/Scripts/Python/truth_tracking_gx2f.py @@ -59,7 +59,6 @@ def runTruthTrackingGx2f( level=acts.logging.INFO, filePath=str(inputParticlePath.resolve()), outputParticles="particles_input", - orderedEvents=False, ) ) diff --git a/Examples/Scripts/Python/truth_tracking_kalman.py b/Examples/Scripts/Python/truth_tracking_kalman.py index d82f4921410..bef6da9c05e 100755 --- a/Examples/Scripts/Python/truth_tracking_kalman.py +++ b/Examples/Scripts/Python/truth_tracking_kalman.py @@ -70,7 +70,6 @@ def runTruthTrackingKalman( level=acts.logging.INFO, filePath=str(inputParticlePath.resolve()), outputParticles="particles_input", - orderedEvents=False, ) ) diff --git a/Examples/Scripts/Python/vertex_fitting.py b/Examples/Scripts/Python/vertex_fitting.py index 12e29c0dcfc..e8797a5ed12 100755 --- a/Examples/Scripts/Python/vertex_fitting.py +++ b/Examples/Scripts/Python/vertex_fitting.py @@ -45,7 +45,6 @@ def runVertexFitting( level=acts.logging.INFO, filePath=str(inputParticlePath.resolve()), outputParticles=inputParticles, - orderedEvents=False, ) ) @@ -83,7 +82,6 @@ def runVertexFitting( outputTracks=trackParameters, outputParticles=associatedParticles, filePath=str(inputTrackSummary.resolve()), - orderedEvents=False, ) s.addReader(trackSummaryReader)