Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ project(
LANGUAGES CXX
)

# Set C++20 standard
set(CMAKE_CXX_STANDARD 20)
# C++23: required by Phlex
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down
14 changes: 8 additions & 6 deletions subsystems/Calorimeter/include/Calorimeter/CaloBarLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include <string>
#include <string_view>

class GeoVPhysVol;
class GeoLogVol;
Expand All @@ -20,11 +21,12 @@ enum class BarAxis { AlongX, AlongY };
* centre-to-centre, centred on the mother origin in the transverse plane,
* and all placed at @p zCenter_mm along Z (local coordinates).
*/
class CaloBarLayer {
public:
static void place(GeoVPhysVol* mother, GeoLogVol* barLog, double pitch_mm, int nBars,
double zCenter_mm, const char* tagPrefix, int layerIndex, BarAxis axis,
const std::string& nameSuffix = "");
};
namespace CaloBar {

void placeLayer(GeoVPhysVol* mother, GeoLogVol* barLog, double pitch_mm, int nBars,
double zCenter_mm, std::string_view tagPrefix, int layerIndex, BarAxis axis,
const std::string& nameSuffix = "");

} // namespace CaloBar

} // namespace SHiPGeometry
15 changes: 8 additions & 7 deletions subsystems/Calorimeter/include/Calorimeter/CaloFibreHPLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ namespace SHiPGeometry {
* cylindrical fibres (cladding + core). Fibres run along Y when
* @p fibresAlongY is true, along X otherwise.
*/
class CaloFibreHPLayer {
public:
static void build(GeoVPhysVol* mother, GeoMaterial* aluminiumMat, GeoMaterial* fibreMat,
const std::string& layerTag, double zCenter_mm, int layerIndex,
double casingXY_mm, double casingZ_mm, double fiberDiam_mm,
double fiberCoreDiam_mm, bool fibresAlongY, const std::string& nameSuffix);
};
namespace CaloFibreHP {

void buildLayer(GeoVPhysVol* mother, GeoMaterial* aluminiumMat, GeoMaterial* fibreMat,
const std::string& layerTag, double zCenter_mm, int layerIndex, double casingXY_mm,
double casingZ_mm, double fiberDiam_mm, double fiberCoreDiam_mm, bool fibresAlongY,
const std::string& nameSuffix);

} // namespace CaloFibreHP

} // namespace SHiPGeometry
12 changes: 12 additions & 0 deletions subsystems/Calorimeter/include/Calorimeter/CalorimeterConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@

namespace SHiPGeometry {

/// Layer type codes used in the ECAL/HCAL layer sequences.
enum class LayerCode : int {
WidePVT_H = 1, ///< Wide PVT bar layer, bars along X (H orientation)
WidePVT_V = 2, ///< Wide PVT bar layer, bars along Y (V orientation)
ThinPS_H = 3, ///< Thin PS bar layer, bars along X (H orientation)
ThinPS_V = 4, ///< Thin PS bar layer, bars along Y (V orientation)
FibreHPL_Y = 5, ///< HPL fibre layer, fibres along Y
FibreHPL_X = 6, ///< HPL fibre layer, fibres along X
Absorber = 7, ///< Absorber plate (Lead in ECAL, Iron in HCAL)
AirGap = 8, ///< Air gap (no volume, just advances z cursor)
};

/**
* @brief Configuration for the SHiP calorimeter geometry.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CalorimeterFactory {
std::string m_configPath;

/** Place one NX×NY tiled stack of layers inside @p container. */
void buildStack(GeoPhysVol* container, const CalorimeterConfig& cfg, int mx, int my,
void buildStack(GeoPhysVol* container, const CalorimeterConfig& cfg, int moduleX, int moduleY,
double offsetX, double offsetY) const;

// ── Fixed container dimensions (mm) ─────────────────────────────────
Expand Down
18 changes: 9 additions & 9 deletions subsystems/Calorimeter/src/CaloBarLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@
#include <GeoModelKernel/GeoTransform.h>
#include <GeoModelKernel/Units.h>

#include <format>
#include <string>

namespace SHiPGeometry {

using namespace GeoModelKernelUnits;

void CaloBarLayer::place(GeoVPhysVol* mother, GeoLogVol* barLog, double pitch_mm, int nBars,
double zCenter_mm, const char* tagPrefix, int layerIndex, BarAxis axis,
const std::string& nameSuffix) {
void CaloBar::placeLayer(GeoVPhysVol* mother, GeoLogVol* barLog, double pitch_mm, int nBars,
double zCenter_mm, std::string_view tagPrefix, int layerIndex,
BarAxis axis, const std::string& nameSuffix) {
const double pitch = pitch_mm * mm;
const double s0 = -0.5 * (nBars - 1) * pitch;
const double firstBarCenter = -0.5 * (nBars - 1) * pitch;

for (int i = 0; i < nBars; ++i) {
const double s = s0 + i * pitch;
const double barCenter = firstBarCenter + i * pitch;

double x = 0.0, y = 0.0;
if (axis == BarAxis::AlongX)
x = s;
x = barCenter;
else
y = s;
y = barCenter;

const std::string name = std::string(tagPrefix) + "_L" + std::to_string(layerIndex) + "_B" +
std::to_string(i) + nameSuffix;
const auto name = std::format("{}_L{}_B{}{}", tagPrefix, layerIndex, i, nameSuffix);

auto* barPhys = new GeoPhysVol(barLog);
mother->add(new GeoNameTag(name.c_str()));
Expand Down
26 changes: 13 additions & 13 deletions subsystems/Calorimeter/src/CaloFibreHPLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@

#include <algorithm>
#include <cmath>
#include <format>
#include <stdexcept>
#include <string>

namespace SHiPGeometry {

using namespace GeoModelKernelUnits;

void CaloFibreHPLayer::build(GeoVPhysVol* mother, GeoMaterial* aluminiumMat, GeoMaterial* fibreMat,
void CaloFibreHP::buildLayer(GeoVPhysVol* mother, GeoMaterial* aluminiumMat, GeoMaterial* fibreMat,
const std::string& layerTag, double zCenter_mm, int layerIndex,
double casingXY_mm, double casingZ_mm, double fiberDiam_mm,
double fiberCoreDiam_mm, bool fibresAlongY,
Expand All @@ -43,7 +44,7 @@ void CaloFibreHPLayer::build(GeoVPhysVol* mother, GeoMaterial* aluminiumMat, Geo

if (rCore <= 0.0 || rCore > rOuter)
throw std::runtime_error(
"CaloFibreHPLayer: invalid core diameter "
"CaloFibreHP::buildLayer: invalid core diameter "
"(must be >0 and <= outer diameter)");

// GeoTube axis is Z; rotate so fibres run along Y or X
Expand All @@ -70,25 +71,24 @@ void CaloFibreHPLayer::build(GeoVPhysVol* mother, GeoMaterial* aluminiumMat, Geo

const std::string orient = fibresAlongY ? "V_L" : "H_L";

for (int s = 0; s < 3; ++s) {
for (int sublayer = 0; sublayer < 3; ++sublayer) {
for (int i = 0; i < nFib; ++i) {
const double pack = x0 + i * pitch + dx[s];
const double zl = zLocal[s];
const double fibrePosition = x0 + i * pitch + dx[sublayer];
const double sublayerZ = zLocal[sublayer];

const std::string baseName = layerTag + "_HPL_" + orient + std::to_string(layerIndex) +
"_S" + std::to_string(s) + "_F" + std::to_string(i) +
nameSuffix;
const auto baseName = std::format("{}_HPL_{}{}_S{}_F{}{}", layerTag, orient, layerIndex,
sublayer, i, nameSuffix);

// cladding physical volume; core is a child of it
auto* cladPhys = new GeoPhysVol(cladLog);
cladPhys->add(new GeoNameTag((baseName + "_Core").c_str()));
cladPhys->add(new GeoNameTag(std::format("{}_Core", baseName).c_str()));
cladPhys->add(new GeoPhysVol(coreLog));

const double xPos = fibresAlongY ? pack : 0.0;
const double yPos = fibresAlongY ? 0.0 : pack;
const double xPos = fibresAlongY ? fibrePosition : 0.0;
const double yPos = fibresAlongY ? 0.0 : fibrePosition;

casingPhys->add(new GeoNameTag((baseName + "_Clad").c_str()));
casingPhys->add(new GeoTransform(GeoTrf::Translate3D(xPos, yPos, zl) * rotAxis));
casingPhys->add(new GeoNameTag(std::format("{}_Clad", baseName).c_str()));
casingPhys->add(new GeoTransform(GeoTrf::Translate3D(xPos, yPos, sublayerZ) * rotAxis));
casingPhys->add(cladPhys);
}
}
Expand Down
Loading