forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChipDigitsContainer.cxx
More file actions
64 lines (57 loc) · 2.43 KB
/
ChipDigitsContainer.cxx
File metadata and controls
64 lines (57 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "TRKSimulation/ChipDigitsContainer.h"
using namespace o2::trk;
ChipDigitsContainer::ChipDigitsContainer(UShort_t idx)
: o2::itsmft::ChipDigitsContainer(idx) {}
//______________________________________________________________________
void ChipDigitsContainer::addNoise(UInt_t rofMin, UInt_t rofMax, const o2::trk::DigiParams* params, int subDetID, int layer)
{
UInt_t row = 0;
UInt_t col = 0;
Int_t nhits = 0;
constexpr float ns2sec = 1e-9;
float mean = 0.f;
int nel = 0;
int maxRows = 0;
int maxCols = 0;
// TODO: set different noise and threshold for VD and MLOT
if (subDetID == 0) { // VD
maxRows = constants::VD::petal::layer::nRows[layer]; // TODO: get the layer from the geometry
maxCols = constants::VD::petal::layer::nCols;
mean = params->getNoisePerPixel() * maxRows * maxCols;
nel = static_cast<int>(params->getChargeThreshold() * 1.1);
} else { // ML/OT
maxRows = constants::moduleMLOT::chip::nRows;
maxCols = constants::moduleMLOT::chip::nCols;
mean = params->getNoisePerPixel() * maxRows * maxCols;
nel = static_cast<int>(params->getChargeThreshold() * 1.1);
}
LOG(debug) << "Adding noise for chip " << mChipIndex << " with mean " << mean << " and charge " << nel;
for (UInt_t rof = rofMin; rof <= rofMax; rof++) {
nhits = gRandom->Poisson(mean);
for (Int_t i = 0; i < nhits; ++i) {
row = gRandom->Integer(maxRows);
col = gRandom->Integer(maxCols);
LOG(debug) << "Generated noise hit at ROF " << rof << ", row " << row << ", col " << col;
if (mNoiseMap && mNoiseMap->isNoisy(mChipIndex, row, col)) {
continue;
}
if (mDeadChanMap && mDeadChanMap->isNoisy(mChipIndex, row, col)) {
continue;
}
auto key = getOrderingKey(rof, row, col);
if (!findDigit(key)) {
addDigit(key, rof, row, col, nel, o2::MCCompLabel(true));
}
}
}
}