Skip to content

Commit 410a6e5

Browse files
authored
[PWGCF] flowtask: reduce configurables; read weight list; (#10075)
1 parent f7764e7 commit 410a6e5

File tree

3 files changed

+47
-20
lines changed

3 files changed

+47
-20
lines changed

PWGCF/Flow/Tasks/flowTask.cxx

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "TList.h"
4343
#include <TProfile.h>
4444
#include <TRandom3.h>
45+
#include <TObjArray.h>
4546
#include <TF1.h>
4647

4748
using namespace o2;
@@ -70,7 +71,6 @@ struct FlowTask {
7071
O2_DEFINE_CONFIGURABLE(cfgCutDCAxyppPass3Enabled, bool, false, "switch of ppPass3 DCAxy pt dependent cut")
7172
O2_DEFINE_CONFIGURABLE(cfgCutDCAzPtDepEnabled, bool, false, "switch of DCAz pt dependent cut")
7273
O2_DEFINE_CONFIGURABLE(cfgTrkSelSwitch, bool, false, "switch for self-defined track selection")
73-
O2_DEFINE_CONFIGURABLE(cfgTrkSelRun3ITSMatch, bool, false, "GlobalTrackRun3ITSMatching::Run3ITSall7Layers selection")
7474
O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations")
7575
O2_DEFINE_CONFIGURABLE(cfgUseTentativeEventCounter, bool, false, "After sel8(), count events regardless of real event selection")
7676
O2_DEFINE_CONFIGURABLE(cfgEvSelkNoSameBunchPileup, bool, false, "rejects collisions which are associated with the same found-by-T0 bunch crossing")
@@ -91,6 +91,8 @@ struct FlowTask {
9191
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeightsRefPt, bool, false, "NUA weights are filled in ref pt bins")
9292
O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object")
9393
O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object")
94+
O2_DEFINE_CONFIGURABLE(cfgAcceptanceList, std::string, "", "CCDB path to acceptance lsit object")
95+
O2_DEFINE_CONFIGURABLE(cfgAcceptanceListEnabled, bool, false, "switch of acceptance list")
9496
O2_DEFINE_CONFIGURABLE(cfgEvSelOccupancy, bool, true, "Occupancy cut")
9597
O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 500, "High cut on TPC occupancy")
9698
O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy")
@@ -99,17 +101,10 @@ struct FlowTask {
99101
Configurable<std::vector<std::string>> cfgUserDefineGFWName{"cfgUserDefineGFWName", std::vector<std::string>{"Ch02Gap22", "Ch12Gap22"}, "User defined GFW Name"};
100102
Configurable<std::vector<int>> cfgRunRemoveList{"cfgRunRemoveList", std::vector<int>{-1}, "excluded run numbers"};
101103

102-
ConfigurableAxis axisVertex{"axisVertex", {40, -20, 20}, "vertex axis for histograms"};
103-
ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"};
104-
ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"};
105104
ConfigurableAxis axisPtHist{"axisPtHist", {100, 0., 10.}, "pt axis for histograms"};
106105
ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10}, "pt axis for histograms"};
107106
ConfigurableAxis axisIndependent{"axisIndependent", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "X axis for histograms"};
108-
ConfigurableAxis axisCentForQA{"axisCentForQA", {100, 0, 100}, "centrality for QA"};
109107
ConfigurableAxis axisNch{"axisNch", {4000, 0, 4000}, "N_{ch}"};
110-
ConfigurableAxis axisT0C{"axisT0C", {70, 0, 70000}, "N_{ch} (T0C)"};
111-
ConfigurableAxis axisT0A{"axisT0A", {200, 0, 200000}, "N_{ch} (T0A)"};
112-
ConfigurableAxis axisNchPV{"axisNchPV", {4000, 0, 4000}, "N_{ch} (PV)"};
113108
ConfigurableAxis axisDCAz{"axisDCAz", {200, -2, 2}, "DCA_{z} (cm)"};
114109
ConfigurableAxis axisDCAxy{"axisDCAxy", {200, -1, 1}, "DCA_{xy} (cm)"};
115110

@@ -119,6 +114,7 @@ struct FlowTask {
119114
// Corrections
120115
TH1D* mEfficiency = nullptr;
121116
GFWWeights* mAcceptance = nullptr;
117+
TObjArray* mAcceptanceList = nullptr;
122118
bool correctionsLoaded = false;
123119

124120
// Connect to ccdb
@@ -169,6 +165,13 @@ struct FlowTask {
169165

170166
void init(InitContext const&)
171167
{
168+
const AxisSpec axisVertex{40, -20, 20, "Vtxz (cm)"};
169+
const AxisSpec axisPhi{60, 0.0, constants::math::TwoPI, "#varphi"};
170+
const AxisSpec axisEta{40, -1., 1., "#eta"};
171+
const AxisSpec axisCentForQA{100, 0, 100, "centrality (%)"};
172+
const AxisSpec axisT0C{70, 0, 70000, "N_{ch} (T0C)"};
173+
const AxisSpec axisT0A{200, 0, 200000, "N_{ch} (T0A)"};
174+
172175
ccdb->setURL(ccdbUrl.value);
173176
ccdb->setCaching(true);
174177
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
@@ -212,15 +215,15 @@ struct FlowTask {
212215
if (!cfgUseSmallMemory) {
213216
registry.add("BeforeSel8_globalTracks_centT0C", "before sel8;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}});
214217
registry.add("BeforeCut_globalTracks_centT0C", "before cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}});
215-
registry.add("BeforeCut_PVTracks_centT0C", "before cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNchPV}});
216-
registry.add("BeforeCut_globalTracks_PVTracks", "before cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNchPV, axisNch}});
218+
registry.add("BeforeCut_PVTracks_centT0C", "before cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNch}});
219+
registry.add("BeforeCut_globalTracks_PVTracks", "before cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNch, axisNch}});
217220
registry.add("BeforeCut_globalTracks_multT0A", "before cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}});
218221
registry.add("BeforeCut_globalTracks_multV0A", "before cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}});
219222
registry.add("BeforeCut_multV0A_multT0A", "before cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {axisT0A, axisT0A}});
220223
registry.add("BeforeCut_multT0C_centT0C", "before cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, axisT0C}});
221224
registry.add("globalTracks_centT0C", "after cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}});
222-
registry.add("PVTracks_centT0C", "after cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNchPV}});
223-
registry.add("globalTracks_PVTracks", "after cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNchPV, axisNch}});
225+
registry.add("PVTracks_centT0C", "after cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNch}});
226+
registry.add("globalTracks_PVTracks", "after cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNch, axisNch}});
224227
registry.add("globalTracks_multT0A", "after cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}});
225228
registry.add("globalTracks_multV0A", "after cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}});
226229
registry.add("multV0A_multT0A", "after cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {axisT0A, axisT0A}});
@@ -416,11 +419,7 @@ struct FlowTask {
416419
fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17);
417420
}
418421

419-
if (cfgTrkSelRun3ITSMatch) {
420-
myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSall7Layers, TrackSelection::GlobalTrackRun3DCAxyCut::Default);
421-
} else {
422-
myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default);
423-
}
422+
myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default);
424423
myTrackSel.SetMinNClustersTPC(cfgCutTPCclu);
425424
myTrackSel.SetMinNClustersITS(cfgCutITSclu);
426425
if (cfgCutDCAxyppPass3Enabled)
@@ -466,17 +465,30 @@ struct FlowTask {
466465
return;
467466
}
468467

469-
void loadCorrections(uint64_t timestamp)
468+
void loadCorrections(uint64_t timestamp, int runNumber)
470469
{
471470
if (correctionsLoaded)
472471
return;
473-
if (cfgAcceptance.value.empty() == false) {
472+
if (!cfgAcceptanceListEnabled && cfgAcceptance.value.empty() == false) {
474473
mAcceptance = ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance, timestamp);
475474
if (mAcceptance)
476475
LOGF(info, "Loaded acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance);
477476
else
478477
LOGF(warning, "Could not load acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance);
479478
}
479+
if (cfgAcceptanceListEnabled && cfgAcceptanceList.value.empty() == false) {
480+
mAcceptanceList = ccdb->getForTimeStamp<TObjArray>(cfgAcceptanceList, timestamp);
481+
if (mAcceptanceList == nullptr) {
482+
LOGF(fatal, "Could not load acceptance weights list from %s", cfgAcceptanceList.value.c_str());
483+
}
484+
LOGF(info, "Loaded acceptance weights list from %s (%p)", cfgAcceptanceList.value.c_str(), (void*)mAcceptanceList);
485+
486+
mAcceptance = static_cast<GFWWeights*>(mAcceptanceList->FindObject(Form("%d", runNumber)));
487+
if (mAcceptance == nullptr) {
488+
LOGF(fatal, "Could not find acceptance weights for run %d in acceptance list", runNumber);
489+
}
490+
LOGF(info, "Loaded acceptance weights (%p) for run %d from list (%p)", (void*)mAcceptance, runNumber, (void*)mAcceptanceList);
491+
}
480492
if (cfgEfficiency.value.empty() == false) {
481493
mEfficiency = ccdb->getForTimeStamp<TH1D>(cfgEfficiency, timestamp);
482494
if (mEfficiency == nullptr) {
@@ -698,7 +710,7 @@ struct FlowTask {
698710
return;
699711
gCurrentHadronicRate->Fill(seconds, hadronicRate);
700712
}
701-
loadCorrections(bc.timestamp());
713+
loadCorrections(bc.timestamp(), currentRunNumber);
702714
registry.fill(HIST("hEventCount"), 4.5);
703715

704716
// fill event QA

PWGCF/GenericFramework/Core/GFWWeights.cxx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,3 +482,17 @@ void GFWWeights::mergeWeights(GFWWeights* other)
482482
addArray(fW_data, other->getDataArray());
483483
return;
484484
}
485+
void GFWWeights::setTH3D(TH3D* th3d)
486+
{
487+
if (!fW_data) {
488+
fW_data = new TObjArray();
489+
fW_data->SetName("GFWWeights_Data");
490+
fW_data->SetOwner(kTRUE);
491+
fW_data->Add(th3d);
492+
return;
493+
}
494+
TString ts(fW_data->At(0)->GetName());
495+
TH3D* trash = reinterpret_cast<TH3D*>(fW_data->RemoveAt(0));
496+
delete trash;
497+
fW_data->Add(reinterpret_cast<TH3D*>(th3d->Clone(ts.Data())));
498+
}

PWGCF/GenericFramework/Core/GFWWeights.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class GFWWeights : public TNamed
6060
TH1D* getdNdPhi();
6161
TH1D* getEfficiency(double etamin, double etamax, double vzmin, double vzmax);
6262
void mergeWeights(GFWWeights* other);
63+
void setTH3D(TH3D* th3d);
6364

6465
private:
6566
bool fDataFilled;

0 commit comments

Comments
 (0)