Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,19 @@ class Chip

/// Resize the vector of tdc states
void resizeTDCStates(int const size) { mTDCStates.resize(size); }
std::vector<std::array<double, 2>>& getTDCStates() { return mTDCStates; }
std::vector<std::array<double, 4>>& getTDCStates() { return mTDCStates; }

void resizeMaskStates(int const size) { mMaskStates.resize(size); }
std::vector<double>& getMaskStates() { return mMaskStates; }

void addDigit(UShort_t row, UShort_t col, Int_t charge, double time, ULong64_t bc, Int_t tdc, o2::MCCompLabel label);

protected:
Int_t mChipIndex = -1; ///< Chip ID
bool mDisabled = false; ///< Flag to indicate if the chip is disabled (e.g. due to dead channels)
std::map<DigitKey, o2::iotof::LabeledDigit> mDigits; ///< Map of fired digits, possibly in multiple frames
std::vector<std::array<double, 2>> mTDCStates; ///< Vector of the last times the TDC pairs went busy
std::vector<std::array<double, 4>> mTDCStates; ///< Vector of the last times the TDC pairs went busy
std::vector<double> mMaskStates; ///< Vector of the last time the RO column was masked

ClassDefNV(Chip, 1);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ struct DPLDigitizerParam : public o2::conf::ConfigurableParamHelper<DPLDigitizer
int responseMatrixSize = 1; ///< size of the response matrix (odd number)

int nColsPerGroup = 4; ///< number of pixel columns grouped into a readout column
double tdcBusyTime = 3000.; ///< tdc pair bsuy time (default 3 us)
double tdcBusyTime = 3300.; ///< tdc pair bsuy time (default 3.3 us)
double maskWindow = 100.; ///< RO column masking time (default 100 ns)

std::string noiseFilePath{}; ///< optional noise masks file path. FIXME to be removed once switch to CCDBFetcher

Expand Down
37 changes: 28 additions & 9 deletions Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "IOTOFSimulation/DPLDigitizerParam.h"
#include "DetectorsRaw/HBFUtils.h"
#include "CCDB/BasicCCDBManager.h"
#include "CommonConstants/MathConstants.h"

#include <TCollection.h>
#include <TFile.h>
Expand Down Expand Up @@ -63,8 +64,14 @@ void Digitizer::init()
// initialize the vector of TDC states
mChips[i].resizeTDCStates(nReadOutCols);
for (auto& tdcStates : mChips[i].getTDCStates()) {
tdcStates[0] = -999.f;
tdcStates[1] = -999.f;
for (int iT = 0; iT < 4; ++iT) {
tdcStates[iT] = -o2::constants::math::VeryBig;
}
}
// initialize the vector of mask states
mChips[i].resizeMaskStates(nReadOutCols);
for (auto& maskStates: mChips[i].getMaskStates()) {
maskStates = -o2::constants::math::VeryBig;
}
}

Expand Down Expand Up @@ -497,6 +504,7 @@ void Digitizer::fillOutputContainer()

auto& chipDigits = chip.getDigits();
auto& tdcStates = chip.getTDCStates();
auto& maskStates = chip.getMaskStates();

for (const auto& [key, digit] : chipDigits) {

Expand All @@ -506,15 +514,26 @@ void Digitizer::fillOutputContainer()

const int colInGroup = digit.getColumn() / digitizerParams.nColsPerGroup;
const double digitTime = digit.getTime();
if (digitTime - tdcStates[colInGroup][0] < digitizerParams.tdcBusyTime && digitTime - tdcStates[colInGroup][1] < digitizerParams.tdcBusyTime) {
// TODO: improve labels treatment if multiple hits cross the same pixel during
continue; // both tdc pairs are busy
} else if (digitTime - tdcStates[colInGroup][0] > digitizerParams.tdcBusyTime) {
tdcStates[colInGroup][0] = digitTime;
} else if (digitTime - tdcStates[colInGroup][1] > digitizerParams.tdcBusyTime) {
tdcStates[colInGroup][1] = digitTime;

if (digitTime - maskStates[colInGroup] < digitizerParams.maskWindow) {
continue; // the RO column is still masked
}

int available = -1;
for (int iT{0}; iT < 4; ++iT) {
if (digitTime - tdcStates[colInGroup][iT] > digitizerParams.tdcBusyTime) {
available = iT;
break;
}
}

if (available == -1) {
continue; // all tdc pairs are busy
}

tdcStates[colInGroup][available] = digitTime;
maskStates[colInGroup] = digitTime;

int digitID = mDigits->size();
mDigits->emplace_back(digit.getChipIndex(), digit.getRow(), digit.getColumn(), digit.getCharge(), digit.getTime(), digit.getBc(), digit.getTdc());
if (mMCLabels) {
Expand Down
Loading