Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,19 @@ class Cluster
static constexpr uint16_t InvalidPatternID = static_cast<uint16_t>(ClusterInfo::MaskPattern);

Cluster() = default;
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)
: mChipID(chipID), mTime(time)
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)
: mChipID(chipID), mTime(time), mBc(bc), mTimeWrtBc(timeWrtBc)
{
mClusterInfo.data = ClusterInfo::pack(row, col, rowSpan, colSpan, patt, topo);
}

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)
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)
{
mClusterInfo.data = ClusterInfo::pack(row, col, rowSpan, colSpan, patt, topo);
mChipID = chipID;
mTime = time;
mBc = bc;
mTimeWrtBc = timeWrtBc;
}

// Unpack Getters
Expand All @@ -149,6 +151,9 @@ class Cluster
uint32_t getChipID() const { return mChipID; }
uint32_t getSensorID() const { return mChipID; }
time_t getTime() const { return mTime; }
uint64_t getBc() const { return mBc; }
float getTimeWrtBc() const { return mTimeWrtBc; }

uint64_t getPackedData() const { return mClusterInfo.data; }

// Setters
Expand All @@ -160,6 +165,8 @@ class Cluster
void setTopology(UShort_t t) { mClusterInfo.setTopology(t); }
void setChipID(UShort_t c) { mChipID = c; }
void setTime(time_t t) { mTime = t; }
void setBc(uint64_t bc) { mBc = bc; }
void setTimeWrtBc(float timeWrtBc) { mTimeWrtBc = timeWrtBc; }

// Operators & Debugging
bool operator==(const Cluster& cl) const
Expand All @@ -174,6 +181,8 @@ class Cluster
ClusterInfo mClusterInfo{}; ///< 64-bit packed structure containing geometry/topology
UShort_t mChipID{0}; ///< Chip / Sensor ID
float mTime{0.0f}; ///< Hit timing information
uint64_t mBc{0}; ///< Number of bunch crossing
float mTimeWrtBc{0.0f}; ///< Cluster time w.r.t. BC

void sanityCheck();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "SimulationDataFormat/ConstMCTruthContainer.h"
#include "SimulationDataFormat/MCCompLabel.h"
#include "SimulationDataFormat/MCTruthContainer.h"
#include "CommonConstants/LHCConstants.h"
#include <gsl/span>
#include <vector>
#include <array>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,15 @@ void Clusterer::ClustererThread::findClustersSingleHit(gsl::span<const Digit> di
const ConstDigitTruth* labelsDigPtr,
ClusterTruth* labelsClusPtr)
{
const auto& digitizerParams = o2::iotof::DPLDigitizerParam::Instance();
const auto& digit = digits[digitIdx];
const uint16_t chipID = digit.getChipIndex();
const uint16_t row = digit.getRow();
const uint16_t col = digit.getColumn();
const time_t time = digit.getTime();
// const time_t time = digit.getTime();
const uint64_t nbc = digit.getBc();
const float timeWrtBc = digit.getTdc() * digitizerParams.tdcBin;
const time_t time = timeWrtBc + nbc * o2::constants::lhc::LHCBunchSpacingNS;

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

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

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

LOG(debug) << "Pushing back cluster with row: " << row << ", col: " << col
<< ", rowSpan: " << static_cast<int>(rowSpan) << ", colSpan: " << static_cast<int>(colSpan)
Expand All @@ -314,19 +321,23 @@ void Clusterer::ClustererThread::findClustersMultipleHits(gsl::span<const Digit>
minCol = std::min(minCol, digit.getColumn());
maxRow = std::max(maxRow, digit.getRow());
maxCol = std::max(maxCol, digit.getColumn());
clsTime += digit.getTime();
const time_t time = digit.getTdc() * digitizerParams.tdcBin + digit.getBc() * o2::constants::lhc::LHCBunchSpacingNS;
clsTime += time;
fetchMCLabels(idx, labelsDigPtr, nMcLabels);
}
clsTime /= precluster.size();
const uint8_t rowSpan = maxRow - minRow + 1;
const uint8_t colSpan = maxCol - minCol + 1;

const uint64_t nbc = static_cast<uint64_t>(clsTime / o2::constants::lhc::LHCBunchSpacingNS);
const float timeWrtBc = clsTime - nbc * o2::constants::lhc::LHCBunchSpacingNS;

// Fired digits bitmask packed into a single 16-bit pattern variable
uint16_t firedDigitsMask = 0;

if (rowSpan * colSpan > maxFiredDigitsForCls) {
// Overflow precluster: pass InvalidPatternID (or 0) and kHuge topology flag
Cluster cluster(minRow, minCol, rowSpan, colSpan, Cluster::InvalidPatternID, Topologies::kHuge, chipID, clsTime);
Cluster cluster(minRow, minCol, rowSpan, colSpan, Cluster::InvalidPatternID, Topologies::kHuge, chipID, clsTime, nbc, timeWrtBc);
mClusters.emplace_back(cluster);
mPatterns.emplace_back(Cluster::InvalidPatternID);
continue;
Expand Down Expand Up @@ -354,7 +365,7 @@ void Clusterer::ClustererThread::findClustersMultipleHits(gsl::span<const Digit>
for (int i = 0; i < nMcLabels; i++) {
mLabels.addElement(nStoredCls, mLabelsBuff[i]);
}
Cluster cluster(minRow, minCol, rowSpan, colSpan, firedDigitsMask, clsTopology, chipID, clsTime);
Cluster cluster(minRow, minCol, rowSpan, colSpan, firedDigitsMask, clsTopology, chipID, clsTime, nbc, timeWrtBc);
LOG(debug) << "Pushing back cluster with row: " << minRow << ", col: " << minCol
<< ", rowSpan: " << static_cast<int>(rowSpan) << ", colSpan: " << static_cast<int>(colSpan)
<< ", pattern: " << firedDigitsMask << ", topology: " << static_cast<int>(clsTopology)
Expand Down
Loading