Skip to content

Commit ac43779

Browse files
authored
[PWGDQ] Add optional fetching of IR per event from CCDB (#16811)
1 parent ec4a242 commit ac43779

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

PWGDQ/Core/VarManager.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,8 @@ void VarManager::SetDefaultVarNames()
916916
fgVariableUnits[kDCAzNPeaksTrimmed2] = "";
917917
fgVariableNames[kDCAzNPeaksTrimmed3] = "Number of peaks in binned DCAz distribution (trimmed 3)";
918918
fgVariableUnits[kDCAzNPeaksTrimmed3] = "";
919+
fgVariableNames[kInteractionRate] = "Interaction rate";
920+
fgVariableUnits[kInteractionRate] = "kHz";
919921
fgVariableNames[kPt] = "p_{T}";
920922
fgVariableUnits[kPt] = "GeV/c";
921923
fgVariableNames[kPt1] = "p_{T1}";
@@ -2196,6 +2198,7 @@ void VarManager::SetDefaultVarNames()
21962198
fgVarNamesMap["kTwoR2EP1"] = kTwoR2EP1;
21972199
fgVarNamesMap["kTwoR2EP2"] = kTwoR2EP2;
21982200
fgVarNamesMap["kNPairsPerEvent"] = kNPairsPerEvent;
2201+
fgVarNamesMap["kInteractionRate"] = kInteractionRate;
21992202
fgVarNamesMap["kNEventWiseVariables"] = kNEventWiseVariables;
22002203
fgVarNamesMap["kX"] = kX;
22012204
fgVarNamesMap["kY"] = kY;

PWGDQ/Core/VarManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ class VarManager : public TObject
495495
kTwoR2EP1, // Event plane resolution of event2 for ME technique
496496
kTwoR2EP2, // Event plane resolution of event2 for ME technique
497497
kNPairsPerEvent, // number of pairs per event in same-event or mixed-event pairing
498+
kInteractionRate,
498499

499500
// Variables for event mixing with cumulant
500501
kV22m,

PWGDQ/Tasks/tableReader_withAssoc.cxx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "PWGDQ/DataModel/ReducedInfoTables.h"
2525

2626
#include "Common/CCDB/EventSelectionParams.h"
27+
#include "Common/CCDB/ctpRateFetcher.h"
2728
#include "Common/Core/RecoDecay.h"
2829
#include "Common/Core/TableHelper.h"
2930

@@ -330,13 +331,16 @@ struct AnalysisEventSelection {
330331
Configurable<bool> fConfigRunZorro{"cfgRunZorro", false, "Enable event selection with zorro [WARNING: under debug, do not enable!]"};
331332
Configurable<std::string> fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
332333
Configurable<int64_t> fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
334+
Configurable<bool> fConfigFetchInteractionRate{"cfgFetchInteractionRate", false, "Fetch event-wise interaction rate from the CCDB"};
335+
Configurable<std::string> fConfigIRSource{"cfgIRSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
333336

334337
HistogramManager* fHistMan = nullptr;
335338
MixingHandler* fMixHandler = nullptr;
336339
AnalysisCompositeCut* fEventCut = nullptr;
337340

338341
Service<o2::ccdb::BasicCCDBManager> fCCDB{};
339342
o2::ccdb::CcdbApi fCCDBApi;
343+
ctpRateFetcher rateFetcher;
340344

341345
std::map<int64_t, bool> fSelMap; // key: reduced event global index, value: event selection decision
342346
std::map<uint64_t, std::vector<int64_t>> fBCCollMap; // key: global BC, value: vector of reduced event global indices
@@ -442,6 +446,10 @@ struct AnalysisEventSelection {
442446
// Reset the fValues array and fill event observables
443447
VarManager::ResetValues(0, VarManager::kNEventWiseVariables);
444448
VarManager::FillEvent<TEventFillMap>(event);
449+
// Get the instantaneous IR from the CCDB
450+
if (fConfigFetchInteractionRate.value) {
451+
VarManager::fgValues[VarManager::kInteractionRate] = rateFetcher.fetch(fCCDB.service, event.timestamp(), fCurrentRun, fConfigIRSource.value, true) / 1000.; // kHz
452+
}
445453

446454
bool decision = false;
447455
// Fill histograms in the class Event, before cuts
@@ -3074,8 +3082,11 @@ struct AnalysisAsymmetricPairing {
30743082
Configurable<bool> fConfigUseAbsDCA{"cfgUseAbsDCA", false, "Use absolute DCA minimization instead of chi^2 minimization in secondary vertexing"};
30753083
Configurable<bool> fConfigPropToPCA{"cfgPropToPCA", false, "Propagate tracks to secondary vertex"};
30763084
Configurable<std::string> fConfigLutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"};
3085+
Configurable<bool> fConfigFetchInteractionRate{"cfgFetchInteractionRate", false, "Fetch event-wise interaction rate from the CCDB"};
3086+
Configurable<std::string> fConfigIRSource{"cfgIRSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
30773087

30783088
Service<o2::ccdb::BasicCCDBManager> fCCDB{};
3089+
ctpRateFetcher rateFetcher;
30793090

30803091
HistogramManager* fHistMan = nullptr;
30813092

@@ -3415,6 +3426,10 @@ struct AnalysisAsymmetricPairing {
34153426
// Reset the fValues array
34163427
VarManager::ResetValues(0, VarManager::kNVars);
34173428
VarManager::FillEvent<TEventFillMap>(event, dqtablereader_helpers::varValues());
3429+
// Get the instantaneous IR from the CCDB
3430+
if (fConfigFetchInteractionRate.value) {
3431+
VarManager::fgValues[VarManager::kInteractionRate] = rateFetcher.fetch(fCCDB.service, event.timestamp(), fCurrentRun, fConfigIRSource.value, true) / 1000.; // kHz
3432+
}
34183433

34193434
auto groupedLegAAssocs = legACandidateAssocs.sliceBy(preslice, event.globalIndex());
34203435
if (groupedLegAAssocs.size() == 0) {

0 commit comments

Comments
 (0)