Skip to content

Commit 893a2ae

Browse files
committed
avoid duplicatiion of chip parameters
1 parent afb1b93 commit 893a2ae

3 files changed

Lines changed: 13 additions & 27 deletions

File tree

Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/Segmentation.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class Segmentation
3535
static std::unique_ptr<o2::iotof::Segmentation> sInstance;
3636

3737
public:
38-
ChipSpecifics mIOTOFSpecsConfig;
3938
static Segmentation* Instance();
4039

4140
~Segmentation() = default;
@@ -74,7 +73,7 @@ class Segmentation
7473
row = col = -1;
7574
return;
7675
}
77-
const ChipSpecifics& specsConfig = mIOTOFSpecsConfig;
76+
const auto& specsConfig = ChipSpecificsParam::Instance();
7877
xRow = getFirstRowCoordinate(subDetectorID) - row * specsConfig.PitchRow;
7978
zCol = col * specsConfig.PitchCol + getFirstColCoordinate(subDetectorID);
8079
}
@@ -85,7 +84,7 @@ class Segmentation
8584
row = col = -1;
8685
return;
8786
}
88-
const ChipSpecifics& specsConfig = mIOTOFSpecsConfig;
87+
const auto& specsConfig = ChipSpecificsParam::Instance();
8988
loc.SetCoordinates(getFirstRowCoordinate(subDetectorID) - row * specsConfig.PitchRow, T(0.), col * specsConfig.PitchCol + getFirstColCoordinate(subDetectorID));
9089
}
9190
template <typename T = float, typename L = float>
@@ -95,7 +94,7 @@ class Segmentation
9594
row = col = -1;
9695
return;
9796
}
98-
const ChipSpecifics& specsConfig = mIOTOFSpecsConfig;
97+
const auto& specsConfig = ChipSpecificsParam::Instance();
9998
loc[0] = getFirstRowCoordinate(subDetectorID) - row * specsConfig.PitchRow;
10099
loc[1] = T(0);
101100
loc[2] = col * specsConfig.PitchCol + getFirstColCoordinate(subDetectorID);
@@ -110,7 +109,7 @@ class Segmentation
110109
row = col = -1;
111110
return false;
112111
}
113-
const ChipSpecifics& specsConfig = mIOTOFSpecsConfig;
112+
const auto& specsConfig = ChipSpecificsParam::Instance();
114113
if (row < 0 || row >= specsConfig.NRows || col < 0 || col >= specsConfig.NCols) {
115114
return false;
116115
}
@@ -125,7 +124,7 @@ class Segmentation
125124
row = col = -1;
126125
return false;
127126
}
128-
const ChipSpecifics& specsConfig = mIOTOFSpecsConfig;
127+
const auto& specsConfig = ChipSpecificsParam::Instance();
129128
if (row < 0 || row >= specsConfig.NRows || col < 0 || col >= specsConfig.NCols) {
130129
return false;
131130
}
@@ -139,7 +138,7 @@ class Segmentation
139138
row = col = -1;
140139
return false;
141140
}
142-
const ChipSpecifics& specsConfig = mIOTOFSpecsConfig;
141+
const auto& specsConfig = ChipSpecificsParam::Instance();
143142
if (row < 0 || row >= specsConfig.NRows || col < 0 || col >= specsConfig.NCols) {
144143
return false;
145144
}
@@ -149,17 +148,15 @@ class Segmentation
149148

150149
float getFirstRowCoordinate(const int subDetectorID)
151150
{
152-
const ChipSpecifics& specsConfig = mIOTOFSpecsConfig;
151+
const auto& specsConfig = ChipSpecificsParam::Instance();
153152
return 0.5 * ((specsConfig.ActiveMatrixSizeRows() - specsConfig.PassiveEdgeTop + specsConfig.PassiveEdgeReadOut) - specsConfig.PitchRow);
154153
}
155154
float getFirstColCoordinate(const int subDetectorID)
156155
{
157-
const ChipSpecifics& specsConfig = mIOTOFSpecsConfig;
156+
const auto& specsConfig = ChipSpecificsParam::Instance();
158157
return 0.5 * (specsConfig.PitchCol - specsConfig.ActiveMatrixSizeCols());
159158
}
160159

161-
void print();
162-
163160
ClassDefNV(Segmentation, 1); // Segmentation class upgrade pixels
164161
};
165162

@@ -171,7 +168,7 @@ inline void Segmentation::localToDetectorUnchecked(float xRow, float zCol, int&
171168
iRow = iCol = -1;
172169
return;
173170
}
174-
const ChipSpecifics& specsConfig = mIOTOFSpecsConfig;
171+
const auto& specsConfig = ChipSpecificsParam::Instance();
175172
xRow = 0.5 * (specsConfig.ActiveMatrixSizeRows() - specsConfig.PassiveEdgeTop + specsConfig.PassiveEdgeReadOut) - xRow; // coordinate wrt top edge of Active matrix
176173
zCol += 0.5 * specsConfig.ActiveMatrixSizeCols(); // coordinate wrt left edge of Active matrix
177174
iRow = int(xRow / specsConfig.PitchRow);
@@ -197,7 +194,7 @@ inline bool Segmentation::localToDetector(float xRow, float zCol, int& iRow, int
197194
iRow = iCol = -1;
198195
return false;
199196
}
200-
const ChipSpecifics& specsConfig = mIOTOFSpecsConfig;
197+
const auto& specsConfig = ChipSpecificsParam::Instance();
201198
xRow = 0.5 * (specsConfig.ActiveMatrixSizeRows() - specsConfig.PassiveEdgeTop + specsConfig.PassiveEdgeReadOut) - xRow; // coordinate wrt top edge of Active matrix
202199
zCol += 0.5 * specsConfig.ActiveMatrixSizeCols(); // coordinate wrt left edge of Active matrix
203200
if (xRow < 0 || xRow >= specsConfig.ActiveMatrixSizeRows() || zCol < 0 || zCol >= specsConfig.ActiveMatrixSizeCols()) {

Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ void Digitizer::stepping(const o2::itsmft::Hit& hit, float**& respMatrix, int& r
210210
rowStart = std::max(rowStart, 0);
211211
colStart = std::max(colStart, 0);
212212

213-
rowEnd = std::min(rowEnd, (sSegmentation->mIOTOFSpecsConfig.NRows) - 1);
214-
colEnd = std::min(colEnd, (sSegmentation->mIOTOFSpecsConfig.NCols) - 1);
213+
const auto& specsConfig = ChipSpecificsParam::Instance();
214+
rowEnd = std::min(rowEnd, (specsConfig.NRows) - 1);
215+
colEnd = std::min(colEnd, (specsConfig.NCols) - 1);
215216
rowSpan = rowEnd - rowStart + 1;
216217
colSpan = colEnd - colStart + 1;
217218

Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Segmentation.cxx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,9 @@ Segmentation::Segmentation()
3636
{
3737
if (sInstance) {
3838
printf("Invalid use of public constructor: o2::iotof::Segmentation instance exists\n");
39-
} else {
40-
auto& iotofChipPars = ChipSpecificsParam::Instance();
41-
mIOTOFSpecsConfig = ChipSpecifics(iotofChipPars.NCols, iotofChipPars.NRows, iotofChipPars.PitchCol, iotofChipPars.PitchRow, iotofChipPars.PassiveEdgeReadOut, iotofChipPars.PassiveEdgeTop, iotofChipPars.PassiveEdgeSide, iotofChipPars.PixelPassiveEdgeX, iotofChipPars.PixelPassiveEdgeZ, iotofChipPars.SensorLayerThicknessEff, iotofChipPars.SensorLayerThickness);
4239
}
4340
}
4441

45-
void Segmentation::print()
46-
{
47-
// IOTOF specs
48-
printf("IOTOF specs:\n");
49-
printf("Pixel size: %.2f (along %d rows) %.2f (along %d columns) microns\n", mIOTOFSpecsConfig.PitchRow * 1e4, mIOTOFSpecsConfig.NRows, mIOTOFSpecsConfig.PitchCol * 1e4, mIOTOFSpecsConfig.NCols);
50-
printf("Passive edges: bottom: %.2f, top: %.2f, left/right: %.2f microns\n", mIOTOFSpecsConfig.PassiveEdgeReadOut * 1e4, mIOTOFSpecsConfig.PassiveEdgeTop * 1e4, mIOTOFSpecsConfig.PassiveEdgeSide * 1e4);
51-
printf("Active/Total size: %.6f/%.6f (rows) %.6f/%.6f (cols) cm\n", mIOTOFSpecsConfig.ActiveMatrixSizeRows(), mIOTOFSpecsConfig.SensorSizeRows(), mIOTOFSpecsConfig.ActiveMatrixSizeCols(), mIOTOFSpecsConfig.SensorSizeCols());
52-
}
53-
5442
} // namespace iotof
5543
} // namespace o2
5644

0 commit comments

Comments
 (0)