Skip to content

Commit 0a06b5d

Browse files
maciaccoalibuild
andauthored
[ALICE3] TF3: group pixel columns into readout columns in digitizer (#15907)
* make timing response independent for different pixels (dt from stepping neglected) * remove useless include and commented line * first attempt to include column-group read-out in the digitizer * imporve implementation using a tdc-status array * Please consider the following formatting changes * fix type * fix busy window * Please consider the following formatting changes --------- Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 2a1a712 commit 0a06b5d

5 files changed

Lines changed: 60 additions & 10 deletions

File tree

‎Detectors/Upgrades/ALICE3/IOTOF/DataFormatsIOTOF/include/DataFormatsIOTOF/Digit.h‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@
2525

2626
namespace o2::iotof
2727
{
28+
struct DigitKey {
29+
ULong64_t high;
30+
UInt_t low;
31+
32+
bool operator<(const DigitKey& other) const
33+
{
34+
if (high != other.high) {
35+
return high < other.high;
36+
}
37+
return low < other.low;
38+
}
39+
};
40+
2841
class Digit : public o2::itsmft::Digit
2942
{
3043
public:
@@ -40,11 +53,14 @@ class Digit : public o2::itsmft::Digit
4053
ULong64_t getBc() const { return mBc; }
4154
Int_t getTdc() const { return mTdc; }
4255

43-
static ULong64_t getOrderingKey(ULong64_t bc, UShort_t row, UShort_t col)
56+
static DigitKey getOrderingKey(ULong64_t bc, UInt_t tdc, uint16_t row, uint16_t col)
4457
{
58+
DigitKey key;
4559
uint32_t orbit = bc / o2::constants::lhc::LHCMaxBunches;
4660
uint16_t bunch = bc % o2::constants::lhc::LHCMaxBunches;
47-
return (static_cast<ULong64_t>(orbit) << 32) | (static_cast<UInt_t>(bunch) << 16) | (static_cast<UInt_t>(row) << 8) | static_cast<UInt_t>(col);
61+
key.high = (static_cast<ULong64_t>(orbit) << 32) | (static_cast<UInt_t>(bunch) << 16) | (static_cast<UInt_t>(tdc) & 0xFFFF);
62+
key.low = (static_cast<UInt_t>(row) << 16) | (static_cast<UInt_t>(col) & 0xFFFF);
63+
return key;
4864
}
4965

5066
private:

‎Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/Chip.h‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Chip
6060
/// @param option unused
6161
void clear() { mDigits.clear(); }
6262

63-
std::map<ULong64_t, o2::iotof::LabeledDigit>& getDigits() { return mDigits; }
63+
std::map<DigitKey, o2::iotof::LabeledDigit>& getDigits() { return mDigits; }
6464
bool isEmpty() const { return mDigits.empty(); }
6565

6666
void setChipIndex(Int_t index) { mChipIndex = index; }
@@ -74,19 +74,24 @@ class Chip
7474
Int_t getNumberOfDigits() const { return mDigits.size(); }
7575

7676
/// reset points container
77-
o2::iotof::LabeledDigit* findDigit(ULong64_t key);
77+
o2::iotof::LabeledDigit* findDigit(DigitKey key);
78+
79+
/// Resize the vector of tdc states
80+
void resizeTDCStates(int const size) { mTDCStates.resize(size); }
81+
std::vector<std::array<double, 2>>& getTDCStates() { return mTDCStates; }
7882

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

8185
protected:
8286
Int_t mChipIndex = -1; ///< Chip ID
8387
bool mDisabled = false; ///< Flag to indicate if the chip is disabled (e.g. due to dead channels)
84-
std::map<ULong64_t, o2::iotof::LabeledDigit> mDigits; ///< Map of fired digits, possibly in multiple frames
88+
std::map<DigitKey, o2::iotof::LabeledDigit> mDigits; ///< Map of fired digits, possibly in multiple frames
89+
std::vector<std::array<double, 2>> mTDCStates; ///< Vector of the last times the TDC pairs went busy
8590

8691
ClassDefNV(Chip, 1);
8792
};
8893

89-
inline o2::iotof::LabeledDigit* Chip::findDigit(ULong64_t key)
94+
inline o2::iotof::LabeledDigit* Chip::findDigit(DigitKey key)
9095
{
9196
// finds the digit corresponding to global key
9297
auto digitentry = mDigits.find(key);

‎Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/DPLDigitizerParam.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ struct DPLDigitizerParam : public o2::conf::ConfigurableParamHelper<DPLDigitizer
3838
float energyToNElectrons = 1. / 3.6e-9; // conversion of eloss to Nelectrons
3939
int responseMatrixSize = 1; ///< size of the response matrix (odd number)
4040

41+
int nColsPerGroup = 4; ///< number of pixel columns grouped into a readout column
42+
double tdcBusyTime = 3000.; ///< tdc pair bsuy time (default 3 us)
43+
4144
std::string noiseFilePath{}; ///< optional noise masks file path. FIXME to be removed once switch to CCDBFetcher
4245

4346
// boilerplate stuff + make principal key

‎Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Chip.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ Chip::Chip(Int_t index)
3434
//_______________________________________________________________________
3535
void Chip::addDigit(UShort_t row, UShort_t col, Int_t charge, double time, ULong64_t bc, Int_t tdc, o2::MCCompLabel label)
3636
{
37-
ULong64_t key = Digit::getOrderingKey(bc, row, col);
37+
DigitKey key = Digit::getOrderingKey(bc, tdc, row, col);
3838
mDigits.emplace(std::make_pair(key, LabeledDigit(mChipIndex, row, col, charge, time, bc, tdc, label)));
3939
}

‎Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx‎

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ void Digitizer::init()
4141
{
4242
const int numberOfChips = mGeometry->getSize();
4343
mChips.resize(numberOfChips);
44+
45+
const auto& specsConfig = ChipSpecificsParam::Instance();
46+
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
47+
const int nReadOutCols = specsConfig.NCols / digitizerParams.nColsPerGroup + 1;
4448
for (int i = numberOfChips; i--;) {
4549
mChips[i].setChipIndex(i);
4650
/// Noise map to be implemented
@@ -53,9 +57,15 @@ void Digitizer::init()
5357
/// mChips[i].disable(mDeadChanMap->isFullChipMasked(i));
5458
/// mChips[i].setDeadChanMap(mDeadChanMap);
5559
/// }
60+
61+
// initialize the vector of TDC states
62+
mChips[i].resizeTDCStates(nReadOutCols);
63+
for (auto& tdcStates : mChips[i].getTDCStates()) {
64+
tdcStates[0] = -999.f;
65+
tdcStates[1] = -999.f;
66+
}
5667
}
5768

58-
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
5969
if (!digitizerParams.efficiencyFilePath.empty()) {
6070
loadEfficiencyMap(digitizerParams.efficiencyFilePath);
6171
}
@@ -404,12 +414,25 @@ void Digitizer::fillOutputContainer()
404414
}
405415

406416
auto& chipDigits = chip.getDigits();
417+
auto& tdcStates = chip.getTDCStates();
418+
407419
for (const auto& [key, digit] : chipDigits) {
408420

409421
if (digit.getCharge() < digitizerParams.chargeThreshold) {
410422
continue; // skip digits below threshold
411423
}
412424

425+
const int colInGroup = digit.getColumn() / digitizerParams.nColsPerGroup;
426+
const double digitTime = digit.getTime();
427+
if (digitTime - tdcStates[colInGroup][0] < digitizerParams.tdcBusyTime && digitTime - tdcStates[colInGroup][1] < digitizerParams.tdcBusyTime) {
428+
// TODO: improve labels treatment if multiple hits cross the same pixel during
429+
continue; // both tdc pairs are busy
430+
} else if (digitTime - tdcStates[colInGroup][0] > digitizerParams.tdcBusyTime) {
431+
tdcStates[colInGroup][0] = digitTime;
432+
} else if (digitTime - tdcStates[colInGroup][1] > digitizerParams.tdcBusyTime) {
433+
tdcStates[colInGroup][1] = digitTime;
434+
}
435+
413436
int digitID = mDigits->size();
414437
mDigits->emplace_back(digit.getChipIndex(), digit.getRow(), digit.getColumn(), digit.getCharge(), digit.getTime(), digit.getBc(), digit.getTdc());
415438
if (mMCLabels) {
@@ -438,7 +461,7 @@ void Digitizer::fillOutputContainer()
438461
void Digitizer::registerDigits(Chip& chip, uint32_t roFrame, double time, int nROF,
439462
uint16_t row, uint16_t col, int nElectrons, o2::MCCompLabel& label)
440463
{
441-
(void)nROF;
464+
// (void)nROF;
442465

443466
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
444467

@@ -448,8 +471,11 @@ void Digitizer::registerDigits(Chip& chip, uint32_t roFrame, double time, int nR
448471

449472
double absoluteTime = tdc * digitizerParams.tdcBin + nbc * o2::constants::lhc::LHCBunchSpacingNS;
450473

451-
auto key = o2::iotof::Digit::getOrderingKey(nbc, row, col);
474+
auto key = o2::iotof::Digit::getOrderingKey(nbc, tdc, row, col);
452475
o2::iotof::LabeledDigit* existingDigit = chip.findDigit(key);
476+
477+
chip.addDigit(row, col, nElectrons, absoluteTime, nbc, tdc, label);
478+
453479
if (!existingDigit) {
454480
// No existing digit, create a new one
455481
chip.addDigit(row, col, nElectrons, absoluteTime, nbc, tdc, label);

0 commit comments

Comments
 (0)