Skip to content

Commit c228bd7

Browse files
committed
recompute time from bc and tdc
1 parent c985746 commit c228bd7

3 files changed

Lines changed: 31 additions & 10 deletions

File tree

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,19 @@ class Cluster
113113
static constexpr uint16_t InvalidPatternID = static_cast<uint16_t>(ClusterInfo::MaskPattern);
114114

115115
Cluster() = default;
116-
Cluster(UShort_t row, UShort_t col, UShort_t rowSpan, UShort_t colSpan, UShort_t patt, UShort_t topo, UShort_t chipID = 0, time_t time = 0.0f)
117-
: mChipID(chipID), mTime(time)
116+
Cluster(UShort_t row, UShort_t col, UShort_t rowSpan, UShort_t colSpan, UShort_t patt, UShort_t topo, UShort_t chipID = 0, time_t time = 0.0f, uint64_t bc = 0, float timeWrtBc = 0.0f)
117+
: mChipID(chipID), mTime(time), mBc(bc), mTimeWrtBc(timeWrtBc)
118118
{
119119
mClusterInfo.data = ClusterInfo::pack(row, col, rowSpan, colSpan, patt, topo);
120120
}
121121

122-
void set(UShort_t row, UShort_t col, UShort_t rowSpan, UShort_t colSpan, UShort_t patt, UShort_t topo, UShort_t chipID, time_t time)
122+
void set(UShort_t row, UShort_t col, UShort_t rowSpan, UShort_t colSpan, UShort_t patt, UShort_t topo, UShort_t chipID, time_t time, uint64_t bc, float timeWrtBc)
123123
{
124124
mClusterInfo.data = ClusterInfo::pack(row, col, rowSpan, colSpan, patt, topo);
125125
mChipID = chipID;
126126
mTime = time;
127+
mBc = bc;
128+
mTimeWrtBc = timeWrtBc;
127129
}
128130

129131
// Unpack Getters
@@ -149,6 +151,9 @@ class Cluster
149151
uint32_t getChipID() const { return mChipID; }
150152
uint32_t getSensorID() const { return mChipID; }
151153
time_t getTime() const { return mTime; }
154+
uint64_t getBc() const { return mBc; }
155+
float gettimeWrtBc() const { return mTimeWrtBc; }
156+
152157
uint64_t getPackedData() const { return mClusterInfo.data; }
153158

154159
// Setters
@@ -174,6 +179,8 @@ class Cluster
174179
ClusterInfo mClusterInfo{}; ///< 64-bit packed structure containing geometry/topology
175180
UShort_t mChipID{0}; ///< Chip / Sensor ID
176181
float mTime{0.0f}; ///< Hit timing information
182+
uint64_t mBc{0}; ///< Number of bunch crossing
183+
float mTimeWrtBc{0.0f}; ///< Cluster time w.r.t. BC
177184

178185
void sanityCheck();
179186

‎Detectors/Upgrades/ALICE3/IOTOF/reconstruction/include/IOTOFReconstruction/Clusterer.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "SimulationDataFormat/ConstMCTruthContainer.h"
2525
#include "SimulationDataFormat/MCCompLabel.h"
2626
#include "SimulationDataFormat/MCTruthContainer.h"
27+
#include "CommonConstants/LHCConstants.h"
2728
#include <gsl/span>
2829
#include <vector>
2930
#include <array>

‎Detectors/Upgrades/ALICE3/IOTOF/reconstruction/src/Clusterer.cxx‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,15 @@ void Clusterer::ClustererThread::findClustersSingleHit(gsl::span<const Digit> di
170170
const ConstDigitTruth* labelsDigPtr,
171171
ClusterTruth* labelsClusPtr)
172172
{
173+
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
173174
const auto& digit = digits[digitIdx];
174175
const uint16_t chipID = digit.getChipIndex();
175176
const uint16_t row = digit.getRow();
176177
const uint16_t col = digit.getColumn();
177-
const time_t time = digit.getTime();
178+
//const time_t time = digit.getTime();
179+
uint64_t nbc = digit.getBc();
180+
float timeWrtBc = digit.getTdc() * digitizerParams.tdcBin;
181+
const time_t time = timeWrtBc + nbc * o2::constants::lhc::LHCBunchSpacingNS;
178182

179183
if (labelsClusPtr) {
180184
int nStoredLabels = 0;
@@ -192,7 +196,7 @@ void Clusterer::ClustererThread::findClustersSingleHit(gsl::span<const Digit> di
192196
constexpr uint16_t firedDigitsMask = (1U << 0); // 0x0001 (1)
193197
mClsTopoClassifier.getTopology(firedDigitsMask, minRow, rowSpan, minCol, colSpan, clsTopology);
194198
// Bit 0 corresponds to (rowOffset=0, colOffset=0) in row-major order
195-
Cluster cluster(row, col, rowSpan, colSpan, firedDigitsMask, clsTopology, chipID, time);
199+
Cluster cluster(row, col, rowSpan, colSpan, firedDigitsMask, clsTopology, chipID, time, nbc, timeWrtBc);
196200

197201
LOG(debug) << "Pushing back cluster with row: " << row << ", col: " << col
198202
<< ", rowSpan: " << static_cast<int>(rowSpan) << ", colSpan: " << static_cast<int>(colSpan)
@@ -270,7 +274,10 @@ void Clusterer::ClustererThread::findClustersMultipleHits(gsl::span<const Digit>
270274
const auto& digit = digits[precluster[0]];
271275
const uint16_t row = digit.getRow();
272276
const uint16_t col = digit.getColumn();
273-
const time_t time = digit.getTime();
277+
// const time_t time = digit.getTime();
278+
uint64_t nbc = digit.getBc();
279+
float timeWrtBc = digit.getTdc() * digitizerParams.tdcBin;
280+
const time_t time = timeWrtBc + nbc * o2::constants::lhc::LHCBunchSpacingNS;
274281

275282
if (labelsClusPtr) {
276283
int nMcLabels = 0;
@@ -288,7 +295,7 @@ void Clusterer::ClustererThread::findClustersMultipleHits(gsl::span<const Digit>
288295
constexpr uint16_t firedDigitsMask = (1U << 0); // 0x0001 (1)
289296
mClsTopoClassifier.getTopology(firedDigitsMask, minRow, rowSpan, minCol, colSpan, clsTopology);
290297
// Bit 0 corresponds to (rowOffset=0, colOffset=0) in row-major order
291-
Cluster cluster(minRow, minCol, rowSpan, colSpan, firedDigitsMask, clsTopology, chipID, time);
298+
Cluster cluster(minRow, minCol, rowSpan, colSpan, firedDigitsMask, clsTopology, chipID, time, nbc, timeWrtBc);
292299

293300
LOG(debug) << "Pushing back cluster with row: " << row << ", col: " << col
294301
<< ", rowSpan: " << static_cast<int>(rowSpan) << ", colSpan: " << static_cast<int>(colSpan)
@@ -314,19 +321,25 @@ void Clusterer::ClustererThread::findClustersMultipleHits(gsl::span<const Digit>
314321
minCol = std::min(minCol, digit.getColumn());
315322
maxRow = std::max(maxRow, digit.getRow());
316323
maxCol = std::max(maxCol, digit.getColumn());
317-
clsTime += digit.getTime();
324+
uint64_t nbc = digit.getBc();
325+
float timeWrtBc = digit.getTdc() * digitizerParams.tdcBin;
326+
const time_t time = timeWrtBc + nbc * o2::constants::lhc::LHCBunchSpacingNS;
327+
clsTime += time;
318328
fetchMCLabels(idx, labelsDigPtr, nMcLabels);
319329
}
320330
clsTime /= precluster.size();
321331
const uint8_t rowSpan = maxRow - minRow + 1;
322332
const uint8_t colSpan = maxCol - minCol + 1;
323333

334+
uint64_t nbc = static_cast<uint64_t>(clsTime / o2::constants::lhc::LHCBunchSpacingNS);
335+
float timeWrtBc = clsTime - nbc * o2::constants::lhc::LHCBunchSpacingNS;
336+
324337
// Fired digits bitmask packed into a single 16-bit pattern variable
325338
uint16_t firedDigitsMask = 0;
326339

327340
if (rowSpan * colSpan > maxFiredDigitsForCls) {
328341
// Overflow precluster: pass InvalidPatternID (or 0) and kHuge topology flag
329-
Cluster cluster(minRow, minCol, rowSpan, colSpan, Cluster::InvalidPatternID, Topologies::kHuge, chipID, clsTime);
342+
Cluster cluster(minRow, minCol, rowSpan, colSpan, Cluster::InvalidPatternID, Topologies::kHuge, chipID, clsTime, nbc, timeWrtBc);
330343
mClusters.emplace_back(cluster);
331344
mPatterns.emplace_back(Cluster::InvalidPatternID);
332345
continue;
@@ -354,7 +367,7 @@ void Clusterer::ClustererThread::findClustersMultipleHits(gsl::span<const Digit>
354367
for (int i = 0; i < nMcLabels; i++) {
355368
mLabels.addElement(nStoredCls, mLabelsBuff[i]);
356369
}
357-
Cluster cluster(minRow, minCol, rowSpan, colSpan, firedDigitsMask, clsTopology, chipID, clsTime);
370+
Cluster cluster(minRow, minCol, rowSpan, colSpan, firedDigitsMask, clsTopology, chipID, clsTime, nbc, timeWrtBc);
358371
LOG(debug) << "Pushing back cluster with row: " << minRow << ", col: " << minCol
359372
<< ", rowSpan: " << static_cast<int>(rowSpan) << ", colSpan: " << static_cast<int>(colSpan)
360373
<< ", pattern: " << firedDigitsMask << ", topology: " << static_cast<int>(clsTopology)

0 commit comments

Comments
 (0)