Skip to content

Commit f40c67d

Browse files
authored
[EMCAL-524] Add occupancy histograms (#437)
Adapt task also to Cells
1 parent 25a6c10 commit f40c67d

3 files changed

Lines changed: 38 additions & 15 deletions

File tree

Modules/EMCAL/etc/digits.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}
2424
},
2525
"tasks": {
26-
"QcTask": {
26+
"CellTask": {
2727
"active": "true",
2828
"className": "o2::quality_control_modules::emcal::DigitsQcTask",
2929
"moduleName": "QcEMCAL",
@@ -49,7 +49,7 @@
4949
"detectorName": "EMC",
5050
"dataSource": [{
5151
"type": "Task",
52-
"name": "QcTask",
52+
"name": "CellTask",
5353
"MOs": ["digitAmplitudeHG"]
5454
}]
5555
},
@@ -61,7 +61,7 @@
6161
"detectorName": "EMC",
6262
"dataSource": [{
6363
"type": "Task",
64-
"name": "QcTask",
64+
"name": "CellTask",
6565
"MOs": ["digitAmplitudeLG"]
6666
}]
6767
},
@@ -73,7 +73,7 @@
7373
"detectorName": "EMC",
7474
"dataSource": [{
7575
"type": "Task",
76-
"name": "QcTask",
76+
"name": "CellTask",
7777
"MOs": ["digitTimeHG"]
7878
}]
7979
},
@@ -85,7 +85,7 @@
8585
"detectorName": "EMC",
8686
"dataSource": [{
8787
"type": "Task",
88-
"name": "QcTask",
88+
"name": "CellTask",
8989
"MOs": ["digitTimeLG"]
9090
}]
9191
},
@@ -97,7 +97,7 @@
9797
"detectorName": "EMC",
9898
"dataSource": [{
9999
"type": "Task",
100-
"name": "QcTask",
100+
"name": "CellTask",
101101
"MOs": ["digitAmplitudeEMCAL"]
102102
}]
103103
},
@@ -109,7 +109,7 @@
109109
"detectorName": "EMC",
110110
"dataSource": [{
111111
"type": "Task",
112-
"name": "QcTask",
112+
"name": "CellTask",
113113
"MOs": ["digitAmplitudeDCAL"]
114114
}]
115115
}

Modules/EMCAL/include/EMCAL/DigitsQcTask.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "QualityControl/TaskInterface.h"
1010
#include <array>
11+
#include <TProfile2D.h>
1112

1213
class TH1;
1314
class TH2;
@@ -51,11 +52,13 @@ class DigitsQcTask final : public TaskInterface
5152
void reset() override;
5253

5354
private:
54-
std::array<TH2*, 2> mDigitAmplitude; ///< Digit amplitude
55-
std::array<TH2*, 2> mDigitTime; ///< Digit time
56-
TH1* mDigitAmplitudeEMCAL = nullptr; ///< Digit amplitude in EMCAL
57-
TH1* mDigitAmplitudeDCAL = nullptr; ///< Digit amplitude in DCAL
58-
o2::emcal::Geometry* mGeometry = nullptr; ///< EMCAL geometry
55+
std::array<TH2*, 2> mDigitAmplitude; ///< Digit amplitude
56+
std::array<TH2*, 2> mDigitTime; ///< Digit time
57+
TH2* mDigitOccupancy = nullptr; ///< Digit occupancy EMCAL and DCAL
58+
TProfile2D* mIntegratedOccupancy = nullptr; ///< Digit integrated occupancy
59+
TH1* mDigitAmplitudeEMCAL = nullptr; ///< Digit amplitude in EMCAL
60+
TH1* mDigitAmplitudeDCAL = nullptr; ///< Digit amplitude in DCAL
61+
o2::emcal::Geometry* mGeometry = nullptr; ///< EMCAL geometry
5962
};
6063

6164
} // namespace emcal

Modules/EMCAL/src/DigitsQcTask.cxx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
#include <TCanvas.h>
77
#include <TH2.h>
8+
#include <TProfile2D.h>
89

910
#include <DataFormatsEMCAL/EMCALBlockHeader.h>
1011
#include <DataFormatsEMCAL/TriggerRecord.h>
1112
#include <DataFormatsEMCAL/Digit.h>
1213
#include "QualityControl/QcInfoLogger.h"
1314
#include "EMCAL/DigitsQcTask.h"
15+
#include "DataFormatsEMCAL/Cell.h"
1416
#include "EMCALBase/Geometry.h"
1517

1618
namespace o2
@@ -41,9 +43,17 @@ void DigitsQcTask::initialize(o2::framework::InitContext& /*ctx*/)
4143
//define histograms
4244
mDigitAmplitude[0] = new TH2F("digitAmplitudeHG", "Digit Amplitude (High gain)", 100, 0, 100, 20000, 0., 20000.);
4345
mDigitAmplitude[1] = new TH2F("digitAmplitudeLG", "Digit Amplitude (Low gain)", 100, 0, 100, 20000, 0., 20000.);
46+
47+
mDigitOccupancy = new TH2F("digitOccupancyEMC", "Digit Occupancy EMCAL", 96, -0.5, 95.5, 208, -0.5, 207.5);
48+
49+
mIntegratedOccupancy = new TProfile2D("digitOccupancyInt", "Digit Occupancy Integrated", 96, -0.5, 95.5, 208, -0.5, 207.5);
50+
mIntegratedOccupancy->GetXaxis()->SetTitle("col");
51+
mIntegratedOccupancy->GetYaxis()->SetTitle("row");
52+
4453
mDigitTime[0] = new TH2F("digitTimeHG", "Digit Time (High gain)", 1000, 0, 1000, 20000, 0., 20000.);
4554
mDigitTime[1] = new TH2F("digitTimeLG", "Digit Time (Low gain)", 1000, 0, 1000, 20000, 0., 20000.);
4655
// 1D histograms for showing the integrated spectrum
56+
4757
mDigitAmplitudeEMCAL = new TH1F("digitAmplitudeEMCAL", "Digit amplitude in EMCAL", 100, 0., 100.);
4858
mDigitAmplitudeDCAL = new TH1F("digitAmplitudeDCAL", "Digit amplitude in DCAL", 100, 0., 100.);
4959

@@ -55,6 +65,8 @@ void DigitsQcTask::initialize(o2::framework::InitContext& /*ctx*/)
5565

5666
getObjectsManager()->startPublishing(mDigitAmplitudeEMCAL);
5767
getObjectsManager()->startPublishing(mDigitAmplitudeDCAL);
68+
getObjectsManager()->startPublishing(mDigitOccupancy);
69+
getObjectsManager()->startPublishing(mIntegratedOccupancy);
5870

5971
// initialize geometry
6072
if (!mGeometry)
@@ -86,7 +98,7 @@ void DigitsQcTask::monitorData(o2::framework::ProcessingContext& ctx)
8698
}
8799

88100
// Get payload and loop over digits
89-
auto digitcontainer = ctx.inputs().get<gsl::span<o2::emcal::Digit>>("emcal-digits");
101+
auto digitcontainer = ctx.inputs().get<gsl::span<o2::emcal::Cell>>("emcal-digits"); //it was emcal::Digit
90102
auto triggerrecords = ctx.inputs().get<gsl::span<o2::emcal::TriggerRecord>>("emcal-triggerecords");
91103

92104
// QcInfoLogger::GetInstance() << "Received " << digitcontainer.size() << " digits " << AliceO2::InfoLogger::InfoLogger::endm;
@@ -95,21 +107,29 @@ void DigitsQcTask::monitorData(o2::framework::ProcessingContext& ctx)
95107
if (!trg.getNumberOfObjects())
96108
continue;
97109
QcInfoLogger::GetInstance() << QcInfoLogger::Debug << "Next event " << eventcouter << " has " << trg.getNumberOfObjects() << " digits" << QcInfoLogger::endm;
98-
gsl::span<const o2::emcal::Digit> eventdigits(digitcontainer.data() + trg.getFirstEntry(), trg.getNumberOfObjects());
110+
//gsl::span<const o2::emcal::Digit> eventdigits(digitcontainer.data() + trg.getFirstEntry(), trg.getNumberOfObjects());
111+
gsl::span<const o2::emcal::Cell> eventdigits(digitcontainer.data() + trg.getFirstEntry(), trg.getNumberOfObjects());
99112
for (auto digit : eventdigits) {
100113
int index = digit.getHighGain() ? 0 : (digit.getLowGain() ? 1 : -1);
101114
if (index < 0)
102115
continue;
103116

104117
mDigitAmplitude[index]->Fill(digit.getEnergy(), digit.getTower());
105118
mDigitTime[index]->Fill(digit.getTimeStamp(), digit.getTower());
106-
//if we fill phy vs eta plots integrated: filled with eta phi GlobalRowColumnFromIndex from Geometry
107119

108120
// get the supermodule for filling EMCAL/DCAL spectra
121+
109122
try {
123+
124+
auto [row, col] = mGeometry->GlobalRowColFromIndex(digit.getTower());
125+
if (digit.getEnergy() > 0)
126+
mDigitOccupancy->Fill(col, row);
127+
mIntegratedOccupancy->Fill(col, row, digit.getEnergy());
128+
110129
auto cellindices = mGeometry->GetCellIndex(digit.getTower());
111130
if (std::get<0>(cellindices) < 12)
112131
mDigitAmplitudeEMCAL->Fill(digit.getEnergy());
132+
113133
else
114134
mDigitAmplitudeDCAL->Fill(digit.getEnergy());
115135
} catch (o2::emcal::InvalidCellIDException& e) {

0 commit comments

Comments
 (0)