15#ifndef ALICEO2_TRK_SEGMENTATIONCHIP_H_
16#define ALICEO2_TRK_SEGMENTATIONCHIP_H_
19#include <fairlogger/Logger.h>
60 static constexpr float PitchColVD{constants::VD::petal::layer::pitchZ};
61 static constexpr float PitchRowVD{constants::VD::petal::layer::pitchX};
73 static constexpr std::array<double, constants::VD::petal::nLayers>
radiiVD = constants::VD::petal::layer::radii;
80 LOGP(fatal,
"SegmentationChip: VD number of petals not set. GeometryTGeo::Build() must be called before using the VD segmentation");
83 return 2 * M_PI * constants::VD::petal::layer::radii[
layer];
85 return constants::VD::petal::layer::radii[
layer] * 2 * M_PI /
sNPetalsVD - constants::VD::petal::layer::gaps[
layer];
103 static bool localToDetector(
float xRow,
float zCol,
int& iRow,
int& iCol,
int subDetID,
int layer,
int disk)
noexcept
106 LOGP(
debug,
"Local coordinates not valid: row = {} cm, col = {} cm", xRow, zCol);
111 LOG(
debug) <<
"Result from localToDetectorUnchecked: xRow " << xRow <<
" -> iRow " << iRow <<
", zCol " << zCol <<
" -> iCol " << iCol <<
" on subDetID, layer, disk: " << subDetID <<
" " <<
layer <<
" " << disk;
115 LOGP(
debug,
"Detector coordinates not valid: iRow = {}, iCol = {}", iRow, iCol);
124 float pitchRow(0), pitchCol(0);
125 float maxWidth(0), maxLength(0);
131 maxLength = constants::VD::petal::layer::length;
133 }
else if (subDetID == 1 || subDetID == 2) {
140 iRow =
static_cast<int>(std::floor((maxWidth / 2 - xRow) / pitchRow));
141 iCol =
static_cast<int>(std::floor((zCol + maxLength / 2) / pitchCol));
147 float maxWidth(0), maxLength(0);
150 maxLength = constants::VD::petal::layer::length;
152 }
else if (subDetID == 1 || subDetID == 2) {
156 return (-maxWidth / 2 <
x &&
x < maxWidth / 2 && -maxLength / 2 <
z &&
z < maxLength / 2);
163 int nRows(0), nCols(0);
166 nCols = constants::VD::petal::layer::nCols;
168 }
else if (subDetID == 1 || subDetID == 2) {
172 return (
row >= 0 && row < nRows && col >= 0 &&
col < nCols);
188 static bool detectorToLocal(
int iRow,
int iCol,
float& xRow,
float& zCol,
int subDetID,
int layer,
int disk)
noexcept
191 LOGP(
debug,
"Detector coordinates not valid: iRow = {}, iCol = {}", iRow, iCol);
195 LOG(
debug) <<
"Result from detectorToLocalUnchecked: iRow " << iRow <<
" -> xRow " << xRow <<
", iCol " << iCol <<
" -> zCol " << zCol <<
" on subDetID, layer, disk: " << subDetID <<
" " <<
layer <<
" " << disk;
198 LOGP(
debug,
"Local coordinates not valid: row = {} cm, col = {} cm", xRow, zCol);
213 }
else if (subDetID == 1 || subDetID == 2) {
231 static math_utils::Vector2D<float>
curvedToFlat(
const int layer,
const float xCurved,
const float yCurved)
noexcept
234 float dist = std::hypot(xCurved, yCurved);
235 float phi = std::atan2(yCurved, xCurved);
239 float xFlat = constants::VD::petal::layer::radii[
layer] * phi;
240 float yFlat = constants::VD::petal::layer::radii[
layer] - dist;
241 return math_utils::Vector2D<float>(xFlat, yFlat);
253 static constexpr math_utils::Vector2D<float>
flatToCurved(
int layer,
float xFlat,
float yFlat)
noexcept
256 float dist = constants::VD::petal::layer::radii[
layer] - yFlat;
257 float phi = xFlat / constants::VD::petal::layer::radii[
layer];
260 float xCurved = dist * std::cos(phi);
261 float yCurved = dist * std::sin(phi);
262 return math_utils::Vector2D<float>(xCurved, yCurved);
273 LOG(info) <<
"Number of cols:\nVD: " << constants::VD::petal::layer::nCols
static void localToDetectorUnchecked(float xRow, float zCol, int &iRow, int &iCol, int subDetID, int layer, int disk) noexcept
same but w/o check for row/column range
static constexpr math_utils::Vector2D< float > flatToCurved(int layer, float xFlat, float yFlat) noexcept
static constexpr float SiliconThicknessVD
static constexpr float SensorLayerThicknessOT
constexpr SegmentationChip()=default
static void detectorToLocalUnchecked(int row, int col, float &xRow, float &zCol, int subDetID, int layer, int disk) noexcept
constexpr SegmentationChip(SegmentationChip &&)=delete
~SegmentationChip()=default
static constexpr float SensorLayerThicknessML
static constexpr float SensorLayerThicknessVD
static bool isValidLoc(float x, float z, int subDetID, int layer) noexcept
static constexpr float PitchColVD
constexpr SegmentationChip & operator=(SegmentationChip &&)=delete
static bool localToDetector(float xRow, float zCol, int &iRow, int &iCol, int subDetID, int layer, int disk) noexcept
static constexpr float PitchColMLOT
static constexpr float PitchRowMLOT
static bool isValidDet(int row, int col, int subDetID, int layer) noexcept
static constexpr std::array< double, constants::VD::petal::nLayers > radiiVD
static float getWidthVD(int layer)
static void Print() noexcept
Print segmentation info.
static constexpr float PitchRowVD
constexpr SegmentationChip & operator=(const SegmentationChip &)=default
static void setNumberOfPetalsVD(int n)
static bool detectorToLocal(int iRow, int iCol, float &xRow, float &zCol, int subDetID, int layer, int disk) noexcept
constexpr SegmentationChip(const SegmentationChip &)=default
static constexpr float SiliconThicknessMLOT
static int getNRowsVD(int layer)
static math_utils::Vector2D< float > curvedToFlat(const int layer, const float xCurved, const float yCurved) noexcept
GLenum GLuint GLint GLint layer
GLdouble GLdouble GLdouble z
constexpr double thickness
constexpr double totalThickness
constexpr double thickness
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"