Skip to content

Commit

Permalink
refactor: Mockup builder files location (#2029)
Browse files Browse the repository at this point in the history
This PR locates the files that hold the class for the construction of the muon spectrometer mock up into another folder.
  • Loading branch information
dimitra97 committed Apr 17, 2023
1 parent a5d5d35 commit da77587
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 13 deletions.
2 changes: 2 additions & 0 deletions Examples/Detectors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ add_subdirectory_if(Geant4Detector ACTS_BUILD_EXAMPLES_GEANT4)
add_subdirectory(MagneticField)
add_subdirectory(TGeoDetector)
add_subdirectory(TelescopeDetector)
add_subdirectory_if(MuonSpectrometerMockupDetector ACTS_BUILD_EXAMPLES_GEANT4)

2 changes: 1 addition & 1 deletion Examples/Detectors/Geant4Detector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
add_library(
ActsExamplesDetectorGeant4 SHARED
src/Geant4Detector.cpp
src/MockupSectorBuilder.cpp)
)
target_include_directories(
ActsExamplesDetectorGeant4
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
Expand Down
14 changes: 14 additions & 0 deletions Examples/Detectors/MuonSpectrometerMockupDetector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
add_library(
ActsExamplesMuonSpectrometerMockupDetector SHARED
src/MockupSectorBuilder.cpp)
target_include_directories(
ActsExamplesMuonSpectrometerMockupDetector
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_link_libraries(
ActsExamplesMuonSpectrometerMockupDetector
PUBLIC ActsCore ActsExamplesFramework ActsExamplesGeant4 ActsExamplesDetectorGeant4 ActsPluginGeant4)

install(
TARGETS ActsExamplesMuonSpectrometerMockupDetector
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// 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/.

#include "ActsExamples/Geant4Detector/MockupSectorBuilder.hpp"
#include "ActsExamples/MuonSpectrometerMockupDetector/MockupSectorBuilder.hpp"

#include "Acts/Detector/DetectorVolume.hpp"
#include "Acts/Detector/PortalGenerators.hpp"
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ if(ACTS_BUILD_EXAMPLES_GEANT4)
pybind11_add_module(ActsPythonBindingsGeant4 src/Geant4Component.cpp)
target_link_libraries(ActsPythonBindingsGeant4 PUBLIC
ActsExamplesGeant4 ActsExamplesDetectorGeant4
ActsPythonUtilities)
ActsPythonUtilities ActsExamplesMuonSpectrometerMockupDetector)
add_dependencies(ActsPythonBindings ActsPythonBindingsGeant4)

install(TARGETS ActsPythonBindingsGeant4 DESTINATION ${_python_install_dir})
Expand Down
12 changes: 6 additions & 6 deletions Examples/Python/python/acts/examples/mockupbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
mockupChamberConfigOuter.SensitiveNames = ["Outer_Skin"]
mockupChamberConfigOuter.PassiveNames = ["xx"]

mockupConfig.gdmlPath = "/home/dimitra/ACTS_Dimitra/acts/Examples/Python/python/acts/examples/MuonChamber.gdml"
mockupConfig.gdmlPath = (
"../../../../Detectors/MuonSpectrometerMockupDetector/MuonChamber.gdml"
)
mockupConfig.NumberOfSectors = 8

mockupBuilder = actsG4.MockupSectorBuilder(mockupConfig)
print("hello")

detectorVolumeInner = mockupBuilder.buildChamber(mockupChamberConfigInner)
print("inner built")

detectorVolumeOuter = mockupBuilder.buildChamber(mockupChamberConfigOuter)
print("outer built")

detectorVolumeMiddle = mockupBuilder.buildChamber(mockupChamberConfigMiddle)
print("middle built")
print("hello")

detectorVolumes = [detectorVolumeInner, detectorVolumeMiddle, detectorVolumeOuter]

Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/src/Geant4Component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "ActsExamples/Geant4/SensitiveSurfaceMapper.hpp"
#include "ActsExamples/Geant4/SimParticleTranslation.hpp"
#include "ActsExamples/Geant4Detector/Geant4Detector.hpp"
#include "ActsExamples/Geant4Detector/MockupSectorBuilder.hpp"
#include "ActsExamples/MuonSpectrometerMockupDetector/MockupSectorBuilder.hpp"
#include "ActsExamples/TelescopeDetector/TelescopeG4DetectorConstruction.hpp"

#include <memory>
Expand Down
1 change: 1 addition & 0 deletions Examples/Run/Geant4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ target_link_libraries(
ActsExamplesIoRoot
ActsPluginGeant4
ActsExamplesDetectorGeant4
ActsExamplesMuonSpectrometerMockupDetector
)

install(
Expand Down
39 changes: 36 additions & 3 deletions Examples/Run/Geant4/TestMockupBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,49 @@
// 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/.

#include "Acts/Detector/Detector.hpp"
#include "Acts/Detector/DetectorVolume.hpp"
#include "Acts/Detector/Portal.hpp"
#include "Acts/Detector/PortalHelper.hpp"
#include "Acts/MagneticField/ConstantBField.hpp"
#include "Acts/MagneticField/MagneticFieldContext.hpp"
#include "Acts/Navigation/DetectorVolumeFinders.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Navigation/NextNavigator.hpp"
#include "Acts/Navigation/SurfaceCandidatesUpdators.hpp"
#include "Acts/Propagator/AbortList.hpp"
#include "Acts/Propagator/EigenStepper.hpp"
#include "Acts/Propagator/Propagator.hpp"
#include "Acts/Propagator/SurfaceCollector.hpp"
#include "Acts/Visualization/GeometryView3D.hpp"
#include "Acts/Visualization/IVisualization3D.hpp"
#include "Acts/Visualization/ObjVisualization3D.hpp"
#include "ActsExamples/Geant4Detector/Geant4Detector.hpp"
#include "ActsExamples/Geant4Detector/MockupSectorBuilder.hpp"
#include "ActsExamples/MuonSpectrometerMockupDetector/MockupSectorBuilder.hpp"

#include <memory>

using namespace Acts;
using namespace ActsExamples;

struct StrawSelector {
/// Call operator
/// @param sf The input surface to be checked
bool operator()(const Surface& sf) const {
return (sf.type() == Surface::Straw);
}
};

int main() {
auto mockup_config = MockupSectorBuilder::Config();

auto mockup_chamberConfig_inner = MockupSectorBuilder::ChamberConfig();
auto mockup_chamberConfig_middle = MockupSectorBuilder::ChamberConfig();
auto mockup_chamberConfig_outer = MockupSectorBuilder::ChamberConfig();

mockup_config.gdmlPath = "./MuonChamber.gdml";
mockup_config.gdmlPath =
" ../../../../acts/Examples/Detectors/MuonSpectrometerMockupDetector/"
"MuonChamber.gdml";
mockup_config.NumberOfSectors = 8;

mockup_chamberConfig_inner.name = "Inner_Detector_Chamber";
Expand Down Expand Up @@ -51,11 +78,17 @@ int main() {
std::vector<std::shared_ptr<Acts::Experimental::DetectorVolume>>
detector_volumes = {};

detector_volumes.push_back(detectorVolume_middle_chamber);
detector_volumes.push_back(detectorVolume_inner_chamber);
detector_volumes.push_back(detectorVolume_middle_chamber);
detector_volumes.push_back(detectorVolume_outer_chamber);

auto detectorVolume_sector = mockup_builder.buildSector(detector_volumes);

mockup_builder.drawSector(detectorVolume_sector, "sector_test.obj");

auto detector_sector = Acts::Experimental::Detector::makeShared(
"Detector",
std::vector<std::shared_ptr<Acts::Experimental::DetectorVolume>>(
{detectorVolume_sector}),
Acts::Experimental::tryAllVolumes());
}

0 comments on commit da77587

Please sign in to comment.