Skip to content

Commit ef4cb87

Browse files
committed
ITS3: make segmentation class header only
Signed-off-by: Felix Schlepper <[email protected]>
1 parent 0c43893 commit ef4cb87

File tree

8 files changed

+38
-64
lines changed

8 files changed

+38
-64
lines changed

Detectors/Upgrades/ITS3/base/CMakeLists.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
# granted to it by virtue of its status as an Intergovernmental Organization
1010
# or submit itself to any jurisdiction.
1111

12-
o2_add_library(ITS3Base
13-
SOURCES src/SegmentationSuperAlpide.cxx
14-
src/ITS3Params.cxx
15-
PUBLIC_LINK_LIBRARIES O2::CommonConstants O2::MathUtils O2::DetectorsBase)
12+
o2_add_library(
13+
ITS3Base
14+
SOURCES src/ITS3Params.cxx
15+
PUBLIC_LINK_LIBRARIES O2::CommonConstants O2::MathUtils O2::DetectorsBase)
1616

17-
o2_target_root_dictionary(ITS3Base
18-
HEADERS include/ITS3Base/SegmentationSuperAlpide.h
19-
include/ITS3Base/ITS3Params.h)
17+
o2_target_root_dictionary(ITS3Base HEADERS include/ITS3Base/ITS3Params.h)

Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ class SegmentationSuperAlpide
5353
// | | |
5454
// x----------------------x
5555
public:
56-
virtual ~SegmentationSuperAlpide() = default;
56+
~SegmentationSuperAlpide() = default;
5757
SegmentationSuperAlpide(const SegmentationSuperAlpide&) = default;
5858
SegmentationSuperAlpide(SegmentationSuperAlpide&&) = delete;
59-
SegmentationSuperAlpide& operator=(const SegmentationSuperAlpide&) = delete;
59+
SegmentationSuperAlpide& operator=(const SegmentationSuperAlpide&) = default;
6060
SegmentationSuperAlpide& operator=(SegmentationSuperAlpide&&) = delete;
6161
constexpr SegmentationSuperAlpide(int layer) : mLayer{layer} {}
6262

@@ -85,9 +85,8 @@ class SegmentationSuperAlpide
8585
{
8686
// MUST align the flat surface with the curved surface with the original pixel array is on
8787
float dist = std::hypot(xCurved, yCurved);
88-
float phiReadout = constants::tile::readout::width / constants::radii[mLayer];
8988
float phi = std::atan2(yCurved, xCurved);
90-
xFlat = mRadii[mLayer] * (phi - phiReadout) - constants::pixelarray::width / 2.;
89+
xFlat = (mRadii[mLayer] * phi) - constants::pixelarray::width / 2.;
9190
yFlat = dist - mRadii[mLayer];
9291
}
9392

@@ -105,9 +104,8 @@ class SegmentationSuperAlpide
105104
{
106105
// MUST align the flat surface with the curved surface with the original pixel array is on
107106
float dist = yFlat + mRadii[mLayer];
108-
float phiReadout = constants::tile::readout::width / mRadii[mLayer];
109-
xCurved = dist * std::cos(phiReadout + (xFlat + constants::pixelarray::width / 2.) / mRadii[mLayer]);
110-
yCurved = dist * std::sin(phiReadout + (xFlat + constants::pixelarray::width / 2.) / mRadii[mLayer]);
107+
xCurved = dist * std::cos((xFlat + constants::pixelarray::width / 2.) / mRadii[mLayer]);
108+
yCurved = dist * std::sin((xFlat + constants::pixelarray::width / 2.) / mRadii[mLayer]);
111109
}
112110

113111
/// Transformation from Geant detector centered local coordinates (cm) to
@@ -196,13 +194,9 @@ class SegmentationSuperAlpide
196194
}
197195
}
198196

199-
const int mLayer{0}; ///< chip layer
200-
201-
ClassDef(SegmentationSuperAlpide, 1);
197+
int mLayer{0}; ///< chip layer
202198
};
203199

204-
/// Segmentation array
205-
extern const std::array<SegmentationSuperAlpide, constants::nLayers> SuperSegmentations;
206200
} // namespace o2::its3
207201

208202
#endif

Detectors/Upgrades/ITS3/base/src/ITS3BaseLinkDef.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#pragma link off all classes;
1616
#pragma link off all functions;
1717

18-
#pragma link C++ class o2::its3::SegmentationSuperAlpide + ;
1918
#pragma link C++ class o2::its3::ITS3Params + ;
2019
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::its3::ITS3Params> + ;
2120

Detectors/Upgrades/ITS3/base/src/SegmentationSuperAlpide.cxx

Lines changed: 0 additions & 20 deletions
This file was deleted.

Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/TopologyDictionary.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "DataFormatsITSMFT/TopologyDictionary.h"
1919
#include "DataFormatsITSMFT/ClusterPattern.h"
20+
#include "ITS3Base/SegmentationSuperAlpide.h"
2021

2122
namespace o2::its3
2223
{
@@ -125,7 +126,7 @@ class TopologyDictionary
125126

126127
/// Returns the local position of a compact cluster
127128
template <typename T = float>
128-
static math_utils::Point3D<T> getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup = true);
129+
math_utils::Point3D<T> getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup = true) const;
129130

130131
static TopologyDictionary* loadFrom(const std::string& fileName = "", const std::string& objName = "ccdb_object");
131132

@@ -134,10 +135,11 @@ class TopologyDictionary
134135

135136
private:
136137
static constexpr int STopoSize{8 * 255 + 1};
137-
std::unordered_map<unsigned long, int> mCommonMap{}; ///< Map of pair <hash, position in mVectorOfIDs>
138-
std::unordered_map<int, int> mGroupMap{}; ///< Map of pair <groudID, position in mVectorOfIDs>
139-
int mSmallTopologiesLUT[STopoSize]{}; ///< Look-Up Table for the topologies with 1-byte linearised matrix
140-
std::vector<itsmft::GroupStruct> mVectorOfIDs{}; ///< Vector of topologies and groups
138+
std::unordered_map<unsigned long, int> mCommonMap{}; ///< Map of pair <hash, position in mVectorOfIDs>
139+
std::unordered_map<int, int> mGroupMap{}; ///< Map of pair <groudID, position in mVectorOfIDs>
140+
int mSmallTopologiesLUT[STopoSize]{}; ///< Look-Up Table for the topologies with 1-byte linearised matrix
141+
std::vector<itsmft::GroupStruct> mVectorOfIDs{}; ///< Vector of topologies and groups
142+
std::array<o2::its3::SegmentationSuperAlpide, 3> mSuperSegmentations{0, 1, 2}; ///< Segmentations for IB layers
141143

142144
ClassDefNV(TopologyDictionary, 3);
143145
};

Detectors/Upgrades/ITS3/reconstruction/src/TopologyDictionary.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,18 @@ math_utils::Point3D<T> TopologyDictionary::getClusterCoordinates(const itsmft::C
143143
locCl.SetZ(locCl.Z() + this->getZCOG(cl.getPatternID()) * itsmft::SegmentationAlpide::PitchCol);
144144
} else {
145145
auto layer = its3::constants::detID::getDetID2Layer(cl.getSensorID());
146-
its3::SuperSegmentations[layer].detectorToLocalUnchecked(cl.getRow(), cl.getCol(), locCl);
146+
mSuperSegmentations[layer].detectorToLocalUnchecked(cl.getRow(), cl.getCol(), locCl);
147147
locCl.SetX(locCl.X() + this->getXCOG(cl.getPatternID()) * its3::SegmentationSuperAlpide::mPitchRow);
148148
locCl.SetZ(locCl.Z() + this->getZCOG(cl.getPatternID()) * its3::SegmentationSuperAlpide::mPitchCol);
149149
float xCurved{0.f}, yCurved{0.f};
150-
its3::SuperSegmentations[layer].flatToCurved(locCl.X(), locCl.Y(), xCurved, yCurved);
150+
mSuperSegmentations[layer].flatToCurved(locCl.X(), locCl.Y(), xCurved, yCurved);
151151
locCl.SetXYZ(xCurved, yCurved, locCl.Z());
152152
}
153153
return locCl;
154154
}
155155

156156
template <typename T>
157-
math_utils::Point3D<T> TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup)
157+
math_utils::Point3D<T> TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup) const
158158
{
159159
auto refRow = cl.getRow();
160160
auto refCol = cl.getCol();
@@ -169,9 +169,9 @@ math_utils::Point3D<T> TopologyDictionary::getClusterCoordinates(const itsmft::C
169169
o2::itsmft::SegmentationAlpide::detectorToLocalUnchecked(refRow + xCOG, refCol + zCOG, locCl);
170170
} else {
171171
auto layer = its3::constants::detID::getDetID2Layer(cl.getSensorID());
172-
its3::SuperSegmentations[layer].detectorToLocalUnchecked(refRow + xCOG, refCol + zCOG, locCl);
172+
mSuperSegmentations[layer].detectorToLocalUnchecked(refRow + xCOG, refCol + zCOG, locCl);
173173
float xCurved{0.f}, yCurved{0.f};
174-
its3::SuperSegmentations[layer].flatToCurved(locCl.X(), locCl.Y(), xCurved, yCurved);
174+
mSuperSegmentations[layer].flatToCurved(locCl.X(), locCl.Y(), xCurved, yCurved);
175175
locCl.SetXYZ(xCurved, yCurved, locCl.Z());
176176
}
177177
return locCl;
@@ -194,6 +194,6 @@ TopologyDictionary* TopologyDictionary::loadFrom(const std::string& fname, const
194194

195195
// Explicitly instaniate templates
196196
template math_utils::Point3D<float> TopologyDictionary::getClusterCoordinates<float>(const itsmft::CompClusterExt& cl) const;
197-
template math_utils::Point3D<float> TopologyDictionary::getClusterCoordinates<float>(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup);
197+
template math_utils::Point3D<float> TopologyDictionary::getClusterCoordinates<float>(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup) const;
198198

199199
} // namespace o2::its3

Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/Digitizer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ class Digitizer : public TObject
108108
uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
109109
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)
110110

111+
const std::array<o2::its3::SegmentationSuperAlpide, 3> mSuperSegmentations{0, 1, 2};
112+
111113
o2::itsmft::AlpideSimResponse* mAlpSimResp = nullptr; // simulated response
112114

113115
const o2::its::GeometryTGeo* mGeometry = nullptr; ///< ITS3 geometry

Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
using o2::itsmft::Hit;
2828
using Segmentation = o2::itsmft::SegmentationAlpide;
29-
using SuperSegmentation = o2::its3::SegmentationSuperAlpide;
3029
using o2::itsmft::AlpideRespSimMat;
3130
using o2::itsmft::PreDigit;
3231

@@ -143,7 +142,7 @@ void Digitizer::fillOutputContainer(uint32_t frameLast)
143142
for (size_t iChip{0}; iChip < mChips.size(); ++iChip) {
144143
auto& chip = mChips[iChip];
145144
if (constants::detID::isDetITS3(iChip)) { // Check if this is a chip of ITS3
146-
chip.addNoise(mROFrameMin, mROFrameMin, &mParams, SuperSegmentation::mNRows, SuperSegmentation::mNCols);
145+
chip.addNoise(mROFrameMin, mROFrameMin, &mParams, SegmentationSuperAlpide::mNRows, SegmentationSuperAlpide::mNCols);
147146
} else {
148147
chip.addNoise(mROFrameMin, mROFrameMin, &mParams);
149148
}
@@ -238,8 +237,8 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
238237
if (innerBarrel) {
239238
// transform the point on the curved surface to a flat one
240239
float xFlatE{0.f}, yFlatE{0.f}, xFlatS{0.f}, yFlatS{0.f};
241-
SuperSegmentations[layer].curvedToFlat(xyzLocS.X(), xyzLocS.Y(), xFlatS, yFlatS);
242-
SuperSegmentations[layer].curvedToFlat(xyzLocE.X(), xyzLocE.Y(), xFlatE, yFlatE);
240+
mSuperSegmentations[layer].curvedToFlat(xyzLocS.X(), xyzLocS.Y(), xFlatS, yFlatS);
241+
mSuperSegmentations[layer].curvedToFlat(xyzLocE.X(), xyzLocE.Y(), xFlatE, yFlatE);
243242
// update the local coordinates with the flattened ones
244243
xyzLocS.SetXYZ(xFlatS, yFlatS, xyzLocS.Z());
245244
xyzLocE.SetXYZ(xFlatE, yFlatE, xyzLocE.Z());
@@ -255,14 +254,14 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
255254
int rowS = -1, colS = -1, rowE = -1, colE = -1, nSkip = 0;
256255
if (innerBarrel) {
257256
// get entrance pixel row and col
258-
while (!SuperSegmentations[layer].localToDetector(xyzLocS.X(), xyzLocS.Z(), rowS, colS)) { // guard-ring ?
257+
while (!mSuperSegmentations[layer].localToDetector(xyzLocS.X(), xyzLocS.Z(), rowS, colS)) { // guard-ring ?
259258
if (++nSkip >= nSteps) {
260259
return; // did not enter to sensitive matrix
261260
}
262261
xyzLocS += step;
263262
}
264263
// get exit pixel row and col
265-
while (!SuperSegmentations[layer].localToDetector(xyzLocE.X(), xyzLocE.Z(), rowE, colE)) { // guard-ring ?
264+
while (!mSuperSegmentations[layer].localToDetector(xyzLocE.X(), xyzLocE.Z(), rowE, colE)) { // guard-ring ?
266265
if (++nSkip >= nSteps) {
267266
return; // did not enter to sensitive matrix
268267
}
@@ -298,8 +297,8 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
298297
rowS = 0;
299298
}
300299

301-
int maxNrows{innerBarrel ? SuperSegmentation::mNRows : Segmentation::NRows};
302-
int maxNcols{innerBarrel ? SuperSegmentation::mNCols : Segmentation::NCols};
300+
int maxNrows{innerBarrel ? SegmentationSuperAlpide::mNRows : Segmentation::NRows};
301+
int maxNcols{innerBarrel ? SegmentationSuperAlpide::mNCols : Segmentation::NCols};
303302
if (rowE >= maxNrows) {
304303
rowE = maxNrows - 1;
305304
}
@@ -327,19 +326,19 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
327326
// take into account that the AlpideSimResponse depth defintion has different min/max boundaries
328327
// although the max should coincide with the surface of the epitaxial layer, which in the chip
329328
// local coordinates has Y = +SensorLayerThickness/2
330-
float thickness = innerBarrel ? SuperSegmentation::mSensorLayerThickness : Segmentation::SensorLayerThickness;
329+
float thickness = innerBarrel ? SegmentationSuperAlpide::mSensorLayerThickness : Segmentation::SensorLayerThickness;
331330
xyzLocS.SetY(xyzLocS.Y() + mAlpSimResp->getDepthMax() - thickness / 2.);
332331
// collect charge in evey pixel which might be affected by the hit
333332
for (int iStep = nSteps; iStep--;) {
334333
// Get the pixel ID
335334
if (innerBarrel) {
336-
SuperSegmentations[layer].localToDetector(xyzLocS.X(), xyzLocS.Z(), row, col);
335+
mSuperSegmentations[layer].localToDetector(xyzLocS.X(), xyzLocS.Z(), row, col);
337336
} else {
338337
Segmentation::localToDetector(xyzLocS.X(), xyzLocS.Z(), row, col);
339338
}
340339
if (row != rowPrev || col != colPrev) { // update pixel and coordinates of its center
341340
if (innerBarrel) {
342-
if (!SuperSegmentations[layer].detectorToLocal(row, col, cRowPix, cColPix)) {
341+
if (!mSuperSegmentations[layer].detectorToLocal(row, col, cRowPix, cColPix)) {
343342
continue;
344343
}
345344
} else if (!Segmentation::detectorToLocal(row, col, cRowPix, cColPix)) {
@@ -350,8 +349,8 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
350349
}
351350
bool flipCol = false, flipRow = false;
352351
// note that response needs coordinates along column row (locX) (locZ) then depth (locY)
353-
double rowMax{0.5f * (innerBarrel ? SuperSegmentation::mPitchRow : Segmentation::PitchRow)};
354-
double colMax{0.5f * (innerBarrel ? SuperSegmentation::mPitchCol : Segmentation::PitchCol)};
352+
double rowMax{0.5f * (innerBarrel ? SegmentationSuperAlpide::mPitchRow : Segmentation::PitchRow)};
353+
double colMax{0.5f * (innerBarrel ? SegmentationSuperAlpide::mPitchCol : Segmentation::PitchCol)};
355354
auto rspmat = mAlpSimResp->getResponse(xyzLocS.X() - cRowPix, xyzLocS.Z() - cColPix, xyzLocS.Y(), flipRow, flipCol, rowMax, colMax);
356355

357356
xyzLocS += step;

0 commit comments

Comments
 (0)