From a938d58c39d110595aa3e15b6a3b023c9477436f Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Wed, 22 Nov 2023 17:07:17 +0100 Subject: [PATCH 1/9] PWGHF: Implent the possibility to apply proton PID for baryons in HF finding --- PWGHF/Core/SelectorCuts.h | 10 + .../DataModel/CandidateReconstructionTables.h | 4 +- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 485 +++++++++++------- 3 files changed, 315 insertions(+), 184 deletions(-) diff --git a/PWGHF/Core/SelectorCuts.h b/PWGHF/Core/SelectorCuts.h index aa98dca0f91..e7e2e818ec1 100644 --- a/PWGHF/Core/SelectorCuts.h +++ b/PWGHF/Core/SelectorCuts.h @@ -63,6 +63,16 @@ static const std::vector labelsPtTrack{}; static const std::vector labelsCutVarTrack = {"min_dcaxytoprimary", "max_dcaxytoprimary"}; } // namespace hf_cuts_single_track +namespace hf_presel_proton_pid +{ +// default values for the PID cuts for protons in the track-index-skim-creator +constexpr float cutsProtonPid[3][6] = {{0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f}, + {0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f}, + {0.f, 1000.f, 5.f, 0.f, 1000.f, 5.f}}; +static const std::vector labelsCutsProtonPid = {"minPtTpc", "maxPtTpc", "nSigmaMaxTpc", "minPtTof", "maxPtTof", "nSigmaMaxTof"}; +static const std::vector labelsRowsProtonPid = {"LcToPKPi", "XicToPKPi", "LcToPK0S"}; +} // namespace hf_presel_proton_pid + namespace hf_cuts_bdt_multiclass { static constexpr int nBinsPt = 1; diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 49a2c5a371c..d7018ce8b8d 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -153,10 +153,12 @@ DECLARE_SOA_TABLE(HfSelCollision, "AOD", "HFSELCOLLISION", //! namespace hf_sel_track { DECLARE_SOA_COLUMN(IsSelProng, isSelProng, int); //! +DECLARE_SOA_COLUMN(IsProton, isProton, int8_t); //! } // namespace hf_sel_track DECLARE_SOA_TABLE(HfSelTrack, "AOD", "HFSELTRACK", //! - hf_sel_track::IsSelProng); + hf_sel_track::IsSelProng, + hf_sel_track::IsProton); namespace hf_pv_refit_track { diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index e1443513dc6..d2cc8a045e6 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -18,7 +18,6 @@ /// \author Mattia Faggin , University and INFN Padova /// \author Jinjoo Seo , Inha University /// \author Fabrizio Grosa , CERN -/// \author Federica Zanone , Heidelberg University #include // std::find #include // std::distance @@ -37,6 +36,7 @@ #include "ReconstructionDataFormats/V0.h" #include "ReconstructionDataFormats/Vertex.h" // for PV refit +#include "Common/Core/TrackSelectorPID.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/CollisionAssociationTables.h" @@ -48,7 +48,6 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/Utils/utilsAnalysis.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsDebugLcToK0sP.h" using namespace o2; using namespace o2::analysis; @@ -87,18 +86,28 @@ enum CentralityEstimator { NCentralityEstimators }; -// #define MY_DEBUG +// enum for proton PID strategy (only proton for baryons) +enum ProtonPidStrategy { + NoPid = 0, + PidTpcOnly, + PidTofOnly, + PidTpcOrTof, + PidTpcAndTof, + NPidStatus +}; -#ifdef MY_DEBUG -using TracksWithSelAndDCA = soa::Join; -#define MY_DEBUG_MSG(condition, cmd) \ - if (condition) { \ - cmd; \ - } -#else -using TracksWithSelAndDCA = soa::Join; -#define MY_DEBUG_MSG(condition, cmd) -#endif +// enum for proton PID channels +enum ChannelsProtonPid { + LcToPKPi = 0, + XicToPKPi, + LcToPK0S, + NChannelsProtonPid +}; + +using TracksWithSelAndDca = soa::Join; +using TracksWithSelAndDcaAndPidTpc = soa::Join; +using TracksWithSelAndDcaAndPidTof = soa::Join; +using TracksWithSelAndDcaAndPidTpcTof = soa::Join; /// Event selection struct HfTrackIndexSkimCreatorTagSelCollisions { @@ -367,17 +376,13 @@ struct HfTrackIndexSkimCreatorTagSelTracks { Configurable useIsGlobalTrackForSoftPion{"useIsGlobalTrackForSoftPion", false, "check isGlobalTrack status for soft pion tracks"}; Configurable useIsGlobalTrackWoDCAForSoftPion{"useIsGlobalTrackWoDCAForSoftPion", false, "check isGlobalTrackWoDCA status for soft pion tracks"}; Configurable useIsQualityTrackITSForSoftPion{"useIsQualityTrackITSForSoftPion", true, "check qualityTracksITS status for soft pion tracks"}; + // proton PID, applied only if corresponding process function enabled + Configurable> selectionsProtonPid{"selectionsProtonPid", {hf_presel_proton_pid::cutsProtonPid[0], 3, 6, hf_presel_proton_pid::labelsRowsProtonPid, hf_presel_proton_pid::labelsCutsProtonPid}, "PID selections for proton applied if proper process function enabled"}; // CCDB Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable ccdbPathLut{"ccdbPathLut", "GLO/Param/MatLUT", "Path for LUT parametrization"}; Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; - // for debugging -#ifdef MY_DEBUG - Configurable> indexK0Spos{"indexK0Spos", {729, 2866, 4754, 5457, 6891, 7824, 9243, 9810}, "indices of K0S positive daughters, for debug"}; - Configurable> indexK0Sneg{"indexK0Sneg", {730, 2867, 4755, 5458, 6892, 7825, 9244, 9811}, "indices of K0S negative daughters, for debug"}; - Configurable> indexProton{"indexProton", {717, 2810, 4393, 5442, 6769, 7793, 9002, 9789}, "indices of protons, for debug"}; -#endif // Needed for PV refitting Service ccdb; @@ -389,6 +394,8 @@ struct HfTrackIndexSkimCreatorTagSelTracks { static const int nCuts = 4; // array of 2-prong and 3-prong cuts std::array, CandidateType::NCandidateTypes> cutsSingleTrack; + // proton PID, if enabled + std::array selectorProton; // QA of PV refit ConfigurableAxis axisPvRefitDeltaX{"axisPvRefitDeltaX", {1000, -0.5f, 0.5f}, "DeltaX binning PV refit"}; @@ -399,6 +406,11 @@ struct HfTrackIndexSkimCreatorTagSelTracks { void init(InitContext const&) { + std::array doProcess = {doprocessNoPid, doprocessProtonPidTpc, doprocessProtonPidTof, doprocessProtonPidTpcOrTof, doprocessProtonPidTpcAndTof}; + if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) { + LOGP(fatal, "One and only one process function for the different PID selection strategies can be enabled at a time!"); + } + cutsSingleTrack = {cutsTrack2Prong, cutsTrack3Prong, cutsTrackBach, cutsTrackDstar}; if (etaMinTrack2Prong == -99999.) { @@ -481,6 +493,53 @@ struct HfTrackIndexSkimCreatorTagSelTracks { lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(ccdbPathLut)); runNumber = 0; } + + // configure proton PID + for (auto iChannel{0u}; iChannelget(iChannel, "minPtTpc"), selectionsProtonPid->get(iChannel, "maxPtTpc")); + selectorProton[iChannel].setRangePtTof(selectionsProtonPid->get(iChannel, "minPtTof"), selectionsProtonPid->get(iChannel, "maxPtTof")); + selectorProton[iChannel].setRangeNSigmaTpc(-selectionsProtonPid->get(iChannel, "nSigmaMaxTpc"), selectionsProtonPid->get(iChannel, "nSigmaMaxTpc")); + selectorProton[iChannel].setRangeNSigmaTof(-selectionsProtonPid->get(iChannel, "nSigmaMaxTof"), selectionsProtonPid->get(iChannel, "nSigmaMaxTof")); + } + } + + /// PID track cuts (for proton only) + /// \param hfTrack is a track + /// \return true if the track is compatible with a proton hypothesis + template + int8_t isSelectedProton(const T& hfTrack) + { + + std::array statusPid = {TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted}; + if constexpr (pidStrategy == ProtonPidStrategy::PidTofOnly) { + for (auto iChannel{0u}; iChannel etaMaxTrackBach || trackEta < etaMinTrackBach)) { CLRBIT(statusProng, CandidateType::CandV0bachelor); @@ -577,8 +634,6 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } // quality cut - MY_DEBUG_MSG(isProtonFromLc, LOG(info) << "proton " << indexBach << " tpcNClsFound = " << hfTrack.tpcNClsFound() << " (cut " << tpcNClsFoundMin.value << ")"); - iCut = 4; bool hasGoodQuality = true; if (doCutQuality.value && statusProng > 0) { // FIXME to make a more complete selection e.g track.flags() & o2::aod::track::TPCrefit && track.flags() & o2::aod::track::GoldenChi2 && @@ -599,7 +654,6 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } } if (!hasGoodQuality) { - MY_DEBUG_MSG(isProtonFromLc, LOG(info) << "proton " << indexBach << " did not pass clusters cut"); for (int iCandType = 0; iCandType < CandidateType::NCandidateTypes; iCandType++) { if (iCandType == CandidateType::CandDstar) { // different quality criteria for D* soft pions continue; @@ -653,7 +707,6 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } } } - MY_DEBUG_MSG(isProtonFromLc, LOG(info) << "statusProng = " << statusProng; printf("\n")); // fill histograms if (fillHistograms) { @@ -671,7 +724,6 @@ struct HfTrackIndexSkimCreatorTagSelTracks { registry.fill(HIST("hRejTracks"), (nCuts + 1) * CandidateType::Cand3Prong + iCut); } if (TESTBIT(statusProng, CandidateType::CandV0bachelor)) { - MY_DEBUG_MSG(isProtonFromLc, LOG(info) << "Will be kept: Proton from Lc " << indexBach); registry.fill(HIST("hPtCutsV0bachelor"), trackPt); registry.fill(HIST("hEtaCutsV0bachelor"), trackEta); registry.fill(HIST("hDCAToPrimXYVsPtCutsV0bachelor"), trackPt, dca[0]); @@ -691,15 +743,16 @@ struct HfTrackIndexSkimCreatorTagSelTracks { /// \param bcWithTimeStamps is a table of bunch crossing joined with timestamps used to query the CCDB for B and material budget /// \param vecPvContributorGlobId is a vector containing the global ID of PV contributors for the current collision /// \param vecPvContributorTrackParCov is a vector containing the TrackParCov of PV contributors for the current collision - /// \param myTrack is the track to be removed, if contributor, from the PV refit + /// \param trackToRemove is the track to be removed, if contributor, from the PV refit /// \param pvCoord is an array containing the coordinates of the refitted PV /// \param pvCovMatrix is an array containing the covariance matrix values of the refitted PV - /// \param dcaXYdcaZ is an array containing the dcaXY and dcaZ of myTrack with respect to the refitted PV + /// \param dcaXYdcaZ is an array containing the dcaXY and dcaZ of trackToRemove with respect to the refitted PV + template void performPvRefitTrack(aod::Collision const& collision, aod::BCsWithTimestamps const& bcWithTimeStamps, std::vector vecPvContributorGlobId, std::vector vecPvContributorTrackParCov, - TracksWithSelAndDCA::iterator const& myTrack, + TTrack const& trackToRemove, std::array& pvCoord, std::array& pvCovMatrix, std::array& dcaXYdcaZ) @@ -767,7 +820,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { bool recalcImpPar = false; if (doPvRefit && pvRefitDoable) { recalcImpPar = true; - auto trackIterator = std::find(vecPvContributorGlobId.begin(), vecPvContributorGlobId.end(), myTrack.globalIndex()); /// track global index + auto trackIterator = std::find(vecPvContributorGlobId.begin(), vecPvContributorGlobId.end(), trackToRemove.globalIndex()); /// track global index if (trackIterator != vecPvContributorGlobId.end()) { /// this track contributed to the PV fit: let's do the refit without it @@ -778,7 +831,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { auto primVtxRefitted = vertexer.refitVertex(vecPvRefitContributorUsed, primVtx); // vertex refit // LOG(info) << "refit " << cnt << "/" << ntr << " result = " << primVtxRefitted.asString(); if (debugPvRefit) { - LOG(info) << "refit for track with global index " << static_cast(myTrack.globalIndex()) << " " << primVtxRefitted.asString(); + LOG(info) << "refit for track with global index " << static_cast(trackToRemove.globalIndex()) << " " << primVtxRefitted.asString(); } if (primVtxRefitted.getChi2() < 0) { if (debugPvRefit) { @@ -827,7 +880,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { /// Track propagation to the PV refit considering also the material budget /// Mandatory for tracks updated at most only to the innermost ITS layer - auto trackPar = getTrackPar(myTrack); + auto trackPar = getTrackPar(trackToRemove); o2::gpu::gpustd::array dcaInfo{-999., -999.}; if (o2::base::Propagator::Instance()->propagateToDCABxByBz({primVtxBaseRecalc.getX(), primVtxBaseRecalc.getY(), primVtxBaseRecalc.getZ()}, trackPar, 2.f, noMatCorr, &dcaInfo)) { pvCoord[0] = primVtxBaseRecalc.getX(); @@ -871,119 +924,198 @@ struct HfTrackIndexSkimCreatorTagSelTracks { /// Partition for PV contributors - Preslice trackIndicesPerCollision = aod::track_association::collisionId; - Partition pvContributors = ((aod::track::flags & (uint32_t)aod::track::PVContributor) == (uint32_t)aod::track::PVContributor); - - void process(aod::Collisions const& collisions, - TrackAssoc const& trackIndices, - TracksWithSelAndDCA const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps // for PV refit -#ifdef MY_DEBUG - , - aod::McParticles& mcParticles -#endif - ) + template + void runTagSelTracks(aod::Collision const& collision, + TTracks const& tracks, // all tracks + GroupedTrackIndices const& trackIndicesCollision, // track indices associated to this collision (from track-to-collision-associator) + GroupedPvContributors const& pvContrCollision, // PV contributors of this collision + aod::BCsWithTimestamps const& bcWithTimeStamps, // for PV refit + int64_t numTracksThisColl, // number of tracks in this collision (for PV refit) + int64_t offsetTracksThisColl) // offset of tracks in this collision with respect to total table (for PV refit) { - rowSelectedTrack.reserve(tracks.size()); - // prepare vectors to cache quantities needed for PV refit std::vector> pvRefitDcaPerTrack{}; std::vector> pvRefitPvCoordPerTrack{}; std::vector> pvRefitPvCovMatrixPerTrack{}; if (doPvRefit) { - pvRefitDcaPerTrack.resize(tracks.size()); - pvRefitPvCoordPerTrack.resize(tracks.size()); - pvRefitPvCovMatrixPerTrack.resize(tracks.size()); - if (debugPvRefit) { - LOG(info) << ">>> number of tracks: " << tracks.size(); - LOG(info) << ">>> number of collisions: " << collisions.size(); - } - tabPvRefitTrack.reserve(tracks.size()); + pvRefitDcaPerTrack.resize(numTracksThisColl); + pvRefitPvCoordPerTrack.resize(numTracksThisColl); + pvRefitPvCovMatrixPerTrack.resize(numTracksThisColl); + tabPvRefitTrack.reserve(numTracksThisColl); } - for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); - auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto thisCollId = collision.globalIndex(); + for (const auto& trackId : trackIndicesCollision) { + int statusProng = BIT(CandidateType::NCandidateTypes) - 1; // all bits on + auto track = trackId.template track_as(); + auto trackIdx = track.globalIndex(); + float trackPt = track.pt(); + float trackEta = track.eta(); + + std::array pvRefitDcaXYDcaZ{track.dcaXY(), track.dcaZ()}; + std::array pvRefitPvCoord{0.f, 0.f, 0.f}; + std::array pvRefitPvCovMatrix{1e10f, 1e10f, 1e10f, 1e10f, 1e10f, 1e10f}; + + // PV refit and DCA recalculation only for tracks with an assigned collision + if (doPvRefit && track.has_collision() && track.collisionId() == thisCollId && track.isPVContributor()) { + pvRefitPvCoord = {collision.posX(), collision.posY(), collision.posZ()}; + pvRefitPvCovMatrix = {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}; + + /// retrieve PV contributors for the current collision + std::vector vecPvContributorGlobId = {}; + std::vector vecPvContributorTrackParCov = {}; + + for (const auto& contributor : pvContrCollision) { + vecPvContributorGlobId.push_back(contributor.globalIndex()); + vecPvContributorTrackParCov.push_back(getTrackParCov(contributor)); + } + if (debugPvRefit) { + LOG(info) << "### vecPvContributorGlobId.size()=" << vecPvContributorGlobId.size() << ", vecPvContributorTrackParCov.size()=" << vecPvContributorTrackParCov.size() << ", N. original contributors=" << collision.numContrib(); + } - for (const auto& trackId : groupedTrackIndices) { - int statusProng = BIT(CandidateType::NCandidateTypes) - 1; // all bits on - auto track = trackId.track_as(); - auto trackIdx = track.globalIndex(); - float trackPt = track.pt(); - float trackEta = track.eta(); - - std::array pvRefitDcaXYDcaZ{track.dcaXY(), track.dcaZ()}; - std::array pvRefitPvCoord{0.f, 0.f, 0.f}; - std::array pvRefitPvCovMatrix{1e10f, 1e10f, 1e10f, 1e10f, 1e10f, 1e10f}; - -#ifdef MY_DEBUG - auto indexBach = track.mcParticleId(); - // LOG(info) << "Checking label " << indexBach; - bool isProtonFromLc = isProtonFromLcFunc(indexBach, indexProton); -#endif - // PV refit and DCA recalculation only for tracks with an assigned collision - if (doPvRefit && track.has_collision() && track.collisionId() == thisCollId && track.isPVContributor()) { - pvRefitPvCoord = {collision.posX(), collision.posY(), collision.posZ()}; - pvRefitPvCovMatrix = {collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()}; - - /// retrieve PV contributors for the current collision - std::vector vecPvContributorGlobId = {}; - std::vector vecPvContributorTrackParCov = {}; - - /// contributors for the current collision - auto pvContrCollision = pvContributors->sliceByCached(aod::track::collisionId, thisCollId, cache); - for (const auto& contributor : pvContrCollision) { - vecPvContributorGlobId.push_back(contributor.globalIndex()); - vecPvContributorTrackParCov.push_back(getTrackParCov(contributor)); - } - if (debugPvRefit) { - LOG(info) << "### vecPvContributorGlobId.size()=" << vecPvContributorGlobId.size() << ", vecPvContributorTrackParCov.size()=" << vecPvContributorTrackParCov.size() << ", N. original contributors=" << collision.numContrib(); - } + /// Perform the PV refit only for tracks with an assigned collision + if (debugPvRefit) { + LOG(info) << "[BEFORE performPvRefitTrack] track.collision().globalIndex(): " << collision.globalIndex(); + } + performPvRefitTrack(collision, bcWithTimeStamps, vecPvContributorGlobId, vecPvContributorTrackParCov, track, pvRefitPvCoord, pvRefitPvCovMatrix, pvRefitDcaXYDcaZ); + // we subtract the offset since trackIdx is the global index referred to the total track table + pvRefitDcaPerTrack[trackIdx - offsetTracksThisColl] = pvRefitDcaXYDcaZ; + pvRefitPvCoordPerTrack[trackIdx - offsetTracksThisColl] = pvRefitPvCoord; + pvRefitPvCovMatrixPerTrack[trackIdx - offsetTracksThisColl] = pvRefitPvCovMatrix; + } else if (track.collisionId() != thisCollId) { + auto bc = collision.bc_as(); + initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); + auto trackPar = getTrackPar(track); + o2::gpu::gpustd::array dcaInfo{-999., -999.}; + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackPar, 2.f, noMatCorr, &dcaInfo); + trackPt = trackPar.getPt(); + trackEta = trackPar.getEta(); + pvRefitDcaXYDcaZ[0] = dcaInfo[0]; + pvRefitDcaXYDcaZ[1] = dcaInfo[1]; + } + + // bool cutStatus[CandidateType::NCandidateTypes][nCuts]; + // if (debug) { + // for (int iCandType = 0; iCandType < CandidateType::NCandidateTypes; iCandType++) { + // for (int iCut = 0; iCut < nCuts; iCut++) { + // cutStatus[iCandType][iCut] = true; + // } + // } + // } - /// Perform the PV refit only for tracks with an assigned collision - if (debugPvRefit) { - LOG(info) << "[BEFORE performPvRefitTrack] track.collision().globalIndex(): " << collision.globalIndex(); - } - performPvRefitTrack(collision, bcWithTimeStamps, vecPvContributorGlobId, vecPvContributorTrackParCov, track, pvRefitPvCoord, pvRefitPvCovMatrix, pvRefitDcaXYDcaZ); - pvRefitDcaPerTrack[trackIdx] = pvRefitDcaXYDcaZ; - pvRefitPvCoordPerTrack[trackIdx] = pvRefitPvCoord; - pvRefitPvCovMatrixPerTrack[trackIdx] = pvRefitPvCovMatrix; - } else if (track.collisionId() != thisCollId) { - auto bc = collision.bc_as(); - initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); - auto trackPar = getTrackPar(track); - o2::gpu::gpustd::array dcaInfo{-999., -999.}; - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackPar, 2.f, noMatCorr, &dcaInfo); - trackPt = trackPar.getPt(); - trackEta = trackPar.getEta(); - pvRefitDcaXYDcaZ[0] = dcaInfo[0]; - pvRefitDcaXYDcaZ[1] = dcaInfo[1]; - } - - MY_DEBUG_MSG(isProtonFromLc, LOG(info) << "\nWe found the proton " << indexBach); - - // bool cutStatus[CandidateType::NCandidateTypes][nCuts]; - // if (debug) { - // for (int iCandType = 0; iCandType < CandidateType::NCandidateTypes; iCandType++) { - // for (int iCut = 0; iCut < nCuts; iCut++) { - // cutStatus[iCandType][iCut] = true; - // } - // } - // } - - isSelectedTrack(track, trackPt, trackEta, pvRefitDcaXYDcaZ, statusProng); - rowSelectedTrack(statusProng); - } - } - - if (doPvRefit) { /// fill table with PV refit info (it has to be filled per track) - for (auto iTrack{0u}; iTrack < tracks.size(); ++iTrack) { + isSelectedTrack(track, trackPt, trackEta, pvRefitDcaXYDcaZ, statusProng); + int8_t isProton = isSelectedProton(track); + rowSelectedTrack(statusProng, isProton); + } + + if (doPvRefit) { /// fill table with PV refit info (it has to be filled per track and not track index) + for (auto iTrack{0}; iTrack < numTracksThisColl; ++iTrack) { tabPvRefitTrack(pvRefitPvCoordPerTrack[iTrack][0], pvRefitPvCoordPerTrack[iTrack][1], pvRefitPvCoordPerTrack[iTrack][2], pvRefitPvCovMatrixPerTrack[iTrack][0], pvRefitPvCovMatrixPerTrack[iTrack][1], pvRefitPvCovMatrixPerTrack[iTrack][2], pvRefitPvCovMatrixPerTrack[iTrack][3], pvRefitPvCovMatrixPerTrack[iTrack][4], pvRefitPvCovMatrixPerTrack[iTrack][5], pvRefitDcaPerTrack[iTrack][0], pvRefitDcaPerTrack[iTrack][1]); } } } + + Preslice trackIndicesPerCollision = aod::track_association::collisionId; + Preslice tracksPerCollision = aod::track_association::collisionId; + Preslice tracksWithPidTpcPerCollision = aod::track_association::collisionId; + Preslice tracksWithPidTofPerCollision = aod::track_association::collisionId; + Preslice tracksWithPidTpcTofPerCollision = aod::track_association::collisionId; + Partition pvContributors = ((aod::track::flags & (uint32_t)aod::track::PVContributor) == (uint32_t)aod::track::PVContributor); + Partition pvContributorsWithPidTpc = ((aod::track::flags & (uint32_t)aod::track::PVContributor) == (uint32_t)aod::track::PVContributor); + Partition pvContributorsWithPidTof = ((aod::track::flags & (uint32_t)aod::track::PVContributor) == (uint32_t)aod::track::PVContributor); + Partition pvContributorsWithPidTpcTof = ((aod::track::flags & (uint32_t)aod::track::PVContributor) == (uint32_t)aod::track::PVContributor); + + void processNoPid(aod::Collisions const& collisions, + TrackAssoc const& trackIndices, + TracksWithSelAndDca const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + rowSelectedTrack.reserve(tracks.size()); + + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto groupedTracks = tracks.sliceBy(tracksPerCollision, thisCollId); // we need to know the number of tracks in this collision and the offset for the PV refit + auto pvContrCollision = pvContributors->sliceByCached(aod::track::collisionId, thisCollId, cache); + runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, groupedTracks.size(), groupedTracks.offset()); + } + } + + PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelTracks, processNoPid, "Process without PID selections", true); + + void processProtonPidTpc(aod::Collisions const& collisions, + TrackAssoc const& trackIndices, + TracksWithSelAndDcaAndPidTpc const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + rowSelectedTrack.reserve(tracks.size()); + + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto groupedTracks = tracks.sliceBy(tracksWithPidTpcPerCollision, thisCollId); // we need to know the number of tracks in this collision and the offset for the PV refit + auto pvContrCollision = pvContributorsWithPidTpc->sliceByCached(aod::track::collisionId, thisCollId, cache); + runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, groupedTracks.size(), groupedTracks.offset()); + } + } + + PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelTracks, processProtonPidTpc, "Process with proton TPC PID selection", false); + + void processProtonPidTof(aod::Collisions const& collisions, + TrackAssoc const& trackIndices, + TracksWithSelAndDcaAndPidTof const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + rowSelectedTrack.reserve(tracks.size()); + + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto groupedTracks = tracks.sliceBy(tracksWithPidTofPerCollision, thisCollId); // we need to know the number of tracks in this collision and the offset for the PV refit + auto pvContrCollision = pvContributorsWithPidTof->sliceByCached(aod::track::collisionId, thisCollId, cache); + runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, groupedTracks.size(), groupedTracks.offset()); + } + } + + PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelTracks, processProtonPidTof, "Process with proton TOF PID selection", false); + + void processProtonPidTpcOrTof(aod::Collisions const& collisions, + TrackAssoc const& trackIndices, + TracksWithSelAndDcaAndPidTpcTof const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + rowSelectedTrack.reserve(tracks.size()); + + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto groupedTracks = tracks.sliceBy(tracksWithPidTpcTofPerCollision, thisCollId); // we need to know the number of tracks in this collision and the offset for the PV refit + auto pvContrCollision = pvContributorsWithPidTpcTof->sliceByCached(aod::track::collisionId, thisCollId, cache); + runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, groupedTracks.size(), groupedTracks.offset()); + } + } + + PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelTracks, processProtonPidTpcOrTof, "Process with proton PID selection (TPC or TOF logic)", false); + + void processProtonPidTpcAndTof(aod::Collisions const& collisions, + TrackAssoc const& trackIndices, + TracksWithSelAndDcaAndPidTpcTof const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + rowSelectedTrack.reserve(tracks.size()); + + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto groupedTracks = tracks.sliceBy(tracksWithPidTpcTofPerCollision, thisCollId); // we need to know the number of tracks in this collision and the offset for the PV refit + auto pvContrCollision = pvContributorsWithPidTpcTof->sliceByCached(aod::track::collisionId, thisCollId, cache); + runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, groupedTracks.size(), groupedTracks.offset()); + } + } + + PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelTracks, processProtonPidTpcAndTof, "Process with proton PID selection (TPC and TOF logic)", false); }; //____________________________________________________________________________________________________________________________________________ @@ -1051,6 +1183,10 @@ struct HfTrackIndexSkimCreator { Configurable> binsPtDstarToD0Pi{"binsPtDstarToD0Pi", std::vector{hf_cuts_presel_dstar::vecBinsPt}, "pT bin limits for D*+->D0pi pT-dependent cuts"}; Configurable> cutsDstarToD0Pi{"cutsDstarToD0Pi", {hf_cuts_presel_dstar::cuts[0], hf_cuts_presel_dstar::nBinsPt, hf_cuts_presel_dstar::nCutVars, hf_cuts_presel_dstar::labelsPt, hf_cuts_presel_dstar::labelsCutVar}, "D*+->D0pi selections per pT bin"}; + // proton PID selections for Lc and Xic + Configurable applyProtonPidForLcToPKPi{"applyProtonPidForLcToPKPi", false, "Apply proton PID for Lc->pKpi"}; + Configurable applyProtonPidForXicToPKPi{"applyProtonPidForXicToPKPi", false, "Apply proton PID for Xic->pKpi"}; + // Needed for PV refitting Service ccdb; o2::base::MatLayerCylSet* lut; @@ -1069,8 +1205,8 @@ struct HfTrackIndexSkimCreator { static constexpr int kN2ProngDecays = hf_cand_2prong::DecayType::N2ProngDecays; // number of 2-prong hadron types static constexpr int kN3ProngDecays = hf_cand_3prong::DecayType::N3ProngDecays; // number of 3-prong hadron types - static constexpr int kNCuts2Prong[kN2ProngDecays] = {hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars}; // how many different selections are made on 2-prongs - static constexpr int kNCuts3Prong[kN3ProngDecays] = {hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_ds::nCutVars, hf_cuts_presel_3prong::nCutVars}; // how many different selections are made on 3-prongs + static constexpr int kNCuts2Prong[kN2ProngDecays] = {hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::nCutVars}; // how many different selections are made on 2-prongs + static constexpr int kNCuts3Prong[kN3ProngDecays] = {hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::nCutVars + 1, hf_cuts_presel_ds::nCutVars, hf_cuts_presel_3prong::nCutVars + 1}; // how many different selections are made on 3-prongs (Lc and Xic have also PID potentially) static constexpr int kNCutsDstar = 3; // how many different selections are made on Dstars std::array, 2>, kN2ProngDecays> arrMass2Prong; std::array, 2>, kN3ProngDecays> arrMass3Prong; @@ -1327,11 +1463,13 @@ struct HfTrackIndexSkimCreator { /// \param pVecTrack0 is the momentum array of the first daughter track /// \param pVecTrack1 is the momentum array of the second daughter track /// \param pVecTrack2 is the momentum array of the third daughter track + /// \param isProtonTrack0 is the flag that tells if the track 0 has been tagged as a proton + /// \param isProtonTrack2 is the flag that tells if the track 2 has been tagged as a proton /// \param cutStatus is a 2D array with outcome of each selection (filled only in debug mode) /// \param whichHypo information of the mass hypoteses that were selected /// \param isSelected is a bitmap with selection outcome template - void is3ProngPreselected(T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, T2& cutStatus, T3& whichHypo, int& isSelected) + void is3ProngPreselected(T1 const& pVecTrack0, T1 const& pVecTrack1, T1 const& pVecTrack2, int8_t& isProtonTrack0, int8_t& isProtonTrack2, T2& cutStatus, T3& whichHypo, int& isSelected) { /// FIXME: this would be better fixed by having a convention on the position of min and max in the 2D Array static std::vector massMinIndex; @@ -1352,6 +1490,23 @@ struct HfTrackIndexSkimCreator { for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { + // check proton PID for Lc and Xic + if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && applyProtonPidForLcToPKPi) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && applyProtonPidForXicToPKPi)) { + if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && !TESTBIT(isProtonTrack0, ChannelsProtonPid::LcToPKPi)) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && !TESTBIT(isProtonTrack0, ChannelsProtonPid::XicToPKPi))) { + CLRBIT(whichHypo[iDecay3P], 0); + } + if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && !TESTBIT(isProtonTrack2, ChannelsProtonPid::LcToPKPi)) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && !TESTBIT(isProtonTrack2, ChannelsProtonPid::XicToPKPi))) { + CLRBIT(whichHypo[iDecay3P], 1); + } + if (whichHypo[iDecay3P] == 0) { + CLRBIT(isSelected, iDecay3P); + if (debug) { + cutStatus[iDecay3P][hf_cuts_presel_3prong::nCutVars] = false; // PID + } + continue; // no need to check further for this particle hypothesis + } + } + // pT auto pTBin = findBin(&pTBins3Prong[iDecay3P], pT); // return immediately if it is outside the defined pT bins @@ -2106,7 +2261,9 @@ struct HfTrackIndexSkimCreator { } // 3-prong preselections - is3ProngPreselected(pVecTrackPos1, pVecTrackNeg1, pVecTrackPos2, cutStatus3Prong, whichHypo3Prong, isSelected3ProngCand); + int8_t isProtonTrackPos1 = trackIndexPos1.isProton(); + int8_t isProtonTrackPos2 = trackIndexPos2.isProton(); + is3ProngPreselected(pVecTrackPos1, pVecTrackNeg1, pVecTrackPos2, isProtonTrackPos1, isProtonTrackPos2, cutStatus3Prong, whichHypo3Prong, isSelected3ProngCand); if (!debug && isSelected3ProngCand == 0) { continue; } @@ -2360,7 +2517,9 @@ struct HfTrackIndexSkimCreator { } // 3-prong preselections - is3ProngPreselected(pVecTrackNeg1, pVecTrackPos1, pVecTrackNeg2, cutStatus3Prong, whichHypo3Prong, isSelected3ProngCand); + int8_t isProtonTrackNeg1 = trackIndexNeg1.isProton(); + int8_t isProtonTrackNeg2 = trackIndexNeg2.isProton(); + is3ProngPreselected(pVecTrackNeg1, pVecTrackPos1, pVecTrackNeg2, isProtonTrackNeg1, isProtonTrackNeg2, cutStatus3Prong, whichHypo3Prong, isSelected3ProngCand); if (!debug && isSelected3ProngCand == 0) { continue; } @@ -2643,17 +2802,14 @@ struct HfTrackIndexSkimCreatorCascades { Configurable ptCascCandMin{"ptCascCandMin", -1., "min. pT of the cascade candidate"}; // PbPb 2018: use 1 Configurable cutInvMassCascLc{"cutInvMassCascLc", 1., "Lc candidate invariant mass difference wrt PDG"}; // for PbPb 2018: use 0.2 // Configurable cutCascDCADaughters{"cutCascDCADaughters", .1, "DCA between V0 and bachelor in cascade"}; + // proton PID + Configurable applyProtonPid{"applyProtonPid", false, "Apply proton PID for Lc->pK0S"}; + // CCDB Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable ccdbPathLut{"ccdbPathLut", "GLO/Param/MatLUT", "Path for LUT parametrization"}; Configurable ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "Path of the grp file (Run 2)"}; Configurable ccdbPathGrpMag{"ccdbPathGrpMag", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object (Run 3)"}; - // for debugging -#ifdef MY_DEBUG - Configurable> indexK0Spos{"indexK0Spos", {729, 2866, 4754, 5457, 6891, 7824, 9243, 9810}, "indices of K0S positive daughters, for debug"}; - Configurable> indexK0Sneg{"indexK0Sneg", {730, 2867, 4755, 5458, 6892, 7825, 9244, 9811}, "indices of K0S negative daughters, for debug"}; - Configurable> indexProton{"indexProton", {717, 2810, 4393, 5442, 6769, 7793, 9002, 9789}, "indices of protons, for debug"}; -#endif // Needed for PV refitting Service ccdb; @@ -2716,12 +2872,9 @@ struct HfTrackIndexSkimCreatorCascades { PROCESS_SWITCH(HfTrackIndexSkimCreatorCascades, processNoCascades, "Do not skim HF -> V0 cascades", true); void processCascades(SelectedCollisions const& collisions, - aod::V0Datas const& v0s, // TODO: I am now assuming that the V0s are already filtered with my cuts (David's work to come) + aod::V0Datas const& v0s, FilteredTrackAssocSel const& trackIndices, aod::TracksWCovDcaExtra const& tracks, -#ifdef MY_DEBUG - aod::McParticles& mcParticles, -#endif aod::BCsWithTimestamps const&) { // set the magnetic field from CCDB @@ -2750,11 +2903,6 @@ struct HfTrackIndexSkimCreatorCascades { for (const auto& bachIdx : groupedBachTrackIndices) { auto bach = bachIdx.track_as(); - MY_DEBUG_MSG(1, printf("\n"); LOG(info) << "Bachelor loop"); -#ifdef MY_DEBUG - auto indexBach = bach.mcParticleId(); - bool isProtonFromLc = isProtonFromLcFunc(indexBach, indexProton); -#endif // selections on the bachelor // // retrieve the selection flag that corresponds to this collision @@ -2762,27 +2910,27 @@ struct HfTrackIndexSkimCreatorCascades { // pT cut if (!TESTBIT(isSelProngBach, CandidateType::CandV0bachelor)) { - MY_DEBUG_MSG(isProtonFromLc, LOG(info) << "proton " << indexBach << ": rejected due to HFsel"); continue; } if (tpcRefitBach) { if (!(bach.trackType() & o2::aod::track::TPCrefit)) { - MY_DEBUG_MSG(isProtonFromLc, LOG(info) << "proton " << indexBach << ": rejected due to TPCrefit"); continue; } } if (bach.tpcNClsCrossedRows() < nCrossedRowsMinBach) { - MY_DEBUG_MSG(isProtonFromLc, LOG(info) << "proton " << indexBach << ": rejected due to minNUmberOfCrossedRows " << bach.tpcNClsCrossedRows() << " (cut " << nCrossedRowsMinBach << ")"); continue; } - MY_DEBUG_MSG(isProtonFromLc, LOG(info) << "KEPT! proton from Lc with daughters " << indexBach); + + // PID + if (applyProtonPid && !TESTBIT(bachIdx.isProton(), ChannelsProtonPid::LcToPK0S)) { + continue; + } auto trackBach = getTrackParCov(bach); auto groupedV0s = v0s.sliceBy(v0sPerCollision, thisCollId); // now we loop over the V0s for (const auto& v0 : groupedV0s) { - MY_DEBUG_MSG(1, LOG(info) << "*** Checking next K0S"); // selections on the V0 daughters const auto& trackV0DaughPos = v0.posTrack_as(); const auto& trackV0DaughNeg = v0.negTrack_as(); @@ -2792,32 +2940,14 @@ struct HfTrackIndexSkimCreatorCascades { continue; } -#ifdef MY_DEBUG - auto indexV0DaughPos = trackV0DaughPos.mcParticleId(); - auto indexV0DaughNeg = trackV0DaughNeg.mcParticleId(); - bool isK0SfromLc = isK0SfromLcFunc(indexV0DaughPos, indexV0DaughNeg, indexK0Spos, indexK0Sneg); - - bool isLc = isLcK0SpFunc(indexBach, indexV0DaughPos, indexV0DaughNeg, indexProton, indexK0Spos, indexK0Sneg); -#endif - MY_DEBUG_MSG(isK0SfromLc, LOG(info) << "K0S from Lc found, trackV0DaughPos --> " << indexV0DaughPos << ", trackV0DaughNeg --> " << indexV0DaughNeg); - - MY_DEBUG_MSG(isK0SfromLc && isProtonFromLc, - LOG(info) << "ACCEPTED!!!"; - LOG(info) << "proton belonging to a Lc found: label --> " << indexBach; - LOG(info) << "K0S belonging to a Lc found: trackV0DaughPos --> " << indexV0DaughPos << ", trackV0DaughNeg --> " << indexV0DaughNeg); - - MY_DEBUG_MSG(isLc, LOG(info) << "Combination of K0S and p which correspond to a Lc found!"); - if (tpcRefitV0Daugh) { if (!(trackV0DaughPos.trackType() & o2::aod::track::TPCrefit) || !(trackV0DaughNeg.trackType() & o2::aod::track::TPCrefit)) { - MY_DEBUG_MSG(isK0SfromLc, LOG(info) << "K0S with daughters " << indexV0DaughPos << " and " << indexV0DaughNeg << ": rejected due to TPCrefit"); continue; } } if (trackV0DaughPos.tpcNClsCrossedRows() < nCrossedRowsMinV0Daugh || trackV0DaughNeg.tpcNClsCrossedRows() < nCrossedRowsMinV0Daugh) { - MY_DEBUG_MSG(isK0SfromLc, LOG(info) << "K0S with daughters " << indexV0DaughPos << " and " << indexV0DaughNeg << ": rejected due to minCrossedRows"); continue; } // @@ -2828,24 +2958,20 @@ struct HfTrackIndexSkimCreatorCascades { // if (trackV0DaughPos.pt() < ptMinV0Daugh || // to the filters? I can't for now, it is not in the tables trackV0DaughNeg.pt() < ptMinV0Daugh) { - MY_DEBUG_MSG(isK0SfromLc, LOG(info) << "K0S with daughters " << indexV0DaughPos << " and " << indexV0DaughNeg << ": rejected due to minPt --> pos " << trackV0DaughPos.pt() << ", neg " << trackV0DaughNeg.pt() << " (cut " << ptMinV0Daugh << ")"); continue; } if ((trackV0DaughPos.eta() > etaMaxV0Daugh || trackV0DaughPos.eta() < etaMinV0Daugh) || // to the filters? I can't for now, it is not in the tables (trackV0DaughNeg.eta() > etaMaxV0Daugh || trackV0DaughNeg.eta() < etaMinV0Daugh)) { - MY_DEBUG_MSG(isK0SfromLc, LOG(info) << "K0S with daughters " << indexV0DaughPos << " and " << indexV0DaughNeg << ": rejected due to eta --> pos " << trackV0DaughPos.eta() << ", neg " << trackV0DaughNeg.eta() << " (cut " << etaMinV0Daugh << " to " << etaMaxV0Daugh << ")"); continue; } // V0 invariant mass selection if (std::abs(v0.mK0Short() - massK0s) > cutInvMassV0) { - MY_DEBUG_MSG(isK0SfromLc, LOG(info) << "K0S with daughters " << indexV0DaughPos << " and " << indexV0DaughNeg << ": rejected due to invMass --> " << v0.mK0Short() - massK0s << " (cut " << cutInvMassV0 << ")"); continue; // should go to the filter, but since it is a dynamic column, I cannot use it there } // V0 cosPointingAngle selection if (v0.v0cosPA() < cpaV0Min) { - MY_DEBUG_MSG(isK0SfromLc, LOG(info) << "K0S with daughters " << indexV0DaughPos << " and " << indexV0DaughNeg << ": rejected due to cosPA --> " << v0.v0cosPA() << " (cut " << cpaV0Min << ")"); continue; } @@ -2855,12 +2981,9 @@ struct HfTrackIndexSkimCreatorCascades { // TODO: but one should better check that the value here and after the fitter do not change significantly!!! mass2K0sP = RecoDecay::m(std::array{std::array{bach.px(), bach.py(), bach.pz()}, momentumV0}, std::array{massP, massK0s}); if ((cutInvMassCascLc >= 0.) && (std::abs(mass2K0sP - massLc) > cutInvMassCascLc)) { - MY_DEBUG_MSG(isK0SfromLc && isProtonFromLc, LOG(info) << "True Lc from proton " << indexBach << " and K0S pos " << indexV0DaughPos << " and neg " << indexV0DaughNeg << " rejected due to invMass cut: " << mass2K0sP << ", mass Lc " << massLc << " (cut " << cutInvMassCascLc << ")"); continue; } - MY_DEBUG_MSG(isK0SfromLc, LOG(info) << "KEPT! K0S from Lc with daughters " << indexV0DaughPos << " and " << indexV0DaughNeg); - auto trackParCovV0DaughPos = getTrackParCov(trackV0DaughPos); trackParCovV0DaughPos.propagateTo(v0.posX(), o2::base::Propagator::Instance()->getNominalBz()); // propagate the track to the X closest to the V0 vertex auto trackParCovV0DaughNeg = getTrackParCov(trackV0DaughNeg); @@ -2874,8 +2997,6 @@ struct HfTrackIndexSkimCreatorCascades { // now we find the DCA between the V0 and the bachelor, for the cascade int nCand2 = fitter.process(trackV0, trackBach); - MY_DEBUG_MSG(isK0SfromLc && isProtonFromLc, LOG(info) << "Fitter result = " << nCand2 << " proton = " << indexBach << " and K0S pos " << indexV0DaughPos << " and neg " << indexV0DaughNeg); - MY_DEBUG_MSG(isLc, LOG(info) << "Fitter result for true Lc = " << nCand2); if (nCand2 == 0) { continue; } @@ -2886,7 +3007,6 @@ struct HfTrackIndexSkimCreatorCascades { // cascade candidate pT cut auto ptCascCand = RecoDecay::pt(pVecBach, pVecV0); if (ptCascCand < ptCascCandMin) { - MY_DEBUG_MSG(isK0SfromLc && isProtonFromLc, LOG(info) << "True Lc from proton " << indexBach << " and K0S pos " << indexV0DaughPos << " and neg " << indexV0DaughNeg << " rejected due to pt cut: " << ptCascCand << " (cut " << ptCascCandMin << ")"); continue; } @@ -2904,7 +3024,6 @@ struct HfTrackIndexSkimCreatorCascades { rowTrackIndexCasc(thisCollId, bach.globalIndex(), v0.v0Id()); // fill histograms if (fillHistograms) { - MY_DEBUG_MSG(isK0SfromLc && isProtonFromLc && isLc, LOG(info) << "KEPT! True Lc from proton " << indexBach << " and K0S pos " << indexV0DaughPos << " and neg " << indexV0DaughNeg); registry.fill(HIST("hVtx2ProngX"), posCasc[0]); registry.fill(HIST("hVtx2ProngY"), posCasc[1]); registry.fill(HIST("hVtx2ProngZ"), posCasc[2]); From 9591217d48268a1b00575ec7aa7111834959e5a0 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 22 Nov 2023 16:18:43 +0000 Subject: [PATCH 2/9] Please consider the following formatting changes --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index d2cc8a045e6..010fd11dfc7 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -495,7 +495,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } // configure proton PID - for (auto iChannel{0u}; iChannelget(iChannel, "minPtTpc"), selectionsProtonPid->get(iChannel, "maxPtTpc")); selectorProton[iChannel].setRangePtTof(selectionsProtonPid->get(iChannel, "minPtTof"), selectionsProtonPid->get(iChannel, "maxPtTof")); selectorProton[iChannel].setRangeNSigmaTpc(-selectionsProtonPid->get(iChannel, "nSigmaMaxTpc"), selectionsProtonPid->get(iChannel, "nSigmaMaxTpc")); @@ -512,28 +512,28 @@ struct HfTrackIndexSkimCreatorTagSelTracks { std::array statusPid = {TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted}; if constexpr (pidStrategy == ProtonPidStrategy::PidTofOnly) { - for (auto iChannel{0u}; iChannel + template void performPvRefitTrack(aod::Collision const& collision, aod::BCsWithTimestamps const& bcWithTimeStamps, std::vector vecPvContributorGlobId, @@ -924,14 +924,14 @@ struct HfTrackIndexSkimCreatorTagSelTracks { /// Partition for PV contributors - template + template void runTagSelTracks(aod::Collision const& collision, - TTracks const& tracks, // all tracks + TTracks const& tracks, // all tracks GroupedTrackIndices const& trackIndicesCollision, // track indices associated to this collision (from track-to-collision-associator) - GroupedPvContributors const& pvContrCollision, // PV contributors of this collision - aod::BCsWithTimestamps const& bcWithTimeStamps, // for PV refit - int64_t numTracksThisColl, // number of tracks in this collision (for PV refit) - int64_t offsetTracksThisColl) // offset of tracks in this collision with respect to total table (for PV refit) + GroupedPvContributors const& pvContrCollision, // PV contributors of this collision + aod::BCsWithTimestamps const& bcWithTimeStamps, // for PV refit + int64_t numTracksThisColl, // number of tracks in this collision (for PV refit) + int64_t offsetTracksThisColl) // offset of tracks in this collision with respect to total table (for PV refit) { // prepare vectors to cache quantities needed for PV refit std::vector> pvRefitDcaPerTrack{}; From 520ac8f727a3b47163535426cef417b8b09d2e05 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Wed, 22 Nov 2023 17:21:59 +0100 Subject: [PATCH 3/9] Restore author removed by mistake --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 010fd11dfc7..69b8015f4f0 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -18,6 +18,7 @@ /// \author Mattia Faggin , University and INFN Padova /// \author Jinjoo Seo , Inha University /// \author Fabrizio Grosa , CERN +//// \author Federica Zanone , Heidelberg University #include // std::find #include // std::distance From 2b1d3ce85f15ff7dc51cf42306b8678ab46be131 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Thu, 23 Nov 2023 10:03:00 +0100 Subject: [PATCH 4/9] Remove all MY_DEBUG instances --- .../TableProducer/candidateCreatorCascade.cxx | 78 ++-------------- .../candidateSelectorLcToK0sP.cxx | 1 - PWGHF/Utils/utilsDebugLcToK0sP.h | 89 ------------------- 3 files changed, 7 insertions(+), 161 deletions(-) delete mode 100644 PWGHF/Utils/utilsDebugLcToK0sP.h diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index d7da1b02456..9fb587906b6 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -27,25 +27,11 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" -#include "PWGHF/Utils/utilsDebugLcToK0sP.h" using namespace o2; using namespace o2::analysis; using namespace o2::framework; -// #define MY_DEBUG - -#ifdef MY_DEBUG -using MyBigTracks = soa::Join; -#define MY_DEBUG_MSG(condition, cmd) \ - if (condition) { \ - cmd; \ - } -#else -using MyBigTracks = aod::TracksWCov; -#define MY_DEBUG_MSG(condition, cmd) -#endif - /// Reconstruction of heavy-flavour cascade decay candidates struct HfCandidateCreatorCascade { Produces rowCandidateBase; @@ -72,13 +58,6 @@ struct HfCandidateCreatorCascade { o2::base::MatLayerCylSet* lut; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; - // for debugging -#ifdef MY_DEBUG - Configurable> indexK0Spos{"indexK0Spos", {729, 2866, 4754, 5457, 6891, 7824, 9243, 9810}, "indices of K0S positive daughters, for debug"}; - Configurable> indexK0Sneg{"indexK0Sneg", {730, 2867, 4755, 5458, 6892, 7825, 9244, 9811}, "indices of K0S negative daughters, for debug"}; - Configurable> indexProton{"indexProton", {717, 2810, 4393, 5442, 6769, 7793, 9002, 9789}, "indices of protons, for debug"}; -#endif - int runNumber{0}; double massP{0.}; double massK0s{0.}; @@ -106,15 +85,10 @@ struct HfCandidateCreatorCascade { void process(aod::Collisions const&, aod::HfCascades const& rowsTrackIndexCasc, - MyBigTracks const&, + aod::TracksWCov const&, aod::V0sLinked const&, aod::V0Datas const&, - aod::BCsWithTimestamps const& -#ifdef MY_DEBUG - , - aod::McParticles const& mcParticles -#endif - ) + aod::BCsWithTimestamps const&) { // 2-prong vertex fitter o2::vertexing::DCAFitterN<2> df; @@ -130,7 +104,7 @@ struct HfCandidateCreatorCascade { // loop over pairs of track indeces for (const auto& casc : rowsTrackIndexCasc) { - const auto& bach = casc.prong0_as(); + const auto& bach = casc.prong0_as(); LOGF(debug, "V0 %d in HF cascade %d.", casc.v0Id(), casc.globalIndex()); if (!casc.has_v0()) { LOGF(error, "V0 not there for HF cascade %d. Skipping candidate.", casc.globalIndex()); @@ -144,8 +118,8 @@ struct HfCandidateCreatorCascade { } LOGF(debug, "V0Data ID: %d", casc.v0_as().v0DataId()); const auto& v0 = casc.v0_as().v0Data(); - const auto& trackV0DaughPos = v0.posTrack_as(); - const auto& trackV0DaughNeg = v0.negTrack_as(); + const auto& trackV0DaughPos = v0.posTrack_as(); + const auto& trackV0DaughNeg = v0.negTrack_as(); auto collision = casc.collision(); @@ -160,18 +134,9 @@ struct HfCandidateCreatorCascade { } df.setBz(bz); -#ifdef MY_DEBUG - auto indexBach = bach.mcParticleId(); - auto indexV0DaughPos = trackV0DaughPos.mcParticleId(); - auto indexV0DaughNeg = trackV0DaughNeg.mcParticleId(); - bool isLc = isLcK0SpFunc(indexBach, indexV0DaughPos, indexV0DaughNeg, indexProton, indexK0Spos, indexK0Sneg); -#endif - - MY_DEBUG_MSG(isLc, LOG(info) << "Processing the Lc with proton " << indexBach << " trackV0DaughPos " << indexV0DaughPos << " trackV0DaughNeg " << indexV0DaughNeg); - auto trackParCovBach = getTrackParCov(bach); - auto trackParCovV0DaughPos = getTrackParCov(trackV0DaughPos); // check that MyBigTracks does not need TracksDCA! - auto trackParCovV0DaughNeg = getTrackParCov(trackV0DaughNeg); // check that MyBigTracks does not need TracksDCA! + auto trackParCovV0DaughPos = getTrackParCov(trackV0DaughPos); // check that aod::TracksWCov does not need TracksDCA! + auto trackParCovV0DaughNeg = getTrackParCov(trackV0DaughNeg); // check that aod::TracksWCov does not need TracksDCA! trackParCovV0DaughPos.propagateTo(v0.posX(), bz); // propagate the track to the X closest to the V0 vertex trackParCovV0DaughNeg.propagateTo(v0.negX(), bz); // propagate the track to the X closest to the V0 vertex const std::array vertexV0 = {v0.x(), v0.y(), v0.z()}; @@ -181,10 +146,6 @@ struct HfCandidateCreatorCascade { // reconstruct the cascade secondary vertex if (df.process(trackV0, trackParCovBach) == 0) { - MY_DEBUG_MSG(isLc, LOG(info) << "Vertexing failed for Lc candidate"); - // if (isLc) { - // LOG(info) << "Vertexing failed for Lc with proton " << indexBach << " trackV0DaughPos " << indexV0DaughPos << " trackV0DaughNeg " << indexV0DaughNeg; - //} continue; } else { // LOG(info) << "Vertexing succeeded for Lc candidate"; @@ -221,7 +182,6 @@ struct HfCandidateCreatorCascade { auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.)); // fill candidate table rows - MY_DEBUG_MSG(isLc, LOG(info) << "IT IS A Lc! Filling for Lc with proton " << indexBach << " trackV0DaughPos " << indexV0DaughPos << " trackV0DaughNeg " << indexV0DaughNeg); rowCandidateBase(collision.globalIndex(), collision.posX(), collision.posY(), collision.posZ(), secondaryVertex[0], secondaryVertex[1], secondaryVertex[2], @@ -258,12 +218,6 @@ struct HfCandidateCreatorCascadeMc { Produces rowMcMatchRec; Produces rowMcMatchGen; -#ifdef MY_DEBUG - Configurable> indexK0Spos{"indexK0Spos", {729, 2866, 4754, 5457, 6891, 7824, 9243, 9810}, "indices of K0S positive daughters, for debug"}; - Configurable> indexK0Sneg{"indexK0Sneg", {730, 2867, 4755, 5458, 6892, 7825, 9244, 9811}, "indices of K0S negative daughters, for debug"}; - Configurable> indexProton{"indexProton", {717, 2810, 4393, 5442, 6769, 7793, 9002, 9789}, "indices of protons, for debug"}; -#endif - using MyTracksWMc = soa::Join; void processMc(MyTracksWMc const& tracks, @@ -293,26 +247,10 @@ struct HfCandidateCreatorCascadeMc { LOG(debug) << "\n"; LOG(debug) << "Checking MC for candidate!"; LOG(debug) << "Looking for K0s"; -#ifdef MY_DEBUG - auto indexV0DaughPos = trackV0DaughPos.mcParticleId(); - auto indexV0DaughNeg = trackV0DaughNeg.mcParticleId(); - auto indexBach = bach.mcParticleId(); - bool isLc = isLcK0SpFunc(indexBach, indexV0DaughPos, indexV0DaughNeg, indexProton, indexK0Spos, indexK0Sneg); - bool isK0SfromLc = isK0SfromLcFunc(indexV0DaughPos, indexV0DaughNeg, indexK0Spos, indexK0Sneg); -#endif - MY_DEBUG_MSG(isK0SfromLc, LOG(info) << "correct K0S in the Lc daughters: posTrack --> " << indexV0DaughPos << ", negTrack --> " << indexV0DaughNeg); // if (isLc) { RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersV0, kK0Short, std::array{+kPiPlus, -kPiPlus}, false, &sign, 1); - if (sign != 0) { // we have already positively checked the K0s - // then we check the Lc - MY_DEBUG_MSG(sign, LOG(info) << "K0S was correct! now we check the Lc"); - MY_DEBUG_MSG(sign, LOG(info) << "index proton = " << indexBach); - indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, pdg::Code::kLambdaCPlus, std::array{+kProton, +kPiPlus, -kPiPlus}, true, &sign, 3); // 3-levels Lc --> p + K0 --> p + K0s --> p + pi+ pi- - MY_DEBUG_MSG(sign, LOG(info) << "Lc found with sign " << sign; printf("\n")); - } - // Check whether the particle is non-prompt (from a b quark). if (sign != 0) { auto particle = mcParticles.rawIteratorAt(indexRec); @@ -333,7 +271,6 @@ struct HfCandidateCreatorCascadeMc { sign = -sign; } if (sign != 0) { - MY_DEBUG_MSG(sign, LOG(info) << "Lc in K0S p"); arrDaughLcIndex.clear(); // checking that the final daughters (decay depth = 3) are p, pi+, pi- RecoDecay::getDaughters(particle, &arrDaughLcIndex, arrDaughLcPDGRef, 3); // best would be to check the K0S daughters @@ -347,7 +284,6 @@ struct HfCandidateCreatorCascadeMc { } else { LOG(debug) << "Lc --> K0S+p found in MC table"; } - MY_DEBUG_MSG(sign == 0, LOG(info) << "Pity, the three final daughters are not p, pi+, pi-, but " << arrDaughLcPDG[0] << ", " << arrDaughLcPDG[1] << ", " << arrDaughLcPDG[2]); } } // Check whether the particle is non-prompt (from a b quark). diff --git a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx index bf058561a7b..d5575866fa2 100644 --- a/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx +++ b/PWGHF/TableProducer/candidateSelectorLcToK0sP.cxx @@ -25,7 +25,6 @@ #include "PWGHF/Core/HfMlResponse.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGHF/Utils/utilsDebugLcToK0sP.h" using namespace o2; using namespace o2::analysis; diff --git a/PWGHF/Utils/utilsDebugLcToK0sP.h b/PWGHF/Utils/utilsDebugLcToK0sP.h deleted file mode 100644 index 0a470c2fc14..00000000000 --- a/PWGHF/Utils/utilsDebugLcToK0sP.h +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file utilsDebugLcToK0sP.h -/// \brief Some utilities to do debugging for the LcK0Sp task -/// -/// For example, for: /alice/sim/2020/LHC20l3a/286350/PWGZZ/Run3_Conversion/156_20210308-1000/0001/AO2D.root - -#ifndef PWGHF_UTILS_UTILSDEBUGLCTOK0SP_H_ -#define PWGHF_UTILS_UTILSDEBUGLCTOK0SP_H_ - -/// listLabelsProton = {717, 2810, 4393, 5442, 6769, 7793, 9002, 9789, 10385, 12601, 13819, 17443, 19936, 21715, 23285, 23999, 25676, 28660, 30684, 32049, 34846, 37042, 39278, 40278, 41567, 43696, 44819, 45232, 46578, 47831, 48981, 53527, 57152, 58155, 59296, 61010, 61932, 63577, 65683, 68047, 69657, 70721, 73141, 75320, 76581, 78165, 79504, 80662, 81552, 84208, 86342, 86829, 87347, 89922, 95032, 96087, 97410, 100154, 101743, 103368, 104635, 106089, 108676, 110308, 111335, 111342, 112606, 113469, 114529, 114533, 116388, 117754, 118765, 118784, 119733, 120691, 121773, 123970, 125316, 127253, 129008, 129883, 131408, 132349, 132395, 133263, 134063, 135417, 136194, 137441, 138569, 139167, 141741, 143422, 144322, 145013, 145695, 147134, 148503, 149283, 149728, 153214, 154481, 155193, 158187, 159039, 160009, 161126, 162191, 163774, 165792, 166934, 168768, 174013, 174017, 175467, 177005, 177258, 178380, 179566, 179577, 181145, 187316, 188512, 189094, 191582, 193018, 194159, 195821, 197459, 201840, 202646, 203119, 203763, 205553, 207745, 208851, 211636, 216231, 217125, 217516, 218522, 219477, 219960, 223246, 224677, 224702, 225438, 227194, 230507, 231304, 232070, 232772, 234765, 235877, 236893, 237989, 239575, 241469, 243404, 244872, 245511, 246688, 249625, 250580, 251879, 253031, 254465, 254511, 255917, 256782, 258734, 261436, 262878, 264465, 264467, 268907, 269974, 271856, 274044, 276071, 276915, 278461, 279559, 280441, 281783, 281976, 283405, 284722, 286324, 287929, 289681, 291005, 292324, 293478, 296484, 300536} -/// listLabelsK0SPos = {729, 2866, 4754, 5457, 6891, 7824, 9243, 9810, 10388, 12665, 13830, 17460, 19955, 21786, 23319, 24010, 26234, 28713, 30699, 32056, 34866, 37075, 39314, 40287, 41617, 43790, 44868, 45252, 46587, 47866, 48992, 53534, 57211, 58160, 59355, 61019, 62003, 63580, 65691, 68164, 69721, 70852, 73167, 75331, 76641, 78188, 79595, 80678, 81613, 84311, 86376, 86840, 87374, 89998, 95078, 96094, 97425, 100157, 101788, 103468, 104646, 106155, 108696, 110388, 111355, 111348, 112712, 113578, 114556, 114550, 116432, 117766, 118796, 118790, 119766, 120728, 121872, 124027, 125407, 127284, 129068, 129924, 131453, 132456, 132436, 133266, 134084, 135470, 136207, 137446, 138616, 139217, 141832, 143513, 144416, 145018, 145702, 147139, 148508, 149290, 149737, 153271, 154515, 155206, 158200, 159059, 160082, 161140, 162208, 163777, 165874, 167001, 168852, 174033, 174027, 175501, 177396, 177265, 178383, 179595, 179580, 181168, 187326, 188608, 189128, 191591, 193025, 194170, 195824, 197472, 201905, 202664, 203163, 203835, 205556, 207838, 208866, 211654, 216312, 217132, 217554, 218616, 219503, 219996, 223354, 224713, 224707, 225482, 227207, 230562, 231324, 232083, 232809, 234774, 235892, 236900, 238038, 239629, 241517, 243460, 244881, 245553, 246721, 249672, 250589, 251882, 253034, 254543, 254539, 255941, 256808, 258807, 261612, 262887, 264473, 264471, 268912, 270023, 271998, 274081, 276125, 276952, 278530, 279613, 280446, 282152, 282034, 283408, 284753, 286615, 288037, 289736, 291009, 292336, 293565, 296529, 300564} -/// listLabelsK0SNeg = {730, 2867, 4755, 5458, 6892, 7825, 9244, 9811, 10389, 12666, 13831, 17461, 19956, 21787, 23320, 24011, 26235, 28714, 30700, 32057, 34867, 37076, 39315, 40288, 41618, 43791, 44869, 45253, 46588, 47867, 48993, 53535, 57212, 58161, 59356, 61020, 62004, 63581, 65692, 68165, 69722, 70853, 73168, 75332, 76642, 78189, 79596, 80679, 81614, 84312, 86377, 86841, 87375, 89999, 95079, 96095, 97426, 100158, 101789, 103469, 104647, 106156, 108697, 110389, 111356, 111349, 112713, 113579, 114557, 114551, 116433, 117767, 118797, 118791, 119767, 120729, 121873, 124028, 125408, 127285, 129069, 129925, 131454, 132457, 132437, 133267, 134085, 135471, 136208, 137447, 138617, 139218, 141833, 143514, 144417, 145019, 145703, 147140, 148509, 149291, 149738, 153272, 154516, 155207, 158201, 159060, 160083, 161141, 162209, 163778, 165875, 167002, 168853, 174034, 174028, 175502, 177397, 177266, 178384, 179596, 179581, 181169, 187327, 188609, 189129, 191592, 193026, 194171, 195825, 197473, 201906, 202665, 203164, 203836, 205557, 207839, 208867, 211655, 216313, 217133, 217555, 218617, 219504, 219997, 223355, 224714, 224708, 225483, 227208, 230563, 231325, 232084, 232810, 234775, 235893, 236901, 238039, 239630, 241518, 243461, 244882, 245554, 246722, 249673, 250590, 251883, 253035, 254544, 254540, 255942, 256809, 258808, 261613, 262888, 264474, 264472, 268913, 270024, 271999, 274082, 276126, 276953, 278531, 279614, 280447, 282153, 282035, 283409, 284754, 286616, 288038, 289737, 291010, 292337, 293566, 296530, 300565} -/// - -#include // std::any_of -#include // std::runtime_error -#include // std::vector - -inline bool isK0SfromLcFunc(int labelK0SPos, int labelK0SNeg, std::vector listLabelsK0SPos, std::vector listLabelsK0SNeg) -{ - - auto nPositiveDau = listLabelsK0SPos.size(); - auto nNegativeDau = listLabelsK0SNeg.size(); - - // checking sizes of vectors: they should be identical - if (nPositiveDau != nNegativeDau) { - LOG(error) << "Number of elements in vector of positive daughters of K0S different from the number of elements in the vector for the negative ones: " << nPositiveDau << " : " << nNegativeDau; - throw std::runtime_error("sizes of configurables for debug do not match"); - } - - // checking if we find the candidate - bool matchesK0Spositive = std::any_of(listLabelsK0SPos.begin(), listLabelsK0SPos.end(), [&labelK0SPos](const int& label) { return label == labelK0SPos; }); - bool matchesK0Snegative = std::any_of(listLabelsK0SNeg.begin(), listLabelsK0SNeg.end(), [&labelK0SNeg](const int& label) { return label == labelK0SNeg; }); - if (matchesK0Spositive && matchesK0Snegative) { - return true; - } - - return false; -} - -//------------------------------- - -inline bool isProtonFromLcFunc(int labelProton, std::vector listLabelsProton) -{ - // checking if we find the candidate` - bool matchesProton = std::any_of(listLabelsProton.begin(), listLabelsProton.end(), [&labelProton](const int& label) { return label == labelProton; }); - if (matchesProton) { - return true; - } - return false; -} - -//--------------------------------- - -inline bool isLcK0SpFunc(int labelProton, int labelK0SPos, int labelK0SNeg, std::vector listLabelsProton, std::vector listLabelsK0SPos, std::vector listLabelsK0SNeg) -{ - - auto nPositiveDau = listLabelsK0SPos.size(); - auto nNegativeDau = listLabelsK0SNeg.size(); - auto nProtons = listLabelsProton.size(); - - // checking sizes of vectors: they should be identical - if (nPositiveDau != nNegativeDau || nPositiveDau != nProtons) { - LOG(error) << "Number of elements in vector of positive daughters of K0S, in vector of negative daughters of K0S, and in vector of protons differ: " << nPositiveDau << " : " << nNegativeDau << " : " << nProtons; - throw std::runtime_error("sizes of configurables for debug do not match"); - } - - // checking if we find the candidate - bool matchesK0Spositive = std::any_of(listLabelsK0SPos.begin(), listLabelsK0SPos.end(), [&labelK0SPos](const int& label) { return label == labelK0SPos; }); - bool matchesK0Snegative = std::any_of(listLabelsK0SNeg.begin(), listLabelsK0SNeg.end(), [&labelK0SNeg](const int& label) { return label == labelK0SNeg; }); - bool matchesProton = std::any_of(listLabelsProton.begin(), listLabelsProton.end(), [&labelProton](const int& label) { return label == labelProton; }); - if (matchesK0Spositive && matchesK0Snegative && matchesProton) { - return true; - } - - return false; -} - -#endif // PWGHF_UTILS_UTILSDEBUGLCTOK0SP_H_ From a5091c02946c35ec38723129c9b5c464d03d9157 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Thu, 23 Nov 2023 10:24:03 +0100 Subject: [PATCH 5/9] Restore line wrongly deleted --- PWGHF/TableProducer/candidateCreatorCascade.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index 9fb587906b6..d3aa264b108 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -250,6 +250,10 @@ struct HfCandidateCreatorCascadeMc { // if (isLc) { RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersV0, kK0Short, std::array{+kPiPlus, -kPiPlus}, false, &sign, 1); + if (sign != 0) { // we have already positively checked the K0s + // then we check the Lc + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, pdg::Code::kLambdaCPlus, std::array{+kProton, +kPiPlus, -kPiPlus}, true, &sign, 3); // 3-levels Lc --> p + K0 --> p + K0s --> p + pi+ pi- + } // Check whether the particle is non-prompt (from a b quark). if (sign != 0) { From 2061753e98d443a641c5d56118a1a884b175083b Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Fri, 24 Nov 2023 12:51:49 +0100 Subject: [PATCH 6/9] Fallback to fill PVrefit table for all tracks at once to avoid crash due to tracks with no collision --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 156 +++++++++++++----- 1 file changed, 114 insertions(+), 42 deletions(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 69b8015f4f0..d59a321e520 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -923,28 +923,26 @@ struct HfTrackIndexSkimCreatorTagSelTracks { return; } /// end of performPvRefitTrack function - /// Partition for PV contributors - + /// Selection tag for tracks + /// \param collision is the collision iterator + /// \param tracks is the entire track table + /// \param trackIndicesCollision are the track indices associated to this collision (from track-to-collision-associator) + /// \param pvContrCollision are the PV contributors of this collision + /// \param bcWithTimeStamps is the bc with timestamp for PVrefit + /// \param pvRefitDcaPerTrack is a vector to be filled with track dcas after PV refit + /// \param pvRefitPvCoordPerTrack is a vector to be filled with PV coordinates after PV refit + /// \param pvRefitPvCovMatrixPerTrack is a vector to be filled with PV coordinate covariances after PV refit + /// \return true if the track is compatible with a proton hypothesis template void runTagSelTracks(aod::Collision const& collision, - TTracks const& tracks, // all tracks - GroupedTrackIndices const& trackIndicesCollision, // track indices associated to this collision (from track-to-collision-associator) - GroupedPvContributors const& pvContrCollision, // PV contributors of this collision - aod::BCsWithTimestamps const& bcWithTimeStamps, // for PV refit - int64_t numTracksThisColl, // number of tracks in this collision (for PV refit) - int64_t offsetTracksThisColl) // offset of tracks in this collision with respect to total table (for PV refit) + TTracks const& tracks, + GroupedTrackIndices const& trackIndicesCollision, + GroupedPvContributors const& pvContrCollision, + aod::BCsWithTimestamps const& bcWithTimeStamps, + std::vector>& pvRefitDcaPerTrack, + std::vector>& pvRefitPvCoordPerTrack, + std::vector>& pvRefitPvCovMatrixPerTrack) { - // prepare vectors to cache quantities needed for PV refit - std::vector> pvRefitDcaPerTrack{}; - std::vector> pvRefitPvCoordPerTrack{}; - std::vector> pvRefitPvCovMatrixPerTrack{}; - if (doPvRefit) { - pvRefitDcaPerTrack.resize(numTracksThisColl); - pvRefitPvCoordPerTrack.resize(numTracksThisColl); - pvRefitPvCovMatrixPerTrack.resize(numTracksThisColl); - tabPvRefitTrack.reserve(numTracksThisColl); - } - auto thisCollId = collision.globalIndex(); for (const auto& trackId : trackIndicesCollision) { int statusProng = BIT(CandidateType::NCandidateTypes) - 1; // all bits on @@ -980,9 +978,9 @@ struct HfTrackIndexSkimCreatorTagSelTracks { } performPvRefitTrack(collision, bcWithTimeStamps, vecPvContributorGlobId, vecPvContributorTrackParCov, track, pvRefitPvCoord, pvRefitPvCovMatrix, pvRefitDcaXYDcaZ); // we subtract the offset since trackIdx is the global index referred to the total track table - pvRefitDcaPerTrack[trackIdx - offsetTracksThisColl] = pvRefitDcaXYDcaZ; - pvRefitPvCoordPerTrack[trackIdx - offsetTracksThisColl] = pvRefitPvCoord; - pvRefitPvCovMatrixPerTrack[trackIdx - offsetTracksThisColl] = pvRefitPvCovMatrix; + pvRefitDcaPerTrack[trackIdx] = pvRefitDcaXYDcaZ; + pvRefitPvCoordPerTrack[trackIdx] = pvRefitPvCoord; + pvRefitPvCovMatrixPerTrack[trackIdx] = pvRefitPvCovMatrix; } else if (track.collisionId() != thisCollId) { auto bc = collision.bc_as(); initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, isRun2); @@ -1008,21 +1006,25 @@ struct HfTrackIndexSkimCreatorTagSelTracks { int8_t isProton = isSelectedProton(track); rowSelectedTrack(statusProng, isProton); } + } - if (doPvRefit) { /// fill table with PV refit info (it has to be filled per track and not track index) - for (auto iTrack{0}; iTrack < numTracksThisColl; ++iTrack) { - tabPvRefitTrack(pvRefitPvCoordPerTrack[iTrack][0], pvRefitPvCoordPerTrack[iTrack][1], pvRefitPvCoordPerTrack[iTrack][2], - pvRefitPvCovMatrixPerTrack[iTrack][0], pvRefitPvCovMatrixPerTrack[iTrack][1], pvRefitPvCovMatrixPerTrack[iTrack][2], pvRefitPvCovMatrixPerTrack[iTrack][3], pvRefitPvCovMatrixPerTrack[iTrack][4], pvRefitPvCovMatrixPerTrack[iTrack][5], - pvRefitDcaPerTrack[iTrack][0], pvRefitDcaPerTrack[iTrack][1]); - } + /// Helper function to fill PVrefit table + /// \param pvRefitDcaPerTrack is a vector to be filled with track dcas after PV refit + /// \param pvRefitPvCoordPerTrack is a vector to be filled with PV coordinates after PV refit + /// \param pvRefitPvCovMatrixPerTrack is a vector to be filled with PV coordinate covariances after PV refit + /// \return true if the track is compatible with a proton hypothesis + void fillPvRefitTable(std::vector>& pvRefitDcaPerTrack, + std::vector>& pvRefitPvCoordPerTrack, + std::vector>& pvRefitPvCovMatrixPerTrack) + { + for (auto iTrack{0u}; iTrack < pvRefitDcaPerTrack.size(); ++iTrack) { + tabPvRefitTrack(pvRefitPvCoordPerTrack[iTrack][0], pvRefitPvCoordPerTrack[iTrack][1], pvRefitPvCoordPerTrack[iTrack][2], + pvRefitPvCovMatrixPerTrack[iTrack][0], pvRefitPvCovMatrixPerTrack[iTrack][1], pvRefitPvCovMatrixPerTrack[iTrack][2], pvRefitPvCovMatrixPerTrack[iTrack][3], pvRefitPvCovMatrixPerTrack[iTrack][4], pvRefitPvCovMatrixPerTrack[iTrack][5], + pvRefitDcaPerTrack[iTrack][0], pvRefitDcaPerTrack[iTrack][1]); } } Preslice trackIndicesPerCollision = aod::track_association::collisionId; - Preslice tracksPerCollision = aod::track_association::collisionId; - Preslice tracksWithPidTpcPerCollision = aod::track_association::collisionId; - Preslice tracksWithPidTofPerCollision = aod::track_association::collisionId; - Preslice tracksWithPidTpcTofPerCollision = aod::track_association::collisionId; Partition pvContributors = ((aod::track::flags & (uint32_t)aod::track::PVContributor) == (uint32_t)aod::track::PVContributor); Partition pvContributorsWithPidTpc = ((aod::track::flags & (uint32_t)aod::track::PVContributor) == (uint32_t)aod::track::PVContributor); Partition pvContributorsWithPidTof = ((aod::track::flags & (uint32_t)aod::track::PVContributor) == (uint32_t)aod::track::PVContributor); @@ -1034,13 +1036,27 @@ struct HfTrackIndexSkimCreatorTagSelTracks { aod::BCsWithTimestamps const& bcWithTimeStamps) { rowSelectedTrack.reserve(tracks.size()); + // prepare vectors to cache quantities needed for PV refit + std::vector> pvRefitDcaPerTrack{}; + std::vector> pvRefitPvCoordPerTrack{}; + std::vector> pvRefitPvCovMatrixPerTrack{}; + if (doPvRefit) { + auto numTracks = tracks.size(); + pvRefitDcaPerTrack.resize(numTracks); + pvRefitPvCoordPerTrack.resize(numTracks); + pvRefitPvCovMatrixPerTrack.resize(numTracks); + tabPvRefitTrack.reserve(numTracks); + } for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto groupedTracks = tracks.sliceBy(tracksPerCollision, thisCollId); // we need to know the number of tracks in this collision and the offset for the PV refit auto pvContrCollision = pvContributors->sliceByCached(aod::track::collisionId, thisCollId, cache); - runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, groupedTracks.size(), groupedTracks.offset()); + runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); + } + + if (doPvRefit) { /// fill table with PV refit info (it has to be filled per track and not track index) + fillPvRefitTable(pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); } } @@ -1052,13 +1068,27 @@ struct HfTrackIndexSkimCreatorTagSelTracks { aod::BCsWithTimestamps const& bcWithTimeStamps) { rowSelectedTrack.reserve(tracks.size()); + // prepare vectors to cache quantities needed for PV refit + std::vector> pvRefitDcaPerTrack{}; + std::vector> pvRefitPvCoordPerTrack{}; + std::vector> pvRefitPvCovMatrixPerTrack{}; + if (doPvRefit) { + auto numTracks = tracks.size(); + pvRefitDcaPerTrack.resize(numTracks); + pvRefitPvCoordPerTrack.resize(numTracks); + pvRefitPvCovMatrixPerTrack.resize(numTracks); + tabPvRefitTrack.reserve(numTracks); + } for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto groupedTracks = tracks.sliceBy(tracksWithPidTpcPerCollision, thisCollId); // we need to know the number of tracks in this collision and the offset for the PV refit auto pvContrCollision = pvContributorsWithPidTpc->sliceByCached(aod::track::collisionId, thisCollId, cache); - runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, groupedTracks.size(), groupedTracks.offset()); + runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); + } + + if (doPvRefit) { /// fill table with PV refit info (it has to be filled per track and not track index) + fillPvRefitTable(pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); } } @@ -1070,13 +1100,27 @@ struct HfTrackIndexSkimCreatorTagSelTracks { aod::BCsWithTimestamps const& bcWithTimeStamps) { rowSelectedTrack.reserve(tracks.size()); + // prepare vectors to cache quantities needed for PV refit + std::vector> pvRefitDcaPerTrack{}; + std::vector> pvRefitPvCoordPerTrack{}; + std::vector> pvRefitPvCovMatrixPerTrack{}; + if (doPvRefit) { + auto numTracks = tracks.size(); + pvRefitDcaPerTrack.resize(numTracks); + pvRefitPvCoordPerTrack.resize(numTracks); + pvRefitPvCovMatrixPerTrack.resize(numTracks); + tabPvRefitTrack.reserve(numTracks); + } for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto groupedTracks = tracks.sliceBy(tracksWithPidTofPerCollision, thisCollId); // we need to know the number of tracks in this collision and the offset for the PV refit auto pvContrCollision = pvContributorsWithPidTof->sliceByCached(aod::track::collisionId, thisCollId, cache); - runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, groupedTracks.size(), groupedTracks.offset()); + runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); + } + + if (doPvRefit) { /// fill table with PV refit info (it has to be filled per track and not track index) + fillPvRefitTable(pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); } } @@ -1088,13 +1132,27 @@ struct HfTrackIndexSkimCreatorTagSelTracks { aod::BCsWithTimestamps const& bcWithTimeStamps) { rowSelectedTrack.reserve(tracks.size()); + // prepare vectors to cache quantities needed for PV refit + std::vector> pvRefitDcaPerTrack{}; + std::vector> pvRefitPvCoordPerTrack{}; + std::vector> pvRefitPvCovMatrixPerTrack{}; + if (doPvRefit) { + auto numTracks = tracks.size(); + pvRefitDcaPerTrack.resize(numTracks); + pvRefitPvCoordPerTrack.resize(numTracks); + pvRefitPvCovMatrixPerTrack.resize(numTracks); + tabPvRefitTrack.reserve(numTracks); + } for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto groupedTracks = tracks.sliceBy(tracksWithPidTpcTofPerCollision, thisCollId); // we need to know the number of tracks in this collision and the offset for the PV refit auto pvContrCollision = pvContributorsWithPidTpcTof->sliceByCached(aod::track::collisionId, thisCollId, cache); - runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, groupedTracks.size(), groupedTracks.offset()); + runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); + } + + if (doPvRefit) { /// fill table with PV refit info (it has to be filled per track and not track index) + fillPvRefitTable(pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); } } @@ -1106,13 +1164,27 @@ struct HfTrackIndexSkimCreatorTagSelTracks { aod::BCsWithTimestamps const& bcWithTimeStamps) { rowSelectedTrack.reserve(tracks.size()); + // prepare vectors to cache quantities needed for PV refit + std::vector> pvRefitDcaPerTrack{}; + std::vector> pvRefitPvCoordPerTrack{}; + std::vector> pvRefitPvCovMatrixPerTrack{}; + if (doPvRefit) { + auto numTracks = tracks.size(); + pvRefitDcaPerTrack.resize(numTracks); + pvRefitPvCoordPerTrack.resize(numTracks); + pvRefitPvCovMatrixPerTrack.resize(numTracks); + tabPvRefitTrack.reserve(numTracks); + } for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto groupedTracks = tracks.sliceBy(tracksWithPidTpcTofPerCollision, thisCollId); // we need to know the number of tracks in this collision and the offset for the PV refit auto pvContrCollision = pvContributorsWithPidTpcTof->sliceByCached(aod::track::collisionId, thisCollId, cache); - runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, groupedTracks.size(), groupedTracks.offset()); + runTagSelTracks(collision, tracks, groupedTrackIndices, pvContrCollision, bcWithTimeStamps, pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); + } + + if (doPvRefit) { /// fill table with PV refit info (it has to be filled per track and not track index) + fillPvRefitTable(pvRefitDcaPerTrack, pvRefitPvCoordPerTrack, pvRefitPvCovMatrixPerTrack); } } From e5b9abdd6e92cc66bf15719b8052ffd3d262e812 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Fri, 24 Nov 2023 15:11:46 +0100 Subject: [PATCH 7/9] Move initialisation of whichHypo --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index d59a321e520..f328a858599 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -1564,6 +1564,7 @@ struct HfTrackIndexSkimCreator { for (int iDecay3P = 0; iDecay3P < kN3ProngDecays; iDecay3P++) { // check proton PID for Lc and Xic + whichHypo[iDecay3P] = 3; if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && applyProtonPidForLcToPKPi) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && applyProtonPidForXicToPKPi)) { if ((iDecay3P == hf_cand_3prong::DecayType::LcToPKPi && !TESTBIT(isProtonTrack0, ChannelsProtonPid::LcToPKPi)) || (iDecay3P == hf_cand_3prong::DecayType::XicToPKPi && !TESTBIT(isProtonTrack0, ChannelsProtonPid::XicToPKPi))) { CLRBIT(whichHypo[iDecay3P], 0); @@ -1585,6 +1586,7 @@ struct HfTrackIndexSkimCreator { // return immediately if it is outside the defined pT bins if (pTBin == -1) { CLRBIT(isSelected, iDecay3P); + whichHypo[iDecay3P] = 0; if (debug) { cutStatus[iDecay3P][0] = false; } @@ -1593,7 +1595,6 @@ struct HfTrackIndexSkimCreator { // invariant mass double massHypos[2]; - whichHypo[iDecay3P] = 3; double min2 = pow(cut3Prong[iDecay3P].get(pTBin, massMinIndex[iDecay3P]), 2); double max2 = pow(cut3Prong[iDecay3P].get(pTBin, massMaxIndex[iDecay3P]), 2); From 4b4d99cd7f9ae4fc3a657a7e19d42faa152d073a Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Fri, 24 Nov 2023 18:38:27 +0100 Subject: [PATCH 8/9] Add check on hasTPC and hasTOF in case of single detector PID --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index f328a858599..b2716cc869d 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -514,12 +514,16 @@ struct HfTrackIndexSkimCreatorTagSelTracks { std::array statusPid = {TrackSelectorPID::Accepted, TrackSelectorPID::Accepted, TrackSelectorPID::Accepted}; if constexpr (pidStrategy == ProtonPidStrategy::PidTofOnly) { for (auto iChannel{0u}; iChannel < ChannelsProtonPid::NChannelsProtonPid; ++iChannel) { - statusPid[iChannel] = selectorProton[iChannel].statusTof(hfTrack); + if (hfTrack.hasTOF()) { + statusPid[iChannel] = selectorProton[iChannel].statusTof(hfTrack); + } } } if constexpr (pidStrategy == ProtonPidStrategy::PidTpcOnly) { for (auto iChannel{0u}; iChannel < ChannelsProtonPid::NChannelsProtonPid; ++iChannel) { - statusPid[iChannel] = selectorProton[iChannel].statusTpc(hfTrack); + if (hfTrack.hasTPC()) { + statusPid[iChannel] = selectorProton[iChannel].statusTpc(hfTrack); + } } } if constexpr (pidStrategy == ProtonPidStrategy::PidTpcOrTof) { From 8da059a569b90b8038b17763902368cde5e16aab Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Fri, 24 Nov 2023 18:40:18 +0100 Subject: [PATCH 9/9] Remove extra slash --- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index b2716cc869d..1781789dc3a 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -18,7 +18,7 @@ /// \author Mattia Faggin , University and INFN Padova /// \author Jinjoo Seo , Inha University /// \author Fabrizio Grosa , CERN -//// \author Federica Zanone , Heidelberg University +/// \author Federica Zanone , Heidelberg University #include // std::find #include // std::distance