Skip to content

Commit 8dc27ec

Browse files
committed
Add ZDC monitoring as a function of IR
1 parent 00708ff commit 8dc27ec

2 files changed

Lines changed: 45 additions & 2 deletions

File tree

PWGLF/TableProducer/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ o2physics_add_dpl_workflow(tpcpid
1717
SOURCES lfTPCPID.cxx
1818
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
1919
COMPONENT_NAME Analysis)
20+
2021
o2physics_add_dpl_workflow(zdcsp
2122
SOURCES zdcSP.cxx
22-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
23+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB
2324
COMPONENT_NAME Analysis)
2425

2526
# Strangeness

PWGLF/TableProducer/zdcSP.cxx

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111
//
12+
// Minimal example to run this task:
13+
// o2-analysis-centrality-table -b --configuration json://configuration.json | o2-analysis-timestamp -b --configuration json://configuration.json | o2-analysis-event-selection -b --configuration json://configuration.json | o2-analysis-multiplicity-table -b --configuration json://configuration.json | o2-analysis-lf-zdcsp -b --configuration json://configuration.json --aod-file @input_data.txt --aod-writer-json OutputDirector.json
14+
1215

1316
#include <cmath>
1417

@@ -26,6 +29,7 @@
2629
#include "Common/TableProducer/PID/pidTOFBase.h"
2730
#include "Common/Core/EventPlaneHelper.h"
2831
#include "Common/DataModel/Qvectors.h"
32+
#include "Common/CCDB/ctpRateFetcher.h"
2933

3034
#include "DataFormatsParameters/GRPMagField.h"
3135
#include "DataFormatsParameters/GRPObject.h"
@@ -54,6 +58,13 @@ constexpr double kVeryNegative = -1.e12;
5458

5559
using BCsRun3 = soa::Join<aod::BCsWithTimestamps, aod::Run3MatchedToBCSparse>;
5660

61+
namespace {
62+
std::unordered_map<int, TH2*> gHistosC[5];
63+
std::unordered_map<int, TH2*> gHistosA[5];
64+
TH2* gCurrentHistC[5];
65+
TH2* gCurrentHistA[5];
66+
}
67+
5768
struct zdcSP {
5869

5970
Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -62,7 +73,8 @@ struct zdcSP {
6273
Configurable<float> cfgCalibrationMaxCentFT0C{"cfgCalibrationMaxCentFT0C", 90.f, "Maximum centrality FT0C"};
6374
Configurable<float> cfgCalibrationDownscaling{"cfgCalibrationDownscaling", 1.f, "Percentage of events to be processed"};
6475

65-
HistogramRegistry mHistos;
76+
ctpRateFetcher mRateFetcher;
77+
HistogramRegistry mHistos{"qaHists", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
6678

6779
template <class collision_t>
6880
bool eventSelection(collision_t& collision)
@@ -76,6 +88,20 @@ struct zdcSP {
7688
return;
7789
}
7890
mRunNumber = bc.runNumber();
91+
if (gHistosC[0].find(mRunNumber) == gHistosC[0].end()) {
92+
gHistosC[0][mRunNumber] = mHistos.add<TH2>(Form("%i/znc_common", mRunNumber), ";Hadronic rate (kHz);ZNC common signal", kTH2D, {{51, 0, 51}, {400, 0., 400.}}).get();
93+
gHistosA[0][mRunNumber] = mHistos.add<TH2>(Form("%i/zna_common", mRunNumber), ";Hadronic rate (kHz);ZNA common signal", kTH2D, {{51, 0, 51}, {400, 0., 400.}}).get();
94+
for (int i{0}; i < 4; ++i) {
95+
gHistosC[i + 1][mRunNumber] = mHistos.add<TH2>(Form("%i/znc_%i", mRunNumber, i + 1), Form(";Hadronic rate (kHz);ZNC %i signal", i + 1), kTH2D, {{51, 0, 51}, {400, 0., 400.}}).get();
96+
gHistosA[i + 1][mRunNumber] = mHistos.add<TH2>(Form("%i/zna_%i", mRunNumber, i + 1), Form(";Hadronic rate (kHz);ZNA %i signal", i + 1), kTH2D, {{51, 0, 51}, {400, 0., 400.}}).get();
97+
}
98+
}
99+
gCurrentHistC[0] = gHistosC[0][mRunNumber];
100+
gCurrentHistA[0] = gHistosA[0][mRunNumber];
101+
for (int i{0}; i < 4; ++i) {
102+
gCurrentHistC[i + 1] = gHistosC[i + 1][mRunNumber];
103+
gCurrentHistA[i + 1] = gHistosA[i + 1][mRunNumber];
104+
}
79105
}
80106

81107
void init(o2::framework::InitContext&)
@@ -100,22 +126,38 @@ struct zdcSP {
100126
if (!bc.has_zdc()) {
101127
return;
102128
}
129+
double hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), mRunNumber, "ZDC hadronic");//
103130
auto zdc = bc.zdc();
104131
auto zncEnergy = zdc.energySectorZNC();
105132
auto znaEnergy = zdc.energySectorZNA();
133+
bool goodC = true, goodA = true;
106134
for (int i = 0; i < 4; i++) { // avoid std::numeric_limits<float>::infinity() in the table
107135
if (zncEnergy[i] < kVeryNegative) {
108136
zncEnergy[i] = kVeryNegative;
137+
goodC = false;
109138
}
110139
if (znaEnergy[i] < kVeryNegative) {
111140
znaEnergy[i] = kVeryNegative;
141+
goodA = false;
112142
}
113143
}
114144
float znaCommon = zdc.energyCommonZNA() < 0 ? kVeryNegative : zdc.energyCommonZNA();
115145
float zncCommon = zdc.energyCommonZNC() < 0 ? kVeryNegative : zdc.energyCommonZNC();
116146
zdcSPTable(bc.globalBC(), bc.runNumber(), collision.posX(), collision.posY(), collision.posZ(), collision.centFT0C(),
117147
znaCommon, znaEnergy[0], znaEnergy[1], znaEnergy[2], znaEnergy[3],
118148
zncCommon, zncEnergy[0], zncEnergy[1], zncEnergy[2], zncEnergy[3]);
149+
if (goodC) {
150+
gCurrentHistC[0]->Fill(hadronicRate, zncCommon);
151+
for (int i{0}; i < 4; ++i) {
152+
gCurrentHistC[i + 1]->Fill(hadronicRate, zncEnergy[i]);
153+
}
154+
}
155+
if (goodA) {
156+
gCurrentHistA[0]->Fill(hadronicRate, znaCommon);
157+
for (int i{0}; i < 4; ++i) {
158+
gCurrentHistA[i + 1]->Fill(hadronicRate, znaEnergy[i]);
159+
}
160+
}
119161
}
120162
PROCESS_SWITCH(zdcSP, processCalibrationData, "Data analysis", true);
121163
};

0 commit comments

Comments
 (0)