Skip to content

Commit

Permalink
feat: Mockup builder class with a cpp script for test (#2008)
Browse files Browse the repository at this point in the history
This PR creates the mockup  geometry with the chambers from a gdml file and extends the sector with the three chambers at phi.  The picture `barrel_chambers000.png` shows the geometry in an obj file obtained by running the `TestMockupBuilder.cpp` script, which is also in the PR in order to reproduce the geometry.

There is also some work in progress (e.g. python bindings)

@noemina  @asalzburger 

Co-authored-by: Andreas Stefl <487211+andiwand@users.noreply.github.com>
  • Loading branch information
dimitra97 and andiwand committed Apr 12, 2023
1 parent 65807a1 commit 98f27de
Show file tree
Hide file tree
Showing 11 changed files with 8,733 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Examples/Detectors/Geant4Detector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_library(
ActsExamplesDetectorGeant4 SHARED
src/Geant4Detector.cpp)
src/Geant4Detector.cpp
src/MockupSectorBuilder.cpp)
target_include_directories(
ActsExamplesDetectorGeant4
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
Expand All @@ -11,4 +12,4 @@ target_link_libraries(
install(
TARGETS ActsExamplesDetectorGeant4
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})


Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// This file is part of the Acts project.
//
// Copyright (C) 2022-2023 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 "Acts/Detector/DetectorVolume.hpp"
#include "Acts/Geometry/GeometryContext.hpp"

#include <iostream>
#include <string>
#include <vector>

#include "G4VPhysicalVolume.hh"

namespace ActsExamples {

///@class MockupsectorBuilder
///
/// This is a class that builds a chamber by reading a gdml file

class MockupSectorBuilder {
public:
/// Nested configuration struct
struct Config {
// The path of the gdml file that holds the mockup geometry
std::string gdmlPath = "";

// The number of sectors we want to create
int NumberOfSectors = 1;

float toleranceOverlap = 10.;
};

/// Nested configuration struct for chamber
struct ChamberConfig {
// The name of the chamber
std::string name;

// The names of the sensitive surfaces
std::vector<std::string> SensitiveNames;

// The names of the passive surfaces
std::vector<std::string> PassiveNames;
};

/// Constructor
///@param config The configuration struct
MockupSectorBuilder(const Config& config);

/// Destructor
~MockupSectorBuilder() = default;

/// Build chamber
/// @param gctx The current geometry context object
/// @param chamber_config The configuration chamber struct
std::shared_ptr<Acts::Experimental::DetectorVolume> buildChamber(
const ChamberConfig& chamberConfig);

/// Build Sector
/// @param det_volumes The vector that contains the detector volumes of the Sector
/// @param gctx The current geometry context object
std::shared_ptr<Acts::Experimental::DetectorVolume> buildSector(
std::vector<std::shared_ptr<Acts::Experimental::DetectorVolume>>
detVolumes);

/// Draw the sector in an obj file
/// @param nameObjFile The name of the obj file where the sector will be saved
void drawSector(const std::shared_ptr<Acts::Experimental::DetectorVolume>&
detectorVolumeSector,
const std::string& nameObjFile);

private:
Config mCfg;

G4VPhysicalVolume* g4World = nullptr;

int maxNumberOfSectors = 8;
};

} // namespace ActsExamples

0 comments on commit 98f27de

Please sign in to comment.