Skip to content

Commit 35d7800

Browse files
authored
[MFT-Module] Updating the MFT digit QC Task (#588)
* Adding histograms - chip maps, pixel maps, std dev per chip * Added hot pixel producer * Added hot pixel producer * Publishing all pixel hit maps * Change in folder strucutre for pixel maps to be able to publish them * Updated folder structer for histogams and deleted the sorting algorithm. * Forgot to delete a counter from Digit Task. * Clang format. * Adjusting cycle length and sampling fraction. * Publishing only pixel hit maps corresponding to given FLP. * Moving overview histograms into the chip hit map folder. * Changing the MO for the checker to correspond to the new location of the chip hit index histogram.
1 parent 4dfb59c commit 35d7800

8 files changed

Lines changed: 2270 additions & 10 deletions

Modules/Example/o2-qc-example-analysis-derived.json

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

Modules/Example/o2-qc-example-analysis-direct.json

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

Modules/MFT/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ add_root_dictionary(QcMFT
3838

3939
set(EXE_SRCS
4040
src/runDigitsRootFileReaderMFT.cxx
41+
src/runDigitsHotPixelRootFileReaderMFT.cxx
4142
src/runClustersRootFileReaderMFT.cxx
4243
src/runTracksRootFileReaderMFT.cxx)
4344
set(EXE_NAMES
4445
o2-qc-run-digits-root-file-reader-mft
46+
o2-qc-run-digits-hot-pixel-root-file-reader-mft
4547
o2-qc-run-clusters-root-file-reader-mft
4648
o2-qc-run-tracks-root-file-reader-mft)
4749

@@ -56,6 +58,7 @@ endforeach()
5658

5759
install(
5860
TARGETS o2-qc-run-digits-root-file-reader-mft
61+
o2-qc-run-digits-hot-pixel-root-file-reader-mft
5962
o2-qc-run-clusters-root-file-reader-mft
6063
o2-qc-run-tracks-root-file-reader-mft
6164
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

Modules/MFT/basic-digit-qc-task.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
"className": "o2::quality_control_modules::mft::BasicDigitQcTask",
2929
"moduleName": "QcMFT",
3030
"detectorName": "MFT",
31-
"cycleDurationSeconds": "10",
31+
"cycleDurationSeconds": "60",
3232
"maxNumberCycles": "-1",
3333
"dataSource_comment": "The other type of dataSource is \"direct\", see basic-no-sampling.json.",
3434
"dataSource": {
3535
"type": "dataSamplingPolicy",
3636
"name": "mft-digits"
3737
},
3838
"taskParameters": {
39-
"myOwnKey": "myOwnValue"
39+
"FLP": "1"
4040
},
4141
"location": "remote"
4242
}
@@ -47,7 +47,7 @@
4747
"dataSource": [{
4848
"type": "Task",
4949
"name": "BasicDigitQcTask",
50-
"MOs": ["mMFT_chip_index_H"]
50+
"MOs": ["ChipHitMaps/mMFT_chip_index_H"]
5151
}],
5252
"className": "o2::quality_control_modules::mft::BasicDigitQcCheck",
5353
"moduleName": "QcMFT",
@@ -65,7 +65,7 @@
6565
"samplingConditions": [
6666
{
6767
"condition": "random",
68-
"fraction": "0.1",
68+
"fraction": "0.2",
6969
"seed": "1234"
7070
}
7171
],

Modules/MFT/include/MFT/BasicDigitQcTask.h

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/// \file BasicDigitQcTask.h
1313
/// \author Tomas Herman
1414
/// \author Guillermo Contreras
15+
/// \author Katarina Krizkova Gajdosova
1516
///
1617

1718
#ifndef QC_MODULE_MFT_MFTBasicDIGITQCTASK_H
@@ -20,6 +21,7 @@
2021
// ROOT
2122
#include <TCanvas.h>
2223
#include <TH1.h>
24+
#include <TH2.h>
2325
// Quality Control
2426
#include "QualityControl/TaskInterface.h"
2527

@@ -50,7 +52,78 @@ class BasicDigitQcTask final : public TaskInterface
5052
void reset() override;
5153

5254
private:
55+
// variables
56+
const double gPixelHitMapsMaxBinX = 1023.5;
57+
const double gPixelHitMapsMaxBinY = 511.5;
58+
const double gPixelHitMapsMinBin = -0.5;
59+
const int gPixelHitMapsBinWidth = 8;
60+
61+
const int nhitmaps = 20;
62+
const int nchip = 936;
63+
64+
int FLP;
65+
int minChipID;
66+
int maxChipID;
67+
68+
int half[936] = { 0 };
69+
int disk[936] = { 0 };
70+
int face[936] = { 0 };
71+
int zone[936] = { 0 };
72+
int ladder[936] = { 0 };
73+
int sensor[936] = { 0 };
74+
int transID[936] = { 0 };
75+
int layer[936] = { 0 };
76+
double x[936] = { 0 };
77+
double y[936] = { 0 };
78+
double z[936] = { 0 };
79+
double binx[936] = { 0 };
80+
double biny[936] = { 0 };
81+
82+
// bin numbers for chip hit maps
83+
double binsChipHitMaps[20][6] = {
84+
// half0
85+
{ 12, -10, 10, 4, -12, 0 }, // disk0, face 0
86+
{ 12, -10, 10, 4, -12, 0 }, // disk0, face 1
87+
88+
{ 12, -10, 10, 4, -12, 0 },
89+
{ 12, -10, 10, 4, -12, 0 },
90+
91+
{ 13, -11, 10, 4, -12, 0 },
92+
{ 13, -10, 11, 4, -12, 0 },
93+
94+
{ 16, -13, 14, 5, -15, 0 },
95+
{ 16, -14, 13, 5, -15, 0 },
96+
97+
{ 17, -14, 14, 5, -15, 0 },
98+
{ 17, -14, 14, 5, -15, 0 },
99+
100+
// half1
101+
{ 12, -10, 10, 4, 0, 12 },
102+
{ 12, -10, 10, 4, 0, 12 },
103+
104+
{ 12, -10, 10, 4, 0, 12 },
105+
{ 12, -10, 10, 4, 0, 12 },
106+
107+
{ 13, -10, 11, 4, 0, 12 },
108+
{ 13, -11, 10, 4, 0, 12 },
109+
110+
{ 16, -14, 13, 5, 0, 15 },
111+
{ 16, -13, 14, 5, 0, 15 },
112+
113+
{ 17, -14, 14, 5, 0, 15 },
114+
{ 17, -14, 14, 5, 0, 15 },
115+
};
116+
53117
std::unique_ptr<TH1F> mMFT_chip_index_H = nullptr;
118+
std::unique_ptr<TH1F> mMFT_chip_std_dev_H = nullptr;
119+
120+
std::vector<std::unique_ptr<TH2F>> mMFTChipHitMap;
121+
std::vector<std::unique_ptr<TH2F>> mMFTPixelHitMap;
122+
123+
// functions
124+
void readTable();
125+
void getChipName(TString& FolderName, TString& HistogramName, int iHitMap);
126+
void getPixelName(TString& FolderName, TString& HistogramName, int iChipID);
54127
};
55128

56129
} // namespace o2::quality_control_modules::mft

Modules/MFT/src/BasicDigitQcCheck.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Quality BasicDigitQcCheck::check(std::map<std::string, std::shared_ptr<MonitorOb
3636
for (auto& [moName, mo] : *moMap) {
3737

3838
(void)moName;
39-
if (mo->getName() == "mMFT_chip_index_H") {
39+
if (mo->getName() == "ChipHitMaps/mMFT_chip_index_H") {
4040
auto* h = dynamic_cast<TH1F*>(mo->getObject());
4141
result = Quality::Good;
4242

@@ -53,7 +53,7 @@ std::string BasicDigitQcCheck::getAcceptedType() { return "TH1"; }
5353

5454
void BasicDigitQcCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult)
5555
{
56-
if (mo->getName() == "mMFT_chip_index_H") {
56+
if (mo->getName() == "ChipHitMaps/mMFT_chip_index_H") {
5757
auto* h = dynamic_cast<TH1F*>(mo->getObject());
5858

5959
if (checkResult == Quality::Good) {

Modules/MFT/src/BasicDigitQcTask.cxx

Lines changed: 149 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,21 @@
1212
/// \file BasicDigitQcTask.cxx
1313
/// \author Tomas Herman
1414
/// \author Guillermo Contreras
15+
/// \author Katarina Krizkova Gajdosova
1516
///
1617

1718
// ROOT
1819
#include <TCanvas.h>
1920
#include <TH1.h>
21+
#include <TH2.h>
2022
// O2
2123
#include <DataFormatsITSMFT/Digit.h>
2224
#include <Framework/InputRecord.h>
2325
// Quality Control
2426
#include "QualityControl/QcInfoLogger.h"
2527
#include "MFT/BasicDigitQcTask.h"
28+
// C++
29+
#include <fstream>
2630

2731
namespace o2::quality_control_modules::mft
2832
{
@@ -39,19 +43,78 @@ void BasicDigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)
3943
ILOG(Info, Support) << "initialize BasicDigitQcTask" << ENDM; // QcInfoLogger is used. FairMQ logs will go to there as well.
4044

4145
// this is how to get access to custom parameters defined in the config file at qc.tasks.<task_name>.taskParameters
42-
if (auto param = mCustomParameters.find("myOwnKey"); param != mCustomParameters.end()) {
46+
if (auto param = mCustomParameters.find("FLP"); param != mCustomParameters.end()) {
4347
ILOG(Info, Support) << "Custom parameter - myOwnKey: " << param->second << ENDM;
48+
FLP = stoi(param->second);
49+
minChipID = (FLP - 1) * nchip / 4;
50+
maxChipID = FLP * nchip / 4;
4451
}
4552

46-
mMFT_chip_index_H = std::make_unique<TH1F>("mMFT_chip_index_H", "mMFT_chip_index_H", 936, -0.5, 935.5);
53+
// -------------------
54+
mMFT_chip_index_H = std::make_unique<TH1F>("ChipHitMaps/mMFT_chip_index_H", "mMFT_chip_index_H", 936, -0.5, 935.5);
4755
getObjectsManager()->startPublishing(mMFT_chip_index_H.get());
4856
getObjectsManager()->addMetadata(mMFT_chip_index_H->GetName(), "custom", "34");
57+
58+
mMFT_chip_std_dev_H = std::make_unique<TH1F>("ChipHitMaps/mMFT_chip_std_dev_H", "mMFT_chip_std_dev_H", 936, -0.5, 935.5);
59+
getObjectsManager()->startPublishing(mMFT_chip_std_dev_H.get());
60+
getObjectsManager()->addMetadata(mMFT_chip_std_dev_H->GetName(), "custom", "34");
61+
62+
//==============================================
63+
// chip hit maps
64+
readTable();
65+
for (int iHitMap = 0; iHitMap < nhitmaps; iHitMap++) {
66+
// generate folder and histogram name using the mapping table
67+
TString FolderName = "";
68+
TString HistogramName = "";
69+
getChipName(FolderName, HistogramName, iHitMap);
70+
71+
auto chiphitmap = std::make_unique<TH2F>(
72+
FolderName, HistogramName,
73+
binsChipHitMaps[iHitMap][0], binsChipHitMaps[iHitMap][1], binsChipHitMaps[iHitMap][2],
74+
binsChipHitMaps[iHitMap][3], binsChipHitMaps[iHitMap][4], binsChipHitMaps[iHitMap][5]);
75+
chiphitmap->SetStats(0);
76+
mMFTChipHitMap.push_back(std::move(chiphitmap));
77+
getObjectsManager()->startPublishing(mMFTChipHitMap[iHitMap].get());
78+
getObjectsManager()->addMetadata(mMFTChipHitMap[iHitMap]->GetName(), "custom", "34");
79+
}
80+
81+
//==============================================
82+
// pixel hit maps
83+
for (int iChipID = 0; iChipID < nchip; iChipID++) {
84+
// generate folder and histogram name using the mapping table
85+
TString FolderName = "";
86+
TString HistogramName = "";
87+
getPixelName(FolderName, HistogramName, iChipID);
88+
89+
// create pixel hit map
90+
auto pxlhitmap = std::make_unique<TH2F>(
91+
FolderName, HistogramName,
92+
gPixelHitMapsMaxBinX / gPixelHitMapsBinWidth, gPixelHitMapsMinBin, gPixelHitMapsMaxBinX,
93+
gPixelHitMapsMaxBinY / gPixelHitMapsBinWidth, gPixelHitMapsMinBin, gPixelHitMapsMaxBinY);
94+
pxlhitmap->SetStats(0);
95+
mMFTPixelHitMap.push_back(std::move(pxlhitmap));
96+
97+
if ((iChipID >= minChipID) && (iChipID < maxChipID)) {
98+
getObjectsManager()->startPublishing(mMFTPixelHitMap[iChipID].get());
99+
getObjectsManager()->addMetadata(mMFTPixelHitMap[iChipID]->GetName(), "custom", "34");
100+
}
101+
}
49102
}
50103

51104
void BasicDigitQcTask::startOfActivity(Activity& /*activity*/)
52105
{
53106
ILOG(Info, Support) << "startOfActivity" << ENDM;
107+
54108
mMFT_chip_index_H->Reset();
109+
mMFT_chip_std_dev_H->Reset();
110+
111+
for (int iHitMap = 0; iHitMap < nhitmaps; iHitMap++) {
112+
mMFTChipHitMap[iHitMap]->Reset();
113+
}
114+
115+
for (int iChipID = 0; iChipID < nchip; iChipID++) {
116+
mMFTPixelHitMap[iChipID]->Reset();
117+
}
55118
}
56119

57120
void BasicDigitQcTask::startOfCycle()
@@ -65,9 +128,22 @@ void BasicDigitQcTask::monitorData(o2::framework::ProcessingContext& ctx)
65128
const auto digits = ctx.inputs().get<gsl::span<o2::itsmft::Digit>>("randomdigit");
66129
if (digits.size() < 1)
67130
return;
131+
68132
// fill the histograms
69133
for (auto& one_digit : digits) {
70-
mMFT_chip_index_H->Fill(one_digit.getChipIndex());
134+
int chipIndex = one_digit.getChipIndex();
135+
136+
// fill pixel hit maps
137+
mMFTPixelHitMap[chipIndex]->Fill(one_digit.getColumn(), one_digit.getRow());
138+
// fill number of entries and standard dev for all chips
139+
mMFT_chip_index_H->SetBinContent(chipIndex, mMFTPixelHitMap[chipIndex]->GetEntries());
140+
mMFT_chip_std_dev_H->SetBinContent(chipIndex, mMFTPixelHitMap[chipIndex]->GetStdDev(1));
141+
}
142+
143+
// fill the chip hit maps
144+
for (int iChipID = 0; iChipID < nchip; iChipID++) {
145+
int nEntries = mMFTPixelHitMap[iChipID]->GetEntries();
146+
mMFTChipHitMap[layer[iChipID] + half[iChipID] * 10]->SetBinContent(binx[iChipID], biny[iChipID], nEntries);
71147
}
72148
}
73149

@@ -84,9 +160,78 @@ void BasicDigitQcTask::endOfActivity(Activity& /*activity*/)
84160
void BasicDigitQcTask::reset()
85161
{
86162
// clean all the monitor objects here
87-
88163
ILOG(Info, Support) << "Resetting the histogram" << ENDM;
164+
89165
mMFT_chip_index_H->Reset();
166+
mMFT_chip_std_dev_H->Reset();
167+
168+
for (int iHitMap = 0; iHitMap < nhitmaps; iHitMap++) {
169+
mMFTChipHitMap[iHitMap]->Reset();
170+
}
171+
172+
for (int iChipID = 0; iChipID < nchip; iChipID++) {
173+
mMFTPixelHitMap[iChipID]->Reset();
174+
}
175+
}
176+
177+
void BasicDigitQcTask::getChipName(TString& FolderName, TString& HistogramName, int iHitMap)
178+
{
179+
FolderName = Form("ChipHitMaps/Half_%d/Disk_%d/Face_%d/mMFTChipHitMap",
180+
int(iHitMap / 10), int((iHitMap % 10) / 2), (iHitMap % 10) % 2);
181+
182+
HistogramName = Form("h%d-d%d-f%d;x (cm);y (cm)",
183+
int(iHitMap / 10), int((iHitMap % 10) / 2), (iHitMap % 10) % 2);
184+
}
185+
186+
void BasicDigitQcTask::getPixelName(TString& FolderName, TString& HistogramName, int iChipID)
187+
{
188+
FolderName = Form("PixelHitMaps/Half_%d/Disk_%d/Face_%d/mMFTPixelHitMap-z%d-l%d-s%d-tr%d",
189+
half[iChipID], disk[iChipID], face[iChipID], zone[iChipID], ladder[iChipID], sensor[iChipID], transID[iChipID]);
190+
191+
HistogramName = Form("h%d-d%d-f%d-z%d-l%d-s%d-tr%d",
192+
half[iChipID], disk[iChipID], face[iChipID], zone[iChipID], ladder[iChipID], sensor[iChipID], transID[iChipID]);
193+
}
194+
195+
void BasicDigitQcTask::readTable()
196+
{
197+
//const int nchip = 936;
198+
199+
// reset arrays
200+
for (int i = 0; i < nchip; i++) {
201+
half[i] = 0;
202+
disk[i] = 0;
203+
face[i] = 0;
204+
zone[i] = 0;
205+
ladder[i] = 0;
206+
sensor[i] = 0;
207+
transID[i] = 0;
208+
layer[i] = 0;
209+
x[i] = 0;
210+
y[i] = 0;
211+
z[i] = 0;
212+
binx[i] = 0;
213+
biny[i] = 0;
214+
}
215+
216+
// read file
217+
std::ifstream read_table;
218+
read_table.open("./table_file_binidx.txt");
219+
for (int i = 0; i < nchip; ++i) {
220+
read_table >> half[i];
221+
read_table >> disk[i];
222+
read_table >> face[i];
223+
read_table >> zone[i];
224+
read_table >> ladder[i];
225+
read_table >> sensor[i];
226+
read_table >> transID[i];
227+
read_table >> layer[i];
228+
read_table >> x[i];
229+
read_table >> y[i];
230+
read_table >> z[i];
231+
read_table >> binx[i];
232+
read_table >> biny[i];
233+
}
234+
read_table.close();
90235
}
91236

92237
} // namespace o2::quality_control_modules::mft

0 commit comments

Comments
 (0)