|
21 | 21 | #include "DataFormatsFIT/Triggers.h" |
22 | 22 | #include "DataFormatsParameters/GRPMagField.h" |
23 | 23 | #include "DataFormatsParameters/GRPObject.h" |
| 24 | +#include "DataFormatsParameters/GRPLHCIFData.h" |
| 25 | +#include "DataFormatsParameters/AggregatedRunInfo.h" |
24 | 26 |
|
25 | 27 | #include "Framework/AnalysisTask.h" |
26 | 28 | #include "Framework/ASoAHelpers.h" |
@@ -74,6 +76,7 @@ struct SGCandProducer { |
74 | 76 | // Configurables to decide which tables are filled |
75 | 77 | Configurable<bool> fillTrackTables{"fillTrackTables", true, "Fill track tables"}; |
76 | 78 | Configurable<bool> fillFwdTrackTables{"fillFwdTrackTables", true, "Fill forward track tables"}; |
| 79 | + |
77 | 80 | // SG selector |
78 | 81 | SGSelector sgSelector; |
79 | 82 | ctpRateFetcher mRateFetcher; |
@@ -103,6 +106,8 @@ struct SGCandProducer { |
103 | 106 | {}}; |
104 | 107 | std::map<std::string, HistPtr> histPointers; |
105 | 108 |
|
| 109 | + int runNumber = -1; |
| 110 | + |
106 | 111 | // function to update UDFwdTracks, UDFwdTracksExtra |
107 | 112 | template <typename TFwdTrack> |
108 | 113 | void updateUDFwdTrackTables(TFwdTrack const& fwdtrack, uint64_t const& bcnum) |
@@ -180,6 +185,78 @@ struct SGCandProducer { |
180 | 185 | outputTracksLabel(track.globalIndex()); |
181 | 186 | } |
182 | 187 |
|
| 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 | + |
183 | 260 | // function to process reconstructed data |
184 | 261 | template <typename TCol> |
185 | 262 | void processReco(std::string histdir, TCol const& collision, BCs const& bcs, |
@@ -324,6 +401,22 @@ struct SGCandProducer { |
324 | 401 | histPointers.clear(); |
325 | 402 | if (context.mOptions.get<bool>("processData")) { |
326 | 403 | 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 | + } |
327 | 420 | } |
328 | 421 | if (context.mOptions.get<bool>("processMcData")) { |
329 | 422 | histPointers.insert({"MCreco/Stat", registry.add("MCreco/Stat", "Cut statistics; Selection criterion; Collisions", {HistType::kTH1F, {{14, -0.5, 13.5}}})}); |
|
0 commit comments