Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TestMockupBuilder.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TestMockupBuilder.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022-2023 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
11 #include "Acts/Detector/Portal.hpp"
27 
28 #include <memory>
29 
30 using namespace Acts;
31 using namespace ActsExamples;
32 
33 struct StrawSelector {
36  bool operator()(const Surface& sf) const {
37  return (sf.type() == Surface::Straw);
38  }
39 };
40 
41 int main() {
42  auto mockup_config = MockupSectorBuilder::Config();
43 
44  auto mockup_chamberConfig_inner = MockupSectorBuilder::ChamberConfig();
45  auto mockup_chamberConfig_middle = MockupSectorBuilder::ChamberConfig();
46  auto mockup_chamberConfig_outer = MockupSectorBuilder::ChamberConfig();
47 
48  mockup_config.gdmlPath =
49  " ../../../../acts/Examples/Detectors/MuonSpectrometerMockupDetector/"
50  "MuonChamber.gdml";
51  mockup_config.NumberOfSectors = 8;
52 
53  mockup_chamberConfig_inner.name = "Inner_Detector_Chamber";
54  mockup_chamberConfig_inner.SensitiveNames = {"Inner_Skin"};
55  mockup_chamberConfig_inner.PassiveNames = {"xx"};
56 
57  mockup_chamberConfig_middle.name = "Middle_Detector_Chamber";
58  mockup_chamberConfig_middle.SensitiveNames = {"Middle_Skin"};
59  mockup_chamberConfig_middle.PassiveNames = {"xx"};
60 
61  mockup_chamberConfig_outer.name = "Outer_Detector_Chamber";
62  mockup_chamberConfig_outer.SensitiveNames = {"Outer_Skin"};
63  mockup_chamberConfig_outer.PassiveNames = {"xx"};
64 
65  MockupSectorBuilder mockup_builder(mockup_config);
66 
68  auto detectorVolume_inner_chamber =
69  mockup_builder.buildChamber(mockup_chamberConfig_inner);
70 
71  auto detectorVolume_middle_chamber =
72  mockup_builder.buildChamber(mockup_chamberConfig_middle);
73 
74  auto detectorVolume_outer_chamber =
75  mockup_builder.buildChamber(mockup_chamberConfig_outer);
76 
77  std::vector<std::shared_ptr<Acts::Experimental::DetectorVolume>>
78  detector_volumes = {detectorVolume_inner_chamber,
79  detectorVolume_middle_chamber,
80  detectorVolume_outer_chamber};
81 
82  auto detectorVolume_sector = mockup_builder.buildSector(detector_volumes);
83 
84  mockup_builder.drawSector(detectorVolume_sector, "sector_test.obj");
85 
86  auto detector_sector = Acts::Experimental::Detector::makeShared(
87  "Detector", {detectorVolume_sector},
89 }