Skip to content

Commit ee404b9

Browse files
committed
Implement luminosity calculation in SG candidate producer
1 parent ed12615 commit ee404b9

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

PWGUD/TableProducer/SGCandProducer.cxx

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "DataFormatsFIT/Triggers.h"
2222
#include "DataFormatsParameters/GRPMagField.h"
2323
#include "DataFormatsParameters/GRPObject.h"
24+
#include "DataFormatsParameters/GRPLHCIFData.h"
25+
#include "DataFormatsParameters/AggregatedRunInfo.h"
2426

2527
#include "Framework/AnalysisTask.h"
2628
#include "Framework/ASoAHelpers.h"
@@ -74,6 +76,7 @@ struct SGCandProducer {
7476
// Configurables to decide which tables are filled
7577
Configurable<bool> fillTrackTables{"fillTrackTables", true, "Fill track tables"};
7678
Configurable<bool> fillFwdTrackTables{"fillFwdTrackTables", true, "Fill forward track tables"};
79+
7780
// SG selector
7881
SGSelector sgSelector;
7982
ctpRateFetcher mRateFetcher;
@@ -103,6 +106,8 @@ struct SGCandProducer {
103106
{}};
104107
std::map<std::string, HistPtr> histPointers;
105108

109+
int runNumber = -1;
110+
106111
// function to update UDFwdTracks, UDFwdTracksExtra
107112
template <typename TFwdTrack>
108113
void updateUDFwdTrackTables(TFwdTrack const& fwdtrack, uint64_t const& bcnum)
@@ -180,6 +185,78 @@ struct SGCandProducer {
180185
outputTracksLabel(track.globalIndex());
181186
}
182187

188+
// function to process trigger counters, accounting for BC selection bits
189+
void processCountersTrg(BCs const& bcs, aod::FT0s const&, aod::Zdcs const&)
190+
{
191+
const auto& firstBc = bcs.iteratorAt(0);
192+
if (runNumber != firstBc.runNumber())
193+
runNumber = firstBc.runNumber();
194+
195+
auto hCountersTrg = getHist(TH1, "reco/hCountersTrg");
196+
auto hCountersTrgBcSel = getHist(TH1, "reco/hCountersTrgBcSel");
197+
auto hLumi = getHist(TH1, "reco/hLumi");
198+
auto hLumiBcSel = getHist(TH1, "reco/hLumiBcSel");
199+
200+
// Cross sections in ub. Using dummy -1 if lumi estimator is not reliable
201+
float csTCE = 10.36e6;
202+
float csZEM = 415.2e6; // see AN: https://alice-notes.web.cern.ch/node/1515
203+
float csZNC = 214.5e6; // see AN: https://alice-notes.web.cern.ch/node/1515
204+
if (runNumber > 543437 && runNumber < 543514) {
205+
csTCE = 8.3e6;
206+
}
207+
if (runNumber >= 543514) {
208+
csTCE = 4.10e6; // see AN: https://alice-notes.web.cern.ch/node/1515
209+
}
210+
211+
for (const auto& bc : bcs) {
212+
bool hasFT0 = bc.has_foundFT0();
213+
bool hasZDC = bc.has_foundZDC();
214+
if (!hasFT0 && !hasZDC)
215+
continue;
216+
bool isSelectedBc = true;
217+
if (rejectAtTFBoundary && !bc.selection_bit(aod::evsel::kNoTimeFrameBorder))
218+
isSelectedBc = false;
219+
if (noITSROFrameBorder && !bc.selection_bit(aod::evsel::kNoITSROFrameBorder))
220+
isSelectedBc = false;
221+
if (hasFT0) {
222+
auto ft0TrgMask = bc.ft0().triggerMask();
223+
if (TESTBIT(ft0TrgMask, o2::fit::Triggers::bitVertex)) {
224+
hCountersTrg->Fill("TVX", 1);
225+
if (isSelectedBc)
226+
hCountersTrgBcSel->Fill("TVX", 1);
227+
}
228+
if (TESTBIT(ft0TrgMask, o2::fit::Triggers::bitVertex) && TESTBIT(ft0TrgMask, o2::fit::Triggers::bitCen)) {
229+
hCountersTrg->Fill("TCE", 1);
230+
hLumi->Fill("TCE", 1. / csTCE);
231+
if (isSelectedBc) {
232+
hCountersTrgBcSel->Fill("TCE", 1);
233+
hLumiBcSel->Fill("TCE", 1. / csTCE);
234+
}
235+
}
236+
}
237+
if (hasZDC) {
238+
if (bc.selection_bit(aod::evsel::kIsBBZNA) || bc.selection_bit(aod::evsel::kIsBBZNC)) {
239+
hCountersTrg->Fill("ZEM", 1);
240+
hLumi->Fill("ZEM", 1. / csZEM);
241+
if (isSelectedBc) {
242+
hCountersTrgBcSel->Fill("ZEM", 1);
243+
hLumiBcSel->Fill("ZEM", 1. / csZEM);
244+
}
245+
}
246+
if (bc.selection_bit(aod::evsel::kIsBBZNC)) {
247+
hCountersTrg->Fill("ZNC", 1);
248+
hLumi->Fill("ZNC", 1. / csZNC);
249+
if (isSelectedBc) {
250+
hCountersTrgBcSel->Fill("ZNC", 1);
251+
hLumiBcSel->Fill("ZNC", 1. / csZNC);
252+
}
253+
}
254+
}
255+
}
256+
}
257+
258+
PROCESS_SWITCH(SGCandProducer, processCountersTrg, "Produce trigger counters and luminosity histograms", true);
259+
183260
// function to process reconstructed data
184261
template <typename TCol>
185262
void processReco(std::string histdir, TCol const& collision, BCs const& bcs,
@@ -324,6 +401,22 @@ struct SGCandProducer {
324401
histPointers.clear();
325402
if (context.mOptions.get<bool>("processData")) {
326403
histPointers.insert({"reco/Stat", registry.add("reco/Stat", "Cut statistics; Selection criterion; Collisions", {HistType::kTH1F, {{14, -0.5, 13.5}}})});
404+
405+
const AxisSpec axisCountersTrg{10, 0.5, 10.5, ""};
406+
histPointers.insert({"reco/hCountersTrg", registry.add("reco/hCountersTrg", "Trigger counts before selections; Trigger; Counts", {HistType::kTH1F, {axisCountersTrg}})});
407+
histPointers.insert({"reco/hCountersTrgBcSel", registry.add("reco/hCountersTrgSel", "Trigger counts after BC selections; Trigger; Counts", {HistType::kTH1F, {axisCountersTrg}})});
408+
histPointers.insert({"reco/hLumi", registry.add("reco/hLumi", "Integrated luminosity before selections; Trigger; Luminosity, 1/#mub", {HistType::kTH1F, {axisCountersTrg}})});
409+
histPointers.insert({"reco/hLumiBcSel", registry.add("reco/hLumiBcSel", "Integrated luminosity before selections; Trigger; Luminosity, 1/#mub", {HistType::kTH1F, {axisCountersTrg}})});
410+
auto hCountersTrg = getHist(TH1, "reco/hCountersTrg");
411+
auto hCountersTrgBcSel = getHist(TH1, "reco/hCountersTrgBcSel");
412+
auto hLumi = getHist(TH1, "reco/hLumi");
413+
auto hLumiBcSel = getHist(TH1, "reco/hLumiBcSel");
414+
for (auto h : {hCountersTrg, hCountersTrgBcSel, hLumi, hLumiBcSel}) {
415+
h->GetXaxis()->SetBinLabel(1, "TVX");
416+
h->GetXaxis()->SetBinLabel(2, "TCE");
417+
h->GetXaxis()->SetBinLabel(3, "ZEM");
418+
h->GetXaxis()->SetBinLabel(4, "ZNC");
419+
}
327420
}
328421
if (context.mOptions.get<bool>("processMcData")) {
329422
histPointers.insert({"MCreco/Stat", registry.add("MCreco/Stat", "Cut statistics; Selection criterion; Collisions", {HistType::kTH1F, {{14, -0.5, 13.5}}})});

0 commit comments

Comments
 (0)