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
11 changes: 5 additions & 6 deletions Modules/ITS/include/ITS/ITSClusterTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
#include <TH1.h>
#include <TH2.h>
#include <THnSparse.h>
#include <string>

#include <DataFormatsITSMFT/TopologyDictionary.h>
#include <ITSBase/GeometryTGeo.h>
#include <TH2Poly.h>

class TH1D;
class TH2D;

Expand All @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -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 } } };
Expand Down
16 changes: 9 additions & 7 deletions Modules/ITS/src/ITSClusterCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <TList.h>
#include <TH2.h>
#include <string.h>
#include <TLatex.h>
#include <iostream>

namespace o2::quality_control_modules::its
Expand Down Expand Up @@ -52,13 +53,15 @@ Quality ITSClusterCheck::check(std::map<std::string, std::shared_ptr<MonitorObje
}

if (iter->second->getName().find("GeneralOccupancy") != std::string::npos) {
auto* hp = dynamic_cast<TH2Poly*>(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<TH2D*>(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");
}
}
}
Expand Down Expand Up @@ -106,7 +109,6 @@ void ITSClusterCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkR
auto* h = dynamic_cast<TH2D*>(mo->getObject());

std::string histoName = mo->getName();
int iLayer = histoName[histoName.find("Layer") + 5] - 48;

if (checkResult == Quality::Good) {
text = "Quality::GOOD";
Expand Down
64 changes: 16 additions & 48 deletions Modules/ITS/src/ITSClusterTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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++) {
Expand All @@ -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);
}
}
}
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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);
Expand Down