Skip to content
Merged
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
10 changes: 5 additions & 5 deletions Detectors/Upgrades/ALICE3/IOTOF/macros/CheckClustersIOTOF.C
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ void addTLines(float pitchRow, float pitchCol)
while (xRow > xmin) {
TLine* lineNeg = new TLine(xRow, ymin, xRow, ymax);
lineNeg->SetLineStyle(2);
lineNeg->SetLineColor(kGray+3);
lineNeg->SetLineColor(kGray + 3);
lineNeg->Draw("same");
TLine* linePos = new TLine(std::abs(xRow), ymin, std::abs(xRow), ymax);
linePos->SetLineStyle(2);
linePos->SetLineColor(kGray+3);
linePos->SetLineColor(kGray + 3);
linePos->Draw("same");
xRow -= pitchRow / 2;
}
Expand All @@ -83,11 +83,11 @@ void addTLines(float pitchRow, float pitchCol)
while (yCol > ymin) {
TLine* lineNeg = new TLine(xmin, yCol, xmax, yCol);
lineNeg->SetLineStyle(2);
lineNeg->SetLineColor(kGray+3);
lineNeg->SetLineColor(kGray + 3);
lineNeg->Draw("same");
TLine* linePos = new TLine(xmin, std::abs(yCol), xmax, std::abs(yCol));
linePos->SetLineStyle(2);
linePos->SetLineColor(kGray+3);
linePos->SetLineColor(kGray + 3);
linePos->Draw("same");
yCol -= pitchCol / 2;
}
Expand Down Expand Up @@ -260,7 +260,7 @@ void CheckClustersIOTOF(std::string clusfile = "tf3clusters.root",
closestHitIdx = 0;
} else {
float maxDist = std::numeric_limits<float>::max();
for (int iHitIdx=0; iHitIdx < hitEntry->second.size(); iHitIdx++) {
for (int iHitIdx = 0; iHitIdx < hitEntry->second.size(); iHitIdx++) {
const o2::itsmft::Hit* hit = &((*hitArray)[hitEntry->second[iHitIdx]]);
if (!hit) {
LOG(error) << "Failed to find matching hit for Track: " << trID << ", chipID: " << chipID << ", eventID: " << evID;
Expand Down
8 changes: 4 additions & 4 deletions Detectors/Upgrades/ALICE3/IOTOF/macros/CheckDigitsIOTOF.C
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ void addTLines(float pitchRow, float pitchCol)
while (xRow > xmin) {
TLine* lineNeg = new TLine(xRow, ymin, xRow, ymax);
lineNeg->SetLineStyle(2);
lineNeg->SetLineColor(kGray+3);
lineNeg->SetLineColor(kGray + 3);
lineNeg->Draw("same");
TLine* linePos = new TLine(std::abs(xRow), ymin, std::abs(xRow), ymax);
linePos->SetLineStyle(2);
linePos->SetLineColor(kGray+3);
linePos->SetLineColor(kGray + 3);
linePos->Draw("same");
xRow -= pitchRow / 2;
}
Expand All @@ -72,11 +72,11 @@ void addTLines(float pitchRow, float pitchCol)
while (yCol > ymin) {
TLine* lineNeg = new TLine(xmin, yCol, xmax, yCol);
lineNeg->SetLineStyle(2);
lineNeg->SetLineColor(kGray+3);
lineNeg->SetLineColor(kGray + 3);
lineNeg->Draw("same");
TLine* linePos = new TLine(xmin, std::abs(yCol), xmax, std::abs(yCol));
linePos->SetLineStyle(2);
linePos->SetLineColor(kGray+3);
linePos->SetLineColor(kGray + 3);
linePos->Draw("same");
yCol -= pitchCol / 2;
}
Expand Down
27 changes: 16 additions & 11 deletions Detectors/Upgrades/ALICE3/IOTOF/macros/CheckTopologiesIOTOF.C
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <algorithm>
#include <bitset>

#include "TFile.h"
#include "TH2F.h"
#include "TGraphErrors.h"

Check failure on line 10 in Detectors/Upgrades/ALICE3/IOTOF/macros/CheckTopologiesIOTOF.C

View workflow job for this annotation

GitHub Actions / PR formatting / copyright headers

Missing or malformed copyright notice

This source file is missing the correct copyright notice.

#include "Framework/Logger.h"
#include "IOTOFBase/IOTOFBaseParam.h"
Expand Down Expand Up @@ -54,11 +54,16 @@
int nPixelsB = b.second.mNPixels;
int frequencyA = a.second.mFrequency;
int frequencyB = b.second.mFrequency;
if (topoA != topoB) return topoA < topoB;
if (frequencyA != frequencyB) return frequencyA > frequencyB;
if (spanRowA != spanRowB) return spanRowA < spanRowB;
if (spanColA != spanColB) return spanColA < spanColB;
if (nPixelsA != nPixelsB) return nPixelsA < nPixelsB;
if (topoA != topoB)
return topoA < topoB;
if (frequencyA != frequencyB)
return frequencyA > frequencyB;
if (spanRowA != spanRowB)
return spanRowA < spanRowB;
if (spanColA != spanColB)
return spanColA < spanColB;
if (nPixelsA != nPixelsB)
return nPixelsA < nPixelsB;
return a.first < b.first; // Finally sort by bitmask if spans are equal
});

Expand All @@ -81,9 +86,9 @@

// Topology names
const std::array<std::string, kNTopologies> topologyNames = {
"kSingleDigit", "kLineOnRow", "kLineOnCol", "kSquare", "kRectangle", "kDiagonal",
"kLowerTriangleLeft", "kLowerTriangleRight", "kUpperTriangleLeft", "kUpperTriangleRight",
"kSnake", "kSnakeRefl", "kSnakeRot90", "kSnakeRot90Refl", "kHuge", "kOther"};
"kSingleDigit", "kLineOnRow", "kLineOnCol", "kSquare", "kRectangle", "kDiagonal",
"kLowerTriangleLeft", "kLowerTriangleRight", "kUpperTriangleLeft", "kUpperTriangleRight",
"kSnake", "kSnakeRefl", "kSnakeRot90", "kSnakeRot90Refl", "kHuge", "kOther"};

// Create output ROOT file
auto* outFile = TFile::Open(outFileName, "RECREATE");
Expand Down Expand Up @@ -113,7 +118,7 @@
float maxRowCoord = chipInfo.PitchRow * (spanRow + 0.5);
float minColCoord = -1.5 * chipInfo.PitchCol;
float maxColCoord = chipInfo.PitchCol * (spanCol + 0.5);
TH2F* hTopoDisplay = new TH2F(Form("spanRow_%i_spanCol_%i_key_%i_all", spanRow, spanCol, topoKey), Form("Cluster Topology %s;Row;Column", topoName.c_str()),
TH2F* hTopoDisplay = new TH2F(Form("spanRow_%i_spanCol_%i_key_%i_all", spanRow, spanCol, topoKey), Form("Cluster Topology %s;Row;Column", topoName.c_str()),
spanRow + 2, minRowCoord, maxRowCoord, spanCol + 2, minColCoord, maxColCoord);

// One-point TGraph for COG
Expand All @@ -125,12 +130,12 @@
gTopoCOG->SetMarkerStyle(20);
gTopoCOG->SetMarkerColor(kBlue);

// Loop over the bits of bitmask and fill the histogram
// Loop over the bits of bitmask and fill the histogram
for (int row = 0; row < spanRow; ++row) {
for (int col = 0; col < spanCol; ++col) {
int bitIndex = row * spanCol + col;
if (bitmask & (1 << bitIndex)) {
hTopoDisplay->SetBinContent(row+2, col+2, frequency);
hTopoDisplay->SetBinContent(row + 2, col + 2, frequency);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Clusterer
const ConstDigitTruth* labelsDigPtr, ClusterTruth* labelsClusPtr);
void findClustersMultipleHits(gsl::span<const Digit> digits, gsl::span<const uint32_t> digitIdxs,
const ConstDigitTruth* labelsDigPtr, ClusterTruth* labelsClusPtr);
std::vector<std::vector<uint32_t>> buildPreclusters(gsl::span<const Digit> digits,
std::vector<std::vector<uint32_t>> buildPreclusters(gsl::span<const Digit> digits,
gsl::span<const uint32_t> digitIdxs,
int maxTimeDiffNSigma,
float timeResolution);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ class TopologyClassifier
static constexpr uint8_t MaxColSpan = 255;
static constexpr uint16_t MaxBitmask = 65535;

TopologyClassifier() {
TopologyClassifier()
{
sSegmentation = o2::iotof::Segmentation::Instance();
}
TopologyClassifier(std::unordered_map<uint32_t, TopologyInfo> map) : mTopologyCache(std::move(map)) {
TopologyClassifier(std::unordered_map<uint32_t, TopologyInfo> map) : mTopologyCache(std::move(map))
{
sSegmentation = o2::iotof::Segmentation::Instance();
}

Expand All @@ -113,16 +115,17 @@ class TopologyClassifier
void saveCacheToFile(const char* filename);
void print();

float getErrX(uint32_t pattID) {return std::sqrt(getTopologyFeatures(pattID).mXSigma2);};
float getErrZ(uint32_t pattID) {return std::sqrt(getTopologyFeatures(pattID).mZSigma2);};
float getNPixels(uint32_t pattID) {return getTopologyFeatures(pattID).mNPixels;};
float getMeanX(uint32_t pattID) {return getTopologyFeatures(pattID).mXMean;};
float getMeanZ(uint32_t pattID) {return getTopologyFeatures(pattID).mZMean;};
float getErrX(uint32_t pattID) { return std::sqrt(getTopologyFeatures(pattID).mXSigma2); };
float getErrZ(uint32_t pattID) { return std::sqrt(getTopologyFeatures(pattID).mZSigma2); };
float getNPixels(uint32_t pattID) { return getTopologyFeatures(pattID).mNPixels; };
float getMeanX(uint32_t pattID) { return getTopologyFeatures(pattID).mXMean; };
float getMeanZ(uint32_t pattID) { return getTopologyFeatures(pattID).mZMean; };

// Provide the common iotof::GeometryTGeo to access matrices and segmentation
void setGeometry(const o2::iotof::GeometryTGeo* gm) { mGeometry = gm; }

static uint32_t makeKey(uint8_t spanRow, uint8_t spanCol, uint16_t bitmask) {
static uint32_t makeKey(uint8_t spanRow, uint8_t spanCol, uint16_t bitmask)
{
return (static_cast<uint32_t>(spanRow) << 24) |
(static_cast<uint32_t>(spanCol) << 16) |
static_cast<uint32_t>(bitmask);
Expand All @@ -139,8 +142,7 @@ class TopologyClassifier

std::unordered_map<uint32_t, TopologyInfo> mTopologyCache;
const o2::iotof::GeometryTGeo* mGeometry = nullptr; ///< IOTOF geometry
static o2::iotof::Segmentation* sSegmentation; ///< IOTOF segmentation instance (singleton)

static o2::iotof::Segmentation* sSegmentation; ///< IOTOF segmentation instance (singleton)
};

} // namespace iotof
Expand Down
20 changes: 10 additions & 10 deletions Detectors/Upgrades/ALICE3/IOTOF/reconstruction/src/Clusterer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,22 @@ void Clusterer::ClustererThread::processChip(gsl::span<const Digit> digits,
}

findClustersMultipleHits(
digits,
gsl::span<const uint32_t>(digitIdxs),
labelsDigPtr,
labelsClusPtr);
digits,
gsl::span<const uint32_t>(digitIdxs),
labelsDigPtr,
labelsClusPtr);
}

// Flush per-thread output into the caller's containers

// Push-back cluster labels, dummy labels for clusters with
// Push-back cluster labels, dummy labels for clusters with
// empty labels, to ensure that the clusterLabels container
// WWhas the same size as the clustersOut container.
// WWhas the same size as the clustersOut container.
if (labelsClusPtr) {
const size_t base = clustersOut->size(); // before inserting this chip's clusters
const size_t base = clustersOut->size(); // before inserting this chip's clusters
// and store labels as you go, or copy from mLabels:
for (size_t i = 0; i < mClusters.size(); ++i) {
auto labels = mLabels.getLabels(i); // empty span if none
auto labels = mLabels.getLabels(i); // empty span if none
if (labels.empty()) {
labelsClusPtr->addNoLabelIndex(base + i);
} else {
Expand Down Expand Up @@ -210,8 +210,8 @@ std::vector<std::vector<uint32_t>> Clusterer::ClustererThread::buildPreclusters(

auto areNeighbours = [&](const Digit& a, const Digit& b) {
return std::abs(static_cast<int>(a.getRow()) - static_cast<int>(b.getRow())) <= 1 &&
std::abs(static_cast<int>(a.getColumn()) - static_cast<int>(b.getColumn())) <= 1 &&
std::abs(a.getTime() - b.getTime()) <= maxTimeDiffNSigma * timeResolution;
std::abs(static_cast<int>(a.getColumn()) - static_cast<int>(b.getColumn())) <= 1 &&
std::abs(a.getTime() - b.getTime()) <= maxTimeDiffNSigma * timeResolution;
};

for (size_t i = 0; i < digitIdxs.size(); ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <TKey.h>
#include <TRandom.h>


#include <set>
#include <vector>
#include <iostream>
Expand Down
Loading