From 39d367a1d849d25fd3b07f39b5714f1d231f31c8 Mon Sep 17 00:00:00 2001 From: Andreas Salzburger <Andreas.Salzburger@cern.ch> Date: Wed, 3 Jul 2019 12:23:35 +0200 Subject: [PATCH] re-establishing material validation --- .../GeometryInterfaces/MaterialWiper.hpp | 47 ++++++++ Examples/CMakeLists.txt | 2 +- .../Common/ACTFW/Options/CommonOptions.cpp | 9 ++ .../Common/ACTFW/Options/CommonOptions.hpp | 4 + Examples/Geometry/CMakeLists.txt | 103 ++++++++++-------- .../src/detail/GeometryExampleBase.hpp | 20 ++-- Examples/MaterialMapping/CMakeLists.txt | 55 +++++----- .../src/detail/MaterialValidationBase.hpp | 90 ++++++--------- Examples/Propagation/CMakeLists.txt | 95 +++++++++------- .../src/detail/PropagationExampleBase.hpp | 19 +++- Plugins/Root/CMakeLists.txt | 3 +- 11 files changed, 267 insertions(+), 180 deletions(-) create mode 100644 Detectors/GeometryInterfaces/include/ACTFW/GeometryInterfaces/MaterialWiper.hpp diff --git a/Detectors/GeometryInterfaces/include/ACTFW/GeometryInterfaces/MaterialWiper.hpp b/Detectors/GeometryInterfaces/include/ACTFW/GeometryInterfaces/MaterialWiper.hpp new file mode 100644 index 00000000..862fd5e8 --- /dev/null +++ b/Detectors/GeometryInterfaces/include/ACTFW/GeometryInterfaces/MaterialWiper.hpp @@ -0,0 +1,47 @@ +// This file is part of the Acts project. +// +// Copyright (C) 2019 Acts project team +// +// 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/. + +/////////////////////////////////////////////////////////////////// +// MaterialWiper.hpp, Acts project +/////////////////////////////////////////////////////////////////// + +#pragma once + +#include "Acts/Detector/TrackingVolume.hpp" +#include "Acts/Material/IMaterialDecorator.hpp" +#include "Acts/Surfaces/Surface.hpp" + +namespace Acts { + +/// @class MaterialWiper +/// +/// This decorator sets the nulls-material +/// +class MaterialWiper : public IMaterialDecorator +{ +public: + /// Decorate a surface + /// + /// @param surface the non-cost surface that is decorated + void + decorate(Surface& surface) const final + { + surface.assignSurfaceMaterial(nullptr); + } + + /// Decorate a TrackingVolume + /// + /// @param volume the non-cost volume that is decorated + virtual void + decorate(TrackingVolume& volume) const final + { + volume.assignVolumeMaterial(nullptr); + } +}; + +} // namespace \ No newline at end of file diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index 98456201..8a2265ba 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -6,7 +6,7 @@ add_subdirectory(EventGenerator) add_subdirectory_if(Fatras USE_PYTHIA8) add_subdirectory(Geometry) add_subdirectory(HelloWorld) -#add_subdirectory(MaterialMapping) +add_subdirectory(MaterialMapping) add_subdirectory(Propagation) add_subdirectory(RandomNumbers) add_subdirectory(WhiteBoard) diff --git a/Examples/Common/ACTFW/Options/CommonOptions.cpp b/Examples/Common/ACTFW/Options/CommonOptions.cpp index 8ad2632b..13f85be8 100644 --- a/Examples/Common/ACTFW/Options/CommonOptions.cpp +++ b/Examples/Common/ACTFW/Options/CommonOptions.cpp @@ -62,6 +62,15 @@ FW::Options::addGeometryOptions( "Sub detectors for the output writing"); } +void +FW::Options::addMaterialOptions( + boost::program_options::options_description& opt) +{ + opt.add_options()("mat-input-type", + value<std::string>()->default_value("none"), + "The way material is loaded: 'none', 'build', 'file'."); +} + void FW::Options::addOutputOptions(boost::program_options::options_description& opt) { diff --git a/Examples/Common/ACTFW/Options/CommonOptions.hpp b/Examples/Common/ACTFW/Options/CommonOptions.hpp index 4f5f2a31..ded7d187 100644 --- a/Examples/Common/ACTFW/Options/CommonOptions.hpp +++ b/Examples/Common/ACTFW/Options/CommonOptions.hpp @@ -32,6 +32,10 @@ namespace Options { void addGeometryOptions(boost::program_options::options_description& opt); + /// Add common material-related options. + void + addMaterialOptions(boost::program_options::options_description& opt); + /// Add common output-related options. void addOutputOptions(boost::program_options::options_description& opt); diff --git a/Examples/Geometry/CMakeLists.txt b/Examples/Geometry/CMakeLists.txt index df24b51a..5866e4e8 100644 --- a/Examples/Geometry/CMakeLists.txt +++ b/Examples/Geometry/CMakeLists.txt @@ -1,55 +1,70 @@ -# generic detector -add_executable(ACTFWGenericGeometryExample src/GenericGeometryExample) -target_include_directories(ACTFWGenericGeometryExample PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(ACTFWGenericGeometryExample PRIVATE ActsCore) -target_link_libraries(ACTFWGenericGeometryExample PRIVATE ACTFramework ACTFWExamplesCommon) -target_link_libraries(ACTFWGenericGeometryExample PRIVATE ACTFWObjPlugin ACTFWCsvPlugin ACTFWJsonPlugin ACTFWGenericDetector) -target_link_libraries(ACTFWGenericGeometryExample PRIVATE ${Boost_LIBRARIES}) +set(_common_libraries + ActsCore + ACTFramework + ACTFWGeometryInterfaces + ACTFWExamplesCommon + ACTFWObjPlugin + ACTFWCsvPlugin + ACTFWJsonPlugin + ${Boost_LIBRARIES}) -install(TARGETS ACTFWGenericGeometryExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +# Generic detector +add_executable(ACTFWGenericGeometryExample src/GenericGeometryExample.cpp) +target_include_directories(ACTFWGenericGeometryExample PRIVATE + ${Boost_INCLUDE_DIRS}) +target_link_libraries(ACTFWGenericGeometryExample PRIVATE + ${_common_libraries} + ACTFWGenericDetector) +install( + TARGETS ACTFWGenericGeometryExample + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -# alignable detector - with iov -add_executable(ACTFWAlignedGeometryExample src/AlignedGeometryExample) -target_include_directories(ACTFWAlignedGeometryExample PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(ACTFWAlignedGeometryExample PRIVATE ActsCore) -target_link_libraries(ACTFWAlignedGeometryExample PRIVATE ACTFramework ACTFWExamplesCommon) -target_link_libraries(ACTFWAlignedGeometryExample PRIVATE ACTFWObjPlugin ACTFWCsvPlugin ACTFWJsonPlugin ACTFWGenericDetector ACTFWContextualDetector) -target_link_libraries(ACTFWAlignedGeometryExample PRIVATE ${Boost_LIBRARIES}) +# Generic detector with IOV based alignment +add_executable(ACTFWAlignedGeometryExample src/AlignedGeometryExample.cpp) +target_include_directories(ACTFWAlignedGeometryExample PRIVATE + ${Boost_INCLUDE_DIRS}) +target_link_libraries(ACTFWAlignedGeometryExample PRIVATE + ${_common_libraries} + ACTFWContextualDetector) +install( + TARGETS ACTFWAlignedGeometryExample + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(TARGETS ACTFWAlignedGeometryExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - -# alignable detector - with payload -add_executable(ACTFWPayloadGeometryExample src/PayloadGeometryExample) -target_include_directories(ACTFWPayloadGeometryExample PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(ACTFWPayloadGeometryExample PRIVATE ActsCore) -target_link_libraries(ACTFWPayloadGeometryExample PRIVATE ACTFramework ACTFWExamplesCommon) -target_link_libraries(ACTFWPayloadGeometryExample PRIVATE ACTFWObjPlugin ACTFWCsvPlugin ACTFWJsonPlugin ACTFWGenericDetector ACTFWContextualDetector) -target_link_libraries(ACTFWPayloadGeometryExample PRIVATE ${Boost_LIBRARIES}) - -install(TARGETS ACTFWPayloadGeometryExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +# Generic detector with Payload based alignment +add_executable(ACTFWPayloadGeometryExample src/PayloadGeometryExample.cpp) +target_include_directories(ACTFWPayloadGeometryExample PRIVATE + ${Boost_INCLUDE_DIRS}) +target_link_libraries(ACTFWPayloadGeometryExample PRIVATE + ${_common_libraries} + ACTFWContextualDetector) +install( + TARGETS ACTFWPayloadGeometryExample + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) # TGEO based detector if (USE_TGEO) - add_executable(ACTFWTGeoGeometryExample src/TGeoGeometryExample) - target_include_directories(ACTFWTGeoGeometryExample PUBLIC ${Boost_INCLUDE_DIRS}) - target_link_libraries(ACTFWTGeoGeometryExample PRIVATE ActsCore) - target_link_libraries(ACTFWTGeoGeometryExample PRIVATE ACTFramework ACTFWExamplesCommon) - target_link_libraries(ACTFWTGeoGeometryExample PRIVATE ACTFWObjPlugin ACTFWCsvPlugin ACTFWJsonPlugin ACTFWTGeoDetector) - target_link_libraries(ACTFWTGeoGeometryExample PRIVATE ${Boost_LIBRARIES}) - - install(TARGETS ACTFWTGeoGeometryExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + add_executable(ACTFWTGeoGeometryExample src/TGeoGeometryExample.cpp) + target_include_directories(ACTFWTGeoGeometryExample PRIVATE + ${Boost_INCLUDE_DIRS}) + target_link_libraries(ACTFWTGeoGeometryExample PRIVATE + ${_common_libraries} + ACTFWTGeoDetector) + install( + TARGETS ACTFWTGeoGeometryExample + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() # DD4hep detector -if (USE_DD4HEP AND USE_GEANT4) +if (USE_DD4HEP) add_executable(ACTFWDD4hepGeometryExample src/DD4hepGeometryExample.cpp) - target_include_directories(ACTFWDD4hepGeometryExample PRIVATE ${DD4hep_INCLUDE_DIRS}) - target_include_directories(ACTFWDD4hepGeometryExample PRIVATE ${Boost_INCLUDE_DIRS}) - target_link_libraries(ACTFWDD4hepGeometryExample PRIVATE ActsCore) - target_link_libraries(ACTFWDD4hepGeometryExample PRIVATE ACTFramework ACTFWExamplesCommon ACTFWDD4hepDetector) - target_link_libraries(ACTFWDD4hepGeometryExample PRIVATE ACTFWCsvPlugin ACTFWObjPlugin ACTFWJsonPlugin ACTFWDD4hepDetector) - target_link_libraries(ACTFWDD4hepGeometryExample PRIVATE ${DD4hep_LIBRARIES}) - target_link_libraries(ACTFWDD4hepGeometryExample PRIVATE ${Boost_LIBRARIES}) - - install(TARGETS ACTFWDD4hepGeometryExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + target_include_directories(ACTFWDD4hepGeometryExample PRIVATE + ${Boost_INCLUDE_DIRS} + ${DD4hep_INCLUDE_DIRS}) + target_link_libraries(ACTFWDD4hepGeometryExample PRIVATE + ${_common_libraries} + ACTFWDD4hepDetector + ${DD4hep_LIBRARIES}) + install( + TARGETS ACTFWDD4hepGeometryExample + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/Examples/Geometry/src/detail/GeometryExampleBase.hpp b/Examples/Geometry/src/detail/GeometryExampleBase.hpp index 793a9d69..0eb9c6ea 100644 --- a/Examples/Geometry/src/detail/GeometryExampleBase.hpp +++ b/Examples/Geometry/src/detail/GeometryExampleBase.hpp @@ -15,6 +15,7 @@ #include "ACTFW/Framework/AlgorithmContext.hpp" #include "ACTFW/Framework/IContextDecorator.hpp" #include "ACTFW/Framework/WhiteBoard.hpp" +#include "ACTFW/GeometryInterfaces/MaterialWiper.hpp" #include "ACTFW/Options/CommonOptions.hpp" #include "ACTFW/Plugins/Csv/CsvSurfaceWriter.hpp" #include "ACTFW/Plugins/Csv/CsvTrackingGeometryWriter.hpp" @@ -39,6 +40,7 @@ processGeometry(int argc, auto desc = FW::Options::makeDefaultOptions(); FW::Options::addSequencerOptions(desc); FW::Options::addGeometryOptions(desc); + FW::Options::addMaterialOptions(desc); FW::Options::addObjWriterOptions(desc); FW::Options::addOutputOptions(desc); // Add specific options for this geometry @@ -50,10 +52,14 @@ processGeometry(int argc, // Now read the standard options auto logLevel = FW::Options::readLogLevel(vm); - // TODO Check whether this truly needs to be event-based. If yes switch to - // Sequencer-based tool, otherwise remove. - auto nEvents = FW::Options::readSequencerConfig(vm).events; - auto geometry = geometrySetup(vm, nullptr); + auto nEvents = FW::Options::readSequencerConfig(vm).events; + // Material decoration + std::shared_ptr<const Acts::IMaterialDecorator> matDeco = nullptr; + auto matType = vm["mat-input-type"].as<std::string>(); + if (matType == "none") { + matDeco = std::make_shared<const Acts::MaterialWiper>(); + } + auto geometry = geometrySetup(vm, matDeco); auto tGeometry = geometry.first; auto contextDecorators = geometry.second; @@ -61,11 +67,11 @@ processGeometry(int argc, read_strings subDetectors = vm["geo-subdetectors"].as<read_strings>(); auto surfaceLogLevel - = Acts::Logging::Level(vm["geo-surface-loglevel"].template as<size_t>()); + = Acts::Logging::Level(vm["geo-surface-loglevel"].as<size_t>()); auto layerLogLevel - = Acts::Logging::Level(vm["geo-layer-loglevel"].template as<size_t>()); + = Acts::Logging::Level(vm["geo-layer-loglevel"].as<size_t>()); auto volumeLogLevel - = Acts::Logging::Level(vm["geo-volume-loglevel"].template as<size_t>()); + = Acts::Logging::Level(vm["geo-volume-loglevel"].as<size_t>()); for (size_t ievt = 0; ievt < nEvents; ++ievt) { diff --git a/Examples/MaterialMapping/CMakeLists.txt b/Examples/MaterialMapping/CMakeLists.txt index 6455f8e3..6ca9f08f 100644 --- a/Examples/MaterialMapping/CMakeLists.txt +++ b/Examples/MaterialMapping/CMakeLists.txt @@ -3,36 +3,35 @@ add_executable(ACTFWGenericMaterialValidationExample src/GenericMaterialValidation.cpp) target_include_directories(ACTFWGenericMaterialValidationExample PRIVATE ${Boost_INCLUDE_DIRS}) target_link_libraries(ACTFWGenericMaterialValidationExample PRIVATE ActsCore) -target_link_libraries(ACTFWGenericMaterialValidationExample PRIVATE ACTFramework ACTFWExamplesCommon ACTFWPropagation ACTFWGenericDetector) -target_link_libraries(ACTFWGenericMaterialValidationExample PRIVATE ACTFWRootPlugin ACTFWJsonPlugin ACTFWBFieldPlugin) +target_link_libraries(ACTFWGenericMaterialValidationExample PRIVATE ACTFramework ACTFWExamplesCommon ACTFWGeometryInterfaces ACTFWPropagation ACTFWGenericDetector) +target_link_libraries(ACTFWGenericMaterialValidationExample PRIVATE ACTFWRootPlugin ACTFWJsonPlugin ACTFWBFieldPlugin) target_link_libraries(ACTFWGenericMaterialValidationExample PRIVATE ${Boost_LIBRARIES}) install(TARGETS ACTFWGenericMaterialValidationExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -add_executable(ACTFWGenericMaterialMappingExample src/GenericMaterialMapping.cpp) -target_include_directories(ACTFWGenericMaterialMappingExample PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(ACTFWGenericMaterialMappingExample PRIVATE ActsCore ActsMaterialMappingPlugin) -target_link_libraries(ACTFWGenericMaterialMappingExample PRIVATE ACTFramework ACTFWExamplesCommon ACTFWMaterialMapping ACTFWGenericDetector) -target_link_libraries(ACTFWGenericMaterialMappingExample PRIVATE ACTFWRootPlugin) -target_link_libraries(ACTFWGenericMaterialMappingExample PRIVATE ACTFWJsonPlugin) -target_link_libraries(ACTFWGenericMaterialMappingExample PRIVATE ${Boost_LIBRARIES}) +#add_executable(ACTFWGenericMaterialMappingExample src/GenericMaterialMapping.cpp) +#target_include_directories(ACTFWGenericMaterialMappingExample PRIVATE ${Boost_INCLUDE_DIRS}) +#target_link_libraries(ACTFWGenericMaterialMappingExample PRIVATE ActsCore ActsMaterialMappingPlugin) +#target_link_libraries(ACTFWGenericMaterialMappingExample PRIVATE ACTFramework ACTFWExamplesCommon ACTFWMaterialMapping ACTFWGenericDetector) +#target_link_libraries(ACTFWGenericMaterialMappingExample PRIVATE ACTFWRootPlugin ACTFWJsonPlugin) +#target_link_libraries(ACTFWGenericMaterialMappingExample PRIVATE ${Boost_LIBRARIES}) +# +#install(TARGETS ACTFWGenericMaterialMappingExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(TARGETS ACTFWGenericMaterialMappingExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - -if (USE_GEANT4 AND USE_DD4HEP) - include(${Geant4_USE_FILE}) - - add_executable(ACTFWGeantinoRecordingExample src/GeantinoRecordingExample.cpp) - target_include_directories(ACTFWGeantinoRecordingExample PRIVATE ${Boost_INCLUDE_DIRS}) - target_include_directories(ACTFWGeantinoRecordingExample PRIVATE ${DD4hep_INCLUDE_DIRS}) - target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ACTFWDD4hepG4Plugin) - target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ACTFWExamplesCommon) - target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ACTFWDD4hepDetector) - target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ACTFWMaterialMapping) - target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ACTFWRootPlugin) - target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ${DD4hep_LIBRARIES}) - target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ${Geant4_LIBRARIES}) - target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ${Boost_LIBRARIES}) - - install(TARGETS ACTFWGeantinoRecordingExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -endif() +#if (USE_GEANT4 AND USE_DD4HEP) +# include(${Geant4_USE_FILE}) +# +# add_executable(ACTFWGeantinoRecordingExample src/GeantinoRecordingExample.cpp) +# target_include_directories(ACTFWGeantinoRecordingExample PRIVATE ${Boost_INCLUDE_DIRS}) +# target_include_directories(ACTFWGeantinoRecordingExample PRIVATE ${DD4hep_INCLUDE_DIRS}) +# target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ACTFWDD4hepG4Plugin) +# target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ACTFWExamplesCommon) +# target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ACTFWDD4hepDetector) +# target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ACTFWMaterialMapping) +# target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ACTFWRootPlugin) +# target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ${DD4hep_LIBRARIES}) +# target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ${Geant4_LIBRARIES}) +# target_link_libraries(ACTFWGeantinoRecordingExample PRIVATE ${Boost_LIBRARIES}) +# +# install(TARGETS ACTFWGeantinoRecordingExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +#endif() diff --git a/Examples/MaterialMapping/src/detail/MaterialValidationBase.hpp b/Examples/MaterialMapping/src/detail/MaterialValidationBase.hpp index d2603aa5..69016c61 100644 --- a/Examples/MaterialMapping/src/detail/MaterialValidationBase.hpp +++ b/Examples/MaterialMapping/src/detail/MaterialValidationBase.hpp @@ -10,13 +10,11 @@ #include <boost/program_options.hpp> #include <memory> -#include "ACTFW/Common/CommonOptions.hpp" -#include "ACTFW/Common/GeometryOptions.hpp" -#include "ACTFW/Common/MaterialOptions.hpp" -#include "ACTFW/Common/OutputOptions.hpp" #include "ACTFW/Framework/Sequencer.hpp" +#include "ACTFW/Options/CommonOptions.hpp" #include "ACTFW/Plugins/BField/BFieldOptions.hpp" -#include "ACTFW/Plugins/Root/RootMaterialReader.hpp" +//#include "ACTFW/Plugins/Root/RootMaterialReader.hpp" +#include "ACTFW/GeometryInterfaces/MaterialWiper.hpp" #include "ACTFW/Plugins/Root/RootMaterialTrackWriter.hpp" #include "ACTFW/Propagation/PropagationAlgorithm.hpp" #include "ACTFW/Propagation/PropagationOptions.hpp" @@ -55,7 +53,7 @@ setupPropagation(sequencer_t& sequencer, std::shared_ptr<const Acts::TrackingGeometry> tGeometry) { // Get the log level - auto logLevel = FW::Options::readLogLevel<po::variables_map>(vm); + auto logLevel = FW::Options::readLogLevel(vm); // Get a Navigator Acts::Navigator navigator(tGeometry); @@ -73,7 +71,7 @@ setupPropagation(sequencer_t& sequencer, pAlgConfig, logLevel); // Add the propagation algorithm - sequencer.appendEventAlgorithms({propagationAlg}); + sequencer.addAlgorithm({propagationAlg}); return FW::ProcessCode::SUCCESS; } @@ -97,7 +95,7 @@ setupStraightLinePropagation( std::shared_ptr<const Acts::TrackingGeometry> tGeometry) { // Get the log level - auto logLevel = FW::Options::readLogLevel<po::variables_map>(vm); + auto logLevel = FW::Options::readLogLevel(vm); // Get a Navigator Acts::Navigator navigator(tGeometry); @@ -116,7 +114,7 @@ setupStraightLinePropagation( pAlgConfig, logLevel); // Add the propagation algorithm - sequencer.appendEventAlgorithms({propagationAlg}); + sequencer.addAlgorithm({propagationAlg}); return FW::ProcessCode::SUCCESS; } @@ -142,58 +140,43 @@ materialValidationExample(int argc, geometry_setup_t geometrySetup) { - // Create the config object for the sequencer - FW::Sequencer::Config seqConfig; - // Now create the sequencer - FW::Sequencer sequencer(seqConfig); - // Declare the supported program options. - po::options_description desc("Allowed options"); - // Add the common options - FW::Options::addCommonOptions<po::options_description>(desc); - // Add the geometry options - FW::Options::addGeometryOptions<po::options_description>(desc); - // Add the material options - FW::Options::addMaterialOptions<po::options_description>(desc); - // Add the bfield options - FW::Options::addBFieldOptions<po::options_description>(desc); - // Add the random number options - FW::Options::addRandomNumbersOptions<po::options_description>(desc); - // Add the fatras options - FW::Options::addPropagationOptions<po::options_description>(desc); - // Add the output options - FW::Options::addOutputOptions<po::options_description>(desc); + // Setup and parse options + auto desc = FW::Options::makeDefaultOptions(); + FW::Options::addSequencerOptions(desc); + FW::Options::addGeometryOptions(desc); + FW::Options::addMaterialOptions(desc); + FW::Options::addBFieldOptions(desc); + FW::Options::addRandomNumbersOptions(desc); + FW::Options::addPropagationOptions(desc); + FW::Options::addOutputOptions(desc); // Add specific options for this geometry optionsSetup(desc); - - // Map to store the given program options - po::variables_map vm; - // Get all options from contain line and store it into the map - po::store(po::parse_command_line(argc, argv, desc), vm); - po::notify(vm); - // Print help if requested - if (vm.count("help")) { - std::cout << desc << std::endl; - return 1; + auto vm = FW::Options::parse(desc, argc, argv); + if (vm.empty()) { + return EXIT_FAILURE; } - // The Log level - auto nEvents = FW::Options::readNumberOfEvents<po::variables_map>(vm); + FW::Sequencer sequencer(FW::Options::readSequencerConfig(vm)); + + // Now read the standard options + auto logLevel = FW::Options::readLogLevel(vm); + + // Material decoration + std::shared_ptr<const Acts::IMaterialDecorator> matDeco = nullptr; + auto matType = vm["mat-input-type"].as<std::string>(); + if (matType == "none") { + matDeco = std::make_shared<const Acts::MaterialWiper>(); + } + auto geometry = geometrySetup(vm, matDeco); + auto tGeometry = geometry.first; // Create the random number engine - auto randomNumberSvcCfg - = FW::Options::readRandomNumbersConfig<po::variables_map>(vm); + auto randomNumberSvcCfg = FW::Options::readRandomNumbersConfig(vm); auto randomNumberSvc = std::make_shared<FW::RandomNumbersSvc>(randomNumberSvcCfg); // Add it to the sequencer - sequencer.addServices({randomNumberSvc}); - - // Material loading from external source - auto mDecorator = FW::Options::readMaterialDecorator<po::variables_map>(vm); - - // Set up the geometry - auto geometry = geometrySetup(vm, mDecorator); - auto tGeometry = geometry.first; + sequencer.addService(randomNumberSvc); // Create BField service auto bField = FW::Options::readBField<po::variables_map>(vm); @@ -236,12 +219,11 @@ materialValidationExample(int argc, auto matTrackWriterRoot = std::make_shared<FW::Root::RootMaterialTrackWriter>( matTrackWriterRootConfig); - if (sequencer.addWriters({matTrackWriterRoot}) != FW::ProcessCode::SUCCESS) - return -1; + sequencer.addWriter(matTrackWriterRoot); } // Initiate the run - sequencer.run(nEvents); + sequencer.run(); // Return success code return 0; } diff --git a/Examples/Propagation/CMakeLists.txt b/Examples/Propagation/CMakeLists.txt index 3dd1573c..de3513e7 100755 --- a/Examples/Propagation/CMakeLists.txt +++ b/Examples/Propagation/CMakeLists.txt @@ -1,57 +1,72 @@ +set(_common_libraries + ActsCore + ACTFramework + ACTFWPropagation + ACTFWExamplesCommon + ACTFWGeometryInterfaces + ACTFWBFieldPlugin + ACTFWObjPlugin + ACTFWJsonPlugin + ACTFWRootPlugin + ${Boost_LIBRARIES}) + # Generic detector add_executable(ACTFWGenericPropagationExample src/GenericPropagationExample.cpp) -target_include_directories(ACTFWGenericPropagationExample PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(ACTFWGenericPropagationExample PRIVATE ActsCore) -target_link_libraries(ACTFWGenericPropagationExample PRIVATE ACTFramework ACTFWExamplesCommon ACTFWPropagation ACTFWGenericDetector) -target_link_libraries(ACTFWGenericPropagationExample PRIVATE ACTFWRootPlugin ACTFWObjPlugin ACTFWJsonPlugin ACTFWBFieldPlugin) -target_link_libraries(ACTFWGenericPropagationExample PRIVATE ${Boost_LIBRARIES}) - -install(TARGETS ACTFWGenericPropagationExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +target_include_directories(ACTFWGenericPropagationExample PRIVATE + ${Boost_INCLUDE_DIRS}) +target_link_libraries(ACTFWGenericPropagationExample PRIVATE + ${_common_libraries} + ACTFWGenericDetector) +install( + TARGETS ACTFWGenericPropagationExample + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) # Generic detector with IOV based alignment add_executable(ACTFWAlignedPropagationExample src/AlignedPropagationExample.cpp) -target_include_directories(ACTFWAlignedPropagationExample PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(ACTFWAlignedPropagationExample PRIVATE ActsCore) -target_link_libraries(ACTFWAlignedPropagationExample PRIVATE ACTFramework ACTFWExamplesCommon ACTFWPropagation) -target_link_libraries(ACTFWAlignedPropagationExample PRIVATE ACTFWGenericDetector ACTFWContextualDetector) -target_link_libraries(ACTFWAlignedPropagationExample PRIVATE ACTFWRootPlugin ACTFWObjPlugin ACTFWJsonPlugin ACTFWBFieldPlugin) -target_link_libraries(ACTFWAlignedPropagationExample PRIVATE ${Boost_LIBRARIES}) - -install(TARGETS ACTFWAlignedPropagationExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +target_include_directories(ACTFWAlignedPropagationExample PRIVATE + ${Boost_INCLUDE_DIRS}) +target_link_libraries(ACTFWAlignedPropagationExample PRIVATE + ${_common_libraries} + ACTFWContextualDetector) +install( + TARGETS ACTFWAlignedPropagationExample + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -# Generic detector with payload based alignment +# Generic detector with Payload based alignment add_executable(ACTFWPayloadPropagationExample src/PayloadPropagationExample.cpp) -target_include_directories(ACTFWPayloadPropagationExample PRIVATE ${Boost_INCLUDE_DIRS}) -target_link_libraries(ACTFWPayloadPropagationExample PRIVATE ActsCore) -target_link_libraries(ACTFWPayloadPropagationExample PRIVATE ACTFramework ACTFWExamplesCommon ACTFWPropagation) -target_link_libraries(ACTFWPayloadPropagationExample PRIVATE ACTFWGenericDetector ACTFWContextualDetector) -target_link_libraries(ACTFWPayloadPropagationExample PRIVATE ACTFWRootPlugin ACTFWObjPlugin ACTFWJsonPlugin ACTFWBFieldPlugin) -target_link_libraries(ACTFWPayloadPropagationExample PRIVATE ${Boost_LIBRARIES}) - -install(TARGETS ACTFWPayloadPropagationExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +target_include_directories(ACTFWPayloadPropagationExample PRIVATE + ${Boost_INCLUDE_DIRS}) +target_link_libraries(ACTFWPayloadPropagationExample PRIVATE + ${_common_libraries} + ACTFWContextualDetector) +install( + TARGETS ACTFWPayloadPropagationExample + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) # TGEO based detector if (USE_TGEO) add_executable(ACTFWTGeoPropagationExample src/TGeoPropagationExample.cpp) - target_include_directories(ACTFWTGeoPropagationExample PRIVATE ${Boost_INCLUDE_DIRS}) - target_link_libraries(ACTFWTGeoPropagationExample PRIVATE ActsCore) - target_link_libraries(ACTFWTGeoPropagationExample PRIVATE ACTFramework ACTFWExamplesCommon ACTFWPropagation ACTFWTGeoDetector) - target_link_libraries(ACTFWTGeoPropagationExample PRIVATE ACTFWRootPlugin ACTFWObjPlugin ACTFWJsonPlugin ACTFWBFieldPlugin) - target_link_libraries(ACTFWTGeoPropagationExample PRIVATE ${Boost_LIBRARIES}) - - install(TARGETS ACTFWTGeoPropagationExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + target_include_directories(ACTFWTGeoPropagationExample PRIVATE + ${Boost_INCLUDE_DIRS}) + target_link_libraries(ACTFWTGeoPropagationExample PRIVATE + ${_common_libraries} + ACTFWTGeoDetector) + install( + TARGETS ACTFWTGeoPropagationExample + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() # DD4hep detector if (USE_DD4HEP) add_executable(ACTFWDD4hepPropagationExample src/DD4hepPropagationExample.cpp) - target_include_directories(ACTFWDD4hepPropagationExample PRIVATE ${DD4hep_INCLUDE_DIRS}) - target_include_directories(ACTFWDD4hepPropagationExample PRIVATE ${Boost_INCLUDE_DIRS}) - target_link_libraries(ACTFWDD4hepPropagationExample PRIVATE ActsCore) - target_link_libraries(ACTFWDD4hepPropagationExample PRIVATE ACTFramework ACTFWExamplesCommon ACTFWPropagation ACTFWDD4hepDetector) - target_link_libraries(ACTFWDD4hepPropagationExample PRIVATE ACTFWRootPlugin ACTFWObjPlugin ACTFWJsonPlugin ACTFWBFieldPlugin) - target_link_libraries(ACTFWDD4hepPropagationExample PRIVATE ${DD4hep_LIBRARIES}) - target_link_libraries(ACTFWDD4hepPropagationExample PRIVATE ${Boost_LIBRARIES}) - - install(TARGETS ACTFWDD4hepPropagationExample RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + target_include_directories(ACTFWDD4hepPropagationExample PRIVATE + ${Boost_INCLUDE_DIRS} + ${DD4hep_INCLUDE_DIRS}) + target_link_libraries(ACTFWDD4hepPropagationExample PRIVATE + ${_common_libraries} + ACTFWDD4hepDetector + ${DD4hep_LIBRARIES}) + install( + TARGETS ACTFWDD4hepPropagationExample + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/Examples/Propagation/src/detail/PropagationExampleBase.hpp b/Examples/Propagation/src/detail/PropagationExampleBase.hpp index ed62400d..4f63b7b4 100644 --- a/Examples/Propagation/src/detail/PropagationExampleBase.hpp +++ b/Examples/Propagation/src/detail/PropagationExampleBase.hpp @@ -13,6 +13,7 @@ #include <boost/program_options.hpp> #include "ACTFW/Framework/Sequencer.hpp" +#include "ACTFW/GeometryInterfaces/MaterialWiper.hpp" #include "ACTFW/Options/CommonOptions.hpp" #include "ACTFW/Plugins/BField/BFieldOptions.hpp" #include "ACTFW/Plugins/BField/ScalableBField.hpp" @@ -130,30 +131,38 @@ propagationExample(int argc, options_setup_t& optionsSetup, geometry_setup_t& geometrySetup) { - // setup and parse options + // Setup and parse options auto desc = FW::Options::makeDefaultOptions(); FW::Options::addSequencerOptions(desc); FW::Options::addGeometryOptions(desc); + FW::Options::addMaterialOptions(desc); FW::Options::addBFieldOptions(desc); FW::Options::addRandomNumbersOptions(desc); FW::Options::addPropagationOptions(desc); FW::Options::addOutputOptions(desc); + // Add specific options for this geometry optionsSetup(desc); auto vm = FW::Options::parse(desc, argc, argv); if (vm.empty()) { return EXIT_FAILURE; } - FW::Sequencer sequencer(FW::Options::readSequencerConfig(vm)); // Now read the standard options - auto logLevel = FW::Options::readLogLevel(vm); - auto geometry = geometrySetup(vm, nullptr); + auto logLevel = FW::Options::readLogLevel(vm); + + // Material decoration + std::shared_ptr<const Acts::IMaterialDecorator> matDeco = nullptr; + auto matType = vm["mat-input-type"].as<std::string>(); + if (matType == "none") { + matDeco = std::make_shared<const Acts::MaterialWiper>(); + } + auto geometry = geometrySetup(vm, matDeco); auto tGeometry = geometry.first; auto contextDecorators = geometry.second; - // Add it to the sequencer + // Add the decorator to the sequencer for (auto cdr : contextDecorators) { sequencer.addContextDecorator(cdr); } diff --git a/Plugins/Root/CMakeLists.txt b/Plugins/Root/CMakeLists.txt index 07ad4d6b..e65b81a3 100644 --- a/Plugins/Root/CMakeLists.txt +++ b/Plugins/Root/CMakeLists.txt @@ -1,4 +1,5 @@ -set(sources src/RootPlanarClusterWriter.cpp +set(sources src/RootMaterialTrackWriter.cpp + src/RootPlanarClusterWriter.cpp src/RootParticleWriter.cpp src/RootSimHitWriter.cpp src/RootPropagationStepsWriter.cpp) -- GitLab