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
13 changes: 6 additions & 7 deletions Detectors/Upgrades/ALICE3/IOTOF/macros/CheckClustersIOTOF.C
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ void CheckClustersIOTOF(std::string clusfile = "tf3clusters.root",
const auto& rofRec = rofRecVec[irof];
rofRec.print();


// >> read and map MC events contributing to this ROF
for (int im = 0; im <= nEvts; im++) {
if (!hitVecPool[im]) {
Expand Down Expand Up @@ -219,32 +218,32 @@ void CheckClustersIOTOF(std::string clusfile = "tf3clusters.root",
continue;
}
// std::cout << "CIAO2" << std::endl;

uint32_t topoKey = TopologyClassifier::makeKey(spanRow, spanCol, pattID);
errX = topoClassifier.getErrX(topoKey);
errZ = topoClassifier.getErrZ(topoKey);
npix = topoClassifier.getNPixels(topoKey);
auto chipID = cluster.getSensorID();
// std::cout << "CIAO3" << std::endl;

// Transformation to the local --> global
locC = topoClassifier.getClusterCoordinates(cluster);
// std::cout << "CIAO31" << std::endl;
auto gloC = gman->getMatrixL2G(chipID) * locC;
// std::cout << "CIAO32" << std::endl;

// Check how many labels are there
if (clusLabArr->getLabels(clEntry).empty()) {
continue;
}
const auto& lab = (clusLabArr->getLabels(clEntry))[0];
// std::cout << "CIAO33" << std::endl;

// std::cout << "CIAO4" << std::endl;
if (!lab.isValid() || lab.getSourceID() == QEDSourceID)
continue;
// std::cout << "CIAO5" << std::endl;

// get MC info
int trID = lab.getTrackID();
const auto& mc2hit = mc2hitVec[lab.getEventID()];
Expand All @@ -261,7 +260,7 @@ void CheckClustersIOTOF(std::string clusfile = "tf3clusters.root",
float dx = 0, dz = 0;
int ievH = lab.getEventID();
o2::math_utils::Point3D<float> locH, locHsta;

// mean local position of the hit
locH = gman->getMatrixL2G(chipID) ^ (hit.GetPos()); // inverse conversion from global to local
locHsta = gman->getMatrixL2G(chipID) ^ (hit.GetPosStart());
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 @@ -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,14 +115,15 @@ 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 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; };

// 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 @@ -137,8 +140,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
16 changes: 8 additions & 8 deletions Detectors/Upgrades/ALICE3/IOTOF/reconstruction/src/Clusterer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ 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
Expand Down Expand Up @@ -258,9 +258,9 @@ void Clusterer::ClustererThread::findClustersMultipleHits(gsl::span<const Digit>
Cluster cluster(minRow, minCol, rowSpan, colSpan, firedDigitsMask, clsTopology, chipID, time);

LOG(debug) << "Pushing back cluster with row: " << row << ", col: " << col << ", rowSpan: " << rowSpan
<< ", colSpan: " << colSpan << ", pattern: " << firedDigitsMask
<< ", topology: " << clsTopology << ", chipID: " << chipID
<< ", time: " << time;
<< ", colSpan: " << colSpan << ", pattern: " << firedDigitsMask
<< ", topology: " << clsTopology << ", chipID: " << chipID
<< ", time: " << time;

mClusters.emplace_back(cluster);
mPatterns.emplace_back(static_cast<unsigned char>(firedDigitsMask));
Expand Down Expand Up @@ -304,7 +304,7 @@ void Clusterer::ClustererThread::findClustersMultipleHits(gsl::span<const Digit>
const auto& digit = digits[idx];
const uint16_t rowOffset = digit.getRow() - minRow;
const uint16_t colOffset = digit.getColumn() - minCol;

// Single bit position calculation
const uint16_t bitIndex = rowOffset * colSpan + colOffset;

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