diff --git a/Modules/ITS/include/ITS/ITSClusterTask.h b/Modules/ITS/include/ITS/ITSClusterTask.h index e2cc992e2b..12578601d8 100644 --- a/Modules/ITS/include/ITS/ITSClusterTask.h +++ b/Modules/ITS/include/ITS/ITSClusterTask.h @@ -21,10 +21,11 @@ #include #include #include +#include #include #include -#include + class TH1D; class TH2D; @@ -50,7 +51,6 @@ class ITSClusterTask : public TaskInterface private: void publishHistos(); - void getStavePoint(int layer, int stave, double* px, double* py); void formatAxes(TH1* h, const char* xTitle, const char* yTitle, float xOffset = 1., float yOffset = 1.); void addObject(TObject* aObject); void getJsonParameters(); @@ -87,7 +87,7 @@ class ITSClusterTask : public TaskInterface TH2D* hAverageClusterSizeMonitorOB[7]; // THnSparseD *sClustersSize[7]; - TH2Poly* mGeneralOccupancy; + TH2D* mGeneralOccupancy; const int mOccUpdateFrequency = 100000; int mNThreads = 1; @@ -103,9 +103,8 @@ class ITSClusterTask : public TaskInterface const int mNLanePerHic[NLayer] = { 3, 3, 3, 2, 2, 2, 2 }; const int ChipBoundary[NLayer + 1] = { 0, 108, 252, 432, 3120, 6480, 14712, 24120 }; const int StaveBoundary[NLayer + 1] = { 0, 12, 28, 48, 72, 102, 144, 192 }; - const float MidPointRad[7] = { 23.49, 31.586, 39.341, 197.598, 246.944, 345.348, 394.883 }; - const float StartAngle[7] = { 16.997 / 360 * (TMath::Pi() * 2.), 17.504 / 360 * (TMath::Pi() * 2.), 17.337 / 360 * (TMath::Pi() * 2.), 8.75 / 360 * (TMath::Pi() * 2.), 7 / 360 * (TMath::Pi() * 2.), 5.27 / 360 * (TMath::Pi() * 2.), 4.61 / 360 * (TMath::Pi() * 2.) }; // start angle of first stave in each layer - // + const std::string mYlabels[NLayer * 2] = { "L6B(S24#rightarrow47)", "L5B(S21#rightarrow41)", "L4B(S15#rightarrow29)", "L3B(S12#rightarrow23)", "L2B(S10#rightarrow19)", "L1B(S08#rightarrow15)", "L0B(S06#rightarrow11)", "L0T(S00#rightarrow05)", "L1T(S00#rightarrow07)", "L2T(S00#rightarrow09)", "L3T(S00#rightarrow11)", "L4T(S00#rightarrow14)", "L5T(S00#rightarrow20)", "L6T(S00#rightarrow23)" }; + int mEnableLayers[7]; int mClusterSize[7][48][28] = { { { 0 } } }; //[#layers][max staves][max lanes / chips] double mClusterSizeMonitor[7][48][28] = { { { 0 } } }; diff --git a/Modules/ITS/src/ITSClusterCheck.cxx b/Modules/ITS/src/ITSClusterCheck.cxx index 65b7a8e34d..2d54d7a270 100644 --- a/Modules/ITS/src/ITSClusterCheck.cxx +++ b/Modules/ITS/src/ITSClusterCheck.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include namespace o2::quality_control_modules::its @@ -52,13 +53,15 @@ Quality ITSClusterCheck::check(std::mapsecond->getName().find("GeneralOccupancy") != std::string::npos) { - auto* hp = dynamic_cast(iter->second->getObject()); - for (int ilayer = 0; ilayer < NLayer; ilayer++) { - result.addMetadata(Form("Layer%d", ilayer), "good"); - for (int ibin = StaveBoundary[ilayer]; ibin < StaveBoundary[ilayer + 1]; ++ibin) { - if (hp->GetBinContent(ibin) > clusterOccupationLimit[ilayer]) { + auto* hp = dynamic_cast(iter->second->getObject()); + for (int iy = 1; iy <= hp->GetNbinsY(); iy++) { + int ilayer = iy <= hp->GetNbinsY() / 2 ? hp->GetNbinsY() / 2 - iy : iy - hp->GetNbinsY() / 2 - 1; + std::string tb = iy <= hp->GetNbinsY() / 2 ? "B" : "T"; + result.addMetadata(Form("Layer%d%s", ilayer, tb.c_str()), "good"); + for (int ix = 1; ix <= hp->GetNbinsX(); ix++) { // loop on staves + if (hp->GetBinContent(ix) > clusterOccupationLimit[ilayer]) { result.set(Quality::Medium); - result.updateMetadata(Form("Layer%d", ilayer), "medium"); + result.updateMetadata(Form("Layer%d%s", ilayer, tb.c_str()), "medium"); } } } @@ -106,7 +109,6 @@ void ITSClusterCheck::beautify(std::shared_ptr mo, Quality checkR auto* h = dynamic_cast(mo->getObject()); std::string histoName = mo->getName(); - int iLayer = histoName[histoName.find("Layer") + 5] - 48; if (checkResult == Quality::Good) { text = "Quality::GOOD"; diff --git a/Modules/ITS/src/ITSClusterTask.cxx b/Modules/ITS/src/ITSClusterTask.cxx index 39e88c9848..7219a341e2 100644 --- a/Modules/ITS/src/ITSClusterTask.cxx +++ b/Modules/ITS/src/ITSClusterTask.cxx @@ -102,23 +102,17 @@ void ITSClusterTask::initialize(o2::framework::InitContext& /*ctx*/) createAllHistos(); - mGeneralOccupancy = new TH2Poly(); - mGeneralOccupancy->SetTitle("General Occupancy (max clusters /event/chip);mm;mm"); - mGeneralOccupancy->SetName("General/General_Occupancy"); - - for (int iLayer = 0; iLayer < 7; iLayer++) { - for (int iStave = 0; iStave < mNStaves[iLayer]; iStave++) { - double* px = new double[4]; - double* py = new double[4]; - getStavePoint(iLayer, iStave, px, py); - mGeneralOccupancy->AddBin(4, px, py); - } - } + mGeneralOccupancy = new TH2D("General/General_Occupancy", "General Cluster Occupancy (max n_clusters/event/chip)", 24, -12, 12, 14, 0, 14); addObject(mGeneralOccupancy); mGeneralOccupancy->SetStats(0); mGeneralOccupancy->SetBit(TH1::kIsAverage); - + for (int iy = 1; iy <= mGeneralOccupancy->GetNbinsY(); iy++) { + mGeneralOccupancy->GetYaxis()->SetBinLabel(iy, mYlabels[iy - 1].c_str()); + } + mGeneralOccupancy->GetXaxis()->SetLabelOffset(999); + mGeneralOccupancy->GetXaxis()->SetLabelSize(0); + mGeneralOccupancy->GetZaxis()->SetTitle("Max Avg Cluster occ (clusters/event/chip)"); publishHistos(); // get dict from ccdb @@ -265,8 +259,10 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx) hAverageClusterSizeSummaryIB[iLayer]->SetBinError(iChip + 1, iStave + 1, 1e-15); } } - mGeneralOccupancy->SetBinContent(iStave + 1 + StaveBoundary[iLayer], (float)(*(std::max_element(mClusterOccupancyIB[iLayer][iStave], mClusterOccupancyIB[iLayer][iStave] + mNChipsPerHic[iLayer]))) / (float)(mNRofs)); - mGeneralOccupancy->SetBinError(iStave + 1 + StaveBoundary[iLayer], 1e-15); + int ybin = iStave < (mNStaves[iLayer] / 2) ? 7 + iLayer + 1 : 7 - iLayer; + int xbin = 12 - mNStaves[iLayer] / 4 + 1 + (iStave % (mNStaves[iLayer] / 2)); + mGeneralOccupancy->SetBinContent(xbin, ybin, (float)(*(std::max_element(mClusterOccupancyIB[iLayer][iStave], mClusterOccupancyIB[iLayer][iStave] + mNChipsPerHic[iLayer]))) / (float)(mNRofs)); + mGeneralOccupancy->SetBinError(xbin, ybin, 1e-15); } else { for (Int_t iLane = 0; iLane < mNLanePerHic[iLayer] * mNHicPerStave[iLayer]; iLane++) { @@ -277,8 +273,10 @@ void ITSClusterTask::monitorData(o2::framework::ProcessingContext& ctx) hAverageClusterSizeSummaryOB[iLayer]->SetBinError(iLane + 1, iStave + 1, 1e-15); } } - mGeneralOccupancy->SetBinContent(iStave + 1 + StaveBoundary[iLayer], (float)(*(std::max_element(mClusterOccupancyOB[iLayer][iStave], mClusterOccupancyOB[iLayer][iStave] + mNHicPerStave[iLayer] * mNLanePerHic[iLayer]))) / (float)(mNRofs) / (mNChipsPerHic[iLayer] / mNLanePerHic[iLayer])); - mGeneralOccupancy->SetBinError(iStave + 1 + StaveBoundary[iLayer], 1e-15); + int ybin = iStave < (mNStaves[iLayer] / 2) ? 7 + iLayer + 1 : 7 - iLayer; + int xbin = 12 - mNStaves[iLayer] / 4 + 1 + (iStave % (mNStaves[iLayer] / 2)); + mGeneralOccupancy->SetBinContent(xbin, ybin, (float)(*(std::max_element(mClusterOccupancyOB[iLayer][iStave], mClusterOccupancyOB[iLayer][iStave] + mNHicPerStave[iLayer] * mNLanePerHic[iLayer]))) / (float)(mNRofs) / (mNChipsPerHic[iLayer] / mNLanePerHic[iLayer])); + mGeneralOccupancy->SetBinError(xbin, ybin, 1e-15); } } } @@ -339,7 +337,7 @@ void ITSClusterTask::reset() { ILOG(Info, Support) << "Resetting the histogram" << ENDM; hClusterVsBunchCrossing->Reset(); - mGeneralOccupancy->Reset("content"); + mGeneralOccupancy->Reset(); for (Int_t iLayer = 0; iLayer < NLayer; iLayer++) { if (!mEnableLayers[iLayer]) @@ -520,36 +518,6 @@ void ITSClusterTask::createAllHistos() } } -void ITSClusterTask::getStavePoint(int layer, int stave, double* px, double* py) -{ - - float stepAngle = TMath::Pi() * 2 / mNStaves[layer]; // the angle between to stave - float midAngle = StartAngle[layer] + (stave * stepAngle); // mid point angle - float staveRotateAngle = TMath::Pi() / 2 - (stave * stepAngle); // how many angle this stave rotate(compare with first stave) - px[1] = MidPointRad[layer] * TMath::Cos(midAngle); // there are 4 point to decide this TH2Poly bin - // 0:left point in this stave; - // 1:mid point in this stave; - // 2:right point in this stave; - // 3:higher point int this stave; - py[1] = MidPointRad[layer] * TMath::Sin(midAngle); // 4 point calculated accord the blueprint - // roughly calculate - if (layer < NLayerIB) { - px[0] = 7.7 * TMath::Cos(staveRotateAngle) + px[1]; - py[0] = -7.7 * TMath::Sin(staveRotateAngle) + py[1]; - px[2] = -7.7 * TMath::Cos(staveRotateAngle) + px[1]; - py[2] = 7.7 * TMath::Sin(staveRotateAngle) + py[1]; - px[3] = 5.623 * TMath::Sin(staveRotateAngle) + px[1]; - py[3] = 5.623 * TMath::Cos(staveRotateAngle) + py[1]; - } else { - px[0] = 21 * TMath::Cos(staveRotateAngle) + px[1]; - py[0] = -21 * TMath::Sin(staveRotateAngle) + py[1]; - px[2] = -21 * TMath::Cos(staveRotateAngle) + px[1]; - py[2] = 21 * TMath::Sin(staveRotateAngle) + py[1]; - px[3] = 40 * TMath::Sin(staveRotateAngle) + px[1]; - py[3] = 40 * TMath::Cos(staveRotateAngle) + py[1]; - } -} - void ITSClusterTask::getJsonParameters() { mNThreads = stoi(mCustomParameters.find("nThreads")->second);