From deeaf9704d7f887c0ba385132e14e1460cb2eb99 Mon Sep 17 00:00:00 2001 From: Iris_Likmeta Date: Fri, 10 May 2024 11:20:01 -0500 Subject: [PATCH 1/2] Try to fix alibuilt error --- PWGCF/Flow/Tasks/FlowGFWPbPb.cxx | 491 +++++++++++++++---------------- 1 file changed, 242 insertions(+), 249 deletions(-) diff --git a/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx b/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx index 03ab19f4838..72ff5244b1f 100644 --- a/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx +++ b/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx @@ -41,11 +41,10 @@ using namespace o2::framework::expressions; #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; -struct FlowGFWPbPb { +struct FlowGFWPbPb +{ O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range") - O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMin, float, 0.2f, "Minimal pT for poi tracks") - O2_DEFINE_CONFIGURABLE(cfgCutPtPOIMax, float, 10.0f, "Maximal pT for poi tracks") O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "Minimal pT for ref tracks") O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 3.0f, "Maximal pT for ref tracks") O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks") @@ -66,12 +65,9 @@ struct FlowGFWPbPb { ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"}; ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.25, 0.30, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.20, 2.40, 2.60, 2.80, 3.00}, "pt axis for histograms"}; ConfigurableAxis axisPtHist{"axisPtHist", {100, 0., 10.}, "pt axis for histograms"}; - ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "centrality axis for histograms"}; + ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "centrality 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)"}; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); @@ -81,10 +77,10 @@ struct FlowGFWPbPb { GFWWeights* mAcceptance = nullptr; bool correctionsLoaded = false; - // Connect to ccdb - Service ccdb; - Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; - Configurable url{"ccdb-url", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; + // Connect to ccdb + Service ccdb; + Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; // Define output OutputObj fFC{FlowContainer("FlowContainer")}; @@ -92,27 +88,23 @@ struct FlowGFWPbPb { HistogramRegistry registry{"registry"}; // define global variables - GFW* fGFW = new GFW(); // GFW class used from main src + GFW* fGFW = new GFW(); // GFW class used from main src std::vector corrconfigs; TRandom3* fRndm = new TRandom3(0); TAxis* fPtAxis; - std::vector>> BootstrapArray; // TProfile is a shared pointer + std::vector>> BootstrapArray; //TProfile is a shared pointer enum ExtraProfile { - // here are TProfiles for vn-pt correlations that are not implemented in GFW - kc22, - kc24, - kc26, - kc28, - kc22etagap, + // here are TProfiles for vn-pt correlations that are not implemented in GFW + kc22, kc24, kc26, kc28, kc22etagap, - // Count the total number of enum - kCount_ExtraProfile - }; + // Count the total number of enum + kCount_ExtraProfile + }; - using aodCollisions = soa::Filtered>; // collisions filter - using aodTracks = soa::Filtered>; // tracks filter + using aodCollisions = soa::Filtered>; // collisions filter + using aodTracks = soa::Filtered>; // tracks filter // Additional Event selection cuts - Copy from flowGenericFramework.cxx TF1* fPhiCutLow = nullptr; @@ -125,24 +117,24 @@ struct FlowGFWPbPb { TF1* fT0AV0AMean = nullptr; TF1* fT0AV0ASigma = nullptr; - void init(InitContext const&) // Initialization + void init(InitContext const&) // Initialization { ccdb->setURL(url.value); ccdb->setCaching(true); ccdb->setCreatedNotAfter(nolaterthan.value); // Add some output objects to the histogram registry - registry.add("hEventCount", "Number of Event;; Count", {HistType::kTH1D, {{5, 0, 5}}}); + registry.add("hEventCount", "Number of Events;; Count", {HistType::kTH1D, {{4, 0, 4}}}); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event"); registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "after sel8"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "after strict Pile-up cut"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(4, "after additional event cut"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(5, "after correction loads"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "after additional event cut"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(4, "after correction loads"); registry.add("hPhi", "", {HistType::kTH1D, {axisPhi}}); registry.add("hEta", "", {HistType::kTH1D, {axisEta}}); registry.add("hVtxZ", "Vexter Z distribution", {HistType::kTH1D, {axisVertex}}); registry.add("hMult", "Multiplicity distribution", {HistType::kTH1D, {{3000, 0.5, 3000.5}}}); registry.add("hCent", "Centrality distribution", {HistType::kTH1D, {{90, 0, 90}}}); + registry.add("cent_vs_Nch", ";Centrality (%); M (|#eta| < 0.8);", {HistType::kTH2F, {axisCentrality, axisNch}}); // Track QA registry.add("hPt", "p_{T} distribution before cut", {HistType::kTH1D, {axisPtHist}}); @@ -154,44 +146,44 @@ struct FlowGFWPbPb { registry.add("hnTPCCrossedRow", "Number of crossed TPC Rows", {HistType::kTH1D, {{100, 40, 180}}}); // additional Output histograms - registry.add("c22", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); - registry.add("c24", ";Centrality (%) ; C_{2}{4}", {HistType::kTProfile, {axisMultiplicity}}); - registry.add("c26", ";Centrality (%) ; C_{2}{6}", {HistType::kTProfile, {axisMultiplicity}}); - registry.add("c28", ";Centrality (%) ; C_{2}{8}", {HistType::kTProfile, {axisMultiplicity}}); - registry.add("c22etagap", ";Centrality (%) ; C_{2}{2} (|#eta| < 0.8) ", {HistType::kTProfile, {axisMultiplicity}}); + registry.add("c22", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisCentrality}}); + registry.add("c24", ";Centrality (%) ; C_{2}{4}", {HistType::kTProfile, {axisCentrality}}); + registry.add("c26", ";Centrality (%) ; C_{2}{6}", {HistType::kTProfile, {axisCentrality}}); + registry.add("c28", ";Centrality (%) ; C_{2}{8}", {HistType::kTProfile, {axisCentrality}}); + registry.add("c22etagap", ";Centrality (%) ; C_{2}{2} (|#eta| < 0.8) ", {HistType::kTProfile, {axisCentrality}}); // initial array BootstrapArray.resize(cfgNbootstrap); for (int i = 0; i < cfgNbootstrap; i++) { - BootstrapArray[i].resize(kCount_ExtraProfile); + BootstrapArray[i].resize(kCount_ExtraProfile); } for (int i = 0; i < cfgNbootstrap; i++) { - BootstrapArray[i][kc22] = registry.add(Form("BootstrapContainer_%d/c22", i), ";Centrality (%) ; C_{2}{2}", {HistType::kTProfile, {axisMultiplicity}}); - BootstrapArray[i][kc24] = registry.add(Form("BootstrapContainer_%d/c24", i), ";Centrality (%) ; C_{2}{4}", {HistType::kTProfile, {axisMultiplicity}}); - BootstrapArray[i][kc26] = registry.add(Form("BootstrapContainer_%d/c26", i), ";Centrality (%) ; C_{2}{6}", {HistType::kTProfile, {axisMultiplicity}}); - BootstrapArray[i][kc28] = registry.add(Form("BootstrapContainer_%d/c28", i), ";Centrality (%) ; C_{2}{8}", {HistType::kTProfile, {axisMultiplicity}}); - BootstrapArray[i][kc22etagap] = registry.add(Form("BootstrapContainer_%d/c22etagap", i), ";Centrality (%) ; C_{2}{2} (|#eta| < 0.8)", {HistType::kTProfile, {axisMultiplicity}}); - } - - o2::framework::AxisSpec axis = axisPt; - int nPtBins = axis.binEdges.size() - 1; - double* PtBins = &(axis.binEdges)[0]; - fPtAxis = new TAxis(nPtBins, PtBins); - - if (cfgOutputNUAWeights) { - fWeights->SetPtBins(nPtBins, PtBins); - fWeights->Init(true, false); - } + BootstrapArray[i][kc22] = registry.add(Form("BootstrapContainer_%d/c22", i), ";Centrality (%) ; C_{2}{2}", {HistType::kTProfile, {axisCentrality}}); + BootstrapArray[i][kc24] = registry.add(Form("BootstrapContainer_%d/c24", i), ";Centrality (%) ; C_{2}{4}", {HistType::kTProfile, {axisCentrality}}); + BootstrapArray[i][kc26] = registry.add(Form("BootstrapContainer_%d/c26", i), ";Centrality (%) ; C_{2}{6}", {HistType::kTProfile, {axisCentrality}}); + BootstrapArray[i][kc28] = registry.add(Form("BootstrapContainer_%d/c28", i), ";Centrality (%) ; C_{2}{8}", {HistType::kTProfile, {axisCentrality}}); + BootstrapArray[i][kc22etagap] = registry.add(Form("BootstrapContainer_%d/c22etagap", i), ";Centrality (%) ; C_{2}{2} (|#eta| < 0.8)", {HistType::kTProfile, {axisCentrality}}); + } + + o2::framework::AxisSpec axis = axisPt; + int nPtBins = axis.binEdges.size() - 1; + double* PtBins = &(axis.binEdges)[0]; + fPtAxis = new TAxis(nPtBins, PtBins); + + if (cfgOutputNUAWeights) { + fWeights->SetPtBins(nPtBins, PtBins); + fWeights->Init(true, false); + } - // add in FlowContainer to Get boostrap sample automatically - TObjArray* oba = new TObjArray(); - fFC->SetXAxis(fPtAxis); - fFC->SetName("FlowContainer"); - fFC->Initialize(oba, axisMultiplicity, cfgNbootstrap); - delete oba; + // add in FlowContainer to Get boostrap sample automatically + TObjArray* oba = new TObjArray(); + fFC->SetXAxis(fPtAxis); + fFC->SetName("FlowContainer"); + fFC->Initialize(oba, axisCentrality, cfgNbootstrap); + delete oba; - fGFW->AddRegion("full", -0.8, 0.8, 1, 1); // eta region -0.8 to 0.8 + fGFW->AddRegion("full", -0.8, 0.8, 1, 1); // eta region -0.8 to 0.8 fGFW->AddRegion("refN10", -0.8, -0.5, 1, 1); fGFW->AddRegion("refP10", 0.5, 0.8, 1, 1); @@ -200,206 +192,204 @@ struct FlowGFWPbPb { corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 2 2 -2 -2 -2}", "ChFull26", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 2 2 2 -2 -2 -2 -2}", "ChFull28", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN10 {2} refP10 {-2}", "Ch10Gap22", kFALSE)); - fGFW->CreateRegions(); // finalize the initialization + fGFW->CreateRegions(); // finalize the initialization if (cfgUseAdditionalEventCut) { - fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); - fMultPVCutLow->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); - fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); - fMultPVCutHigh->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); - - fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultCutLow->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); - fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultCutHigh->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); - - fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); - fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); - fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); - fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); - } + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); + fMultPVCutLow->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); + fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); + fMultPVCutHigh->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); + + fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultCutLow->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); + fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultCutHigh->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); + + fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); + fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); + fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); + fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); + } - if (cfgUseAdditionalTrackCut) { - fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100); - fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100); + if (cfgUseAdditionalTrackCut) { + fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100); + fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100); } } // end of Initialization - template - void FillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) - { - double dnx, val; - dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); - if (dnx == 0) - return; - if (!corrconf.pTDif) { - val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) - registry.fill(tarName, cent, val, dnx); + template + void FillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) + registry.fill(tarName, cent, val, dnx); + return; + } return; } - return; - } - void FillProfile(const GFW::CorrConfig& corrconf, std::shared_ptr tarName, const double& cent) - { - double dnx, val; - dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); - if (dnx == 0) - return; - if (!corrconf.pTDif) { - val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) { - tarName->Fill(cent, val, dnx); + void FillProfile(const GFW::CorrConfig& corrconf, std::shared_ptr tarName, const double& cent) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) { + tarName->Fill(cent, val, dnx); + } + return; } return; } - return; - } - void FillFC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm) - { - double dnx, val; - dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); - if (dnx == 0) - return; - if (!corrconf.pTDif) { - val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) - fFC->FillProfile(corrconf.Head.c_str(), cent, val, dnx, rndm); - return; - } - for (Int_t i = 1; i <= fPtAxis->GetNbins(); i++) { - dnx = fGFW->Calculate(corrconf, i - 1, kTRUE).real(); - if (dnx == 0) - continue; - val = fGFW->Calculate(corrconf, i - 1, kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) - fFC->FillProfile(Form("%s_pt_%i", corrconf.Head.c_str(), i), cent, val, dnx, rndm); + void FillFC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) + fFC->FillProfile(corrconf.Head.c_str(), cent, val, dnx, rndm); + return; + } + for (Int_t i = 1; i <= fPtAxis->GetNbins(); i++) { + dnx = fGFW->Calculate(corrconf, i - 1, kTRUE).real(); + if (dnx == 0) + continue; + val = fGFW->Calculate(corrconf, i - 1, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) + fFC->FillProfile(Form("%s_pt_%i", corrconf.Head.c_str(), i), cent, val, dnx, rndm); + } + return; + } + + void loadCorrections(uint64_t timestamp) + { + if (correctionsLoaded) + return; + if (cfgAcceptance.value.empty() == false) { + mAcceptance = ccdb->getForTimeStamp(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 (cfgEfficiency.value.empty() == false) { + mEfficiency = ccdb->getForTimeStamp(cfgEfficiency, timestamp); + if (mEfficiency == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEfficiency.value.c_str()); + } + LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency); + } + correctionsLoaded = true; } - return; - } - void loadCorrections(uint64_t timestamp) - { - if (correctionsLoaded) - return; - if (cfgAcceptance.value.empty() == false) { - mAcceptance = ccdb->getForTimeStamp(cfgAcceptance, timestamp); + bool setCurrentParticleWeights(float& weight_nue, float& weight_nua, float phi, float eta, float pt, float vtxz) + { + float eff = 1.; + if (mEfficiency) + eff = mEfficiency->GetBinContent(mEfficiency->FindBin(pt)); + else + eff = 1.0; + if (eff == 0) + return false; + weight_nue = 1. / eff; if (mAcceptance) - LOGF(info, "Loaded acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance); + weight_nua = mAcceptance->GetNUA(phi, eta, vtxz); else - LOGF(warning, "Could not load acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance); + weight_nua = 1; + return true; } - if (cfgEfficiency.value.empty() == false) { - mEfficiency = ccdb->getForTimeStamp(cfgEfficiency, timestamp); - if (mEfficiency == nullptr) { - LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEfficiency.value.c_str()); + + template + bool eventSelected(TCollision collision, const int multTrk, const float centrality) + { + if (collision.alias_bit(kTVXinTRD)) { + // TRD triggered + return 0; + } + if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + // reject collisions close to Time Frame borders + // https://its.cern.ch/jira/browse/O2-4623 + return 0; + } + if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + // reject events affected by the ITS ROF border + // https://its.cern.ch/jira/browse/O2-4309 + return 0; + } + if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + // rejects collisions which are associated with the same "found-by-T0" bunch crossing + // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof + return 0; + } + if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference + // use this cut at low multiplicities with caution + return 0; } - LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency); + return 1; } - correctionsLoaded = true; - } - bool setCurrentParticleWeights(float& weight_nue, float& weight_nua, float phi, float eta, float pt, float vtxz) - { - float eff = 1.; - if (mEfficiency) - eff = mEfficiency->GetBinContent(mEfficiency->FindBin(pt)); - else - eff = 1.0; - if (eff == 0) - return false; - weight_nue = 1. / eff; - if (mAcceptance) - weight_nua = mAcceptance->GetNUA(phi, eta, vtxz); - else - weight_nua = 1; - return true; - } - - template - bool eventSelected(TCollision collision, const int multTrk, const float centrality) - { - if (collision.alias_bit(kTVXinTRD)) { - // TRD triggered - return 0; - } - if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - // reject collisions close to Time Frame borders - // https://its.cern.ch/jira/browse/O2-4623 - return 0; - } - if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - // reject events affected by the ITS ROF border - // https://its.cern.ch/jira/browse/O2-4309 - return 0; - } - if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - // rejects collisions which are associated with the same "found-by-T0" bunch crossing - // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof - return 0; - } - if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference - // use this cut at low multiplicities with caution - return 0; - } - return 1; - } - int getMagneticField(uint64_t timestamp) - { - static o2::parameters::GRPMagField* grpo = nullptr; - if (grpo == nullptr) { - grpo = ccdb->getForTimeStamp(cfgMagnetField, timestamp); + int getMagneticField(uint64_t timestamp) + { + static o2::parameters::GRPMagField* grpo = nullptr; if (grpo == nullptr) { - LOGF(fatal, "GRP object not found in %s for timestamp %llu", cfgMagnetField.value.c_str(), timestamp); - return 0; + grpo = ccdb->getForTimeStamp(cfgMagnetField, timestamp); + if (grpo == nullptr) { + LOGF(fatal, "GRP object not found in %s for timestamp %llu", cfgMagnetField.value.c_str(), timestamp); + return 0; + } + LOGF(info, "Retrieved GRP from %s for timestamp %llu with magnetic field of %d kG", cfgMagnetField.value.c_str(), timestamp, grpo->getNominalL3Field()); } - LOGF(info, "Retrieved GRP from %s for timestamp %llu with magnetic field of %d kG", cfgMagnetField.value.c_str(), timestamp, grpo->getNominalL3Field()); + return grpo->getNominalL3Field(); } - return grpo->getNominalL3Field(); - } - template - bool trackSelected(TTrack track, const int field) - { - double phimodn = track.phi(); - if (field < 0) // for negative polarity field - phimodn = TMath::TwoPi() - phimodn; - if (track.sign() < 0) // for negative charge - phimodn = TMath::TwoPi() - phimodn; - if (phimodn < 0) - LOGF(warning, "phi < 0: %g", phimodn); - - phimodn += TMath::Pi() / 18.0; // to center gap in the middle - phimodn = fmod(phimodn, TMath::Pi() / 9.0); - registry.fill(HIST("pt_phi_bef"), track.pt(), phimodn); - if (phimodn < fPhiCutHigh->Eval(track.pt()) && phimodn > fPhiCutLow->Eval(track.pt())) - return false; // reject track - registry.fill(HIST("pt_phi_aft"), track.pt(), phimodn); - return true; - } + template + bool trackSelected(TTrack track, const int field) + { + double phimodn = track.phi(); + if (field < 0) // for negative polarity field + phimodn = TMath::TwoPi() - phimodn; + if (track.sign() < 0) // for negative charge + phimodn = TMath::TwoPi() - phimodn; + if (phimodn < 0) + LOGF(warning, "phi < 0: %g", phimodn); + + phimodn += TMath::Pi() / 18.0; // to center gap in the middle + phimodn = fmod(phimodn, TMath::Pi() / 9.0); + registry.fill(HIST("pt_phi_bef"), track.pt(), phimodn); + if (phimodn < fPhiCutHigh->Eval(track.pt()) && phimodn > fPhiCutLow->Eval(track.pt())) + return false; // reject track + registry.fill(HIST("pt_phi_aft"), track.pt(), phimodn); + return true; + } void process(aodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, aodTracks const& tracks) { registry.fill(HIST("hEventCount"), 0.5); - if (!collision.sel8()) - return; + if (!collision.sel8()) return; + int Ntot = tracks.size(); - if (Ntot < 1) - return; + if (Ntot < 1) return; registry.fill(HIST("hEventCount"), 1.5); - // place holder for pile-up rejection - registry.fill(HIST("hEventCount"), 2.5); + const auto cent = collision.centFT0C(); - if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent)) - return; - registry.fill(HIST("hEventCount"), 3.5); + if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent)) return; + registry.fill(HIST("hEventCount"), 2.5); float vtxz = collision.posZ(); float l_Random = fRndm->Rndm(); @@ -410,50 +400,49 @@ struct FlowGFWPbPb { auto bc = collision.bc_as(); loadCorrections(bc.timestamp()); - registry.fill(HIST("hEventCount"), 4.5); + registry.fill(HIST("hEventCount"), 3.5); // track weights float weff = 1, wacc = 1; int Magnetfield = 0; if (cfgUseAdditionalTrackCut) { - // magnet field dependence cut - Magnetfield = getMagneticField(bc.timestamp()); + // magnet field dependence cut + Magnetfield = getMagneticField(bc.timestamp()); } for (auto& track : tracks) { - if (track.tpcNClsFound() < cfgCutTPCclu) - continue; - if (cfgUseAdditionalTrackCut && !trackSelected(track, Magnetfield)) - continue; - if (cfgOutputNUAWeights) - fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); - if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz)) - continue; + if (track.tpcNClsFound() < cfgCutTPCclu) + continue; + if (cfgUseAdditionalTrackCut && !trackSelected(track, Magnetfield)) + continue; + if (cfgOutputNUAWeights) + fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); + if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz)) + continue; + - bool WithinPtPOI = (cfgCutPtPOIMin < track.pt()) && (track.pt() < cfgCutPtPOIMax); // within POI pT range bool WithinPtRef = (cfgCutPtMin < track.pt()) && (track.pt() < cfgCutPtMax); // within RF pT range registry.fill(HIST("hPt"), track.pt()); if (WithinPtRef) { - registry.fill(HIST("hPhi"), track.phi()); - registry.fill(HIST("hEta"), track.eta()); - registry.fill(HIST("hPtRef"), track.pt()); - registry.fill(HIST("hChi2prTPCcls"), track.tpcChi2NCl()); - registry.fill(HIST("hnTPCClu"), track.tpcNClsFound()); - registry.fill(HIST("hnTPCCrossedRow"), track.tpcNClsCrossedRows()); - } + registry.fill(HIST("hPhi"), track.phi()); + registry.fill(HIST("hEta"), track.eta()); + registry.fill(HIST("hPtRef"), track.pt()); + registry.fill(HIST("hChi2prTPCcls"), track.tpcChi2NCl()); + registry.fill(HIST("hnTPCClu"), track.tpcNClsFound()); + registry.fill(HIST("hnTPCCrossedRow"), track.tpcNClsCrossedRows()); + } if (WithinPtRef) - fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1); - if (WithinPtPOI) - fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 2); - if (WithinPtPOI && WithinPtRef) - fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 4); + fGFW->Fill(track.eta(),fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1); + } // End of track loop + registry.fill(HIST("cent_vs_Nch"), cent, Ntot); + // Filling c22 with ROOT TProfile FillProfile(corrconfigs.at(0), HIST("c22"), cent); FillProfile(corrconfigs.at(1), HIST("c24"), cent); @@ -461,7 +450,7 @@ struct FlowGFWPbPb { FillProfile(corrconfigs.at(3), HIST("c28"), cent); FillProfile(corrconfigs.at(4), HIST("c22etagap"), cent); - // Filling Bootstrap Samples + //Filling Bootstrap Samples int SampleIndex = static_cast(cfgNbootstrap * l_Random); FillProfile(corrconfigs.at(0), BootstrapArray[SampleIndex][kc22], cent); FillProfile(corrconfigs.at(1), BootstrapArray[SampleIndex][kc24], cent); @@ -469,13 +458,17 @@ struct FlowGFWPbPb { FillProfile(corrconfigs.at(3), BootstrapArray[SampleIndex][kc28], cent); FillProfile(corrconfigs.at(4), BootstrapArray[SampleIndex][kc22etagap], cent); + + // Filling Flow Container for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) { - FillFC(corrconfigs.at(l_ind), cent, l_Random); + FillFC(corrconfigs.at(l_ind), cent, l_Random); } + + } // End of process -}; // end of struct +}; // end of struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From ac2af2a71bebd6b488d451dad2be69ccafaca28c Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Fri, 10 May 2024 16:21:32 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- PWGCF/Flow/Tasks/FlowGFWPbPb.cxx | 452 +++++++++++++++---------------- 1 file changed, 225 insertions(+), 227 deletions(-) diff --git a/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx b/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx index 72ff5244b1f..d02c981204a 100644 --- a/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx +++ b/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx @@ -41,8 +41,7 @@ using namespace o2::framework::expressions; #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; -struct FlowGFWPbPb -{ +struct FlowGFWPbPb { O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range") O2_DEFINE_CONFIGURABLE(cfgCutPtMin, float, 0.2f, "Minimal pT for ref tracks") @@ -77,10 +76,10 @@ struct FlowGFWPbPb GFWWeights* mAcceptance = nullptr; bool correctionsLoaded = false; - // Connect to ccdb - Service ccdb; - Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; - Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + // Connect to ccdb + Service ccdb; + Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; // Define output OutputObj fFC{FlowContainer("FlowContainer")}; @@ -88,23 +87,27 @@ struct FlowGFWPbPb HistogramRegistry registry{"registry"}; // define global variables - GFW* fGFW = new GFW(); // GFW class used from main src + GFW* fGFW = new GFW(); // GFW class used from main src std::vector corrconfigs; TRandom3* fRndm = new TRandom3(0); TAxis* fPtAxis; - std::vector>> BootstrapArray; //TProfile is a shared pointer + std::vector>> BootstrapArray; // TProfile is a shared pointer enum ExtraProfile { - // here are TProfiles for vn-pt correlations that are not implemented in GFW - kc22, kc24, kc26, kc28, kc22etagap, + // here are TProfiles for vn-pt correlations that are not implemented in GFW + kc22, + kc24, + kc26, + kc28, + kc22etagap, - // Count the total number of enum - kCount_ExtraProfile - }; + // Count the total number of enum + kCount_ExtraProfile + }; - using aodCollisions = soa::Filtered>; // collisions filter - using aodTracks = soa::Filtered>; // tracks filter + using aodCollisions = soa::Filtered>; // collisions filter + using aodTracks = soa::Filtered>; // tracks filter // Additional Event selection cuts - Copy from flowGenericFramework.cxx TF1* fPhiCutLow = nullptr; @@ -117,7 +120,7 @@ struct FlowGFWPbPb TF1* fT0AV0AMean = nullptr; TF1* fT0AV0ASigma = nullptr; - void init(InitContext const&) // Initialization + void init(InitContext const&) // Initialization { ccdb->setURL(url.value); ccdb->setCaching(true); @@ -155,35 +158,35 @@ struct FlowGFWPbPb // initial array BootstrapArray.resize(cfgNbootstrap); for (int i = 0; i < cfgNbootstrap; i++) { - BootstrapArray[i].resize(kCount_ExtraProfile); + BootstrapArray[i].resize(kCount_ExtraProfile); } for (int i = 0; i < cfgNbootstrap; i++) { - BootstrapArray[i][kc22] = registry.add(Form("BootstrapContainer_%d/c22", i), ";Centrality (%) ; C_{2}{2}", {HistType::kTProfile, {axisCentrality}}); - BootstrapArray[i][kc24] = registry.add(Form("BootstrapContainer_%d/c24", i), ";Centrality (%) ; C_{2}{4}", {HistType::kTProfile, {axisCentrality}}); - BootstrapArray[i][kc26] = registry.add(Form("BootstrapContainer_%d/c26", i), ";Centrality (%) ; C_{2}{6}", {HistType::kTProfile, {axisCentrality}}); - BootstrapArray[i][kc28] = registry.add(Form("BootstrapContainer_%d/c28", i), ";Centrality (%) ; C_{2}{8}", {HistType::kTProfile, {axisCentrality}}); - BootstrapArray[i][kc22etagap] = registry.add(Form("BootstrapContainer_%d/c22etagap", i), ";Centrality (%) ; C_{2}{2} (|#eta| < 0.8)", {HistType::kTProfile, {axisCentrality}}); - } - - o2::framework::AxisSpec axis = axisPt; - int nPtBins = axis.binEdges.size() - 1; - double* PtBins = &(axis.binEdges)[0]; - fPtAxis = new TAxis(nPtBins, PtBins); - - if (cfgOutputNUAWeights) { - fWeights->SetPtBins(nPtBins, PtBins); - fWeights->Init(true, false); - } + BootstrapArray[i][kc22] = registry.add(Form("BootstrapContainer_%d/c22", i), ";Centrality (%) ; C_{2}{2}", {HistType::kTProfile, {axisCentrality}}); + BootstrapArray[i][kc24] = registry.add(Form("BootstrapContainer_%d/c24", i), ";Centrality (%) ; C_{2}{4}", {HistType::kTProfile, {axisCentrality}}); + BootstrapArray[i][kc26] = registry.add(Form("BootstrapContainer_%d/c26", i), ";Centrality (%) ; C_{2}{6}", {HistType::kTProfile, {axisCentrality}}); + BootstrapArray[i][kc28] = registry.add(Form("BootstrapContainer_%d/c28", i), ";Centrality (%) ; C_{2}{8}", {HistType::kTProfile, {axisCentrality}}); + BootstrapArray[i][kc22etagap] = registry.add(Form("BootstrapContainer_%d/c22etagap", i), ";Centrality (%) ; C_{2}{2} (|#eta| < 0.8)", {HistType::kTProfile, {axisCentrality}}); + } + + o2::framework::AxisSpec axis = axisPt; + int nPtBins = axis.binEdges.size() - 1; + double* PtBins = &(axis.binEdges)[0]; + fPtAxis = new TAxis(nPtBins, PtBins); - // add in FlowContainer to Get boostrap sample automatically - TObjArray* oba = new TObjArray(); - fFC->SetXAxis(fPtAxis); - fFC->SetName("FlowContainer"); - fFC->Initialize(oba, axisCentrality, cfgNbootstrap); - delete oba; + if (cfgOutputNUAWeights) { + fWeights->SetPtBins(nPtBins, PtBins); + fWeights->Init(true, false); + } + + // add in FlowContainer to Get boostrap sample automatically + TObjArray* oba = new TObjArray(); + fFC->SetXAxis(fPtAxis); + fFC->SetName("FlowContainer"); + fFC->Initialize(oba, axisCentrality, cfgNbootstrap); + delete oba; - fGFW->AddRegion("full", -0.8, 0.8, 1, 1); // eta region -0.8 to 0.8 + fGFW->AddRegion("full", -0.8, 0.8, 1, 1); // eta region -0.8 to 0.8 fGFW->AddRegion("refN10", -0.8, -0.5, 1, 1); fGFW->AddRegion("refP10", 0.5, 0.8, 1, 1); @@ -192,203 +195,204 @@ struct FlowGFWPbPb corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 2 2 -2 -2 -2}", "ChFull26", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 2 2 2 -2 -2 -2 -2}", "ChFull28", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN10 {2} refP10 {-2}", "Ch10Gap22", kFALSE)); - fGFW->CreateRegions(); // finalize the initialization + fGFW->CreateRegions(); // finalize the initialization if (cfgUseAdditionalEventCut) { - fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); - fMultPVCutLow->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); - fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); - fMultPVCutHigh->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); - - fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultCutLow->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); - fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultCutHigh->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); - - fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); - fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); - fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); - fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); - } + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); + fMultPVCutLow->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); + fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x + 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100); + fMultPVCutHigh->SetParameters(3257.29, -121.848, 1.98492, -0.0172128, 6.47528e-05, 154.756, -1.86072, -0.0274713, 0.000633499, -3.37757e-06); + + fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultCutLow->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); + fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultCutHigh->SetParameters(1654.46, -47.2379, 0.449833, -0.0014125, 150.773, -3.67334, 0.0530503, -0.000614061, 3.15956e-06); + + fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); + fT0AV0AMean->SetParameters(-1601.0581, 9.417652e-01); + fT0AV0ASigma = new TF1("fT0AV0ASigma", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 200000); + fT0AV0ASigma->SetParameters(463.4144, 6.796509e-02, -9.097136e-07, 7.971088e-12, -2.600581e-17); + } - if (cfgUseAdditionalTrackCut) { - fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100); - fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100); + if (cfgUseAdditionalTrackCut) { + fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100); + fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100); } } // end of Initialization - template - void FillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) - { - double dnx, val; - dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); - if (dnx == 0) - return; - if (!corrconf.pTDif) { - val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) - registry.fill(tarName, cent, val, dnx); - return; - } + template + void FillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) + registry.fill(tarName, cent, val, dnx); return; } + return; + } - void FillProfile(const GFW::CorrConfig& corrconf, std::shared_ptr tarName, const double& cent) - { - double dnx, val; - dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); - if (dnx == 0) - return; - if (!corrconf.pTDif) { - val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) { - tarName->Fill(cent, val, dnx); - } - return; + void FillProfile(const GFW::CorrConfig& corrconf, std::shared_ptr tarName, const double& cent) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) { + tarName->Fill(cent, val, dnx); } return; } + return; + } - void FillFC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm) - { - double dnx, val; - dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); - if (dnx == 0) - return; - if (!corrconf.pTDif) { - val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) - fFC->FillProfile(corrconf.Head.c_str(), cent, val, dnx, rndm); - return; - } - for (Int_t i = 1; i <= fPtAxis->GetNbins(); i++) { - dnx = fGFW->Calculate(corrconf, i - 1, kTRUE).real(); - if (dnx == 0) - continue; - val = fGFW->Calculate(corrconf, i - 1, kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) - fFC->FillProfile(Form("%s_pt_%i", corrconf.Head.c_str(), i), cent, val, dnx, rndm); - } - return; - } - - void loadCorrections(uint64_t timestamp) - { - if (correctionsLoaded) - return; - if (cfgAcceptance.value.empty() == false) { - mAcceptance = ccdb->getForTimeStamp(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 (cfgEfficiency.value.empty() == false) { - mEfficiency = ccdb->getForTimeStamp(cfgEfficiency, timestamp); - if (mEfficiency == nullptr) { - LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEfficiency.value.c_str()); - } - LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency); - } - correctionsLoaded = true; + void FillFC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm) + { + double dnx, val; + dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); + if (dnx == 0) + return; + if (!corrconf.pTDif) { + val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) + fFC->FillProfile(corrconf.Head.c_str(), cent, val, dnx, rndm); + return; } + for (Int_t i = 1; i <= fPtAxis->GetNbins(); i++) { + dnx = fGFW->Calculate(corrconf, i - 1, kTRUE).real(); + if (dnx == 0) + continue; + val = fGFW->Calculate(corrconf, i - 1, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) + fFC->FillProfile(Form("%s_pt_%i", corrconf.Head.c_str(), i), cent, val, dnx, rndm); + } + return; + } - bool setCurrentParticleWeights(float& weight_nue, float& weight_nua, float phi, float eta, float pt, float vtxz) - { - float eff = 1.; - if (mEfficiency) - eff = mEfficiency->GetBinContent(mEfficiency->FindBin(pt)); - else - eff = 1.0; - if (eff == 0) - return false; - weight_nue = 1. / eff; + void loadCorrections(uint64_t timestamp) + { + if (correctionsLoaded) + return; + if (cfgAcceptance.value.empty() == false) { + mAcceptance = ccdb->getForTimeStamp(cfgAcceptance, timestamp); if (mAcceptance) - weight_nua = mAcceptance->GetNUA(phi, eta, vtxz); + LOGF(info, "Loaded acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance); else - weight_nua = 1; - return true; + LOGF(warning, "Could not load acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance); } - - template - bool eventSelected(TCollision collision, const int multTrk, const float centrality) - { - if (collision.alias_bit(kTVXinTRD)) { - // TRD triggered - return 0; + if (cfgEfficiency.value.empty() == false) { + mEfficiency = ccdb->getForTimeStamp(cfgEfficiency, timestamp); + if (mEfficiency == nullptr) { + LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEfficiency.value.c_str()); } - if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - // reject collisions close to Time Frame borders - // https://its.cern.ch/jira/browse/O2-4623 - return 0; - } - if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - // reject events affected by the ITS ROF border - // https://its.cern.ch/jira/browse/O2-4309 - return 0; - } - if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - // rejects collisions which are associated with the same "found-by-T0" bunch crossing - // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof - return 0; - } - if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference - // use this cut at low multiplicities with caution - return 0; - } - return 1; + LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency); } + correctionsLoaded = true; + } + bool setCurrentParticleWeights(float& weight_nue, float& weight_nua, float phi, float eta, float pt, float vtxz) + { + float eff = 1.; + if (mEfficiency) + eff = mEfficiency->GetBinContent(mEfficiency->FindBin(pt)); + else + eff = 1.0; + if (eff == 0) + return false; + weight_nue = 1. / eff; + if (mAcceptance) + weight_nua = mAcceptance->GetNUA(phi, eta, vtxz); + else + weight_nua = 1; + return true; + } + + template + bool eventSelected(TCollision collision, const int multTrk, const float centrality) + { + if (collision.alias_bit(kTVXinTRD)) { + // TRD triggered + return 0; + } + if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + // reject collisions close to Time Frame borders + // https://its.cern.ch/jira/browse/O2-4623 + return 0; + } + if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + // reject events affected by the ITS ROF border + // https://its.cern.ch/jira/browse/O2-4309 + return 0; + } + if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + // rejects collisions which are associated with the same "found-by-T0" bunch crossing + // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof + return 0; + } + if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference + // use this cut at low multiplicities with caution + return 0; + } + return 1; + } - int getMagneticField(uint64_t timestamp) - { - static o2::parameters::GRPMagField* grpo = nullptr; + int getMagneticField(uint64_t timestamp) + { + static o2::parameters::GRPMagField* grpo = nullptr; + if (grpo == nullptr) { + grpo = ccdb->getForTimeStamp(cfgMagnetField, timestamp); if (grpo == nullptr) { - grpo = ccdb->getForTimeStamp(cfgMagnetField, timestamp); - if (grpo == nullptr) { - LOGF(fatal, "GRP object not found in %s for timestamp %llu", cfgMagnetField.value.c_str(), timestamp); - return 0; - } - LOGF(info, "Retrieved GRP from %s for timestamp %llu with magnetic field of %d kG", cfgMagnetField.value.c_str(), timestamp, grpo->getNominalL3Field()); + LOGF(fatal, "GRP object not found in %s for timestamp %llu", cfgMagnetField.value.c_str(), timestamp); + return 0; } - return grpo->getNominalL3Field(); + LOGF(info, "Retrieved GRP from %s for timestamp %llu with magnetic field of %d kG", cfgMagnetField.value.c_str(), timestamp, grpo->getNominalL3Field()); } + return grpo->getNominalL3Field(); + } - template - bool trackSelected(TTrack track, const int field) - { - double phimodn = track.phi(); - if (field < 0) // for negative polarity field - phimodn = TMath::TwoPi() - phimodn; - if (track.sign() < 0) // for negative charge - phimodn = TMath::TwoPi() - phimodn; - if (phimodn < 0) - LOGF(warning, "phi < 0: %g", phimodn); - - phimodn += TMath::Pi() / 18.0; // to center gap in the middle - phimodn = fmod(phimodn, TMath::Pi() / 9.0); - registry.fill(HIST("pt_phi_bef"), track.pt(), phimodn); - if (phimodn < fPhiCutHigh->Eval(track.pt()) && phimodn > fPhiCutLow->Eval(track.pt())) - return false; // reject track - registry.fill(HIST("pt_phi_aft"), track.pt(), phimodn); - return true; - } + template + bool trackSelected(TTrack track, const int field) + { + double phimodn = track.phi(); + if (field < 0) // for negative polarity field + phimodn = TMath::TwoPi() - phimodn; + if (track.sign() < 0) // for negative charge + phimodn = TMath::TwoPi() - phimodn; + if (phimodn < 0) + LOGF(warning, "phi < 0: %g", phimodn); + + phimodn += TMath::Pi() / 18.0; // to center gap in the middle + phimodn = fmod(phimodn, TMath::Pi() / 9.0); + registry.fill(HIST("pt_phi_bef"), track.pt(), phimodn); + if (phimodn < fPhiCutHigh->Eval(track.pt()) && phimodn > fPhiCutLow->Eval(track.pt())) + return false; // reject track + registry.fill(HIST("pt_phi_aft"), track.pt(), phimodn); + return true; + } void process(aodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, aodTracks const& tracks) { registry.fill(HIST("hEventCount"), 0.5); - if (!collision.sel8()) return; - + if (!collision.sel8()) + return; int Ntot = tracks.size(); - if (Ntot < 1) return; + if (Ntot < 1) + return; registry.fill(HIST("hEventCount"), 1.5); const auto cent = collision.centFT0C(); - if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent)) return; + if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent)) + return; registry.fill(HIST("hEventCount"), 2.5); float vtxz = collision.posZ(); @@ -407,37 +411,35 @@ struct FlowGFWPbPb int Magnetfield = 0; if (cfgUseAdditionalTrackCut) { - // magnet field dependence cut - Magnetfield = getMagneticField(bc.timestamp()); + // magnet field dependence cut + Magnetfield = getMagneticField(bc.timestamp()); } for (auto& track : tracks) { - if (track.tpcNClsFound() < cfgCutTPCclu) - continue; - if (cfgUseAdditionalTrackCut && !trackSelected(track, Magnetfield)) - continue; - if (cfgOutputNUAWeights) - fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); - if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz)) - continue; - + if (track.tpcNClsFound() < cfgCutTPCclu) + continue; + if (cfgUseAdditionalTrackCut && !trackSelected(track, Magnetfield)) + continue; + if (cfgOutputNUAWeights) + fWeights->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); + if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz)) + continue; bool WithinPtRef = (cfgCutPtMin < track.pt()) && (track.pt() < cfgCutPtMax); // within RF pT range registry.fill(HIST("hPt"), track.pt()); if (WithinPtRef) { - registry.fill(HIST("hPhi"), track.phi()); - registry.fill(HIST("hEta"), track.eta()); - registry.fill(HIST("hPtRef"), track.pt()); - registry.fill(HIST("hChi2prTPCcls"), track.tpcChi2NCl()); - registry.fill(HIST("hnTPCClu"), track.tpcNClsFound()); - registry.fill(HIST("hnTPCCrossedRow"), track.tpcNClsCrossedRows()); - } + registry.fill(HIST("hPhi"), track.phi()); + registry.fill(HIST("hEta"), track.eta()); + registry.fill(HIST("hPtRef"), track.pt()); + registry.fill(HIST("hChi2prTPCcls"), track.tpcChi2NCl()); + registry.fill(HIST("hnTPCClu"), track.tpcNClsFound()); + registry.fill(HIST("hnTPCCrossedRow"), track.tpcNClsCrossedRows()); + } if (WithinPtRef) - fGFW->Fill(track.eta(),fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1); - + fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1); } // End of track loop @@ -450,7 +452,7 @@ struct FlowGFWPbPb FillProfile(corrconfigs.at(3), HIST("c28"), cent); FillProfile(corrconfigs.at(4), HIST("c22etagap"), cent); - //Filling Bootstrap Samples + // Filling Bootstrap Samples int SampleIndex = static_cast(cfgNbootstrap * l_Random); FillProfile(corrconfigs.at(0), BootstrapArray[SampleIndex][kc22], cent); FillProfile(corrconfigs.at(1), BootstrapArray[SampleIndex][kc24], cent); @@ -458,17 +460,13 @@ struct FlowGFWPbPb FillProfile(corrconfigs.at(3), BootstrapArray[SampleIndex][kc28], cent); FillProfile(corrconfigs.at(4), BootstrapArray[SampleIndex][kc22etagap], cent); - - // Filling Flow Container for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) { - FillFC(corrconfigs.at(l_ind), cent, l_Random); + FillFC(corrconfigs.at(l_ind), cent, l_Random); } - - } // End of process -}; // end of struct +}; // end of struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) {