Skip to content

Commit 2d424c3

Browse files
committed
Added bc and time-dependent counters
1 parent d01e369 commit 2d424c3

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

DPG/Tasks/AOTEvent/lumiQa.cxx

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,29 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
#include "Framework/runDataProcessing.h"
13-
#include "Framework/AnalysisTask.h"
14-
#include "Framework/AnalysisDataModel.h"
1512
#include "CCDB/BasicCCDBManager.h"
16-
#include "Framework/HistogramRegistry.h"
17-
#include "DataFormatsParameters/GRPLHCIFData.h"
1813
#include "DataFormatsFT0/Digit.h"
19-
#include "TList.h"
14+
#include "DataFormatsParameters/GRPLHCIFData.h"
15+
#include "Framework/AnalysisDataModel.h"
16+
#include "Framework/AnalysisTask.h"
17+
#include "Framework/HistogramRegistry.h"
18+
#include "Framework/runDataProcessing.h"
19+
#include <DataFormatsParameters/AggregatedRunInfo.h>
20+
2021
#include "TH1.h"
22+
#include "TList.h"
2123

2224
using namespace o2;
2325
using namespace o2::framework;
2426
using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::Run3MatchedToBCSparse>;
2527

2628
struct LumiQaTask {
29+
Configurable<float> confTimeBinWidthInSec{"TimeBinWidthInSec", 60., "Width of time bins in seconds"}; // o2-linter: disable=name/configurable (temporary fix)
2730
Service<o2::ccdb::BasicCCDBManager> ccdb;
2831
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
2932
int lastRunNumber = -1;
33+
double maxSec = 1;
34+
double minSec = 0;
3035
TH1* hCalibT0C = nullptr;
3136
static const int nBCsPerOrbit = o2::constants::lhc::LHCMaxBunches;
3237
std::bitset<nBCsPerOrbit> bcPatternB;
@@ -40,6 +45,7 @@ struct LumiQaTask {
4045
ccdb->setURL("http://alice-ccdb.cern.ch");
4146
ccdb->setCaching(true);
4247
ccdb->setLocalObjectValidityChecking();
48+
4349
const AxisSpec axisMultZNA{2000, 0., 400., "ZNA multiplicity"};
4450
const AxisSpec axisMultZNC{2000, 0., 400., "ZNC multiplicity"};
4551
const AxisSpec axisMultT0M{1000, 0., 270000., "T0M multiplicity"};
@@ -116,9 +122,30 @@ struct LumiQaTask {
116122
LOGF(info, "hCalibZeqFT0C histogram is not available for run=%d at timestamp=%llu", runNumber, ts);
117123
return;
118124
}
125+
126+
if (runNumber >= 500000) {
127+
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), runNumber);
128+
auto tsSOR = runInfo.sor;
129+
auto tsEOR = runInfo.eor;
130+
minSec = floor(tsSOR / 1000.);
131+
maxSec = ceil(tsEOR / 1000.);
132+
}
133+
134+
int nTimeBins = static_cast<int>((maxSec - minSec) / confTimeBinWidthInSec);
135+
double timeInterval = nTimeBins * confTimeBinWidthInSec;
136+
137+
const AxisSpec axisBCs{nBCsPerOrbit, 0., static_cast<double>(nBCsPerOrbit), ""};
138+
const AxisSpec axisSeconds{nTimeBins, 0, timeInterval, "seconds"};
139+
histos.add("hSecondsBcsTCE", "", kTH2D, {axisSeconds, axisBCs});
140+
histos.add("hSecondsBcsZNA", "", kTH2D, {axisSeconds, axisBCs});
141+
histos.add("hSecondsBcsZNC", "", kTH2D, {axisSeconds, axisBCs});
142+
histos.add("hSecondsBcsZEM", "", kTH2D, {axisSeconds, axisBCs});
119143
}
120144

121145
for (const auto& bc : bcs) {
146+
int64_t ts = bc.timestamp();
147+
double secFromSOR = ts / 1000. - minSec;
148+
double bcInOrbit = bc.globalBC() % nBCsPerOrbit;
122149
if (bc.has_zdc()) {
123150
float timeZNA = bc.zdc().timeZNA();
124151
float timeZNC = bc.zdc().timeZNC();
@@ -159,12 +186,15 @@ struct LumiQaTask {
159186

160187
if (fabs(timeZNA - meanTimeZNA) < 2) {
161188
histos.get<TH1>(HIST("hCounterZNA"))->Fill(srun, 1);
189+
histos.fill(HIST("hSecondsBcsZNA"), secFromSOR, bcInOrbit);
162190
}
163191
if (fabs(timeZNC - meanTimeZNC) < 2) {
164192
histos.get<TH1>(HIST("hCounterZNC"))->Fill(srun, 1);
193+
histos.fill(HIST("hSecondsBcsZNC"), secFromSOR, bcInOrbit);
165194
}
166195
if (fabs(timeZNA - meanTimeZNA) < 2 || fabs(timeZNC - meanTimeZNC) < 2) {
167196
histos.get<TH1>(HIST("hCounterZEM"))->Fill(srun, 1);
197+
histos.fill(HIST("hSecondsBcsZEM"), secFromSOR, bcInOrbit);
168198
}
169199
}
170200

@@ -211,6 +241,7 @@ struct LumiQaTask {
211241
histos.fill(HIST("hCentT0CselTVXTCEB"), centT0C);
212242

213243
histos.get<TH1>(HIST("hCounterTCE"))->Fill(srun, 1);
244+
histos.fill(HIST("hSecondsBcsTCE"), secFromSOR, bcInOrbit);
214245
}
215246
}
216247
};

0 commit comments

Comments
 (0)