From a5fbc4725145cde25cdc79ee25097b4e04efb7b6 Mon Sep 17 00:00:00 2001 From: Nicolo Valle Date: Thu, 12 Jun 2025 17:10:23 +0200 Subject: [PATCH 1/4] WIP - Cluster occupancy distribution for ITS --- Modules/ITS/include/ITS/ITSClusterTask.h | 1 + Modules/ITS/src/ITSClusterTask.cxx | 25 ++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Modules/ITS/include/ITS/ITSClusterTask.h b/Modules/ITS/include/ITS/ITSClusterTask.h index f48ca10b1e..c652ad84fe 100644 --- a/Modules/ITS/include/ITS/ITSClusterTask.h +++ b/Modules/ITS/include/ITS/ITSClusterTask.h @@ -96,6 +96,7 @@ class ITSClusterTask : public TaskInterface TH1L* hClusterSizeLayerSummary[NLayer] = { nullptr }; TH1L* hClusterTopologyLayerSummary[NLayer] = { nullptr }; TH1L* hGroupedClusterSizeLayerSummary[NLayer] = { nullptr }; + TH1D* hClusterOccupancyDistribution[NLayer] = { nullptr }; // number of clusters with npix > 1, per chip, per ROF // Anomalies plots TH2D* hLongClustersPerChip[3] = { nullptr }; diff --git a/Modules/ITS/src/ITSClusterTask.cxx b/Modules/ITS/src/ITSClusterTask.cxx index 065fb4043f..b8976a0ac9 100644 --- a/Modules/ITS/src/ITSClusterTask.cxx +++ b/Modules/ITS/src/ITSClusterTask.cxx @@ -54,6 +54,7 @@ ITSClusterTask::~ITSClusterTask() delete hClusterSizeLayerSummary[iLayer]; delete hClusterTopologyLayerSummary[iLayer]; delete hGroupedClusterSizeLayerSummary[iLayer]; + delete hClusterOccupancyDistribution[iLayer]; if (mDoPublish1DSummary == 1) { if (iLayer < NLayerIB) { @@ -154,7 +155,8 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx) const auto& ROF = clusRofArr[iROF]; const auto bcdata = ROF.getBCData(); - int nClustersForBunchCrossing = 0; + int nClusters3pixLay[7] = {0}; + int nClusters3pix = 0; int nLongClusters[ChipBoundary[NLayerIB]] = {}; int nHitsFromClusters[ChipBoundary[NLayerIB]] = {}; // only IB is implemented at the moment @@ -213,7 +215,8 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx) } if (npix > 2) { - nClustersForBunchCrossing++; + nClusters3pixLay[lay]++; + nClusters3pix++; } if (lay < NLayerIB) { @@ -273,7 +276,15 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx) hAverageClusterSizeSummaryFine[lay]->getNum()->Fill(getHorizontalBin(locC.Z(), chip, lay, lane), getVerticalBin(locC.X(), sta, lay), (float)npix); } } - hClusterVsBunchCrossing->Fill(bcdata.bc, nClustersForBunchCrossing); // we count only the number of clusters, not their sizes + hClusterVsBunchCrossing->Fill(bcdata.bc, nClusters3pix); // we count only the number of clusters, not their sizes + for (int lay = 0; lay < 7; lay++){ + if (nClusters3pixLay[lay] > 0){ + int nchips = mNStaves[lay]*mNHicPerStave[lay]*mNChipsPerHic[lay]; + hClusterOccupancyDistribution[lay]->Fill(TMath::Log10(1.*nClusters3pixLay[lay]/nchips)); + } + } + + // filling these anomaly plots once per ROF, ignoring chips w/o long clusters for (int ichip = 0; ichip < ChipBoundary[NLayerIB]; ichip++) { @@ -438,7 +449,7 @@ void ITSClusterTask::reset() void ITSClusterTask::createAllHistos() { - hClusterVsBunchCrossing = new TH2D("BunchCrossingIDvsClusters", "BunchCrossingIDvsClusters", nBCbins, 0, 4095, 100, 0, 2000); + hClusterVsBunchCrossing = new TH2D("BunchCrossingIDvsClusters", "BunchCrossingIDvsClusters", nBCbins, 0, 4095, 150, 0, 3000); hClusterVsBunchCrossing->SetTitle("#clusters vs BC id for clusters with npix > 2"); addObject(hClusterVsBunchCrossing); formatAxes(hClusterVsBunchCrossing, "Bunch Crossing ID", "Number of clusters with npix > 2 in ROF", 1, 1.10); @@ -478,6 +489,12 @@ void ITSClusterTask::createAllHistos() formatAxes(hClusterSizeLayerSummary[iLayer], "Cluster Size (pixels)", "counts", 1, 1.10); hClusterSizeLayerSummary[iLayer]->SetStats(0); + hClusterOccupancyDistribution[iLayer] = new TH1D(Form("Layer%d/ClustersPerChipPerEvt", iLayer), Form("Layer%d/ClustersPerChipPerEvt", iLayer), 100, -4, 5); + hClusterOccupancyDistribution[iLayer]->SetTitle(Form("log10 n_clusters with npix > 2 / chip / evt - Layer%d",iLayer)); + addObject(hClusterOccupancyDistribution[iLayer]); + formatAxes(hClusterOccupancyDistribution[iLayer],"n clus","events",1,1.10); + hClusterOccupancyDistribution[iLayer]->SetStats(0); + hGroupedClusterSizeLayerSummary[iLayer] = new TH1L(Form("Layer%d/AverageGroupedClusterSizeSummary", iLayer), Form("Layer%dAverageGroupedClusterSizeSummary", iLayer), 128 * 128, 0, 128 * 128); hGroupedClusterSizeLayerSummary[iLayer]->SetTitle(Form("Cluster size summary for Layer %d", iLayer)); addObject(hGroupedClusterSizeLayerSummary[iLayer]); From a1e4219c77bb666feec12952b984ade87ce9df18 Mon Sep 17 00:00:00 2001 From: Nicolo Valle Date: Mon, 16 Jun 2025 18:06:23 +0200 Subject: [PATCH 2/4] Working version --- Modules/ITS/include/ITS/ITSClusterTask.h | 2 +- Modules/ITS/src/ITSClusterTask.cxx | 29 +++++++++++++++--------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Modules/ITS/include/ITS/ITSClusterTask.h b/Modules/ITS/include/ITS/ITSClusterTask.h index c652ad84fe..c1581458fd 100644 --- a/Modules/ITS/include/ITS/ITSClusterTask.h +++ b/Modules/ITS/include/ITS/ITSClusterTask.h @@ -96,7 +96,7 @@ class ITSClusterTask : public TaskInterface TH1L* hClusterSizeLayerSummary[NLayer] = { nullptr }; TH1L* hClusterTopologyLayerSummary[NLayer] = { nullptr }; TH1L* hGroupedClusterSizeLayerSummary[NLayer] = { nullptr }; - TH1D* hClusterOccupancyDistribution[NLayer] = { nullptr }; // number of clusters with npix > 1, per chip, per ROF + TH2D* hClusterOccupancyDistribution[NLayer] = { nullptr }; // number of clusters and hits per chip, per ROF. From clusters with npix > 2 // Anomalies plots TH2D* hLongClustersPerChip[3] = { nullptr }; diff --git a/Modules/ITS/src/ITSClusterTask.cxx b/Modules/ITS/src/ITSClusterTask.cxx index b8976a0ac9..e3cbb14e84 100644 --- a/Modules/ITS/src/ITSClusterTask.cxx +++ b/Modules/ITS/src/ITSClusterTask.cxx @@ -42,6 +42,7 @@ ITSClusterTask::~ITSClusterTask() { delete hEmptyLaneFractionGlobal; delete hClusterVsBunchCrossing; + for (int iLayer = 0; iLayer < NLayer; iLayer++) { if (!mEnableLayers[iLayer]) @@ -155,7 +156,8 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx) const auto& ROF = clusRofArr[iROF]; const auto bcdata = ROF.getBCData(); - int nClusters3pixLay[7] = {0}; + int nClusters3pixLay[7] = { 0 }; + int nDigits3pixLay[7] = { 0 }; int nClusters3pix = 0; int nLongClusters[ChipBoundary[NLayerIB]] = {}; int nHitsFromClusters[ChipBoundary[NLayerIB]] = {}; // only IB is implemented at the moment @@ -216,7 +218,8 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx) if (npix > 2) { nClusters3pixLay[lay]++; - nClusters3pix++; + nClusters3pix++; + nDigits3pixLay[lay] += npix; } if (lay < NLayerIB) { @@ -277,14 +280,12 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx) } } hClusterVsBunchCrossing->Fill(bcdata.bc, nClusters3pix); // we count only the number of clusters, not their sizes - for (int lay = 0; lay < 7; lay++){ - if (nClusters3pixLay[lay] > 0){ - int nchips = mNStaves[lay]*mNHicPerStave[lay]*mNChipsPerHic[lay]; - hClusterOccupancyDistribution[lay]->Fill(TMath::Log10(1.*nClusters3pixLay[lay]/nchips)); + for (int lay = 0; lay < 7; lay++) { + if (nClusters3pixLay[lay] > 0) { + int nchips = mNStaves[lay] * mNHicPerStave[lay] * mNChipsPerHic[lay]; + hClusterOccupancyDistribution[lay]->Fill(1. * nClusters3pixLay[lay] / nchips, 1. * nDigits3pixLay[lay] / nchips); } } - - // filling these anomaly plots once per ROF, ignoring chips w/o long clusters for (int ichip = 0; ichip < ChipBoundary[NLayerIB]; ichip++) { @@ -410,6 +411,7 @@ void ITSClusterTask::reset() if (!mEnableLayers[iLayer]) continue; + hClusterOccupancyDistribution[iLayer]->Reset(); hClusterSizeLayerSummary[iLayer]->Reset(); hGroupedClusterSizeLayerSummary[iLayer]->Reset(); hClusterTopologyLayerSummary[iLayer]->Reset(); @@ -489,10 +491,15 @@ void ITSClusterTask::createAllHistos() formatAxes(hClusterSizeLayerSummary[iLayer], "Cluster Size (pixels)", "counts", 1, 1.10); hClusterSizeLayerSummary[iLayer]->SetStats(0); - hClusterOccupancyDistribution[iLayer] = new TH1D(Form("Layer%d/ClustersPerChipPerEvt", iLayer), Form("Layer%d/ClustersPerChipPerEvt", iLayer), 100, -4, 5); - hClusterOccupancyDistribution[iLayer]->SetTitle(Form("log10 n_clusters with npix > 2 / chip / evt - Layer%d",iLayer)); + double dynbin[7][4] = { { 300, 100, 500, 1000 }, { 300, 100, 500, 1000 }, { 300, 100, 500, 1000 }, // IB + { 300, 5, 500, 50 }, + { 300, 5, 500, 50 }, // ML + { 300, 1.5, 500, 15 }, + { 300, 1.5, 500, 15 } }; // OL + hClusterOccupancyDistribution[iLayer] = new TH2D(Form("Layer%d/OccupancyPerChipPerEvt", iLayer), Form("Layer%d/OccupancyPerChipPerEvt", iLayer), (int)dynbin[iLayer][0], 0, dynbin[iLayer][1], (int)dynbin[iLayer][2], 0, dynbin[iLayer][3]); + hClusterOccupancyDistribution[iLayer]->SetTitle(Form("hits/chip/evt, form clusters with npix>2 - Layer%d", iLayer)); addObject(hClusterOccupancyDistribution[iLayer]); - formatAxes(hClusterOccupancyDistribution[iLayer],"n clus","events",1,1.10); + formatAxes(hClusterOccupancyDistribution[iLayer], "N clus", "N hit", 1, 1.10); hClusterOccupancyDistribution[iLayer]->SetStats(0); hGroupedClusterSizeLayerSummary[iLayer] = new TH1L(Form("Layer%d/AverageGroupedClusterSizeSummary", iLayer), Form("Layer%dAverageGroupedClusterSizeSummary", iLayer), 128 * 128, 0, 128 * 128); From a996138d47882eedc7fd9af86e43f803e14af198 Mon Sep 17 00:00:00 2001 From: Nicolo Valle Date: Thu, 19 Jun 2025 14:51:35 +0200 Subject: [PATCH 3/4] Adding TF counter --- Modules/ITS/include/ITS/ITSClusterTask.h | 3 +++ Modules/ITS/src/ITSClusterTask.cxx | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/Modules/ITS/include/ITS/ITSClusterTask.h b/Modules/ITS/include/ITS/ITSClusterTask.h index c1581458fd..854d847877 100644 --- a/Modules/ITS/include/ITS/ITSClusterTask.h +++ b/Modules/ITS/include/ITS/ITSClusterTask.h @@ -77,6 +77,9 @@ class ITSClusterTask : public TaskInterface std::vector mPublishedObjects; + // Task + TH1D* hTFCounter = nullptr; + // Inner barrel TH1D* hClusterTopologySummaryIB[NLayer][48][9] = { { { nullptr } } }; TH1D* hGroupedClusterSizeSummaryIB[NLayer][48][9] = { { { nullptr } } }; diff --git a/Modules/ITS/src/ITSClusterTask.cxx b/Modules/ITS/src/ITSClusterTask.cxx index e3cbb14e84..0b9716f6c6 100644 --- a/Modules/ITS/src/ITSClusterTask.cxx +++ b/Modules/ITS/src/ITSClusterTask.cxx @@ -40,6 +40,7 @@ ITSClusterTask::ITSClusterTask() : TaskInterface() {} ITSClusterTask::~ITSClusterTask() { + delete hTFCounter; delete hEmptyLaneFractionGlobal; delete hClusterVsBunchCrossing; @@ -370,6 +371,8 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx) } } + hTFCounter->Fill(0); + end = std::chrono::high_resolution_clock::now(); difference = std::chrono::duration_cast(end - start).count(); ILOG(Debug, Devel) << "Time in QC Cluster Task: " << difference << ENDM; @@ -404,6 +407,7 @@ void ITSClusterTask::endOfActivity(const Activity& /*activity*/) void ITSClusterTask::reset() { ILOG(Debug, Devel) << "Resetting the histograms" << ENDM; + hTFCounter->Reset(); hClusterVsBunchCrossing->Reset(); hEmptyLaneFractionGlobal->Reset("ICES"); mGeneralOccupancy->Reset(); @@ -451,6 +455,11 @@ void ITSClusterTask::reset() void ITSClusterTask::createAllHistos() { + hTFCounter = new TH1D("TFcounter", "TFcounter", 1, 0, 1); + hTFCounter->SetTitle("TF counter"); + addObject(hTFCounter); + formatAxes(hTFCounter, "", "TF", 1, 1.10); + hClusterVsBunchCrossing = new TH2D("BunchCrossingIDvsClusters", "BunchCrossingIDvsClusters", nBCbins, 0, 4095, 150, 0, 3000); hClusterVsBunchCrossing->SetTitle("#clusters vs BC id for clusters with npix > 2"); addObject(hClusterVsBunchCrossing); From be0ec194ac70b1e0a92414f6912d61a5129234bc Mon Sep 17 00:00:00 2001 From: Nicolo Valle Date: Tue, 1 Jul 2025 16:14:35 +0200 Subject: [PATCH 4/4] dummy commit --- Modules/ITS/src/ITSClusterTask.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/ITS/src/ITSClusterTask.cxx b/Modules/ITS/src/ITSClusterTask.cxx index 0b9716f6c6..280792a417 100644 --- a/Modules/ITS/src/ITSClusterTask.cxx +++ b/Modules/ITS/src/ITSClusterTask.cxx @@ -157,8 +157,8 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx) const auto& ROF = clusRofArr[iROF]; const auto bcdata = ROF.getBCData(); - int nClusters3pixLay[7] = { 0 }; int nDigits3pixLay[7] = { 0 }; + int nClusters3pixLay[7] = { 0 }; int nClusters3pix = 0; int nLongClusters[ChipBoundary[NLayerIB]] = {}; int nHitsFromClusters[ChipBoundary[NLayerIB]] = {}; // only IB is implemented at the moment