From 76682af4a62b050c1cb18c660a12578c80d0afe9 Mon Sep 17 00:00:00 2001 From: Preet Pati Date: Wed, 27 Nov 2024 17:55:54 +0100 Subject: [PATCH 01/11] Recommiting the generic frmework pid code --- PWGCF/Flow/Tasks/FlowPbPbpikp.cxx | 61 ++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx b/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx index 3692ad0375d..6139a47b2be 100644 --- a/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx +++ b/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx @@ -44,6 +44,7 @@ #include #include +#include using namespace o2; using namespace o2::framework; @@ -69,11 +70,11 @@ struct GfwPidflow { ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "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 axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.20, 1.40, 1.60, 1.80, 2.00, 2.20, 2.40, 2.60, 2.80, 3.00, 3.50, 4.00, 5.00, 6.00, 8.00, 10.00}, "pt axis for histograms"}; + ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.20, 1.40, 1.60, 1.80, 2.00, 2.20, 2.40, 2.60, 2.80, 3.00, 3.50, 4.00, 5.00, 6.00, 8.00, 10.00}, "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 axisNsigmaTPC{"axisNsigmaTPC", {80, -5, 5}, "nsigmaTPC axis"}; ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {80, -5, 5}, "nsigmaTOF axis"}; - ConfigurableAxis axisparticles{"axisparticles", {3, 0, 3}, "axis for different hadrons"}; + ConfigurableAxis axisParticles{"axisParticles", {3, 0, 3}, "axis for different hadrons"}; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); @@ -106,8 +107,8 @@ struct GfwPidflow { histos.add("c22_gap08_ka", "", {HistType::kTProfile, {axisMultiplicity}}); histos.add("c22_gap08_pr", "", {HistType::kTProfile, {axisMultiplicity}}); histos.add("c24_full", "", {HistType::kTProfile, {axisMultiplicity}}); - histos.add("TofTpcNsigma", "", {HistType::kTHnSparseD, {{axisparticles, axisNsigmaTPC, axisNsigmaTOF}}}); - + histos.add("TofTpcNsigma", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}}); + histos.add("partCount", "", {HistType::kTHnSparseD, {{axisParticles, axisMultiplicity, axisPt}}}); o2::framework::AxisSpec axis = axisPt; int nPtBins = axis.binEdges.size() - 1; double* PtBins = &(axis.binEdges)[0]; @@ -127,8 +128,8 @@ struct GfwPidflow { for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) oba->Add(new TNamed(Form("Pr08Gap22_pt_%i", i + 1), "Pr08Gap22_pTDiff")); oba->Add(new TNamed("ChFull24", "ChFull24")); - for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) - oba->Add(new TNamed(Form("ChFull24_pt_%i", i + 1), "ChFull24_pTDiff")); + for(Int_t i=0;iGetNbins();i++) + oba->Add(new TNamed(Form("ChFull24_pt_%i",i+1),"ChFull24_pTDiff")); fFC->SetName("FlowContainer"); fFC->SetXAxis(fPtAxis); @@ -137,7 +138,7 @@ struct GfwPidflow { fGFW->AddRegion("refN08", -0.8, -0.4, 1, 1); fGFW->AddRegion("refP08", 0.4, 0.8, 1, 1); - fGFW->AddRegion("full", -0.8, 0.8, 1, 512); + fGFW->AddRegion("full",-0.8, 0.8, 1, 512); // charged parts fGFW->AddRegion("poiN", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 128); @@ -169,6 +170,38 @@ struct GfwPidflow { fGFW->CreateRegions(); } + enum Particles { + PIONS, + KAONS, + PROTONS + }; + + enum Particles pion = PIONS; + enum Particles kaon = KAONS; + enum Particles proton = PROTONS; + + template + int GetNsigmaPID(TTrack track) + { + //Computing Nsigma arrays for pion, kaon, and protons + std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; + std::array nSigmaCombined = {std::hypot(track.tpcNSigmaPi(), track.tofNSigmaPi()), std::hypot(track.tpcNSigmaKa(), track.tofNSigmaKa()), std::hypot(track.tpcNSigmaPr(), track.tofNSigmaPr())}; + int pid = -1; + float nsigma = 3.0; + + //Choose which nSigma to use + std::array nSigmaToUse = (track.pt() > 0.4 && track.hasTOF()) ? nSigmaCombined : nSigmaTPC; + + //Select particle with the lowest nsigma + for (int i = 0; i < 3; ++i) { + if (std::abs(nSigmaToUse[i]) < nsigma) { + pid = i; + nsigma = std::abs(nSigmaToUse[i]); + } + } + return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton + } + template std::pair GetBayesID(TTrack track) { @@ -191,7 +224,7 @@ struct GfwPidflow { int maxProb[3] = {80, 80, 80}; int pidID = -1; std::pair idprob = GetBayesID(track); - if (idprob.first == 0 || idprob.first == 1 || idprob.first == 2) { // 0 = pion, 1 = kaon, 2 = proton + if (idprob.first == pion || idprob.first == kaon || idprob.first == proton) { // 0 = pion, 1 = kaon, 2 = proton pidID = idprob.first; float nsigmaTPC[3] = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; if (idprob.second > maxProb[pidID]) { @@ -277,14 +310,15 @@ struct GfwPidflow { histos.fill(HIST("hEta"), track.eta()); histos.fill(HIST("hPt"), pt); - histos.fill(HIST("TofTpcNsigma"), 0, track.tpcNSigmaPi(), track.tofNSigmaPi()); - histos.fill(HIST("TofTpcNsigma"), 1, track.tpcNSigmaKa(), track.tofNSigmaKa()); - histos.fill(HIST("TofTpcNsigma"), 2, track.tpcNSigmaPr(), track.tofNSigmaPr()); + histos.fill(HIST("TofTpcNsigma"), pion, track.tpcNSigmaPi(), track.tofNSigmaPi(), pt); + histos.fill(HIST("TofTpcNsigma"), kaon, track.tpcNSigmaKa(), track.tofNSigmaKa(), pt); + histos.fill(HIST("TofTpcNsigma"), proton, track.tpcNSigmaPr(), track.tofNSigmaPr(), pt); bool WithinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range bool WithinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax); // within RF pT range - pidIndex = GetBayesPIDIndex(track); + //pidIndex = GetBayesPIDIndex(track); + pidIndex = GetNsigmaPID(track); if (WithinPtRef) fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 1); if (WithinPtPOI) @@ -294,6 +328,7 @@ struct GfwPidflow { fGFW->Fill(track.eta(), 1, track.phi(), wacc * weff, 512); if (pidIndex) { + histos.fill(HIST("partCount"), pidIndex - 1, cent, pt); if (WithinPtPOI) fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 1 << (pidIndex)); if (WithinPtPOI && WithinPtRef) @@ -318,4 +353,4 @@ struct GfwPidflow { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} +} \ No newline at end of file From 91cd1175185e45317d4b0eb8ac5e21112bac91a9 Mon Sep 17 00:00:00 2001 From: Preet Pati Date: Thu, 5 Dec 2024 21:16:24 +0100 Subject: [PATCH 02/11] Implementing formatting changes --- PWGCF/Flow/Tasks/FlowPbPbpikp.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx b/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx index 6139a47b2be..52c928db2aa 100644 --- a/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx +++ b/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx @@ -128,8 +128,8 @@ struct GfwPidflow { for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) oba->Add(new TNamed(Form("Pr08Gap22_pt_%i", i + 1), "Pr08Gap22_pTDiff")); oba->Add(new TNamed("ChFull24", "ChFull24")); - for(Int_t i=0;iGetNbins();i++) - oba->Add(new TNamed(Form("ChFull24_pt_%i",i+1),"ChFull24_pTDiff")); + for(Int_t i = 0; i < fPtAxis->GetNbins(); i++) + oba->Add(new TNamed(Form("ChFull24_pt_%i", i + 1), "ChFull24_pTDiff")); fFC->SetName("FlowContainer"); fFC->SetXAxis(fPtAxis); @@ -138,7 +138,7 @@ struct GfwPidflow { fGFW->AddRegion("refN08", -0.8, -0.4, 1, 1); fGFW->AddRegion("refP08", 0.4, 0.8, 1, 1); - fGFW->AddRegion("full",-0.8, 0.8, 1, 512); + fGFW->AddRegion("full", -0.8, 0.8, 1, 512); // charged parts fGFW->AddRegion("poiN", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 128); From 808e391df51e0e407eba223fe171b3662f71799f Mon Sep 17 00:00:00 2001 From: Preet Pati Date: Thu, 5 Dec 2024 21:23:56 +0100 Subject: [PATCH 03/11] Fixing format changes --- PWGCF/Flow/Tasks/FlowPbPbpikp.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx b/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx index 52c928db2aa..b7a2c2b4abf 100644 --- a/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx +++ b/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx @@ -128,7 +128,7 @@ struct GfwPidflow { for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) oba->Add(new TNamed(Form("Pr08Gap22_pt_%i", i + 1), "Pr08Gap22_pTDiff")); oba->Add(new TNamed("ChFull24", "ChFull24")); - for(Int_t i = 0; i < fPtAxis->GetNbins(); i++) + for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) oba->Add(new TNamed(Form("ChFull24_pt_%i", i + 1), "ChFull24_pTDiff")); fFC->SetName("FlowContainer"); From 206da1a1b0f9e946f06c51652ef9e93fcae2dbb9 Mon Sep 17 00:00:00 2001 From: Preet Pati Date: Mon, 9 Dec 2024 10:35:04 +0100 Subject: [PATCH 04/11] Changed the function names and modified the CMakeLists.txt to contain the new file name --- PWGCF/Flow/Tasks/CMakeLists.txt | 2 +- PWGCF/Flow/Tasks/FlowPbPbpikp.cxx | 128 +++++++++++++++--------------- 2 files changed, 65 insertions(+), 65 deletions(-) diff --git a/PWGCF/Flow/Tasks/CMakeLists.txt b/PWGCF/Flow/Tasks/CMakeLists.txt index eaee5ac70ed..77eaf3460c0 100644 --- a/PWGCF/Flow/Tasks/CMakeLists.txt +++ b/PWGCF/Flow/Tasks/CMakeLists.txt @@ -40,7 +40,7 @@ o2physics_add_dpl_workflow(flow-gf COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(flow-pbpb-pikp-task - SOURCES FlowPbPbpikp.cxx + SOURCES flowPbPbpikp.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) diff --git a/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx b/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx index b7a2c2b4abf..f64aa452e59 100644 --- a/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx +++ b/PWGCF/Flow/Tasks/FlowPbPbpikp.cxx @@ -9,10 +9,13 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file flowPbPbpikp.cxx +/// \brief PID flow using the generic framework +/// \author Preet Bhanjan Pati + #include #include #include -#include #include #include #include @@ -44,15 +47,15 @@ #include #include -#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace std; #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; -struct GfwPidflow { +struct flowPbPbpikp { 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"}; @@ -87,8 +90,9 @@ struct GfwPidflow { TAxis* fPtAxis; TRandom3* fRndm = new TRandom3(0); - using aodCollisions = soa::Filtered>; - using aodTracks = soa::Filtered>; + using AodCollisions = soa::Filtered>; + //using AodTracks = soa::Filtered>; + using AodTracks = soa::Filtered>; void init(InitContext const&) { @@ -111,24 +115,24 @@ struct GfwPidflow { histos.add("partCount", "", {HistType::kTHnSparseD, {{axisParticles, axisMultiplicity, axisPt}}}); o2::framework::AxisSpec axis = axisPt; int nPtBins = axis.binEdges.size() - 1; - double* PtBins = &(axis.binEdges)[0]; - fPtAxis = new TAxis(nPtBins, PtBins); + double* ptBins = &(axis.binEdges)[0]; + fPtAxis = new TAxis(nPtBins, ptBins); TObjArray* oba = new TObjArray(); oba->Add(new TNamed("Ch08Gap22", "Ch08Gap22")); - for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) + for (int i = 0; i < fPtAxis->GetNbins(); i++) oba->Add(new TNamed(Form("Ch08Gap22_pt_%i", i + 1), "Ch08Gap22_pTDiff")); oba->Add(new TNamed("Pi08Gap22", "Pi08Gap22")); - for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) + for (int i = 0; i < fPtAxis->GetNbins(); i++) oba->Add(new TNamed(Form("Pi08Gap22_pt_%i", i + 1), "Pi08Gap22_pTDiff")); oba->Add(new TNamed("Ka08Gap22", "Ka08Gap22")); - for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) + for (int i = 0; i < fPtAxis->GetNbins(); i++) oba->Add(new TNamed(Form("Ka08Gap22_pt_%i", i + 1), "Ka08Gap22_pTDiff")); oba->Add(new TNamed("Pr08Gap22", "Pr08Gap22")); - for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) + for (int i = 0; i < fPtAxis->GetNbins(); i++) oba->Add(new TNamed(Form("Pr08Gap22_pt_%i", i + 1), "Pr08Gap22_pTDiff")); oba->Add(new TNamed("ChFull24", "ChFull24")); - for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) + for (int i = 0; i < fPtAxis->GetNbins(); i++) oba->Add(new TNamed(Form("ChFull24_pt_%i", i + 1), "ChFull24_pTDiff")); fFC->SetName("FlowContainer"); @@ -176,34 +180,30 @@ struct GfwPidflow { PROTONS }; - enum Particles pion = PIONS; - enum Particles kaon = KAONS; - enum Particles proton = PROTONS; - template - int GetNsigmaPID(TTrack track) + int getNsigmaPID(TTrack track) { - //Computing Nsigma arrays for pion, kaon, and protons + // Computing Nsigma arrays for pion, kaon, and protons std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; std::array nSigmaCombined = {std::hypot(track.tpcNSigmaPi(), track.tofNSigmaPi()), std::hypot(track.tpcNSigmaKa(), track.tofNSigmaKa()), std::hypot(track.tpcNSigmaPr(), track.tofNSigmaPr())}; int pid = -1; float nsigma = 3.0; - //Choose which nSigma to use + // Choose which nSigma to use std::array nSigmaToUse = (track.pt() > 0.4 && track.hasTOF()) ? nSigmaCombined : nSigmaTPC; - //Select particle with the lowest nsigma + // Select particle with the lowest nsigma for (int i = 0; i < 3; ++i) { - if (std::abs(nSigmaToUse[i]) < nsigma) { - pid = i; - nsigma = std::abs(nSigmaToUse[i]); - } + if (std::abs(nSigmaToUse[i]) < nsigma) { + pid = i; + nsigma = std::abs(nSigmaToUse[i]); } + } return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton } - template - std::pair GetBayesID(TTrack track) + /*template + std::pair getBayesID(TTrack track) { std::array bayesprobs = {static_cast(track.bayesPi()), static_cast(track.bayesKa()), static_cast(track.bayesPr())}; int bayesid = -1; @@ -219,16 +219,16 @@ struct GfwPidflow { } template - int GetBayesPIDIndex(TTrack track) + int getBayesPIDIndex(TTrack track) { int maxProb[3] = {80, 80, 80}; int pidID = -1; - std::pair idprob = GetBayesID(track); - if (idprob.first == pion || idprob.first == kaon || idprob.first == proton) { // 0 = pion, 1 = kaon, 2 = proton + std::pair idprob = getBayesID(track); + if (idprob.first == PIONS || idprob.first == KAONS || idprob.first == PROTONS) { // 0 = pion, 1 = kaon, 2 = proton pidID = idprob.first; float nsigmaTPC[3] = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; if (idprob.second > maxProb[pidID]) { - if (abs(nsigmaTPC[pidID]) > 3) + if (std::fabs(nsigmaTPC[pidID]) > 3) return 0; return pidID + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton } else { @@ -236,10 +236,10 @@ struct GfwPidflow { } } return 0; - } + }*/ template - void FillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) + void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) { double dnx, val; dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); @@ -247,22 +247,22 @@ struct GfwPidflow { return; if (!corrconf.pTDif) { val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) + if (std::fabs(val) < 1) histos.fill(tarName, cent, val, dnx); return; } - for (Int_t i = 1; i <= fPtAxis->GetNbins(); i++) { + for (int 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) + if (std::fabs(val) < 1) histos.fill(tarName, fPtAxis->GetBinCenter(i), val, dnx); } return; } - void FillFC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm) + void fillFC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm) { double dnx, val; dnx = fGFW->Calculate(corrconf, 0, kTRUE).real(); @@ -271,80 +271,80 @@ struct GfwPidflow { } if (!corrconf.pTDif) { val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx; - if (TMath::Abs(val) < 1) { + if (std::fabs(val) < 1) { fFC->FillProfile(corrconf.Head.c_str(), cent, val, dnx, rndm); } return; } - for (Int_t i = 1; i <= fPtAxis->GetNbins(); i++) { + for (int 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) + if (std::fabs(val) < 1) fFC->FillProfile(Form("%s_pt_%i", corrconf.Head.c_str(), i), cent, val, dnx, rndm); } return; } - void process(aodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, aodTracks const& tracks) + void process(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks) { - int Ntot = tracks.size(); - if (Ntot < 1) + int nTot = tracks.size(); + if (nTot < 1) return; if (!collision.sel8()) return; - float l_Random = fRndm->Rndm(); + float lRandom = fRndm->Rndm(); float vtxz = collision.posZ(); histos.fill(HIST("hVtxZ"), vtxz); - histos.fill(HIST("hMult"), Ntot); + histos.fill(HIST("hMult"), nTot); histos.fill(HIST("hCent"), collision.centFT0C()); fGFW->Clear(); const auto cent = collision.centFT0C(); float weff = 1, wacc = 1; int pidIndex; - for (auto& track : tracks) { + for (auto const& track : tracks) { double pt = track.pt(); histos.fill(HIST("hPhi"), track.phi()); histos.fill(HIST("hEta"), track.eta()); histos.fill(HIST("hPt"), pt); - histos.fill(HIST("TofTpcNsigma"), pion, track.tpcNSigmaPi(), track.tofNSigmaPi(), pt); - histos.fill(HIST("TofTpcNsigma"), kaon, track.tpcNSigmaKa(), track.tofNSigmaKa(), pt); - histos.fill(HIST("TofTpcNsigma"), proton, track.tpcNSigmaPr(), track.tofNSigmaPr(), pt); + histos.fill(HIST("TofTpcNsigma"), PIONS, track.tpcNSigmaPi(), track.tofNSigmaPi(), pt); + histos.fill(HIST("TofTpcNsigma"), KAONS, track.tpcNSigmaKa(), track.tofNSigmaKa(), pt); + histos.fill(HIST("TofTpcNsigma"), PROTONS, track.tpcNSigmaPr(), track.tofNSigmaPr(), pt); - bool WithinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range - bool WithinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax); // within RF pT range + bool withinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range + bool withinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax); // within RF pT range - //pidIndex = GetBayesPIDIndex(track); - pidIndex = GetNsigmaPID(track); - if (WithinPtRef) + // pidIndex = getBayesPIDIndex(track); + pidIndex = getNsigmaPID(track); + if (withinPtRef) fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 1); - if (WithinPtPOI) + if (withinPtPOI) fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 128); - if (WithinPtPOI && WithinPtRef) + if (withinPtPOI && withinPtRef) fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 256); fGFW->Fill(track.eta(), 1, track.phi(), wacc * weff, 512); if (pidIndex) { histos.fill(HIST("partCount"), pidIndex - 1, cent, pt); - if (WithinPtPOI) + if (withinPtPOI) fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 1 << (pidIndex)); - if (WithinPtPOI && WithinPtRef) + if (withinPtPOI && withinPtRef) fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 1 << (pidIndex + 3)); } } // Filling c22 with ROOT TProfile - FillProfile(corrconfigs.at(0), HIST("c22_gap08"), cent); - FillProfile(corrconfigs.at(1), HIST("c22_gap08_pi"), cent); - FillProfile(corrconfigs.at(2), HIST("c22_gap08_ka"), cent); - FillProfile(corrconfigs.at(3), HIST("c22_gap08_pr"), cent); - FillProfile(corrconfigs.at(4), HIST("c24_full"), cent); + fillProfile(corrconfigs.at(0), HIST("c22_gap08"), cent); + fillProfile(corrconfigs.at(1), HIST("c22_gap08_pi"), cent); + fillProfile(corrconfigs.at(2), HIST("c22_gap08_ka"), cent); + fillProfile(corrconfigs.at(3), HIST("c22_gap08_pr"), cent); + fillProfile(corrconfigs.at(4), HIST("c24_full"), cent); 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, lRandom); } } // end of process @@ -352,5 +352,5 @@ struct GfwPidflow { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } \ No newline at end of file From 74ce3206f484e6cd2b89e02029eef1effa74d0e2 Mon Sep 17 00:00:00 2001 From: Preet Pati Date: Wed, 8 Jan 2025 17:17:38 +0100 Subject: [PATCH 05/11] Added phi reconstruction code --- PWGCF/Flow/Tasks/CMakeLists.txt | 5 - PWGCF/Flow/Tasks/flowPbpbPikp.cxx | 161 ++++++++++++++++++++++-------- 2 files changed, 117 insertions(+), 49 deletions(-) diff --git a/PWGCF/Flow/Tasks/CMakeLists.txt b/PWGCF/Flow/Tasks/CMakeLists.txt index 2f1f76a9430..d6e288a4594 100644 --- a/PWGCF/Flow/Tasks/CMakeLists.txt +++ b/PWGCF/Flow/Tasks/CMakeLists.txt @@ -39,13 +39,8 @@ o2physics_add_dpl_workflow(flow-gf PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) -<<<<<<< HEAD -o2physics_add_dpl_workflow(flow-pbpb-pikp-task - SOURCES flowPbPbpikp.cxx -======= o2physics_add_dpl_workflow(flow-pbpb-pikp SOURCES flowPbpbPikp.cxx ->>>>>>> 5b9f1eab610d3879f782c6b06957eb9eb3e1d5ec PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) diff --git a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx index c82444f3d5f..e819bc60d97 100644 --- a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx +++ b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx @@ -9,13 +9,9 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -<<<<<<< HEAD:PWGCF/Flow/Tasks/FlowPbPbpikp.cxx -/// \file flowPbPbpikp.cxx -======= /// \file flowPbpbPikp.cxx ->>>>>>> 5b9f1eab610d3879f782c6b06957eb9eb3e1d5ec:PWGCF/Flow/Tasks/flowPbpbPikp.cxx /// \brief PID flow using the generic framework -/// \author Preet Bhanjan Pati +/// \author Preet Bhanjan Pati #include #include @@ -24,6 +20,8 @@ #include #include +#include "Math/Vector4D.h" + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" @@ -59,11 +57,7 @@ using namespace std; #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; -<<<<<<< HEAD:PWGCF/Flow/Tasks/FlowPbPbpikp.cxx -struct flowPbPbpikp { -======= struct FlowPbpbPikp { ->>>>>>> 5b9f1eab610d3879f782c6b06957eb9eb3e1d5ec:PWGCF/Flow/Tasks/flowPbpbPikp.cxx Service ccdb; Configurable noLaterThan{"noLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable ccdbUrl{"ccdbUrl", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; @@ -78,6 +72,9 @@ struct FlowPbpbPikp { O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Use Nch for flow observables") O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples") + O2_DEFINE_CONFIGURABLE(cfgTpcNsigmaCut, float, 2.0f, "TPC N-sigma cut for pions, kaons, protons") + O2_DEFINE_CONFIGURABLE(cfgTofPtCut, float, 1.8f, "Minimum pt to use TOF N-sigma") + ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "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"}; @@ -86,9 +83,19 @@ struct FlowPbpbPikp { ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {80, -5, 5}, "nsigmaTPC axis"}; ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {80, -5, 5}, "nsigmaTOF axis"}; ConfigurableAxis axisParticles{"axisParticles", {3, 0, 3}, "axis for different hadrons"}; + ConfigurableAxis axisPhiMass{"axisPhiMass", {10000, 0, 2}, "axis for invariant mass distibution for Phi"}; + ConfigurableAxis axisTPCsignal{"axisTPCsignal", {10000, 0, 1000}, "axis for TPC signal"}; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; - Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t)true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); + + using AodCollisions = soa::Filtered>; + // using AodTracks = soa::Filtered>; + using AodTracks = soa::Filtered>; + + SliceCache cache; + Partition posTracks = aod::track::signed1Pt > 0.0f; + Partition negTracks = aod::track::signed1Pt < 0.0f; OutputObj fFC{FlowContainer("FlowContainer")}; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -98,14 +105,6 @@ struct FlowPbpbPikp { TAxis* fPtAxis; TRandom3* fRndm = new TRandom3(0); - using AodCollisions = soa::Filtered>; -<<<<<<< HEAD:PWGCF/Flow/Tasks/FlowPbPbpikp.cxx - //using AodTracks = soa::Filtered>; -======= - // using AodTracks = soa::Filtered>; ->>>>>>> 5b9f1eab610d3879f782c6b06957eb9eb3e1d5ec:PWGCF/Flow/Tasks/flowPbpbPikp.cxx - using AodTracks = soa::Filtered>; - void init(InitContext const&) { ccdb->setURL(ccdbUrl.value); @@ -118,13 +117,17 @@ struct FlowPbpbPikp { histos.add("hMult", "", {HistType::kTH1D, {{3000, 0.5, 3000.5}}}); histos.add("hCent", "", {HistType::kTH1D, {{90, 0, 90}}}); histos.add("hPt", "", {HistType::kTH1D, {axisPt}}); + histos.add("hPhiMass", "", {HistType::kTH1D, {axisPhiMass}}); histos.add("c22_gap08", "", {HistType::kTProfile, {axisMultiplicity}}); histos.add("c22_gap08_pi", "", {HistType::kTProfile, {axisMultiplicity}}); histos.add("c22_gap08_ka", "", {HistType::kTProfile, {axisMultiplicity}}); histos.add("c22_gap08_pr", "", {HistType::kTProfile, {axisMultiplicity}}); histos.add("c24_full", "", {HistType::kTProfile, {axisMultiplicity}}); + histos.add("KplusTPC", "", {HistType::kTH2D, {{axisPt, axisTPCsignal}}}); + histos.add("KminusTPC", "", {HistType::kTH2D, {{axisPt, axisTPCsignal}}}); histos.add("TofTpcNsigma", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}}); histos.add("partCount", "", {HistType::kTHnSparseD, {{axisParticles, axisMultiplicity, axisPt}}}); + o2::framework::AxisSpec axis = axisPt; int nPtBins = axis.binEdges.size() - 1; double* ptBins = &(axis.binEdges)[0]; @@ -155,6 +158,8 @@ struct FlowPbpbPikp { fGFW->AddRegion("refN08", -0.8, -0.4, 1, 1); fGFW->AddRegion("refP08", 0.4, 0.8, 1, 1); fGFW->AddRegion("full", -0.8, 0.8, 1, 512); + fGFW->AddRegion("poi", -0.8, 0.8, 1 + fPtAxis->GetNbins(), 1024); + fGFW->AddRegion("ol", -0.8, 0.8, 1 + fPtAxis->GetNbins(), 2048); // charged parts fGFW->AddRegion("poiN", -0.8, -0.4, 1 + fPtAxis->GetNbins(), 128); @@ -183,6 +188,7 @@ struct FlowPbpbPikp { corrconfigs.push_back(fGFW->GetCorrelatorConfig("poiNpr refN08 | olNpr {2} refP08 {-2}", "Pr08Gap22", kTRUE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 2 -2 -2}", "ChFull24", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("poi full | ol {2 2 -2 -2}", "ChFull24", kTRUE)); fGFW->CreateRegions(); } @@ -192,6 +198,17 @@ struct FlowPbpbPikp { PROTONS }; + template + bool isFakeKaon(TTrack track) + { + const auto pglobal = track.p(); + const auto ptpc = track.tpcInnerParam(); + if (TMath::Abs(pglobal - ptpc) > 0.1) { + return true; + } + return false; + } + template int getNsigmaPID(TTrack track) { @@ -199,10 +216,10 @@ struct FlowPbpbPikp { std::array nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()}; std::array nSigmaCombined = {std::hypot(track.tpcNSigmaPi(), track.tofNSigmaPi()), std::hypot(track.tpcNSigmaKa(), track.tofNSigmaKa()), std::hypot(track.tpcNSigmaPr(), track.tofNSigmaPr())}; int pid = -1; - float nsigma = 3.0; + float nsigma = cfgTpcNsigmaCut; // Choose which nSigma to use - std::array nSigmaToUse = (track.pt() > 0.4 && track.hasTOF()) ? nSigmaCombined : nSigmaTPC; + std::array nSigmaToUse = (track.pt() > cfgTofPtCut && track.hasTOF()) ? nSigmaCombined : nSigmaTPC; // Select particle with the lowest nsigma for (int i = 0; i < 3; ++i) { @@ -250,6 +267,24 @@ struct FlowPbpbPikp { return 0; }*/ + template + void resurrectParticle(TTrack trackplus, TTrack trackminus, vector plusdaug, vector minusdaug, vector mom, double plusmass, double minusmass, const ConstStr& hist) + { + for (auto& [partplus, partminus] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(trackplus, trackminus))) { + if (getNsigmaPID(partplus) != 2) + continue; + if (getNsigmaPID(partminus) != 2) + continue; + + plusdaug = ROOT::Math::PxPyPzMVector(partplus.px(), partplus.py(), partplus.pz(), plusmass); + minusdaug = ROOT::Math::PxPyPzMVector(partminus.px(), partminus.py(), partminus.pz(), minusmass); + mom = plusdaug + minusdaug; + + histos.fill(hist, mom.M()); + } + return; + } + template void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr& tarName, const double& cent) { @@ -299,6 +334,10 @@ struct FlowPbpbPikp { return; } + ROOT::Math::PxPyPzMVector Phimom, kplusdaug, kminusdaug; + double massKplus = o2::constants::physics::MassKPlus; + double massKminus = o2::constants::physics::MassKMinus; + void process(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks) { int nTot = tracks.size(); @@ -314,39 +353,78 @@ struct FlowPbpbPikp { histos.fill(HIST("hCent"), collision.centFT0C()); fGFW->Clear(); const auto cent = collision.centFT0C(); + + auto posSlicedTracks = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto negSlicedTracks = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + float weff = 1, wacc = 1; int pidIndex; - for (auto const& track : tracks) { - double pt = track.pt(); - histos.fill(HIST("hPhi"), track.phi()); - histos.fill(HIST("hEta"), track.eta()); + + // resurrectParticle(posSlicedTracks, negSlicedTracks, kplusdaug, kminusdaug, Phimom, massKplus, massKminus, HIST("hPhiMass")); + + for (auto const& trackA : posSlicedTracks) { + if (getNsigmaPID(trackA) != 2) + continue; + if (isFakeKaon(trackA)) + continue; + auto trackAID = trackA.globalIndex(); + + for (auto const& trackB : negSlicedTracks) { + auto trackBID = trackB.globalIndex(); + if (getNsigmaPID(trackB) != 2) + continue; + if (isFakeKaon(trackB)) + continue; + if (trackAID == trackBID) + continue; + + histos.fill(HIST("KplusTPC"), trackA.pt(), trackA.tpcSignal()); + histos.fill(HIST("KminusTPC"), trackB.pt(), trackB.tpcSignal()); + + kplusdaug = ROOT::Math::PxPyPzMVector(trackA.px(), trackA.py(), trackA.pz(), massKplus); + kminusdaug = ROOT::Math::PxPyPzMVector(trackB.px(), trackB.py(), trackB.pz(), massKminus); + Phimom = kplusdaug + kminusdaug; + + histos.fill(HIST("hPhiMass"), Phimom.M()); + } + } + + for (auto const& track1 : tracks) { + double pt = track1.pt(); + histos.fill(HIST("hPhi"), track1.phi()); + histos.fill(HIST("hEta"), track1.eta()); histos.fill(HIST("hPt"), pt); - histos.fill(HIST("TofTpcNsigma"), PIONS, track.tpcNSigmaPi(), track.tofNSigmaPi(), pt); - histos.fill(HIST("TofTpcNsigma"), KAONS, track.tpcNSigmaKa(), track.tofNSigmaKa(), pt); - histos.fill(HIST("TofTpcNsigma"), PROTONS, track.tpcNSigmaPr(), track.tofNSigmaPr(), pt); + histos.fill(HIST("TofTpcNsigma"), PIONS, track1.tpcNSigmaPi(), track1.tofNSigmaPi(), pt); + histos.fill(HIST("TofTpcNsigma"), KAONS, track1.tpcNSigmaKa(), track1.tofNSigmaKa(), pt); + histos.fill(HIST("TofTpcNsigma"), PROTONS, track1.tpcNSigmaPr(), track1.tofNSigmaPr(), pt); bool withinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range bool withinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax); // within RF pT range - // pidIndex = getBayesPIDIndex(track); - pidIndex = getNsigmaPID(track); - if (withinPtRef) - fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 1); - if (withinPtPOI) - fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 128); - if (withinPtPOI && withinPtRef) - fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 256); - fGFW->Fill(track.eta(), 1, track.phi(), wacc * weff, 512); + // pidIndex = getBayesPIDIndex(track1); + pidIndex = getNsigmaPID(track1); + if (withinPtRef) { + fGFW->Fill(track1.eta(), fPtAxis->FindBin(pt) - 1, track1.phi(), wacc * weff, 1); + fGFW->Fill(track1.eta(), 1, track1.phi(), wacc * weff, 512); + } + if (withinPtPOI) { + fGFW->Fill(track1.eta(), fPtAxis->FindBin(pt) - 1, track1.phi(), wacc * weff, 128); + fGFW->Fill(track1.eta(), fPtAxis->FindBin(pt) - 1, track1.phi(), wacc * weff, 1024); + } + if (withinPtPOI && withinPtRef) { + fGFW->Fill(track1.eta(), fPtAxis->FindBin(pt) - 1, track1.phi(), wacc * weff, 256); + fGFW->Fill(track1.eta(), fPtAxis->FindBin(pt) - 1, track1.phi(), wacc * weff, 2048); + } if (pidIndex) { histos.fill(HIST("partCount"), pidIndex - 1, cent, pt); if (withinPtPOI) - fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 1 << (pidIndex)); + fGFW->Fill(track1.eta(), fPtAxis->FindBin(pt) - 1, track1.phi(), wacc * weff, 1 << (pidIndex)); if (withinPtPOI && withinPtRef) - fGFW->Fill(track.eta(), fPtAxis->FindBin(pt) - 1, track.phi(), wacc * weff, 1 << (pidIndex + 3)); + fGFW->Fill(track1.eta(), fPtAxis->FindBin(pt) - 1, track1.phi(), wacc * weff, 1 << (pidIndex + 3)); } - } + } // track1 loop ends // Filling c22 with ROOT TProfile fillProfile(corrconfigs.at(0), HIST("c22_gap08"), cent); @@ -364,10 +442,5 @@ struct FlowPbpbPikp { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { -<<<<<<< HEAD:PWGCF/Flow/Tasks/FlowPbPbpikp.cxx - return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} -======= return WorkflowSpec{adaptAnalysisTask(cfgc)}; } ->>>>>>> 5b9f1eab610d3879f782c6b06957eb9eb3e1d5ec:PWGCF/Flow/Tasks/flowPbpbPikp.cxx From 48ff1af24c5ff3e8f69d9b328c9092c1dbed8092 Mon Sep 17 00:00:00 2001 From: Preet Pati Date: Wed, 8 Jan 2025 17:37:52 +0100 Subject: [PATCH 06/11] Added the formatting changes --- PWGCF/Flow/Tasks/flowPbpbPikp.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx index e819bc60d97..e583b609f02 100644 --- a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx +++ b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx @@ -71,7 +71,6 @@ struct FlowPbpbPikp { O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters") O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Use Nch for flow observables") O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples") - O2_DEFINE_CONFIGURABLE(cfgTpcNsigmaCut, float, 2.0f, "TPC N-sigma cut for pions, kaons, protons") O2_DEFINE_CONFIGURABLE(cfgTofPtCut, float, 1.8f, "Minimum pt to use TOF N-sigma") @@ -203,7 +202,7 @@ struct FlowPbpbPikp { { const auto pglobal = track.p(); const auto ptpc = track.tpcInnerParam(); - if (TMath::Abs(pglobal - ptpc) > 0.1) { + if (std::abs(pglobal - ptpc) > 0.1) { return true; } return false; @@ -270,7 +269,7 @@ struct FlowPbpbPikp { template void resurrectParticle(TTrack trackplus, TTrack trackminus, vector plusdaug, vector minusdaug, vector mom, double plusmass, double minusmass, const ConstStr& hist) { - for (auto& [partplus, partminus] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(trackplus, trackminus))) { + for (auto const& [partplus, partminus] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(trackplus, trackminus))) { if (getNsigmaPID(partplus) != 2) continue; if (getNsigmaPID(partminus) != 2) From bb065579c031ab1ba1c9eed7d9adfc026264513e Mon Sep 17 00:00:00 2001 From: Preet Pati Date: Mon, 20 Jan 2025 14:43:55 +0100 Subject: [PATCH 07/11] Flow for Phi meson --- PWGCF/Flow/Tasks/CMakeLists.txt | 5 + PWGCF/Flow/Tasks/flowPbpbReso.cxx | 365 ++++++++++++++++++++++++++++++ 2 files changed, 370 insertions(+) create mode 100644 PWGCF/Flow/Tasks/flowPbpbReso.cxx diff --git a/PWGCF/Flow/Tasks/CMakeLists.txt b/PWGCF/Flow/Tasks/CMakeLists.txt index d6e288a4594..9d04923c87c 100644 --- a/PWGCF/Flow/Tasks/CMakeLists.txt +++ b/PWGCF/Flow/Tasks/CMakeLists.txt @@ -58,3 +58,8 @@ o2physics_add_dpl_workflow(flow-sp SOURCES flowSP.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(flow-pbpb-reso + SOURCES flowPbpbReso.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore + COMPONENT_NAME Analysis) diff --git a/PWGCF/Flow/Tasks/flowPbpbReso.cxx b/PWGCF/Flow/Tasks/flowPbpbReso.cxx new file mode 100644 index 00000000000..b009bb04805 --- /dev/null +++ b/PWGCF/Flow/Tasks/flowPbpbReso.cxx @@ -0,0 +1,365 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// 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. + +/// \file flowPbpbReso.cxx +/// \brief PID flow for resonances using the generic framework +/// \author Preet Bhanjan Pati + +#include +#include +#include +#include +#include +#include + +#include "Math/Vector4D.h" + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/StepTHn.h" + +#include "Common/DataModel/EventSelection.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/Core/trackUtilities.h" +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Multiplicity.h" +#include "PWGLF/DataModel/EPCalibrationTables.h" +#include "CommonConstants/PhysicsConstants.h" + +#include "ReconstructionDataFormats/Track.h" +#include "ReconstructionDataFormats/PID.h" + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace std; + +#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; + +struct FlowPbpbReso { + Service ccdb; + Configurable noLaterThan{"noLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + Configurable ccdbUrl{"ccdbUrl", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; + + 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") + O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgUseNch, bool, false, "Use Nch for flow observables") + O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples") + O2_DEFINE_CONFIGURABLE(cfgTpcNsigmaCut, float, 3.0f, "TPC N-sigma cut for pions, kaons, protons") + O2_DEFINE_CONFIGURABLE(cfgTofNsigmaCut, float, 3.0f, "TOF N-sigma cut for pions, kaons, protons") + O2_DEFINE_CONFIGURABLE(cfgTofPtCut, float, 0.5f, "Minimum pt to use TOF N-sigma") + + O2_DEFINE_CONFIGURABLE(cfgUsePVContributor, bool, true, "Use PV contributor for tracks") + O2_DEFINE_CONFIGURABLE(cfgFakePartCut, float, 0.1f, "Maximum difference in measured momentum and TPC inner ring momentum of particle") + O2_DEFINE_CONFIGURABLE(cfgTpcCluster, int, 70, "Number of TPC clusters") + O2_DEFINE_CONFIGURABLE(cfgUsePointingAngle, bool, false, "Use Pointing angle for resonances") + O2_DEFINE_CONFIGURABLE(cfgPointingAnglePhi, float, 0.04f, "Minimum Pointing angle for Phi") + O2_DEFINE_CONFIGURABLE(cfgPointingAngleKo, float, 0.97f, "Minimum Pointing angle for K0") + O2_DEFINE_CONFIGURABLE(cfgPointingAngleLambda, float, 0.995f, "Minimum Pointing angle for Lambda") + O2_DEFINE_CONFIGURABLE(cfgUseVoRadius, bool, true, "Use V0 radius for particle identification") + O2_DEFINE_CONFIGURABLE(cfgVoRadiusMin, float, 0.5f, "Minimum V0 radius in cm") + O2_DEFINE_CONFIGURABLE(cfgVoRadiusMax, float, 200.0f, "Maximum V0 radius in cm") + O2_DEFINE_CONFIGURABLE(cfgUseProperLifetime, bool, true, "Use proper lifetime for particle identification") + O2_DEFINE_CONFIGURABLE(cfgProperLtK0, float, 20.0f, "Minimum lifetime for K0 in cm") + O2_DEFINE_CONFIGURABLE(cfgProperLtLambda, float, 30.0f, "Minimum lifetime for Lambda in cm") + O2_DEFINE_CONFIGURABLE(cfgUseDCA, bool, true, "Use dca for daughter tracks") + O2_DEFINE_CONFIGURABLE(cfgDCAtoPV, float, 0.06f, "Minimum DCA of daughter tracks to primary vertex in cm") + O2_DEFINE_CONFIGURABLE(cfgDCABetDaug, int, 1, "Maximum DCA between daughter tracks") + + O2_DEFINE_CONFIGURABLE(cfgCutDCAxy, float, 2.0f, "DCAxy range for tracks") + O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "DCAz range for tracks") + O2_DEFINE_CONFIGURABLE(additionalEvsel, bool, false, "Additional event selcection") + O2_DEFINE_CONFIGURABLE(useGlobalTrack, bool, true, "use Global track") + O2_DEFINE_CONFIGURABLE(cfgITScluster, int, 0, "Number of ITS cluster") + O2_DEFINE_CONFIGURABLE(cfgCutTOFBeta, float, 0.0, "cut TOF beta") + O2_DEFINE_CONFIGURABLE(cfgCutOccupancy, int, 3000, "Occupancy cut") + O2_DEFINE_CONFIGURABLE(ispTdepPID, bool, true, "pT dependent PID") + O2_DEFINE_CONFIGURABLE(removefaketrack, bool, true, "Remove fake track from momentum difference") + O2_DEFINE_CONFIGURABLE(confRapidity, float, 0.5, "Rapidity cut") + + // Defining configurable axis + ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "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 axisPt{"axisPt", {VARIABLE_WIDTH, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00, 1.20, 1.40, 1.60, 1.80, 2.00, 2.20, 2.40, 2.60, 2.80, 3.00, 3.50, 4.00, 5.00, 6.00, 8.00, 10.00}, "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 axisNsigmaTPC{"axisNsigmaTPC", {80, -5, 5}, "nsigmaTPC axis"}; + ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {80, -5, 5}, "nsigmaTOF axis"}; + ConfigurableAxis axisParticles{"axisParticles", {3, 0, 3}, "axis for different hadrons"}; + ConfigurableAxis axisPhiMass{"axisPhiMass", {50000, 0, 5}, "axis for invariant mass distibution for Phi"}; + ConfigurableAxis axisKoMass{"axisKoMass", {50000, 0, 5}, "axis for invariant mass distibution for K0"}; + ConfigurableAxis axisLambdaMass{"axisLambdaMass", {50000, 0, 5}, "axis for invariant mass distibution for Lambda"}; + ConfigurableAxis axisTPCsignal{"axisTPCsignal", {10000, 0, 1000}, "axis for TPC signal"}; + ConfigurableAxis axisTOFsignal{"axisTOFsignal", {10000, 0, 1000}, "axis for TOF signal"}; + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; + Filter trackFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax); + + using AodCollisions = soa::Filtered>; + using AodTracksWithoutBayes = soa::Filtered>; + + SliceCache cache; + Partition posTracks = aod::track::signed1Pt > 0.0f; + Partition negTracks = aod::track::signed1Pt < 0.0f; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + TAxis* fPtAxis; + TRandom3* fRndm = new TRandom3(0); + + // Event selection cuts - Alex + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + TF1* fMultCutLow = nullptr; + TF1* fMultCutHigh = nullptr; + TF1* fMultMultPVCut = nullptr; + + void init(InitContext const&) + { + ccdb->setURL(ccdbUrl.value); + ccdb->setCaching(true); + ccdb->setCreatedNotAfter(noLaterThan.value); + + histos.add("hPhi", "", {HistType::kTH1D, {axisPhi}}); + histos.add("hEta", "", {HistType::kTH1D, {axisEta}}); + histos.add("hVtxZ", "", {HistType::kTH1D, {axisVertex}}); + histos.add("hMult", "", {HistType::kTH1D, {{3000, 0.5, 3000.5}}}); + histos.add("hCent", "", {HistType::kTH1D, {{90, 0, 90}}}); + + histos.add("KaplusTPC", "", {HistType::kTH2D, {{axisPt, axisTPCsignal}}}); + histos.add("KaminusTPC", "", {HistType::kTH2D, {{axisPt, axisTPCsignal}}}); + histos.add("KaplusTOF", "", {HistType::kTH2D, {{axisPt, axisTOFsignal}}}); + histos.add("KaminusTOF", "", {HistType::kTH2D, {{axisPt, axisTOFsignal}}}); + histos.add("hPhiMass_sparse", "", {HistType::kTHnSparseD, {{axisPhiMass, axisPt, axisMultiplicity}}}); + + if (additionalEvsel) { + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutLow->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutHigh->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x)", 0, 100); + fMultCutLow->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); + fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x)", 0, 100); + fMultCutHigh->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); + fMultMultPVCut = new TF1("fMultMultPVCut", "[0]+[1]*x+[2]*x*x", 0, 5000); + fMultMultPVCut->SetParameters(-0.1, 0.785, -4.7e-05); + } + } + + // deep angle cut on pair to remove photon conversion + template + bool selectionPair(const T1& candidate1, const T2& candidate2) + { + double pt1, pt2, pz1, pz2, p1, p2, angle; + pt1 = candidate1.pt(); + pt2 = candidate2.pt(); + pz1 = candidate1.pz(); + pz2 = candidate2.pz(); + p1 = candidate1.p(); + p2 = candidate2.p(); + angle = TMath::ACos((pt1 * pt2 + pz1 * pz2) / (p1 * p2)); + if (cfgUsePointingAngle && angle < cfgPointingAnglePhi) { + return false; + } + return true; + } + + template + bool eventSelected(TCollision collision, const float& centrality) + { + auto multNTracksPV = collision.multNTracksPV(); + if (multNTracksPV < fMultPVCutLow->Eval(centrality)) + return 0; + if (multNTracksPV > fMultPVCutHigh->Eval(centrality)) + return 0; + + return 1; + } + + template + bool selectionTrack(const T& candidate) + { + if (useGlobalTrack && !(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTpcCluster)) { + return false; + } + if (!useGlobalTrack && !(candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster)) { + return false; + } + return true; + } + + template + bool selectionPIDpTdependent(const T& candidate) + { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut) { + return true; + } + if (candidate.pt() >= 0.5 && candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut && TMath::Abs(candidate.tofNSigmaKa()) < cfgTofNsigmaCut) { + return true; + } + if (!useGlobalTrack && !candidate.hasTPC()) { + return true; + } + return false; + } + template + bool selectionPID(const T& candidate) + { + if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut) { + return true; + } + if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut && TMath::Abs(candidate.tofNSigmaKa()) < cfgTofNsigmaCut) { + return true; + } + return false; + } + + template + bool isFakeKaon(T const& track) + { + const auto pglobal = track.p(); + const auto ptpc = track.tpcInnerParam(); + if (TMath::Abs(pglobal - ptpc) > cfgFakePartCut) { + return true; + } + return false; + } + + double GetPhiInRange(double phi) + { + double result = phi; + while (result < 0) { + result = result + 2. * TMath::Pi() / 2; + } + while (result > 2. * TMath::Pi() / 2) { + result = result - 2. * TMath::Pi() / 2; + } + return result; + } + + double GetDeltaPsiSubInRange(double psi1, double psi2) + { + double delta = psi1 - psi2; + if (TMath::Abs(delta) > TMath::Pi() / 2) { + if (delta > 0.) + delta -= 2. * TMath::Pi() / 2; + else + delta += 2. * TMath::Pi() / 2; + } + return delta; + } + + using BinningTypeVertexContributor = ColumnBinningPolicy; + ROOT::Math::PxPyPzMVector PhiMom, KaonPlus, KaonMinus; + double massKaplus = o2::constants::physics::MassKPlus; + + void process(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracksWithoutBayes const& tracks) + { + if (!collision.sel8() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return; + } + + const auto cent = collision.centFT0C(); + int nTot = tracks.size(); + float vtxz = collision.posZ(); + int occupancy = collision.trackOccupancyInTimeRange(); + + if (occupancy > cfgCutOccupancy) { + return; + } + + if (additionalEvsel && !eventSelected(collision, cent)) { + return; + } + + histos.fill(HIST("hVtxZ"), vtxz); + histos.fill(HIST("hMult"), nTot); + histos.fill(HIST("hCent"), cent); + + auto posSlicedTracks = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + auto negSlicedTracks = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + + for (auto track1 : posSlicedTracks) { + // track selection + if (!selectionTrack(track1)) { + continue; + } + // PID check + if (ispTdepPID && !selectionPIDpTdependent(track1)) { + continue; + } + if (!ispTdepPID && !selectionPID(track1)) { + continue; + } + histos.fill(HIST("KaplusTPC"), track1.pt(), track1.tpcNSigmaKa()); + histos.fill(HIST("KaplusTOF"), track1.pt(), track1.tofNSigmaKa()); + auto track1ID = track1.globalIndex(); + + for (auto track2 : negSlicedTracks) { + // track selection + if (!selectionTrack(track2)) { + continue; + } + // PID check + if (ispTdepPID && !selectionPIDpTdependent(track2)) { + continue; + } + if (!ispTdepPID && !selectionPID(track2)) { + continue; + } + auto track2ID = track2.globalIndex(); + if (track2ID == track1ID) { + continue; + } + if (!selectionPair(track1, track2)) { + continue; + } + if (removefaketrack && isFakeKaon(track1)) { + continue; + } + if (removefaketrack && isFakeKaon(track2)) { + continue; + } + histos.fill(HIST("KaminusTPC"), track2.pt(), track2.tpcNSigmaKa()); + histos.fill(HIST("KaminusTOF"), track2.pt(), track2.tofNSigmaKa()); + KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKaplus); + KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKaplus); + PhiMom = KaonPlus + KaonMinus; + if (TMath::Abs(PhiMom.Rapidity()) < confRapidity) { + histos.fill(HIST("hPhiMass_sparse"), PhiMom.M(), PhiMom.Pt(), cent); + histos.fill(HIST("hPhi"), PhiMom.Phi()); + histos.fill(HIST("hEta"), PhiMom.Eta()); + } + } // end of track 2 + } // end of track 1 + } // end of process +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 47473a9a8fcbc93711bbc39ff92cfcf87fce2ffa Mon Sep 17 00:00:00 2001 From: Preet Pati Date: Mon, 20 Jan 2025 15:28:26 +0100 Subject: [PATCH 08/11] Fixed the formatting and linter errors --- PWGCF/Flow/Tasks/CMakeLists.txt | 2 +- PWGCF/Flow/Tasks/flowPbpbReso.cxx | 58 +++++++++---------------------- 2 files changed, 18 insertions(+), 42 deletions(-) diff --git a/PWGCF/Flow/Tasks/CMakeLists.txt b/PWGCF/Flow/Tasks/CMakeLists.txt index 9d04923c87c..5e6f5ff76cd 100644 --- a/PWGCF/Flow/Tasks/CMakeLists.txt +++ b/PWGCF/Flow/Tasks/CMakeLists.txt @@ -62,4 +62,4 @@ o2physics_add_dpl_workflow(flow-sp o2physics_add_dpl_workflow(flow-pbpb-reso SOURCES flowPbpbReso.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore - COMPONENT_NAME Analysis) + COMPONENT_NAME Analysis) diff --git a/PWGCF/Flow/Tasks/flowPbpbReso.cxx b/PWGCF/Flow/Tasks/flowPbpbReso.cxx index b009bb04805..2ce7a3e9690 100644 --- a/PWGCF/Flow/Tasks/flowPbpbReso.cxx +++ b/PWGCF/Flow/Tasks/flowPbpbReso.cxx @@ -181,7 +181,7 @@ struct FlowPbpbReso { pz2 = candidate2.pz(); p1 = candidate1.p(); p2 = candidate2.p(); - angle = TMath::ACos((pt1 * pt2 + pz1 * pz2) / (p1 * p2)); + angle = std::acos((pt1 * pt2 + pz1 * pz2) / (p1 * p2)); if (cfgUsePointingAngle && angle < cfgPointingAnglePhi) { return false; } @@ -215,10 +215,10 @@ struct FlowPbpbReso { template bool selectionPIDpTdependent(const T& candidate) { - if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut) { + if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut) { return true; } - if (candidate.pt() >= 0.5 && candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut && TMath::Abs(candidate.tofNSigmaKa()) < cfgTofNsigmaCut) { + if (candidate.pt() >= 0.5 && candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && std::abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut && std::abs(candidate.tofNSigmaKa()) < cfgTofNsigmaCut) { return true; } if (!useGlobalTrack && !candidate.hasTPC()) { @@ -229,10 +229,10 @@ struct FlowPbpbReso { template bool selectionPID(const T& candidate) { - if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut) { + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut) { return true; } - if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut && TMath::Abs(candidate.tofNSigmaKa()) < cfgTofNsigmaCut) { + if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && std::abs(candidate.tpcNSigmaKa()) < cfgTpcNsigmaCut && std::abs(candidate.tofNSigmaKa()) < cfgTofNsigmaCut) { return true; } return false; @@ -243,39 +243,15 @@ struct FlowPbpbReso { { const auto pglobal = track.p(); const auto ptpc = track.tpcInnerParam(); - if (TMath::Abs(pglobal - ptpc) > cfgFakePartCut) { + if (std::abs(pglobal - ptpc) > cfgFakePartCut) { return true; } return false; } - double GetPhiInRange(double phi) - { - double result = phi; - while (result < 0) { - result = result + 2. * TMath::Pi() / 2; - } - while (result > 2. * TMath::Pi() / 2) { - result = result - 2. * TMath::Pi() / 2; - } - return result; - } - - double GetDeltaPsiSubInRange(double psi1, double psi2) - { - double delta = psi1 - psi2; - if (TMath::Abs(delta) > TMath::Pi() / 2) { - if (delta > 0.) - delta -= 2. * TMath::Pi() / 2; - else - delta += 2. * TMath::Pi() / 2; - } - return delta; - } - using BinningTypeVertexContributor = ColumnBinningPolicy; - ROOT::Math::PxPyPzMVector PhiMom, KaonPlus, KaonMinus; - double massKaplus = o2::constants::physics::MassKPlus; + ROOT::Math::PxPyPzMVector phiMom, kaonPlus, kaonminus; + double massKaPlus = o2::constants::physics::MassKPlus; void process(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracksWithoutBayes const& tracks) { @@ -303,7 +279,7 @@ struct FlowPbpbReso { auto posSlicedTracks = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negSlicedTracks = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - for (auto track1 : posSlicedTracks) { + for (auto const& track1 : posSlicedTracks) { // track selection if (!selectionTrack(track1)) { continue; @@ -319,7 +295,7 @@ struct FlowPbpbReso { histos.fill(HIST("KaplusTOF"), track1.pt(), track1.tofNSigmaKa()); auto track1ID = track1.globalIndex(); - for (auto track2 : negSlicedTracks) { + for (auto const& track2 : negSlicedTracks) { // track selection if (!selectionTrack(track2)) { continue; @@ -346,13 +322,13 @@ struct FlowPbpbReso { } histos.fill(HIST("KaminusTPC"), track2.pt(), track2.tpcNSigmaKa()); histos.fill(HIST("KaminusTOF"), track2.pt(), track2.tofNSigmaKa()); - KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKaplus); - KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKaplus); - PhiMom = KaonPlus + KaonMinus; - if (TMath::Abs(PhiMom.Rapidity()) < confRapidity) { - histos.fill(HIST("hPhiMass_sparse"), PhiMom.M(), PhiMom.Pt(), cent); - histos.fill(HIST("hPhi"), PhiMom.Phi()); - histos.fill(HIST("hEta"), PhiMom.Eta()); + kaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKaPlus); + kaonminus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKaPlus); + phiMom = kaonPlus + kaonminus; + if (std::abs(phiMom.Rapidity()) < confRapidity) { + histos.fill(HIST("hPhiMass_sparse"), phiMom.M(), phiMom.Pt(), cent); + histos.fill(HIST("hPhi"), phiMom.Phi()); + histos.fill(HIST("hEta"), phiMom.Eta()); } } // end of track 2 } // end of track 1 From 59c84fd1c6c014978173f5ff20e12673afc3f205 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 20 Jan 2025 14:29:07 +0000 Subject: [PATCH 09/11] Please consider the following formatting changes --- PWGCF/Flow/Tasks/flowPbpbPikp.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx index e583b609f02..5aecd0a5fa4 100644 --- a/PWGCF/Flow/Tasks/flowPbpbPikp.cxx +++ b/PWGCF/Flow/Tasks/flowPbpbPikp.cxx @@ -86,7 +86,7 @@ struct FlowPbpbPikp { ConfigurableAxis axisTPCsignal{"axisTPCsignal", {10000, 0, 1000}, "axis for TPC signal"}; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; - Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t)true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); using AodCollisions = soa::Filtered>; // using AodTracks = soa::Filtered>; From 9fc449604393697a1f33b0498ce86aa1c846bdec Mon Sep 17 00:00:00 2001 From: Preet-Bhanjan Date: Mon, 20 Jan 2025 16:35:15 +0100 Subject: [PATCH 10/11] Update and rename flowPbpbReso.cxx to resonancesGfwFlow.cxx --- .../Flow/Tasks/{flowPbpbReso.cxx => resonancesGfwFlow.cxx} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename PWGCF/Flow/Tasks/{flowPbpbReso.cxx => resonancesGfwFlow.cxx} (99%) diff --git a/PWGCF/Flow/Tasks/flowPbpbReso.cxx b/PWGCF/Flow/Tasks/resonancesGfwFlow.cxx similarity index 99% rename from PWGCF/Flow/Tasks/flowPbpbReso.cxx rename to PWGCF/Flow/Tasks/resonancesGfwFlow.cxx index 2ce7a3e9690..1b8428f0d9d 100644 --- a/PWGCF/Flow/Tasks/flowPbpbReso.cxx +++ b/PWGCF/Flow/Tasks/resonancesGfwFlow.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file flowPbpbReso.cxx +/// \file resonancesGfwFlow.cxx /// \brief PID flow for resonances using the generic framework /// \author Preet Bhanjan Pati @@ -55,7 +55,7 @@ using namespace std; #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; -struct FlowPbpbReso { +struct ResonancesGfwFlow { Service ccdb; Configurable noLaterThan{"noLaterThan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable ccdbUrl{"ccdbUrl", "http://ccdb-test.cern.ch:8080", "url of the ccdb repository"}; @@ -337,5 +337,5 @@ struct FlowPbpbReso { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } From aea0bd9f599d2d1d21fcc857b8c04a35d11765c4 Mon Sep 17 00:00:00 2001 From: Preet-Bhanjan Date: Mon, 20 Jan 2025 16:35:53 +0100 Subject: [PATCH 11/11] Update CMakeLists.txt --- PWGCF/Flow/Tasks/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGCF/Flow/Tasks/CMakeLists.txt b/PWGCF/Flow/Tasks/CMakeLists.txt index 8c25f618dc1..c77ae659fdb 100644 --- a/PWGCF/Flow/Tasks/CMakeLists.txt +++ b/PWGCF/Flow/Tasks/CMakeLists.txt @@ -59,7 +59,7 @@ o2physics_add_dpl_workflow(flow-sp PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(flow-pbpb-reso - SOURCES flowPbpbReso.cxx +o2physics_add_dpl_workflow(resonances-gfw-flow + SOURCES resonancesGfwFlow.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis)