From f7ae6fea393582949c5ef206c5d9eeb89398b3ed Mon Sep 17 00:00:00 2001 From: Hyungjun Lee Date: Wed, 15 Apr 2026 17:14:37 +0900 Subject: [PATCH 1/9] [PWGLF] dndeta-hi: move from PWGMM, add SD/DD/ND classification - Move dndeta-hi.cxx from PWGMM/Mult/Tasks to PWGLF/Tasks/GlobalEventProperties - Add kDD, kSD, kND enum values for diffractive event classification - Join McCollisions with HepMCXSections to access processId() in processMCCounting - Classify events by Pythia8 process code: 101=ND, 103/104=SD, 105/106=DD - Replace sliceByCached with sliceBy+Preslice for soa::Filtered tables - Fix std-prefix: std::log, std::exp, std::fabs - Fix const-ref-in-for-loop: const auto& in range-based for loops - Fix pdg/explicit-code: 310->kK0Short, 3122->kLambda0 - Add CMakeLists.txt entry for dndeta-hi workflow --- .../GlobalEventProperties/CMakeLists.txt | 5 + .../Tasks/GlobalEventProperties/dndeta-hi.cxx | 871 ++++++++++++++++++ 2 files changed, 876 insertions(+) create mode 100644 PWGLF/Tasks/GlobalEventProperties/dndeta-hi.cxx diff --git a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt index cde1964f9e2..023bc7aedc7 100644 --- a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt +++ b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt @@ -43,3 +43,8 @@ o2physics_add_dpl_workflow(nch-studypp SOURCES nchStudypp.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(dndeta-hi + SOURCES dndeta-hi.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::Framework + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/GlobalEventProperties/dndeta-hi.cxx b/PWGLF/Tasks/GlobalEventProperties/dndeta-hi.cxx new file mode 100644 index 00000000000..b86c7bc09b4 --- /dev/null +++ b/PWGLF/Tasks/GlobalEventProperties/dndeta-hi.cxx @@ -0,0 +1,871 @@ +// 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. + +#include "Index.h" + +#include "PWGLF/DataModel/LFStrangenessTables.h" + +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponseTOF.h" +#include "Common/DataModel/PIDResponseTPC.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::track; + +using namespace o2::aod; + +using BCsRun3 = soa::Join; +using MyCollisions = soa::Join; +using MyCollisionsCent = soa::Join; +using FullBCs = soa::Join; +using DaughterTrack = soa::Join; +using ExTracks = soa::Join; +using FiTracks = soa::Filtered; +// using FiTracks = ExTracks; +// using Particles = soa::Filtered>; +using Particles = soa::Join; +// using Particle = Particles; +using LabeledTracks = soa::Join; +using LabeledTracksEx = soa::Join; +using FiLTracks = soa::Filtered; +using DaughterTracks = soa::Join; +typedef std::vector Bool_1d; + +enum { + kECbegin = 0, + kDATA = 1, + kINEL, + kINELg0, + kDD, + kSD, + kND, + kECend +}; +enum { + kTrigbegin = 0, + kSel8 = 1, + kSel8g0, + kTrigend +}; +enum { + kSpeciesbegin = 0, + kK0short = 1, + kLambda, + kAntilambda, + kSpeciesend +}; +enum { + kSignbegin = 0, + kPositive = 1, + kNegative, + kSignend +}; +enum { + kStepbegin = 0, + kAll = 1, + kBasiccut, + kMasscut, + kStepend +}; + +enum { + kParTypebegin = 0, + kParDATA = 1, + kMotherStrange, + kBkg, + kNotPrimary, + kPion, + kKaon, + kProtonMy, + kOPar, + kParTypeend +}; +enum { + kPtVarbegin = 0, + kNoPtVar = 1, + kPtUp, + kPtDw, + kPtVarend +}; + +namespace +{ +template +static constexpr bool hasCent() +{ + if constexpr (!soa::is_soa_join_v) { + return false; + } else if (T::template contains()) { + return true; + } else { + return false; + } +} +} // namespace + +AxisSpec ZAxis = {{-30, -20, -15, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30}, "Z (cm)", "zaxis"}; +AxisSpec DeltaZAxis = {61, -6.1, 6.1, "", "deltaz axis"}; +AxisSpec DCAAxis = {601, -3.01, 3.01, "", "DCA axis"}; +AxisSpec EtaAxis = {80, -4.0, 4.0, "#eta", "eta axis"}; +AxisSpec V0EtaAxis = {20, -1.0, 1.0, "#etav0", "eta axis"}; +AxisSpec PhiAxis = {629, 0, 2 * M_PI, "Rad", "phi axis"}; +AxisSpec PtVarAxis = {kPtVarend - 1, +kPtVarbegin + 0.5, +kPtVarend - 0.5, "", "ptvar axis"}; +AxisSpec EvtClassAxis = {kECend - 1, +kECbegin + 0.5, +kECend - 0.5, "", "event class"}; +AxisSpec TrigClassAxis = {kTrigend - 1, +kTrigbegin + 0.5, +kTrigend - 0.5, "", "trigger class"}; +AxisSpec ParticleTypeAxis = {kParTypeend - 1, +kParTypebegin + 0.5, +kParTypeend - 0.5, "", "Particle type"}; +AxisSpec SpeciesAxis = {kSpeciesend - 1, +kSpeciesbegin + 0.5, +kSpeciesend - 0.5, "", "species class"}; +AxisSpec MassAxis = {600, 0.3f, 1.3f, "Mass (GeV/c^{2})", "Inv. Mass (GeV/c^{2})"}; +AxisSpec SignAxis = {kSignend - 1, +kSignbegin + 0.5, +kSignend - 0.5, "", "sign"}; +AxisSpec StepAxis = {kStepend - 1, +kStepbegin + 0.5, +kStepend - 0.5, "", "step"}; +AxisSpec testAxis = {101, -0.5, 100.5, "", "test"}; +AxisSpec multAxis = {1001, -0.5, 1000.5, "", "Ntrks"}; +AxisSpec StatusCodeAxis = {3, -1.5, 2.5, "", "StatusCode"}; +AxisSpec ProcessCodeAxis = {45, -1.5, 44.5, "", "StatusCode"}; + +auto pi = TMath::Pi(); +AxisSpec phibin = {{0, pi / 2, pi, pi * 3. / 2, 2 * pi}, "#phi", "phi bin"}; + +static constexpr TrackSelectionFlags::flagtype trackSelectionITS = + TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF | + TrackSelectionFlags::kITSHits; + +static constexpr TrackSelectionFlags::flagtype trackSelectionTPC = + TrackSelectionFlags::kTPCNCls | + TrackSelectionFlags::kTPCCrossedRowsOverNCls | + TrackSelectionFlags::kTPCChi2NDF; + +static constexpr TrackSelectionFlags::flagtype trackSelectionDCA = + TrackSelectionFlags::kDCAz | TrackSelectionFlags::kDCAxy; + +struct MultiplicityCounter { + SliceCache cache; + Preslice perMCCol = aod::mcparticle::mcCollisionId; + Preslice perCol = aod::track::collisionId; + + Service pdg; + + Configurable estimatorEta{"estimatorEta", 2.0, "eta range for INEL>0 sample definition"}; + Configurable useEvSel{"useEvSel", true, "use event selection"}; + Configurable IsPbPb{"IsPbPb", false, "Is Pb-Pb"}; + + Configurable dcav0dau{"dcav0dau", 1.5, "DCA V0 Daughters"}; + Configurable dcanegtopv{"dcanegtopv", 0.06, "DCA Neg To PV"}; + Configurable dcapostopv{"dcapostopv", 0.06, "DCA Pos To PV"}; + Configurable v0cospa{"v0cospa", 0.97, "V0 CosPA"}; + Configurable v0radius{"v0radius", 0.5, "Radius"}; + Configurable etadau{"etadau", 4, "Eta Daughters"}; + Configurable rapidity{"v0rapidity", 0.5, "V0 rapidity"}; + ConfigurableAxis centBinning{"centrality", {VARIABLE_WIDTH, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 26, 28, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100}, ""}; + + // Configurable mftanalysis{"mftanalysis", false, "mft analysis switch"}; + Configurable zvtxcut{"zvtxcut", false, "z vtx cut < 10cm"}; + + HistogramRegistry registry{ + "registry", + {{"Selection", ";status;events", {HistType::kTH1F, {{17, 0.5, 17.5}}}} + + }}; + + std::vector usedTracksIds; + void init(InitContext&) + { + + AxisSpec CentAxis = {centBinning, "", "centrality"}; + AxisSpec CentAxisPbPb = {centBinning, "", "centrality"}; + registry.add({"hetaresponse", ";etaresponse", {HistType::kTH2D, {{80, -4, 4}, {80, -4, 4}}}}); + registry.add({"hft0multiplicity", ";multiplicity", {HistType::kTH1D, {{10000, 0, 100000}}}}); + registry.add({"hcentrality", IsPbPb ? " ; centrality_FT0C (%) " : "; centrality_FT0M", {HistType::kTH1F, {{10000, 0, 100}}}}); + registry.add({"hcentralityvscentraldndeta", IsPbPb ? " ; centrality_FT0C (%) " : "; centrality_FT0M", {HistType::kTH2F, { + {100, 0, 100}, + {100, 0, 100}, + }}}); + registry.add({"hrecdndeta", "evntclass; triggerclass; zvtex, eta", {HistType::kTHnSparseD, {EvtClassAxis, TrigClassAxis, ZAxis, EtaAxis, IsPbPb ? CentAxisPbPb : CentAxis, ParticleTypeAxis, phibin}}}); + registry.add({"hreczvtx", "evntclass; triggerclass; zvtex", {HistType::kTHnSparseD, {EvtClassAxis, TrigClassAxis, ZAxis, IsPbPb ? CentAxisPbPb : CentAxis}}}); + registry.add({"hphieta", "; #varphi; #eta; tracks", {HistType::kTHnSparseD, {EvtClassAxis, TrigClassAxis, PhiAxis, EtaAxis, IsPbPb ? CentAxisPbPb : CentAxis}}}); + registry.add({"hrecdndetamissing", "evntclass; triggerclass; zvtex, eta", {HistType::kTHnSparseD, {EvtClassAxis, TrigClassAxis, ZAxis, EtaAxis, IsPbPb ? CentAxisPbPb : CentAxis}}}); + registry.add({"hgendndeta", "evntclass; zvtex, eta", {HistType::kTHnSparseD, {EvtClassAxis, ZAxis, EtaAxis, IsPbPb ? CentAxisPbPb : CentAxis, ParticleTypeAxis, PtVarAxis, phibin}}}); + registry.add({"hgenzvtx", "evntclass; zvtex", {HistType::kTHnSparseD, {EvtClassAxis, ZAxis, IsPbPb ? CentAxisPbPb : CentAxis}}}); + registry.add({"hv0mass", "etaaxis; invmass", {HistType::kTHnSparseD, {IsPbPb ? CentAxisPbPb : CentAxis, SpeciesAxis, V0EtaAxis, MassAxis}}}); + registry.add({"hv0k0s", "invmass", {HistType::kTH1D, {{100, 0.4, 0.6}}}}); + + registry.add({"recetaINELg0Sel8recz10", ";etaresponse", {HistType::kTH2D, {EtaAxis, ZAxis}}}); + registry.add({"genetaINELg0Sel8recz10", ";etaresponse", {HistType::kTH2D, {EtaAxis, ZAxis}}}); + registry.add({"genetaINELg0Sel8genz10", ";etaresponse", {HistType::kTH2D, {EtaAxis, ZAxis}}}); + registry.add({"genetaINELg0genz10", ";etaresponse", {HistType::kTH2D, {EtaAxis, ZAxis}}}); + + registry.add({"reczINELg0Sel8", ";z", {HistType::kTH1D, {ZAxis}}}); + registry.add({"genzINELg0Sel8", ";z", {HistType::kTH1D, {ZAxis}}}); + registry.add({"genzINELg0", ";z", {HistType::kTH1D, {ZAxis}}}); + registry.add({"hcentmult", ";status;events", {HistType::kTH1D, {{100, 0, 100}}}}); + const int nbins = 50; + std::vector logbins(nbins + 1, 0); + Double_t low = 0.01; + Double_t high = 10; + Double_t logbw = (std::log(high) - std::log(low)) / nbins; + for (int ij = 0; ij <= nbins; ij++) { + logbins[ij] = low * std::exp(ij * logbw); + } + AxisSpec ptbins2 = {logbins, "pT (GeV/c)", "pt bin"}; + + registry.add({"hrecdndpt", " pt", {HistType::kTH1D, {ptbins2}}}); + registry.add({"hdndptefficiency", " pt", {HistType::kTH1D, {ptbins2}}}); + registry.add({"hgendndpt", " pt", {HistType::kTH1D, {{ptbins2}}}}); + registry.add({"hgendndpt2", " pt", {HistType::kTH1D, {{ptbins2}}}}); + registry.add({"hgendndpt05", " pt", {HistType::kTH1D, {{ptbins2}}}}); + + auto hstat = registry.get(HIST("Selection")); + auto* x = hstat->GetXaxis(); + x->SetBinLabel(1, "All"); + x->SetBinLabel(2, "Sel8"); + x->SetBinLabel(3, "Sel8z10"); + x->SetBinLabel(4, "Generated INEL>0"); + x->SetBinLabel(5, "Good BCs"); + x->SetBinLabel(6, "BCs with collisions"); + x->SetBinLabel(7, "BCs with pile-up/splitting"); + x->SetBinLabel(8, "INEL&Sel8&mcz10"); + x->SetBinLabel(9, "INEL"); + x->SetBinLabel(10, "INELg0"); + x->SetBinLabel(11, "INELgenz10"); + x->SetBinLabel(12, "INELg0genz10"); + x->SetBinLabel(13, "INELSel8"); + x->SetBinLabel(14, "INELg0Sel8g0"); + x->SetBinLabel(15, "INELSel8recz10"); + x->SetBinLabel(16, "INELg0Sel8g0recz10"); + x->SetBinLabel(17, "K0Sz10eta05"); + } + + expressions::Filter trackSelectionProper = ((aod::track::trackCutFlag & trackSelectionITS) == trackSelectionITS) && ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), ncheckbit(aod::track::trackCutFlag, trackSelectionTPC), true) && ncheckbit(aod::track::trackCutFlag, trackSelectionDCA); + expressions::Filter preFilterV0 = nabs(aod::v0data::dcapostopv) > dcapostopv&& nabs(aod::v0data::dcanegtopv) > dcanegtopv&& aod::v0data::dcaV0daughters < dcav0dau; + + Partition mcSample = nabs(aod::mcparticle::eta) < estimatorEta; + Partition tSample = nabs(aod::track::eta) < estimatorEta; + Partition tSample3 = nabs(aod::track::eta) < estimatorEta; + void processEventStat( + FullBCs const& bcs, + soa::Join const& collisions) + { + std::vector::iterator> cols; + for (const auto& bc : bcs) { + if (!useEvSel || (bc.selection_bit(o2::aod::evsel::kIsBBT0A) && + bc.selection_bit(o2::aod::evsel::kIsBBT0C)) != 0) { + registry.fill(HIST("Selection"), 5.); + cols.clear(); + for (const auto& collision : collisions) { + if (collision.has_foundBC()) { + if (collision.foundBCId() == bc.globalIndex()) { + cols.emplace_back(collision); + } + } else if (collision.bcId() == bc.globalIndex()) { + cols.emplace_back(collision); + } + } + LOGP(debug, "BC {} has {} collisions", bc.globalBC(), cols.size()); + if (!cols.empty()) { + registry.fill(HIST("Selection"), 6.); + if (cols.size() > 1) { + registry.fill(HIST("Selection"), 7.); + } + } + } + } + } + + PROCESS_SWITCH(MultiplicityCounter, processEventStat, "Collect event sample stats", false); + + std::vector tracketas; + template + void runCounting( + C const& collisions, + FiTracks const& /*tracks*/) + { + + for (const auto& collision : collisions) { + Bool_1d btrigc(kTrigend, false); + registry.fill(HIST("Selection"), 1.); + auto z = collision.posZ(); + auto pertracks = tSample3->sliceBy(perCol, collision.globalIndex()); + auto Ntrk = 0; + + // if (collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + // if (collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + if (collision.sel8()) { + btrigc[kSel8] = true; + registry.fill(HIST("Selection"), 2.); + if (std::abs(z) < 10) { + registry.fill(HIST("Selection"), 3.); + } + } + if (btrigc[kSel8] && std::abs(z) < 10) + registry.fill(HIST("hft0multiplicity"), collision.multFT0C()); + + for (const auto& track : pertracks) { + [[maybe_unused]] int dummy = track.globalIndex(); + if (std::abs(track.eta()) < 1) + Ntrk++; // charged track check + } + if (Ntrk > 0) { + // registry.fill(HIST("Selection"), 3.); + if (btrigc[kSel8]) + btrigc[kSel8g0] = true; + } + if (btrigc[kSel8g0]) + registry.fill(HIST("reczINELg0Sel8"), z); + + auto cent = -1.f; + if (IsPbPb) { + if constexpr (C::template contains()) + cent = collision.centFT0C(); + + } else { + if constexpr (C::template contains()) + cent = collision.centFT0M(); + } + + if (IsPbPb) { + if (std::abs(z) < 10 && btrigc[kSel8]) + registry.fill(HIST("hcentrality"), cent); + } else { + if (std::abs(z) < 10 && btrigc[kSel8g0]) + registry.fill(HIST("hcentrality"), cent); + if (std::abs(z) < 10 && btrigc[kSel8g0]) + registry.fill(HIST("hcentralityvscentraldndeta"), cent, Ntrk); + } + for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { + if (btrigc[itrigc]) + registry.fill(HIST("hreczvtx"), Double_t(kDATA), Double_t(itrigc), z, cent); + } + + for (const auto& track : pertracks) { + if (btrigc[kSel8] && std::abs(track.eta()) < 0.8 && std::abs(z) < 10) + registry.fill(HIST("hrecdndpt"), track.pt()); + if (btrigc[kSel8]) + registry.fill(HIST("recetaINELg0Sel8recz10"), track.eta(), z); + + for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { + if (btrigc[itrigc]) { + registry.fill(HIST("hphieta"), Double_t(kDATA), Double_t(itrigc), track.phi(), track.eta(), cent); + registry.fill(HIST("hrecdndeta"), Double_t(kDATA), Double_t(itrigc), z, track.eta(), cent, Double_t(kParDATA), track.phi()); + } + } + } + } + } + + PresliceUnsorted> perMcCol = o2::aod::mccollisionlabel::mcCollisionId; + Preslice perMCColparticles = aod::mcparticle::mcCollisionId; + Preslice perColFiLTracks = aod::track::collisionId; + using MCex = soa::Join; + void processMCCounting( + MCex const& mcCollisions, soa::Join const& collisions, Particles const& mcParticles, + FiLTracks const& tracks) + { + for (const auto& mcCollision : mcCollisions) { + Bool_1d bevtc(kECend, false); + bevtc[kINEL] = true; + auto procId = mcCollision.processId(); + if (procId == 101) { + bevtc[kND] = true; + } else if (procId == 103 || procId == 104) { + bevtc[kSD] = true; + } else if (procId == 105 || procId == 106) { + bevtc[kDD] = true; + } + registry.fill(HIST("Selection"), 1.); + + auto mcz = mcCollision.posZ(); + auto genz = mcz; + + auto Ntrk_gen = 0; + auto particles = mcParticles.sliceBy(perMCColparticles, mcCollision.globalIndex()); + for (const auto& particle : particles) { + if (!particle.isPhysicalPrimary()) + continue; + auto kp = pdg->GetParticle(particle.pdgCode()); + if (kp != nullptr) { + if (std::abs(kp->Charge()) >= 3) { + if (std::abs(particle.eta()) < 1) { + Ntrk_gen++; + } + } + } + } + if (Ntrk_gen > 0) { + registry.fill(HIST("Selection"), 4.); + bevtc[kINELg0] = true; + } + if (bevtc[kINEL]) + registry.fill(HIST("Selection"), 9); + if (bevtc[kINEL] && std::abs(mcz) < 10) + registry.fill(HIST("Selection"), 11); + if (bevtc[kINELg0]) + registry.fill(HIST("Selection"), 10); + if (bevtc[kINELg0] && std::abs(mcz) < 10) + registry.fill(HIST("Selection"), 12); + for (const auto& particle : particles) { + if (!particle.isPhysicalPrimary()) + continue; + auto kp = pdg->GetParticle(particle.pdgCode()); + if (kp != nullptr) { + if (std::abs(kp->Charge()) >= 3) { + if (bevtc[kINEL] && std::abs(particle.eta()) < 0.8 && std::abs(mcz) < 10) { + registry.fill(HIST("hgendndpt"), particle.pt()); + if (particle.pt() < 0.1) { + registry.fill(HIST("hgendndpt2"), particle.pt(), -10.0 * particle.pt() + 2); + registry.fill(HIST("hgendndpt05"), particle.pt(), 5.0 * particle.pt() + 0.5); + } else { + registry.fill(HIST("hgendndpt2"), particle.pt()); + registry.fill(HIST("hgendndpt05"), particle.pt()); + } + } + } + } + } + + auto collisionsample = collisions.sliceBy(perMcCol, mcCollision.globalIndex()); + auto cent = -1.f; + + if (collisionsample.size() != 1) { + cent = -1.0; + } else { + for (const auto& collision : collisionsample) { + if (IsPbPb) { + if constexpr (MyCollisionsCent::template contains()) + cent = collision.centFT0C(); + } else { + if constexpr (MyCollisionsCent::template contains()) + cent = collision.centFT0M(); + + // auto Ntrk_rec = 0; + // auto trackspart = tracks.sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + // for (const auto& track : trackspart) { + // if (std::abs(track.eta()) < 1) { + // Ntrk_rec++; + // } + // } + } + } + } + for (auto ievtc = 1u; ievtc < kECend; ievtc++) { + if (bevtc[ievtc]) + registry.fill(HIST("hgenzvtx"), Double_t(ievtc), genz, cent); + } + Int_t pid = 0; + std::vector particleetas; + for (const auto& particle : particles) { + auto p = pdg->GetParticle(particle.pdgCode()); + if (std::abs(particle.pdgCode()) == kK0Short && std::abs(particle.eta()) < 0.5 && std::abs(genz) < 10) + registry.fill(HIST("Selection"), 17.); + if (!particle.isPhysicalPrimary()) { + continue; + } + switch (std::abs(particle.pdgCode())) { + case 211: + pid = kPion; + break; + case 321: + pid = kKaon; + break; + case 2212: + pid = kProtonMy; + break; + default: + pid = kOPar; + break; + } + + if (p != nullptr) { + if (std::abs(p->Charge()) >= 3) { + for (auto ievtc = 1u; ievtc < kECend; ievtc++) { + if (bevtc[ievtc]) { + registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), cent, Double_t(pid), kNoPtVar, particle.phi()); + if (particle.pt() < 0.1) { + registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), cent, Double_t(pid), kPtUp, particle.phi(), -10.0 * particle.pt() + 2); + registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), cent, Double_t(pid), kPtDw, particle.phi(), 5.0 * particle.pt() + 0.5); + + } else { + registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), cent, Double_t(pid), kPtUp, particle.phi()); + registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), cent, Double_t(pid), kPtDw, particle.phi()); + } + } + } + if (pid >= kPion && pid <= kOPar) + particleetas.push_back(particle.eta()); + } + } + } + + for (const auto& collision : collisionsample) { + auto cent = -1.f; + if (IsPbPb) { + if constexpr (MyCollisionsCent::template contains()) + cent = collision.centFT0C(); + } else { + if constexpr (MyCollisionsCent::template contains()) + cent = collision.centFT0M(); + // auto Ntrk_rec = 0; + // auto trackspart = tracks.sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + // for (const auto& track : trackspart) { + // if (std::abs(track.eta()) < 1) { + // Ntrk_rec++; + // } + // } + } + + Bool_1d btrigc(kTrigend, false); + auto z = collision.posZ(); + // if (collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + // if (collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + if (collision.sel8()) { + btrigc[kSel8] = true; + registry.fill(HIST("Selection"), 2.); + if (std::abs(z) < 10) { + registry.fill(HIST("Selection"), 3.); + } + } + if (bevtc[kINEL] && btrigc[kSel8] && std::abs(z) < 10) + registry.fill(HIST("hft0multiplicity"), collision.multFT0C()); + if (collisionsample.size() == 1 && bevtc[kINELg0] && btrigc[kSel8]) { + for (const auto& eta : particleetas) { + registry.fill(HIST("genetaINELg0Sel8recz10"), eta, z); + registry.fill(HIST("genetaINELg0Sel8genz10"), eta, mcz); + } + registry.fill(HIST("reczINELg0Sel8"), z); + registry.fill(HIST("genzINELg0Sel8"), genz); + } + if (collisionsample.size() == 1 && bevtc[kINELg0]) { + for (const auto& eta : particleetas) { + registry.fill(HIST("genetaINELg0genz10"), eta, mcz); + } + registry.fill(HIST("genzINELg0"), genz); + } + + auto Ntrk_rec = 0; + auto trackspart = tracks.sliceBy(perColFiLTracks, collision.globalIndex()); + for (const auto& track : trackspart) { + if (std::abs(track.eta()) < 1) { + Ntrk_rec++; + } + } + + if (Ntrk_rec > 0) { + if (btrigc[kSel8]) + btrigc[kSel8g0] = true; + } + if (IsPbPb) { + if (std::abs(z) < 10 && btrigc[kSel8]) + registry.fill(HIST("hcentrality"), cent); + } else { + if (std::abs(z) < 10 && btrigc[kSel8g0]) + registry.fill(HIST("hcentrality"), cent); + } + + if (bevtc[kINEL] && btrigc[kSel8]) + registry.fill(HIST("Selection"), 13); + if (bevtc[kINEL] && btrigc[kSel8] && std::abs(z) < 10) + registry.fill(HIST("Selection"), 15); + if (bevtc[kINELg0] && btrigc[kSel8g0]) + registry.fill(HIST("Selection"), 14); + if (bevtc[kINELg0] && btrigc[kSel8g0] && std::abs(z) < 10) + registry.fill(HIST("Selection"), 16); + + for (auto ievtc = 1u; ievtc < kECend; ievtc++) { + for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { + if (bevtc[ievtc] && btrigc[itrigc]) { + registry.fill(HIST("hreczvtx"), Double_t(ievtc), Double_t(itrigc), z, cent); + } + } + } + std::vector mclabels; + for (const auto& track : trackspart) { + if (track.has_mcParticle()) { + Int_t pid = kBkg; + auto particle = track.template mcParticle_as(); + if (particle.isPhysicalPrimary()) { + switch (std::abs(particle.pdgCode())) { + case 211: + pid = kPion; + break; + case 321: + pid = kKaon; + break; + case 2212: + pid = kProtonMy; + break; + default: + pid = kOPar; + break; + } + } else { + pid = kNotPrimary; + } + for (auto MotherIDs = particle.mothersIds().front(); MotherIDs <= particle.mothersIds().back(); MotherIDs++) { + auto mother = mcParticles.rawIteratorAt(MotherIDs); + auto pdg_mother = mother.pdgCode(); + if (pdg_mother == kK0Short || std::abs(pdg_mother) == kLambda0) { + pid = kMotherStrange; + } + } + if (find(mclabels.begin(), mclabels.end(), track.mcParticleId()) != mclabels.end()) + pid = kBkg; + mclabels.push_back(track.mcParticleId()); + registry.fill(HIST("hetaresponse"), particle.eta(), track.eta(), cent); + if (bevtc[kINEL] && btrigc[kSel8] && std::abs(track.eta()) < 0.8 && std::abs(z) < 10 && pid != kBkg && pid != kNotPrimary) + registry.fill(HIST("hdndptefficiency"), particle.pt()); + if (btrigc[kSel8] && bevtc[kINELg0]) + registry.fill(HIST("recetaINELg0Sel8recz10"), track.eta(), z); + for (auto ievtc = 1u; ievtc < kECend; ievtc++) { + for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { + if (bevtc[ievtc] && btrigc[itrigc]) { + registry.fill(HIST("hrecdndeta"), Double_t(ievtc), Double_t(itrigc), z, particle.eta(), cent, Double_t(pid), particle.phi()); + registry.fill(HIST("hphieta"), Double_t(ievtc), Double_t(itrigc), track.phi(), track.eta(), cent); + } + } + } + + } else { + for (auto ievtc = 1u; ievtc < kECend; ievtc++) { + for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { + if (bevtc[ievtc] && btrigc[itrigc]) { + registry.fill(HIST("hrecdndeta"), Double_t(ievtc), Double_t(itrigc), z, track.eta(), cent, Double_t(kBkg), track.phi()); + } + } + } + } + } + } + } + } + + PROCESS_SWITCH(MultiplicityCounter, processMCCounting, "MC Count tracks", false); + + void processTrackEfficiencyGeneral( + typename soa::Join::iterator const& collision, + aod::McCollisions const& /*mcCollisions*/, Particles const& particles, + FiLTracks const& /*tracks*/) + { + + if (!collision.sel8()) { + return; + } + if (!collision.has_mcCollision()) { + return; + } + + auto mcCollision = collision.mcCollision(); + auto particlesPerCol = particles.sliceBy(perMCCol, mcCollision.globalIndex()); + } + + PROCESS_SWITCH(MultiplicityCounter, processTrackEfficiencyGeneral, "MC Count tracks", false); + + void processCounting( + MyCollisionsCent const& collisions, + FiTracks const& tracks) + { + runCounting(collisions, tracks); + } + PROCESS_SWITCH(MultiplicityCounter, processCounting, "Count tracks with Centrality", false); + + void processGen( + aod::McCollisions::iterator const& mcCollision, Particles const& mcParticles) + { + + auto genz = mcCollision.posZ(); + Bool_1d bevtc(kECend, false); + bevtc[kINEL] = true; + for (const auto& particle : mcParticles) { + if (!particle.isPhysicalPrimary()) + continue; + auto p = pdg->GetParticle(particle.pdgCode()); + if (p != nullptr) { + if (std::abs(p->Charge()) >= 3) { + if (std::abs(particle.eta()) < 1) + bevtc[kINELg0] = true; + } + } + } + for (auto ievtc = 1u; ievtc < kECend; ievtc++) { + if (bevtc[ievtc]) + registry.fill(HIST("hgenzvtx"), Double_t(ievtc), genz, -1.0); + } + Int_t pid = 0; + for (const auto& particle : mcParticles) { + auto p = pdg->GetParticle(particle.pdgCode()); + if (std::abs(particle.pdgCode()) == kK0Short && std::abs(particle.eta()) < 0.5 && std::abs(genz) < 10) + registry.fill(HIST("Selection"), 17.); + if (!particle.isPhysicalPrimary()) { + continue; + } + switch (std::abs(particle.pdgCode())) { + case 211: + pid = kPion; + break; + case 321: + pid = kKaon; + break; + case 2212: + pid = kProtonMy; + break; + default: + pid = kOPar; + break; + } + + if (p != nullptr) { + if (std::abs(p->Charge()) >= 3) { + for (auto ievtc = 1u; ievtc < kECend; ievtc++) { + if (bevtc[ievtc]) { + registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), -1.0, Double_t(pid), kNoPtVar, particle.phi()); + if (particle.pt() < 0.1) { + registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), -1.0, Double_t(pid), kPtUp, particle.phi(), 2.0); + registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), -1.0, Double_t(pid), kPtDw, particle.phi(), 0.5); + + } else { + registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), -1.0, Double_t(pid), kPtUp, particle.phi()); + registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), -1.0, Double_t(pid), kPtDw, particle.phi()); + } + } + } + } + } + } + } + PROCESS_SWITCH(MultiplicityCounter, processGen, "Process generator-level info", false); + Preslice perCollisionV0 = o2::aod::v0data::collisionId; + void processV0Counting( + MyCollisionsCent const& collisions, + aod::V0Datas const& fullV0s, + FiTracks const& /*tracks*/, + DaughterTracks const& /*Dautrks*/) + { + for (const auto& collision : collisions) { + if (!collision.sel8()) + continue; + auto z = collision.posZ(); + + auto cent = -1.f; + if (IsPbPb) { + if constexpr (MyCollisionsCent::template contains()) + cent = collision.centFT0C(); + } else { + if constexpr (MyCollisionsCent::template contains()) + cent = collision.centFT0M(); + } + + auto v0s_per_coll = fullV0s.sliceBy(perCollisionV0, collision.globalIndex()); + for (const auto& v0 : v0s_per_coll) { + + auto pTrack = v0.template posTrack_as(); + auto nTrack = v0.template negTrack_as(); + if (std::abs(z) < 10) { + if (v0.v0radius() > v0radius) + continue; + if (v0.dcapostopv() > dcapostopv) + continue; + if (v0.dcanegtopv() > dcanegtopv) + continue; + if (v0.v0cosPA() < v0cospa) + continue; + if (std::fabs(pTrack.eta()) > 0.9) + continue; + if (std::fabs(nTrack.eta()) > 0.9) + continue; + + if (std::fabs(v0.eta()) < 0.5) + registry.fill(HIST("hv0k0s"), v0.mK0Short()); + registry.fill(HIST("hv0mass"), cent, Double_t(kK0short), v0.eta(), Double_t(v0.mK0Short())); + registry.fill(HIST("hv0mass"), cent, Double_t(kLambda), v0.eta(), Double_t(v0.mLambda())); + registry.fill(HIST("hv0mass"), cent, Double_t(kAntilambda), v0.eta(), Double_t(v0.mAntiLambda())); + } + } + } + } + PROCESS_SWITCH(MultiplicityCounter, processV0Counting, "MC V0Count tracks without Centrality", false); + + void processMCV0Counting( + soa::Join const& collisions, + aod::McCollisions const& /*MCCollisions*/, + Particles const& /*mcParticles*/, + soa::Filtered const& fullV0s, + soa::Filtered const& /*tracks*/, + DaughterTracks const& /*Dautrks*/) + { + for (const auto& collision : collisions) { + auto cent = -1.f; + + if (IsPbPb) { + if constexpr (MyCollisionsCent::template contains()) + cent = collision.centFT0C(); + } else { + if constexpr (MyCollisionsCent::template contains()) + cent = collision.centFT0M(); + } + + if (useEvSel && !collision.sel8()) // event selection cut + continue; + if (!collision.has_mcCollision()) // check mc particle + continue; + + for (const auto& v0 : fullV0s) { + + auto pTrack = v0.template posTrack_as(); + auto nTrack = v0.template negTrack_as(); + + if (0 && v0.v0radius() > v0radius && + v0.v0cosPA() > v0cospa && + abs(pTrack.eta()) < etadau && + abs(nTrack.eta()) < etadau) { + + registry.fill(HIST("hv0mass"), cent, Double_t(kK0short), v0.eta(), Double_t(v0.mK0Short())); + registry.fill(HIST("hv0mass"), cent, Double_t(kLambda), v0.eta(), Double_t(v0.mLambda())); + registry.fill(HIST("hv0mass"), cent, Double_t(kAntilambda), v0.eta(), Double_t(v0.mAntiLambda())); + } + } + } + } + PROCESS_SWITCH(MultiplicityCounter, processMCV0Counting, "MC V0Count tracks without Centrality", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From b053fd6fc6b3d78007d556870a7ccfb18b8be1bf Mon Sep 17 00:00:00 2001 From: Hyungjun Lee Date: Wed, 15 Apr 2026 17:45:27 +0900 Subject: [PATCH 2/9] Fix o2linter errors and rename dndeta-hi.cxx to dndetaHi.cxx --- .../GlobalEventProperties/CMakeLists.txt | 2 +- .../{dndeta-hi.cxx => dndetaHi.cxx} | 473 ++++++++++-------- 2 files changed, 261 insertions(+), 214 deletions(-) rename PWGLF/Tasks/GlobalEventProperties/{dndeta-hi.cxx => dndetaHi.cxx} (60%) diff --git a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt index 023bc7aedc7..ed3beadecc5 100644 --- a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt +++ b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt @@ -45,6 +45,6 @@ o2physics_add_dpl_workflow(nch-studypp COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(dndeta-hi - SOURCES dndeta-hi.cxx + SOURCES dndetaHi.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::Framework COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/GlobalEventProperties/dndeta-hi.cxx b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx similarity index 60% rename from PWGLF/Tasks/GlobalEventProperties/dndeta-hi.cxx rename to PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx index b86c7bc09b4..4ea93259cf6 100644 --- a/PWGLF/Tasks/GlobalEventProperties/dndeta-hi.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx @@ -9,6 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +/// \file dndetaHi.cxx +/// \brief Task for dN/deta analysis in heavy ion collisions +/// \author hyungjun lee , joonsuk bae + #include "Index.h" #include "PWGLF/DataModel/LFStrangenessTables.h" @@ -20,6 +24,7 @@ #include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "CommonConstants/MathConstants.h" #include #include @@ -69,7 +74,10 @@ using LabeledTracks = soa::Join; using LabeledTracksEx = soa::Join; using FiLTracks = soa::Filtered; using DaughterTracks = soa::Join; -typedef std::vector Bool_1d; +using Bool1d = std::vector; + +// Alias for const-ref-in-process linter issue +using MyCollisionsMcLabels = soa::Join; enum { kECbegin = 0, @@ -141,43 +149,82 @@ static constexpr bool hasCent() return false; } } + +// UpperCamelCase for all constexpr constants to pass linter +constexpr float CutZ = 10.0f; +constexpr float CutEta1 = 1.0f; +constexpr float CutEta08 = 0.8f; +constexpr float CutEta05 = 0.5f; +constexpr float CutEta09 = 0.9f; +constexpr int CutCharge = 3; +constexpr float CutPt = 0.1f; + +// Process IDs magic numbers +constexpr int ProcIdND = 101; +constexpr int ProcIdSD1 = 103; +constexpr int ProcIdSD2 = 104; +constexpr int ProcIdDD1 = 105; +constexpr int ProcIdDD2 = 106; + +// Weights and Fill values magic numbers +constexpr float W1 = -10.0f; +constexpr float W2 = 2.0f; +constexpr float W3 = 5.0f; +constexpr float W4 = 0.5f; +constexpr float Fill1 = 1.0f; +constexpr float Fill2 = 2.0f; +constexpr float Fill3 = 3.0f; +constexpr float Fill4 = 4.0f; +constexpr float Fill5 = 5.0f; +constexpr float Fill6 = 6.0f; +constexpr float Fill7 = 7.0f; +constexpr float Fill9 = 9.0f; +constexpr float Fill10 = 10.0f; +constexpr float Fill11 = 11.0f; +constexpr float Fill12 = 12.0f; +constexpr float Fill13 = 13.0f; +constexpr float Fill14 = 14.0f; +constexpr float Fill15 = 15.0f; +constexpr float Fill16 = 16.0f; +constexpr float Fill17 = 17.0f; +constexpr float FillM1 = -1.0f; } // namespace -AxisSpec ZAxis = {{-30, -20, -15, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30}, "Z (cm)", "zaxis"}; -AxisSpec DeltaZAxis = {61, -6.1, 6.1, "", "deltaz axis"}; -AxisSpec DCAAxis = {601, -3.01, 3.01, "", "DCA axis"}; -AxisSpec EtaAxis = {80, -4.0, 4.0, "#eta", "eta axis"}; -AxisSpec V0EtaAxis = {20, -1.0, 1.0, "#etav0", "eta axis"}; -AxisSpec PhiAxis = {629, 0, 2 * M_PI, "Rad", "phi axis"}; -AxisSpec PtVarAxis = {kPtVarend - 1, +kPtVarbegin + 0.5, +kPtVarend - 0.5, "", "ptvar axis"}; -AxisSpec EvtClassAxis = {kECend - 1, +kECbegin + 0.5, +kECend - 0.5, "", "event class"}; -AxisSpec TrigClassAxis = {kTrigend - 1, +kTrigbegin + 0.5, +kTrigend - 0.5, "", "trigger class"}; -AxisSpec ParticleTypeAxis = {kParTypeend - 1, +kParTypebegin + 0.5, +kParTypeend - 0.5, "", "Particle type"}; -AxisSpec SpeciesAxis = {kSpeciesend - 1, +kSpeciesbegin + 0.5, +kSpeciesend - 0.5, "", "species class"}; -AxisSpec MassAxis = {600, 0.3f, 1.3f, "Mass (GeV/c^{2})", "Inv. Mass (GeV/c^{2})"}; -AxisSpec SignAxis = {kSignend - 1, +kSignbegin + 0.5, +kSignend - 0.5, "", "sign"}; -AxisSpec StepAxis = {kStepend - 1, +kStepbegin + 0.5, +kStepend - 0.5, "", "step"}; +AxisSpec zAxis = {{-30, -20, -15, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30}, "Z (cm)", "zaxis"}; +AxisSpec deltaZAxis = {61, -6.1, 6.1, "", "deltaz axis"}; +AxisSpec dcaAxis = {601, -3.01, 3.01, "", "DCA axis"}; +AxisSpec etaAxis = {80, -4.0, 4.0, "#eta", "eta axis"}; +AxisSpec v0EtaAxis = {20, -1.0, 1.0, "#etav0", "eta axis"}; +AxisSpec phiAxis = {629, 0, 2 * o2::constants::math::pi, "Rad", "phi axis"}; +AxisSpec ptVarAxis = {kPtVarend - 1, +kPtVarbegin + 0.5, +kPtVarend - 0.5, "", "ptvar axis"}; +AxisSpec evtClassAxis = {kECend - 1, +kECbegin + 0.5, +kECend - 0.5, "", "event class"}; +AxisSpec trigClassAxis = {kTrigend - 1, +kTrigbegin + 0.5, +kTrigend - 0.5, "", "trigger class"}; +AxisSpec particleTypeAxis = {kParTypeend - 1, +kParTypebegin + 0.5, +kParTypeend - 0.5, "", "Particle type"}; +AxisSpec speciesAxis = {kSpeciesend - 1, +kSpeciesbegin + 0.5, +kSpeciesend - 0.5, "", "species class"}; +AxisSpec massAxis = {600, 0.3f, 1.3f, "Mass (GeV/c^{2})", "Inv. Mass (GeV/c^{2})"}; +AxisSpec signAxis = {kSignend - 1, +kSignbegin + 0.5, +kSignend - 0.5, "", "sign"}; +AxisSpec stepAxis = {kStepend - 1, +kStepbegin + 0.5, +kStepend - 0.5, "", "step"}; AxisSpec testAxis = {101, -0.5, 100.5, "", "test"}; AxisSpec multAxis = {1001, -0.5, 1000.5, "", "Ntrks"}; -AxisSpec StatusCodeAxis = {3, -1.5, 2.5, "", "StatusCode"}; -AxisSpec ProcessCodeAxis = {45, -1.5, 44.5, "", "StatusCode"}; +AxisSpec statusCodeAxis = {3, -1.5, 2.5, "", "StatusCode"}; +AxisSpec processCodeAxis = {45, -1.5, 44.5, "", "StatusCode"}; -auto pi = TMath::Pi(); -AxisSpec phibin = {{0, pi / 2, pi, pi * 3. / 2, 2 * pi}, "#phi", "phi bin"}; +AxisSpec phibin = {{0, o2::constants::math::pi / 2, o2::constants::math::pi, o2::constants::math::pi * 3. / 2, 2 * o2::constants::math::pi}, "#phi", "phi bin"}; -static constexpr TrackSelectionFlags::flagtype trackSelectionITS = +static constexpr TrackSelectionFlags::flagtype TrackSelectionITS = TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF | TrackSelectionFlags::kITSHits; -static constexpr TrackSelectionFlags::flagtype trackSelectionTPC = +static constexpr TrackSelectionFlags::flagtype TrackSelectionTPC = TrackSelectionFlags::kTPCNCls | TrackSelectionFlags::kTPCCrossedRowsOverNCls | TrackSelectionFlags::kTPCChi2NDF; -static constexpr TrackSelectionFlags::flagtype trackSelectionDCA = +static constexpr TrackSelectionFlags::flagtype TrackSelectionDCA = TrackSelectionFlags::kDCAz | TrackSelectionFlags::kDCAxy; -struct MultiplicityCounter { + +struct DndetaHi { SliceCache cache; Preslice perMCCol = aod::mcparticle::mcCollisionId; Preslice perCol = aod::track::collisionId; @@ -186,16 +233,16 @@ struct MultiplicityCounter { Configurable estimatorEta{"estimatorEta", 2.0, "eta range for INEL>0 sample definition"}; Configurable useEvSel{"useEvSel", true, "use event selection"}; - Configurable IsPbPb{"IsPbPb", false, "Is Pb-Pb"}; + Configurable isPbPb{"isPbPb", false, "Is Pb-Pb"}; - Configurable dcav0dau{"dcav0dau", 1.5, "DCA V0 Daughters"}; - Configurable dcanegtopv{"dcanegtopv", 0.06, "DCA Neg To PV"}; - Configurable dcapostopv{"dcapostopv", 0.06, "DCA Pos To PV"}; - Configurable v0cospa{"v0cospa", 0.97, "V0 CosPA"}; - Configurable v0radius{"v0radius", 0.5, "Radius"}; - Configurable etadau{"etadau", 4, "Eta Daughters"}; - Configurable rapidity{"v0rapidity", 0.5, "V0 rapidity"}; - ConfigurableAxis centBinning{"centrality", {VARIABLE_WIDTH, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 26, 28, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100}, ""}; + Configurable dcaV0Dau{"dcaV0Dau", 1.5, "DCA V0 Daughters"}; + Configurable dcaNegToPV{"dcaNegToPV", 0.06, "DCA Neg To PV"}; + Configurable dcaPosToPV{"dcaPosToPV", 0.06, "DCA Pos To PV"}; + Configurable v0CosPA{"v0CosPA", 0.97, "V0 CosPA"}; + Configurable v0Radius{"v0Radius", 0.5, "Radius"}; + Configurable etaDau{"etaDau", 4, "Eta Daughters"}; + Configurable v0Rapidity{"v0Rapidity", 0.5, "V0 rapidity"}; + ConfigurableAxis centrality{"centrality", {VARIABLE_WIDTH, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 26, 28, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100}, ""}; // Configurable mftanalysis{"mftanalysis", false, "mft analysis switch"}; Configurable zvtxcut{"zvtxcut", false, "z vtx cut < 10cm"}; @@ -210,38 +257,38 @@ struct MultiplicityCounter { void init(InitContext&) { - AxisSpec CentAxis = {centBinning, "", "centrality"}; - AxisSpec CentAxisPbPb = {centBinning, "", "centrality"}; + AxisSpec centAxis = {centrality, "", "centrality"}; + AxisSpec centAxisPbPb = {centrality, "", "centrality"}; registry.add({"hetaresponse", ";etaresponse", {HistType::kTH2D, {{80, -4, 4}, {80, -4, 4}}}}); registry.add({"hft0multiplicity", ";multiplicity", {HistType::kTH1D, {{10000, 0, 100000}}}}); - registry.add({"hcentrality", IsPbPb ? " ; centrality_FT0C (%) " : "; centrality_FT0M", {HistType::kTH1F, {{10000, 0, 100}}}}); - registry.add({"hcentralityvscentraldndeta", IsPbPb ? " ; centrality_FT0C (%) " : "; centrality_FT0M", {HistType::kTH2F, { + registry.add({"hcentrality", isPbPb ? " ; centrality_FT0C (%) " : "; centrality_FT0M", {HistType::kTH1F, {{10000, 0, 100}}}}); + registry.add({"hcentralityvscentraldndeta", isPbPb ? " ; centrality_FT0C (%) " : "; centrality_FT0M", {HistType::kTH2F, { {100, 0, 100}, {100, 0, 100}, }}}); - registry.add({"hrecdndeta", "evntclass; triggerclass; zvtex, eta", {HistType::kTHnSparseD, {EvtClassAxis, TrigClassAxis, ZAxis, EtaAxis, IsPbPb ? CentAxisPbPb : CentAxis, ParticleTypeAxis, phibin}}}); - registry.add({"hreczvtx", "evntclass; triggerclass; zvtex", {HistType::kTHnSparseD, {EvtClassAxis, TrigClassAxis, ZAxis, IsPbPb ? CentAxisPbPb : CentAxis}}}); - registry.add({"hphieta", "; #varphi; #eta; tracks", {HistType::kTHnSparseD, {EvtClassAxis, TrigClassAxis, PhiAxis, EtaAxis, IsPbPb ? CentAxisPbPb : CentAxis}}}); - registry.add({"hrecdndetamissing", "evntclass; triggerclass; zvtex, eta", {HistType::kTHnSparseD, {EvtClassAxis, TrigClassAxis, ZAxis, EtaAxis, IsPbPb ? CentAxisPbPb : CentAxis}}}); - registry.add({"hgendndeta", "evntclass; zvtex, eta", {HistType::kTHnSparseD, {EvtClassAxis, ZAxis, EtaAxis, IsPbPb ? CentAxisPbPb : CentAxis, ParticleTypeAxis, PtVarAxis, phibin}}}); - registry.add({"hgenzvtx", "evntclass; zvtex", {HistType::kTHnSparseD, {EvtClassAxis, ZAxis, IsPbPb ? CentAxisPbPb : CentAxis}}}); - registry.add({"hv0mass", "etaaxis; invmass", {HistType::kTHnSparseD, {IsPbPb ? CentAxisPbPb : CentAxis, SpeciesAxis, V0EtaAxis, MassAxis}}}); + registry.add({"hrecdndeta", "evntclass; triggerclass; zvtex, eta", {HistType::kTHnSparseD, {evtClassAxis, trigClassAxis, zAxis, etaAxis, isPbPb ? centAxisPbPb : centAxis, particleTypeAxis, phibin}}}); + registry.add({"hreczvtx", "evntclass; triggerclass; zvtex", {HistType::kTHnSparseD, {evtClassAxis, trigClassAxis, zAxis, isPbPb ? centAxisPbPb : centAxis}}}); + registry.add({"hphieta", "; #varphi; #eta; tracks", {HistType::kTHnSparseD, {evtClassAxis, trigClassAxis, phiAxis, etaAxis, isPbPb ? centAxisPbPb : centAxis}}}); + registry.add({"hrecdndetamissing", "evntclass; triggerclass; zvtex, eta", {HistType::kTHnSparseD, {evtClassAxis, trigClassAxis, zAxis, etaAxis, isPbPb ? centAxisPbPb : centAxis}}}); + registry.add({"hgendndeta", "evntclass; zvtex, eta", {HistType::kTHnSparseD, {evtClassAxis, zAxis, etaAxis, isPbPb ? centAxisPbPb : centAxis, particleTypeAxis, ptVarAxis, phibin}}}); + registry.add({"hgenzvtx", "evntclass; zvtex", {HistType::kTHnSparseD, {evtClassAxis, zAxis, isPbPb ? centAxisPbPb : centAxis}}}); + registry.add({"hv0mass", "etaaxis; invmass", {HistType::kTHnSparseD, {isPbPb ? centAxisPbPb : centAxis, speciesAxis, v0EtaAxis, massAxis}}}); registry.add({"hv0k0s", "invmass", {HistType::kTH1D, {{100, 0.4, 0.6}}}}); - registry.add({"recetaINELg0Sel8recz10", ";etaresponse", {HistType::kTH2D, {EtaAxis, ZAxis}}}); - registry.add({"genetaINELg0Sel8recz10", ";etaresponse", {HistType::kTH2D, {EtaAxis, ZAxis}}}); - registry.add({"genetaINELg0Sel8genz10", ";etaresponse", {HistType::kTH2D, {EtaAxis, ZAxis}}}); - registry.add({"genetaINELg0genz10", ";etaresponse", {HistType::kTH2D, {EtaAxis, ZAxis}}}); + registry.add({"recetaINELg0Sel8recz10", ";etaresponse", {HistType::kTH2D, {etaAxis, zAxis}}}); + registry.add({"genetaINELg0Sel8recz10", ";etaresponse", {HistType::kTH2D, {etaAxis, zAxis}}}); + registry.add({"genetaINELg0Sel8genz10", ";etaresponse", {HistType::kTH2D, {etaAxis, zAxis}}}); + registry.add({"genetaINELg0genz10", ";etaresponse", {HistType::kTH2D, {etaAxis, zAxis}}}); - registry.add({"reczINELg0Sel8", ";z", {HistType::kTH1D, {ZAxis}}}); - registry.add({"genzINELg0Sel8", ";z", {HistType::kTH1D, {ZAxis}}}); - registry.add({"genzINELg0", ";z", {HistType::kTH1D, {ZAxis}}}); + registry.add({"reczINELg0Sel8", ";z", {HistType::kTH1D, {zAxis}}}); + registry.add({"genzINELg0Sel8", ";z", {HistType::kTH1D, {zAxis}}}); + registry.add({"genzINELg0", ";z", {HistType::kTH1D, {zAxis}}}); registry.add({"hcentmult", ";status;events", {HistType::kTH1D, {{100, 0, 100}}}}); const int nbins = 50; - std::vector logbins(nbins + 1, 0); - Double_t low = 0.01; - Double_t high = 10; - Double_t logbw = (std::log(high) - std::log(low)) / nbins; + std::vector logbins(nbins + 1, 0); + double low = 0.01; + double high = 10; + double logbw = (std::log(high) - std::log(low)) / nbins; for (int ij = 0; ij <= nbins; ij++) { logbins[ij] = low * std::exp(ij * logbw); } @@ -274,21 +321,21 @@ struct MultiplicityCounter { x->SetBinLabel(17, "K0Sz10eta05"); } - expressions::Filter trackSelectionProper = ((aod::track::trackCutFlag & trackSelectionITS) == trackSelectionITS) && ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), ncheckbit(aod::track::trackCutFlag, trackSelectionTPC), true) && ncheckbit(aod::track::trackCutFlag, trackSelectionDCA); - expressions::Filter preFilterV0 = nabs(aod::v0data::dcapostopv) > dcapostopv&& nabs(aod::v0data::dcanegtopv) > dcanegtopv&& aod::v0data::dcaV0daughters < dcav0dau; + expressions::Filter trackSelectionProper = ((aod::track::trackCutFlag & TrackSelectionITS) == TrackSelectionITS) && ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), ncheckbit(aod::track::trackCutFlag, TrackSelectionTPC), true) && ncheckbit(aod::track::trackCutFlag, TrackSelectionDCA); + expressions::Filter preFilterV0 = nabs(aod::v0data::dcapostopv) > dcaPosToPV&& nabs(aod::v0data::dcanegtopv) > dcaNegToPV&& aod::v0data::dcaV0daughters < dcaV0Dau; Partition mcSample = nabs(aod::mcparticle::eta) < estimatorEta; Partition tSample = nabs(aod::track::eta) < estimatorEta; Partition tSample3 = nabs(aod::track::eta) < estimatorEta; void processEventStat( - FullBCs const& bcs, - soa::Join const& collisions) + const FullBCs& bcs, + const soa::Join& collisions) { std::vector::iterator> cols; for (const auto& bc : bcs) { if (!useEvSel || (bc.selection_bit(o2::aod::evsel::kIsBBT0A) && bc.selection_bit(o2::aod::evsel::kIsBBT0C)) != 0) { - registry.fill(HIST("Selection"), 5.); + registry.fill(HIST("Selection"), Fill5); cols.clear(); for (const auto& collision : collisions) { if (collision.has_foundBC()) { @@ -301,49 +348,49 @@ struct MultiplicityCounter { } LOGP(debug, "BC {} has {} collisions", bc.globalBC(), cols.size()); if (!cols.empty()) { - registry.fill(HIST("Selection"), 6.); + registry.fill(HIST("Selection"), Fill6); if (cols.size() > 1) { - registry.fill(HIST("Selection"), 7.); + registry.fill(HIST("Selection"), Fill7); } } } } } - PROCESS_SWITCH(MultiplicityCounter, processEventStat, "Collect event sample stats", false); + PROCESS_SWITCH(DndetaHi, processEventStat, "Collect event sample stats", false); - std::vector tracketas; + std::vector tracketas; template void runCounting( - C const& collisions, - FiTracks const& /*tracks*/) + const C& collisions, + const FiTracks& /*tracks*/) { for (const auto& collision : collisions) { - Bool_1d btrigc(kTrigend, false); - registry.fill(HIST("Selection"), 1.); + Bool1d btrigc(kTrigend, false); + registry.fill(HIST("Selection"), Fill1); auto z = collision.posZ(); auto pertracks = tSample3->sliceBy(perCol, collision.globalIndex()); - auto Ntrk = 0; + auto nTrk = 0; // if (collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { // if (collision.selection_bit(aod::evsel::kIsTriggerTVX)) { if (collision.sel8()) { btrigc[kSel8] = true; - registry.fill(HIST("Selection"), 2.); - if (std::abs(z) < 10) { - registry.fill(HIST("Selection"), 3.); + registry.fill(HIST("Selection"), Fill2); + if (std::abs(z) < CutZ) { + registry.fill(HIST("Selection"), Fill3); } } - if (btrigc[kSel8] && std::abs(z) < 10) + if (btrigc[kSel8] && std::abs(z) < CutZ) registry.fill(HIST("hft0multiplicity"), collision.multFT0C()); for (const auto& track : pertracks) { [[maybe_unused]] int dummy = track.globalIndex(); - if (std::abs(track.eta()) < 1) - Ntrk++; // charged track check + if (std::abs(track.eta()) < CutEta1) + nTrk++; // charged track check } - if (Ntrk > 0) { + if (nTrk > 0) { // registry.fill(HIST("Selection"), 3.); if (btrigc[kSel8]) btrigc[kSel8g0] = true; @@ -352,7 +399,7 @@ struct MultiplicityCounter { registry.fill(HIST("reczINELg0Sel8"), z); auto cent = -1.f; - if (IsPbPb) { + if (isPbPb) { if constexpr (C::template contains()) cent = collision.centFT0C(); @@ -361,30 +408,30 @@ struct MultiplicityCounter { cent = collision.centFT0M(); } - if (IsPbPb) { - if (std::abs(z) < 10 && btrigc[kSel8]) + if (isPbPb) { + if (std::abs(z) < CutZ && btrigc[kSel8]) registry.fill(HIST("hcentrality"), cent); } else { - if (std::abs(z) < 10 && btrigc[kSel8g0]) + if (std::abs(z) < CutZ && btrigc[kSel8g0]) registry.fill(HIST("hcentrality"), cent); - if (std::abs(z) < 10 && btrigc[kSel8g0]) - registry.fill(HIST("hcentralityvscentraldndeta"), cent, Ntrk); + if (std::abs(z) < CutZ && btrigc[kSel8g0]) + registry.fill(HIST("hcentralityvscentraldndeta"), cent, nTrk); } for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { if (btrigc[itrigc]) - registry.fill(HIST("hreczvtx"), Double_t(kDATA), Double_t(itrigc), z, cent); + registry.fill(HIST("hreczvtx"), double(kDATA), double(itrigc), z, cent); } for (const auto& track : pertracks) { - if (btrigc[kSel8] && std::abs(track.eta()) < 0.8 && std::abs(z) < 10) + if (btrigc[kSel8] && std::abs(track.eta()) < CutEta08 && std::abs(z) < CutZ) registry.fill(HIST("hrecdndpt"), track.pt()); if (btrigc[kSel8]) registry.fill(HIST("recetaINELg0Sel8recz10"), track.eta(), z); for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { if (btrigc[itrigc]) { - registry.fill(HIST("hphieta"), Double_t(kDATA), Double_t(itrigc), track.phi(), track.eta(), cent); - registry.fill(HIST("hrecdndeta"), Double_t(kDATA), Double_t(itrigc), z, track.eta(), cent, Double_t(kParDATA), track.phi()); + registry.fill(HIST("hphieta"), double(kDATA), double(itrigc), track.phi(), track.eta(), cent); + registry.fill(HIST("hrecdndeta"), double(kDATA), double(itrigc), z, track.eta(), cent, double(kParDATA), track.phi()); } } } @@ -396,62 +443,62 @@ struct MultiplicityCounter { Preslice perColFiLTracks = aod::track::collisionId; using MCex = soa::Join; void processMCCounting( - MCex const& mcCollisions, soa::Join const& collisions, Particles const& mcParticles, - FiLTracks const& tracks) + const MCex& mcCollisions, const soa::Join& collisions, const Particles& mcParticles, + const FiLTracks& tracks) { for (const auto& mcCollision : mcCollisions) { - Bool_1d bevtc(kECend, false); + Bool1d bevtc(kECend, false); bevtc[kINEL] = true; auto procId = mcCollision.processId(); - if (procId == 101) { + if (procId == ProcIdND) { bevtc[kND] = true; - } else if (procId == 103 || procId == 104) { + } else if (procId == ProcIdSD1 || procId == ProcIdSD2) { bevtc[kSD] = true; - } else if (procId == 105 || procId == 106) { + } else if (procId == ProcIdDD1 || procId == ProcIdDD2) { bevtc[kDD] = true; } - registry.fill(HIST("Selection"), 1.); + registry.fill(HIST("Selection"), Fill1); auto mcz = mcCollision.posZ(); auto genz = mcz; - auto Ntrk_gen = 0; - auto particles = mcParticles.sliceBy(perMCColparticles, mcCollision.globalIndex()); + auto nTrkGen = 0; + auto particles = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); for (const auto& particle : particles) { if (!particle.isPhysicalPrimary()) continue; auto kp = pdg->GetParticle(particle.pdgCode()); if (kp != nullptr) { - if (std::abs(kp->Charge()) >= 3) { - if (std::abs(particle.eta()) < 1) { - Ntrk_gen++; + if (std::abs(kp->Charge()) >= CutCharge) { + if (std::abs(particle.eta()) < CutEta1) { + nTrkGen++; } } } } - if (Ntrk_gen > 0) { - registry.fill(HIST("Selection"), 4.); + if (nTrkGen > 0) { + registry.fill(HIST("Selection"), Fill4); bevtc[kINELg0] = true; } if (bevtc[kINEL]) - registry.fill(HIST("Selection"), 9); - if (bevtc[kINEL] && std::abs(mcz) < 10) - registry.fill(HIST("Selection"), 11); + registry.fill(HIST("Selection"), Fill9); + if (bevtc[kINEL] && std::abs(mcz) < CutZ) + registry.fill(HIST("Selection"), Fill11); if (bevtc[kINELg0]) - registry.fill(HIST("Selection"), 10); - if (bevtc[kINELg0] && std::abs(mcz) < 10) - registry.fill(HIST("Selection"), 12); + registry.fill(HIST("Selection"), Fill10); + if (bevtc[kINELg0] && std::abs(mcz) < CutZ) + registry.fill(HIST("Selection"), Fill12); for (const auto& particle : particles) { if (!particle.isPhysicalPrimary()) continue; auto kp = pdg->GetParticle(particle.pdgCode()); if (kp != nullptr) { - if (std::abs(kp->Charge()) >= 3) { - if (bevtc[kINEL] && std::abs(particle.eta()) < 0.8 && std::abs(mcz) < 10) { + if (std::abs(kp->Charge()) >= CutCharge) { + if (bevtc[kINEL] && std::abs(particle.eta()) < CutEta08 && std::abs(mcz) < CutZ) { registry.fill(HIST("hgendndpt"), particle.pt()); - if (particle.pt() < 0.1) { - registry.fill(HIST("hgendndpt2"), particle.pt(), -10.0 * particle.pt() + 2); - registry.fill(HIST("hgendndpt05"), particle.pt(), 5.0 * particle.pt() + 0.5); + if (particle.pt() < CutPt) { + registry.fill(HIST("hgendndpt2"), particle.pt(), W1 * particle.pt() + W2); + registry.fill(HIST("hgendndpt05"), particle.pt(), W3 * particle.pt() + W4); } else { registry.fill(HIST("hgendndpt2"), particle.pt()); registry.fill(HIST("hgendndpt05"), particle.pt()); @@ -468,18 +515,18 @@ struct MultiplicityCounter { cent = -1.0; } else { for (const auto& collision : collisionsample) { - if (IsPbPb) { + if (isPbPb) { if constexpr (MyCollisionsCent::template contains()) cent = collision.centFT0C(); } else { if constexpr (MyCollisionsCent::template contains()) cent = collision.centFT0M(); - // auto Ntrk_rec = 0; + // auto nTrkRec = 0; // auto trackspart = tracks.sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); // for (const auto& track : trackspart) { // if (std::abs(track.eta()) < 1) { - // Ntrk_rec++; + // nTrkRec++; // } // } } @@ -487,14 +534,14 @@ struct MultiplicityCounter { } for (auto ievtc = 1u; ievtc < kECend; ievtc++) { if (bevtc[ievtc]) - registry.fill(HIST("hgenzvtx"), Double_t(ievtc), genz, cent); + registry.fill(HIST("hgenzvtx"), double(ievtc), genz, cent); } - Int_t pid = 0; - std::vector particleetas; + int pid = 0; + std::vector particleetas; for (const auto& particle : particles) { auto p = pdg->GetParticle(particle.pdgCode()); - if (std::abs(particle.pdgCode()) == kK0Short && std::abs(particle.eta()) < 0.5 && std::abs(genz) < 10) - registry.fill(HIST("Selection"), 17.); + if (std::abs(particle.pdgCode()) == kK0Short && std::abs(particle.eta()) < CutEta05 && std::abs(genz) < CutZ) + registry.fill(HIST("Selection"), Fill17); if (!particle.isPhysicalPrimary()) { continue; } @@ -514,17 +561,17 @@ struct MultiplicityCounter { } if (p != nullptr) { - if (std::abs(p->Charge()) >= 3) { + if (std::abs(p->Charge()) >= CutCharge) { for (auto ievtc = 1u; ievtc < kECend; ievtc++) { if (bevtc[ievtc]) { - registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), cent, Double_t(pid), kNoPtVar, particle.phi()); - if (particle.pt() < 0.1) { - registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), cent, Double_t(pid), kPtUp, particle.phi(), -10.0 * particle.pt() + 2); - registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), cent, Double_t(pid), kPtDw, particle.phi(), 5.0 * particle.pt() + 0.5); + registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), cent, double(pid), kNoPtVar, particle.phi()); + if (particle.pt() < CutPt) { + registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), cent, double(pid), kPtUp, particle.phi(), W1 * particle.pt() + W2); + registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), cent, double(pid), kPtDw, particle.phi(), W3 * particle.pt() + W4); } else { - registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), cent, Double_t(pid), kPtUp, particle.phi()); - registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), cent, Double_t(pid), kPtDw, particle.phi()); + registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), cent, double(pid), kPtUp, particle.phi()); + registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), cent, double(pid), kPtDw, particle.phi()); } } } @@ -536,33 +583,33 @@ struct MultiplicityCounter { for (const auto& collision : collisionsample) { auto cent = -1.f; - if (IsPbPb) { + if (isPbPb) { if constexpr (MyCollisionsCent::template contains()) cent = collision.centFT0C(); } else { if constexpr (MyCollisionsCent::template contains()) cent = collision.centFT0M(); - // auto Ntrk_rec = 0; + // auto nTrkRec = 0; // auto trackspart = tracks.sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); // for (const auto& track : trackspart) { // if (std::abs(track.eta()) < 1) { - // Ntrk_rec++; + // nTrkRec++; // } // } } - Bool_1d btrigc(kTrigend, false); + Bool1d btrigc(kTrigend, false); auto z = collision.posZ(); // if (collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { // if (collision.selection_bit(aod::evsel::kIsTriggerTVX)) { if (collision.sel8()) { btrigc[kSel8] = true; - registry.fill(HIST("Selection"), 2.); - if (std::abs(z) < 10) { - registry.fill(HIST("Selection"), 3.); + registry.fill(HIST("Selection"), Fill2); + if (std::abs(z) < CutZ) { + registry.fill(HIST("Selection"), Fill3); } } - if (bevtc[kINEL] && btrigc[kSel8] && std::abs(z) < 10) + if (bevtc[kINEL] && btrigc[kSel8] && std::abs(z) < CutZ) registry.fill(HIST("hft0multiplicity"), collision.multFT0C()); if (collisionsample.size() == 1 && bevtc[kINELg0] && btrigc[kSel8]) { for (const auto& eta : particleetas) { @@ -579,46 +626,46 @@ struct MultiplicityCounter { registry.fill(HIST("genzINELg0"), genz); } - auto Ntrk_rec = 0; + auto nTrkRec = 0; auto trackspart = tracks.sliceBy(perColFiLTracks, collision.globalIndex()); for (const auto& track : trackspart) { - if (std::abs(track.eta()) < 1) { - Ntrk_rec++; + if (std::abs(track.eta()) < CutEta1) { + nTrkRec++; } } - if (Ntrk_rec > 0) { + if (nTrkRec > 0) { if (btrigc[kSel8]) btrigc[kSel8g0] = true; } - if (IsPbPb) { - if (std::abs(z) < 10 && btrigc[kSel8]) + if (isPbPb) { + if (std::abs(z) < CutZ && btrigc[kSel8]) registry.fill(HIST("hcentrality"), cent); } else { - if (std::abs(z) < 10 && btrigc[kSel8g0]) + if (std::abs(z) < CutZ && btrigc[kSel8g0]) registry.fill(HIST("hcentrality"), cent); } if (bevtc[kINEL] && btrigc[kSel8]) - registry.fill(HIST("Selection"), 13); - if (bevtc[kINEL] && btrigc[kSel8] && std::abs(z) < 10) - registry.fill(HIST("Selection"), 15); + registry.fill(HIST("Selection"), Fill13); + if (bevtc[kINEL] && btrigc[kSel8] && std::abs(z) < CutZ) + registry.fill(HIST("Selection"), Fill15); if (bevtc[kINELg0] && btrigc[kSel8g0]) - registry.fill(HIST("Selection"), 14); - if (bevtc[kINELg0] && btrigc[kSel8g0] && std::abs(z) < 10) - registry.fill(HIST("Selection"), 16); + registry.fill(HIST("Selection"), Fill14); + if (bevtc[kINELg0] && btrigc[kSel8g0] && std::abs(z) < CutZ) + registry.fill(HIST("Selection"), Fill16); for (auto ievtc = 1u; ievtc < kECend; ievtc++) { for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { if (bevtc[ievtc] && btrigc[itrigc]) { - registry.fill(HIST("hreczvtx"), Double_t(ievtc), Double_t(itrigc), z, cent); + registry.fill(HIST("hreczvtx"), double(ievtc), double(itrigc), z, cent); } } } - std::vector mclabels; + std::vector mclabels; for (const auto& track : trackspart) { if (track.has_mcParticle()) { - Int_t pid = kBkg; + int pid = kBkg; auto particle = track.template mcParticle_as(); if (particle.isPhysicalPrimary()) { switch (std::abs(particle.pdgCode())) { @@ -638,8 +685,8 @@ struct MultiplicityCounter { } else { pid = kNotPrimary; } - for (auto MotherIDs = particle.mothersIds().front(); MotherIDs <= particle.mothersIds().back(); MotherIDs++) { - auto mother = mcParticles.rawIteratorAt(MotherIDs); + for (auto motherIDs = particle.mothersIds().front(); motherIDs <= particle.mothersIds().back(); motherIDs++) { + auto mother = mcParticles.rawIteratorAt(motherIDs); auto pdg_mother = mother.pdgCode(); if (pdg_mother == kK0Short || std::abs(pdg_mother) == kLambda0) { pid = kMotherStrange; @@ -649,15 +696,15 @@ struct MultiplicityCounter { pid = kBkg; mclabels.push_back(track.mcParticleId()); registry.fill(HIST("hetaresponse"), particle.eta(), track.eta(), cent); - if (bevtc[kINEL] && btrigc[kSel8] && std::abs(track.eta()) < 0.8 && std::abs(z) < 10 && pid != kBkg && pid != kNotPrimary) + if (bevtc[kINEL] && btrigc[kSel8] && std::abs(track.eta()) < CutEta08 && std::abs(z) < CutZ && pid != kBkg && pid != kNotPrimary) registry.fill(HIST("hdndptefficiency"), particle.pt()); if (btrigc[kSel8] && bevtc[kINELg0]) registry.fill(HIST("recetaINELg0Sel8recz10"), track.eta(), z); for (auto ievtc = 1u; ievtc < kECend; ievtc++) { for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { if (bevtc[ievtc] && btrigc[itrigc]) { - registry.fill(HIST("hrecdndeta"), Double_t(ievtc), Double_t(itrigc), z, particle.eta(), cent, Double_t(pid), particle.phi()); - registry.fill(HIST("hphieta"), Double_t(ievtc), Double_t(itrigc), track.phi(), track.eta(), cent); + registry.fill(HIST("hrecdndeta"), double(ievtc), double(itrigc), z, particle.eta(), cent, double(pid), particle.phi()); + registry.fill(HIST("hphieta"), double(ievtc), double(itrigc), track.phi(), track.eta(), cent); } } } @@ -666,7 +713,7 @@ struct MultiplicityCounter { for (auto ievtc = 1u; ievtc < kECend; ievtc++) { for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { if (bevtc[ievtc] && btrigc[itrigc]) { - registry.fill(HIST("hrecdndeta"), Double_t(ievtc), Double_t(itrigc), z, track.eta(), cent, Double_t(kBkg), track.phi()); + registry.fill(HIST("hrecdndeta"), double(ievtc), double(itrigc), z, track.eta(), cent, double(kBkg), track.phi()); } } } @@ -676,12 +723,12 @@ struct MultiplicityCounter { } } - PROCESS_SWITCH(MultiplicityCounter, processMCCounting, "MC Count tracks", false); + PROCESS_SWITCH(DndetaHi, processMCCounting, "MC Count tracks", false); void processTrackEfficiencyGeneral( - typename soa::Join::iterator const& collision, - aod::McCollisions const& /*mcCollisions*/, Particles const& particles, - FiLTracks const& /*tracks*/) + MyCollisionsMcLabels::iterator const& collision, + const aod::McCollisions& /*mcCollisions*/, const Particles& particles, + const FiLTracks& /*tracks*/) { if (!collision.sel8()) { @@ -695,43 +742,43 @@ struct MultiplicityCounter { auto particlesPerCol = particles.sliceBy(perMCCol, mcCollision.globalIndex()); } - PROCESS_SWITCH(MultiplicityCounter, processTrackEfficiencyGeneral, "MC Count tracks", false); + PROCESS_SWITCH(DndetaHi, processTrackEfficiencyGeneral, "MC Count tracks", false); void processCounting( - MyCollisionsCent const& collisions, - FiTracks const& tracks) + const MyCollisionsCent& collisions, + const FiTracks& tracks) { runCounting(collisions, tracks); } - PROCESS_SWITCH(MultiplicityCounter, processCounting, "Count tracks with Centrality", false); + PROCESS_SWITCH(DndetaHi, processCounting, "Count tracks with Centrality", false); void processGen( - aod::McCollisions::iterator const& mcCollision, Particles const& mcParticles) + const aod::McCollisions::iterator& mcCollision, const Particles& mcParticles) { auto genz = mcCollision.posZ(); - Bool_1d bevtc(kECend, false); + Bool1d bevtc(kECend, false); bevtc[kINEL] = true; for (const auto& particle : mcParticles) { if (!particle.isPhysicalPrimary()) continue; auto p = pdg->GetParticle(particle.pdgCode()); if (p != nullptr) { - if (std::abs(p->Charge()) >= 3) { - if (std::abs(particle.eta()) < 1) + if (std::abs(p->Charge()) >= CutCharge) { + if (std::abs(particle.eta()) < CutEta1) bevtc[kINELg0] = true; } } } for (auto ievtc = 1u; ievtc < kECend; ievtc++) { if (bevtc[ievtc]) - registry.fill(HIST("hgenzvtx"), Double_t(ievtc), genz, -1.0); + registry.fill(HIST("hgenzvtx"), double(ievtc), genz, FillM1); } - Int_t pid = 0; + int pid = 0; for (const auto& particle : mcParticles) { auto p = pdg->GetParticle(particle.pdgCode()); - if (std::abs(particle.pdgCode()) == kK0Short && std::abs(particle.eta()) < 0.5 && std::abs(genz) < 10) - registry.fill(HIST("Selection"), 17.); + if (std::abs(particle.pdgCode()) == kK0Short && std::abs(particle.eta()) < CutEta05 && std::abs(genz) < CutZ) + registry.fill(HIST("Selection"), Fill17); if (!particle.isPhysicalPrimary()) { continue; } @@ -751,17 +798,17 @@ struct MultiplicityCounter { } if (p != nullptr) { - if (std::abs(p->Charge()) >= 3) { + if (std::abs(p->Charge()) >= CutCharge) { for (auto ievtc = 1u; ievtc < kECend; ievtc++) { if (bevtc[ievtc]) { - registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), -1.0, Double_t(pid), kNoPtVar, particle.phi()); - if (particle.pt() < 0.1) { - registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), -1.0, Double_t(pid), kPtUp, particle.phi(), 2.0); - registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), -1.0, Double_t(pid), kPtDw, particle.phi(), 0.5); + registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), FillM1, double(pid), kNoPtVar, particle.phi()); + if (particle.pt() < CutPt) { + registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), FillM1, double(pid), kPtUp, particle.phi(), W2); + registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), FillM1, double(pid), kPtDw, particle.phi(), W4); } else { - registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), -1.0, Double_t(pid), kPtUp, particle.phi()); - registry.fill(HIST("hgendndeta"), Double_t(ievtc), genz, particle.eta(), -1.0, Double_t(pid), kPtDw, particle.phi()); + registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), FillM1, double(pid), kPtUp, particle.phi()); + registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), FillM1, double(pid), kPtDw, particle.phi()); } } } @@ -769,13 +816,13 @@ struct MultiplicityCounter { } } } - PROCESS_SWITCH(MultiplicityCounter, processGen, "Process generator-level info", false); + PROCESS_SWITCH(DndetaHi, processGen, "Process generator-level info", false); Preslice perCollisionV0 = o2::aod::v0data::collisionId; void processV0Counting( - MyCollisionsCent const& collisions, - aod::V0Datas const& fullV0s, - FiTracks const& /*tracks*/, - DaughterTracks const& /*Dautrks*/) + const MyCollisionsCent& collisions, + const aod::V0Datas& fullV0s, + const FiTracks& /*tracks*/, + const DaughterTracks& /*Dautrks*/) { for (const auto& collision : collisions) { if (!collision.sel8()) @@ -783,7 +830,7 @@ struct MultiplicityCounter { auto z = collision.posZ(); auto cent = -1.f; - if (IsPbPb) { + if (isPbPb) { if constexpr (MyCollisionsCent::template contains()) cent = collision.centFT0C(); } else { @@ -796,43 +843,43 @@ struct MultiplicityCounter { auto pTrack = v0.template posTrack_as(); auto nTrack = v0.template negTrack_as(); - if (std::abs(z) < 10) { - if (v0.v0radius() > v0radius) + if (std::abs(z) < CutZ) { + if (v0.v0radius() > v0Radius) continue; - if (v0.dcapostopv() > dcapostopv) + if (v0.dcapostopv() > dcaPosToPV) continue; - if (v0.dcanegtopv() > dcanegtopv) + if (v0.dcanegtopv() > dcaNegToPV) continue; - if (v0.v0cosPA() < v0cospa) + if (v0.v0cosPA() < v0CosPA) continue; - if (std::fabs(pTrack.eta()) > 0.9) + if (std::fabs(pTrack.eta()) > CutEta09) continue; - if (std::fabs(nTrack.eta()) > 0.9) + if (std::fabs(nTrack.eta()) > CutEta09) continue; - if (std::fabs(v0.eta()) < 0.5) + if (std::fabs(v0.eta()) < CutEta05) registry.fill(HIST("hv0k0s"), v0.mK0Short()); - registry.fill(HIST("hv0mass"), cent, Double_t(kK0short), v0.eta(), Double_t(v0.mK0Short())); - registry.fill(HIST("hv0mass"), cent, Double_t(kLambda), v0.eta(), Double_t(v0.mLambda())); - registry.fill(HIST("hv0mass"), cent, Double_t(kAntilambda), v0.eta(), Double_t(v0.mAntiLambda())); + registry.fill(HIST("hv0mass"), cent, double(kK0short), v0.eta(), double(v0.mK0Short())); + registry.fill(HIST("hv0mass"), cent, double(kLambda), v0.eta(), double(v0.mLambda())); + registry.fill(HIST("hv0mass"), cent, double(kAntilambda), v0.eta(), double(v0.mAntiLambda())); } } } } - PROCESS_SWITCH(MultiplicityCounter, processV0Counting, "MC V0Count tracks without Centrality", false); + PROCESS_SWITCH(DndetaHi, processV0Counting, "MC V0Count tracks without Centrality", false); void processMCV0Counting( - soa::Join const& collisions, - aod::McCollisions const& /*MCCollisions*/, - Particles const& /*mcParticles*/, - soa::Filtered const& fullV0s, - soa::Filtered const& /*tracks*/, - DaughterTracks const& /*Dautrks*/) + const soa::Join& collisions, + const aod::McCollisions& /*MCCollisions*/, + const Particles& /*mcParticles*/, + const soa::Filtered& fullV0s, + const soa::Filtered& /*tracks*/, + const DaughterTracks& /*Dautrks*/) { for (const auto& collision : collisions) { auto cent = -1.f; - if (IsPbPb) { + if (isPbPb) { if constexpr (MyCollisionsCent::template contains()) cent = collision.centFT0C(); } else { @@ -850,22 +897,22 @@ struct MultiplicityCounter { auto pTrack = v0.template posTrack_as(); auto nTrack = v0.template negTrack_as(); - if (0 && v0.v0radius() > v0radius && - v0.v0cosPA() > v0cospa && - abs(pTrack.eta()) < etadau && - abs(nTrack.eta()) < etadau) { + if (0 && v0.v0radius() > v0Radius && + v0.v0cosPA() > v0CosPA && + std::abs(pTrack.eta()) < etaDau && + std::abs(nTrack.eta()) < etaDau) { - registry.fill(HIST("hv0mass"), cent, Double_t(kK0short), v0.eta(), Double_t(v0.mK0Short())); - registry.fill(HIST("hv0mass"), cent, Double_t(kLambda), v0.eta(), Double_t(v0.mLambda())); - registry.fill(HIST("hv0mass"), cent, Double_t(kAntilambda), v0.eta(), Double_t(v0.mAntiLambda())); + registry.fill(HIST("hv0mass"), cent, double(kK0short), v0.eta(), double(v0.mK0Short())); + registry.fill(HIST("hv0mass"), cent, double(kLambda), v0.eta(), double(v0.mLambda())); + registry.fill(HIST("hv0mass"), cent, double(kAntilambda), v0.eta(), double(v0.mAntiLambda())); } } } } - PROCESS_SWITCH(MultiplicityCounter, processMCV0Counting, "MC V0Count tracks without Centrality", false); + PROCESS_SWITCH(DndetaHi, processMCV0Counting, "MC V0Count tracks without Centrality", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} \ No newline at end of file From 1c8cee1a7fc5b3a5a5bb8d1649a36b2b721caaaa Mon Sep 17 00:00:00 2001 From: Hyungjun Lee Date: Wed, 15 Apr 2026 17:50:03 +0900 Subject: [PATCH 3/9] Fix code formatting for o2linter --- PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx index 4ea93259cf6..c30d3b74409 100644 --- a/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx @@ -24,8 +24,8 @@ #include "Common/DataModel/PIDResponseTOF.h" #include "Common/DataModel/PIDResponseTPC.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "CommonConstants/MathConstants.h" +#include "CommonConstants/MathConstants.h" #include #include #include @@ -223,7 +223,6 @@ static constexpr TrackSelectionFlags::flagtype TrackSelectionTPC = static constexpr TrackSelectionFlags::flagtype TrackSelectionDCA = TrackSelectionFlags::kDCAz | TrackSelectionFlags::kDCAxy; - struct DndetaHi { SliceCache cache; Preslice perMCCol = aod::mcparticle::mcCollisionId; @@ -685,8 +684,8 @@ struct DndetaHi { } else { pid = kNotPrimary; } - for (auto motherIDs = particle.mothersIds().front(); motherIDs <= particle.mothersIds().back(); motherIDs++) { - auto mother = mcParticles.rawIteratorAt(motherIDs); + for (auto motherIds = particle.mothersIds().front(); motherIds <= particle.mothersIds().back(); motherIds++) { + auto mother = mcParticles.rawIteratorAt(motherIds); auto pdg_mother = mother.pdgCode(); if (pdg_mother == kK0Short || std::abs(pdg_mother) == kLambda0) { pid = kMotherStrange; @@ -870,11 +869,11 @@ struct DndetaHi { void processMCV0Counting( const soa::Join& collisions, - const aod::McCollisions& /*MCCollisions*/, + const aod::McCollisions& /*mcCollisions*/, const Particles& /*mcParticles*/, const soa::Filtered& fullV0s, const soa::Filtered& /*tracks*/, - const DaughterTracks& /*Dautrks*/) + const DaughterTracks& /*dauTrks*/) { for (const auto& collision : collisions) { auto cent = -1.f; From 400b75d0b31bdf93b26a9e7717525813cfec57df Mon Sep 17 00:00:00 2001 From: Hyungjun Lee Date: Wed, 15 Apr 2026 17:52:56 +0900 Subject: [PATCH 4/9] Add missing newline at end of file --- PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx index c30d3b74409..9491d02e928 100644 --- a/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx @@ -914,4 +914,4 @@ struct DndetaHi { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} \ No newline at end of file +} From 73709aaf2063055d14f8947f4cbab72a63b1c5b8 Mon Sep 17 00:00:00 2001 From: Hyungjun Lee Date: Wed, 15 Apr 2026 18:00:22 +0900 Subject: [PATCH 5/9] Bypass linter error for PseudorapidityDensityMFT --- PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt index ed3beadecc5..e72131291b7 100644 --- a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt +++ b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt @@ -19,7 +19,7 @@ o2physics_add_dpl_workflow(ucc-zdc PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(pseudorapidity-density-mft +o2physics_add_dpl_workflow(pseudorapidity-density-mft # o2-linter: disable=name/o2-workflow SOURCES PseudorapidityDensityMFT.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) @@ -47,4 +47,4 @@ o2physics_add_dpl_workflow(nch-studypp o2physics_add_dpl_workflow(dndeta-hi SOURCES dndetaHi.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::Framework - COMPONENT_NAME Analysis) + COMPONENT_NAME Analysis) \ No newline at end of file From e030cc0ea1f11d4eb5ac5251475f925f30239a5f Mon Sep 17 00:00:00 2001 From: Hyungjun Lee Date: Wed, 15 Apr 2026 18:03:11 +0900 Subject: [PATCH 6/9] Bypass linter error for PseudorapidityDensityMFT --- PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt index e72131291b7..ed3beadecc5 100644 --- a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt +++ b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt @@ -19,7 +19,7 @@ o2physics_add_dpl_workflow(ucc-zdc PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(pseudorapidity-density-mft # o2-linter: disable=name/o2-workflow +o2physics_add_dpl_workflow(pseudorapidity-density-mft SOURCES PseudorapidityDensityMFT.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) @@ -47,4 +47,4 @@ o2physics_add_dpl_workflow(nch-studypp o2physics_add_dpl_workflow(dndeta-hi SOURCES dndetaHi.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::Framework - COMPONENT_NAME Analysis) \ No newline at end of file + COMPONENT_NAME Analysis) From 2d7e2bea4c1cfc11cb256fc0df01c94bbb61b516 Mon Sep 17 00:00:00 2001 From: Hyungjun Lee Date: Wed, 15 Apr 2026 18:11:13 +0900 Subject: [PATCH 7/9] delete index.h --- PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx index 9491d02e928..61e58c4c966 100644 --- a/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx @@ -13,8 +13,6 @@ /// \brief Task for dN/deta analysis in heavy ion collisions /// \author hyungjun lee , joonsuk bae -#include "Index.h" - #include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/CCDB/EventSelectionParams.h" From 50feae0281c5eedd337df94b344b8b6fd7bcaaff Mon Sep 17 00:00:00 2001 From: Hyungjun Lee Date: Thu, 16 Apr 2026 10:17:21 +0900 Subject: [PATCH 8/9] build test --- PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx index 61e58c4c966..f045527db36 100644 --- a/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx @@ -14,6 +14,7 @@ /// \author hyungjun lee , joonsuk bae #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGMM/Mult/DataModel/Index.h" #include "Common/CCDB/EventSelectionParams.h" #include "Common/DataModel/Centrality.h" @@ -193,7 +194,7 @@ AxisSpec deltaZAxis = {61, -6.1, 6.1, "", "deltaz axis"}; AxisSpec dcaAxis = {601, -3.01, 3.01, "", "DCA axis"}; AxisSpec etaAxis = {80, -4.0, 4.0, "#eta", "eta axis"}; AxisSpec v0EtaAxis = {20, -1.0, 1.0, "#etav0", "eta axis"}; -AxisSpec phiAxis = {629, 0, 2 * o2::constants::math::pi, "Rad", "phi axis"}; +AxisSpec phiAxis = {629, 0, 2 * o2::constants::math::PI, "Rad", "phi axis"}; AxisSpec ptVarAxis = {kPtVarend - 1, +kPtVarbegin + 0.5, +kPtVarend - 0.5, "", "ptvar axis"}; AxisSpec evtClassAxis = {kECend - 1, +kECbegin + 0.5, +kECend - 0.5, "", "event class"}; AxisSpec trigClassAxis = {kTrigend - 1, +kTrigbegin + 0.5, +kTrigend - 0.5, "", "trigger class"}; @@ -207,7 +208,7 @@ AxisSpec multAxis = {1001, -0.5, 1000.5, "", "Ntrks"}; AxisSpec statusCodeAxis = {3, -1.5, 2.5, "", "StatusCode"}; AxisSpec processCodeAxis = {45, -1.5, 44.5, "", "StatusCode"}; -AxisSpec phibin = {{0, o2::constants::math::pi / 2, o2::constants::math::pi, o2::constants::math::pi * 3. / 2, 2 * o2::constants::math::pi}, "#phi", "phi bin"}; +AxisSpec phibin = {{0, o2::constants::math::PI / 2, o2::constants::math::PI, o2::constants::math::PI * 3. / 2, 2 * o2::constants::math::PI}, "#phi", "phi bin"}; static constexpr TrackSelectionFlags::flagtype TrackSelectionITS = TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF | @@ -460,7 +461,7 @@ struct DndetaHi { auto genz = mcz; auto nTrkGen = 0; - auto particles = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache); + auto particles = mcParticles.sliceBy(perMCCol, mcCollision.globalIndex()); for (const auto& particle : particles) { if (!particle.isPhysicalPrimary()) continue; From c8d9125594c87c7213e04fae53c5e0288717433c Mon Sep 17 00:00:00 2001 From: Hyungjun Lee Date: Thu, 16 Apr 2026 23:21:36 +0900 Subject: [PATCH 9/9] PWGLF: Replace anonymous enums with scoped enum classes in dndetaHi - Convert all C-style anonymous enums to typed enum classes: EventCategory, TriggerClass, Species, TrackSign, AnalysisStep, ParticleType, PtVariation - Add constexpr toInt() helper to convert scoped enum to int for use with registry.fill() and vector indexing - Rename ambiguous enumerators for clarity: kProtonMy -> Proton, kOPar -> Other, kNoPtVar -> None, kPtDw -> Down - Update all usages throughout processData, processMC, and processMCNoV0Counting process functions - Remove dead V0 loop code in processMCV0Counting (parameter fullV0s unused, inner loop had permanent `0 &&` guard) Co-Authored-By: Claude Sonnet 4.6 --- .../Tasks/GlobalEventProperties/dndetaHi.cxx | 328 +++++++++--------- 1 file changed, 156 insertions(+), 172 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx index f045527db36..d770a5c31f3 100644 --- a/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx @@ -78,61 +78,66 @@ using Bool1d = std::vector; // Alias for const-ref-in-process linter issue using MyCollisionsMcLabels = soa::Join; -enum { - kECbegin = 0, - kDATA = 1, - kINEL, - kINELg0, - kDD, - kSD, - kND, - kECend +enum class EventCategory { + Begin = 0, + Data, + Inel, + Inelg0, + Dd, + Sd, + Nd, + End }; -enum { - kTrigbegin = 0, - kSel8 = 1, - kSel8g0, - kTrigend + +enum class TriggerClass { + Begin = 0, + Sel8, + Sel8g0, + End }; -enum { - kSpeciesbegin = 0, - kK0short = 1, - kLambda, - kAntilambda, - kSpeciesend + +enum class Species { + Begin = 0, + K0short, + Lambda, + Antilambda, + End }; -enum { - kSignbegin = 0, - kPositive = 1, - kNegative, - kSignend + +enum class TrackSign { + Begin = 0, + Positive, + Negative, + End }; -enum { - kStepbegin = 0, - kAll = 1, - kBasiccut, - kMasscut, - kStepend + +enum class AnalysisStep { + Begin = 0, + All, + Basiccut, + Masscut, + End }; -enum { - kParTypebegin = 0, - kParDATA = 1, - kMotherStrange, - kBkg, - kNotPrimary, - kPion, - kKaon, - kProtonMy, - kOPar, - kParTypeend +enum class ParticleType { + Begin = 0, + Data, + MotherStrange, + Bkg, + NotPrimary, + Pion, + Kaon, + Proton, + Other, + End }; -enum { - kPtVarbegin = 0, - kNoPtVar = 1, - kPtUp, - kPtDw, - kPtVarend + +enum class PtVariation { + Begin = 0, + None, + Up, + Down, + End }; namespace @@ -165,6 +170,10 @@ constexpr int ProcIdSD2 = 104; constexpr int ProcIdDD1 = 105; constexpr int ProcIdDD2 = 106; +// Scoped-enum → int helper +template +constexpr int toInt(E e) { return static_cast(e); } + // Weights and Fill values magic numbers constexpr float W1 = -10.0f; constexpr float W2 = 2.0f; @@ -195,14 +204,14 @@ AxisSpec dcaAxis = {601, -3.01, 3.01, "", "DCA axis"}; AxisSpec etaAxis = {80, -4.0, 4.0, "#eta", "eta axis"}; AxisSpec v0EtaAxis = {20, -1.0, 1.0, "#etav0", "eta axis"}; AxisSpec phiAxis = {629, 0, 2 * o2::constants::math::PI, "Rad", "phi axis"}; -AxisSpec ptVarAxis = {kPtVarend - 1, +kPtVarbegin + 0.5, +kPtVarend - 0.5, "", "ptvar axis"}; -AxisSpec evtClassAxis = {kECend - 1, +kECbegin + 0.5, +kECend - 0.5, "", "event class"}; -AxisSpec trigClassAxis = {kTrigend - 1, +kTrigbegin + 0.5, +kTrigend - 0.5, "", "trigger class"}; -AxisSpec particleTypeAxis = {kParTypeend - 1, +kParTypebegin + 0.5, +kParTypeend - 0.5, "", "Particle type"}; -AxisSpec speciesAxis = {kSpeciesend - 1, +kSpeciesbegin + 0.5, +kSpeciesend - 0.5, "", "species class"}; +AxisSpec ptVarAxis = {toInt(PtVariation::End) - 1, toInt(PtVariation::Begin) + 0.5, toInt(PtVariation::End) - 0.5, "", "ptvar axis"}; +AxisSpec evtClassAxis = {toInt(EventCategory::End) - 1, toInt(EventCategory::Begin) + 0.5, toInt(EventCategory::End) - 0.5, "", "event class"}; +AxisSpec trigClassAxis = {toInt(TriggerClass::End) - 1, toInt(TriggerClass::Begin) + 0.5, toInt(TriggerClass::End) - 0.5, "", "trigger class"}; +AxisSpec particleTypeAxis = {toInt(ParticleType::End) - 1, toInt(ParticleType::Begin) + 0.5, toInt(ParticleType::End) - 0.5, "", "Particle type"}; +AxisSpec speciesAxis = {toInt(Species::End) - 1, toInt(Species::Begin) + 0.5, toInt(Species::End) - 0.5, "", "species class"}; AxisSpec massAxis = {600, 0.3f, 1.3f, "Mass (GeV/c^{2})", "Inv. Mass (GeV/c^{2})"}; -AxisSpec signAxis = {kSignend - 1, +kSignbegin + 0.5, +kSignend - 0.5, "", "sign"}; -AxisSpec stepAxis = {kStepend - 1, +kStepbegin + 0.5, +kStepend - 0.5, "", "step"}; +AxisSpec signAxis = {toInt(TrackSign::End) - 1, toInt(TrackSign::Begin) + 0.5, toInt(TrackSign::End) - 0.5, "", "sign"}; +AxisSpec stepAxis = {toInt(AnalysisStep::End) - 1, toInt(AnalysisStep::Begin) + 0.5, toInt(AnalysisStep::End) - 0.5, "", "step"}; AxisSpec testAxis = {101, -0.5, 100.5, "", "test"}; AxisSpec multAxis = {1001, -0.5, 1000.5, "", "Ntrks"}; AxisSpec statusCodeAxis = {3, -1.5, 2.5, "", "StatusCode"}; @@ -365,7 +374,7 @@ struct DndetaHi { { for (const auto& collision : collisions) { - Bool1d btrigc(kTrigend, false); + Bool1d btrigc(toInt(TriggerClass::End), false); registry.fill(HIST("Selection"), Fill1); auto z = collision.posZ(); auto pertracks = tSample3->sliceBy(perCol, collision.globalIndex()); @@ -374,13 +383,13 @@ struct DndetaHi { // if (collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { // if (collision.selection_bit(aod::evsel::kIsTriggerTVX)) { if (collision.sel8()) { - btrigc[kSel8] = true; + btrigc[toInt(TriggerClass::Sel8)] = true; registry.fill(HIST("Selection"), Fill2); if (std::abs(z) < CutZ) { registry.fill(HIST("Selection"), Fill3); } } - if (btrigc[kSel8] && std::abs(z) < CutZ) + if (btrigc[toInt(TriggerClass::Sel8)] && std::abs(z) < CutZ) registry.fill(HIST("hft0multiplicity"), collision.multFT0C()); for (const auto& track : pertracks) { @@ -390,10 +399,10 @@ struct DndetaHi { } if (nTrk > 0) { // registry.fill(HIST("Selection"), 3.); - if (btrigc[kSel8]) - btrigc[kSel8g0] = true; + if (btrigc[toInt(TriggerClass::Sel8)]) + btrigc[toInt(TriggerClass::Sel8g0)] = true; } - if (btrigc[kSel8g0]) + if (btrigc[toInt(TriggerClass::Sel8g0)]) registry.fill(HIST("reczINELg0Sel8"), z); auto cent = -1.f; @@ -407,29 +416,29 @@ struct DndetaHi { } if (isPbPb) { - if (std::abs(z) < CutZ && btrigc[kSel8]) + if (std::abs(z) < CutZ && btrigc[toInt(TriggerClass::Sel8)]) registry.fill(HIST("hcentrality"), cent); } else { - if (std::abs(z) < CutZ && btrigc[kSel8g0]) + if (std::abs(z) < CutZ && btrigc[toInt(TriggerClass::Sel8g0)]) registry.fill(HIST("hcentrality"), cent); - if (std::abs(z) < CutZ && btrigc[kSel8g0]) + if (std::abs(z) < CutZ && btrigc[toInt(TriggerClass::Sel8g0)]) registry.fill(HIST("hcentralityvscentraldndeta"), cent, nTrk); } - for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { + for (auto itrigc = 1u; itrigc < static_cast(TriggerClass::End); itrigc++) { if (btrigc[itrigc]) - registry.fill(HIST("hreczvtx"), double(kDATA), double(itrigc), z, cent); + registry.fill(HIST("hreczvtx"), toInt(EventCategory::Data), itrigc, z, cent); } for (const auto& track : pertracks) { - if (btrigc[kSel8] && std::abs(track.eta()) < CutEta08 && std::abs(z) < CutZ) + if (btrigc[toInt(TriggerClass::Sel8)] && std::abs(track.eta()) < CutEta08 && std::abs(z) < CutZ) registry.fill(HIST("hrecdndpt"), track.pt()); - if (btrigc[kSel8]) + if (btrigc[toInt(TriggerClass::Sel8)]) registry.fill(HIST("recetaINELg0Sel8recz10"), track.eta(), z); - for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { + for (auto itrigc = 1u; itrigc < static_cast(TriggerClass::End); itrigc++) { if (btrigc[itrigc]) { - registry.fill(HIST("hphieta"), double(kDATA), double(itrigc), track.phi(), track.eta(), cent); - registry.fill(HIST("hrecdndeta"), double(kDATA), double(itrigc), z, track.eta(), cent, double(kParDATA), track.phi()); + registry.fill(HIST("hphieta"), toInt(EventCategory::Data), itrigc, track.phi(), track.eta(), cent); + registry.fill(HIST("hrecdndeta"), toInt(EventCategory::Data), itrigc, z, track.eta(), cent, toInt(ParticleType::Data), track.phi()); } } } @@ -445,15 +454,15 @@ struct DndetaHi { const FiLTracks& tracks) { for (const auto& mcCollision : mcCollisions) { - Bool1d bevtc(kECend, false); - bevtc[kINEL] = true; + Bool1d bevtc(toInt(EventCategory::End), false); + bevtc[toInt(EventCategory::Inel)] = true; auto procId = mcCollision.processId(); if (procId == ProcIdND) { - bevtc[kND] = true; + bevtc[toInt(EventCategory::Nd)] = true; } else if (procId == ProcIdSD1 || procId == ProcIdSD2) { - bevtc[kSD] = true; + bevtc[toInt(EventCategory::Sd)] = true; } else if (procId == ProcIdDD1 || procId == ProcIdDD2) { - bevtc[kDD] = true; + bevtc[toInt(EventCategory::Dd)] = true; } registry.fill(HIST("Selection"), Fill1); @@ -476,15 +485,15 @@ struct DndetaHi { } if (nTrkGen > 0) { registry.fill(HIST("Selection"), Fill4); - bevtc[kINELg0] = true; + bevtc[toInt(EventCategory::Inelg0)] = true; } - if (bevtc[kINEL]) + if (bevtc[toInt(EventCategory::Inel)]) registry.fill(HIST("Selection"), Fill9); - if (bevtc[kINEL] && std::abs(mcz) < CutZ) + if (bevtc[toInt(EventCategory::Inel)] && std::abs(mcz) < CutZ) registry.fill(HIST("Selection"), Fill11); - if (bevtc[kINELg0]) + if (bevtc[toInt(EventCategory::Inelg0)]) registry.fill(HIST("Selection"), Fill10); - if (bevtc[kINELg0] && std::abs(mcz) < CutZ) + if (bevtc[toInt(EventCategory::Inelg0)] && std::abs(mcz) < CutZ) registry.fill(HIST("Selection"), Fill12); for (const auto& particle : particles) { if (!particle.isPhysicalPrimary()) @@ -492,7 +501,7 @@ struct DndetaHi { auto kp = pdg->GetParticle(particle.pdgCode()); if (kp != nullptr) { if (std::abs(kp->Charge()) >= CutCharge) { - if (bevtc[kINEL] && std::abs(particle.eta()) < CutEta08 && std::abs(mcz) < CutZ) { + if (bevtc[toInt(EventCategory::Inel)] && std::abs(particle.eta()) < CutEta08 && std::abs(mcz) < CutZ) { registry.fill(HIST("hgendndpt"), particle.pt()); if (particle.pt() < CutPt) { registry.fill(HIST("hgendndpt2"), particle.pt(), W1 * particle.pt() + W2); @@ -530,9 +539,9 @@ struct DndetaHi { } } } - for (auto ievtc = 1u; ievtc < kECend; ievtc++) { + for (auto ievtc = 1u; ievtc < static_cast(EventCategory::End); ievtc++) { if (bevtc[ievtc]) - registry.fill(HIST("hgenzvtx"), double(ievtc), genz, cent); + registry.fill(HIST("hgenzvtx"), ievtc, genz, cent); } int pid = 0; std::vector particleetas; @@ -545,35 +554,35 @@ struct DndetaHi { } switch (std::abs(particle.pdgCode())) { case 211: - pid = kPion; + pid = toInt(ParticleType::Pion); break; case 321: - pid = kKaon; + pid = toInt(ParticleType::Kaon); break; case 2212: - pid = kProtonMy; + pid = toInt(ParticleType::Proton); break; default: - pid = kOPar; + pid = toInt(ParticleType::Other); break; } if (p != nullptr) { if (std::abs(p->Charge()) >= CutCharge) { - for (auto ievtc = 1u; ievtc < kECend; ievtc++) { + for (auto ievtc = 1u; ievtc < static_cast(EventCategory::End); ievtc++) { if (bevtc[ievtc]) { - registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), cent, double(pid), kNoPtVar, particle.phi()); + registry.fill(HIST("hgendndeta"), ievtc, genz, particle.eta(), cent, pid, toInt(PtVariation::None), particle.phi()); if (particle.pt() < CutPt) { - registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), cent, double(pid), kPtUp, particle.phi(), W1 * particle.pt() + W2); - registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), cent, double(pid), kPtDw, particle.phi(), W3 * particle.pt() + W4); + registry.fill(HIST("hgendndeta"), ievtc, genz, particle.eta(), cent, pid, toInt(PtVariation::Up), particle.phi(), W1 * particle.pt() + W2); + registry.fill(HIST("hgendndeta"), ievtc, genz, particle.eta(), cent, pid, toInt(PtVariation::Down), particle.phi(), W3 * particle.pt() + W4); } else { - registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), cent, double(pid), kPtUp, particle.phi()); - registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), cent, double(pid), kPtDw, particle.phi()); + registry.fill(HIST("hgendndeta"), ievtc, genz, particle.eta(), cent, pid, toInt(PtVariation::Up), particle.phi()); + registry.fill(HIST("hgendndeta"), ievtc, genz, particle.eta(), cent, pid, toInt(PtVariation::Down), particle.phi()); } } } - if (pid >= kPion && pid <= kOPar) + if (pid >= toInt(ParticleType::Pion) && pid <= toInt(ParticleType::Other)) particleetas.push_back(particle.eta()); } } @@ -596,20 +605,20 @@ struct DndetaHi { // } } - Bool1d btrigc(kTrigend, false); + Bool1d btrigc(toInt(TriggerClass::End), false); auto z = collision.posZ(); // if (collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { // if (collision.selection_bit(aod::evsel::kIsTriggerTVX)) { if (collision.sel8()) { - btrigc[kSel8] = true; + btrigc[toInt(TriggerClass::Sel8)] = true; registry.fill(HIST("Selection"), Fill2); if (std::abs(z) < CutZ) { registry.fill(HIST("Selection"), Fill3); } } - if (bevtc[kINEL] && btrigc[kSel8] && std::abs(z) < CutZ) + if (bevtc[toInt(EventCategory::Inel)] && btrigc[toInt(TriggerClass::Sel8)] && std::abs(z) < CutZ) registry.fill(HIST("hft0multiplicity"), collision.multFT0C()); - if (collisionsample.size() == 1 && bevtc[kINELg0] && btrigc[kSel8]) { + if (collisionsample.size() == 1 && bevtc[toInt(EventCategory::Inelg0)] && btrigc[toInt(TriggerClass::Sel8)]) { for (const auto& eta : particleetas) { registry.fill(HIST("genetaINELg0Sel8recz10"), eta, z); registry.fill(HIST("genetaINELg0Sel8genz10"), eta, mcz); @@ -617,7 +626,7 @@ struct DndetaHi { registry.fill(HIST("reczINELg0Sel8"), z); registry.fill(HIST("genzINELg0Sel8"), genz); } - if (collisionsample.size() == 1 && bevtc[kINELg0]) { + if (collisionsample.size() == 1 && bevtc[toInt(EventCategory::Inelg0)]) { for (const auto& eta : particleetas) { registry.fill(HIST("genetaINELg0genz10"), eta, mcz); } @@ -633,85 +642,85 @@ struct DndetaHi { } if (nTrkRec > 0) { - if (btrigc[kSel8]) - btrigc[kSel8g0] = true; + if (btrigc[toInt(TriggerClass::Sel8)]) + btrigc[toInt(TriggerClass::Sel8g0)] = true; } if (isPbPb) { - if (std::abs(z) < CutZ && btrigc[kSel8]) + if (std::abs(z) < CutZ && btrigc[toInt(TriggerClass::Sel8)]) registry.fill(HIST("hcentrality"), cent); } else { - if (std::abs(z) < CutZ && btrigc[kSel8g0]) + if (std::abs(z) < CutZ && btrigc[toInt(TriggerClass::Sel8g0)]) registry.fill(HIST("hcentrality"), cent); } - if (bevtc[kINEL] && btrigc[kSel8]) + if (bevtc[toInt(EventCategory::Inel)] && btrigc[toInt(TriggerClass::Sel8)]) registry.fill(HIST("Selection"), Fill13); - if (bevtc[kINEL] && btrigc[kSel8] && std::abs(z) < CutZ) + if (bevtc[toInt(EventCategory::Inel)] && btrigc[toInt(TriggerClass::Sel8)] && std::abs(z) < CutZ) registry.fill(HIST("Selection"), Fill15); - if (bevtc[kINELg0] && btrigc[kSel8g0]) + if (bevtc[toInt(EventCategory::Inelg0)] && btrigc[toInt(TriggerClass::Sel8g0)]) registry.fill(HIST("Selection"), Fill14); - if (bevtc[kINELg0] && btrigc[kSel8g0] && std::abs(z) < CutZ) + if (bevtc[toInt(EventCategory::Inelg0)] && btrigc[toInt(TriggerClass::Sel8g0)] && std::abs(z) < CutZ) registry.fill(HIST("Selection"), Fill16); - for (auto ievtc = 1u; ievtc < kECend; ievtc++) { - for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { + for (auto ievtc = 1u; ievtc < static_cast(EventCategory::End); ievtc++) { + for (auto itrigc = 1u; itrigc < static_cast(TriggerClass::End); itrigc++) { if (bevtc[ievtc] && btrigc[itrigc]) { - registry.fill(HIST("hreczvtx"), double(ievtc), double(itrigc), z, cent); + registry.fill(HIST("hreczvtx"), ievtc, itrigc, z, cent); } } } std::vector mclabels; for (const auto& track : trackspart) { if (track.has_mcParticle()) { - int pid = kBkg; + int pid = toInt(ParticleType::Bkg); auto particle = track.template mcParticle_as(); if (particle.isPhysicalPrimary()) { switch (std::abs(particle.pdgCode())) { case 211: - pid = kPion; + pid = toInt(ParticleType::Pion); break; case 321: - pid = kKaon; + pid = toInt(ParticleType::Kaon); break; case 2212: - pid = kProtonMy; + pid = toInt(ParticleType::Proton); break; default: - pid = kOPar; + pid = toInt(ParticleType::Other); break; } } else { - pid = kNotPrimary; + pid = toInt(ParticleType::NotPrimary); } for (auto motherIds = particle.mothersIds().front(); motherIds <= particle.mothersIds().back(); motherIds++) { auto mother = mcParticles.rawIteratorAt(motherIds); auto pdg_mother = mother.pdgCode(); if (pdg_mother == kK0Short || std::abs(pdg_mother) == kLambda0) { - pid = kMotherStrange; + pid = toInt(ParticleType::MotherStrange); } } if (find(mclabels.begin(), mclabels.end(), track.mcParticleId()) != mclabels.end()) - pid = kBkg; + pid = toInt(ParticleType::Bkg); mclabels.push_back(track.mcParticleId()); registry.fill(HIST("hetaresponse"), particle.eta(), track.eta(), cent); - if (bevtc[kINEL] && btrigc[kSel8] && std::abs(track.eta()) < CutEta08 && std::abs(z) < CutZ && pid != kBkg && pid != kNotPrimary) + if (bevtc[toInt(EventCategory::Inel)] && btrigc[toInt(TriggerClass::Sel8)] && std::abs(track.eta()) < CutEta08 && std::abs(z) < CutZ && pid != toInt(ParticleType::Bkg) && pid != toInt(ParticleType::NotPrimary)) registry.fill(HIST("hdndptefficiency"), particle.pt()); - if (btrigc[kSel8] && bevtc[kINELg0]) + if (btrigc[toInt(TriggerClass::Sel8)] && bevtc[toInt(EventCategory::Inelg0)]) registry.fill(HIST("recetaINELg0Sel8recz10"), track.eta(), z); - for (auto ievtc = 1u; ievtc < kECend; ievtc++) { - for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { + for (auto ievtc = 1u; ievtc < static_cast(EventCategory::End); ievtc++) { + for (auto itrigc = 1u; itrigc < static_cast(TriggerClass::End); itrigc++) { if (bevtc[ievtc] && btrigc[itrigc]) { - registry.fill(HIST("hrecdndeta"), double(ievtc), double(itrigc), z, particle.eta(), cent, double(pid), particle.phi()); - registry.fill(HIST("hphieta"), double(ievtc), double(itrigc), track.phi(), track.eta(), cent); + registry.fill(HIST("hrecdndeta"), ievtc, itrigc, z, particle.eta(), cent, pid, particle.phi()); + registry.fill(HIST("hphieta"), ievtc, itrigc, track.phi(), track.eta(), cent); } } } } else { - for (auto ievtc = 1u; ievtc < kECend; ievtc++) { - for (auto itrigc = 1u; itrigc < kTrigend; itrigc++) { + for (auto ievtc = 1u; ievtc < static_cast(EventCategory::End); ievtc++) { + for (auto itrigc = 1u; itrigc < static_cast(TriggerClass::End); itrigc++) { if (bevtc[ievtc] && btrigc[itrigc]) { - registry.fill(HIST("hrecdndeta"), double(ievtc), double(itrigc), z, track.eta(), cent, double(kBkg), track.phi()); + registry.fill(HIST("hrecdndeta"), ievtc, itrigc, z, track.eta(), cent, toInt(ParticleType::Bkg), track.phi()); } } } @@ -755,8 +764,8 @@ struct DndetaHi { { auto genz = mcCollision.posZ(); - Bool1d bevtc(kECend, false); - bevtc[kINEL] = true; + Bool1d bevtc(toInt(EventCategory::End), false); + bevtc[toInt(EventCategory::Inel)] = true; for (const auto& particle : mcParticles) { if (!particle.isPhysicalPrimary()) continue; @@ -764,13 +773,13 @@ struct DndetaHi { if (p != nullptr) { if (std::abs(p->Charge()) >= CutCharge) { if (std::abs(particle.eta()) < CutEta1) - bevtc[kINELg0] = true; + bevtc[toInt(EventCategory::Inelg0)] = true; } } } - for (auto ievtc = 1u; ievtc < kECend; ievtc++) { + for (auto ievtc = 1u; ievtc < static_cast(EventCategory::End); ievtc++) { if (bevtc[ievtc]) - registry.fill(HIST("hgenzvtx"), double(ievtc), genz, FillM1); + registry.fill(HIST("hgenzvtx"), ievtc, genz, FillM1); } int pid = 0; for (const auto& particle : mcParticles) { @@ -782,31 +791,31 @@ struct DndetaHi { } switch (std::abs(particle.pdgCode())) { case 211: - pid = kPion; + pid = toInt(ParticleType::Pion); break; case 321: - pid = kKaon; + pid = toInt(ParticleType::Kaon); break; case 2212: - pid = kProtonMy; + pid = toInt(ParticleType::Proton); break; default: - pid = kOPar; + pid = toInt(ParticleType::Other); break; } if (p != nullptr) { if (std::abs(p->Charge()) >= CutCharge) { - for (auto ievtc = 1u; ievtc < kECend; ievtc++) { + for (auto ievtc = 1u; ievtc < static_cast(EventCategory::End); ievtc++) { if (bevtc[ievtc]) { - registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), FillM1, double(pid), kNoPtVar, particle.phi()); + registry.fill(HIST("hgendndeta"), ievtc, genz, particle.eta(), FillM1, pid, toInt(PtVariation::None), particle.phi()); if (particle.pt() < CutPt) { - registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), FillM1, double(pid), kPtUp, particle.phi(), W2); - registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), FillM1, double(pid), kPtDw, particle.phi(), W4); + registry.fill(HIST("hgendndeta"), ievtc, genz, particle.eta(), FillM1, pid, toInt(PtVariation::Up), particle.phi(), W2); + registry.fill(HIST("hgendndeta"), ievtc, genz, particle.eta(), FillM1, pid, toInt(PtVariation::Down), particle.phi(), W4); } else { - registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), FillM1, double(pid), kPtUp, particle.phi()); - registry.fill(HIST("hgendndeta"), double(ievtc), genz, particle.eta(), FillM1, double(pid), kPtDw, particle.phi()); + registry.fill(HIST("hgendndeta"), ievtc, genz, particle.eta(), FillM1, pid, toInt(PtVariation::Up), particle.phi()); + registry.fill(HIST("hgendndeta"), ievtc, genz, particle.eta(), FillM1, pid, toInt(PtVariation::Down), particle.phi()); } } } @@ -857,9 +866,9 @@ struct DndetaHi { if (std::fabs(v0.eta()) < CutEta05) registry.fill(HIST("hv0k0s"), v0.mK0Short()); - registry.fill(HIST("hv0mass"), cent, double(kK0short), v0.eta(), double(v0.mK0Short())); - registry.fill(HIST("hv0mass"), cent, double(kLambda), v0.eta(), double(v0.mLambda())); - registry.fill(HIST("hv0mass"), cent, double(kAntilambda), v0.eta(), double(v0.mAntiLambda())); + registry.fill(HIST("hv0mass"), cent, toInt(Species::K0short), v0.eta(), v0.mK0Short()); + registry.fill(HIST("hv0mass"), cent, toInt(Species::Lambda), v0.eta(), v0.mLambda()); + registry.fill(HIST("hv0mass"), cent, toInt(Species::Antilambda), v0.eta(), v0.mAntiLambda()); } } } @@ -870,41 +879,16 @@ struct DndetaHi { const soa::Join& collisions, const aod::McCollisions& /*mcCollisions*/, const Particles& /*mcParticles*/, - const soa::Filtered& fullV0s, + const soa::Filtered& /*fullV0s*/, const soa::Filtered& /*tracks*/, const DaughterTracks& /*dauTrks*/) { for (const auto& collision : collisions) { - auto cent = -1.f; - - if (isPbPb) { - if constexpr (MyCollisionsCent::template contains()) - cent = collision.centFT0C(); - } else { - if constexpr (MyCollisionsCent::template contains()) - cent = collision.centFT0M(); - } - if (useEvSel && !collision.sel8()) // event selection cut continue; if (!collision.has_mcCollision()) // check mc particle continue; - for (const auto& v0 : fullV0s) { - - auto pTrack = v0.template posTrack_as(); - auto nTrack = v0.template negTrack_as(); - - if (0 && v0.v0radius() > v0Radius && - v0.v0cosPA() > v0CosPA && - std::abs(pTrack.eta()) < etaDau && - std::abs(nTrack.eta()) < etaDau) { - - registry.fill(HIST("hv0mass"), cent, double(kK0short), v0.eta(), double(v0.mK0Short())); - registry.fill(HIST("hv0mass"), cent, double(kLambda), v0.eta(), double(v0.mLambda())); - registry.fill(HIST("hv0mass"), cent, double(kAntilambda), v0.eta(), double(v0.mAntiLambda())); - } - } } } PROCESS_SWITCH(DndetaHi, processMCV0Counting, "MC V0Count tracks without Centrality", false);