Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 32 additions & 20 deletions PWGCF/Flow/Tasks/flowTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "TList.h"
#include <TProfile.h>
#include <TRandom3.h>
#include <TObjArray.h>
#include <TF1.h>

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

ConfigurableAxis axisVertex{"axisVertex", {40, -20, 20}, "vertex axis for histograms"};
ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"};
ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"};
ConfigurableAxis axisPtHist{"axisPtHist", {100, 0., 10.}, "pt axis for histograms"};
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"};
ConfigurableAxis axisIndependent{"axisIndependent", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "X axis for histograms"};
ConfigurableAxis axisCentForQA{"axisCentForQA", {100, 0, 100}, "centrality for QA"};
ConfigurableAxis axisNch{"axisNch", {4000, 0, 4000}, "N_{ch}"};
ConfigurableAxis axisT0C{"axisT0C", {70, 0, 70000}, "N_{ch} (T0C)"};
ConfigurableAxis axisT0A{"axisT0A", {200, 0, 200000}, "N_{ch} (T0A)"};
ConfigurableAxis axisNchPV{"axisNchPV", {4000, 0, 4000}, "N_{ch} (PV)"};
ConfigurableAxis axisDCAz{"axisDCAz", {200, -2, 2}, "DCA_{z} (cm)"};
ConfigurableAxis axisDCAxy{"axisDCAxy", {200, -1, 1}, "DCA_{xy} (cm)"};

Expand All @@ -119,6 +114,7 @@ struct FlowTask {
// Corrections
TH1D* mEfficiency = nullptr;
GFWWeights* mAcceptance = nullptr;
TObjArray* mAcceptanceList = nullptr;
bool correctionsLoaded = false;

// Connect to ccdb
Expand Down Expand Up @@ -169,6 +165,13 @@ struct FlowTask {

void init(InitContext const&)
{
const AxisSpec axisVertex{40, -20, 20, "Vtxz (cm)"};
const AxisSpec axisPhi{60, 0.0, constants::math::TwoPI, "#varphi"};
const AxisSpec axisEta{40, -1., 1., "#eta"};
const AxisSpec axisCentForQA{100, 0, 100, "centrality (%)"};
const AxisSpec axisT0C{70, 0, 70000, "N_{ch} (T0C)"};
const AxisSpec axisT0A{200, 0, 200000, "N_{ch} (T0A)"};

ccdb->setURL(ccdbUrl.value);
ccdb->setCaching(true);
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
Expand Down Expand Up @@ -212,15 +215,15 @@ struct FlowTask {
if (!cfgUseSmallMemory) {
registry.add("BeforeSel8_globalTracks_centT0C", "before sel8;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}});
registry.add("BeforeCut_globalTracks_centT0C", "before cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}});
registry.add("BeforeCut_PVTracks_centT0C", "before cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNchPV}});
registry.add("BeforeCut_globalTracks_PVTracks", "before cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNchPV, axisNch}});
registry.add("BeforeCut_PVTracks_centT0C", "before cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNch}});
registry.add("BeforeCut_globalTracks_PVTracks", "before cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNch, axisNch}});
registry.add("BeforeCut_globalTracks_multT0A", "before cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}});
registry.add("BeforeCut_globalTracks_multV0A", "before cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}});
registry.add("BeforeCut_multV0A_multT0A", "before cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {axisT0A, axisT0A}});
registry.add("BeforeCut_multT0C_centT0C", "before cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, axisT0C}});
registry.add("globalTracks_centT0C", "after cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}});
registry.add("PVTracks_centT0C", "after cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNchPV}});
registry.add("globalTracks_PVTracks", "after cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNchPV, axisNch}});
registry.add("PVTracks_centT0C", "after cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNch}});
registry.add("globalTracks_PVTracks", "after cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNch, axisNch}});
registry.add("globalTracks_multT0A", "after cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}});
registry.add("globalTracks_multV0A", "after cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}});
registry.add("multV0A_multT0A", "after cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {axisT0A, axisT0A}});
Expand Down Expand Up @@ -416,11 +419,7 @@ struct FlowTask {
fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17);
}

if (cfgTrkSelRun3ITSMatch) {
myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSall7Layers, TrackSelection::GlobalTrackRun3DCAxyCut::Default);
} else {
myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default);
}
myTrackSel = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, TrackSelection::GlobalTrackRun3DCAxyCut::Default);
myTrackSel.SetMinNClustersTPC(cfgCutTPCclu);
myTrackSel.SetMinNClustersITS(cfgCutITSclu);
if (cfgCutDCAxyppPass3Enabled)
Expand Down Expand Up @@ -466,17 +465,30 @@ struct FlowTask {
return;
}

void loadCorrections(uint64_t timestamp)
void loadCorrections(uint64_t timestamp, int runNumber)
{
if (correctionsLoaded)
return;
if (cfgAcceptance.value.empty() == false) {
if (!cfgAcceptanceListEnabled && cfgAcceptance.value.empty() == false) {
mAcceptance = ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance, timestamp);
if (mAcceptance)
LOGF(info, "Loaded acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance);
else
LOGF(warning, "Could not load acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance);
}
if (cfgAcceptanceListEnabled && cfgAcceptanceList.value.empty() == false) {
mAcceptanceList = ccdb->getForTimeStamp<TObjArray>(cfgAcceptanceList, timestamp);
if (mAcceptanceList == nullptr) {
LOGF(fatal, "Could not load acceptance weights list from %s", cfgAcceptanceList.value.c_str());
}
LOGF(info, "Loaded acceptance weights list from %s (%p)", cfgAcceptanceList.value.c_str(), (void*)mAcceptanceList);

mAcceptance = static_cast<GFWWeights*>(mAcceptanceList->FindObject(Form("%d", runNumber)));
if (mAcceptance == nullptr) {
LOGF(fatal, "Could not find acceptance weights for run %d in acceptance list", runNumber);
}
LOGF(info, "Loaded acceptance weights (%p) for run %d from list (%p)", (void*)mAcceptance, runNumber, (void*)mAcceptanceList);
}
if (cfgEfficiency.value.empty() == false) {
mEfficiency = ccdb->getForTimeStamp<TH1D>(cfgEfficiency, timestamp);
if (mEfficiency == nullptr) {
Expand Down Expand Up @@ -698,7 +710,7 @@ struct FlowTask {
return;
gCurrentHadronicRate->Fill(seconds, hadronicRate);
}
loadCorrections(bc.timestamp());
loadCorrections(bc.timestamp(), currentRunNumber);
registry.fill(HIST("hEventCount"), 4.5);

// fill event QA
Expand Down
14 changes: 14 additions & 0 deletions PWGCF/GenericFramework/Core/GFWWeights.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check warning on line 1 in PWGCF/GenericFramework/Core/GFWWeights.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -8,7 +8,7 @@
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

Check warning on line 11 in PWGCF/GenericFramework/Core/GFWWeights.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.

Check warning on line 11 in PWGCF/GenericFramework/Core/GFWWeights.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

Check warning on line 11 in PWGCF/GenericFramework/Core/GFWWeights.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \author is missing, incorrect or misplaced.
#include "GFWWeights.h"
#include "TMath.h"
#include <cstdio>
Expand Down Expand Up @@ -68,7 +68,7 @@
fW_data->SetName("GFWWeights_Data");
fW_data->SetOwner(kTRUE);
const char* tnd = getBinName(0, 0, Form("data_%s", this->GetName()));
fW_data->Add(new TH3D(tnd, ";#varphi;#eta;v_{z}", 60, 0, TMath::TwoPi(), 64, -1.6, 1.6, 40, -10, 10));

Check warning on line 71 in PWGCF/GenericFramework/Core/GFWWeights.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Consider using the PI constant (and its multiples and fractions) defined in o2::constants::math.
fDataFilled = kTRUE;
}
if (AddMC) {
Expand Down Expand Up @@ -109,7 +109,7 @@
TH3D* th3 = reinterpret_cast<TH3D*>(tar->FindObject(getBinName(0, 0, pf))); // pT bin 0, V0M bin 0, since all integrated
if (!th3) {
if (!htype)
tar->Add(new TH3D(getBinName(0, 0, pf), ";#varphi;#eta;v_{z}", 60, 0, TMath::TwoPi(), 64, -1.6, 1.6, 40, -10, 10)); // 0,0 since all integrated

Check warning on line 112 in PWGCF/GenericFramework/Core/GFWWeights.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Consider using the PI constant (and its multiples and fractions) defined in o2::constants::math.
th3 = reinterpret_cast<TH3D*>(tar->At(tar->GetEntries() - 1));
}
th3->Fill(htype ? pt : phi, eta, vz, weight);
Expand Down Expand Up @@ -365,9 +365,9 @@
fW_data->Add(reinterpret_cast<TH3D*>(fAccInt->Clone(ts.Data())));
delete fAccInt;
}
Long64_t GFWWeights::Merge(TCollection* collist)

Check warning on line 368 in PWGCF/GenericFramework/Core/GFWWeights.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root-entity]

Consider replacing ROOT entities with equivalents from standard C++ or from O2.

Check warning on line 368 in PWGCF/GenericFramework/Core/GFWWeights.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
{
Long64_t nmerged = 0;

Check warning on line 370 in PWGCF/GenericFramework/Core/GFWWeights.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root-entity]

Consider replacing ROOT entities with equivalents from standard C++ or from O2.
if (!fW_data) {
fW_data = new TObjArray();
fW_data->SetName("Weights_Data");
Expand All @@ -383,7 +383,7 @@
fW_mcgen->SetName("Weights_MCGen");
fW_mcgen->SetOwner(kTRUE);
}
GFWWeights* l_w = 0;

Check warning on line 386 in PWGCF/GenericFramework/Core/GFWWeights.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
TIter all_w(collist);
while ((l_w = (reinterpret_cast<GFWWeights*>(all_w())))) {
addArray(fW_data, l_w->getDataArray());
Expand Down Expand Up @@ -482,3 +482,17 @@
addArray(fW_data, other->getDataArray());
return;
}
void GFWWeights::setTH3D(TH3D* th3d)
{
if (!fW_data) {
fW_data = new TObjArray();
fW_data->SetName("GFWWeights_Data");
fW_data->SetOwner(kTRUE);
fW_data->Add(th3d);
return;
}
TString ts(fW_data->At(0)->GetName());
TH3D* trash = reinterpret_cast<TH3D*>(fW_data->RemoveAt(0));
delete trash;
fW_data->Add(reinterpret_cast<TH3D*>(th3d->Clone(ts.Data())));
}
1 change: 1 addition & 0 deletions PWGCF/GenericFramework/Core/GFWWeights.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class GFWWeights : public TNamed
TH1D* getdNdPhi();
TH1D* getEfficiency(double etamin, double etamax, double vzmin, double vzmax);
void mergeWeights(GFWWeights* other);
void setTH3D(TH3D* th3d);

private:
bool fDataFilled;
Expand Down
Loading