From 7a93d8ee525e3b414e6f252c0a5f6f5f3fb1b62d Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 6 Jun 2024 12:19:51 +0200 Subject: [PATCH 1/7] PWGLF: adapt V0 TOF PID to be used also for coll-unassoc V0s --- .../Strangeness/lambdakzeropid.cxx | 100 +++++++++++------- 1 file changed, 62 insertions(+), 38 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx index 1624a8094d2..ff45caaf640 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx @@ -49,6 +49,7 @@ #include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" +#include "DataFormatsCalibration/MeanVertexObject.h" #include "CommonConstants/PhysicsConstants.h" #include "Common/TableProducer/PID/pidTOFBase.h" #include "Common/DataModel/PIDResponse.h" @@ -75,6 +76,9 @@ struct lambdakzeropid { Service ccdb; + // mean vertex position to be used if no collision associated + o2::dataformats::MeanVertexObject* mVtx = nullptr; + // For manual sliceBy Preslice perCollisionOriginal = o2::aod::v0data::collisionId; ; @@ -100,6 +104,11 @@ struct lambdakzeropid { Configurable lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable nSigmaPath{"nSigmaPath", "Users/d/ddobrigk/stratof", "Path of information for n-sigma calculation"}; + Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; + + // manual + Configurable manualRunNumber{"manualRunNumber", 544122, "manual run number if no collisions saved"}; + Configurable manualTimeStamp{"manualTimeStamp", 1696549226920, "manual time stamp if no collisions saved"}; ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; @@ -318,10 +327,9 @@ struct lambdakzeropid { } } - template - void initCCDB(TInformationClass const& infoObject) + void initCCDB(int runNumber, uint64_t timeStamp) { - if (mRunNumber == infoObject.runNumber()) { + if (mRunNumber == runNumber) { return; } @@ -333,11 +341,12 @@ struct lambdakzeropid { grpmag.setL3Current(30000.f / (d_bz / 5.0f)); } o2::base::Propagator::initFieldFromGRP(&grpmag); - mRunNumber = infoObject.runNumber(); + mVtx = ccdb->getForTimeStamp(mVtxPath, timeStamp); + mRunNumber = runNumber; return; } - auto run3grp_timestamp = infoObject.timestamp(); + auto run3grp_timestamp = timeStamp; o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); o2::parameters::GRPMagField* grpmag = 0x0; if (grpo) { @@ -353,12 +362,13 @@ struct lambdakzeropid { o2::base::Propagator::initFieldFromGRP(grpmag); // Fetch magnetic field from ccdb for current collision d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + mVtx = ccdb->getForTimeStamp(mVtxPath, timeStamp); LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; } // if TOF Nsigma desired if (doNSigmas) { - nSigmaCalibObjects = ccdb->getForTimeStamp(nSigmaPath, infoObject.timestamp()); + nSigmaCalibObjects = ccdb->getForTimeStamp(nSigmaPath, timeStamp); if (nSigmaCalibObjects) { LOGF(info, "loaded TList with this many objects: %i", nSigmaCalibObjects->GetEntries()); @@ -393,7 +403,7 @@ struct lambdakzeropid { } } } - mRunNumber = infoObject.runNumber(); + mRunNumber = runNumber; } float velocity(float lMomentum, float lMass) @@ -409,7 +419,7 @@ struct lambdakzeropid { void processV0Candidate(TCollision const& collision, TV0 const& v0, TTrack const& pTra, TTrack const& nTra) { // time of V0 segment - float lengthV0 = std::hypot(v0.x() - collision.posX(), v0.y() - collision.posY(), v0.z() - collision.posZ()); + float lengthV0 = std::hypot(v0.x() - collision.getX(), v0.y() - collision.getY(), v0.z() - collision.getZ()); float velocityK0Short = velocity(v0.p(), o2::constants::physics::MassKaonNeutral); float velocityLambda = velocity(v0.p(), o2::constants::physics::MassLambda); float timeK0Short = lengthV0 / velocityK0Short; // in picoseconds @@ -582,43 +592,57 @@ struct lambdakzeropid { void processStandardData(aod::Collisions const& collisions, V0OriginalDatas const& V0s, TracksWithAllExtras const&, aod::BCsWithTimestamps const& /*bcs*/) { - auto collision = collisions.begin(); - auto bc = collision.bc_as(); - // Fire up CCDB - based on standard collisions - initCCDB(bc); - for (const auto& collision : collisions) { - // Do analysis with collision-grouped V0s, retain full collision information - const uint64_t collIdx = collision.globalIndex(); - auto V0Table_thisCollision = V0s.sliceBy(perCollisionOriginal, collIdx); - histos.fill(HIST("hCandidateCounter"), V0Table_thisCollision.size()); - // V0 table sliced - for (auto const& v0 : V0Table_thisCollision) { - // de-reference interlinks by hand for derived data - auto pTra = v0.posTrack_as(); - auto nTra = v0.negTrack_as(); - - processV0Candidate(collision, v0, pTra, nTra); + // Fire up CCDB with first collision in record. If no collisions, bypass + if(collisions.size()>0){ + auto collision = collisions.begin(); + auto bc = collision.bc_as(); + initCCDB(bc.runNumber(), bc.timestamp()); + }else{ + initCCDB(manualRunNumber, manualTimeStamp); + } + + for (const auto& V0 : V0s) { + // for storing whatever is the relevant quantity for the PV + o2::dataformats::VertexBase primaryVertex; + if (V0.has_collision()) { + auto const& collision = V0.collision(); + primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); + primaryVertex.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + } else { + primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); } + + auto pTra = V0.posTrack_as(); + auto nTra = V0.negTrack_as(); + processV0Candidate(primaryVertex, V0, pTra, nTra); } } void processDerivedData(soa::Join const& collisions, V0DerivedDatas const& V0s, dauTracks const&) { - for (const auto& collision : collisions) { - // Fire up CCDB - based on StraCollisions for derived analysis - initCCDB(collision); - // Do analysis with collision-grouped V0s, retain full collision information - const uint64_t collIdx = collision.globalIndex(); - auto V0Table_thisCollision = V0s.sliceBy(perCollisionDerived, collIdx); - histos.fill(HIST("hCandidateCounter"), V0Table_thisCollision.size()); - // V0 table sliced - for (auto const& v0 : V0Table_thisCollision) { - // de-reference interlinks by hand for derived data - auto pTra = v0.posTrackExtra_as(); - auto nTra = v0.negTrackExtra_as(); - - processV0Candidate(collision, v0, pTra, nTra); + // Fire up CCDB with first collision in record. If no collisions, bypass + if(collisions.size()>0){ + auto collision = collisions.begin(); + initCCDB(collision.runNumber(), collision.timestamp()); + }else{ + initCCDB(manualRunNumber, manualTimeStamp); + } + + for (const auto& V0 : V0s) { + // for storing whatever is the relevant quantity for the PV + o2::dataformats::VertexBase primaryVertex; + if (V0.has_straCollision()) { + auto const& collision = V0.straCollision(); + primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); + // cov: won't be used anyways, all fine + primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); + } else { + primaryVertex.setPos({mVtx->getX(), mVtx->getY(), mVtx->getZ()}); } + + auto pTra = V0.posTrackExtra_as(); + auto nTra = V0.negTrackExtra_as(); + processV0Candidate(primaryVertex, V0, pTra, nTra); } } From 99b4780d927a8a719b0de81c259384799275700b Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Thu, 6 Jun 2024 12:25:38 +0200 Subject: [PATCH 2/7] Please consider the following formatting changes (#305) --- PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx index ff45caaf640..061e70c964e 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx @@ -106,7 +106,7 @@ struct lambdakzeropid { Configurable nSigmaPath{"nSigmaPath", "Users/d/ddobrigk/stratof", "Path of information for n-sigma calculation"}; Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; - // manual + // manual Configurable manualRunNumber{"manualRunNumber", 544122, "manual run number if no collisions saved"}; Configurable manualTimeStamp{"manualTimeStamp", 1696549226920, "manual time stamp if no collisions saved"}; @@ -593,11 +593,11 @@ struct lambdakzeropid { void processStandardData(aod::Collisions const& collisions, V0OriginalDatas const& V0s, TracksWithAllExtras const&, aod::BCsWithTimestamps const& /*bcs*/) { // Fire up CCDB with first collision in record. If no collisions, bypass - if(collisions.size()>0){ + if (collisions.size() > 0) { auto collision = collisions.begin(); auto bc = collision.bc_as(); initCCDB(bc.runNumber(), bc.timestamp()); - }else{ + } else { initCCDB(manualRunNumber, manualTimeStamp); } @@ -621,10 +621,10 @@ struct lambdakzeropid { void processDerivedData(soa::Join const& collisions, V0DerivedDatas const& V0s, dauTracks const&) { // Fire up CCDB with first collision in record. If no collisions, bypass - if(collisions.size()>0){ + if (collisions.size() > 0) { auto collision = collisions.begin(); initCCDB(collision.runNumber(), collision.timestamp()); - }else{ + } else { initCCDB(manualRunNumber, manualTimeStamp); } From 39095e1b461bd65ca590b11433109cabb99960af Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 6 Jun 2024 14:25:48 +0200 Subject: [PATCH 3/7] Add correct cast --- PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx index 061e70c964e..0e8617d51c7 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx @@ -632,7 +632,7 @@ struct lambdakzeropid { // for storing whatever is the relevant quantity for the PV o2::dataformats::VertexBase primaryVertex; if (V0.has_straCollision()) { - auto const& collision = V0.straCollision(); + auto const& collision = V0.straCollision_as(); primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); // cov: won't be used anyways, all fine primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); From 9b1c37e6551fb9b2a7e9568ce6859b55c608121d Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Thu, 6 Jun 2024 14:37:06 +0200 Subject: [PATCH 4/7] Fix compilation-stopping typo --- PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx index 0e8617d51c7..18a5c7efe25 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx @@ -632,7 +632,7 @@ struct lambdakzeropid { // for storing whatever is the relevant quantity for the PV o2::dataformats::VertexBase primaryVertex; if (V0.has_straCollision()) { - auto const& collision = V0.straCollision_as(); + auto const& collision = V0.straCollision_as>(); primaryVertex.setPos({collision.posX(), collision.posY(), collision.posZ()}); // cov: won't be used anyways, all fine primaryVertex.setCov(1e-6, 1e-6, 1e-6, 1e-6, 1e-6, 1e-6); From 1c00b325232dab73c4ca9a832d775b591f7f32df Mon Sep 17 00:00:00 2001 From: gianniliveraro Date: Fri, 7 Jun 2024 12:09:13 -0300 Subject: [PATCH 5/7] findableStudy: straCollision check --- PWGLF/Tasks/QC/findableStudy.cxx | 287 ++++++++++++++++--------------- 1 file changed, 146 insertions(+), 141 deletions(-) diff --git a/PWGLF/Tasks/QC/findableStudy.cxx b/PWGLF/Tasks/QC/findableStudy.cxx index 61c5b4e244a..98f398c23df 100644 --- a/PWGLF/Tasks/QC/findableStudy.cxx +++ b/PWGLF/Tasks/QC/findableStudy.cxx @@ -61,7 +61,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using recoStraCollisions = soa::Join; +using recoStraCollisions = soa::Join; using reconstructedV0s = soa::Join; using reconstructedV0sNoMC = soa::Join; @@ -280,161 +280,166 @@ struct findableStudy { // Detailed analysis level bool topoV0RadiusOK = false, topoV0RadiusMaxOK = false, topoV0CosPAOK = false, topoDcaPosToPVOK = false, topoDcaNegToPVOK = false, topoDcaV0DauOK = false; - auto coll = recv0.straCollision_as(); - int mcCollID_fromCollision = coll.straMCCollisionId(); - int mcCollID_fromV0 = recv0.straMCCollisionId(); - if (mcCollID_fromCollision != mcCollID_fromV0) { - hasWrongCollision = true; - } else { - // if this is a correctly collision-associated V0, take centrality from here - // N.B.: this could still be an issue if collision <-> mc collision is imperfect - centrality = coll.centFT0C(); - } - - if (recv0.isFound()) { - hasBeenFoundAny = true; // includes also ITS-only, checked before skipITSonly check - } - - if ( - (pTrack.hasTPC() && pTrack.hasITS()) || // full global track - (pTrack.hasTPC() && pTrack.hasTOF()) || // TPC + TOF is accepted - (pTrack.hasTPC() && pTrack.hasTRD()) || // TPC + TRD is accepted - (!pTrack.hasTPC() && pTrack.itsNCls() >= 6) // long ITS-only - ) { - pTrackOK = true; // for this V0 only - } - if ( - (nTrack.hasTPC() && nTrack.hasITS()) || - (nTrack.hasTPC() && nTrack.hasTOF()) || // TPC + TOF is accepted - (nTrack.hasTPC() && nTrack.hasTRD()) || // TPC + TRD is accepted - (!nTrack.hasTPC() && nTrack.itsNCls() >= 6)) { - nTrackOK = true; // for this V0 only - } + if (recv0.has_straCollision()) { + auto coll = recv0.straCollision_as(); + int mcCollID_fromCollision = coll.straMCCollisionId(); + int mcCollID_fromV0 = recv0.straMCCollisionId(); + if (mcCollID_fromCollision != mcCollID_fromV0) { + hasWrongCollision = true; + } else { + // if this is a correctly collision-associated V0, take centrality from here + // N.B.: this could still be an issue if collision <-> mc collision is imperfect + centrality = coll.centFT0C(); + } - if (pTrackOK && nTrackOK) - hasBeenAcceptablyTracked = true; + if (recv0.isFound()) { + hasBeenFoundAny = true; // includes also ITS-only, checked before skipITSonly check + } - // cross-check correctness of new getter - if (pTrack.hasITSTracker() && (pTrack.hasITS() && pTrack.itsChi2PerNcl() < -1e-3)) { - LOGF(fatal, "Positive track: inconsistent outcome of ITS tracker getter and explicit check!"); - } - if (nTrack.hasITSTracker() && (pTrack.hasITS() && nTrack.itsChi2PerNcl() < -1e-3)) { - LOGF(fatal, "Negative track: inconsistent outcome of ITS tracker getter and explicit check!"); - } - if (pTrack.hasITSAfterburner() && (pTrack.hasITS() && pTrack.itsChi2PerNcl() > -1e-3)) { - LOGF(fatal, "Positive track: inconsistent outcome of ITS tracker getter and explicit check!"); - } - if (nTrack.hasITSAfterburner() && (pTrack.hasITS() && nTrack.itsChi2PerNcl() > -1e-3)) { - LOGF(fatal, "Negative track: inconsistent outcome of ITS tracker getter and explicit check!"); - } + if ( + (pTrack.hasTPC() && pTrack.hasITS()) || // full global track + (pTrack.hasTPC() && pTrack.hasTOF()) || // TPC + TOF is accepted + (pTrack.hasTPC() && pTrack.hasTRD()) || // TPC + TRD is accepted + (!pTrack.hasTPC() && pTrack.itsNCls() >= 6) // long ITS-only + ) { + pTrackOK = true; // for this V0 only + } + if ( + (nTrack.hasTPC() && nTrack.hasITS()) || + (nTrack.hasTPC() && nTrack.hasTOF()) || // TPC + TOF is accepted + (nTrack.hasTPC() && nTrack.hasTRD()) || // TPC + TRD is accepted + (!nTrack.hasTPC() && nTrack.itsNCls() >= 6)) { + nTrackOK = true; // for this V0 only + } - // Cross-checking consistency: found should be a subset of nTrack, pTrack OK - histos.fill(HIST("hFoundVsTracksOK"), nTrackOK && pTrackOK, recv0.isFound()); - - // encode conditions of tracks - uint8_t positiveTrackCode = ((uint8_t(pTrack.hasTPC()) << hasTPC) | - (uint8_t(pTrack.hasITSTracker()) << hasITSTracker) | - (uint8_t(pTrack.hasITSAfterburner()) << hasITSAfterburner) | - (uint8_t(pTrack.hasTRD()) << hasTRD) | - (uint8_t(pTrack.hasTOF()) << hasTOF)); - - uint8_t negativeTrackCode = ((uint8_t(nTrack.hasTPC()) << hasTPC) | - (uint8_t(nTrack.hasITSTracker()) << hasITSTracker) | - (uint8_t(nTrack.hasITSAfterburner()) << hasITSAfterburner) | - (uint8_t(nTrack.hasTRD()) << hasTRD) | - (uint8_t(nTrack.hasTOF()) << hasTOF)); - - if (pTrackOK && nTrackOK && ptmc > 1.0 && ptmc < 1.1) { - // this particular V0 reco entry has been acceptably tracked. Do bookkeeping - histos.fill(HIST("h2dTrackPropAcceptablyTracked"), positiveTrackCode, negativeTrackCode, centrality); - } + if (pTrackOK && nTrackOK) + hasBeenAcceptablyTracked = true; - // determine if this V0 would go to analysis or not - if (recv0.isFound() && pTrackOK && nTrackOK) { // hack to avoid type check; only interested in found type 1 - // at this stage, this should be REALLY mostly unique (unless you switch skipITSonly to false or so) - // ... but we will cross-check this assumption (hNRecoV0sWithTPC, h2dPtVsCentrality_FoundInLoop) - if (pTrack.hasTPC() && !pTrack.hasITS() && !pTrack.hasTRD() && !pTrack.hasTOF()) { - LOGF(info, "Positive track is TPC only and this is a found V0. Puzzling!"); + // cross-check correctness of new getter + if (pTrack.hasITSTracker() && (pTrack.hasITS() && pTrack.itsChi2PerNcl() < -1e-3)) { + LOGF(fatal, "Positive track: inconsistent outcome of ITS tracker getter and explicit check!"); } - if (nTrack.hasTPC() && !nTrack.hasITS() && !nTrack.hasTRD() && !nTrack.hasTOF()) { - LOGF(info, "Negative track is TPC only and this is a found V0. Puzzling!"); + if (nTrack.hasITSTracker() && (pTrack.hasITS() && nTrack.itsChi2PerNcl() < -1e-3)) { + LOGF(fatal, "Negative track: inconsistent outcome of ITS tracker getter and explicit check!"); } - - nCandidatesWithTPC++; - hasBeenFound = true; - histos.fill(HIST("h2dPtVsCentrality_FoundInLoop"), centrality, ptmc); - if (ptmc > 1.0 && ptmc < 1.1) { - histos.fill(HIST("h2dTrackPropFound"), positiveTrackCode, negativeTrackCode, centrality); + if (pTrack.hasITSAfterburner() && (pTrack.hasITS() && pTrack.itsChi2PerNcl() > -1e-3)) { + LOGF(fatal, "Positive track: inconsistent outcome of ITS tracker getter and explicit check!"); + } + if (nTrack.hasITSAfterburner() && (pTrack.hasITS() && nTrack.itsChi2PerNcl() > -1e-3)) { + LOGF(fatal, "Negative track: inconsistent outcome of ITS tracker getter and explicit check!"); } - uint64_t selMap = v0data::computeReconstructionBitmap(recv0, pTrack, nTrack, coll, recv0.yLambda(), recv0.yK0Short(), v0Selections); - - // Consider in all cases - selMap = selMap | (uint64_t(1) << v0data::selConsiderK0Short) | (uint64_t(1) << v0data::selConsiderLambda) | (uint64_t(1) << v0data::selConsiderAntiLambda); - - // selection checker: ensure this works on subset of actual svertexer-findable - bool validTrackProperties = v0Selections->verifyMask(selMap, maskTrackProperties) && pTrackOK && nTrackOK; - bool validTopology = v0Selections->verifyMask(selMap, maskTopological); - - uint64_t thisSpeciesMask = maskK0ShortSpecific; - if (pdgCode == 3122) - thisSpeciesMask = maskLambdaSpecific; - if (pdgCode == -3122) - thisSpeciesMask = maskAntiLambdaSpecific; - // add other species masks as necessary - - bool validThisSpecies = v0Selections->verifyMask(selMap, thisSpeciesMask); - - // specific selection (not cumulative) - topoV0RadiusOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selRadius); - topoV0RadiusMaxOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selRadiusMax); - topoV0CosPAOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selCosPA); - topoDcaPosToPVOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selDCAPosToPV); - topoDcaNegToPVOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selDCANegToPV); - topoDcaV0DauOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selDCAV0Dau); - // trackTPCRowsOK = v0Selections->verifyMask(selMap, (uint64_t(1) << v0data::selPosGoodTPCTrack) | (uint64_t(1) << v0data::selNegGoodTPCTrack) ); - - // uint64_t tpcPidMask = (uint64_t(1) << v0data::selTPCPIDPositivePion) | (uint64_t(1) << v0data::selTPCPIDNegativePion); - // if(pdgCode==3122) - // tpcPidMask = (uint64_t(1) << v0data::selTPCPIDPositiveProton) | (uint64_t(1) << v0data::selTPCPIDNegativePion); - // if(pdgCode==-3122) - // tpcPidMask = (uint64_t(1) << v0data::selTPCPIDPositivePion) | (uint64_t(1) << v0data::selTPCPIDNegativeProton); + // Cross-checking consistency: found should be a subset of nTrack, pTrack OK + histos.fill(HIST("hFoundVsTracksOK"), nTrackOK && pTrackOK, recv0.isFound()); + + // encode conditions of tracks + uint8_t positiveTrackCode = ((uint8_t(pTrack.hasTPC()) << hasTPC) | + (uint8_t(pTrack.hasITSTracker()) << hasITSTracker) | + (uint8_t(pTrack.hasITSAfterburner()) << hasITSAfterburner) | + (uint8_t(pTrack.hasTRD()) << hasTRD) | + (uint8_t(pTrack.hasTOF()) << hasTOF)); + + uint8_t negativeTrackCode = ((uint8_t(nTrack.hasTPC()) << hasTPC) | + (uint8_t(nTrack.hasITSTracker()) << hasITSTracker) | + (uint8_t(nTrack.hasITSAfterburner()) << hasITSAfterburner) | + (uint8_t(nTrack.hasTRD()) << hasTRD) | + (uint8_t(nTrack.hasTOF()) << hasTOF)); + + if (pTrackOK && nTrackOK && ptmc > 1.0 && ptmc < 1.1) { + // this particular V0 reco entry has been acceptably tracked. Do bookkeeping + histos.fill(HIST("h2dTrackPropAcceptablyTracked"), positiveTrackCode, negativeTrackCode, centrality); + } - // trackTPCPIDOK = v0Selections->verifyMask(selMap, tpcPidMask); + // determine if this V0 would go to analysis or not + if (recv0.isFound() && pTrackOK && nTrackOK) { // hack to avoid type check; only interested in found type 1 + // at this stage, this should be REALLY mostly unique (unless you switch skipITSonly to false or so) + // ... but we will cross-check this assumption (hNRecoV0sWithTPC, h2dPtVsCentrality_FoundInLoop) + if (pTrack.hasTPC() && !pTrack.hasITS() && !pTrack.hasTRD() && !pTrack.hasTOF()) { + LOGF(info, "Positive track is TPC only and this is a found V0. Puzzling!"); + } + if (nTrack.hasTPC() && !nTrack.hasITS() && !nTrack.hasTRD() && !nTrack.hasTOF()) { + LOGF(info, "Negative track is TPC only and this is a found V0. Puzzling!"); + } - // Broad level - if (validTrackProperties) { - histos.fill(HIST("h2dPtVsCentrality_PassesTrackQuality"), centrality, ptmc); + nCandidatesWithTPC++; + hasBeenFound = true; + histos.fill(HIST("h2dPtVsCentrality_FoundInLoop"), centrality, ptmc); if (ptmc > 1.0 && ptmc < 1.1) { - histos.fill(HIST("h2dTrackPropAnalysisTracks"), positiveTrackCode, negativeTrackCode, centrality); + histos.fill(HIST("h2dTrackPropFound"), positiveTrackCode, negativeTrackCode, centrality); } - } - if (validTrackProperties && validTopology) { - histos.fill(HIST("h2dPtVsCentrality_PassesTopological"), centrality, ptmc); - if (ptmc > 1.0 && ptmc < 1.1) { - histos.fill(HIST("h2dTrackPropAnalysisTopo"), positiveTrackCode, negativeTrackCode, centrality); + + uint64_t selMap = v0data::computeReconstructionBitmap(recv0, pTrack, nTrack, coll, recv0.yLambda(), recv0.yK0Short(), v0Selections); + + // Consider in all cases + selMap = selMap | (uint64_t(1) << v0data::selConsiderK0Short) | (uint64_t(1) << v0data::selConsiderLambda) | (uint64_t(1) << v0data::selConsiderAntiLambda); + + // selection checker: ensure this works on subset of actual svertexer-findable + bool validTrackProperties = v0Selections->verifyMask(selMap, maskTrackProperties) && pTrackOK && nTrackOK; + bool validTopology = v0Selections->verifyMask(selMap, maskTopological); + + uint64_t thisSpeciesMask = maskK0ShortSpecific; + if (pdgCode == 3122) + thisSpeciesMask = maskLambdaSpecific; + if (pdgCode == -3122) + thisSpeciesMask = maskAntiLambdaSpecific; + // add other species masks as necessary + + bool validThisSpecies = v0Selections->verifyMask(selMap, thisSpeciesMask); + + // specific selection (not cumulative) + topoV0RadiusOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selRadius); + topoV0RadiusMaxOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selRadiusMax); + topoV0CosPAOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selCosPA); + topoDcaPosToPVOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selDCAPosToPV); + topoDcaNegToPVOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selDCANegToPV); + topoDcaV0DauOK = v0Selections->verifyMask(selMap, uint64_t(1) << v0data::selDCAV0Dau); + // trackTPCRowsOK = v0Selections->verifyMask(selMap, (uint64_t(1) << v0data::selPosGoodTPCTrack) | (uint64_t(1) << v0data::selNegGoodTPCTrack) ); + + // uint64_t tpcPidMask = (uint64_t(1) << v0data::selTPCPIDPositivePion) | (uint64_t(1) << v0data::selTPCPIDNegativePion); + // if(pdgCode==3122) + // tpcPidMask = (uint64_t(1) << v0data::selTPCPIDPositiveProton) | (uint64_t(1) << v0data::selTPCPIDNegativePion); + // if(pdgCode==-3122) + // tpcPidMask = (uint64_t(1) << v0data::selTPCPIDPositivePion) | (uint64_t(1) << v0data::selTPCPIDNegativeProton); + + // trackTPCPIDOK = v0Selections->verifyMask(selMap, tpcPidMask); + + // Broad level + if (validTrackProperties) { + histos.fill(HIST("h2dPtVsCentrality_PassesTrackQuality"), centrality, ptmc); + if (ptmc > 1.0 && ptmc < 1.1) { + histos.fill(HIST("h2dTrackPropAnalysisTracks"), positiveTrackCode, negativeTrackCode, centrality); + } } - } - if (validTrackProperties && validTopology && validThisSpecies) { - histos.fill(HIST("h2dPtVsCentrality_PassesThisSpecies"), centrality, ptmc); - if (ptmc > 1.0 && ptmc < 1.1) { - histos.fill(HIST("h2dTrackPropAnalysisSpecies"), positiveTrackCode, negativeTrackCode, centrality); + if (validTrackProperties && validTopology) { + histos.fill(HIST("h2dPtVsCentrality_PassesTopological"), centrality, ptmc); + if (ptmc > 1.0 && ptmc < 1.1) { + histos.fill(HIST("h2dTrackPropAnalysisTopo"), positiveTrackCode, negativeTrackCode, centrality); + } + } + if (validTrackProperties && validTopology && validThisSpecies) { + histos.fill(HIST("h2dPtVsCentrality_PassesThisSpecies"), centrality, ptmc); + if (ptmc > 1.0 && ptmc < 1.1) { + histos.fill(HIST("h2dTrackPropAnalysisSpecies"), positiveTrackCode, negativeTrackCode, centrality); + } } - } - // topological - if (validTrackProperties && validThisSpecies && topoV0RadiusOK) - histos.fill(HIST("h2dPtVsCentrality_V0Radius"), centrality, ptmc); - if (validTrackProperties && validThisSpecies && topoV0RadiusMaxOK) - histos.fill(HIST("h2dPtVsCentrality_V0RadiusMax"), centrality, ptmc); - if (validTrackProperties && validThisSpecies && topoV0CosPAOK) - histos.fill(HIST("h2dPtVsCentrality_V0CosPA"), centrality, ptmc); - if (validTrackProperties && validThisSpecies && topoDcaPosToPVOK) - histos.fill(HIST("h2dPtVsCentrality_DcaPosToPV"), centrality, ptmc); - if (validTrackProperties && validThisSpecies && topoDcaNegToPVOK) - histos.fill(HIST("h2dPtVsCentrality_DcaNegToPV"), centrality, ptmc); - if (validTrackProperties && validThisSpecies && topoDcaV0DauOK) - histos.fill(HIST("h2dPtVsCentrality_DcaV0Dau"), centrality, ptmc); + // topological + if (validTrackProperties && validThisSpecies && topoV0RadiusOK) + histos.fill(HIST("h2dPtVsCentrality_V0Radius"), centrality, ptmc); + if (validTrackProperties && validThisSpecies && topoV0RadiusMaxOK) + histos.fill(HIST("h2dPtVsCentrality_V0RadiusMax"), centrality, ptmc); + if (validTrackProperties && validThisSpecies && topoV0CosPAOK) + histos.fill(HIST("h2dPtVsCentrality_V0CosPA"), centrality, ptmc); + if (validTrackProperties && validThisSpecies && topoDcaPosToPVOK) + histos.fill(HIST("h2dPtVsCentrality_DcaPosToPV"), centrality, ptmc); + if (validTrackProperties && validThisSpecies && topoDcaNegToPVOK) + histos.fill(HIST("h2dPtVsCentrality_DcaNegToPV"), centrality, ptmc); + if (validTrackProperties && validThisSpecies && topoDcaV0DauOK) + histos.fill(HIST("h2dPtVsCentrality_DcaV0Dau"), centrality, ptmc); + } + } + else{ + continue; } } histos.fill(HIST("hNRecoV0sWithTPC"), nCandidatesWithTPC); From 798348553ea225cbc35dcea6877c7713377c0a5c Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Sat, 8 Jun 2024 13:56:07 +0200 Subject: [PATCH 6/7] Please consider the following formatting changes (#307) --- PWGLF/Tasks/QC/findableStudy.cxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/PWGLF/Tasks/QC/findableStudy.cxx b/PWGLF/Tasks/QC/findableStudy.cxx index 98f398c23df..d8ca8cc8c80 100644 --- a/PWGLF/Tasks/QC/findableStudy.cxx +++ b/PWGLF/Tasks/QC/findableStudy.cxx @@ -334,16 +334,16 @@ struct findableStudy { // encode conditions of tracks uint8_t positiveTrackCode = ((uint8_t(pTrack.hasTPC()) << hasTPC) | - (uint8_t(pTrack.hasITSTracker()) << hasITSTracker) | - (uint8_t(pTrack.hasITSAfterburner()) << hasITSAfterburner) | - (uint8_t(pTrack.hasTRD()) << hasTRD) | - (uint8_t(pTrack.hasTOF()) << hasTOF)); + (uint8_t(pTrack.hasITSTracker()) << hasITSTracker) | + (uint8_t(pTrack.hasITSAfterburner()) << hasITSAfterburner) | + (uint8_t(pTrack.hasTRD()) << hasTRD) | + (uint8_t(pTrack.hasTOF()) << hasTOF)); uint8_t negativeTrackCode = ((uint8_t(nTrack.hasTPC()) << hasTPC) | - (uint8_t(nTrack.hasITSTracker()) << hasITSTracker) | - (uint8_t(nTrack.hasITSAfterburner()) << hasITSAfterburner) | - (uint8_t(nTrack.hasTRD()) << hasTRD) | - (uint8_t(nTrack.hasTOF()) << hasTOF)); + (uint8_t(nTrack.hasITSTracker()) << hasITSTracker) | + (uint8_t(nTrack.hasITSAfterburner()) << hasITSAfterburner) | + (uint8_t(nTrack.hasTRD()) << hasTRD) | + (uint8_t(nTrack.hasTOF()) << hasTOF)); if (pTrackOK && nTrackOK && ptmc > 1.0 && ptmc < 1.1) { // this particular V0 reco entry has been acceptably tracked. Do bookkeeping @@ -437,8 +437,7 @@ struct findableStudy { if (validTrackProperties && validThisSpecies && topoDcaV0DauOK) histos.fill(HIST("h2dPtVsCentrality_DcaV0Dau"), centrality, ptmc); } - } - else{ + } else { continue; } } From 7a191a4708adda06a5ae09bdc91b1bd7eea7b811 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Sat, 8 Jun 2024 14:13:10 +0200 Subject: [PATCH 7/7] Megalinter fix --- PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx index 18a5c7efe25..8871c983668 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx @@ -470,14 +470,14 @@ struct lambdakzeropid { // calculate and pack properties for QA purposes int posProperties = 0; if (lengthPositive > 0) - posProperties = posProperties | (int(1) << kLength); + posProperties = posProperties | (static_cast(1) << kLength); if (pTra.hasTOF()) - posProperties = posProperties | (int(1) << kHasTOF); + posProperties = posProperties | (static_cast(1) << kHasTOF); int negProperties = 0; if (lengthNegative > 0) - negProperties = negProperties | (int(1) << kLength); + negProperties = negProperties | (static_cast(1) << kLength); if (nTra.hasTOF()) - negProperties = negProperties | (int(1) << kHasTOF); + negProperties = negProperties | (static_cast(1) << kHasTOF); histos.fill(HIST("h2dPositiveTOFProperties"), v0.pt(), posProperties); histos.fill(HIST("h2dNegativeTOFProperties"), v0.pt(), negProperties);