Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ITS] Anomalous clusters plots #2482

Merged
merged 6 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 5 additions & 1 deletion Modules/ITS/include/ITS/ITSClusterTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ class ITSClusterTask : public TaskInterface
std::shared_ptr<TH2DRatio> hAverageClusterOccupancySummaryOB[NLayer];
std::shared_ptr<TH2DRatio> hAverageClusterSizeSummaryOB[NLayer];

// Layer synnary
// Layer summary
TH1D* hClusterSizeLayerSummary[NLayer] = { nullptr };
TH1D* hClusterTopologyLayerSummary[NLayer] = { nullptr };
TH1D* hGroupedClusterSizeLayerSummary[NLayer] = { nullptr };

// Anomalies plots
TH2D* hLongClustersPerChip[3] = { nullptr };
TH2D* hMultPerChipWhenLongClusters[3] = { nullptr };

// General
TH2D* hClusterVsBunchCrossing = nullptr;
std::unique_ptr<TH2DRatio> mGeneralOccupancy = nullptr;
Expand Down
61 changes: 57 additions & 4 deletions Modules/ITS/src/ITSClusterTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ ITSClusterTask::~ITSClusterTask()
if (!mEnableLayers[iLayer])
continue;

if (iLayer < NLayerIB) {
delete hLongClustersPerChip[iLayer];
delete hMultPerChipWhenLongClusters[iLayer];
}
delete hClusterSizeLayerSummary[iLayer];
delete hClusterTopologyLayerSummary[iLayer];
delete hGroupedClusterSizeLayerSummary[iLayer];
Expand Down Expand Up @@ -137,8 +141,6 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
auto clusPatternArr = ctx.inputs().get<gsl::span<unsigned char>>("patterns");
auto pattIt = clusPatternArr.begin();

int ChipIDprev = -1;

// Reset this histo to have the latest picture
hEmptyLaneFractionGlobal->Reset("ICES");

Expand All @@ -153,34 +155,44 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
const auto& ROF = clusRofArr[iROF];
const auto bcdata = ROF.getBCData();
int nClustersForBunchCrossing = 0;
int nLongClusters[ChipBoundary[NLayerIB]] = { 0 };
int nHitsFromClusters[ChipBoundary[NLayerIB]] = { 0 }; // only IB is implemented at the moment

for (int icl = ROF.getFirstEntry(); icl < ROF.getFirstEntry() + ROF.getNEntries(); icl++) {

auto& cluster = clusArr[icl];
auto ChipID = cluster.getSensorID();
int ClusterID = cluster.getPatternID(); // used for normal (frequent) cluster shapes
int lay, sta, ssta, mod, chip, lane;

if (ChipID != ChipIDprev) {
if (ChipID != -1) { // TODO: is this needed?
nicolovalle marked this conversation as resolved.
Show resolved Hide resolved
mGeom->getChipId(ChipID, lay, sta, ssta, mod, chip);
mod = mod + (ssta * (mNHicPerStave[lay] / 2));
int chipIdLocal = (ChipID - ChipBoundary[lay]) % (14 * mNHicPerStave[lay]);
lane = (chipIdLocal % (14 * mNHicPerStave[lay])) / (14 / 2);
}
int npix = -1;
int colspan = -1;
int rowspan = -1;
int isGrouped = -1;

o2::math_utils::Point3D<float> locC; // local coordinates

if (ClusterID != o2::itsmft::CompCluster::InvalidPatternID) { // Normal (frequent) cluster shapes
if (!mDict->isGroup(ClusterID)) {
npix = mDict->getNpixels(ClusterID);
// to do: is there way other than calling the pattern?
colspan = mDict->getPattern(ClusterID).getColumnSpan();
rowspan = mDict->getPattern(ClusterID).getRowSpan();
if (mDoPublishDetailedSummary == 1) {
locC = mDict->getClusterCoordinates(cluster);
}
isGrouped = 0;
} else {
o2::itsmft::ClusterPattern patt(pattIt);
npix = patt.getNPixels();
colspan = patt.getColumnSpan();
rowspan = patt.getRowSpan();
if (mDoPublishDetailedSummary == 1) {
locC = mDict->getClusterCoordinates(cluster, patt, true);
}
Expand All @@ -190,6 +202,8 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
} else { // invalid pattern
o2::itsmft::ClusterPattern patt(pattIt);
npix = patt.getNPixels();
colspan = patt.getColumnSpan();
rowspan = patt.getRowSpan();
isGrouped = 0;
if (mDoPublishDetailedSummary == 1) {
locC = mDict->getClusterCoordinates(cluster, patt, false);
Expand All @@ -200,6 +214,15 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
nClustersForBunchCrossing++;
}

if (lay < NLayerIB) {
nHitsFromClusters[ChipID] += npix;
}

if (lay < NLayerIB && colspan > 127 && rowspan < 30) {
// definition of long cluster. 127 is driven by o2::itsmft::ClusterPattern::MaxColSpan = 128
nLongClusters[ChipID]++;
}

if (lay < NLayerIB) {
hAverageClusterOccupancySummaryIB[lay]->getNum()->Fill(chip, sta);
hAverageClusterSizeSummaryIB[lay]->getNum()->Fill(chip, sta, (double)npix);
Expand Down Expand Up @@ -249,6 +272,23 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx)
}
}
hClusterVsBunchCrossing->Fill(bcdata.bc, nClustersForBunchCrossing); // we count only the number of clusters, not their sizes

// filling these anomaly plots once per ROF, ignoring chips w/o long clusters
for (int ichip = 0; ichip < ChipBoundary[NLayerIB]; ichip++) {

int nLong = nLongClusters[ichip] <= 20 ? nLongClusters[ichip] : 21;

if (nLong < 1) {
continue;
}

int ilayer = -1;
while (ichip >= ChipBoundary[ilayer + 1]) {
ilayer++;
}
hLongClustersPerChip[ilayer]->Fill(ichip, nLong);
hMultPerChipWhenLongClusters[ilayer]->Fill(ichip, nHitsFromClusters[ichip]);
}
}

if ((int)clusRofArr.size() > 0) {
Expand Down Expand Up @@ -364,6 +404,8 @@ void ITSClusterTask::reset()
hClusterTopologyLayerSummary[iLayer]->Reset();

if (iLayer < NLayerIB) {
hLongClustersPerChip[iLayer]->Reset();
hMultPerChipWhenLongClusters[iLayer]->Reset();
hAverageClusterOccupancySummaryIB[iLayer]->Reset();
hAverageClusterSizeSummaryIB[iLayer]->Reset();
if (mDoPublish1DSummary == 1) {
Expand Down Expand Up @@ -396,7 +438,7 @@ void ITSClusterTask::reset()

void ITSClusterTask::createAllHistos()
{
hClusterVsBunchCrossing = new TH2D("BunchCrossingIDvsClusters", "BunchCrossingIDvsClusters", nBCbins, 0, 4095, 100, 0, 1000);
hClusterVsBunchCrossing = new TH2D("BunchCrossingIDvsClusters", "BunchCrossingIDvsClusters", nBCbins, 0, 4095, 100, 0, 2000);
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);
Expand All @@ -419,6 +461,17 @@ void ITSClusterTask::createAllHistos()
if (!mEnableLayers[iLayer])
continue;

if (iLayer < NLayerIB) {
hLongClustersPerChip[iLayer] = new TH2D(Form("Anomalies/Layer%d/LongClusters", iLayer), Form("Layer%d/LongClusters", iLayer), ChipBoundary[iLayer + 1] - ChipBoundary[iLayer], ChipBoundary[iLayer], ChipBoundary[iLayer + 1], 21, 0, 21);
hMultPerChipWhenLongClusters[iLayer] = new TH2D(Form("Anomalies/Layer%d/HitsWhenLongClusters", iLayer), Form("Layer%d/HitsWhenLongClusters", iLayer), ChipBoundary[iLayer + 1] - ChipBoundary[iLayer], ChipBoundary[iLayer], ChipBoundary[iLayer + 1], 150, 0, 15000);
addObject(hLongClustersPerChip[iLayer]);
formatAxes(hLongClustersPerChip[iLayer], "Chip ID", "number of long clusters", 1, 1.10);
hLongClustersPerChip[iLayer]->SetStats(0);
addObject(hMultPerChipWhenLongClusters[iLayer]);
formatAxes(hMultPerChipWhenLongClusters[iLayer], "Chip ID", "Sum of clusters size (events w/ long clus)", 1, 1.10);
hMultPerChipWhenLongClusters[iLayer]->SetStats(0);
}

hClusterSizeLayerSummary[iLayer] = new TH1D(Form("Layer%d/AverageClusterSizeSummary", iLayer), Form("Layer%dAverageClusterSizeSummary", iLayer), 100, 0, 100);
hClusterSizeLayerSummary[iLayer]->SetTitle(Form("Cluster size summary for Layer %d", iLayer));
addObject(hClusterSizeLayerSummary[iLayer]);
Expand Down
Loading