From 2a9ec158476db73d66fda1c9cd8c710a786990df Mon Sep 17 00:00:00 2001 From: Omar Vazquez Rueda Date: Fri, 17 Jul 2026 08:03:55 -0600 Subject: [PATCH] Charge-dependent analysis + fixes warnings --- PWGLF/Tasks/Nuspex/piKpRAA.cxx | 444 +++++++++++++++++++++------------ 1 file changed, 283 insertions(+), 161 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/piKpRAA.cxx b/PWGLF/Tasks/Nuspex/piKpRAA.cxx index 76160372514..2ca5f0ec7e9 100644 --- a/PWGLF/Tasks/Nuspex/piKpRAA.cxx +++ b/PWGLF/Tasks/Nuspex/piKpRAA.cxx @@ -60,6 +60,7 @@ #include #include #include +#include #include #include @@ -324,7 +325,7 @@ struct PiKpRAA { }; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - Service ccdb; + Service ccdb{}; struct ConfigDCA { TH1F* hDCAxy = nullptr; @@ -345,7 +346,7 @@ struct PiKpRAA { bool isCalPlateauLoaded = false; } etaCal; - int currentRunNumberPhiSel; + int currentRunNumberPhiSel = -1; void init(InitContext const&) { @@ -641,14 +642,15 @@ struct PiKpRAA { const int magField{getMagneticField(timeStamp)}; const double nPV{collision.multNTracksPVeta1() / 1.}; float centrality{-999.0}; - if (centralitySelector.value == "FT0C") + if (centralitySelector.value == "FT0C") { centrality = collision.centFT0C(); - else if (centralitySelector.value == "FT0M") + } else if (centralitySelector.value == "FT0M") { centrality = collision.centFT0M(); - else if (centralitySelector.value == "FV0A") + } else if (centralitySelector.value == "FV0A") { centrality = collision.centFV0A(); - else + } else { centrality = -999.0; + } // Apply RCT selection? if (requireGoodRct) { @@ -663,38 +665,49 @@ struct PiKpRAA { const bool isTPCLimAcc{requireBCRct ? foundBC.rct_bit(kTPCLimAccMCRepr) : collision.rct_bit(kTPCLimAccMCRepr)}; registry.fill(HIST("CentralityVsRCTSel"), centrality, 1.0); - if (!isFT0Bad) + if (!isFT0Bad) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 2.0); - if (!isITSBad) + } + if (!isITSBad) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 3.0); - if (!isITSLimAcc) + } + if (!isITSLimAcc) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 4.0); - if (!isTOFBad) + } + if (!isTOFBad) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 5.0); - if (!isTOFLimAcc) + } + if (!isTOFLimAcc) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 6.0); - if (!isTPCTrackingBad) + } + if (!isTPCTrackingBad) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 7.0); - if (!isTPCPIDBad) + } + if (!isTPCPIDBad) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 8.0); - if (!isTPCLimAcc) + } + if (!isTPCLimAcc) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 9.0); + } registry.fill(HIST("RCTSel"), 1.0); - if (!rctChecker(collision)) + if (!rctChecker(collision)) { return; + } registry.fill(HIST("RCTSel"), 2.0); } - if (!isEventSelected(collision)) + if (!isEventSelected(collision)) { return; + } //--------------------------- // Control histogram //--------------------------- - if (selHasFT0 && !collision.has_foundFT0()) + if (selHasFT0 && !collision.has_foundFT0()) { registry.fill(HIST("CentralityVsFoundFT0"), centrality, 0.5); + } registry.fill(HIST("CentralityVsFoundFT0"), centrality, 1.5); @@ -710,8 +723,9 @@ struct PiKpRAA { } // return if phi cut objects are nullptr - if (!(phiCut.hPhiCutHigh && phiCut.hPhiCutLow)) + if (!(phiCut.hPhiCutHigh && phiCut.hPhiCutLow)) { return; + } } registry.fill(HIST("zPos"), collision.posZ()); @@ -724,8 +738,9 @@ struct PiKpRAA { for (const auto& track : tracks) { const bool applyDca{false}; - if (!selectPrimary(track, applyDca)) + if (!selectPrimary(track, applyDca)) { continue; + } const int charge{track.sign()}; const float momentum{track.p()}; @@ -736,17 +751,19 @@ struct PiKpRAA { const float pOrpTPC{trackSelections.usePinPhiSelection ? momentum : pTPC}; // Reject track on the basis of its charge - if (trackSelections.signCharge.value == "Positive" && charge < KzeroInt) + if (trackSelections.signCharge.value == "Positive" && charge < KzeroInt) { continue; - if (trackSelections.signCharge.value == "Negative" && charge > KzeroInt) + } + if (trackSelections.signCharge.value == "Negative" && charge > KzeroInt) { continue; + } float phiPrime{phi}; - phiPrimeFunc(phiPrime, magField, charge); - if (trackSelections.applyPhiCut) { - if (!passesPhiSelection(pOrpTPC, phiPrime)) + phiPrimeFunc(phiPrime, magField, charge); + if (!passesPhiSelection(pOrpTPC, phiPrime)) { continue; + } } const float piTPCNsigma{std::fabs(track.tpcNSigmaPi())}; @@ -756,10 +773,12 @@ struct PiKpRAA { const double piRadiusNsigma{std::sqrt(std::pow(piTPCNsigma, 2.) + std::pow(piTOFNsigma, 2.))}; const double prRadiusNsigma{std::sqrt(std::pow(prTPCNsigma, 2.) + std::pow(prTOFNsigma, 2.))}; - if (piRadiusNsigma < Kthree) + if (piRadiusNsigma < Kthree) { registry.fill(HIST("dcaVsPtPi"), pt, dcaXy, centrality); - if (prRadiusNsigma < Kthree) + } + if (prRadiusNsigma < Kthree) { registry.fill(HIST("dcaVsPtPr"), pt, dcaXy, centrality); + } } // ================ @@ -780,32 +799,36 @@ struct PiKpRAA { const int16_t ncl{trackSelections.useNclsPID ? nclPID : nclFound}; // Reject track on the basis of its charge - if (trackSelections.signCharge.value == "Positive" && charge < KzeroInt) + if (trackSelections.signCharge.value == "Positive" && charge < KzeroInt) { continue; - if (trackSelections.signCharge.value == "Negative" && charge > KzeroInt) + } + if (trackSelections.signCharge.value == "Negative" && charge > KzeroInt) { continue; + } // ================ // DCAxy & DCAz Selections // ================ const bool applyDca{true}; - if (!selectPrimary(track, applyDca)) + if (!selectPrimary(track, applyDca)) { continue; + } float phiPrime{phi}; - phiPrimeFunc(phiPrime, magField, charge); - if (trackSelections.applyPhiCut) { - if (!passesPhiSelection(pOrpTPC, phiPrime)) + phiPrimeFunc(phiPrime, magField, charge); + if (!passesPhiSelection(pOrpTPC, phiPrime)) { continue; + } } if (trackSelections.applyEtaCal && etaCal.isMIPCalLoaded) { const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(eta))}; - if (dedxCal > KmindEdxMIP && dedxCal < KmaxdEdxMIP) + if (dedxCal > KmindEdxMIP && dedxCal < KmaxdEdxMIP) { dedx *= (50.0 / dedxCal); - else + } else { continue; + } } int indexEta{-999}; @@ -816,8 +839,9 @@ struct PiKpRAA { } } - if (indexEta < KzeroInt || indexEta > KsevenInt) + if (indexEta < KzeroInt || indexEta > KsevenInt) { continue; + } if (momentum > KminPMIP && momentum < KmaxPMIP && dedx > KmindEdxMIP && dedx < KmaxdEdxMIP) { registry.fill(HIST("dEdxVsEtaPiMIP"), eta, dedx); @@ -884,8 +908,9 @@ struct PiKpRAA { for (const auto& v0 : v0s) { // Select V0 type - if (v0.v0Type() != v0Selections.v0TypeSelection) + if (v0.v0Type() != v0Selections.v0TypeSelection) { continue; + } // Positive-(negative-)charged tracks (daughters) const auto& posTrack = v0.posTrack_as(); @@ -910,58 +935,65 @@ struct PiKpRAA { const int16_t negNclPID{negTrack.tpcNClsPID()}; const int16_t posNcl{trackSelections.useNclsPID ? posNclPID : posNclFound}; const int16_t negNcl{trackSelections.useNclsPID ? negNclPID : negNclFound}; - - phiPrimeFunc(posTrackPhiPrime, magField, posTrackCharge); - phiPrimeFunc(negTrackPhiPrime, magField, negTrackCharge); const float posPorPTPC{trackSelections.usePinPhiSelection ? posTrkP : posTrkPTPC}; const float negPorPTPC{trackSelections.usePinPhiSelection ? negTrkP : negTrkPTPC}; // Skip v0s with like-sig daughters - if (posTrack.sign() == negTrack.sign()) + if (posTrack.sign() == negTrack.sign()) { continue; + } // Passes Geometrical (Phi) cut? if (trackSelections.applyPhiCut) { - if (!(passesPhiSelection(posPorPTPC, posTrackPhiPrime) && passesPhiSelection(negPorPTPC, negTrackPhiPrime))) + phiPrimeFunc(posTrackPhiPrime, magField, posTrackCharge); + phiPrimeFunc(negTrackPhiPrime, magField, negTrackCharge); + if (!(passesPhiSelection(posPorPTPC, posTrackPhiPrime) && passesPhiSelection(negPorPTPC, negTrackPhiPrime))) { continue; + } } // Passes daughters track-selection? - if (!(selectV0Daughter(posTrack) && selectV0Daughter(negTrack))) + if (!(selectV0Daughter(posTrack) && selectV0Daughter(negTrack))) { continue; + } // Eta calibration positive-charge track if (trackSelections.applyEtaCal && etaCal.isMIPCalLoaded) { const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(posTrkEta))}; - if (dedxCal > KmindEdxMIP && dedxCal < KmaxdEdxMIP) + if (dedxCal > KmindEdxMIP && dedxCal < KmaxdEdxMIP) { posTrkdEdx *= (50.0 / dedxCal); - else + } else { continue; + } } // Eta calibration negative-charge track if (trackSelections.applyEtaCal && etaCal.isMIPCalLoaded) { const double dedxCal{etaCal.pEtaCal->GetBinContent(etaCal.pEtaCal->FindBin(negTrkEta))}; - if (dedxCal > KmindEdxMIP && dedxCal < KmaxdEdxMIP) + if (dedxCal > KmindEdxMIP && dedxCal < KmaxdEdxMIP) { negTrkdEdx *= (50.0 / dedxCal); - else + } else { continue; + } } const TVector3 ppos(posTrack.px(), posTrack.py(), posTrack.pz()); const TVector3 pneg(negTrack.px(), negTrack.py(), negTrack.pz()); - double alpha, qT; + double alpha{-999.0}; + double qT{-999.0}; getArmeterosVariables(ppos, pneg, alpha, qT); registry.fill(HIST("ArmAll"), alpha, qT); bool passesTopoSel{false}; // Passes V0 topological cuts? - if (passesV0TopologicalSelection(v0)) + if (passesV0TopologicalSelection(v0)) { passesTopoSel = true; + } - if (!passesTopoSel) + if (!passesTopoSel) { continue; + } int posIndexEta{-999}; int negIndexEta{-999}; @@ -979,11 +1011,13 @@ struct PiKpRAA { } } - if (posIndexEta < KzeroInt || posIndexEta > KsevenInt) + if (posIndexEta < KzeroInt || posIndexEta > KsevenInt) { continue; + } - if (negIndexEta < KzeroInt || negIndexEta > KsevenInt) + if (negIndexEta < KzeroInt || negIndexEta > KsevenInt) { continue; + } registry.fill(HIST("ArmAfterTopoSel"), alpha, qT); registry.fill(HIST("dcaDauVsPt"), v0.pt(), v0.dcapostopv()); @@ -1109,7 +1143,8 @@ struct PiKpRAA { registry.fill(HIST("NclVsEtaPiV0p"), posTrkEta, posNcl); nClVsPpPiV0[posIndexEta]->Fill(posPorPTPC, posNcl); dEdxPiV0[posIndexEta]->Fill(posPorPTPC, posTrkdEdx); - } else if (negTrackCharge < KzeroInt) { + } + if (negTrackCharge < KzeroInt) { registry.fill(HIST("nSigPrFromAL"), negTrkPt, negTrack.tpcNSigmaPr()); registry.fill(HIST("NclVsEtaPrV0"), negTrkEta, negNcl); registry.fill(HIST("NclVsEtaPrV0p"), negTrkEta, negNcl); @@ -1126,8 +1161,9 @@ struct PiKpRAA { if (trackSelections.applyPlateauSel && etaCal.isCalPlateauLoaded) { const double posDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(posTrkEta))}; const double negDedxCal{etaCal.pEtaCalPlateau->GetBinContent(etaCal.pEtaCalPlateau->FindBin(negTrkEta))}; - if (!(std::abs(posTrkdEdx - posDedxCal) < v0Selections.dEdxPlateauSel && std::abs(negTrkdEdx - negDedxCal) < v0Selections.dEdxPlateauSel)) + if (!(std::abs(posTrkdEdx - posDedxCal) < v0Selections.dEdxPlateauSel && std::abs(negTrkdEdx - negDedxCal) < v0Selections.dEdxPlateauSel)) { continue; + } } registry.fill(HIST("V0sCounter"), V0sCounter::Gamma); @@ -1145,7 +1181,7 @@ struct PiKpRAA { registry.fill(HIST("dEdxVsEtaElMIPV0p"), posTrkEta, posTrkdEdx); } dEdxElV0[posIndexEta]->Fill(posPorPTPC, posTrkdEdx); - } else if (trackSelections.signCharge.value == "Positive" && posTrackCharge > KzeroInt) { + } else if (trackSelections.signCharge.value == "Negative" && negTrackCharge < KzeroInt) { registry.fill(HIST("nSigElFromG"), negTrkPt, negTrack.tpcNSigmaEl()); registry.fill(HIST("NclVsEtaElV0"), negTrkEta, negNcl); registry.fill(HIST("NclVsEtaElV0p"), negTrkEta, negNcl); @@ -1213,18 +1249,22 @@ struct PiKpRAA { } // Is it a charged particle? - if (std::abs(charge) < KminCharge) + if (std::abs(charge) < KminCharge) { continue; + } // Select particle based on its charge - if (trackSelections.signCharge.value == "Positive" && charge < Kzero) + if (trackSelections.signCharge.value == "Positive" && charge < Kzero) { continue; - if (trackSelections.signCharge.value == "Negative" && charge > Kzero) + } + if (trackSelections.signCharge.value == "Negative" && charge > Kzero) { continue; + } // Is it a primary particle? - if (!particle.isPhysicalPrimary()) + if (!particle.isPhysicalPrimary()) { continue; + } const float eta{particle.eta()}; @@ -1242,8 +1282,9 @@ struct PiKpRAA { } // INEL > 0 - if (std::abs(eta) > Kone) + if (std::abs(eta) > Kone) { continue; + } nChMC++; } @@ -1283,11 +1324,13 @@ struct PiKpRAA { // Also for MC closure: True Pt vs Generated Nch //--------------------------- for (const auto& particle : mcParticles) { - if (particle.eta() < trackSelections.minEta || particle.eta() > trackSelections.maxEta) + if (particle.eta() < trackSelections.minEta || particle.eta() > trackSelections.maxEta) { continue; + } - if (particle.pt() < trackSelections.minPt || particle.pt() > trackSelections.maxPt) + if (particle.pt() < trackSelections.minPt || particle.pt() > trackSelections.maxPt) { continue; + } auto charge{0.}; // Get the MC particle @@ -1299,19 +1342,23 @@ struct PiKpRAA { } // Is it a charged particle? - if (std::abs(charge) < KminCharge) + if (std::abs(charge) < KminCharge) { continue; + } // Select particle based on its charge - if (trackSelections.signCharge.value == "Positive" && charge < Kzero) + if (trackSelections.signCharge.value == "Positive" && charge < Kzero) { continue; - if (trackSelections.signCharge.value == "Negative" && charge > Kzero) + } + if (trackSelections.signCharge.value == "Negative" && charge > Kzero) { continue; + } // Is it a primary particle? bool isPrimary{true}; - if (!particle.isPhysicalPrimary()) + if (!particle.isPhysicalPrimary()) { isPrimary = false; + } if (isPrimary) { if (particle.pdgCode() == PDG_t::kPiPlus || particle.pdgCode() == PDG_t::kPiMinus) { @@ -1355,14 +1402,15 @@ struct PiKpRAA { for (const auto& collision : collisions) { float centrality{-999.0}; - if (centralitySelector.value == "FT0C") + if (centralitySelector.value == "FT0C") { centrality = collision.centFT0C(); - else if (centralitySelector.value == "FT0M") + } else if (centralitySelector.value == "FT0M") { centrality = collision.centFT0M(); - else if (centralitySelector.value == "FV0A") + } else if (centralitySelector.value == "FV0A") { centrality = collision.centFV0A(); - else + } else { centrality = -999.0; + } if (selHasFT0 && !collision.has_foundFT0()) { continue; @@ -1373,33 +1421,41 @@ struct PiKpRAA { bestCollisionIndex = collision.globalIndex(); } - if (selHasBC && !collision.has_foundBC()) + if (selHasBC && !collision.has_foundBC()) { continue; + } - if (useSel8 && !collision.sel8()) + if (useSel8 && !collision.sel8()) { continue; + } // kIsTriggerTVX - if (selTriggerTVX && !collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) + if (selTriggerTVX && !collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { continue; + } // kNoITSROFrameBorder - if (selNoITSROFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) + if (selNoITSROFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { continue; + } // kNoTimeFrameBorder - if (selNoTimeFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) + if (selNoTimeFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { continue; + } // Zvtx - if (isZvtxPosSel && std::fabs(collision.posZ()) > posZcut) + if (isZvtxPosSel && std::fabs(collision.posZ()) > posZcut) { continue; + } - if (selIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + if (selIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { continue; + } - if (selNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + if (selNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { continue; + } //--------------------------- // Needed to calculate denominator of the Event Splitting correction @@ -1414,25 +1470,27 @@ struct PiKpRAA { for (const auto& collision : collisions) { float centrality{-999.0}; - if (centralitySelector.value == "FT0C") + if (centralitySelector.value == "FT0C") { centrality = collision.centFT0C(); - else if (centralitySelector.value == "FT0M") + } else if (centralitySelector.value == "FT0M") { centrality = collision.centFT0M(); - else if (centralitySelector.value == "FV0A") + } else if (centralitySelector.value == "FV0A") { centrality = collision.centFV0A(); - else + } else { centrality = -999.0; + } //--------------------------- // Pick the collisions with the largest number of contributors //--------------------------- - if (bestCollisionIndex != collision.globalIndex()) + if (bestCollisionIndex != collision.globalIndex()) { continue; + } // Needed to load the Phi selection from the CCDB const auto& foundBC = collision.foundBC_as(); uint64_t timeStamp{foundBC.timestamp()}; - const int magField{getMagneticField(timeStamp)}; + // const int magField{getMagneticField(timeStamp)}; if (trackSelections.applyPhiCut) { const int nextRunNumber{foundBC.runNumber()}; @@ -1443,8 +1501,9 @@ struct PiKpRAA { } // return if phi cut objects are nullptr - if (!(phiCut.hPhiCutHigh && phiCut.hPhiCutLow)) + if (!(phiCut.hPhiCutHigh && phiCut.hPhiCutLow)) { return; + } } //--------------------------- @@ -1486,26 +1545,35 @@ struct PiKpRAA { const bool isTPCLimAcc{requireBCRct ? foundBC.rct_bit(kTPCLimAccMCRepr) : collision.rct_bit(kTPCLimAccMCRepr)}; registry.fill(HIST("CentralityVsRCTSel"), centrality, 1.0); - if (!isFT0Bad) + if (!isFT0Bad) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 2.0); - if (!isITSBad) + } + if (!isITSBad) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 3.0); - if (!isITSLimAcc) + } + if (!isITSLimAcc) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 4.0); - if (!isTOFBad) + } + if (!isTOFBad) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 5.0); - if (!isTOFLimAcc) + } + if (!isTOFLimAcc) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 6.0); - if (!isTPCTrackingBad) + } + if (!isTPCTrackingBad) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 7.0); - if (!isTPCPIDBad) + } + if (!isTPCPIDBad) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 8.0); - if (!isTPCLimAcc) + } + if (!isTPCLimAcc) { registry.fill(HIST("CentralityVsRCTSel"), centrality, 9.0); + } registry.fill(HIST("RCTSel"), 1.0); - if (!rctChecker(collision)) + if (!rctChecker(collision)) { return; + } registry.fill(HIST("RCTSel"), 2.0); } @@ -1513,8 +1581,9 @@ struct PiKpRAA { //--------------------------- // Event Selection //--------------------------- - if (!isEventSelected(collision)) + if (!isEventSelected(collision)) { return; + } registry.fill(HIST("Centrality_WRecoEvtWSelCri"), centrality); registry.fill(HIST("NchMCVsCent"), centrality, nChMCTPCAcc); @@ -1531,10 +1600,11 @@ struct PiKpRAA { registry.fill(HIST("HasBCVsFT0VsTVXVsEvSel"), 5.0); } - if (collision.has_foundFT0()) + if (collision.has_foundFT0()) { registry.fill(HIST("CentralityVsFoundFT0"), centrality, 1.5); - else + } else { registry.fill(HIST("CentralityVsFoundFT0"), centrality, 0.5); + } //--------------------------- // All Generated events with at least one associated reconstructed collision @@ -1543,11 +1613,13 @@ struct PiKpRAA { // This histograms are used for the denominator of the tracking efficiency //--------------------------- for (const auto& particle : mcParticles) { - if (particle.eta() < trackSelections.minEta || particle.eta() > trackSelections.maxEta) + if (particle.eta() < trackSelections.minEta || particle.eta() > trackSelections.maxEta) { continue; + } - if (particle.pt() < trackSelections.minPt || particle.pt() > trackSelections.maxPt) + if (particle.pt() < trackSelections.minPt || particle.pt() > trackSelections.maxPt) { continue; + } auto charge{0.}; // Get the MC particle @@ -1559,19 +1631,23 @@ struct PiKpRAA { } // Is it a charged particle? - if (std::abs(charge) < KminCharge) + if (std::abs(charge) < KminCharge) { continue; + } // Select particle based on its charge - if (trackSelections.signCharge.value == "Positive" && charge < Kzero) + if (trackSelections.signCharge.value == "Positive" && charge < Kzero) { continue; - if (trackSelections.signCharge.value == "Negative" && charge > Kzero) + } + if (trackSelections.signCharge.value == "Negative" && charge > Kzero) { continue; + } // Is it a primary particle? bool isPrimary{true}; - if (!particle.isPhysicalPrimary()) + if (!particle.isPhysicalPrimary()) { isPrimary = false; + } if (isPrimary) { if (particle.pdgCode() == PDG_t::kPiPlus || particle.pdgCode() == PDG_t::kPiMinus) { @@ -1598,11 +1674,13 @@ struct PiKpRAA { for (const auto& track : groupedTracks) { const bool applyDca{false}; - if (!selectPrimary(track, applyDca)) + if (!selectPrimary(track, applyDca)) { continue; + } - if (!track.has_mcParticle()) + if (!track.has_mcParticle()) { continue; + } // Get the MC particle const auto& particle{track.mcParticle()}; @@ -1615,20 +1693,23 @@ struct PiKpRAA { } // Is it a charged particle? - if (std::abs(charge) < KminCharge) + if (std::abs(charge) < KminCharge) { continue; + } // Select particle based on its charge - if (trackSelections.signCharge.value == "Positive" && charge < Kzero) + if (trackSelections.signCharge.value == "Positive" && charge < Kzero) { continue; - if (trackSelections.signCharge.value == "Negative" && charge > Kzero) + } + if (trackSelections.signCharge.value == "Negative" && charge > Kzero) { continue; + } registry.fill(HIST("DCAxyVsPt"), track.pt(), track.dcaXY()); registry.fill(HIST("DCAzVsPt"), track.pt(), track.dcaZ()); - float phiPrime{track.phi()}; - phiPrimeFunc(phiPrime, magField, charge); + // float phiPrime{track.phi()}; + // phiPrimeFunc(phiPrime, magField, charge); bool isPrimary{false}; bool isDecay{false}; @@ -1652,24 +1733,30 @@ struct PiKpRAA { } if (isPrimary && !isDecay && !isMaterial) { - if (isPi && !isPr) + if (isPi && !isPr) { registry.fill(HIST("dcaVsPtPi"), track.pt(), track.dcaXY(), centrality); - if (isPr && !isPi) + } + if (isPr && !isPi) { registry.fill(HIST("dcaVsPtPr"), track.pt(), track.dcaXY(), centrality); + } } if (isDecay && !isPrimary && !isMaterial) { - if (isPi && !isPr) + if (isPi && !isPr) { registry.fill(HIST("dcaVsPtPiDec"), track.pt(), track.dcaXY(), centrality); - if (isPr && !isPi) + } + if (isPr && !isPi) { registry.fill(HIST("dcaVsPtPrDec"), track.pt(), track.dcaXY(), centrality); + } } if (isMaterial && !isPrimary && !isDecay) { - if (isPi && !isPr) + if (isPi && !isPr) { registry.fill(HIST("dcaVsPtPiMat"), track.pt(), track.dcaXY(), centrality); - if (isPr && !isPi) + } + if (isPr && !isPi) { registry.fill(HIST("dcaVsPtPrMat"), track.pt(), track.dcaXY(), centrality); + } } } @@ -1681,12 +1768,14 @@ struct PiKpRAA { for (const auto& track : groupedTracks) { const bool applyDca{true}; - if (!selectPrimary(track, applyDca)) + if (!selectPrimary(track, applyDca)) { continue; + } // Has MC particle? - if (!track.has_mcParticle()) + if (!track.has_mcParticle()) { continue; + } // Get the MC particle const auto& particle{track.mcParticle()}; @@ -1699,17 +1788,20 @@ struct PiKpRAA { } // Is it a charged particle? - if (std::abs(charge) < KminCharge) + if (std::abs(charge) < KminCharge) { continue; + } // Select particle based on its charge - if (trackSelections.signCharge.value == "Positive" && charge < Kzero) + if (trackSelections.signCharge.value == "Positive" && charge < Kzero) { continue; - if (trackSelections.signCharge.value == "Negative" && charge > Kzero) + } + if (trackSelections.signCharge.value == "Negative" && charge > Kzero) { continue; + } - float phiPrime{track.phi()}; - phiPrimeFunc(phiPrime, magField, charge); + // float phiPrime{track.phi()}; + // phiPrimeFunc(phiPrime, magField, charge); int indexEta{-999}; const float eta{track.eta()}; @@ -1720,8 +1812,9 @@ struct PiKpRAA { } } - if (indexEta < KzeroInt || indexEta > KsevenInt) + if (indexEta < KzeroInt || indexEta > KsevenInt) { continue; + } nCh++; @@ -1737,16 +1830,17 @@ struct PiKpRAA { registry.fill(HIST("NclVsEtaPIDp"), track.eta(), track.tpcNClsPID()); bool isPrimary{false}; - if (particle.isPhysicalPrimary()) + if (particle.isPhysicalPrimary()) { isPrimary = true; + } - if (!isPrimary) + if (!isPrimary) { continue; + } bool isPi{false}; bool isKa{false}; bool isPr{false}; - // bool isMu{false}; if (particle.pdgCode() == PDG_t::kPiPlus || particle.pdgCode() == PDG_t::kPiMinus) { isPi = true; @@ -1801,8 +1895,9 @@ struct PiKpRAA { // α: longitudinal asymmetry (uses + and − labels by charge) double denom = pLpos + pLneg; - if (std::abs(denom) < KtEnToMinusNine) - return; // avoid 0 division (unphysical for V0s) + if (std::abs(denom) < KtEnToMinusNine) { + return; + } // avoid 0 division (unphysical for V0s) alpha = (pLpos - pLneg) / denom; // equivalently / pV0mag } @@ -1840,9 +1935,6 @@ struct PiKpRAA { return false; } - // std::cout << "track.itsClusterMap() = " << static_cast(track.itsClusterMap()) << '\n'; - // std::cout << "track.itsNCls() = " << static_cast(track.itsNCls()) << '\n'; - if (track.itsNCls() < trackSelections.minNClusITS || track.tpcNClsCrossedRows() < trackSelections.minNCrossedRows || track.tpcChi2NCl() > trackSelections.maxChi2ClsTPC || @@ -1852,20 +1944,23 @@ struct PiKpRAA { } // ==== Ncl selection ==== // - if (trackSelections.applyNclSel && ncl < trackSelections.minNcl) + if (trackSelections.applyNclSel && ncl < trackSelections.minNcl) { return false; + } // ==== DCAxy & DCAz selections ==== // if (applyDca && cfgDCA.dcaSelectionsLoaded) { - if (std::abs(dcaZ) > dcaZcut || std::abs(dcaXY) > dcaXYcut) + if (std::abs(dcaZ) > dcaZcut || std::abs(dcaXY) > dcaXYcut) { return false; + } } // Flag to check that the DCA selections are loaded // when asking to apply DCA // ==== DCAxy & DCAz selections ==== // - if (loadHisWithDCASel && applyDca && !cfgDCA.dcaSelectionsLoaded) + if (loadHisWithDCASel && applyDca && !cfgDCA.dcaSelectionsLoaded) { return false; + } return true; } @@ -1895,12 +1990,14 @@ struct PiKpRAA { } // ==== Ncl selection ==== // - if (trackSelections.applyNclSel && ncl < v0Selections.minNclV0Daugther) + if (trackSelections.applyNclSel && ncl < v0Selections.minNclV0Daugther) { return false; + } // ==== Ncl shared ==== // - if (nclShared > v0Selections.nSharedClusTpc) + if (nclShared > v0Selections.nSharedClusTpc) { return false; + } return true; } @@ -1947,8 +2044,9 @@ struct PiKpRAA { // Rejects V0 if its invariant mass is not compatible with the K0s proper mass if (v0Selections.applyInvMassSel) { - if (!(dMassK0s < v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) + if (!(dMassK0s < v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) { return false; + } } bool isSelected{false}; @@ -1956,10 +2054,12 @@ struct PiKpRAA { isSelected = lifeTime < v0Selections.lifeTimeCutK0s && (rapidity > v0Selections.minY && rapidity < v0Selections.maxY) && dcaDaugToPV ? true : false; } if (!v0Selections.useOfficialV0sSelOfDaughters) { - if (v0Selections.useTPCNsigma) + if (v0Selections.useTPCNsigma) { isSelected = lifeTime < v0Selections.lifeTimeCutK0s && (rapidity > v0Selections.minY && rapidity < v0Selections.maxY) && posTPCNsigma < v0Selections.pidNsigmaCut && negTPCNsigma < v0Selections.pidNsigmaCut && dcaDaugToPV ? true : false; - if (!v0Selections.useTPCNsigma) + } + if (!v0Selections.useTPCNsigma) { isSelected = lifeTime < v0Selections.lifeTimeCutK0s && (rapidity > v0Selections.minY && rapidity < v0Selections.maxY) && posTOFNsigma < v0Selections.pidNsigmaCut && negTOFNsigma < v0Selections.pidNsigmaCut && hasToF && goodToFmatch && dcaDaugToPV ? true : false; + } } if (isSelected) { @@ -2000,8 +2100,9 @@ struct PiKpRAA { // Rejects V0 if the invariant mass is not compatible with the Lambda proper mass if (v0Selections.applyInvMassSel) { - if (!(dMassL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) + if (!(dMassL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) { return false; + } } bool isSelected{false}; @@ -2009,10 +2110,12 @@ struct PiKpRAA { isSelected = lifeTime < v0Selections.lifeTimeCutLambda && (rapidity > v0Selections.minY && rapidity < v0Selections.maxY) && dcaDaugToPV ? true : false; } if (!v0Selections.useOfficialV0sSelOfDaughters) { - if (v0Selections.useTPCNsigma) + if (v0Selections.useTPCNsigma) { isSelected = lifeTime < v0Selections.lifeTimeCutLambda && (rapidity > v0Selections.minY && rapidity < v0Selections.maxY) && posTPCNsigma < v0Selections.pidNsigmaCut && negTPCNsigma < v0Selections.pidNsigmaCut && dcaDaugToPV ? true : false; - if (!v0Selections.useTPCNsigma) + } + if (!v0Selections.useTPCNsigma) { isSelected = lifeTime < v0Selections.lifeTimeCutLambda && (rapidity > v0Selections.minY && rapidity < v0Selections.maxY) && posTOFNsigma < v0Selections.pidNsigmaCut && negTOFNsigma < v0Selections.pidNsigmaCut && hasToF && goodToFmatch && dcaDaugToPV ? true : false; + } } if (isSelected) { @@ -2053,8 +2156,9 @@ struct PiKpRAA { // Rejects V0 if the invariant mass is not compatible with the Lambda proper mass if (v0Selections.applyInvMassSel) { - if (!(dMassAL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) + if (!(dMassAL < v0Selections.dMassSel && dMassK0s > v0Selections.dMassSel && dMassG > v0Selections.dMassSelG)) { return false; + } } bool isSelected{false}; @@ -2062,10 +2166,12 @@ struct PiKpRAA { isSelected = lifeTime < v0Selections.lifeTimeCutLambda && (rapidity > v0Selections.minY && rapidity < v0Selections.maxY) && dcaDaugToPV ? true : false; } if (!v0Selections.useOfficialV0sSelOfDaughters) { - if (v0Selections.useTPCNsigma) + if (v0Selections.useTPCNsigma) { isSelected = lifeTime < v0Selections.lifeTimeCutLambda && (rapidity > v0Selections.minY && rapidity < v0Selections.maxY) && posTPCNsigma < v0Selections.pidNsigmaCut && negTPCNsigma < v0Selections.pidNsigmaCut && dcaDaugToPV ? true : false; - if (!v0Selections.useTPCNsigma) + } + if (!v0Selections.useTPCNsigma) { isSelected = lifeTime < v0Selections.lifeTimeCutLambda && (rapidity > v0Selections.minY && rapidity < v0Selections.maxY) && posTOFNsigma < v0Selections.pidNsigmaCut && negTOFNsigma < v0Selections.pidNsigmaCut && hasToF && goodToFmatch && dcaDaugToPV ? true : false; + } } if (isSelected) { @@ -2097,18 +2203,22 @@ struct PiKpRAA { const bool dcaDaugToPV{dcaPos > v0Selections.dcaElectronFromGamma && dcaNeg > v0Selections.dcaElectronFromGamma ? true : false}; if (v0Selections.applyInvMassSel) { - if (!(dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel)) + if (!(dMassK0s > v0Selections.dMassSel && dMassL > v0Selections.dMassSel && dMassAL > v0Selections.dMassSel && dMassG < v0Selections.dMassSel)) { return false; + } } - if (!(rapidity > v0Selections.minY && rapidity < v0Selections.maxY)) + if (!(rapidity > v0Selections.minY && rapidity < v0Selections.maxY)) { return false; + } bool isSelected{false}; - if (v0Selections.useOfficialV0sSelOfDaughters) + if (v0Selections.useOfficialV0sSelOfDaughters) { isSelected = dcaDaugToPV ? true : false; - if (!v0Selections.useOfficialV0sSelOfDaughters) + } + if (!v0Selections.useOfficialV0sSelOfDaughters) { isSelected = dcaDaugToPV && posTPCNsigma < v0Selections.pidNsigmaCut && negTPCNsigma < v0Selections.pidNsigmaCut ? true : false; + } if (isSelected) { registry.fill(HIST("EtaVsYG"), negTrack.eta(), rapidity); @@ -2135,10 +2245,12 @@ struct PiKpRAA { void phiPrimeFunc(float& phi, const int& magField, const int& charge) { - if (magField < 0) + if (magField < 0) { phi = o2::constants::math::TwoPI - phi; - if (charge < 0) + } + if (charge < 0) { phi = o2::constants::math::TwoPI - phi; + } phi += o2::constants::math::PI / 18.0f; phi = std::fmod(phi, o2::constants::math::PI / 9.0f); @@ -2147,8 +2259,9 @@ struct PiKpRAA { bool passesPhiSelection(const float& pt, const float& phi) { // Do not apply Phi Sel if pt < 2 GeV/c - if (pt < KtwoPtGeVSel) + if (pt < KtwoPtGeVSel) { return true; + } bool isSelected{true}; if (phiCut.isPhiCutLoaded) { @@ -2156,8 +2269,9 @@ struct PiKpRAA { const int binHigh{phiCut.hPhiCutHigh->FindBin(pt)}; const double phiCutLow{phiCut.hPhiCutLow->GetBinContent(binLow)}; const double phiCutHigh{phiCut.hPhiCutHigh->GetBinContent(binHigh)}; - if (phi >= phiCutLow && phi <= phiCutHigh) + if (phi >= phiCutLow && phi <= phiCutHigh) { isSelected = false; + } } return isSelected; } @@ -2331,17 +2445,20 @@ struct PiKpRAA { { if (pathDCAxy.value.empty() == false) { cfgDCA.hDCAxy = ccdb->getForTimeStamp(pathDCAxy, ccdbNoLaterThan.value); - if (cfgDCA.hDCAxy == nullptr) + if (cfgDCA.hDCAxy == nullptr) { LOGF(fatal, "Could not load hDCAxy histogram from %s", pathDCAxy.value.c_str()); + } } if (pathDCAz.value.empty() == false) { cfgDCA.hDCAz = ccdb->getForTimeStamp(pathDCAz, ccdbNoLaterThan.value); - if (cfgDCA.hDCAz == nullptr) + if (cfgDCA.hDCAz == nullptr) { LOGF(fatal, "Could not load hDCAz histogram from %s", pathDCAz.value.c_str()); + } } - if (cfgDCA.hDCAxy && cfgDCA.hDCAz) + if (cfgDCA.hDCAxy && cfgDCA.hDCAz) { cfgDCA.dcaSelectionsLoaded = true; + } } void loadPhiCutSelections(const uint64_t& timeStamp) @@ -2360,20 +2477,23 @@ struct PiKpRAA { } } - if (phiCut.hPhiCutHigh && phiCut.hPhiCutLow) + if (phiCut.hPhiCutHigh && phiCut.hPhiCutLow) { phiCut.isPhiCutLoaded = true; + } } void loadEtaCalibration() { if (pathEtaCal.value.empty() == false) { etaCal.pEtaCal = ccdb->getForTimeStamp(pathEtaCal, ccdbNoLaterThan.value); - if (etaCal.pEtaCal == nullptr) + if (etaCal.pEtaCal == nullptr) { LOGF(fatal, "Could not load pEtaCal from %s", pathEtaCal.value.c_str()); + } } - if (etaCal.pEtaCal) + if (etaCal.pEtaCal) { etaCal.isMIPCalLoaded = true; + } } void loadEtaPlateauCalibration() @@ -2381,12 +2501,14 @@ struct PiKpRAA { if (pathEtaCalPlateau.value.empty() == false) { etaCal.pEtaCalPlateau = ccdb->getForTimeStamp(pathEtaCalPlateau, ccdbNoLaterThan.value); - if (etaCal.pEtaCalPlateau == nullptr) + if (etaCal.pEtaCalPlateau == nullptr) { LOGF(fatal, "Could not load pEtaCalPlateau from %s", pathEtaCalPlateau.value.c_str()); + } } - if (etaCal.pEtaCalPlateau) + if (etaCal.pEtaCalPlateau) { etaCal.isCalPlateauLoaded = true; + } } };