Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AlpideRespSimMat
static int constexpr getNPix() { return NPix; }

AlpideRespSimMat() = default;
~AlpideRespSimMat() = default;
virtual ~AlpideRespSimMat() = default;

void adopt(const AlpideRespSimMat& src, bool flipRow = false, bool flipCol = false)
{
Expand Down Expand Up @@ -69,7 +69,7 @@ class AlpideRespSimMat
private:
std::array<float, MatSize> data;

ClassDefNV(AlpideRespSimMat, 1);
ClassDef(AlpideRespSimMat, 1);
};

/*
Expand All @@ -91,6 +91,7 @@ class AlpideSimResponse
int getDepthBin(float pos) const;
std::string composeDataName(int colBin, int rowBin);

protected:
int mNBinCol = 0; /// number of bins in X(col direction)
int mNBinRow = 0; /// number of bins in Y(row direction)
int mNBinDpt = 0; /// number of bins in Z(sensor dept)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
/// \file SegmentationMosaix.h
/// \brief Definition of the SegmentationMosaix class
/// \author felix.schlepper@cern.ch
/// \author chunzheng.wang@cern.ch

#ifndef ALICEO2_ITS3_SEGMENTATIONMOSAIX_H_
#define ALICEO2_ITS3_SEGMENTATIONMOSAIX_H_

#include <type_traits>

#include "MathUtils/Cartesian.h"
#include "ITS3Base/SpecsV2.h"

Expand All @@ -43,24 +42,22 @@ class SegmentationMosaix
// 3. The detector coordinate system. Defined by the row and column segmentation
// defined at the upper edge in the flat coord.

// row,col=0
// |
// v
// x----------------------x
// | | |
// | | |
// | | | ^ x
// | | | |
// | | | |
// | | | |
// |-----------X----------| X marks (x,z)=(0,0) X----> z
// | | |
// O----------------------|
// | | |
// | | | ^ x
// | | | |
// | | | |
// | | | |
// | | | X----> z X marks (x,z)=(0,0)
// |-----------X----------|
// | | | O----> col O marks (row,col)=(0,0)
// | | | |
// | | | |
// | | | v
// | | | row
// | | |
// | | |
// | | |
// | | |
// x----------------------x
// |----------------------|

public:
constexpr SegmentationMosaix(int layer) : mRadius(static_cast<float>(constants::radiiMiddle[layer])) {}
constexpr ~SegmentationMosaix() = default;
Expand All @@ -79,7 +76,6 @@ class SegmentationMosaix
static constexpr float PitchCol{constants::pixelarray::pixels::mosaix::pitchZ};
static constexpr float PitchRow{constants::pixelarray::pixels::mosaix::pitchX};
static constexpr float SensorLayerThickness{constants::totalThickness};
static constexpr float NominalYShift{constants::nominalYShift};

/// Transformation from the curved surface to a flat surface.
/// Additionally a shift in the flat coordinates must be applied because
Expand All @@ -102,10 +98,10 @@ class SegmentationMosaix
// stack
float dist = std::hypot(xCurved, yCurved);
float phi = std::atan2(yCurved, xCurved);
xFlat = (mRadius * phi) - WidthH;
// the y position is in the silicon volume however we need the chip volume (silicon+metalstack)
// this is accounted by a y shift
yFlat = dist - mRadius + NominalYShift;
xFlat = WidthH - mRadius * phi;
yFlat = dist - mRadius;
}

/// Transformation from the flat surface to a curved surface
Expand All @@ -122,11 +118,12 @@ class SegmentationMosaix
{
// MUST align the flat surface with the curved surface with the original pixel array is on and account for metal
// stack
float dist = yFlat + mRadius;
float phi = (WidthH - xFlat) / mRadius;
// the y position is in the chip volume however we need the silicon volume
// this is accounted by a -y shift
float dist = yFlat - NominalYShift + mRadius;
xCurved = dist * std::cos((xFlat + WidthH) / mRadius);
yCurved = dist * std::sin((xFlat + WidthH) / mRadius);
xCurved = dist * std::cos(phi);
yCurved = dist * std::sin(phi);
}

/// Transformation from Geant detector centered local coordinates (cm) to
Expand All @@ -142,8 +139,11 @@ class SegmentationMosaix
/// \param int iCol Detector z cell coordinate.
constexpr bool localToDetector(float const xRow, float const zCol, int& iRow, int& iCol) const noexcept
{
if (!isValidLoc(xRow, zCol)) {
return false;
}
localToDetectorUnchecked(xRow, zCol, iRow, iCol);
if (!isValid(iRow, iCol)) {
if (!isValidDet(iRow, iCol)) {
iRow = iCol = -1;
return false;
}
Expand All @@ -167,49 +167,54 @@ class SegmentationMosaix
/// center of the sensitive volume.
/// If iRow and or iCol is outside of the segmentation range a value of -0.5*Dx()
/// or -0.5*Dz() is returned.
constexpr bool detectorToLocal(int const iRow, int const iCol, float& xRow, float& zCol) const noexcept
bool detectorToLocal(float const row, float const col, float& xRow, float& zCol) const noexcept
{
if (!isValid(iRow, iCol)) {
if (!isValidDet(row, col)) {
return false;
}
detectorToLocalUnchecked(iRow, iCol, xRow, zCol);
return isValid(xRow, zCol);
detectorToLocalUnchecked(row, col, xRow, zCol);
return isValidLoc(xRow, zCol);
}

// Same as detectorToLocal w.o. checks.
// We position ourself in the middle of the pixel.
constexpr void detectorToLocalUnchecked(int const iRow, int const iCol, float& xRow, float& zCol) const noexcept
void detectorToLocalUnchecked(float const row, float const col, float& xRow, float& zCol) const noexcept
{
xRow = -(static_cast<float>(iRow) + 0.5f) * PitchRow + WidthH;
zCol = (static_cast<float>(iCol) + 0.5f) * PitchCol - LengthH;
xRow = -(row + 0.5f) * PitchRow + WidthH;
zCol = (col + 0.5f) * PitchCol - LengthH;
}

bool detectorToLocal(int const row, int const col, math_utils::Point3D<float>& loc) const noexcept
bool detectorToLocal(float const row, float const col, math_utils::Point3D<float>& loc) const noexcept
{
float xRow{0.}, zCol{0.};
if (!detectorToLocal(row, col, xRow, zCol)) {
return false;
}
loc.SetCoordinates(xRow, NominalYShift, zCol);
loc.SetCoordinates(xRow, 0.0f, zCol);
return true;
}

void detectorToLocalUnchecked(int const row, int const col, math_utils::Point3D<float>& loc) const noexcept
void detectorToLocalUnchecked(float const row, float const col, math_utils::Point3D<float>& loc) const noexcept
{
float xRow{0.}, zCol{0.};
detectorToLocalUnchecked(row, col, xRow, zCol);
loc.SetCoordinates(xRow, NominalYShift, zCol);
loc.SetCoordinates(xRow, 0.0f, zCol);
}

private:
// Check local coordinates (cm) validity.
template <typename T>
[[nodiscard]] constexpr bool isValid(T const row, T const col) const noexcept
constexpr bool isValidLoc(T const x, T const z) const noexcept
{
if constexpr (std::is_floating_point_v<T>) { // compares in local coord.
return (-WidthH < row && row < WidthH && -LengthH < col && col < LengthH);
} else { // compares in rows/cols
return !static_cast<bool>(row < 0 || row >= static_cast<int>(NRows) || col < 0 || col >= static_cast<int>(NCols));
}
return (-WidthH < x && x < WidthH && -LengthH < z && z < LengthH);
}

// Check detector coordinates validity.
template <typename T>
constexpr bool isValidDet(T const row, T const col) const noexcept
{
return (row >= 0 && row < static_cast<T>(NRows) &&
col >= 0 && col < static_cast<T>(NCols));
}

float mRadius;
Expand Down
1 change: 0 additions & 1 deletion Detectors/Upgrades/ITS3/base/include/ITS3Base/SpecsV2.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ constexpr std::array<double, nLayers> radii{19.0006 * mm, 25.228 * mm, 31.4554 *
constexpr std::array<double, nLayers> radiiInner{radii[0] - silicon::thicknessIn, radii[1] - silicon::thicknessIn, radii[2] - silicon::thicknessIn}; // inner silicon radius
constexpr std::array<double, nLayers> radiiOuter{radii[0] + silicon::thicknessOut, radii[1] + silicon::thicknessOut, radii[2] + silicon::thicknessOut}; // outer silicon radius
constexpr std::array<double, nLayers> radiiMiddle{(radiiInner[0] + radiiOuter[0]) / 2., (radiiInner[1] + radiiOuter[1]) / 2., (radiiInner[2] + radiiOuter[2]) / 2.}; // middle silicon radius
constexpr double nominalYShift{-metalstack::thickness / 2.}; // shift to position in silicion volume to the chip volume (silicon+metalstack)

// extra information of pixels and their response functions
namespace pixelarray::pixels
Expand Down
3 changes: 3 additions & 0 deletions Detectors/Upgrades/ITS3/macros/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ its3_add_macro(CompareClusterSize.C)
its3_add_macro(CheckMosaixSegment.C)
its3_add_macro(CheckMosaixSegmentTrans.C)
its3_add_macro(CompareClustersAndDigits.C)
its3_add_macro(CompareClustersAndDigitsOnChip.C)
its3_add_macro(CheckROFs.C)
its3_add_macro(CheckTileNumbering.C)
its3_add_macro(CreateITS3StaticDeadMap.C)
its3_add_macro(TestSensorGeometry.C)
its3_add_macro(CorrTracksClusters.C)
its3_add_macro(CheckChipResponseFile.C)
Loading