-
Notifications
You must be signed in to change notification settings - Fork 54
feat: Acts Gen3 geometry test #1011
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
Open
wdconinc
wants to merge
11
commits into
main
Choose a base branch
from
acts-gen3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+52
−12
Open
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3d0a7a3
git-cp: move test_ACTS.cxx to test_ACTS_gen3.cxx
wdconinc 9c32f28
git-cp: restore test_ACTS.cxx
wdconinc 4c95779
git-cp test_ACTS.cxx test_ACTS_gen3.cxx
wdconinc 0372b2c
feat: this adds a gen3 import test for the epic geometry
wdconinc 665e73d
fix: rm unused code from test_ACTS_gen3.cxx
wdconinc d35ff92
Add docs
wdconinc 54be390
Add docs
wdconinc 7d9a2b4
Use unique filename for gen3
wdconinc 9486516
Include fstream for file operations
wdconinc 5324b2d
fix: add VertexBarrelL\d_nz to correspond with VertexBarrelL\d_nphi
wdconinc 92bf4da
fix: use actual Gen3 geometry for test_ACTS_gen3.cxx
wdconinc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| // SPDX-License-Identifier: LGPL-3.0-or-later | ||
| // Copyright (C) 2022 - 2024, Whitney Armstrong, Wouter Deconinck | ||
|
|
||
| #include <DD4hep/Detector.h> | ||
|
|
||
| #include <Acts/Detector/CylindricalContainerBuilder.hpp> | ||
| #include <Acts/Detector/Detector.hpp> | ||
| #include <Acts/Detector/DetectorBuilder.hpp> | ||
| #include <Acts/Detector/detail/BlueprintDrawer.hpp> | ||
| #include <Acts/Detector/detail/BlueprintHelper.hpp> | ||
| #include <Acts/Geometry/TrackingGeometry.hpp> | ||
| #include <Acts/Geometry/TrackingVolume.hpp> | ||
| #include <Acts/Surfaces/Surface.hpp> | ||
| #include <Acts/Surfaces/SurfaceBounds.hpp> | ||
| #include <Acts/Utilities/Enumerate.hpp> | ||
| #include <Acts/Utilities/Logger.hpp> | ||
| #include <Acts/Visualization/GeometryView3D.hpp> | ||
| #include <Acts/Visualization/ObjVisualization3D.hpp> | ||
| #include <Acts/Visualization/PlyVisualization3D.hpp> | ||
| #include <Acts/Visualization/ViewConfig.hpp> | ||
|
|
||
| #include <ActsPlugins/DD4hep/DD4hepBlueprintFactory.hpp> | ||
| #include <ActsPlugins/DD4hep/DD4hepDetectorStructure.hpp> | ||
| #include <ActsPlugins/DD4hep/DD4hepDetectorSurfaceFactory.hpp> | ||
| #include <ActsPlugins/DD4hep/DD4hepLayerStructure.hpp> | ||
|
|
||
| /** Example loading ACTs. | ||
| * | ||
| * | ||
wdconinc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| */ | ||
| void test_ACTS_gen3(const char* compact = "epic.xml") { | ||
| // ------------------------- | ||
| // Get the DD4hep instance | ||
| // Load the compact XML file | ||
| // Initialize the position converter tool | ||
| auto dd4hep_detector = dd4hep::Detector::make_unique(""); | ||
| dd4hep_detector->fromCompact(compact); | ||
| auto dd4hep_world = dd4hep_detector->world(); | ||
|
|
||
| Acts::GeometryContext trackingGeoCtx; | ||
|
|
||
| ActsPlugins::DD4hepDetectorSurfaceFactory::Config surfaceFactoryConfig; | ||
| auto surfaceFactory = std::make_shared<ActsPlugins::DD4hepDetectorSurfaceFactory>( | ||
| surfaceFactoryConfig, | ||
| Acts::getDefaultLogger("DD4hepDetectorSurfaceFactory", Acts::Logging::VERBOSE)); | ||
| auto layerStructure = std::make_shared<ActsPlugins::DD4hepLayerStructure>( | ||
| std::move(surfaceFactory), | ||
| Acts::getDefaultLogger("DD4hepLayerStructure", Acts::Logging::VERBOSE)); | ||
| ActsPlugins::DD4hepBlueprintFactory::Config blueprintConfig{layerStructure}; | ||
| ActsPlugins::DD4hepBlueprintFactory::Cache blueprintCache; | ||
| ActsPlugins::DD4hepBlueprintFactory blueprint( | ||
| blueprintConfig, Acts::getDefaultLogger("DD4hepBlueprintFactory", Acts::Logging::VERBOSE)); | ||
| auto dd4hepBlueprint = blueprint.create(blueprintCache, trackingGeoCtx, dd4hep_world); | ||
|
|
||
| // Now fill the gaps | ||
| Acts::Experimental::detail::BlueprintHelper::fillGaps(*dd4hepBlueprint); | ||
|
|
||
| // dot -P -Tsvg -o plugins.svg | ||
wdconinc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| std::ofstream cbp("cylindrical_detector_dd4hep.dot"); | ||
wdconinc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Acts::Experimental::detail::BlueprintDrawer::dotStream(cbp, *dd4hepBlueprint); | ||
| cbp.close(); | ||
|
|
||
| // Create a Cylindrical detector builder from this blueprint | ||
| auto detectorBuilder = std::make_shared<Acts::Experimental::CylindricalContainerBuilder>( | ||
| *dd4hepBlueprint, Acts::Logging::VERBOSE); | ||
|
|
||
| // Detector builder | ||
| Acts::Experimental::DetectorBuilder::Config detectorBuilderConfig; | ||
| detectorBuilderConfig.auxiliary = "*** Test : auto generated cylindrical detector builder ***"; | ||
| detectorBuilderConfig.name = "Cylindrical detector from blueprint"; | ||
| detectorBuilderConfig.builder = detectorBuilder; | ||
| detectorBuilderConfig.geoIdGenerator = dd4hepBlueprint->geoIdGenerator; | ||
| auto detector = | ||
| Acts::Experimental::DetectorBuilder(detectorBuilderConfig).construct(trackingGeoCtx); | ||
|
|
||
| // Get the root detector volumes | ||
| for (const auto* volume : detector->rootVolumes()) { | ||
|
|
||
| // Export to obj+mtl | ||
| Acts::ObjVisualization3D objVis; | ||
| Acts::GeometryView3D::drawDetectorVolume(objVis, *volume, trackingGeoCtx); | ||
| // Export to ply | ||
| Acts::PlyVisualization3D plyVis; | ||
| Acts::GeometryView3D::drawDetectorVolume(plyVis, *volume, trackingGeoCtx); | ||
wdconinc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.