From b2d9292241db4afd3ecd518009dcd0f5d7e56e8c Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 15 Jul 2025 14:56:55 +0000 Subject: [PATCH] Please consider the following formatting changes --- PWGLF/Tasks/Resonances/phiOO.cxx | 238 +++++++++++-------------------- 1 file changed, 82 insertions(+), 156 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phiOO.cxx b/PWGLF/Tasks/Resonances/phiOO.cxx index c7c696a4092..9c7e6005264 100644 --- a/PWGLF/Tasks/Resonances/phiOO.cxx +++ b/PWGLF/Tasks/Resonances/phiOO.cxx @@ -61,8 +61,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -struct phiOO -{ +struct phiOO { SliceCache cache; Preslice perCollision = aod::track::collisionId; @@ -124,7 +123,7 @@ struct phiOO ConfigurableAxis cfg_bins_MixVtx{"cfg_bins_MixVtx", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; ConfigurableAxis cfg_bins_MixMult{"cfg_bins_MixMult", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f}, "Mixing bins - z-vertex"}; - void init(o2::framework::InitContext &) + void init(o2::framework::InitContext&) { const AxisSpec MinvAxis = {cfg_Pair_MinvBins, cfg_Pair_MinvMin, cfg_Pair_MinvMax}; const AxisSpec PtAxis = {200, 0, 20.0}; @@ -135,8 +134,7 @@ struct phiOO const AxisSpec axisDCAxy{binsDCAxy, "DCA_{XY}"}; // Event QA - if (cfg_Event_CutQA) - { + if (cfg_Event_CutQA) { histos.add("hPosZ_BC", "PosZ_BC", kTH1F, {{240, -12.0, 12.0}}); histos.add("hcentFT0C_BC", "centFT0C_BC", kTH1F, {{110, 0.0, 110.0}}); histos.add("hOccupancy_BC", "Occupancy_BC", kTH1F, {{100, 0.0, 20000}}); @@ -146,8 +144,7 @@ struct phiOO histos.add("hOccupancy_AC", "Occupancy_AC", kTH1F, {{100, 0.0, 20000}}); } // Track QA - if (cfg_Track_CutQA) - { + if (cfg_Track_CutQA) { histos.add("hDCArToPv_BC", "DCArToPv_BC", kTH1F, {axisDCAxy}); histos.add("hDCAzToPv_BC", "DCAzToPv_BC", kTH1F, {axisDCAz}); histos.add("hIsPrim_BC", "hIsPrim_BC", kTH1F, {{2, -0.5, 1.5}}); @@ -214,47 +211,39 @@ struct phiOO using BinningTypeVtxCent = ColumnBinningPolicy; Partition PosKaon_MC = - (aod::track::signed1Pt > static_cast(0)) && - (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); + (aod::track::signed1Pt > static_cast(0)) && + (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); Partition NegKaon_MC = - (aod::track::signed1Pt < static_cast(0)) && - (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); + (aod::track::signed1Pt < static_cast(0)) && + (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); Partition PosKaon = - (aod::track::signed1Pt > static_cast(0)) && - (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); + (aod::track::signed1Pt > static_cast(0)) && + (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); Partition NegKaon = - (aod::track::signed1Pt < static_cast(0)) && - (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); + (aod::track::signed1Pt < static_cast(0)) && + (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); double massKa = o2::constants::physics::MassKPlus; //***********************************// // First, we declare some helper functions template - void fillQA(const bool pass, const objType &obj, const int objecttype = 0) + void fillQA(const bool pass, const objType& obj, const int objecttype = 0) { - if (objecttype == 1) - { - if constexpr (requires { obj.posZ(); }) - { - if (!pass) - { + if (objecttype == 1) { + if constexpr (requires { obj.posZ(); }) { + if (!pass) { histos.fill(HIST("hPosZ_BC"), obj.posZ()); histos.fill(HIST("hcentFT0C_BC"), obj.centFT0C()); - } - else - { + } else { histos.fill(HIST("hPosZ_AC"), obj.posZ()); histos.fill(HIST("hcentFT0C_AC"), obj.centFT0C()); } } } - if constexpr (requires { obj.tpcCrossedRowsOverFindableCls(); }) - { - if (objecttype == 2) - { - if (!pass) - { + if constexpr (requires { obj.tpcCrossedRowsOverFindableCls(); }) { + if (objecttype == 2) { + if (!pass) { histos.fill(HIST("hDCArToPv_BC"), obj.dcaXY()); histos.fill(HIST("hDCAzToPv_BC"), obj.dcaZ()); histos.fill(HIST("hIsPrim_BC"), obj.isPrimaryTrack()); @@ -264,9 +253,7 @@ struct phiOO histos.fill(HIST("hFindableTPCRows_BC"), obj.tpcNClsCrossedRows()); histos.fill(HIST("hClustersVsRows_BC"), obj.tpcCrossedRowsOverFindableCls()); histos.fill(HIST("hTPCChi2_BC"), obj.tpcChi2NCl()); - } - else - { + } else { histos.fill(HIST("hDCArToPv_AC"), obj.dcaXY()); histos.fill(HIST("hDCAzToPv_AC"), obj.dcaZ()); histos.fill(HIST("hIsPrim_AC"), obj.isPrimaryTrack()); @@ -278,17 +265,13 @@ struct phiOO histos.fill(HIST("hTPCChi2_AC"), obj.tpcChi2NCl()); } } - if (objecttype == 3) - { - if (!pass) - { + if (objecttype == 3) { + if (!pass) { histos.fill(HIST("hTPC_nSigma_BC"), obj.tpcNSigmaKa()); histos.fill(HIST("hTOF_nSigma_BC"), obj.tofNSigmaKa()); histos.fill(HIST("hTPC_nSigma_v_pt_BC"), obj.tpcNSigmaKa(), obj.pt()); histos.fill(HIST("hTOF_nSigma_v_pt_BC"), obj.tofNSigmaKa(), obj.pt()); - } - else - { + } else { histos.fill(HIST("hTPC_nSigma_AC"), obj.tpcNSigmaKa()); histos.fill(HIST("hTOF_nSigma_AC"), obj.tofNSigmaKa()); histos.fill(HIST("hTPC_nSigma_v_pt_AC"), obj.tpcNSigmaKa(), obj.pt()); @@ -367,49 +350,36 @@ struct phiOO // trackpid template - bool trackPIDKaon(const TrackPID &candidate, const bool QA) + bool trackPIDKaon(const TrackPID& candidate, const bool QA) { bool tpcPIDPassed{false}, tofPIDPassed{false}; if (cfg_Track_CutQA && QA) fillQA(false, candidate, 3); - if (!cfg_Track_TPCPID) - { + if (!cfg_Track_TPCPID) { tpcPIDPassed = true; - } - else - { + } else { if (std::abs(candidate.tpcNSigmaKa()) < cfg_Track_TPCPID_nSig) tpcPIDPassed = true; } - if (!cfg_Track_TOFPID) - { + if (!cfg_Track_TOFPID) { tofPIDPassed = true; - } - else - { - if (candidate.hasTOF()) - { - if (std::abs(candidate.tofNSigmaKa()) < cfg_Track_TOFPID_nSig) - { + } else { + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaKa()) < cfg_Track_TOFPID_nSig) { tofPIDPassed = true; } - } - else if (!cfg_Track_Hard_TOFPID) - { + } else if (!cfg_Track_Hard_TOFPID) { tofPIDPassed = true; } - if (!candidate.hasTOF()) - { + if (!candidate.hasTOF()) { std::cout << candidate.tofNSigmaKa() << std::endl; } } - if (tpcPIDPassed && tofPIDPassed) - { - if (cfg_Track_CutQA && QA) - { + if (tpcPIDPassed && tofPIDPassed) { + if (cfg_Track_CutQA && QA) { fillQA(true, candidate, 3); } return true; @@ -418,36 +388,26 @@ struct phiOO } template - void TrackSlicing(const CollisionType &collision1, const TracksType &, const CollisionType &collision2, const TracksType &, const bool QA, const bool IsMix) + void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix) { auto slicedtracks1 = PosKaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto slicedtracks2 = NegKaon->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); - for (auto &[track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(slicedtracks1, slicedtracks2))) - { + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(slicedtracks1, slicedtracks2))) { auto [Minv, PhiPt] = minvReconstruction(track1, track2, QA); if (Minv < 0) continue; double conjugate = track1.sign() * track2.sign(); - if (!IsMix) - { - if (conjugate < 0) - { + if (!IsMix) { + if (conjugate < 0) { histos.fill(HIST("hUSS"), centrality, Minv, PhiPt); - } - else if (conjugate > 0) - { + } else if (conjugate > 0) { histos.fill(HIST("hLSS"), centrality, Minv, PhiPt); } - } - else - { - if (conjugate < 0) - { + } else { + if (conjugate < 0) { histos.fill(HIST("hUSS_Mix"), centrality, Minv, PhiPt); - } - else if (conjugate > 0) - { + } else if (conjugate > 0) { histos.fill(HIST("hLSS_Mix"), centrality, Minv, PhiPt); } } @@ -455,36 +415,26 @@ struct phiOO } // TrackSlicing template - void TrackSlicing_MC(const CollisionType &collision1, const TracksType &, const CollisionType &collision2, const TracksType &, const bool QA, const bool IsMix) + void TrackSlicing_MC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix) { auto slicedtracks1 = PosKaon_MC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto slicedtracks2 = NegKaon_MC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); - for (auto &[track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(slicedtracks1, slicedtracks2))) - { + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(slicedtracks1, slicedtracks2))) { auto [Minv, PhiPt] = minvReconstruction(track1, track2, QA); if (Minv < 0) continue; double conjugate = track1.sign() * track2.sign(); - if (!IsMix) - { - if (conjugate < 0) - { + if (!IsMix) { + if (conjugate < 0) { histos.fill(HIST("hMC_USS"), centrality, Minv, PhiPt); - } - else if (conjugate > 0) - { + } else if (conjugate > 0) { histos.fill(HIST("hMC_LSS"), centrality, Minv, PhiPt); } - } - else - { - if (conjugate < 0) - { + } else { + if (conjugate < 0) { histos.fill(HIST("hMC_USS_Mix"), centrality, Minv, PhiPt); - } - else if (conjugate > 0) - { + } else if (conjugate > 0) { histos.fill(HIST("hMC_LSS_Mix"), centrality, Minv, PhiPt); } } @@ -505,16 +455,14 @@ struct phiOO std::vector mothers1{}; std::vector mothers1PDG{}; - for (auto &part1_mom : part1.template mothers_as()) - { + for (auto& part1_mom : part1.template mothers_as()) { mothers1.push_back(part1_mom.globalIndex()); mothers1PDG.push_back(part1_mom.pdgCode()); } std::vector mothers2{}; std::vector mothers2PDG{}; - for (auto &part2_mom : part2.template mothers_as()) - { + for (auto& part2_mom : part2.template mothers_as()) { mothers2.push_back(part2_mom.globalIndex()); mothers2PDG.push_back(part2_mom.pdgCode()); } @@ -533,7 +481,7 @@ struct phiOO // Invariant mass template - std::pair minvReconstruction(const TracksType &trk1, const TracksType &trk2, const bool QA) + std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA) { TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; //==================================================== @@ -541,8 +489,7 @@ struct phiOO if (!trackSelection(trk1, QA) || !trackSelection(trk2, false)) return {-1.0, -1.0}; - if (cfg_Track_Explicit_PID) - { + if (cfg_Track_Explicit_PID) { if (!trackPIDKaon(trk1, QA) || !trackPIDKaon(trk2, false)) return {-1.0, -1.0}; } @@ -562,13 +509,11 @@ struct phiOO //***************// int nEvents = 0; - void processSameEvent(EventCandidates::iterator const &collision, TrackCandidates const &tracks) + void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks) { - if (cDebugLevel > 0) - { + if (cDebugLevel > 0) { ++nEvents; - if (nEvents % 10000 == 0) - { + if (nEvents % 10000 == 0) { std::cout << "Processed Data Events: " << nEvents << std::endl; } } @@ -588,19 +533,16 @@ struct phiOO //***************// int nEvents_Mix = 0; - void processMixedEvent(EventCandidates const &collisions, TrackCandidates const &tracks) + void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks) { auto tracksTuple = std::make_tuple(tracks); BinningTypeVtxCent colBinning{{cfg_bins_MixVtx, cfg_bins_MixMult}, true}; SameKindPair pairs{colBinning, cfg_Mix_NMixedEvents, -1, collisions, tracksTuple, &cache}; - for (const auto &[collision1, tracks1, collision2, tracks2] : pairs) - { - if (cDebugLevel > 0) - { + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + if (cDebugLevel > 0) { ++nEvents_Mix; - if (nEvents_Mix % 10000 == 0) - { + if (nEvents_Mix % 10000 == 0) { std::cout << "Processed Mixed Events: " << nEvents_Mix << std::endl; } } @@ -618,13 +560,11 @@ struct phiOO //***************// int nEvents_MC = 0; - void processSameEvent_MC(EventCandidates::iterator const &collision, TrackCandidates_MC const &tracks, aod::McParticles const &) + void processSameEvent_MC(EventCandidates::iterator const& collision, TrackCandidates_MC const& tracks, aod::McParticles const&) { - if (cDebugLevel > 0) - { + if (cDebugLevel > 0) { ++nEvents_MC; - if (nEvents_MC % 10000 == 0) - { + if (nEvents_MC % 10000 == 0) { std::cout << "Processed MC (REC) Events: " << nEvents_MC << std::endl; } } @@ -643,18 +583,15 @@ struct phiOO //***************// int nEvents_MC_Mix = 0; - void processMixedEvent_MC(EventCandidates const &collisions, TrackCandidates_MC const &tracks, aod::McParticles const &) + void processMixedEvent_MC(EventCandidates const& collisions, TrackCandidates_MC const& tracks, aod::McParticles const&) { auto tracksTuple = std::make_tuple(tracks); BinningTypeVtxCent colBinning{{cfg_bins_MixVtx, cfg_bins_MixMult}, true}; SameKindPair pairs{colBinning, cfg_Mix_NMixedEvents, -1, collisions, tracksTuple, &cache}; - for (const auto &[collision1, tracks1, collision2, tracks2] : pairs) - { - if (cDebugLevel > 0) - { + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + if (cDebugLevel > 0) { ++nEvents_MC_Mix; - if (nEvents_MC_Mix % 10000 == 0) - { + if (nEvents_MC_Mix % 10000 == 0) { std::cout << "Processed Mixed Events: " << nEvents_MC_Mix << std::endl; } } @@ -672,13 +609,11 @@ struct phiOO //***************// int nEvents_True = 0; - void processParticles(EventCandidates_True::iterator const &collision, soa::SmallGroups> const &recocolls, aod::McParticles const &particles) + void processParticles(EventCandidates_True::iterator const& collision, soa::SmallGroups> const& recocolls, aod::McParticles const& particles) { - if (cDebugLevel > 0) - { + if (cDebugLevel > 0) { ++nEvents_True; - if (nEvents_True % 10000 == 0) - { + if (nEvents_True % 10000 == 0) { std::cout << "Processed MC (GEN) Events: " << nEvents_True << std::endl; } } @@ -686,17 +621,14 @@ struct phiOO if (fabs(collision.posZ()) > cfg_Event_VtxCut) return; - if (recocolls.size() <= 0) - { // not reconstructed - if (cfg_Force_GenReco) - { + if (recocolls.size() <= 0) { // not reconstructed + if (cfg_Force_GenReco) { return; } } double centrality = -1; - for (auto &recocoll : recocolls) - { // poorly reconstructed + for (auto& recocoll : recocolls) { // poorly reconstructed centrality = recocoll.centFT0C(); auto [goodEv, code] = eventSelection(recocoll, false); histos.fill(HIST("hnEvents_MC_True"), code); @@ -704,27 +636,21 @@ struct phiOO return; } - for (auto &particle : particles) - { + for (auto& particle : particles) { if (particle.pdgCode() != 333) continue; if (std::fabs(particle.eta()) > cfg_Track_MaxEta) continue; - if (cfg_Force_BR) - { + if (cfg_Force_BR) { bool baddecay = false; - for (auto &phidaughter : particle.daughters_as()) - { - if (std::fabs(phidaughter.pdgCode()) != 321) - { + for (auto& phidaughter : particle.daughters_as()) { + if (std::fabs(phidaughter.pdgCode()) != 321) { baddecay = true; break; } - if (cfg_Force_Kaon_Acceptence) - { - if (std::fabs(phidaughter.eta()) > cfg_Track_MaxEta) - { + if (cfg_Force_Kaon_Acceptence) { + if (std::fabs(phidaughter.eta()) > cfg_Track_MaxEta) { baddecay = true; break; } @@ -743,7 +669,7 @@ struct phiOO }; // end of main struct -WorkflowSpec defineDataProcessing(ConfigContext const &cfgc) +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; };