Skip to content

Commit 8a63905

Browse files
authored
[ALICE3] TF3: store BC and TDC in digits
The digit time is saved both as absolute time (double) and as bc + tdc. A 10 ps TDC bin is set by default The bc is used in the digit map of chips
1 parent 1023347 commit 8a63905

5 files changed

Lines changed: 35 additions & 18 deletions

File tree

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#ifndef ALICEO2_IOTOF_DIGIT_H
2020
#define ALICEO2_IOTOF_DIGIT_H
2121

22+
#include "CommonConstants/LHCConstants.h"
2223
#include "SimulationDataFormat/MCCompLabel.h"
2324
#include "DataFormatsITSMFT/Digit.h"
2425

@@ -28,22 +29,28 @@ class Digit : public o2::itsmft::Digit
2829
{
2930
public:
3031
~Digit() = default;
31-
Digit(UShort_t chipindex = 0, UShort_t row = 0, UShort_t col = 0, Int_t charge = 0, double time = 0.)
32-
: o2::itsmft::Digit(chipindex, row, col, charge), mTime(time) {};
32+
Digit(UShort_t chipindex = 0, UShort_t row = 0, UShort_t col = 0, Int_t charge = 0, double time = 0., ULong64_t bc = 0, Int_t tdc = 0)
33+
: o2::itsmft::Digit(chipindex, row, col, charge), mTime(time), mBc(bc), mTdc(tdc) {};
3334

3435
// Setters
3536
void setTime(double time) { mTime = time; }
3637

3738
// Getters
3839
double getTime() const { return mTime; }
40+
ULong64_t getBc() const { return mBc; }
41+
Int_t getTdc() const { return mTdc; }
3942

40-
static UInt_t getOrderingKey(UShort_t chipindex, UShort_t row, UShort_t col)
43+
static ULong64_t getOrderingKey(ULong64_t bc, UShort_t row, UShort_t col)
4144
{
42-
return (static_cast<UInt_t>(chipindex) << 16) | (static_cast<UInt_t>(row) << 8) | static_cast<UInt_t>(col);
45+
uint32_t orbit = bc / o2::constants::lhc::LHCMaxBunches;
46+
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);
4348
}
4449

4550
private:
4651
double mTime = 0.; ///< Measured time (ns)
52+
ULong64_t mBc = 0; ///< BC
53+
Int_t mTdc = 0; ///< tdc time
4754
ClassDefNV(Digit, 1);
4855
};
4956

@@ -59,9 +66,9 @@ struct McLabelRef {
5966
class LabeledDigit : public Digit
6067
{
6168
public:
62-
LabeledDigit(UShort_t chipindex = 0, UShort_t row = 0, UShort_t col = 0, Int_t charge = 0, double time = 0.,
69+
LabeledDigit(UShort_t chipindex = 0, UShort_t row = 0, UShort_t col = 0, Int_t charge = 0, double time = 0., ULong64_t bc = 0, Int_t tdc = 0,
6370
o2::MCCompLabel label = 0)
64-
: Digit(chipindex, row, col, charge, time), mLabel(label) {}
71+
: Digit(chipindex, row, col, charge, time, bc, tdc), mLabel(label) {}
6572

6673
void setLabel(McLabelRef label) { mLabel = label; }
6774
McLabelRef getLabel() const { return mLabel; }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Chip
7676
/// reset points container
7777
o2::iotof::LabeledDigit* findDigit(ULong64_t key);
7878

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

8181
protected:
8282
Int_t mChipIndex = -1; ///< Chip ID
@@ -95,4 +95,4 @@ inline o2::iotof::LabeledDigit* Chip::findDigit(ULong64_t key)
9595

9696
} // namespace o2::iotof
9797

98-
#endif /* defined(ALICEO2_IOTOF_CHIP_H_) */
98+
#endif /* defined(ALICEO2_IOTOF_CHIP_H_) */

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct DPLDigitizerParam : public o2::conf::ConfigurableParamHelper<DPLDigitizer
2828

2929
double timeOffset = 0.; ///< time offset (in seconds!) to calculate ROFrame from hit time
3030
float timeResolution = 0.020f; ///< time resolution sigma in ns (20 ps default)
31+
float tdcBin = 0.010f; ///< TDC time bin (10 ps default)
3132
float efficiency = 0.98f; ///< detection efficiency
3233
int chargeThreshold = 100; ///< charge threshold in Nelectrons
3334
int minChargeToAccount = 7; ///< minimum charge contribution to account

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Chip::Chip(Int_t index)
3232
{
3333
}
3434
//_______________________________________________________________________
35-
void Chip::addDigit(UShort_t row, UShort_t col, Int_t charge, double time, o2::MCCompLabel label)
35+
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(mChipIndex, row, col);
38-
mDigits.emplace(std::make_pair(key, LabeledDigit(mChipIndex, row, col, charge, time, label)));
37+
ULong64_t key = Digit::getOrderingKey(bc, row, col);
38+
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: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID)
123123

124124
// Get hit time and apply smearing
125125
// Hit time is in seconds, convert to ns and add event time
126-
double hitTime = hit.GetTime() * sec2ns; // convert to ns
127-
double eventTimeNS = mEventTime.getTimeNS(); // event time since orbit 0
128-
double absoluteTime = hitTime + eventTimeNS; // absolute time
129-
double smearedTime = smearTime(absoluteTime); // apply detector resolution
126+
double hitTime = hit.GetTime() * sec2ns; // convert to ns
127+
double eventTimeInBC = mEventTime.getTimeOffsetWrtBC(); // event time wrt bc
128+
double hitTimeWrtBC = hitTime + eventTimeInBC; // hit time wrt bc
129+
double smearedTime = smearTime(hitTimeWrtBC); // apply detector resolution
130130

131131
if (chipID < 0 || chipID >= mGeometry->getSize() || mGeometry->getSize() < 1) {
132132
LOG(debug) << "Invalid detector ID: " << chipID << ", geometry size: " << mGeometry->getSize();
@@ -316,7 +316,7 @@ void Digitizer::fillOutputContainer()
316316
}
317317

318318
int digitID = mDigits->size();
319-
mDigits->emplace_back(digit.getChipIndex(), digit.getRow(), digit.getColumn(), digit.getCharge(), digit.getTime());
319+
mDigits->emplace_back(digit.getChipIndex(), digit.getRow(), digit.getColumn(), digit.getCharge(), digit.getTime(), digit.getBc(), digit.getTdc());
320320
if (mMCLabels) {
321321
mMCLabels->addElement(digitID, digit.getLabel().mLabel);
322322
}
@@ -345,11 +345,20 @@ void Digitizer::registerDigits(Chip& chip, uint32_t roFrame, double time, int nR
345345
{
346346
(void)nROF;
347347

348-
auto key = o2::iotof::Digit::getOrderingKey(chip.getChipIndex(), row, col);
348+
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
349+
350+
uint64_t nbc = static_cast<uint64_t>(time / o2::constants::lhc::LHCBunchSpacingNS);
351+
int tdc = int((time - nbc * o2::constants::lhc::LHCBunchSpacingNS) / digitizerParams.tdcBin);
352+
nbc += mEventTime.toLong();
353+
354+
LOG(debug) << nbc << "\t" << tdc;
355+
double absoluteTime = tdc * digitizerParams.tdcBin * 1.e-9 + nbc * o2::constants::lhc::LHCBunchSpacingNS;
356+
357+
auto key = o2::iotof::Digit::getOrderingKey(nbc, row, col);
349358
o2::iotof::LabeledDigit* existingDigit = chip.findDigit(key);
350359
if (!existingDigit) {
351360
// No existing digit, create a new one
352-
chip.addDigit(row, col, nElectrons, time, label);
361+
chip.addDigit(row, col, nElectrons, absoluteTime, nbc, tdc, label);
353362
} else {
354363
// Digit already exists, update charge and labels
355364
const int storedCharge = existingDigit->getCharge();

0 commit comments

Comments
 (0)