Skip to content

Commit 38ccad5

Browse files
atrioloalibuild
andauthored
[ALICE3] TRK: add noise to the digitization process (#15167)
* ALICE3-TRK: add noise to the digitization process * Please consider the following formatting changes --------- Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent f039750 commit 38ccad5

File tree

5 files changed

+54
-3
lines changed

5 files changed

+54
-3
lines changed

Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/ChipDigitsContainer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ class ChipDigitsContainer : public o2::itsmft::ChipDigitsContainer
3535
return (static_cast<ULong64_t>(roframe) << (8 * sizeof(UInt_t))) + (static_cast<ULong64_t>(col) << (8 * sizeof(Short_t))) + row;
3636
}
3737

38+
/// Adds noise digits, deleted the one using the itsmft::DigiParams interface
39+
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;
40+
void addNoise(UInt_t rofMin, UInt_t rofMax, const o2::trk::DigiParams* params, int subDetID, int layer);
41+
3842
ClassDefNV(ChipDigitsContainer, 1);
3943
};
4044

Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/DPLDigitizerParam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct DPLDigitizerParam : public o2::conf::ConfigurableParamHelper<DPLDigitizer
5454
private:
5555
static constexpr float DEFNoisePerPixel()
5656
{
57-
return N == o2::detectors::DetID::TRK ? 1e-8 : 1e-8; // ITS/MFT values here!!
57+
return N == o2::detectors::DetID::TRK ? 1e-7 : 1e-8; // ITS/MFT values here!!
5858
}
5959

6060
static constexpr std::string_view ParamName[2] = {"TRKDigitizerParam", "FT3DigitizerParam"};

Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/DigiParams.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class DigiParams
103103
private:
104104
static constexpr double infTime = 1e99;
105105
bool mIsContinuous = false; ///< flag for continuous simulation
106-
float mNoisePerPixel = 1.e-8; ///< ALPIDE Noise per chip
106+
float mNoisePerPixel = 1.e-7; ///< Noise per chip
107107
int mROFrameLengthInBC = 0; ///< ROF length in BC for continuos mode
108108
float mROFrameLength = 0; ///< length of RO frame in ns
109109
float mStrobeDelay = 0.; ///< strobe start (in ns) wrt ROF start

Detectors/Upgrades/ALICE3/TRK/simulation/src/ChipDigitsContainer.cxx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,50 @@ using namespace o2::trk;
1515

1616
ChipDigitsContainer::ChipDigitsContainer(UShort_t idx)
1717
: o2::itsmft::ChipDigitsContainer(idx) {}
18+
19+
//______________________________________________________________________
20+
void ChipDigitsContainer::addNoise(UInt_t rofMin, UInt_t rofMax, const o2::trk::DigiParams* params, int subDetID, int layer)
21+
{
22+
UInt_t row = 0;
23+
UInt_t col = 0;
24+
Int_t nhits = 0;
25+
constexpr float ns2sec = 1e-9;
26+
float mean = 0.f;
27+
int nel = 0;
28+
int maxRows = 0;
29+
int maxCols = 0;
30+
31+
// TODO: set different noise and threshold for VD and MLOT
32+
if (subDetID == 0) { // VD
33+
maxRows = constants::VD::petal::layer::nRows[layer]; // TODO: get the layer from the geometry
34+
maxCols = constants::VD::petal::layer::nCols;
35+
mean = params->getNoisePerPixel() * maxRows * maxCols;
36+
nel = static_cast<int>(params->getChargeThreshold() * 1.1);
37+
} else { // ML/OT
38+
maxRows = constants::moduleMLOT::chip::nRows;
39+
maxCols = constants::moduleMLOT::chip::nCols;
40+
mean = params->getNoisePerPixel() * maxRows * maxCols;
41+
nel = static_cast<int>(params->getChargeThreshold() * 1.1);
42+
}
43+
44+
LOG(debug) << "Adding noise for chip " << mChipIndex << " with mean " << mean << " and charge " << nel;
45+
46+
for (UInt_t rof = rofMin; rof <= rofMax; rof++) {
47+
nhits = gRandom->Poisson(mean);
48+
for (Int_t i = 0; i < nhits; ++i) {
49+
row = gRandom->Integer(maxRows);
50+
col = gRandom->Integer(maxCols);
51+
LOG(debug) << "Generated noise hit at ROF " << rof << ", row " << row << ", col " << col;
52+
if (mNoiseMap && mNoiseMap->isNoisy(mChipIndex, row, col)) {
53+
continue;
54+
}
55+
if (mDeadChanMap && mDeadChanMap->isNoisy(mChipIndex, row, col)) {
56+
continue;
57+
}
58+
auto key = getOrderingKey(rof, row, col);
59+
if (!findDigit(key)) {
60+
addDigit(key, rof, row, col, nel, o2::MCCompLabel(true));
61+
}
62+
}
63+
}
64+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void Digitizer::fillOutputContainer(uint32_t frameLast)
215215
if (chip.isDisabled()) {
216216
continue;
217217
}
218-
// chip.addNoise(mROFrameMin, mROFrameMin, &mParams); /// TODO: add noise
218+
chip.addNoise(mROFrameMin, mROFrameMin, &mParams, mGeometry->getSubDetID(chip.getChipIndex()), mGeometry->getLayer(chip.getChipIndex())); /// TODO: add noise
219219
auto& buffer = chip.getPreDigits();
220220
if (buffer.empty()) {
221221
continue;

0 commit comments

Comments
 (0)