Skip to content

Commit 88b3941

Browse files
committed
compute bc and tdc time from hit and event time
1 parent de03530 commit 88b3941

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID)
125125
// Hit time is in seconds, convert to ns and add event time
126126
double hitTime = hit.GetTime() * sec2ns; // convert to ns
127127
double eventTimeNS = mEventTime.getTimeNS(); // event time since orbit 0
128-
double absoluteTime = hitTime + eventTimeNS; // absolute time
128+
double eventTimeInBC = mEventTime.getTimeOffsetWrtBC();
129+
// double absoluteTime = hitTime + eventTimeNS; // absolute time
130+
double absoluteTime = hitTime + eventTimeInBC; // absolute time
129131
double smearedTime = smearTime(absoluteTime); // apply detector resolution
130132

131133
if (chipID < 0 || chipID >= mGeometry->getSize() || mGeometry->getSize() < 1) {
@@ -340,11 +342,19 @@ void Digitizer::fillOutputContainer()
340342
// mExtraLabelBuffer.pop_front();
341343
}
342344

345+
// have a addDigit funtion?
346+
343347
void Digitizer::registerDigits(Chip& chip, uint32_t roFrame, double time, int nROF,
344348
uint16_t row, uint16_t col, int nElectrons, o2::MCCompLabel& label)
345349
{
346350
(void)nROF;
347351

352+
uint64_t nbc = static_cast<uint64_t>(time / o2::constants::lhc::LHCBunchSpacingNS);
353+
int tdc = int((time - nbc * o2::constants::lhc::LHCBunchSpacingNS) / .01);
354+
nbc += mEventTime.toLong();
355+
356+
LOG(debug) << nbc << "\t" << tdc;
357+
348358
auto key = o2::iotof::Digit::getOrderingKey(chip.getChipIndex(), row, col);
349359
o2::iotof::LabeledDigit* existingDigit = chip.findDigit(key);
350360
if (!existingDigit) {

0 commit comments

Comments
 (0)