Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2b17981
one sensor per chip
maciacco Apr 30, 2026
3b72641
one sensor per chip also in second layer
maciacco Apr 30, 2026
e0f57a7
iotof segmentation and parameters. Segmentation parameters are stolen…
GiorgioAlbertoLucia Apr 30, 2026
c072ae2
compute number of chips in IOTOF
maciacco Apr 30, 2026
876f171
fill L2G transformation matrices
maciacco Apr 30, 2026
6ce0aa3
Merge pull request #4 from GiorgioAlbertoLucia/tf3_digit
maciacco Apr 30, 2026
684490f
fix cmakelist
maciacco Apr 30, 2026
abe83cb
only fill segmentation details if layout is segmented + add function …
maciacco May 1, 2026
ce30af9
use proper chip id for segmented barrel
maciacco May 1, 2026
0038f09
refactoring of segmentation, idependent for inner and outer tof, nons…
GiorgioAlbertoLucia May 4, 2026
728a505
singleton implementation of the segmentation class
GiorgioAlbertoLucia May 6, 2026
5924d18
realistic values fot the chip segmentation
GiorgioAlbertoLucia May 6, 2026
bdbd1b8
hit processing in place, tested on A3Studies/Digitization/testDigitiz…
GiorgioAlbertoLucia May 6, 2026
175f4db
clang format
GiorgioAlbertoLucia May 6, 2026
ea0d674
protect against disks for now
GiorgioAlbertoLucia May 6, 2026
e437ecf
added sanity checks
GiorgioAlbertoLucia May 6, 2026
d4b2789
thickness that matches the values currently in O2
GiorgioAlbertoLucia May 6, 2026
6a4c6c2
default init of chipspecifics to zero
GiorgioAlbertoLucia May 6, 2026
31daa6d
double typo (half the honor)
GiorgioAlbertoLucia May 6, 2026
213c808
Please consider the following formatting changes
alibuild May 6, 2026
f30965d
Merge pull request #1 from alibuild/alibot-cleanup-15372
GiorgioAlbertoLucia May 6, 2026
42c13bf
Fix row and column assignment in detector functions
GiorgioAlbertoLucia May 7, 2026
2a32b97
Change return type in segmentation function
GiorgioAlbertoLucia May 7, 2026
6326fbe
Remove return statement from detectorToLocalUnchecked
GiorgioAlbertoLucia May 7, 2026
adbaeb1
Remove Mat3D alias from GeometryTGeo class
njacazio May 7, 2026
0dc1796
Replace matrix transformation with Transform3D
njacazio May 7, 2026
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
Prev Previous commit
Next Next commit
singleton implementation of the segmentation class
  • Loading branch information
GiorgioAlbertoLucia committed May 6, 2026
commit 728a5052da5730f6c112f4085be232b9110638e4
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define ALICEO2_IOTOF_SEGMENTATION_H

#include <Rtypes.h>
#include <memory>
#include "MathUtils/Cartesian.h"
#include "IOTOFBase/IOTOFBaseParam.h"

Expand All @@ -29,12 +30,16 @@ namespace iotof
/// Questions to solve:
class Segmentation
{
private:
Segmentation();
static std::unique_ptr<o2::iotof::Segmentation> sInstance;

public:

ChipSpecifics iTofSpecsConfig;
ChipSpecifics oTofSpecsConfig;
ChipSpecifics mITofSpecsConfig;
ChipSpecifics mOTofSpecsConfig;
static Segmentation* Instance();

Segmentation();
~Segmentation() = default;

void configChip(const int nCols, const int nRows, const float pitchCol, const float pitchRow, const float passiveEdgeReadOut, const float passiveEdgeTop,
Expand Down Expand Up @@ -71,20 +76,20 @@ class Segmentation
template <typename T = float, typename L = float>
void detectorToLocalUnchecked(L row, L col, T& xRow, T& zCol, const int subDetectorID)
{
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? iTofSpecsConfig : oTofSpecsConfig;
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? mITofSpecsConfig : mOTofSpecsConfig;
xRow = getFirstRowCoordinate(subDetectorID) - row * specsConfig.PitchRow;
zCol = col * specsConfig.PitchCol + getFirstColCoordinate(subDetectorID);
}
template <typename T = float, typename L = float>
void detectorToLocalUnchecked(L row, L col, math_utils::Point3D<T>& loc, const int subDetectorID)
{
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? iTofSpecsConfig : oTofSpecsConfig;
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? mITofSpecsConfig : mOTofSpecsConfig;
loc.SetCoordinates(getFirstRowCoordinate(subDetectorID) - row * specsConfig.PitchRow, T(0.), col * specsConfig.PitchCol + getFirstColCoordinate(subDetectorID));
}
template <typename T = float, typename L = float>
void detectorToLocalUnchecked(L row, L col, std::array<T, 3>& loc, const int subDetectorID)
{
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? iTofSpecsConfig : oTofSpecsConfig;
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? mITofSpecsConfig : mOTofSpecsConfig;
loc[0] = getFirstRowCoordinate(subDetectorID) - row * specsConfig.PitchRow;
loc[1] = T(0);
loc[2] = col * specsConfig.PitchCol + getFirstColCoordinate(subDetectorID);
Expand All @@ -95,7 +100,7 @@ class Segmentation
template <typename T = float, typename L = float>
bool detectorToLocal(L row, L col, T& xRow, T& zCol, const int subDetectorID)
{
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? iTofSpecsConfig : oTofSpecsConfig;
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? mITofSpecsConfig : mOTofSpecsConfig;
if (row < 0 || row >= specsConfig.NRows || col < 0 || col >= specsConfig.NCols) {
return false;
}
Expand All @@ -106,7 +111,7 @@ class Segmentation
template <typename T = float, typename L = float>
bool detectorToLocal(L row, L col, math_utils::Point3D<T>& loc, const int subDetectorID)
{
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? iTofSpecsConfig : oTofSpecsConfig;
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? mITofSpecsConfig : mOTofSpecsConfig;
if (row < 0 || row >= specsConfig.NRows || col < 0 || col >= specsConfig.NCols) {
return false;
}
Expand All @@ -116,7 +121,7 @@ class Segmentation
template <typename T = float, typename L = float>
bool detectorToLocal(L row, L col, std::array<T, 3>& loc, const int subDetectorID)
{
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? iTofSpecsConfig : oTofSpecsConfig;
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? mITofSpecsConfig : mOTofSpecsConfig;
if (row < 0 || row >= specsConfig.NRows || col < 0 || col >= specsConfig.NCols) {
return false;
}
Expand All @@ -126,12 +131,12 @@ class Segmentation

float getFirstRowCoordinate(const int subDetectorID)
{
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? iTofSpecsConfig : oTofSpecsConfig;
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? mITofSpecsConfig : mOTofSpecsConfig;
return 0.5 * ((specsConfig.ActiveMatrixSizeRows() - specsConfig.PassiveEdgeTop + specsConfig.PassiveEdgeReadOut) - specsConfig.PitchRow);
}
float getFirstColCoordinate(const int subDetectorID)
{
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? iTofSpecsConfig : oTofSpecsConfig;
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? mITofSpecsConfig : mOTofSpecsConfig;
return 0.5 * (specsConfig.PitchCol - specsConfig.ActiveMatrixSizeCols());
}

Expand All @@ -144,7 +149,7 @@ class Segmentation
inline void Segmentation::localToDetectorUnchecked(float xRow, float zCol, int& iRow, int& iCol, const int subDetectorID)
{
// convert to row/col w/o over/underflow check
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? iTofSpecsConfig : oTofSpecsConfig;
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? mITofSpecsConfig : mOTofSpecsConfig;
xRow = 0.5 * (specsConfig.ActiveMatrixSizeRows() - specsConfig.PassiveEdgeTop + specsConfig.PassiveEdgeReadOut) - xRow; // coordinate wrt top edge of Active matrix
zCol += 0.5 * specsConfig.ActiveMatrixSizeCols(); // coordinate wrt left edge of Active matrix
iRow = int(xRow / specsConfig.PitchRow);
Expand All @@ -161,7 +166,7 @@ inline void Segmentation::localToDetectorUnchecked(float xRow, float zCol, int&
inline bool Segmentation::localToDetector(float xRow, float zCol, int& iRow, int& iCol, const int subDetectorID)
{
// convert to row/col
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? iTofSpecsConfig : oTofSpecsConfig;
const ChipSpecifics& specsConfig = (subDetectorID == 0) ? mITofSpecsConfig : mOTofSpecsConfig;
xRow = 0.5 * (specsConfig.ActiveMatrixSizeRows() - specsConfig.PassiveEdgeTop + specsConfig.PassiveEdgeReadOut) - xRow; // coordinate wrt top edge of Active matrix
zCol += 0.5 * specsConfig.ActiveMatrixSizeCols(); // coordinate wrt left edge of Active matrix
if (xRow < 0 || xRow >= specsConfig.ActiveMatrixSizeRows() || zCol < 0 || zCol >= specsConfig.ActiveMatrixSizeCols()) {
Expand Down
47 changes: 31 additions & 16 deletions Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Segmentation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,38 @@ namespace o2
namespace iotof
{

std::unique_ptr<o2::iotof::Segmentation> Segmentation::sInstance;

Segmentation* Segmentation::Instance()
{
if (!sInstance) {
sInstance = std::unique_ptr<Segmentation>(new Segmentation());
}
return sInstance.get();
}

Segmentation::Segmentation()
{
auto& iotofPars = IOTOFBaseParam::Instance();
const ChipSpecifics& iTofChipPars = iotofPars.iTofChipSpecifics;
const ChipSpecifics& oTofChipPars = iotofPars.oTofChipSpecifics;

configChip(iTofChipPars, 0 /* subDetectorID for iTOF */);
configChip(oTofChipPars, 1 /* subDetectorID for oTOF */);
if (sInstance) {
printf("Invalid use of public constructor: o2::iotof::Segmentation instance exists\n");
}
else {
auto& iotofPars = IOTOFBaseParam::Instance();
const ChipSpecifics& mITofChipPars = iotofPars.iTofChipSpecifics;
const ChipSpecifics& mOTofChipPars = iotofPars.oTofChipSpecifics;

configChip(mITofChipPars, 0 /* subDetectorID for iTOF */);
configChip(mOTofChipPars, 1 /* subDetectorID for oTOF */);
}
}

void Segmentation::configChip(const int nCols, const int nRows, const float pitchCol, const float pitchRow, const float passiveEdgeReadOut,
const float passiveEdgeTop, const float passiveEdgeSide, const float sensorLayerThicknessEff, const float sensorLayerThickness, const int subDetectorID)
{
if (subDetectorID == 0) {
iTofSpecsConfig = ChipSpecifics(nCols, nRows, pitchCol, pitchRow, passiveEdgeReadOut, passiveEdgeTop, passiveEdgeSide, sensorLayerThicknessEff, sensorLayerThickness);
mITofSpecsConfig = ChipSpecifics(nCols, nRows, pitchCol, pitchRow, passiveEdgeReadOut, passiveEdgeTop, passiveEdgeSide, sensorLayerThicknessEff, sensorLayerThickness);
} else if (subDetectorID == 1) {
oTofSpecsConfig = ChipSpecifics(nCols, nRows, pitchCol, pitchRow, passiveEdgeReadOut, passiveEdgeTop, passiveEdgeSide, sensorLayerThicknessEff, sensorLayerThickness);
mOTofSpecsConfig = ChipSpecifics(nCols, nRows, pitchCol, pitchRow, passiveEdgeReadOut, passiveEdgeTop, passiveEdgeSide, sensorLayerThicknessEff, sensorLayerThickness);
} else {
printf("Invalid subDetectorID %d. Must be 0 (iTOF) or 1 (oTOF). No configuration applied.\n", subDetectorID);
}
Expand All @@ -47,9 +62,9 @@ void Segmentation::configChip(const int nCols, const int nRows, const float pitc
void Segmentation::configChip(const ChipSpecifics& specsConfig, const int subDetectorID)
{
if (subDetectorID == 0) {
iTofSpecsConfig = specsConfig;
mITofSpecsConfig = specsConfig;
} else if (subDetectorID == 1) {
oTofSpecsConfig = specsConfig;
mOTofSpecsConfig = specsConfig;
} else {
printf("Invalid subDetectorID %d. Must be 0 (iTOF) or 1 (oTOF). No configuration applied.\n", subDetectorID);
}
Expand All @@ -59,15 +74,15 @@ void Segmentation::print()
{
// iTOF specs
printf("iTOF specs:\n");
printf("Pixel size: %.2f (along %d rows) %.2f (along %d columns) microns\n", iTofSpecsConfig.PitchRow * 1e4, iTofSpecsConfig.NRows, iTofSpecsConfig.PitchCol * 1e4, iTofSpecsConfig.NCols);
printf("Passive edges: bottom: %.2f, top: %.2f, left/right: %.2f microns\n", iTofSpecsConfig.PassiveEdgeReadOut * 1e4, iTofSpecsConfig.PassiveEdgeTop * 1e4, iTofSpecsConfig.PassiveEdgeSide * 1e4);
printf("Active/Total size: %.6f/%.6f (rows) %.6f/%.6f (cols) cm\n", iTofSpecsConfig.ActiveMatrixSizeRows(), iTofSpecsConfig.SensorSizeRows(), iTofSpecsConfig.ActiveMatrixSizeCols(), iTofSpecsConfig.SensorSizeCols());
printf("Pixel size: %.2f (along %d rows) %.2f (along %d columns) microns\n", mITofSpecsConfig.PitchRow * 1e4, mITofSpecsConfig.NRows, mITofSpecsConfig.PitchCol * 1e4, mITofSpecsConfig.NCols);
printf("Passive edges: bottom: %.2f, top: %.2f, left/right: %.2f microns\n", mITofSpecsConfig.PassiveEdgeReadOut * 1e4, mITofSpecsConfig.PassiveEdgeTop * 1e4, mITofSpecsConfig.PassiveEdgeSide * 1e4);
printf("Active/Total size: %.6f/%.6f (rows) %.6f/%.6f (cols) cm\n", mITofSpecsConfig.ActiveMatrixSizeRows(), mITofSpecsConfig.SensorSizeRows(), mITofSpecsConfig.ActiveMatrixSizeCols(), mITofSpecsConfig.SensorSizeCols());

// oTOF specs
printf("oTOF specs:\n");
printf("Pixel size: %.2f (along %d rows) %.2f (along %d columns) microns\n", oTofSpecsConfig.PitchRow * 1e4, oTofSpecsConfig.NRows, oTofSpecsConfig.PitchCol * 1e4, oTofSpecsConfig.NCols);
printf("Passive edges: bottom: %.2f, top: %.2f, left/right: %.2f microns\n", oTofSpecsConfig.PassiveEdgeReadOut * 1e4, oTofSpecsConfig.PassiveEdgeTop * 1e4, oTofSpecsConfig.PassiveEdgeSide * 1e4);
printf("Active/Total size: %.6f/%.6f (rows) %.6f/%.6f (cols) cm\n", oTofSpecsConfig.ActiveMatrixSizeRows(), oTofSpecsConfig.SensorSizeRows(), oTofSpecsConfig.ActiveMatrixSizeCols(), oTofSpecsConfig.SensorSizeCols());
printf("Pixel size: %.2f (along %d rows) %.2f (along %d columns) microns\n", mOTofSpecsConfig.PitchRow * 1e4, mOTofSpecsConfig.NRows, mOTofSpecsConfig.PitchCol * 1e4, mOTofSpecsConfig.NCols);
printf("Passive edges: bottom: %.2f, top: %.2f, left/right: %.2f microns\n", mOTofSpecsConfig.PassiveEdgeReadOut * 1e4, mOTofSpecsConfig.PassiveEdgeTop * 1e4, mOTofSpecsConfig.PassiveEdgeSide * 1e4);
printf("Active/Total size: %.6f/%.6f (rows) %.6f/%.6f (cols) cm\n", mOTofSpecsConfig.ActiveMatrixSizeRows(), mOTofSpecsConfig.SensorSizeRows(), mOTofSpecsConfig.ActiveMatrixSizeCols(), mOTofSpecsConfig.SensorSizeCols());
}

} // namespace iotof
Expand Down