Skip to content

Commit 0154ee9

Browse files
committed
ITS3 digitization: parameters, segmentation and container fixes
- Add digitization parameter sets - Fix C2F/F2C conversion in SegmentationMosaix - Set scale function for Alpide as IB - Fix chip digits container initialization - Correct ordering of maxRows and maxCols - Add support for floating row/column numbers in D2L
1 parent 304938e commit 0154ee9

File tree

12 files changed

+346
-93
lines changed

12 files changed

+346
-93
lines changed

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

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/// \file SegmentationMosaix.h
1313
/// \brief Definition of the SegmentationMosaix class
1414
/// \author felix.schlepper@cern.ch
15+
/// \author chunzheng.wang@cern.ch
1516

1617
#ifndef ALICEO2_ITS3_SEGMENTATIONMOSAIX_H_
1718
#define ALICEO2_ITS3_SEGMENTATIONMOSAIX_H_
@@ -43,24 +44,22 @@ class SegmentationMosaix
4344
// 3. The detector coordinate system. Defined by the row and column segmentation
4445
// defined at the upper edge in the flat coord.
4546

46-
// row,col=0
47-
// |
48-
// v
49-
// x----------------------x
47+
// O----------------------|
5048
// | | |
49+
// | | | ^ x
50+
// | | | |
51+
// | | | |
52+
// | | | |
53+
// | | | X----> z X marks (x,z)=(0,0)
54+
// |-----------X----------|
55+
// | | | O----> col O marks (row,col)=(0,0)
56+
// | | | |
57+
// | | | |
58+
// | | | v
59+
// | | | row
5160
// | | |
52-
// | | | ^ x
53-
// | | | |
54-
// | | | |
55-
// | | | |
56-
// |-----------X----------| X marks (x,z)=(0,0) X----> z
57-
// | | |
58-
// | | |
59-
// | | |
60-
// | | |
61-
// | | |
62-
// | | |
63-
// x----------------------x
61+
// |----------------------|
62+
6463
public:
6564
constexpr SegmentationMosaix(int layer) : mRadius(static_cast<float>(constants::radiiMiddle[layer])) {}
6665
constexpr ~SegmentationMosaix() = default;
@@ -79,7 +78,7 @@ class SegmentationMosaix
7978
static constexpr float PitchCol{constants::pixelarray::pixels::mosaix::pitchZ};
8079
static constexpr float PitchRow{constants::pixelarray::pixels::mosaix::pitchX};
8180
static constexpr float SensorLayerThickness{constants::totalThickness};
82-
static constexpr float NominalYShift{constants::nominalYShift};
81+
static constexpr float NominalYShift{0.0f};
8382

8483
/// Transformation from the curved surface to a flat surface.
8584
/// Additionally a shift in the flat coordinates must be applied because
@@ -102,9 +101,9 @@ class SegmentationMosaix
102101
// stack
103102
float dist = std::hypot(xCurved, yCurved);
104103
float phi = std::atan2(yCurved, xCurved);
105-
xFlat = (mRadius * phi) - WidthH;
106104
// the y position is in the silicon volume however we need the chip volume (silicon+metalstack)
107105
// this is accounted by a y shift
106+
xFlat = WidthH - mRadius * phi;
108107
yFlat = dist - mRadius + NominalYShift;
109108
}
110109

@@ -122,11 +121,12 @@ class SegmentationMosaix
122121
{
123122
// MUST align the flat surface with the curved surface with the original pixel array is on and account for metal
124123
// stack
124+
float dist = yFlat - NominalYShift + mRadius;
125+
float phi = (WidthH - xFlat) / mRadius;
125126
// the y position is in the chip volume however we need the silicon volume
126127
// this is accounted by a -y shift
127-
float dist = yFlat - NominalYShift + mRadius;
128-
xCurved = dist * std::cos((xFlat + WidthH) / mRadius);
129-
yCurved = dist * std::sin((xFlat + WidthH) / mRadius);
128+
xCurved = dist * std::cos(phi);
129+
yCurved = dist * std::sin(phi);
130130
}
131131

132132
/// Transformation from Geant detector centered local coordinates (cm) to
@@ -142,8 +142,11 @@ class SegmentationMosaix
142142
/// \param int iCol Detector z cell coordinate.
143143
constexpr bool localToDetector(float const xRow, float const zCol, int& iRow, int& iCol) const noexcept
144144
{
145+
if (!isValidLoc(xRow, zCol)) {
146+
return false;
147+
}
145148
localToDetectorUnchecked(xRow, zCol, iRow, iCol);
146-
if (!isValid(iRow, iCol)) {
149+
if (!isValidDet(iRow, iCol)) {
147150
iRow = iCol = -1;
148151
return false;
149152
}
@@ -167,24 +170,27 @@ class SegmentationMosaix
167170
/// center of the sensitive volume.
168171
/// If iRow and or iCol is outside of the segmentation range a value of -0.5*Dx()
169172
/// or -0.5*Dz() is returned.
170-
constexpr bool detectorToLocal(int const iRow, int const iCol, float& xRow, float& zCol) const noexcept
173+
template <typename T>
174+
constexpr bool detectorToLocal(T const row, T const col, float& xRow, float& zCol) const noexcept
171175
{
172-
if (!isValid(iRow, iCol)) {
176+
if (!isValidDet(row, col)) {
173177
return false;
174178
}
175-
detectorToLocalUnchecked(iRow, iCol, xRow, zCol);
176-
return isValid(xRow, zCol);
179+
detectorToLocalUnchecked(row, col, xRow, zCol);
180+
return isValidLoc(xRow, zCol);
177181
}
178182

179183
// Same as detectorToLocal w.o. checks.
180184
// We position ourself in the middle of the pixel.
181-
constexpr void detectorToLocalUnchecked(int const iRow, int const iCol, float& xRow, float& zCol) const noexcept
185+
template <typename T>
186+
constexpr void detectorToLocalUnchecked(T const row, T const col, float& xRow, float& zCol) const noexcept
182187
{
183-
xRow = -(static_cast<float>(iRow) + 0.5f) * PitchRow + WidthH;
184-
zCol = (static_cast<float>(iCol) + 0.5f) * PitchCol - LengthH;
188+
xRow = -(static_cast<float>(row) + 0.5f) * PitchRow + WidthH;
189+
zCol = (static_cast<float>(col) + 0.5f) * PitchCol - LengthH;
185190
}
186191

187-
bool detectorToLocal(int const row, int const col, math_utils::Point3D<float>& loc) const noexcept
192+
template <typename T>
193+
constexpr bool detectorToLocal(T const row, T const col, math_utils::Point3D<float>& loc) const noexcept
188194
{
189195
float xRow{0.}, zCol{0.};
190196
if (!detectorToLocal(row, col, xRow, zCol)) {
@@ -194,22 +200,28 @@ class SegmentationMosaix
194200
return true;
195201
}
196202

197-
void detectorToLocalUnchecked(int const row, int const col, math_utils::Point3D<float>& loc) const noexcept
203+
template <typename T>
204+
constexpr void detectorToLocalUnchecked(T const row, T const col, math_utils::Point3D<float>& loc) const noexcept
198205
{
199206
float xRow{0.}, zCol{0.};
200207
detectorToLocalUnchecked(row, col, xRow, zCol);
201208
loc.SetCoordinates(xRow, NominalYShift, zCol);
202209
}
203210

204211
private:
212+
// Check local coordinates (cm) validity.
205213
template <typename T>
206-
[[nodiscard]] constexpr bool isValid(T const row, T const col) const noexcept
214+
constexpr bool isValidLoc(T const x, T const z) const noexcept
207215
{
208-
if constexpr (std::is_floating_point_v<T>) { // compares in local coord.
209-
return (-WidthH < row && row < WidthH && -LengthH < col && col < LengthH);
210-
} else { // compares in rows/cols
211-
return !static_cast<bool>(row < 0 || row >= static_cast<int>(NRows) || col < 0 || col >= static_cast<int>(NCols));
212-
}
216+
return (-WidthH < x && x < WidthH && -LengthH < z && z < LengthH);
217+
}
218+
219+
// Check detector coordinates validity.
220+
template <typename T>
221+
constexpr bool isValidDet(T const row, T const col) const noexcept
222+
{
223+
return (row >= 0 && row < static_cast<T>(NRows) &&
224+
col >= 0 && col < static_cast<T>(NCols));
213225
}
214226

215227
float mRadius;

Detectors/Upgrades/ITS3/simulation/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ o2_add_library(ITS3Simulation
1515
src/DescriptorInnerBarrelITS3.cxx
1616
src/Digitizer.cxx
1717
src/DigiParams.cxx
18+
src/ITS3DPLDigitizerParam.cxx
19+
src/ChipDigitsContainer.cxx
1820
PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat
19-
O2::ITSBase O2::ITSMFTSimulation
21+
O2::ITSBase O2::ITSMFTSimulation O2::ITSMFTBase
2022
ROOT::Physics)
2123

2224
o2_target_root_dictionary(ITS3Simulation
@@ -25,6 +27,8 @@ o2_target_root_dictionary(ITS3Simulation
2527
include/ITS3Simulation/DescriptorInnerBarrelITS3.h
2628
include/ITS3Simulation/Digitizer.h
2729
include/ITS3Simulation/DigiParams.h
30+
include/ITS3Simulation/ITS3DPLDigitizerParam.h
31+
include/ITS3Simulation/ChipDigitsContainer.h
2832
)
2933

3034
o2_data_file(COPY data DESTINATION Detectors/ITS3/simulation)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef ALICEO2_ITS3_CHIPDIGITSCONTAINER_
13+
#define ALICEO2_ITS3_CHIPDIGITSCONTAINER_
14+
15+
#include "ITSMFTBase/SegmentationAlpide.h" // Base class in o2::itsmft namespace
16+
#include "ITSMFTSimulation/ChipDigitsContainer.h" // Base class in o2::itsmft namespace
17+
#include "ITS3Base/SegmentationMosaix.h" // OB segmentation implementation
18+
#include "ITS3Base/SpecsV2.h" // Provides SpecsV2::isDetITS3() interface
19+
#include "ITS3Simulation/DigiParams.h" // ITS3-specific DigiParams interface
20+
#include <TRandom.h>
21+
22+
namespace o2
23+
{
24+
namespace its3
25+
{
26+
27+
// IB uses the Alpide segmentation,
28+
// OB uses the Mosaix segmentation.
29+
using SegmentationIB = SegmentationMosaix;
30+
using SegmentationOB = o2::itsmft::SegmentationAlpide;
31+
class ChipDigitsContainer : public o2::itsmft::ChipDigitsContainer
32+
{
33+
private:
34+
bool innerBarrel; ///< true if the chip belongs to the inner barrel (IB), false if outer barrel (OB)
35+
int maxRows; ///< maximum number of rows
36+
int maxCols; ///< maximum number of columns
37+
38+
public:
39+
explicit ChipDigitsContainer(UShort_t idx = 0);
40+
41+
/// Returns whether the chip is in the inner barrel (IB)
42+
void setChipIndex(UShort_t idx)
43+
{
44+
o2::itsmft::ChipDigitsContainer::setChipIndex(idx);
45+
innerBarrel = constants::detID::isDetITS3(getChipIndex());
46+
maxRows = innerBarrel ? SegmentationIB::NRows : SegmentationOB::NRows;
47+
maxCols = innerBarrel ? SegmentationIB::NCols : SegmentationOB::NCols;
48+
}
49+
50+
int getMaxRows() const { return maxRows; }
51+
int getMaxCols() const { return maxCols; }
52+
bool isIB() const;
53+
/// Adds noise digits, deleted the one using the itsmft::DigiParams interface
54+
void addNoise(UInt_t rofMin, UInt_t rofMax, const o2::itsmft::DigiParams* params, int maxRows = o2::itsmft::SegmentationAlpide::NRows, int maxCols = o2::itsmft::SegmentationAlpide::NCols) = delete;
55+
void addNoise(UInt_t rofMin, UInt_t rofMax, const o2::its3::DigiParams* params);
56+
57+
ClassDefNV(ChipDigitsContainer, 1);
58+
};
59+
60+
} // namespace its3
61+
} // namespace o2
62+
63+
#endif // ALICEO2_ITS3_CHIPDIGITSCONTAINER_

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,28 @@ namespace o2::its3
1919

2020
class DigiParams final : public o2::itsmft::DigiParams
2121
{
22+
private:
23+
float mIBNoisePerPixel = 1.e-8;
24+
int mIBChargeThreshold = 150; ///< charge threshold in Nelectrons
25+
int mIBMinChargeToAccount = 15; ///< minimum charge contribution to account
26+
int mIBNSimSteps = 18; ///< number of steps in response simulation
27+
float mIBNSimStepsInv = 0; ///< its inverse
28+
2229
public:
30+
DigiParams();
31+
32+
void setIBNoisePerPixel(float v) { mIBNoisePerPixel = v; }
33+
float getIBNoisePerPixel() const { return mIBNoisePerPixel; }
34+
35+
void setIBChargeThreshold(int v, float frac2Account = 0.1);
36+
int getIBChargeThreshold() const { return mIBChargeThreshold; }
37+
38+
void setIBNSimSteps(int v);
39+
int getIBNSimSteps() const { return mIBNSimSteps; }
40+
float getIBNSimStepsInv() const { return mIBNSimStepsInv; }
41+
42+
int getIBMinChargeToAccount() const { return mIBMinChargeToAccount; }
43+
2344
const o2::itsmft::AlpideSimResponse* getAlpSimResponse() const = delete;
2445
void setAlpSimResponse(const o2::itsmft::AlpideSimResponse* par) = delete;
2546

@@ -37,7 +58,7 @@ class DigiParams final : public o2::itsmft::DigiParams
3758
const o2::itsmft::AlpideSimResponse* mOBSimResponse = nullptr; //!< pointer to external response
3859
const o2::itsmft::AlpideSimResponse* mIBSimResponse = nullptr; //!< pointer to external response
3960

40-
ClassDef(DigiParams, 1);
61+
ClassDefNV(DigiParams, 1);
4162
};
4263

4364
} // namespace o2::its3

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
#include "Rtypes.h"
2222
#include "TObject.h"
2323

24-
#include "ITSMFTSimulation/ChipDigitsContainer.h"
2524
#include "ITSMFTSimulation/AlpideSimResponse.h"
2625
#include "ITSMFTSimulation/Hit.h"
2726
#include "ITSBase/GeometryTGeo.h"
2827
#include "ITS3Base/SegmentationMosaix.h"
2928
#include "ITS3Simulation/DigiParams.h"
29+
#include "ITS3Simulation/ChipDigitsContainer.h"
3030
#include "DataFormatsITSMFT/Digit.h"
3131
#include "DataFormatsITSMFT/ROFRecord.h"
3232
#include "CommonDataFormat/InteractionRecord.h"
@@ -78,7 +78,7 @@ class Digitizer : public TObject
7878

7979
private:
8080
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID);
81-
void registerDigits(o2::itsmft::ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
81+
void registerDigits(o2::its3::ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
8282
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl);
8383

8484
ExtraDig* getExtraDigBuffer(uint32_t roFrame)
@@ -118,7 +118,7 @@ class Digitizer : public TObject
118118

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

121-
std::vector<o2::itsmft::ChipDigitsContainer> mChips; ///< Array of chips digits containers
121+
std::vector<o2::its3::ChipDigitsContainer> mChips; ///< Array of chips digits containers
122122
std::deque<std::unique_ptr<ExtraDig>> mExtraBuff; ///< burrer (per roFrame) for extra digits
123123

124124
std::vector<o2::itsmft::Digit>* mDigits = nullptr; //! output digits
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
8+
#ifndef ALICEO2_ITS3DPLDIGITIZERPARAM_H_
9+
#define ALICEO2_ITS3DPLDIGITIZERPARAM_H_
10+
11+
#include "CommonUtils/ConfigurableParam.h"
12+
#include "CommonUtils/ConfigurableParamHelper.h"
13+
14+
namespace o2
15+
{
16+
namespace its3
17+
{
18+
19+
struct ITS3DPLDigitizerParam : public o2::conf::ConfigurableParamHelper<ITS3DPLDigitizerParam> {
20+
float IBNoisePerPixel = 1.e-8; ///< MOSAIX Noise per channel
21+
int IBChargeThreshold = 150; ///< charge threshold in Nelectrons for IB
22+
int IBMinChargeToAccount = 15; ///< minimum charge contribution to account for IB
23+
int nIBSimSteps = 18; ///< number of steps in response for IB
24+
25+
O2ParamDef(ITS3DPLDigitizerParam, "ITS3DPLDigitizerParam");
26+
};
27+
28+
} // namespace its3
29+
} // namespace o2
30+
31+
#endif

0 commit comments

Comments
 (0)