Skip to content

Commit 7dc8fdb

Browse files
committed
save bc and tdc in digit
1 parent 88b3941 commit 7dc8fdb

5 files changed

Lines changed: 21 additions & 14 deletions

File tree

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@ class Digit : public o2::itsmft::Digit
2828
{
2929
public:
3030
~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) {};
31+
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)
32+
: o2::itsmft::Digit(chipindex, row, col, charge), mTime(time), mBc(bc), mTdc(tdc) {};
3333

3434
// Setters
3535
void setTime(double time) { mTime = time; }
3636

3737
// Getters
3838
double getTime() const { return mTime; }
39+
ULong64_t getBc() const { return mBc; }
40+
Int_t getTdc() const { return mTdc; }
3941

4042
static UInt_t getOrderingKey(UShort_t chipindex, UShort_t row, UShort_t col)
4143
{
@@ -44,6 +46,8 @@ class Digit : public o2::itsmft::Digit
4446

4547
private:
4648
double mTime = 0.; ///< Measured time (ns)
49+
ULong64_t mBc = 0; ///< BC
50+
Int_t mTdc = 0; ///< tdc time
4751
ClassDefNV(Digit, 1);
4852
};
4953

@@ -59,9 +63,9 @@ struct McLabelRef {
5963
class LabeledDigit : public Digit
6064
{
6165
public:
62-
LabeledDigit(UShort_t chipindex = 0, UShort_t row = 0, UShort_t col = 0, Int_t charge = 0, double time = 0.,
66+
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,
6367
o2::MCCompLabel label = 0)
64-
: Digit(chipindex, row, col, charge, time), mLabel(label) {}
68+
: Digit(chipindex, row, col, charge, time, bc, tdc), mLabel(label) {}
6569

6670
void setLabel(McLabelRef label) { mLabel = label; }
6771
McLabelRef getLabel() const { return mLabel; }

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ 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:
82-
Int_t mChipIndex = -1; ///< Chip ID
83-
bool mDisabled = false; ///< Flag to indicate if the chip is disabled (e.g. due to dead channels)
82+
Int_t mChipIndex = -1; ///< Chip ID
83+
bool mDisabled = false; ///< Flag to indicate if the chip is disabled (e.g. due to dead channels)
8484
std::map<ULong64_t, o2::iotof::LabeledDigit> mDigits; ///< Map of fired digits, possibly in multiple frames
8585

8686
ClassDefNV(Chip, 1);
@@ -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: 2 additions & 2 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
{
3737
ULong64_t key = Digit::getOrderingKey(mChipIndex, row, col);
38-
mDigits.emplace(std::make_pair(key, LabeledDigit(mChipIndex, row, col, charge, time, label)));
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: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ void Digitizer::fillOutputContainer()
318318
}
319319

320320
int digitID = mDigits->size();
321-
mDigits->emplace_back(digit.getChipIndex(), digit.getRow(), digit.getColumn(), digit.getCharge(), digit.getTime());
321+
mDigits->emplace_back(digit.getChipIndex(), digit.getRow(), digit.getColumn(), digit.getCharge(), digit.getTime(), digit.getBc(), digit.getTdc());
322322
if (mMCLabels) {
323323
mMCLabels->addElement(digitID, digit.getLabel().mLabel);
324324
}
@@ -342,15 +342,17 @@ void Digitizer::fillOutputContainer()
342342
// mExtraLabelBuffer.pop_front();
343343
}
344344

345-
// have a addDigit funtion?
345+
// have a addDigit function?
346346

347347
void Digitizer::registerDigits(Chip& chip, uint32_t roFrame, double time, int nROF,
348348
uint16_t row, uint16_t col, int nElectrons, o2::MCCompLabel& label)
349349
{
350350
(void)nROF;
351351

352+
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
353+
352354
uint64_t nbc = static_cast<uint64_t>(time / o2::constants::lhc::LHCBunchSpacingNS);
353-
int tdc = int((time - nbc * o2::constants::lhc::LHCBunchSpacingNS) / .01);
355+
int tdc = int((time - nbc * o2::constants::lhc::LHCBunchSpacingNS) / digitizerParams.tdcBin);
354356
nbc += mEventTime.toLong();
355357

356358
LOG(debug) << nbc << "\t" << tdc;
@@ -359,7 +361,7 @@ void Digitizer::registerDigits(Chip& chip, uint32_t roFrame, double time, int nR
359361
o2::iotof::LabeledDigit* existingDigit = chip.findDigit(key);
360362
if (!existingDigit) {
361363
// No existing digit, create a new one
362-
chip.addDigit(row, col, nElectrons, time, label);
364+
chip.addDigit(row, col, nElectrons, time, nbc, tdc, label);
363365
} else {
364366
// Digit already exists, update charge and labels
365367
const int storedCharge = existingDigit->getCharge();

0 commit comments

Comments
 (0)