@@ -28,15 +28,17 @@ namespace o2::trk
2828// / This is a work-in-progress code derived from the ITS2 and ITS3 segmentations.
2929class SegmentationChip
3030{
31- // This class defines the segmenation of the TRK chips in the ALICE3 upgrade. We define
32- // two coordinate systems, one width x,z detector local coordianates (cm) and
33- // the more natural row,col layout: Also all the transformation between these
34- // two. The class provides the transformation from the stave/layer/disk to TGeo
35- // coordinates.
31+ // This class defines the segmenation of the TRK chips in the ALICE3 upgrade.
32+ // The "global coordinate system" refers to the hit position in cm in the global coordinate system centered in 0,0,0
33+ // The "local coordinate system" refers to the hit position in cm in the coordinate system of the sensor, which
34+ // is centered in 0,0,0 in the case of curved layers, and in the middle of the chip in the case of flat layers
35+ // The "detector coordinate system" refers to the hit position in row,col inside the sensor
36+ // This class provides the transformations from the local and detector coordinate systems
37+ // The conversion between global and local coordinate systems is operated by the transformation matrices
3638 // For the curved VD layers there exist three coordinate systems and one is transient.
3739 // 1. The global (curved) coordinate system. The chip's center of coordinate system is
3840 // defined at the the mid-point of the detector.
39- // 2. The flat coordinate system. This is the tube segment projected onto a flat
41+ // 2. The local ( flat) coordinate system. This is the tube segment projected onto a flat
4042 // surface. In the projection we implicitly assume that the inner and outer
4143 // stretch does not depend on the radius.
4244 // 3. The detector coordinate system. Defined by the row and column segmentation
@@ -58,17 +60,15 @@ class SegmentationChip
5860 static constexpr float PitchColVD{constants::VD::petal::layer::pitchZ};
5961 static constexpr float PitchRowVD{constants::VD::petal::layer::pitchX};
6062
61- static constexpr float PitchColML{constants::moduleMLOT::chip::pitchZ};
62- static constexpr float PitchRowML{constants::moduleMLOT::chip::pitchX};
63-
64- static constexpr float PitchColOT{constants::moduleMLOT::chip::pitchZ};
65- static constexpr float PitchRowOT{constants::moduleMLOT::chip::pitchX};
63+ static constexpr float PitchColMLOT{constants::moduleMLOT::chip::pitchZ};
64+ static constexpr float PitchRowMLOT{constants::moduleMLOT::chip::pitchX};
6665
6766 static constexpr float SensorLayerThicknessVD = {constants::VD::petal::layer::totalThickness}; // physical thickness of sensitive part = 30 um
6867 static constexpr float SensorLayerThicknessML = {constants::moduleMLOT::chip::totalThickness}; // physical thickness of sensitive part = 100 um
6968 static constexpr float SensorLayerThicknessOT = {constants::moduleMLOT::chip::totalThickness}; // physical thickness of sensitive part = 100 um
7069
71- static constexpr float SiliconTickness = constants::silicon::thickness; // effective thickness of sensitive part
70+ static constexpr float SiliconThicknessVD = constants::VD::silicon::thickness; // effective thickness of sensitive part
71+ static constexpr float SiliconThicknessMLOT = constants::moduleMLOT::silicon::thickness; // effective thickness of sensitive part
7272
7373 static constexpr std::array<double , constants::VD::petal::nLayers> radiiVD = constants::VD::petal::layer::radii;
7474
@@ -86,24 +86,25 @@ class SegmentationChip
8686 // / \param int subDetID Sub-detector ID (0 for VD, 1 for ML/OT)
8787 // / \param int layer Layer number (0 to 2 for VD, 0 to 7 for ML/OT)
8888 // / \param int disk Disk number (0 to 5 for VD)
89- static bool globalToDetector (float xRow, float zCol, int & iRow, int & iCol, int subDetID, int layer, int disk) noexcept
89+ static bool localToDetector (float xRow, float zCol, int & iRow, int & iCol, int subDetID, int layer, int disk) noexcept
9090 {
9191 if (!isValidGlob (xRow, zCol, subDetID, layer)) {
92- LOGP (info , " Global coordinates not valid: row = {} cm, col = {} cm" , xRow, zCol);
92+ LOGP (debug , " Local coordinates not valid: row = {} cm, col = {} cm" , xRow, zCol);
9393 return false ;
9494 }
95+ localToDetectorUnchecked (xRow, zCol, iRow, iCol, subDetID, layer, disk);
9596
96- globalToDetectorUnchecked ( xRow, zCol, iRow, iCol, subDetID, layer, disk) ;
97+ LOG (debug) << " Result from localToDetectorUnchecked: xRow " << xRow << " -> iRow " << iRow << " , zCol " << zCol << " -> iCol " << iCol << " on subDetID, layer, disk: " << subDetID << " " << layer << " " << disk ;
9798
9899 if (!isValidDet (iRow, iCol, subDetID, layer)) {
99100 iRow = iCol = -1 ;
100- LOGP (info , " Detector coordinates not valid: iRow = {}, iCol = {}" , iRow, iCol);
101+ LOGP (debug , " Detector coordinates not valid: iRow = {}, iCol = {}" , iRow, iCol);
101102 return false ;
102103 }
103104 return true ;
104105 };
105106 // / same but w/o check for row/column range
106- static void globalToDetectorUnchecked (float xRow, float zCol, int & iRow, int & iCol, int subDetID, int layer, int disk) noexcept
107+ static void localToDetectorUnchecked (float xRow, float zCol, int & iRow, int & iCol, int subDetID, int layer, int disk) noexcept
107108 {
108109 // convert to row/col w/o over/underflow check
109110 float pitchRow (0 ), pitchCol (0 );
@@ -116,13 +117,13 @@ class SegmentationChip
116117 maxLength = constants::VD::petal::layer::length;
117118 // TODO: change this to use the layer and disk
118119 } else if (subDetID == 1 && layer <= 3 ) { // ML
119- pitchRow = PitchRowML ;
120- pitchCol = PitchColML ;
120+ pitchRow = PitchRowMLOT ;
121+ pitchCol = PitchColMLOT ;
121122 maxWidth = constants::ML::width;
122123 maxLength = constants::ML::length;
123124 } else if (subDetID == 1 && layer >= 4 ) { // OT
124- pitchRow = PitchRowOT ;
125- pitchCol = PitchColOT ;
125+ pitchRow = PitchRowMLOT ;
126+ pitchCol = PitchColMLOT ;
126127 maxWidth = constants::OT::width;
127128 maxLength = constants::OT::length;
128129 }
@@ -131,7 +132,7 @@ class SegmentationChip
131132 iCol = static_cast <int >(std::floor ((zCol + maxLength / 2 ) / pitchCol));
132133 };
133134
134- // Check global coordinates (cm) validity.
135+ // Check local coordinates (cm) validity.
135136 static constexpr bool isValidGlob (float x, float z, int subDetID, int layer) noexcept
136137 {
137138 float maxWidth (0 ), maxLength (0 );
@@ -165,8 +166,7 @@ class SegmentationChip
165166 nRows = constants::OT::nRows;
166167 nCols = constants::OT::nCols;
167168 }
168- return (row >= 0 && row < static_cast <float >(nRows) &&
169- col >= 0 && col < static_cast <float >(nCols));
169+ return (row >= 0 && row < static_cast <float >(nRows) && col >= 0 && col < static_cast <float >(nCols));
170170 }
171171
172172 // / Transformation from Detector cell coordinates to Geant detector centered
@@ -182,34 +182,37 @@ class SegmentationChip
182182 // / \param int subDetID Sub-detector ID (0 for VD, 1 for ML/OT)
183183 // / \param int layer Layer number (0 to 2 for VD, 0 to 7 for ML/OT)
184184 // / \param int disk Disk number (0 to 5 for VD)
185- static constexpr bool detectorToGlobal (int iRow, int iCol, float & xRow, float & zCol, int subDetID, int layer, int disk) noexcept
185+ static constexpr bool detectorToLocal (int iRow, int iCol, float & xRow, float & zCol, int subDetID, int layer, int disk) noexcept
186186 {
187- if (!isValidDet (xRow, zCol , subDetID, layer)) {
187+ if (!isValidDet (iRow, iCol , subDetID, layer)) {
188188 LOGP (debug, " Detector coordinates not valid: iRow = {}, iCol = {}" , iRow, iCol);
189189 return false ;
190190 }
191- detectorToGlobalUnchecked (iRow, iCol, xRow, zCol, subDetID, layer, disk);
191+ detectorToLocalUnchecked (iRow, iCol, xRow, zCol, subDetID, layer, disk);
192+ LOG (debug) << " Result from detectorToLocalUnchecked: iRow " << iRow << " -> xRow " << xRow << " , iCol " << iCol << " -> zCol " << zCol << " on subDetID, layer, disk: " << subDetID << " " << layer << " " << disk;
192193
193194 if (!isValidGlob (xRow, zCol, subDetID, layer)) {
194- LOGP (debug, " Global coordinates not valid: row = {} cm, col = {} cm" , xRow, zCol);
195+ LOGP (debug, " Local coordinates not valid: row = {} cm, col = {} cm" , xRow, zCol);
195196 return false ;
196197 }
197198 return true ;
198199 };
199200
200- // Same as detectorToGlobal w.o. checks.
201+ // Same as detectorToLocal w.o. checks.
201202 // We position ourself in the middle of the pixel.
202- static void detectorToGlobalUnchecked (int & row, int & col, float xRow, float zCol, int subDetID, int layer, int disk) noexcept
203+ static void detectorToLocalUnchecked (int row, int col, float & xRow, float & zCol, int subDetID, int layer, int disk) noexcept
203204 {
205+ // / xRow = half chip width - iRow(center) * pitch
206+ // / zCol = iCol * pitch - half chip lenght
204207 if (subDetID == 0 ) {
205- xRow = -(row + 0 . 5f ) * PitchRowVD + constants::VD::petal::layer::width[layer] / 2 ;
206- zCol = ( col + 0 .5f ) * PitchColVD - constants::VD::petal::layer::length / 2 ;
208+ xRow = 0.5 * ( constants::VD::petal::layer::width[layer] - PitchRowVD) - (row * PitchRowVD) ;
209+ zCol = col * PitchColVD + 0.5 * ( PitchColVD - constants::VD::petal::layer::length) ;
207210 } else if (subDetID == 1 && layer <= 3 ) { // ML
208- xRow = -(row + 0 . 5f ) * PitchRowML + constants::ML::width / 2 ;
209- zCol = ( col + 0 .5f ) * PitchColML - constants::ML::length / 2 ;
211+ xRow = 0.5 * ( constants::ML::width - PitchRowMLOT) - (row * PitchRowMLOT) ;
212+ zCol = col * PitchRowMLOT + 0.5 * (PitchRowMLOT - constants::ML::length) ;
210213 } else if (subDetID == 1 && layer >= 4 ) { // OT
211- xRow = -(row + 0 . 5f ) * PitchRowOT + constants::OT::width / 2 ;
212- zCol = ( col + 0 .5f ) * PitchColOT - constants::OT::length / 2 ;
214+ xRow = 0.5 * ( constants::OT::width - PitchRowMLOT) - (row * PitchRowMLOT) ;
215+ zCol = col * PitchColMLOT + 0.5 * (PitchColMLOT - constants::OT::length) ;
213216 }
214217 }
215218
@@ -225,7 +228,6 @@ class SegmentationChip
225228 // / the center of the sensitive volume.
226229 // / \return math_utils::Vector2D<float>: x and y represent the detector local flat coordinates x and y
227230 // in cm with respect to the center of the sensitive volume.
228-
229231 static math_utils::Vector2D<float > curvedToFlat (const int layer, const float xCurved, const float yCurved) noexcept
230232 {
231233 // Align the flat surface with the curved survace of the original chip (and account for metal stack, TODO)
@@ -259,8 +261,22 @@ class SegmentationChip
259261 float yCurved = dist * std::sin (phi);
260262 return math_utils::Vector2D<float >(xCurved, yCurved);
261263 }
264+
265+ // / Print segmentation info
266+ static const void Print () noexcept
267+ {
268+ LOG (info) << " Number of rows:\n VD L0: " << constants::VD::petal::layer::nRows[0 ]
269+ << " \n VD L1: " << constants::VD::petal::layer::nRows[1 ]
270+ << " \n VD L2: " << constants::VD::petal::layer::nRows[2 ]
271+ << " \n ML stave: " << constants::ML::nRows
272+ << " \n OT stave: " << constants::OT::nRows;
273+
274+ LOG (info) << " Number of cols:\n VD: " << constants::VD::petal::layer::nCols
275+ << " \n ML stave: " << constants::ML::nCols
276+ << " \n OT stave: " << constants::OT::nCols;
277+ }
262278};
263279
264280} // namespace o2::trk
265281
266- #endif
282+ #endif
0 commit comments