From f7a831a12992e82d7ad8b901d3ffb154c0bf40b5 Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Tue, 30 Jan 2024 11:52:22 +0100 Subject: [PATCH 01/33] PWGLF: Add QC histograms for hypertriton 3-body decay analysis (#4512) * Check decay3body table withhypertriton 3body finder method * "Update hypertriton 3body decay reconstruction" * Fix typo * Update mc analysis check Add check for duplicated daughters and daughters from materials * Update mc check for daughter tracks * Update check of decayed daughters * Solve Conflicts * Make type conversion automatically --- .../TableProducer/hypertriton3bodyfinder.cxx | 862 ++++++++++-------- PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx | 211 +++-- .../Tasks/Nuspex/hypertriton3bodyanalysis.cxx | 8 +- 3 files changed, 627 insertions(+), 454 deletions(-) diff --git a/PWGLF/TableProducer/hypertriton3bodyfinder.cxx b/PWGLF/TableProducer/hypertriton3bodyfinder.cxx index 2b29305dc5c..124dde6c847 100644 --- a/PWGLF/TableProducer/hypertriton3bodyfinder.cxx +++ b/PWGLF/TableProducer/hypertriton3bodyfinder.cxx @@ -50,29 +50,56 @@ using FullTracksExtMCIU = soa::Join; using LabeledTracks = soa::Join; +template +bool is3bodyDecayedH3L(TMCParticle const& particle) +{ + if (particle.pdgCode() != 1010010030 && particle.pdgCode() != -1010010030) { + return false; + } + bool haveProton = false, havePion = false, haveDeuteron = false; + bool haveAntiProton = false, haveAntiPion = false, haveAntiDeuteron = false; + for (auto& mcparticleDaughter : particle.template daughters_as()) { + if (mcparticleDaughter.pdgCode() == 2212) + haveProton = true; + if (mcparticleDaughter.pdgCode() == -2212) + haveAntiProton = true; + if (mcparticleDaughter.pdgCode() == 211) + havePion = true; + if (mcparticleDaughter.pdgCode() == -211) + haveAntiPion = true; + if (mcparticleDaughter.pdgCode() == 1000010020) + haveDeuteron = true; + if (mcparticleDaughter.pdgCode() == -1000010020) + haveAntiDeuteron = true; + } + if (haveProton && haveAntiPion && haveDeuteron && particle.pdgCode() == 1010010030) { + return true; + } else if (haveAntiProton && havePion && haveAntiDeuteron && particle.pdgCode() == -1010010030) { + return true; + } + return false; +} + namespace o2::aod { namespace v0goodpostrack { DECLARE_SOA_INDEX_COLUMN_FULL(GoodTrack, goodTrack, int, Tracks, "_GoodTrack"); DECLARE_SOA_INDEX_COLUMN(Collision, collision); -DECLARE_SOA_COLUMN(DCAXY, dcaXY, float); } // namespace v0goodpostrack -DECLARE_SOA_TABLE(V0GoodPosTracks, "AOD", "V0GOODPOSTRACKS", o2::soa::Index<>, v0goodpostrack::GoodTrackId, v0goodpostrack::CollisionId, v0goodpostrack::DCAXY); +DECLARE_SOA_TABLE(V0GoodPosTracks, "AOD", "V0GOODPOSTRACKS", o2::soa::Index<>, v0goodpostrack::GoodTrackId, v0goodpostrack::CollisionId); namespace v0goodnegtrack { DECLARE_SOA_INDEX_COLUMN_FULL(GoodTrack, goodTrack, int, Tracks, "_GoodTrack"); DECLARE_SOA_INDEX_COLUMN(Collision, collision); -DECLARE_SOA_COLUMN(DCAXY, dcaXY, float); } // namespace v0goodnegtrack -DECLARE_SOA_TABLE(V0GoodNegTracks, "AOD", "V0GOODNEGTRACKS", o2::soa::Index<>, v0goodnegtrack::GoodTrackId, v0goodnegtrack::CollisionId, v0goodnegtrack::DCAXY); +DECLARE_SOA_TABLE(V0GoodNegTracks, "AOD", "V0GOODNEGTRACKS", o2::soa::Index<>, v0goodnegtrack::GoodTrackId, v0goodnegtrack::CollisionId); namespace v0goodtrack { DECLARE_SOA_INDEX_COLUMN_FULL(GoodTrack, goodTrack, int, Tracks, "_GoodTrack"); DECLARE_SOA_INDEX_COLUMN(Collision, collision); -DECLARE_SOA_COLUMN(DCAXY, dcaXY, float); } // namespace v0goodtrack -DECLARE_SOA_TABLE(V0GoodTracks, "AOD", "V0GOODTRACKS", o2::soa::Index<>, v0goodtrack::GoodTrackId, v0goodtrack::CollisionId, v0goodtrack::DCAXY); +DECLARE_SOA_TABLE(V0GoodTracks, "AOD", "V0GOODTRACKS", o2::soa::Index<>, v0goodtrack::GoodTrackId, v0goodtrack::CollisionId); } // namespace o2::aod struct trackprefilter { @@ -83,6 +110,7 @@ struct trackprefilter { {"hGoodTrackCount", "hGoodTrackCount", {HistType::kTH1F, {{4, 0.0f, 4.0f}}}}, {"hGoodPosTrackCount", "hGoodPosTrackCount", {HistType::kTH1F, {{1, 0.0f, 1.0f}}}}, {"hGoodNegTrackCount", "hGoodNegTrackCount", {HistType::kTH1F, {{1, 0.0f, 1.0f}}}}, + {"h3bodyCounter", "h3bodyCounter", {HistType::kTH1F, {{6, 0.0f, 6.0f}}}}, }, }; @@ -94,8 +122,9 @@ struct trackprefilter { Produces v0GoodNegTracks; Produces v0GoodTracks; - void process(aod::Collision const& collision, - FullTracksExtIU const& tracks) + // Fix: Add PID and pt cuts to tracks + void processDefault(aod::Collision const& collision, + FullTracksExtIU const& tracks) { for (auto& t0 : tracks) { registry.fill(HIST("hGoodTrackCount"), 0.5); @@ -111,49 +140,82 @@ struct trackprefilter { } registry.fill(HIST("hGoodTrackCount"), 2.5); if (t0.signed1Pt() > 0.0f) { - v0GoodPosTracks(t0.globalIndex(), collision.globalIndex(), t0.dcaXY()); + v0GoodPosTracks(t0.globalIndex(), t0.collisionId()); registry.fill(HIST("hGoodPosTrackCount"), 0.5); registry.fill(HIST("hGoodTrackCount"), 3.5); } if (t0.signed1Pt() < 0.0f) { - v0GoodNegTracks(t0.globalIndex(), collision.globalIndex(), t0.dcaXY()); + v0GoodNegTracks(t0.globalIndex(), t0.collisionId()); registry.fill(HIST("hGoodNegTrackCount"), 0.5); registry.fill(HIST("hGoodTrackCount"), 3.5); } - v0GoodTracks(t0.globalIndex(), collision.globalIndex(), t0.dcaXY()); + v0GoodTracks(t0.globalIndex(), t0.collisionId()); } } -}; + PROCESS_SWITCH(trackprefilter, processDefault, "Default process function", true); -template -bool is3bodyDecayedH3L(TMCParticle const& particle) -{ - if (particle.pdgCode() != 1010010030 && particle.pdgCode() != -1010010030) { - return false; - } - bool haveProton = false, havePion = false, haveDeuteron = false; - bool haveAntiProton = false, haveAntiPion = false, haveAntiDeuteron = false; - for (auto& mcparticleDaughter : particle.template daughters_as()) { - if (mcparticleDaughter.pdgCode() == 2212) - haveProton = true; - if (mcparticleDaughter.pdgCode() == -2212) - haveAntiProton = true; - if (mcparticleDaughter.pdgCode() == 211) - havePion = true; - if (mcparticleDaughter.pdgCode() == -211) - haveAntiPion = true; - if (mcparticleDaughter.pdgCode() == 1000010020) - haveDeuteron = true; - if (mcparticleDaughter.pdgCode() == -1000010020) - haveAntiDeuteron = true; - } - if (haveProton && haveAntiPion && haveDeuteron && particle.pdgCode() == 1010010030) { - return true; - } else if (haveAntiProton && havePion && haveAntiDeuteron && particle.pdgCode() == -1010010030) { - return true; + // process function for MC d3body check + // void processCheck(aod::Collision const& collision, aod::Decay3Bodys const& decay3bodys, + void processCheck(aod::Decay3Bodys const& decay3bodys, + FullTracksExtMCIU const& tracks, aod::McParticles const& particlesMC) + { + for (auto& d3body : decay3bodys) { + registry.fill(HIST("h3bodyCounter"), 0.5); + auto lTrack0 = d3body.track0_as(); + auto lTrack1 = d3body.track1_as(); + auto lTrack2 = d3body.track2_as(); + if (!lTrack0.has_mcParticle() || !lTrack1.has_mcParticle() || !lTrack2.has_mcParticle()) { + continue; + } + registry.fill(HIST("h3bodyCounter"), 1.5); + auto lMCTrack0 = lTrack0.mcParticle_as(); + auto lMCTrack1 = lTrack1.mcParticle_as(); + auto lMCTrack2 = lTrack2.mcParticle_as(); + if (!lMCTrack0.has_mothers() || !lMCTrack1.has_mothers() || !lMCTrack2.has_mothers()) { + continue; + } + registry.fill(HIST("h3bodyCounter"), 2.5); + + int lPDG = -1; + bool is3bodyDecay = false; + for (auto& lMother0 : lMCTrack0.mothers_as()) { + for (auto& lMother1 : lMCTrack1.mothers_as()) { + for (auto& lMother2 : lMCTrack2.mothers_as()) { + if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { + lPDG = lMother1.pdgCode(); + if (lPDG == 1010010030 && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == 1000010020) { + is3bodyDecay = true; // vtxs with the same mother + } + if (lPDG == -1010010030 && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -1000010020) { + is3bodyDecay = true; // vtxs with the same mother + } + } + } + } + } // end association check + + if (!is3bodyDecay || std::abs(lPDG) != 1010010030) { + continue; + } + registry.fill(HIST("h3bodyCounter"), 3.5); + if (lTrack0.collisionId() != lTrack1.collisionId() || lTrack0.collisionId() != lTrack2.collisionId()) { + continue; + } + registry.fill(HIST("h3bodyCounter"), 4.5); + + if (lTrack0.collisionId() != d3body.collisionId()) { + continue; + } + registry.fill(HIST("h3bodyCounter"), 5.5); + + // LOG(info) << "; Track0ID: " << lTrack0.globalIndex() << "; Track1ID:" << lTrack1.globalIndex() << "; Track2ID:" << lTrack2.globalIndex(); + v0GoodPosTracks(lTrack0.globalIndex(), lTrack0.collisionId()); + v0GoodNegTracks(lTrack1.globalIndex(), lTrack1.collisionId()); + v0GoodTracks(lTrack2.globalIndex(), lTrack2.collisionId()); + } } - return false; -} + PROCESS_SWITCH(trackprefilter, processCheck, "Check specific paired tracks", false); +}; struct hypertriton3bodyFinder { @@ -163,7 +225,6 @@ struct hypertriton3bodyFinder { // Configurables Configurable UseCFFilter{"UseCFFilter", true, "Reject event without CF LD trigger"}; Configurable RejectBkgInMC{"RejectBkgInMC", false, "Reject fake 3-body pairs in MC check"}; - Configurable KeepSignalInMC{"KeepSignalInMC", false, "Reject fake 3-body pairs in MC check"}; Configurable d_UseAbsDCA{"d_UseAbsDCA", true, "Use Abs DCAs"}; Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; @@ -455,184 +516,224 @@ struct hypertriton3bodyFinder { o2::dataformats::VertexBase mMeanVertex{{0., 0., 0.}, {0.1 * 0.1, 0., 0.1 * 0.1, 0., 0., 6. * 6.}}; //------------------------------------------------------------------ - // 3body decay finder - template - void DecayFinder(TCollisionTable const& dCollision, TPosTrackTable const& dPtracks, TNegTrackTable const& dNtracks, TGoodTrackTable const& dGoodtracks) + // Virtual Lambda V0 finder + template + bool DecayV0Finder(TCollisionTable const& dCollision, TTrackTable const& dPtrack, TTrackTable const& dNtrack, float& rv0, bool isTrue3bodyV0 = false) { - for (auto& t0id : dPtracks) { // FIXME: turn into combination(...) - auto t0 = t0id.template goodTrack_as(); - auto Track0 = getTrackParCov(t0); + if (dPtrack.collisionId() != dNtrack.collisionId()) { + return false; + } + FillV0Counter(kV0All, isTrue3bodyV0); + if (!isTrue3bodyV0 && RejectBkgInMC) { + return false; + } - for (auto& t1id : dNtracks) { + auto Track0 = getTrackParCov(dPtrack); + auto Track1 = getTrackParCov(dNtrack); + int nCand = fitter.process(Track0, Track1); + if (nCand == 0) { + return false; + } + FillV0Counter(kV0hasSV, isTrue3bodyV0); + + // validate V0 radial position + // First check closeness to the beam-line as same as SVertexer + const auto& v0XYZ = fitter.getPCACandidate(); + float dxv0 = v0XYZ[0] - mMeanVertex.getX(), dyv0 = v0XYZ[1] - mMeanVertex.getY(), r2v0 = dxv0 * dxv0 + dyv0 * dyv0; + // float rv0 = std::sqrt(r2v0); + rv0 = std::sqrt(r2v0); + if (rv0 < minRToMeanVertex) { + return false; + } + FillV0Counter(kV0Radius, isTrue3bodyV0); - FillV0Counter(kV0All); - auto t1 = t1id.template goodTrack_as(); - auto Track1 = getTrackParCov(t1); - int nCand = fitter.process(Track0, Track1); - if (nCand == 0) { - continue; - } - FillV0Counter(kV0hasSV); - - // validate V0 radial position - // First check closeness to the beam-line as same as SVertexer - const auto& v0XYZ = fitter.getPCACandidate(); - float dxv0 = v0XYZ[0] - mMeanVertex.getX(), dyv0 = v0XYZ[1] - mMeanVertex.getY(), r2v0 = dxv0 * dxv0 + dyv0 * dyv0; - float rv0 = std::sqrt(r2v0); - if (rv0 < minRToMeanVertex) { - continue; - } - FillV0Counter(kV0Radius); + // Not involved: Get minR with same way in SVertexer + // float drv0P = rv0 - Track0minR, drv0N = rv0 - Track1minR; - // Not involved: Get minR with same way in SVertexer - // float drv0P = rv0 - Track0minR, drv0N = rv0 - Track1minR; + // check: if the process function finish the propagation + if (!fitter.isPropagateTracksToVertexDone() && !fitter.propagateTracksToVertex()) { + return false; + } - // check: if the process function finish the propagation - if (!fitter.isPropagateTracksToVertexDone() && !fitter.propagateTracksToVertex()) { - continue; - } + auto& trPProp = fitter.getTrack(0); + auto& trNProp = fitter.getTrack(1); + std::array pP, pN; + trPProp.getPxPyPzGlo(pP); + trNProp.getPxPyPzGlo(pN); + // estimate DCA of neutral V0 track to beamline: straight line with parametric equation + // x = X0 + pV0[0]*t, y = Y0 + pV0[1]*t reaches DCA to beamline (Xv, Yv) at + // t = -[ (x0-Xv)*pV0[0] + (y0-Yv)*pV0[1]) ] / ( pT(pV0)^2 ) + // Similar equation for 3D distance involving pV0[2] + std::array pV0 = {pP[0] + pN[0], pP[1] + pN[1], pP[2] + pN[2]}; + float pt2V0 = pV0[0] * pV0[0] + pV0[1] * pV0[1], prodXYv0 = dxv0 * pV0[0] + dyv0 * pV0[1], tDCAXY = prodXYv0 / pt2V0; + float p2V0 = pt2V0 + pV0[2] * pV0[2], ptV0 = std::sqrt(pt2V0); + if (ptV0 < minPtV0) { // pt cut + return false; + } + FillV0Counter(kV0Pt, isTrue3bodyV0); - int cand = 0; - auto& trPProp = fitter.getTrack(0, cand); - auto& trNProp = fitter.getTrack(1, cand); - std::array pP, pN; - trPProp.getPxPyPzGlo(pP); - trNProp.getPxPyPzGlo(pN); - // estimate DCA of neutral V0 track to beamline: straight line with parametric equation - // x = X0 + pV0[0]*t, y = Y0 + pV0[1]*t reaches DCA to beamline (Xv, Yv) at - // t = -[ (x0-Xv)*pV0[0] + (y0-Yv)*pV0[1]) ] / ( pT(pV0)^2 ) - // Similar equation for 3D distance involving pV0[2] - std::array pV0 = {pP[0] + pN[0], pP[1] + pN[1], pP[2] + pN[2]}; - float pt2V0 = pV0[0] * pV0[0] + pV0[1] * pV0[1], prodXYv0 = dxv0 * pV0[0] + dyv0 * pV0[1], tDCAXY = prodXYv0 / pt2V0; - float p2V0 = pt2V0 + pV0[2] * pV0[2], ptV0 = std::sqrt(pt2V0); - if (ptV0 < minPtV0) { // pt cut - continue; - } - FillV0Counter(kV0Pt); + if (pV0[2] / ptV0 > maxTglV0) { // tgLambda cut + return false; + } + FillV0Counter(kV0TgLamda, isTrue3bodyV0); + + // apply mass selections + float massV0LambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); + float massV0AntiLambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); + float massMargin = 20 * (0.001 * (1. + 0.5 * ptV0)) + 0.07; + if (massV0LambdaHyp - o2::constants::physics::MassLambda > massMargin && massV0AntiLambdaHyp - o2::constants::physics::MassLambda > massMargin) { + return false; + } + FillV0Counter(kV0InvMass, isTrue3bodyV0); - if (pV0[2] / ptV0 > maxTglV0) { // tgLambda cut - continue; - } - FillV0Counter(kV0TgLamda); + float dcaX = dxv0 - pV0[0] * tDCAXY, dcaY = dyv0 - pV0[1] * tDCAXY, dca2 = dcaX * dcaX + dcaY * dcaY; + float cosPAXY = prodXYv0 / std::sqrt(r2v0 * pt2V0); + if (dca2 > maxDCAXY2ToMeanVertex3bodyV0) { + return false; + } + FillV0Counter(kV0DcaXY, isTrue3bodyV0); - // apply mass selections - float massV0LambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); - float massV0AntiLambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); - float massMargin = 20 * (0.001 * (1. + 0.5 * ptV0)) + 0.07; - if (massV0LambdaHyp - o2::constants::physics::MassLambda > massMargin && massV0AntiLambdaHyp - o2::constants::physics::MassLambda > massMargin) { - continue; - } - FillV0Counter(kV0InvMass); + if (cosPAXY < minCosPAXYMeanVertex3bodyV0) { + return false; + } + float dx = v0XYZ[0] - dCollision.posX(), dy = v0XYZ[1] - dCollision.posY(), dz = v0XYZ[2] - dCollision.posZ(), prodXYZv0 = dx * pV0[0] + dy * pV0[1] + dz * pV0[2]; + float cosPA = prodXYZv0 / std::sqrt((dx * dx + dy * dy + dz * dz) * p2V0); + if (cosPA < minCosPA3bodyV0) { + return false; + } + FillV0Counter(kV0CosPA, isTrue3bodyV0); + return true; + } + //------------------------------------------------------------------ + // 3body decay finder + template + void Decay3bodyFinder(TCollisionTable const& dCollision, TTrackTable const& dPtrack, TTrackTable const& dNtrack, TTrackTable const& dBachtrack, float const& rv0, bool isTrue3bodyVtx = false) + { + if (dPtrack.collisionId() != dBachtrack.collisionId()) { + return; + } + if (dPtrack.globalIndex() == dBachtrack.globalIndex()) { + return; // skip the track used by V0 + } + FillVtxCounter(kVtxAll, isTrue3bodyVtx); + if (!isTrue3bodyVtx && RejectBkgInMC) { + return; + } - float dcaX = dxv0 - pV0[0] * tDCAXY, dcaY = dyv0 - pV0[1] * tDCAXY, dca2 = dcaX * dcaX + dcaY * dcaY; - if (dca2 > maxDCAXY2ToMeanVertex3bodyV0) { - continue; - } - FillV0Counter(kV0DcaXY); + auto track0 = getTrackParCov(dPtrack); + auto track1 = getTrackParCov(dNtrack); + auto bach = getTrackParCov(dBachtrack); - float cosPAXY = prodXYv0 / std::sqrt(r2v0 * pt2V0); - if (cosPAXY < minCosPAXYMeanVertex3bodyV0) { - continue; - } - float dx = v0XYZ[0] - dCollision.posX(), dy = v0XYZ[1] - dCollision.posY(), dz = v0XYZ[2] - dCollision.posZ(), prodXYZv0 = dx * pV0[0] + dy * pV0[1] + dz * pV0[2]; - float cosPA = prodXYZv0 / std::sqrt((dx * dx + dy * dy + dz * dz) * p2V0); - if (cosPA < minCosPA3bodyV0) { - continue; - } - FillV0Counter(kV0CosPA); + if (bach.getPt() < minbachPt) { + return; + } + FillVtxCounter(kVtxbachPt, isTrue3bodyVtx); - for (auto& t2id : dGoodtracks) { - if (t2id.globalIndex() == t0id.globalIndex()) { - continue; // skip the track used by V0 - } - FillVtxCounter(kVtxAll); + int n3bodyVtx = fitter3body.process(track0, track1, bach); + if (n3bodyVtx == 0) { // discard this pair + return; + } + FillVtxCounter(kVtxhasSV, isTrue3bodyVtx); + + int cand3B = 0; + const auto& vertexXYZ = fitter3body.getPCACandidatePos(cand3B); + // make sure the cascade radius is smaller than that of the vertex + float dxc = vertexXYZ[0] - dCollision.posX(), dyc = vertexXYZ[1] - dCollision.posY(), dzc = vertexXYZ[2] - dCollision.posZ(), r2vertex = dxc * dxc + dyc * dyc; + float rvertex = std::sqrt(r2vertex); + if (std::abs(rv0 - rvertex) > maxRDiff3bodyV0 || rvertex < minRToMeanVertex) { + return; + } + FillVtxCounter(kVtxRadius, isTrue3bodyVtx); - auto t2 = t2id.template goodTrack_as(); - auto track0 = getTrackParCov(t0); - auto track1 = getTrackParCov(t1); - auto bach = getTrackParCov(t2); + // Not involved: bach.minR - rveretx check - if (bach.getPt() < 0.6) { - continue; - } - FillVtxCounter(kVtxbachPt); + // check: if the process function finish the propagation + if (!fitter3body.isPropagateTracksToVertexDone() && !fitter3body.propagateTracksToVertex()) { + return; + } - int n3bodyVtx = fitter3body.process(track0, track1, bach); - if (n3bodyVtx == 0) { // discard this pair - continue; - } - FillVtxCounter(kVtxhasSV); - - int cand3B = 0; - const auto& vertexXYZ = fitter3body.getPCACandidatePos(cand3B); - // make sure the cascade radius is smaller than that of the vertex - float dxc = vertexXYZ[0] - dCollision.posX(), dyc = vertexXYZ[1] - dCollision.posY(), dzc = vertexXYZ[2] - dCollision.posZ(), r2vertex = dxc * dxc + dyc * dyc; - float rvertex = std::sqrt(r2vertex); - if (std::abs(rv0 - rvertex) > maxRDiff3bodyV0 || rvertex < minRToMeanVertex) { - continue; - } - FillVtxCounter(kVtxRadius); + auto& tr0 = fitter3body.getTrack(0, cand3B); + auto& tr1 = fitter3body.getTrack(1, cand3B); + auto& tr2 = fitter3body.getTrack(2, cand3B); + std::array p0, p1, p2; + tr0.getPxPyPzGlo(p0); + tr1.getPxPyPzGlo(p1); + tr2.getPxPyPzGlo(p2); + std::array p3B = {p0[0] + p1[0] + p2[0], p0[1] + p1[1] + p2[1], p0[2] + p1[2] + p2[2]}; + + float pt2 = p3B[0] * p3B[0] + p3B[1] * p3B[1], p2candidate = pt2 + p3B[2] * p3B[2]; + float pt = std::sqrt(pt2); + if (pt < minPt3Body) { // pt cut + return; + } + FillVtxCounter(kVtxPt, isTrue3bodyVtx); - // Not involved: bach.minR - rveretx check + if (p3B[2] / pt > maxTgl3Body) { // tgLambda cut + return; + } + FillVtxCounter(kVtxTgLamda, isTrue3bodyVtx); - if (!fitter3body.isPropagateTracksToVertexDone() && !fitter3body.propagateTracksToVertex()) { - continue; - } + float cosPA = (p3B[0] * dxc + p3B[1] * dyc + p3B[2] * dzc) / std::sqrt(p2candidate * (r2vertex + dzc * dzc)); + if (cosPA < minCosPA3body) { + return; + } + FillVtxCounter(kVtxCosPA, isTrue3bodyVtx); - auto& tr0 = fitter3body.getTrack(0, cand3B); - auto& tr1 = fitter3body.getTrack(1, cand3B); - auto& tr2 = fitter3body.getTrack(2, cand3B); - std::array p0, p1, p2; - tr0.getPxPyPzGlo(p0); - tr1.getPxPyPzGlo(p1); - tr2.getPxPyPzGlo(p2); - std::array p3B = {p0[0] + p1[0] + p2[0], p0[1] + p1[1] + p2[1], p0[2] + p1[2] + p2[2]}; - - float pt2 = p3B[0] * p3B[0] + p3B[1] * p3B[1], p2candidate = pt2 + p3B[2] * p3B[2]; - float pt = std::sqrt(pt2); - if (pt < minPt3Body) { // pt cut - continue; - } - FillVtxCounter(kVtxPt); + if (fitter3body.getChi2AtPCACandidate() > dcavtxdau) { + return; + } + FillVtxCounter(kVtxDcaDau, isTrue3bodyVtx); - if (p3B[2] / pt > maxTgl3Body) { // tgLambda cut - continue; - } - FillVtxCounter(kVtxTgLamda); + // Calculate DCA with respect to the collision associated to the V0, not individual tracks + gpu::gpustd::array dcaInfo; - float cosPA = (p3B[0] * dxc + p3B[1] * dyc + p3B[2] * dzc) / std::sqrt(p2candidate * (r2vertex + dzc * dzc)); - if (cosPA < minCosPA3body) { - continue; - } - FillVtxCounter(kVtxCosPA); + auto Track0Par = getTrackPar(dPtrack); + o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track0Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); + auto Track0dcaXY = dcaInfo[0]; - if (fitter3body.getChi2AtPCACandidate() > dcavtxdau) { - continue; - } - FillVtxCounter(kVtxDcaDau); - - // Calculate DCA with respect to the collision associated to the V0, not individual tracks - gpu::gpustd::array dcaInfo; - - auto Track0Par = getTrackPar(t0); - o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track0Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track0dcaXY = dcaInfo[0]; - - auto Track1Par = getTrackPar(t1); - o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track1Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track1dcaXY = dcaInfo[0]; - - auto Track2Par = getTrackPar(t2); - o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track2Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track2dcaXY = dcaInfo[0]; - - // Not involved: H3L DCA Check - vtx3bodydata( - t0.globalIndex(), t1.globalIndex(), t2.globalIndex(), dCollision.globalIndex(), 0, - vertexXYZ[0], vertexXYZ[1], vertexXYZ[2], - p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], - fitter3body.getChi2AtPCACandidate(), - Track0dcaXY, Track1dcaXY, Track2dcaXY); + auto Track1Par = getTrackPar(dNtrack); + o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track1Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); + auto Track1dcaXY = dcaInfo[0]; + + auto Track2Par = getTrackPar(dBachtrack); + o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track2Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); + auto Track2dcaXY = dcaInfo[0]; + + // H3L DCA Check + // auto track3B = o2::track::TrackParCov(vertexXYZ, p3B, fitter3body.calcPCACovMatrixFlat(cand3B), t2.sign()); + auto track3B = o2::track::TrackParCov(vertexXYZ, p3B, dBachtrack.sign()); + o2::dataformats::DCA dca; + if (d_UseH3LDCACut && (!track3B.propagateToDCA({{dCollision.posX(), dCollision.posY(), dCollision.posZ()}, {dCollision.covXX(), dCollision.covXY(), dCollision.covYY(), dCollision.covXZ(), dCollision.covYZ(), dCollision.covZZ()}}, fitter3body.getBz(), &dca, 5.) || + std::abs(dca.getY()) > maxDCAXY3Body || std::abs(dca.getZ()) > maxDCAZ3Body)) { + return; + } + FillVtxCounter(kVtxDcaH3L, isTrue3bodyVtx); + + vtx3bodydata( + dPtrack.globalIndex(), dNtrack.globalIndex(), dBachtrack.globalIndex(), dCollision.globalIndex(), 0, + vertexXYZ[0], vertexXYZ[1], vertexXYZ[2], + p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], + fitter3body.getChi2AtPCACandidate(), + Track0dcaXY, Track1dcaXY, Track2dcaXY); + } + //------------------------------------------------------------------ + // 3body decay finder + template + void DecayFinder(TCollisionTable const& dCollision, TPosTrackTable const& dPtracks, TNegTrackTable const& dNtracks, TGoodTrackTable const& dGoodtracks) + { + for (auto& t0id : dPtracks) { // FIXME: turn into combination(...) + auto t0 = t0id.template goodTrack_as(); + + for (auto& t1id : dNtracks) { + auto t1 = t1id.template goodTrack_as(); + float rv0; + if (!DecayV0Finder(dCollision, t0, t1, rv0)) { + continue; + } + + for (auto& t2id : dGoodtracks) { + auto t2 = t2id.template goodTrack_as(); + Decay3bodyFinder(dCollision, t0, t1, t2, rv0); } } } @@ -646,14 +747,11 @@ struct hypertriton3bodyFinder { { for (auto& t0id : dPtracks) { // FIXME: turn into combination(...) auto t0 = t0id.template goodTrack_as(); - auto Track0 = getTrackParCov(t0); for (auto& t1id : dNtracks) { - - if (t0id.collisionId() != t1id.collisionId()) { + auto t1 = t1id.template goodTrack_as(); + if (t0.collisionId() != t1.collisionId()) { continue; } - auto t1 = t1id.template goodTrack_as(); - auto Track1 = getTrackParCov(t1); bool isTrue3bodyV0 = false; if (t0.has_mcParticle() && t1.has_mcParticle()) { @@ -672,92 +770,13 @@ struct hypertriton3bodyFinder { } } - FillV0Counter(kV0All, isTrue3bodyV0); - if (!isTrue3bodyV0 && RejectBkgInMC) { - continue; - } - - int nCand = fitter.process(Track0, Track1); - if (nCand == 0) { - continue; - } - FillV0Counter(kV0hasSV, isTrue3bodyV0); - - // validate V0 radial position - // First check closeness to the beam-line as same as SVertexer - const auto& v0XYZ = fitter.getPCACandidate(); - float dxv0 = v0XYZ[0] - mMeanVertex.getX(), dyv0 = v0XYZ[1] - mMeanVertex.getY(), r2v0 = dxv0 * dxv0 + dyv0 * dyv0; - float rv0 = std::sqrt(r2v0); - if (rv0 < minRToMeanVertex) { - continue; - } - FillV0Counter(kV0Radius, isTrue3bodyV0); - - // Not involved: Get minR with same way in SVertexer - // float drv0P = rv0 - Track0minR, drv0N = rv0 - Track1minR; - - // check: if the process function finish the propagation - if (!fitter.isPropagateTracksToVertexDone() && !fitter.propagateTracksToVertex()) { - continue; - } - - int cand = 0; - auto& trPProp = fitter.getTrack(0, cand); - auto& trNProp = fitter.getTrack(1, cand); - std::array pP, pN; - trPProp.getPxPyPzGlo(pP); - trNProp.getPxPyPzGlo(pN); - // estimate DCA of neutral V0 track to beamline: straight line with parametric equation - // x = X0 + pV0[0]*t, y = Y0 + pV0[1]*t reaches DCA to beamline (Xv, Yv) at - // t = -[ (x0-Xv)*pV0[0] + (y0-Yv)*pV0[1]) ] / ( pT(pV0)^2 ) - // Similar equation for 3D distance involving pV0[2] - std::array pV0 = {pP[0] + pN[0], pP[1] + pN[1], pP[2] + pN[2]}; - float pt2V0 = pV0[0] * pV0[0] + pV0[1] * pV0[1], prodXYv0 = dxv0 * pV0[0] + dyv0 * pV0[1], tDCAXY = prodXYv0 / pt2V0; - float p2V0 = pt2V0 + pV0[2] * pV0[2], ptV0 = std::sqrt(pt2V0); - if (ptV0 < minPtV0) { // pt cut - continue; - } - FillV0Counter(kV0Pt, isTrue3bodyV0); - - if (pV0[2] / ptV0 > maxTglV0) { // tgLambda cut + float rv0; + if (!DecayV0Finder(dCollision, t0, t1, rv0, isTrue3bodyV0)) { continue; } - FillV0Counter(kV0TgLamda, isTrue3bodyV0); - - // apply mass selections - float massV0LambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); - float massV0AntiLambdaHyp = RecoDecay::m(array{array{pP[0], pP[1], pP[2]}, array{pN[0], pN[1], pN[2]}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); - float massMargin = 20 * (0.001 * (1. + 0.5 * ptV0)) + 0.07; - if (massV0LambdaHyp - o2::constants::physics::MassLambda > massMargin && massV0AntiLambdaHyp - o2::constants::physics::MassLambda > massMargin) { - continue; - } - FillV0Counter(kV0InvMass, isTrue3bodyV0); - - float dcaX = dxv0 - pV0[0] * tDCAXY, dcaY = dyv0 - pV0[1] * tDCAXY, dca2 = dcaX * dcaX + dcaY * dcaY; - float cosPAXY = prodXYv0 / std::sqrt(r2v0 * pt2V0); - if (dca2 > maxDCAXY2ToMeanVertex3bodyV0) { - continue; - } - FillV0Counter(kV0DcaXY, isTrue3bodyV0); - - if (cosPAXY < minCosPAXYMeanVertex3bodyV0) { - continue; - } - float dx = v0XYZ[0] - dCollision.posX(), dy = v0XYZ[1] - dCollision.posY(), dz = v0XYZ[2] - dCollision.posZ(), prodXYZv0 = dx * pV0[0] + dy * pV0[1] + dz * pV0[2]; - float cosPA = prodXYZv0 / std::sqrt((dx * dx + dy * dy + dz * dz) * p2V0); - if (cosPA < minCosPA3bodyV0) { - continue; - } - FillV0Counter(kV0CosPA, isTrue3bodyV0); for (auto& t2id : dGoodtracks) { - if (t2id.globalIndex() == t0id.globalIndex()) { - continue; // skip the track used by V0 - } auto t2 = t2id.template goodTrack_as(); - auto track0 = getTrackParCov(t0); - auto track1 = getTrackParCov(t1); - auto bach = getTrackParCov(t2); bool isTrue3bodyVtx = false; if (t0.has_mcParticle() && t1.has_mcParticle() && t2.has_mcParticle()) { @@ -779,109 +798,13 @@ struct hypertriton3bodyFinder { } } - FillVtxCounter(kVtxAll, isTrue3bodyVtx); - if (!isTrue3bodyVtx && RejectBkgInMC) { - continue; - } - - if (bach.getPt() < minbachPt) { - continue; - } - FillVtxCounter(kVtxbachPt, isTrue3bodyVtx); - - int n3bodyVtx = fitter3body.process(track0, track1, bach); - if (n3bodyVtx == 0) { // discard this pair - continue; - } - FillVtxCounter(kVtxhasSV, isTrue3bodyVtx); - - int cand3B = 0; - const auto& vertexXYZ = fitter3body.getPCACandidatePos(cand3B); - // make sure the cascade radius is smaller than that of the vertex - float dxc = vertexXYZ[0] - dCollision.posX(), dyc = vertexXYZ[1] - dCollision.posY(), dzc = vertexXYZ[2] - dCollision.posZ(), r2vertex = dxc * dxc + dyc * dyc; - float rvertex = std::sqrt(r2vertex); - if (std::abs(rv0 - rvertex) > maxRDiff3bodyV0 || rvertex < minRToMeanVertex) { - continue; - } - FillVtxCounter(kVtxRadius, isTrue3bodyVtx); - - // Not involved: bach.minR - rveretx check - - // check: if the process function finish the propagation - if (!fitter3body.isPropagateTracksToVertexDone() && !fitter3body.propagateTracksToVertex()) { - continue; - } - - auto& tr0 = fitter3body.getTrack(0, cand3B); - auto& tr1 = fitter3body.getTrack(1, cand3B); - auto& tr2 = fitter3body.getTrack(2, cand3B); - std::array p0, p1, p2; - tr0.getPxPyPzGlo(p0); - tr1.getPxPyPzGlo(p1); - tr2.getPxPyPzGlo(p2); - std::array p3B = {p0[0] + p1[0] + p2[0], p0[1] + p1[1] + p2[1], p0[2] + p1[2] + p2[2]}; - - float pt2 = p3B[0] * p3B[0] + p3B[1] * p3B[1], p2candidate = pt2 + p3B[2] * p3B[2]; - float pt = std::sqrt(pt2); - if (pt < minPt3Body) { // pt cut - continue; - } - FillVtxCounter(kVtxPt, isTrue3bodyVtx); - - if (p3B[2] / pt > maxTgl3Body) { // tgLambda cut - continue; - } - FillVtxCounter(kVtxTgLamda, isTrue3bodyVtx); - - float cosPA = (p3B[0] * dxc + p3B[1] * dyc + p3B[2] * dzc) / std::sqrt(p2candidate * (r2vertex + dzc * dzc)); - if (cosPA < minCosPA3body) { - continue; - } - FillVtxCounter(kVtxCosPA, isTrue3bodyVtx); - - if (fitter3body.getChi2AtPCACandidate() > dcavtxdau) { - continue; - } - FillVtxCounter(kVtxDcaDau, isTrue3bodyVtx); - - // Calculate DCA with respect to the collision associated to the V0, not individual tracks - gpu::gpustd::array dcaInfo; - - auto Track0Par = getTrackPar(t0); - o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track0Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track0dcaXY = dcaInfo[0]; - - auto Track1Par = getTrackPar(t1); - o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track1Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track1dcaXY = dcaInfo[0]; - - auto Track2Par = getTrackPar(t2); - o2::base::Propagator::Instance()->propagateToDCABxByBz({dCollision.posX(), dCollision.posY(), dCollision.posZ()}, Track2Par, 2.f, fitter3body.getMatCorrType(), &dcaInfo); - auto Track2dcaXY = dcaInfo[0]; - - // Not involved: H3L DCA Check - // auto track3B = o2::track::TrackParCov(vertexXYZ, p3B, fitter3body.calcPCACovMatrixFlat(cand3B), t2.sign()); - auto track3B = o2::track::TrackParCov(vertexXYZ, p3B, t2.sign()); - o2::dataformats::DCA dca; - if (d_UseH3LDCACut && (!track3B.propagateToDCA({{dCollision.posX(), dCollision.posY(), dCollision.posZ()}, {dCollision.covXX(), dCollision.covXY(), dCollision.covYY(), dCollision.covXZ(), dCollision.covYZ(), dCollision.covZZ()}}, fitter3body.getBz(), &dca, 5.) || - std::abs(dca.getY()) > maxDCAXY3Body || std::abs(dca.getZ()) > maxDCAZ3Body)) { - continue; - } - FillVtxCounter(kVtxDcaH3L, isTrue3bodyVtx); - - vtx3bodydata( - t0.globalIndex(), t1.globalIndex(), t2.globalIndex(), dCollision.globalIndex(), 0, - vertexXYZ[0], vertexXYZ[1], vertexXYZ[2], - p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], - fitter3body.getChi2AtPCACandidate(), - Track0dcaXY, Track1dcaXY, Track2dcaXY); + Decay3bodyFinder(dCollision, t0, t1, t2, rv0, isTrue3bodyVtx); } } } fillHistos(); resetHistos(); } - //------------------------------------------------------------------ // MC virtual lambda check template @@ -925,7 +848,7 @@ struct hypertriton3bodyFinder { DecayFinder(collision, ptracks, ntracks, goodtracks); } - PROCESS_SWITCH(hypertriton3bodyFinder, processData, "Produce StoredVtx3BodyDatas with data", false); + PROCESS_SWITCH(hypertriton3bodyFinder, processData, "Produce StoredVtx3BodyDatas with data", true); void processCFFilteredData(aod::Collisions const& collisions, aod::CFFilters const& cffilters, aod::V0GoodPosTracks const& Ptracks, aod::V0GoodNegTracks const& Ntracks, aod::V0GoodTracks const& Goodtracks, FullTracksExtIU const&, aod::BCsWithTimestamps const&) { @@ -948,7 +871,7 @@ struct hypertriton3bodyFinder { DecayFinder(collision, ptracks, ntracks, goodtracks); } } - PROCESS_SWITCH(hypertriton3bodyFinder, processCFFilteredData, "Produce StoredVtx3BodyDatas with data using CFtriggers", true); + PROCESS_SWITCH(hypertriton3bodyFinder, processCFFilteredData, "Produce StoredVtx3BodyDatas with data using CFtriggers", false); void processMC(aod::Collision const& collision, aod::V0GoodPosTracks const& ptracks, aod::V0GoodNegTracks const& ntracks, aod::V0GoodTracks const& goodtracks, aod::McParticles const& mcparticles, FullTracksExtMCIU const&, aod::BCsWithTimestamps const&) { @@ -1146,6 +1069,176 @@ struct hypertriton3bodyLabelBuilder { PROCESS_SWITCH(hypertriton3bodyLabelBuilder, processBuildLabels, "Produce MC label tables", false); }; +struct hypertriton3bodyComparewithDecay3body { + + HistogramRegistry registry{ + "registry", + { + {"hTestCounter", "hTestCounter", {HistType::kTH1F, {{8, 0.0f, 8.0f}}}}, + {"hMotherCounter", "hMotherCounter", {HistType::kTH1F, {{10, 0.0f, 10.0f}}}}, + {"hCheckCounter", "hCheckCounter", {HistType::kTH1F, {{5, 0.0f, 5.0f}}}}, + {"hHypertritonMCPtTotal", "hHypertritonMCPtTotal", {HistType::kTH1F, {{20, 0.0f, 10.0f}}}}, + {"hHypertritonMCPt", "hHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, + {"hAntiHypertritonMCPt", "hAntiHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, + {"hHypertritonMCMass", "hHypertritonMCMass", {HistType::kTH1F, {{40, 2.95f, 3.05f}}}}, + {"hAntiHypertritonMCMass", "hAntiHypertritonMCMass", {HistType::kTH1F, {{40, 2.95f, 3.05f}}}}, + {"hPairedHypertritonMCPt", "hPairedHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, + {"hPairedAntiHypertritonMCPt", "hPairedAntiHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, + {"hSameMcIndexCounter", "hSameMcIndexCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, + }, + }; + + void init(InitContext const&) + { + registry.get(HIST("hCheckCounter"))->GetXaxis()->SetBinLabel(1, "Total"); + registry.get(HIST("hCheckCounter"))->GetXaxis()->SetBinLabel(2, "Sig in Decay3body"); + registry.get(HIST("hCheckCounter"))->GetXaxis()->SetBinLabel(3, "Sig SameCol"); + registry.get(HIST("hCheckCounter"))->GetXaxis()->SetBinLabel(4, "Sig contained by finder"); + registry.get(HIST("hCheckCounter"))->GetXaxis()->SetBinLabel(5, "Sig SameIndex"); + } + struct Indexdaughters { // check duplicated paired daughters + int64_t index0; + int64_t index1; + int64_t index2; + bool operator==(const Indexdaughters& t) const + { + return (this->index0 == t.index0 && this->index1 == t.index1 && this->index2 == t.index2); + } + }; + + void processDoNotCompare(aod::Collisions::iterator const& collision) + { + // dummy process function - should not be required in the future + } + PROCESS_SWITCH(hypertriton3bodyComparewithDecay3body, processDoNotCompare, "Do not do comparison", true); + + void processDoComparison(aod::Decay3Bodys const& decay3bodytable, soa::Join const& vtx3bodydatas, LabeledTracks const&, aod::McParticles const& particlesMC) + { + std::vector set_pair; + for (auto d3body : decay3bodytable) { + registry.fill(HIST("hCheckCounter"), 0.5); + registry.fill(HIST("hTestCounter"), 0.5); + auto lTrack0 = d3body.track0_as(); + auto lTrack1 = d3body.track1_as(); + auto lTrack2 = d3body.track2_as(); + if (!lTrack0.has_mcParticle() || !lTrack1.has_mcParticle() || !lTrack2.has_mcParticle()) { + continue; + } + registry.fill(HIST("hTestCounter"), 1.5); + auto lMCTrack0 = lTrack0.mcParticle_as(); + auto lMCTrack1 = lTrack1.mcParticle_as(); + auto lMCTrack2 = lTrack2.mcParticle_as(); + /*if (lMCTrack0.isPhysicalPrimary() || lMCTrack1.isPhysicalPrimary() || lMCTrack2.isPhysicalPrimary()) { + continue; + }*/ + /*if (lMCTrack0.producedByGenerator() || lMCTrack1.producedByGenerator() || lMCTrack2.producedByGenerator()) { + continue; + }*/ + registry.fill(HIST("hTestCounter"), 2.5); + + if (!lMCTrack0.has_mothers() || !lMCTrack1.has_mothers() || !lMCTrack2.has_mothers()) { + continue; + } + registry.fill(HIST("hTestCounter"), 3.5); + + int lPDG = -1; + float lPt = -1; + bool is3bodyDecayedH3L = false; + int lGlobalIndex = -1; + int nmother = 0, dummyindex; + for (auto& lMother0 : lMCTrack0.mothers_as()) { + ++nmother; + dummyindex = lMother0.globalIndex(); + } + registry.fill(HIST("hMotherCounter"), nmother); + nmother = 0; + for (auto& lMother1 : lMCTrack1.mothers_as()) { + ++nmother; + dummyindex = lMother1.globalIndex(); + } + registry.fill(HIST("hMotherCounter"), nmother); + nmother = 0; + for (auto& lMother2 : lMCTrack2.mothers_as()) { + ++nmother; + dummyindex = lMother2.globalIndex(); + } + registry.fill(HIST("hMotherCounter"), nmother); + + for (auto& lMother0 : lMCTrack0.mothers_as()) { + for (auto& lMother1 : lMCTrack1.mothers_as()) { + for (auto& lMother2 : lMCTrack2.mothers_as()) { + registry.fill(HIST("hTestCounter"), 4.5); + if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { // vtxs with the same mother + registry.fill(HIST("hTestCounter"), 7.5); + lGlobalIndex = lMother1.globalIndex(); + lPDG = lMother1.pdgCode(); + lPt = lMother1.pt(); + if (lPDG == 1010010030 && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == 1000010020) { + is3bodyDecayedH3L = true; + double hypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); + registry.fill(HIST("hHypertritonMCPt"), lPt); + registry.fill(HIST("hHypertritonMCMass"), hypertritonMCMass); + } + if (lPDG == -1010010030 && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -1000010020) { + is3bodyDecayedH3L = true; + double antiHypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}); + registry.fill(HIST("hAntiHypertritonMCPt"), lPt); + registry.fill(HIST("hAntiHypertritonMCMass"), antiHypertritonMCMass); + } + } + } + } + } // end association check + + if (!is3bodyDecayedH3L) { + continue; + } + + registry.fill(HIST("hCheckCounter"), 1.5); + registry.fill(HIST("hTestCounter"), 5.5); + // for check + registry.fill(HIST("hHypertritonMCPtTotal"), lPt); + /*if ( (lPt >= 3.5 && lPt < 4.0) || (lPt >= 8.5 && lPt < 9.0) ) { + std::cout << "---------------------- Num:" << registry.get(HIST("hCheckCounter"))->GetBinContent(1) << "-----------------------------" << std::endl; + std::cout << "track0Pt=" << lMCTrack0.pt() << " track1Pt=" << lMCTrack1.pt() << " track2Pt=" << lMCTrack2.pt() << std::endl; + std::cout << "MotherTrackPt=" << lPt << std::endl; + }*/ + + Indexdaughters temp = {lMCTrack0.globalIndex(), lMCTrack1.globalIndex(), lMCTrack2.globalIndex()}; + auto p = std::find(set_pair.begin(), set_pair.end(), temp); + if (p == set_pair.end()) { + set_pair.push_back(temp); + registry.fill(HIST("hTestCounter"), 6.5); + } + + if (lTrack0.collisionId() != lTrack1.collisionId() || lTrack0.collisionId() != lTrack2.collisionId()) { + continue; + } + registry.fill(HIST("hCheckCounter"), 2.5); + + for (auto vtx : vtx3bodydatas) { + if (vtx.mcParticleId() == -1) { + continue; + } + auto mcparticle = vtx.mcParticle_as(); + if (mcparticle.globalIndex() == lGlobalIndex) { + registry.fill(HIST("hCheckCounter"), 4.5); // rare case check: if motherId matches but daughters not + if (lTrack0.globalIndex() == vtx.track0Id() && lTrack1.globalIndex() == vtx.track1Id() && lTrack2.globalIndex() == vtx.track2Id()) { + registry.fill(HIST("hCheckCounter"), 3.5); + if (lPDG > 0) { + registry.fill(HIST("hPairedHypertritonMCPt"), lPt); + } else { + registry.fill(HIST("hPairedAntiHypertritonMCPt"), lPt); + } + break; + } + } + } + } + } + PROCESS_SWITCH(hypertriton3bodyComparewithDecay3body, processDoComparison, "Compare decay3bodys and finder method with MC", true); +}; + struct hypertriton3bodyInitializer { Spawns vtx3bodydatas; void init(InitContext const&) {} @@ -1157,6 +1250,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), }; } diff --git a/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx b/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx index 4c1b0884a53..d6720e6f8b4 100644 --- a/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx +++ b/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx @@ -14,7 +14,7 @@ // // This code loops over a StoredVtx3BodyDatas table and produces some // standard analysis output. It requires either -// the hypertriton3bodybuilder or hypertriton3bodyfinder (not recommaended) tasks +// the hypertriton3bodybuilder or hypertriton3bodyfinder (not recommended) tasks // to have been executed in the workflow (before). // // author: yuanzhe.wang@cern.ch @@ -22,6 +22,7 @@ #include #include #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -76,26 +77,30 @@ bool is3bodyDecayedH3L(TMCParticle const& particle) return false; } -/* template - bool is3bodyDecayedH3L(TMCParticle const& mctrack0, TMCParticle const& mctrack1, TMCParticle const& mctrack2) - { - bool flag = false; - for (auto& particleMother : mctrack0.mothers_as()) { - if (particleMother.pdgCode() != 1010010030 && particleMother.pdgCode() != -1010010030) { - continue; +template +bool isPairedH3LDaughters(TMCParticle const& mctrack0, TMCParticle const& mctrack1, TMCParticle const& mctrack2) +{ + for (auto& particleMother : mctrack0.template mothers_as()) { + if (!(particleMother.pdgCode() == 1010010030 && mctrack0.pdgCode() == 2212 && mctrack1.pdgCode() == -211 && mctrack2.pdgCode() == 1000010020) && + !(particleMother.pdgCode() == -1010010030 && mctrack0.pdgCode() == -2212 && mctrack1.pdgCode() == 211 && mctrack2.pdgCode() == -1000010020)) { + continue; } bool flag1 = false, flag2 = false; - for (auto& mcparticleDaughter : particle.template daughters_as()) { - if(mcparticleDaughter.globalIndex() == mctrack1.globalIndex()) - flag1 = true; - if(mcparticleDaughter.globalIndex() == mctrack2.globalIndex()) - flag2 = true; - } - if (flag1 && flag2) - flag = true; + for (auto& mcparticleDaughter : particleMother.template daughters_as()) { + if (mcparticleDaughter.globalIndex() == mctrack1.globalIndex()) + flag1 = true; + if (mcparticleDaughter.globalIndex() == mctrack2.globalIndex()) + flag2 = true; } - return flag; - }*/ + if (!flag1 || !flag2) + continue; + // move the requirement in mass region into the loop to draw a histogram + // double hypertritonMCMass = RecoDecay::m(array{array{mctrack0.px(), mctrack0.py(), mctrack0.pz()}, array{mctrack1.px(), mctrack1.py(), mctrack1.pz()}, array{mctrack2.px(), mctrack2.py(), mctrack2.pz()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); + // if (hypertritonMCMass > 2.990 && hypertritonMCMass < 2.993) + return true; + } + return false; +} struct hypertriton3bodyQaMc { // Basic checks @@ -152,7 +157,7 @@ struct hypertriton3bodyAnalysisMc { Configurable TofPidNsigmaMin{"TofPidNsigmaMin", -4, "TofPidNsigmaMin"}; Configurable TofPidNsigmaMax{"TofPidNsigmaMax", 8, "TofPidNsigmaMax"}; Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; - Configurable eventSelection{"eventSelection", true, "event selection"}; + Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; Configurable lifetimecut{"lifetimecut", 40., "lifetimecut"}; Configurable minProtonPt{"minProtonPt", 0.3, "minProtonPt"}; Configurable maxProtonPt{"maxProtonPt", 5, "maxProtonPt"}; @@ -202,6 +207,10 @@ struct hypertriton3bodyAnalysisMc { {"hProtonTPCVsPt", "hProtonTPCVsPt", {HistType::kTH2F, {{50, 0.0f, 5.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, {"hPionTPCVsPt", "hPionTPCVsPt", {HistType::kTH2F, {{20, 0.0f, 2.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, {"hDeuteronTPCVsPt", "hDeuteronTPCVsPt", {HistType::kTH2F, {{80, 0.0f, 8.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, + {"hDeuteronTOFVsPBeforeTOFCut", "hDeuteronTOFVsPBeforeTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, + {"hDeuteronTOFVsPBeforeTOFCutSig", "hDeuteronTOFVsPBeforeTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, + {"hDeuteronTOFVsPAtferTOFCut", "hDeuteronTOFVsPAtferTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, + {"hDeuteronTOFVsPAtferTOFCutSig", "hDeuteronTOFVsPAtferTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, {"hDalitz", "hDalitz", {HistType::kTH2F, {{120, 7.85, 8.45, "M^{2}(dp) (GeV^{2}/c^{4})"}, {60, 1.1, 1.4, "M^{2}(p#pi) (GeV^{2}/c^{4})"}}}}, {"h3dMassHypertriton", "h3dMassHypertriton", {HistType::kTH3F, {{20, 0.0f, 100.0f, "Cent (%)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, @@ -249,7 +258,7 @@ struct hypertriton3bodyAnalysisMc { registry.add("h3dMassAntiHypertritonDca", "h3dMassAntiHypertritonDca", {HistType::kTH3F, {dcaAxis, ptAxis, massAxisHypertriton}}); } - TString CandCounterbinLabel[11] = {"Total", "VtxCosPA", "TrackEta", "MomRapidity", "Lifetime", "DcaV0Dau", "d TOFPID", "TPCPID&Mass", "TPCNcls", "DauPt", "PionDcatoPV"}; + TString CandCounterbinLabel[11] = {"Total", "VtxCosPA", "TrackEta", "MomRapidity", "Lifetime", "VtxDcaDau", "d TOFPID", "TPCPID&Mass", "TPCNcls", "DauPt", "PionDcatoPV"}; for (int i{0}; i < kNVtxSteps; i++) { registry.get(HIST("hSelectedCandidatesCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); registry.get(HIST("hSelectedTrueHypertritonCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); @@ -259,7 +268,7 @@ struct hypertriton3bodyAnalysisMc { void process(soa::Join::iterator const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, MyTracks const& tracks, aod::McParticles const& particlesMC) { registry.fill(HIST("hSelectedEventCounter"), 0.5); - if (eventSelection && !collision.sel8()) { + if (event_sel8_selection && !collision.sel8()) { return; } registry.fill(HIST("hSelectedEventCounter"), 1.5); @@ -324,10 +333,18 @@ struct hypertriton3bodyAnalysisMc { continue; } FillCandCounter(kCandDcaDau, isFromHypertriton); + registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCut"), track2.sign() * track2.p(), track2.tofNSigmaDe()); + if (isFromHypertriton) { + registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCutSig"), track2.sign() * track2.p(), track2.tofNSigmaDe()); + } if ((track2.tofNSigmaDe() < TofPidNsigmaMin || track2.tofNSigmaDe() > TofPidNsigmaMax) && track2.p() > minDeuteronPUseTOF) { continue; } FillCandCounter(kCandTOFPID, isFromHypertriton); + registry.fill(HIST("hDeuteronTOFVsPAtferTOFCut"), track2.sign() * track2.p(), track2.tofNSigmaDe()); + if (isFromHypertriton) { + registry.fill(HIST("hDeuteronTOFVsPAtferTOFCutSig"), track2.sign() * track2.p(), track2.tofNSigmaDe()); + } // 3sigma region for Dalitz plot double lowerlimit = o2::constants::physics::MassHyperTriton - 3 * mcsigma; @@ -479,7 +496,7 @@ struct hypertriton3bodyLabelCheck { HistogramRegistry registry{ "registry", { - {"hLabeledVtxCounter", "hLabeledVtxCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, + {"hLabeledVtxCounter", "hLabeledVtxCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, {"hMassTrueH3L", "hMassTrueH3L", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, {"hMassTrueH3LMatter", "hMassTrueH3LMatter", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, {"hMassTrueH3LAntiMatter", "hMassTrueH3LAntiMatter", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, @@ -490,9 +507,10 @@ struct hypertriton3bodyLabelCheck { { registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(1, "Readin"); registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(2, "TrueMCH3L"); + registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(3, "Nonrepetitive"); } - Configurable eventSelection{"eventSelection", true, "event selection"}; + Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; void process(soa::Join::iterator const& collision) { @@ -502,10 +520,11 @@ struct hypertriton3bodyLabelCheck { void processCheckLabel(soa::Join::iterator const& collision, soa::Join const& vtx3bodydatas, MyTracks const& tracks, aod::McParticles const& particlesMC) { - if (eventSelection && !collision.sel8()) { + if (event_sel8_selection && !collision.sel8()) { return; } + std::vector set_mothertrack; for (auto& vtx : vtx3bodydatas) { registry.fill(HIST("hLabeledVtxCounter"), 0.5); if (vtx.mcParticleId() != -1) { @@ -514,10 +533,20 @@ struct hypertriton3bodyLabelCheck { registry.fill(HIST("hLabeledVtxCounter"), 1.5); registry.fill(HIST("hMassTrueH3L"), vtx.mHypertriton()); registry.fill(HIST("hMassTrueH3LMatter"), vtx.mHypertriton()); + auto p = std::find(set_mothertrack.begin(), set_mothertrack.end(), mcparticle.globalIndex()); + if (p == set_mothertrack.end()) { + set_mothertrack.push_back(mcparticle.globalIndex()); + registry.fill(HIST("hLabeledVtxCounter"), 2.5); + } } else if (mcparticle.pdgCode() == -1010010030) { registry.fill(HIST("hLabeledVtxCounter"), 1.5); registry.fill(HIST("hMassTrueH3L"), vtx.mAntiHypertriton()); registry.fill(HIST("hMassTrueH3LAntiMatter"), vtx.mAntiHypertriton()); + auto p = std::find(set_mothertrack.begin(), set_mothertrack.end(), mcparticle.globalIndex()); + if (p == set_mothertrack.end()) { + set_mothertrack.push_back(mcparticle.globalIndex()); + registry.fill(HIST("hLabeledVtxCounter"), 2.5); + } } } } @@ -578,7 +607,7 @@ struct hypertriton3bodyTrackMcinfo { {"hDauPionNsigmaPion", "hDauPionNsigmaPion", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, {"hDauPionTPCVsPt", "hDauPionTPCVsPt", {HistType::kTH2F, {{20, 0.0f, 2.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hDeuteronCount", "hDeuteronCount", {HistType::kTH1F, {{6, 0.0f, 6.0f}}}}, + {"hDeuteronCount", "hDeuteronCount", {HistType::kTH1F, {{7, 0.0f, 7.0f}}}}, {"hDeuteronPt", "hDeuteronPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hDeuteronP", "hDeuteronP", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hDeuteronMcPt", "hDeuteronMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, @@ -592,8 +621,14 @@ struct hypertriton3bodyTrackMcinfo { {"hDauDeuteronPt", "hDauDeuteronPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hDauDeuteronMcPt", "hDauDeuteronMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hDauDeuteronTPCVsPt", "hDauDeuteronTPCVsPt", {HistType::kTH2F, {{80, 0.0f, 8.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, + {"hDauDeuteronTOFNSigmaVsP", "hDauDeuteronTOFNSigmaVsP", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {200, -100.0f, 100.0f, "TPC n#sigma"}}}}, + {"hDauDeuteronTOFNSigmaVsPifhasTOF", "hDauDeuteronTOFNSigmaVsPifhasTOF", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {200, -100.0f, 100.0f, "TPC n#sigma"}}}}, {"hTPCBB", "hTPCBB", {HistType::kTH2F, {{120, -8.0f, 8.0f, "p/z(GeV/c)"}, {100, 0.0f, 1000.0f, "TPCSignal"}}}}, + + {"hPairedH3LDaughers", "hPairedH3LDaughers", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, + {"hPairedH3LDaughersInvMass", "hPairedH3LDaughersInvMass", {HistType::kTH1F, {{300, 2.9f, 3.2f}}}}, + {"hDuplicatedH3LDaughers", "hDuplicatedH3LDaughers", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, }, }; @@ -607,25 +642,17 @@ struct hypertriton3bodyTrackMcinfo { registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(6, "McisPion"); registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(7, "McisDeuteron"); - registry.get(HIST("hProtonCount"))->GetXaxis()->SetBinLabel(1, "hasMom"); - registry.get(HIST("hProtonCount"))->GetXaxis()->SetBinLabel(2, "FromHypertriton"); - registry.get(HIST("hProtonCount"))->GetXaxis()->SetBinLabel(3, "TPCNcls"); - registry.get(HIST("hProtonCount"))->GetXaxis()->SetBinLabel(4, "Eta"); - registry.get(HIST("hProtonCount"))->GetXaxis()->SetBinLabel(5, "Pt"); - registry.get(HIST("hProtonCount"))->GetXaxis()->SetBinLabel(6, "TPCPID"); - registry.get(HIST("hPionCount"))->GetXaxis()->SetBinLabel(1, "hasMom"); - registry.get(HIST("hPionCount"))->GetXaxis()->SetBinLabel(2, "FromHypertriton"); - registry.get(HIST("hPionCount"))->GetXaxis()->SetBinLabel(3, "TPCNcls"); - registry.get(HIST("hPionCount"))->GetXaxis()->SetBinLabel(4, "Eta"); - registry.get(HIST("hPionCount"))->GetXaxis()->SetBinLabel(5, "Pt"); - registry.get(HIST("hPionCount"))->GetXaxis()->SetBinLabel(6, "TPCPID"); + TString TrackCounterbinLabel[6] = {"hasMom", "FromHypertriton", "TPCNcls", "Eta", "Pt", "TPCPID"}; + for (int i{0}; i < 6; i++) { + registry.get(HIST("hProtonCount"))->GetXaxis()->SetBinLabel(i + 1, TrackCounterbinLabel[i]); + registry.get(HIST("hPionCount"))->GetXaxis()->SetBinLabel(i + 1, TrackCounterbinLabel[i]); + registry.get(HIST("hDeuteronCount"))->GetXaxis()->SetBinLabel(i + 1, TrackCounterbinLabel[i]); + } registry.get(HIST("hPionCount"))->GetXaxis()->SetBinLabel(7, "DcatoPV"); - registry.get(HIST("hDeuteronCount"))->GetXaxis()->SetBinLabel(1, "hasMom"); - registry.get(HIST("hDeuteronCount"))->GetXaxis()->SetBinLabel(2, "FromHypertriton"); - registry.get(HIST("hDeuteronCount"))->GetXaxis()->SetBinLabel(3, "TPCNcls"); - registry.get(HIST("hDeuteronCount"))->GetXaxis()->SetBinLabel(4, "Eta"); - registry.get(HIST("hDeuteronCount"))->GetXaxis()->SetBinLabel(5, "Pt"); - registry.get(HIST("hDeuteronCount"))->GetXaxis()->SetBinLabel(6, "TPCPID"); + registry.get(HIST("hDeuteronCount"))->GetXaxis()->SetBinLabel(7, "hasTOF"); + registry.get(HIST("hDuplicatedH3LDaughers"))->GetXaxis()->SetBinLabel(1, "proton"); + registry.get(HIST("hDuplicatedH3LDaughers"))->GetXaxis()->SetBinLabel(2, "pion"); + registry.get(HIST("hDuplicatedH3LDaughers"))->GetXaxis()->SetBinLabel(3, "deuteron"); } Configurable dcapiontopv{"dcapiontopv", .05, "DCA Pion To PV"}; @@ -635,18 +662,30 @@ struct hypertriton3bodyTrackMcinfo { Configurable maxPionPt{"maxPionPt", 1.2, "maxPionPt"}; Configurable minDeuteronPt{"minDeuteronPt", 0.6, "minDeuteronPt"}; Configurable maxDeuteronPt{"maxDeuteronPt", 10, "maxDeuteronPt"}; - Configurable eventSelection{"eventSelection", true, "event selection"}; + Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; + + struct Indexdaughters { // check duplicated paired daughters + int64_t index0; + int64_t index1; + int64_t index2; + bool operator==(const Indexdaughters& t) const + { + return (this->index0 == t.index0 && this->index1 == t.index1 && this->index2 == t.index2); + } + }; void process(soa::Join::iterator const& collision, aod::McParticles const& mcparticles, MyTracks const& tracks) { registry.fill(HIST("hTotalCollCounter"), 0.5); - if (eventSelection && !collision.sel8()) { + if (event_sel8_selection && !collision.sel8()) { return; } registry.fill(HIST("hTotalCollCounter"), 1.5); - std::vector protons, pions, deuterons; // index for daughter tracks + std::vector protons, pions, deuterons; // index for daughter tracks + std::unordered_set set_proton, set_pion, set_deuteron; // check duplicated daughters + int itrack = 0; for (auto& track : tracks) { registry.fill(HIST("hParticleCount"), 0.5); @@ -690,7 +729,10 @@ struct hypertriton3bodyTrackMcinfo { if (!flag_H3L) { continue; } - protons.push_back(track.globalIndex()); + protons.push_back(itrack); + auto p = set_proton.insert(mcparticle.globalIndex()); + if (p.second == false) + registry.fill(HIST("hDuplicatedH3LDaughers"), 0); registry.fill(HIST("hProtonCount"), 1.5); registry.fill(HIST("hDauProtonPt"), track.pt()); registry.fill(HIST("hDauProtonMcPt"), mcparticle.pt()); @@ -741,7 +783,10 @@ struct hypertriton3bodyTrackMcinfo { if (!flag_H3L) { continue; } - pions.push_back(track.globalIndex()); + pions.push_back(itrack); + auto p = set_pion.insert(mcparticle.globalIndex()); + if (p.second == false) + registry.fill(HIST("hDuplicatedH3LDaughers"), 1); registry.fill(HIST("hPionCount"), 1.5); registry.fill(HIST("hDauPionPt"), track.pt()); registry.fill(HIST("hDauPionMcPt"), mcparticle.pt()); @@ -795,11 +840,18 @@ struct hypertriton3bodyTrackMcinfo { if (!flag_H3L) { continue; } - deuterons.push_back(track.globalIndex()); + deuterons.push_back(itrack); + auto p = set_deuteron.insert(mcparticle.globalIndex()); + if (p.second == false) + registry.fill(HIST("hDuplicatedH3LDaughers"), 2); registry.fill(HIST("hDeuteronCount"), 1.5); registry.fill(HIST("hDauDeuteronPt"), track.pt()); registry.fill(HIST("hDauDeuteronMcPt"), mcparticle.pt()); registry.fill(HIST("hDauDeuteronTPCVsPt"), track.pt(), track.tpcNSigmaDe()); + registry.fill(HIST("hDauDeuteronTOFNSigmaVsP"), track.sign() * track.p(), track.tofNSigmaDe()); + if (track.hasTOF()) { + registry.fill(HIST("hDauDeuteronTOFNSigmaVsPifhasTOF"), track.sign() * track.p(), track.tofNSigmaDe()); + } if (track.tpcNClsCrossedRows() < 70) { continue; } @@ -816,6 +868,10 @@ struct hypertriton3bodyTrackMcinfo { continue; } registry.fill(HIST("hDeuteronCount"), 5.5); + if (track.hasTOF()) { + continue; + } + registry.fill(HIST("hDeuteronCount"), 6.5); } } @@ -830,15 +886,37 @@ struct hypertriton3bodyTrackMcinfo { registry.fill(HIST("hDeuteronMcRapidity"), mcparticle.y()); registry.fill(HIST("hDeuteronTPCBB"), track.p() * track.sign(), track.tpcSignal()); } + ++itrack; + } - /*for(int iproton = 0; iproton < protons.size(); iproton++){ - for(int ipion = 0; ipion < pions.size(); ipion++){ - for(int ideuteron = 0; ideuteron < deuterons.size(); ideuteron++){ - auto track0 = tracks.A - if(!isPaired3body() - } + std::vector set_pair; + for (auto iproton = 0; iproton < protons.size(); iproton++) { + auto track0 = tracks.iteratorAt(protons[iproton]); + auto mctrack0 = track0.mcParticle_as(); + for (auto ipion = 0; ipion < pions.size(); ipion++) { + auto track1 = tracks.iteratorAt(pions[ipion]); + auto mctrack1 = track1.mcParticle_as(); + for (auto ideuteron = 0; ideuteron < deuterons.size(); ideuteron++) { + auto track2 = tracks.iteratorAt(deuterons[ideuteron]); + auto mctrack2 = track2.mcParticle_as(); + if (isPairedH3LDaughters(mctrack0, mctrack1, mctrack2)) { + registry.fill(HIST("hPairedH3LDaughers"), 0); + // MC mass cut, to check if the daughters are from materials + double hypertritonMCMass = RecoDecay::m(array{array{mctrack0.px(), mctrack0.py(), mctrack0.pz()}, array{mctrack1.px(), mctrack1.py(), mctrack1.pz()}, array{mctrack2.px(), mctrack2.py(), mctrack2.pz()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); + registry.fill(HIST("hPairedH3LDaughersInvMass"), hypertritonMCMass); + if (hypertritonMCMass < 2.990 || hypertritonMCMass > 2.993) + continue; + registry.fill(HIST("hPairedH3LDaughers"), 1); + // duplicated daughters check + Indexdaughters temp = {mctrack0.globalIndex(), mctrack1.globalIndex(), mctrack2.globalIndex()}; + auto p = std::find(set_pair.begin(), set_pair.end(), temp); + if (p == set_pair.end()) { + set_pair.push_back(temp); + registry.fill(HIST("hPairedH3LDaughers"), 2); + } + } } - }*/ + } } } }; @@ -854,7 +932,7 @@ struct hypertriton3bodyMcParticleCount { {"h3dMCDecayedHypertriton", "h3dMCDecayedHypertriton", {HistType::kTH3F, {{20, -1.0f, 1.0f, "Rapidity"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {50, 0.0f, 50.0f, "ct(cm)"}}}}, {"hMcPhysicalPrimaryParticleCount", "hMcPhysicalPrimaryParticleCount", {HistType::kTH1F, {{8, 0.0f, 8.0f}}}}, - {"hMcHypertritonCount", "hMcHypertritonCount", {HistType::kTH1F, {{8, 0.0f, 8.0f}}}}, + {"hMcHypertritonCount", "hMcHypertritonCount", {HistType::kTH1F, {{9, 0.0f, 9.0f}}}}, {"hMcHypertritonPt", "hMcHypertritonPt", {HistType::kTH1F, {{300, 0.0f, 15.0f}}}}, {"hMcProtonPt", "hMcProtonPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hMcPionPt", "hMcPionPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, @@ -878,24 +956,25 @@ struct hypertriton3bodyMcParticleCount { registry.get(HIST("hMcPhysicalPrimaryParticleCount"))->GetXaxis()->SetBinLabel(7, "(Anti)Hypertriton"); registry.get(HIST("hMcPhysicalPrimaryParticleCount"))->GetXaxis()->SetBinLabel(8, "HasDaughter"); registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(1, "Hypertriton All"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(2, "AntiHypertriton All"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(3, "confirm to 3-body decay"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(4, "Hypertriton"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(5, "AntiHypertriton"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(6, "Rapidity"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(7, "Lifetime"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(8, "PtCut"); + registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(2, "Matter All"); + registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(3, "AntiMatter All"); + registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(4, "confirm to 3-body decay"); + registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(5, "Matter"); + registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(6, "AntiMatter"); + registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(7, "Rapidity"); + registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(8, "Lifetime"); + registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(9, "PtCut"); } Configurable rapidityMCcut{"rapidityMCcut", 0.9, "rapidity cut MC count"}; - Configurable eventSelectionMC{"eventSelectionMC", true, "event selection MC count"}; + Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; void process(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups>& collisions) { std::vector SelectedEvents(collisions.size()); int nevts = 0; for (const auto& collision : collisions) { - if (eventSelectionMC && !collision.sel8()) { + if (event_sel8_selection && !collision.sel8()) { continue; } SelectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); diff --git a/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx b/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx index 97cb130d10d..159f64546cf 100644 --- a/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx +++ b/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx @@ -14,7 +14,7 @@ // // This code loops over a StoredVtx3BodyDatas table and produces some // standard analysis output. It requires either -// the hypertriton3bodybuilder or hypertriton3bodyfinder (not recommaended) tasks +// the hypertriton3bodybuilder or hypertriton3bodyfinder (not recommended) tasks // to have been executed in the workflow (before). // // author: yuanzhe.wang@cern.ch @@ -139,7 +139,7 @@ struct hypertriton3bodyAnalysis { Configurable TofPidNsigmaMin{"TofPidNsigmaMin", -4, "TofPidNsigmaMin"}; Configurable TofPidNsigmaMax{"TofPidNsigmaMax", 8, "TofPidNsigmaMax"}; Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; - Configurable eventSelection{"eventSelection", true, "event selection"}; + Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; Configurable lifetimecut{"lifetimecut", 40., "lifetimecut"}; // ct Configurable minProtonPt{"minProtonPt", 0.3, "minProtonPt"}; Configurable maxProtonPt{"maxProtonPt", 5, "maxProtonPt"}; @@ -225,7 +225,7 @@ struct hypertriton3bodyAnalysis { registry.add("h3dMassAntiHypertritonDca", "h3dMassAntiHypertritonDca", {HistType::kTH3F, {dcaAxis, ptAxis, massAxisHypertriton}}); } - TString CandCounterbinLabel[11] = {"Total", "VtxCosPA", "TrackEta", "MomRapidity", "Lifetime", "DcaV0Dau", "d TOFPID", "TPCPID&Mass", "TPCNcls", "DauPt", "PionDcatoPV"}; + TString CandCounterbinLabel[11] = {"Total", "VtxCosPA", "TrackEta", "MomRapidity", "Lifetime", "VtxDcaDau", "d TOFPID", "TPCPID&Mass", "TPCNcls", "DauPt", "PionDcatoPV"}; for (int i{0}; i < kNVtxSteps; i++) { registry.get(HIST("hSelectedCandidatesCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); } @@ -234,7 +234,7 @@ struct hypertriton3bodyAnalysis { void process(soa::Join::iterator const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, MyTracks const& tracks) { registry.fill(HIST("hSelectedEventCounter"), 0.5); - if (eventSelection && !collision.sel8()) { + if (event_sel8_selection && !collision.sel8()) { return; } registry.fill(HIST("hSelectedEventCounter"), 1.5); From cf6b6868c4ec85d4df264fccc56217e3f7a52618 Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Tue, 30 Jan 2024 12:28:39 +0100 Subject: [PATCH 02/33] [PWGLF] LightNucleiTask - Add analysis binning axis (#4516) --- PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx | 133 +++++++++++++------------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index 4e175c80de4..28d68db386e 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -89,6 +89,9 @@ struct LFNucleiBATask { // Set the axis used in this task ConfigurableAxis binsPercentile{"binsPercentile", {100, 0, 100}, "Centrality FT0M"}; ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0, 6.5, 7.0, 7.5, 8.0}, ""}; + ConfigurableAxis binsPtHe{"binsPtHe", {VARIABLE_WIDTH, 1.0, 1.25, 1.50, 1.75, 2.0, 2.25, 2.50, 2.75, 3.0, 3.25, 3.50, 3.75, 4.0, 4.50, 5.0, 6.0, 7.0, 8.0}, ""}; + ConfigurableAxis binsPtZHe{"binsPtZHe", {VARIABLE_WIDTH, 0.5, 0.625, 0.75, 0.875, 1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, 2.0, 2.25, 2.5, 3.0, 3.5, 4.0}, ""}; + ConfigurableAxis binsdEdx{"binsdEdx", {1000, 0.f, 1000.f}, ""}; ConfigurableAxis binsBeta{"binsBeta", {120, 0.0, 1.2}, ""}; ConfigurableAxis binsDCA{"binsDCA", {400, -1.f, 1.f}, ""}; @@ -171,6 +174,8 @@ struct LFNucleiBATask { { const AxisSpec pAxis{binsPt, "#it{p} (GeV/#it{c})"}; const AxisSpec ptAxis{binsPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec ptHeAxis{binsPtHe, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec ptZHeAxis{binsPtZHe, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec dedxAxis{binsdEdx, "d#it{E}/d#it{x} A.U."}; const AxisSpec betaAxis{binsBeta, "TOF #beta"}; const AxisSpec dcaxyAxis{binsDCA, "DCAxy (cm)"}; @@ -418,21 +423,21 @@ struct LFNucleiBATask { histos.add("tracks/triton/h1antiTritonSpectra", "#it{p}_{T} (#bar{t})", HistType::kTH1F, {ptAxis}); } if (enableHe) { - histos.add("tracks/helium/h1HeliumSpectra", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1antiHeliumSpectra", "#it{p}_{T} (#bar{He})", HistType::kTH1F, {ptAxis}); + histos.add("tracks/helium/h1HeliumSpectra", "#it{p}_{T} (He)", HistType::kTH1F, {ptZHeAxis}); + histos.add("tracks/helium/h1antiHeliumSpectra", "#it{p}_{T} (#bar{He})", HistType::kTH1F, {ptZHeAxis}); - histos.add("tracks/helium/h2HeliumYvsPt", "#it{y} vs #it{p}_{T} (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptAxis}}); - histos.add("tracks/helium/h2HeliumYvsPt_Z2", "#it{y} vs #it{p}_{T} (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptAxis}}); - histos.add("tracks/helium/h2HeliumEtavsPt", "#it{#eta} vs #it{p}_{T} (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptAxis}}); - histos.add("tracks/helium/h2HeliumEtavsPt_Z2", "#it{#eta} vs #it{p}_{T} (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptAxis}}); + histos.add("tracks/helium/h2HeliumYvsPt", "#it{y} vs #it{p}_{T} (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptZHeAxis}}); + histos.add("tracks/helium/h2HeliumYvsPt_Z2", "#it{y} vs #it{p}_{T} (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptHeAxis}}); + histos.add("tracks/helium/h2HeliumEtavsPt", "#it{#eta} vs #it{p}_{T} (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptZHeAxis}}); + histos.add("tracks/helium/h2HeliumEtavsPt_Z2", "#it{#eta} vs #it{p}_{T} (He)", HistType::kTH2F, {{96, -1.2, 1.2}, {ptHeAxis}}); - histos.add("tracks/helium/h1HeliumSpectra_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1antiHeliumSpectra_Z2", "#it{p}_{T} (#bar{He})", HistType::kTH1F, {ptAxis}); + histos.add("tracks/helium/h1HeliumSpectra_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + histos.add("tracks/helium/h1antiHeliumSpectra_Z2", "#it{p}_{T} (#bar{He})", HistType::kTH1F, {ptHeAxis}); - histos.add("tracks/helium/h2antiHeliumYvsPt", "#it{y} vs #it{p}_{T} (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptAxis}}); - histos.add("tracks/helium/h2antiHeliumYvsPt_Z2", "#it{y} vs #it{p}_{T} (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptAxis}}); - histos.add("tracks/helium/h2antiHeliumEtavsPt", "#it{#eta} vs #it{p}_{T} (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptAxis}}); - histos.add("tracks/helium/h2antiHeliumEtavsPt_Z2", "#it{#eta} vs #it{p}_{T} (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptAxis}}); + histos.add("tracks/helium/h2antiHeliumYvsPt", "#it{y} vs #it{p}_{T} (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptZHeAxis}}); + histos.add("tracks/helium/h2antiHeliumYvsPt_Z2", "#it{y} vs #it{p}_{T} (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptHeAxis}}); + histos.add("tracks/helium/h2antiHeliumEtavsPt", "#it{#eta} vs #it{p}_{T} (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptZHeAxis}}); + histos.add("tracks/helium/h2antiHeliumEtavsPt_Z2", "#it{#eta} vs #it{p}_{T} (#bar{He})", HistType::kTH2F, {{96, -1.2, 1.2}, {ptHeAxis}}); } if (enableAl) { histos.add("tracks/alpha/h1AlphaSpectra", "#it{p}_{T} (#alpha)", HistType::kTH1F, {ptAxis}); @@ -480,29 +485,29 @@ struct LFNucleiBATask { histos.add("tracks/triton/h1antiTritonSpectraTrueTransport", "#it{p}_{T} (#bar{t})", HistType::kTH1F, {ptAxis}); } if (enableHe) { - histos.add("tracks/helium/h1HeliumSpectraTrue", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1HeliumSpectraTrueWPID", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1HeliumSpectraTruePrim", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1HeliumSpectraTrueSec", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1HeliumSpectraTrueTransport", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - - histos.add("tracks/helium/h1HeliumSpectraTrue_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1HeliumSpectraTrueWPID_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1HeliumSpectraTruePrim_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1HeliumSpectraTrueSec_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1HeliumSpectraTrueTransport_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - - histos.add("tracks/helium/h1antiHeliumSpectraTrue", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1antiHeliumSpectraTrueWPID", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1antiHeliumSpectraTruePrim", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1antiHeliumSpectraTrueSec", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1antiHeliumSpectraTrueTransport", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - - histos.add("tracks/helium/h1antiHeliumSpectraTrue_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1antiHeliumSpectraTrueWPID_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1antiHeliumSpectraTruePrim_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1antiHeliumSpectraTrueSec_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); - histos.add("tracks/helium/h1antiHeliumSpectraTrueTransport_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptAxis}); + histos.add("tracks/helium/h1HeliumSpectraTrue", "#it{p}_{T} (He)", HistType::kTH1F, {ptZHeAxis}); + histos.add("tracks/helium/h1HeliumSpectraTrueWPID", "#it{p}_{T} (He)", HistType::kTH1F, {ptZHeAxis}); + histos.add("tracks/helium/h1HeliumSpectraTruePrim", "#it{p}_{T} (He)", HistType::kTH1F, {ptZHeAxis}); + histos.add("tracks/helium/h1HeliumSpectraTrueSec", "#it{p}_{T} (He)", HistType::kTH1F, {ptZHeAxis}); + histos.add("tracks/helium/h1HeliumSpectraTrueTransport", "#it{p}_{T} (He)", HistType::kTH1F, {ptZHeAxis}); + + histos.add("tracks/helium/h1HeliumSpectraTrue_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + histos.add("tracks/helium/h1HeliumSpectraTrueWPID_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + histos.add("tracks/helium/h1HeliumSpectraTruePrim_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + histos.add("tracks/helium/h1HeliumSpectraTrueSec_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + histos.add("tracks/helium/h1HeliumSpectraTrueTransport_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + + histos.add("tracks/helium/h1antiHeliumSpectraTrue", "#it{p}_{T} (He)", HistType::kTH1F, {ptZHeAxis}); + histos.add("tracks/helium/h1antiHeliumSpectraTrueWPID", "#it{p}_{T} (He)", HistType::kTH1F, {ptZHeAxis}); + histos.add("tracks/helium/h1antiHeliumSpectraTruePrim", "#it{p}_{T} (He)", HistType::kTH1F, {ptZHeAxis}); + histos.add("tracks/helium/h1antiHeliumSpectraTrueSec", "#it{p}_{T} (He)", HistType::kTH1F, {ptZHeAxis}); + histos.add("tracks/helium/h1antiHeliumSpectraTrueTransport", "#it{p}_{T} (He)", HistType::kTH1F, {ptZHeAxis}); + + histos.add("tracks/helium/h1antiHeliumSpectraTrue_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + histos.add("tracks/helium/h1antiHeliumSpectraTrueWPID_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + histos.add("tracks/helium/h1antiHeliumSpectraTruePrim_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + histos.add("tracks/helium/h1antiHeliumSpectraTrueSec_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); + histos.add("tracks/helium/h1antiHeliumSpectraTrueTransport_Z2", "#it{p}_{T} (He)", HistType::kTH1F, {ptHeAxis}); if (enablePtSpectra) { histos.add("tracks/eff/helium/hPtHeTrue", "Track #it{p}_{T} (He); #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{400, 0., 8.}}); histos.add("tracks/eff/helium/hPtantiHeTrue", "Track #it{p}_{T} (#bar{He}); #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{400, 0., 8.}}); @@ -881,8 +886,8 @@ struct LFNucleiBATask { histos.add("tracks/deuteron/h2antiDeuteronTPCExpSignalDiffVsPt", "TPC <-dE/dX> - Exp <-dE/dX> (#bar{d}) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TPC <-dE/dX> ExpDiff (#bar{d})", HistType::kTH2F, {{ptAxis}, {16000, -800, 800.}}); } if (enableHe) { - histos.add("tracks/helium/h2HeliumTPCExpSignalDiffVsPt", "TPC <-dE/dX> - Exp <-dE/dX> (He) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TPC <-dE/dX> ExpDiff (He)", HistType::kTH2F, {{ptAxis}, {16000, -800, 800.}}); - histos.add("tracks/helium/h2antiHeliumTPCExpSignalDiffVsPt", "TPC <-dE/dX> - Exp <-dE/dX> (#bar{He}) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TPC <-dE/dX> ExpDiff (#bar{He})", HistType::kTH2F, {{ptAxis}, {16000, -800, 800.}}); + histos.add("tracks/helium/h2HeliumTPCExpSignalDiffVsPt", "TPC <-dE/dX> - Exp <-dE/dX> (He) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TPC <-dE/dX> ExpDiff (He)", HistType::kTH2F, {{ptZHeAxis}, {16000, -800, 800.}}); + histos.add("tracks/helium/h2antiHeliumTPCExpSignalDiffVsPt", "TPC <-dE/dX> - Exp <-dE/dX> (#bar{He}) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TPC <-dE/dX> ExpDiff (#bar{He})", HistType::kTH2F, {{ptZHeAxis}, {16000, -800, 800.}}); } } @@ -910,8 +915,8 @@ struct LFNucleiBATask { histos.add("tracks/triton/h2antiTritonVspTNSigmaTPC", "NSigmaTPC(#bar{t}) vs pT; #it{p}_{T} (GeV/#it{c}); NSigmaTPC", HistType::kTH2F, {{ptAxis}, {SigmaTPCAxis}}); } if (enableHe) { - histos.add("tracks/helium/h2HeliumVspTNSigmaTPC", "NSigmaTPC(He) vs pT; #it{p}_{T} (GeV/#it{c}); NSigmaTPC", HistType::kTH2F, {{ptAxis}, {SigmaTPCAxis}}); - histos.add("tracks/helium/h2antiHeliumVspTNSigmaTPC", "NSigmaTPC(#bar{He}) vs pT; #it{p}_{T} (GeV/#it{c}); NSigmaTPC", HistType::kTH2F, {{ptAxis}, {SigmaTPCAxis}}); + histos.add("tracks/helium/h2HeliumVspTNSigmaTPC", "NSigmaTPC(He) vs pT/Z; #it{p}_{T}/Z (GeV/#it{c}); NSigmaTPC", HistType::kTH2F, {{ptZHeAxis}, {SigmaTPCAxis}}); + histos.add("tracks/helium/h2antiHeliumVspTNSigmaTPC", "NSigmaTPC(#bar{He}) vs pT/Z; #it{p}_{T}/Z (GeV/#it{c}); NSigmaTPC", HistType::kTH2F, {{ptZHeAxis}, {SigmaTPCAxis}}); } if (enableAl) { histos.add("tracks/alpha/h2AlphaVspTNSigmaTPC", "NSigmaTPC(#alpha) vs pT; #it{p}_{T} (GeV/#it{c}); NSigmaTPC", HistType::kTH2F, {{ptAxis}, {SigmaTPCAxis}}); @@ -991,10 +996,10 @@ struct LFNucleiBATask { histos.add("tracks/deuteron/h2antiDeuteronTOFExpSignalDiffVsPtCut", "TOF t - t_{exp}(#bar{d}) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TOF t - t_{exp} (#bar{d})", HistType::kTH2F, {{ptAxis}, {2000, -25000, 25000}}); } if (enableHe) { - histos.add("tracks/helium/h2HeliumTOFExpSignalDiffVsPt", "TOF t - t_{exp}(He) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TOF t - t_{exp} (He)", HistType::kTH2F, {{ptAxis}, {2000, -25000, 25000}}); - histos.add("tracks/helium/h2antiHeliumTOFExpSignalDiffVsPt", "TOF t - t_{exp}(#bar{He}) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TOF t - t_{exp} (#bar{He})", HistType::kTH2F, {{ptAxis}, {2000, -25000, 25000}}); - histos.add("tracks/helium/h2HeliumTOFExpSignalDiffVsPtCut", "TOF t - t_{exp}(He) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TOF t - t_{exp} (He)", HistType::kTH2F, {{ptAxis}, {2000, -25000, 25000}}); - histos.add("tracks/helium/h2antiHeliumTOFExpSignalDiffVsPtCut", "TOF t - t_{exp}(#bar{He}}) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TOF t - t_{exp} (#bar{He})", HistType::kTH2F, {{ptAxis}, {2000, -25000, 25000}}); + histos.add("tracks/helium/h2HeliumTOFExpSignalDiffVsPt", "TOF t - t_{exp}(He) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TOF t - t_{exp} (He)", HistType::kTH2F, {{ptZHeAxis}, {2000, -25000, 25000}}); + histos.add("tracks/helium/h2antiHeliumTOFExpSignalDiffVsPt", "TOF t - t_{exp}(#bar{He}) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TOF t - t_{exp} (#bar{He})", HistType::kTH2F, {{ptZHeAxis}, {2000, -25000, 25000}}); + histos.add("tracks/helium/h2HeliumTOFExpSignalDiffVsPtCut", "TOF t - t_{exp}(He) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TOF t - t_{exp} (He)", HistType::kTH2F, {{ptZHeAxis}, {2000, -25000, 25000}}); + histos.add("tracks/helium/h2antiHeliumTOFExpSignalDiffVsPtCut", "TOF t - t_{exp}(#bar{He}}) vs #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); TOF t - t_{exp} (#bar{He})", HistType::kTH2F, {{ptZHeAxis}, {2000, -25000, 25000}}); } } @@ -1010,8 +1015,8 @@ struct LFNucleiBATask { histos.add("tracks/deuteron/h2antiDeuteronVspTNSigmaTOF", "NSigmaTOF(#bar{d}) vs pT; #it{p}_{T} (GeV/#it{c}); NSigmaTOF", HistType::kTH2F, {{ptAxis}, {SigmaTOFAxis}}); } if (enableHe) { - histos.add("tracks/helium/h2HeliumVspTNSigmaTOF", "NSigmaTOF(He) vs pT; #it{p}_{T} (GeV/#it{c}); NSigmaTOF", HistType::kTH2F, {{ptAxis}, {SigmaTOFAxis}}); - histos.add("tracks/helium/h2antiHeliumVspTNSigmaTOF", "NSigmaTOF(#bar{He}) vs pT; #it{p}_{T} (GeV/#it{c}); NSigmaTOF", HistType::kTH2F, {{ptAxis}, {SigmaTOFAxis}}); + histos.add("tracks/helium/h2HeliumVspTNSigmaTOF", "NSigmaTOF(He) vs pT; #it{p}_{T} (GeV/#it{c}); NSigmaTOF", HistType::kTH2F, {{ptZHeAxis}, {SigmaTOFAxis}}); + histos.add("tracks/helium/h2antiHeliumVspTNSigmaTOF", "NSigmaTOF(#bar{He}) vs pT; #it{p}_{T} (GeV/#it{c}); NSigmaTOF", HistType::kTH2F, {{ptZHeAxis}, {SigmaTOFAxis}}); } if (enableDebug) { // NSigmaTPC vs NSigmaTOF histograms @@ -1051,11 +1056,11 @@ struct LFNucleiBATask { } } if (enableHe) { - histos.add("tracks/helium/h2TOFmassHeliumVsPt", "h2TOFmassHeliumVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{320, 0.4, 4.}, {250, 0., 5.}}); - histos.add("tracks/helium/h2TOFmassantiHeliumVsPt", "h2TOFmassantiHeliumVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{320, 0.4, 4.}, {250, 0., 5.}}); + histos.add("tracks/helium/h2TOFmassHeliumVsPt", "h2TOFmassHeliumVsPt; TOFmass; #it{p}_{T}/Z (GeV)", HistType::kTH2F, {{320, 0.4, 4.}, {ptZHeAxis}}); + histos.add("tracks/helium/h2TOFmassantiHeliumVsPt", "h2TOFmassantiHeliumVsPt; TOFmass; #it{p}_{T}/Z (GeV)", HistType::kTH2F, {{320, 0.4, 4.}, {ptZHeAxis}}); if (enableBetaCut) { - histos.add("tracks/helium/h2TOFmassHeliumVsPt_BetaCut", "h2TOFmassHeliumVsPt_BetaCut; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{320, 0.4, 4.}, {250, 0., 5.}}); - histos.add("tracks/helium/h2TOFmassantiHeliumVsPt_BetaCut", "h2TOFmassantiHeliumVsPt_BetaCut; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{320, 0.4, 4.}, {250, 0., 5.}}); + histos.add("tracks/helium/h2TOFmassHeliumVsPt_BetaCut", "h2TOFmassHeliumVsPt_BetaCut; TOFmass; #it{p}_{T}/Z (GeV)", HistType::kTH2F, {{320, 0.4, 4.}, {ptZHeAxis}}); + histos.add("tracks/helium/h2TOFmassantiHeliumVsPt_BetaCut", "h2TOFmassantiHeliumVsPt_BetaCut; TOFmass; #it{p}_{T}/Z (GeV)", HistType::kTH2F, {{320, 0.4, 4.}, {ptZHeAxis}}); } } // TOF mass squared histograms @@ -1089,13 +1094,13 @@ struct LFNucleiBATask { } } if (enableHe) { - histos.add("tracks/helium/h2TOFmass2antiHeliumVsPt", "#Delta M^{2} (#bar{He}) vs #it{p}_{T}; #Delta M^{2} (#bar{He}); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {250, 0., 5.}}); - histos.add("tracks/helium/h2TOFmass2HeliumVsPt", "#Delta M^{2} (He) vs #it{p}_{T}; #Delta M^{2} (He); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {250, 0., 5.}}); - histos.add("tracks/helium/h2TOFmassDeltaHeliumVsPt", "#Delta M (He) vs #it{p}_{T}; #Delta M (He); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {250, 0., 5.}}); - histos.add("tracks/helium/h2TOFmassDeltaantiHeliumVsPt", "#Delta M (#bar{He}) vs #it{p}_{T}; #Delta M (#bar{He}); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {250, 0., 5.}}); + histos.add("tracks/helium/h2TOFmass2antiHeliumVsPt", "#Delta M^{2} (#bar{He}) vs #it{p}_{T}; #Delta M^{2} (#bar{He}); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); + histos.add("tracks/helium/h2TOFmass2HeliumVsPt", "#Delta M^{2} (He) vs #it{p}_{T}; #Delta M^{2} (He); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); + histos.add("tracks/helium/h2TOFmassDeltaHeliumVsPt", "#Delta M (He) vs #it{p}_{T}; #Delta M (He); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); + histos.add("tracks/helium/h2TOFmassDeltaantiHeliumVsPt", "#Delta M (#bar{He}) vs #it{p}_{T}; #Delta M (#bar{He}); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); if (enableBetaCut) { - histos.add("tracks/helium/h2TOFmass2antiHeliumVsPt_BetaCut", "#Delta M^{2} (#bar{He}) vs #it{p}_{T}; #Delta M^{2} (#bar{He}); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {250, 0., 5.}}); - histos.add("tracks/helium/h2TOFmass2HeliumVsPt_BetaCut", "#Delta M^{2} (He) vs #it{p}_{T}; #Delta M^{2} (He); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {250, 0., 5.}}); + histos.add("tracks/helium/h2TOFmass2antiHeliumVsPt_BetaCut", "#Delta M^{2} (#bar{He}) vs #it{p}_{T}; #Delta M^{2} (#bar{He}); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); + histos.add("tracks/helium/h2TOFmass2HeliumVsPt_BetaCut", "#Delta M^{2} (He) vs #it{p}_{T}; #Delta M^{2} (He); #it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {{massHeAxis}, {ptZHeAxis}}); } } // TOF EvTime Splitting plots @@ -1396,15 +1401,15 @@ struct LFNucleiBATask { histos.add("spectraGen/triton/histSecTransportPtantiT", "generated particles", HistType::kTH1F, {ptAxis}); } if (enableHe) { - histos.add("spectraGen/helium/histGenPtHe", "generated particles", HistType::kTH1F, {ptAxis}); - histos.add("spectraGen/helium/histGenPtHePrim", "generated particles", HistType::kTH1F, {ptAxis}); - histos.add("spectraGen/helium/histGenPtHeSec", "generated particles", HistType::kTH1F, {ptAxis}); - histos.add("spectraGen/helium/histSecTransportPtHe", "generated particles", HistType::kTH1F, {ptAxis}); - - histos.add("spectraGen/helium/histGenPtantiHe", "generated particles", HistType::kTH1F, {ptAxis}); - histos.add("spectraGen/helium/histGenPtantiHePrim", "generated particles", HistType::kTH1F, {ptAxis}); - histos.add("spectraGen/helium/histGenPtantiHeSec", "generated particles", HistType::kTH1F, {ptAxis}); - histos.add("spectraGen/helium/histSecTransportPtantiHe", "generated particles", HistType::kTH1F, {ptAxis}); + histos.add("spectraGen/helium/histGenPtHe", "generated particles", HistType::kTH1F, {ptHeAxis}); + histos.add("spectraGen/helium/histGenPtHePrim", "generated particles", HistType::kTH1F, {ptHeAxis}); + histos.add("spectraGen/helium/histGenPtHeSec", "generated particles", HistType::kTH1F, {ptHeAxis}); + histos.add("spectraGen/helium/histSecTransportPtHe", "generated particles", HistType::kTH1F, {ptHeAxis}); + + histos.add("spectraGen/helium/histGenPtantiHe", "generated particles", HistType::kTH1F, {ptHeAxis}); + histos.add("spectraGen/helium/histGenPtantiHePrim", "generated particles", HistType::kTH1F, {ptHeAxis}); + histos.add("spectraGen/helium/histGenPtantiHeSec", "generated particles", HistType::kTH1F, {ptHeAxis}); + histos.add("spectraGen/helium/histSecTransportPtantiHe", "generated particles", HistType::kTH1F, {ptHeAxis}); } if (enableAl) { histos.add("spectraGen/alpha/histGenPtAl", "generated particles", HistType::kTH1F, {ptAxis}); From 853befbf2b19f121a9bc17bd076e1c2a0235d8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 30 Jan 2024 15:39:36 +0100 Subject: [PATCH 03/33] LF: Update ME K0s (#4519) --- PWGLF/Tasks/Strangeness/k0_mixed_events.cxx | 29 ++++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx b/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx index 7a532499312..708a0b3981b 100644 --- a/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx +++ b/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx @@ -54,15 +54,24 @@ class ResoPair : public MyFemtoPair ResoPair() {} ResoPair(trkType const& first, trkType const& second) : MyFemtoPair(first, second) { - lDecayDaughter1.SetPtEtaPhiM(first->pt(), first->eta(), first->phi(), particle_mass(GetPDG1())); - lDecayDaughter2.SetPtEtaPhiM(second->pt(), second->eta(), second->phi(), particle_mass(GetPDG2())); - lResonance = lDecayDaughter1 + lDecayDaughter2; + SetPair(first, second); }; ResoPair(trkType const& first, trkType const& second, const bool& isidentical) : MyFemtoPair(first, second, isidentical){}; bool IsClosePair() const { return MyFemtoPair::IsClosePair(_deta, _dphi, _radius); } void SetEtaDiff(const float deta) { _deta = deta; } void SetPhiStarDiff(const float dphi) { _dphi = dphi; } - float GetInvMass() const { return lResonance.M(); } + void SetPair(trkType const& first, trkType const& second) + { + MyFemtoPair::SetPair(first, second); + lDecayDaughter1.SetPtEtaPhiM(first->pt(), first->eta(), first->phi(), particle_mass(GetPDG1())); + lDecayDaughter2.SetPtEtaPhiM(second->pt(), second->eta(), second->phi(), particle_mass(GetPDG2())); + lResonance = lDecayDaughter1 + lDecayDaughter2; + } + float GetInvMass() const + { + // LOG(info) << "Mass = " << lResonance.M() << " 1 " << lDecayDaughter1.M() << " 2 " << lDecayDaughter2.M(); + return lResonance.M(); + } float GetPt() const { return lResonance.Pt(); } float GetRapidity() const { return lResonance.Rapidity(); } @@ -161,7 +170,7 @@ struct K0MixedEvents { void init(o2::framework::InitContext&) { IsIdentical = (_sign_1 * _particlePDG_1 == _sign_2 * _particlePDG_2); - LOG(info) << "IsIdentical = " << IsIdentical << " sign1 " << _sign_1 << " Pdg1 " << _particlePDG_1 << " Pdg2 " << _particlePDG_2 << " sign2 " << _sign_2; + LOG(info) << "IsIdentical=" << IsIdentical << "; sign1=" << _sign_1 << "; Pdg1=" << _particlePDG_1 << "; total1=" << _sign_1 * _particlePDG_1 << " -- Pdg2=" << _particlePDG_2 << "; sign2=" << _sign_2 << "; total2=" << _sign_2 * _particlePDG_2; Pair->SetIdentical(IsIdentical); Pair->SetPDG1(_particlePDG_1); @@ -173,7 +182,7 @@ struct K0MixedEvents { TPCcuts_2 = std::make_pair(_particlePDG_2, _tpcNSigma_2); TOFcuts_2 = std::make_pair(_particlePDG_2, _tofNSigma_2); - const AxisSpec kStarAxis{CFkStarBinning, "Inv. mass (GeV/c^{2})"}; + const AxisSpec invMassAxis{CFkStarBinning, "Inv. mass (GeV/c^{2})"}; const AxisSpec ptAxis{ptBinning, "#it{p}_{T} (GeV/c)"}; const AxisSpec dcaXyAxis{dcaXyBinning, "DCA_{xy} (cm)"}; @@ -181,10 +190,10 @@ struct K0MixedEvents { registry.add("VTXc", "VTXc", kTH1F, {{100, -20., 20., "vtx"}}); registry.add("VTX", "VTX", kTH1F, {{100, -20., 20., "vtx"}}); registry.add("SEcand", "SEcand", kTH1F, {{2, 0.5, 2.5}}); - registry.add("SE", "SE", kTH1F, {kStarAxis}); - registry.add("ME", "ME", kTH1F, {kStarAxis}); - registry.add("SEvsPt", "SEvsPt", kTH2D, {kStarAxis, ptAxis}); - registry.add("MEvsPt", "MEvsPt", kTH2D, {kStarAxis, ptAxis}); + registry.add("SE", "SE", kTH1F, {invMassAxis}); + registry.add("ME", "ME", kTH1F, {invMassAxis}); + registry.add("SEvsPt", "SEvsPt", kTH2D, {invMassAxis, ptAxis}); + registry.add("MEvsPt", "MEvsPt", kTH2D, {invMassAxis, ptAxis}); registry.add("eta", Form("eta_%i", (int)_particlePDG_1), kTH2F, {ptAxis, {100, -10., 10., "#eta"}}); registry.add("p_first", Form("p_%i", (int)_particlePDG_1), kTH1F, {ptAxis}); registry.add("dcaXY_first", Form("dca_%i", (int)_particlePDG_1), kTH2F, {ptAxis, dcaXyAxis}); From 26d50af9511f2b1d296aae54b19c2b893d8d1082 Mon Sep 17 00:00:00 2001 From: Nazar Burmasov Date: Tue, 30 Jan 2024 17:45:17 +0300 Subject: [PATCH 04/33] Fix typo in TCE trigger luminosity (#4486) --- Common/TableProducer/eventSelection.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/TableProducer/eventSelection.cxx b/Common/TableProducer/eventSelection.cxx index 2141c065768..eedcc8db1bd 100644 --- a/Common/TableProducer/eventSelection.cxx +++ b/Common/TableProducer/eventSelection.cxx @@ -308,10 +308,10 @@ struct BcSelectionTask { float csZEM = isPP ? -1. : 415.2e6; float csZNC = isPP ? -1. : 214.5e6; if (run > 543437 && run < 543514) { - csTCE = 8.3; + csTCE = 8.3e6; } if (run >= 543514) { - csTCE = 3.97; + csTCE = 3.97e6; } // Fill TVX (T0 vertex) counters From 17438edefa6b1946ddd268d4022a4c02d93432b3 Mon Sep 17 00:00:00 2001 From: Nazar Burmasov Date: Tue, 30 Jan 2024 17:50:41 +0300 Subject: [PATCH 05/33] Adding reduced ZDC info to UPCCandidateProducer (#4518) --- PWGUD/DataModel/UDTables.h | 18 ++++- PWGUD/TableProducer/UPCCandidateProducer.cxx | 85 +++++++++++++++++--- 2 files changed, 90 insertions(+), 13 deletions(-) diff --git a/PWGUD/DataModel/UDTables.h b/PWGUD/DataModel/UDTables.h index 9c688ba5416..1f3d5a7db98 100644 --- a/PWGUD/DataModel/UDTables.h +++ b/PWGUD/DataModel/UDTables.h @@ -190,7 +190,8 @@ DECLARE_SOA_TABLE(UDCollisionsSels, "AOD", "UDCOLLISIONSEL", DECLARE_SOA_TABLE(UDCollisionsSelsCent, "AOD", "UDCOLSELCNT", udcollision::DBcTOR, udcollision::DBcTSC, - udcollision::DBcTVX); + udcollision::DBcTVX, + udcollision::DBcV0A); // forward-specific selections DECLARE_SOA_TABLE(UDCollisionsSelsFwd, "AOD", "UDCOLSELFWD", @@ -412,6 +413,11 @@ DECLARE_SOA_COLUMN(ChannelE, channelE, std::vector); //! Channel IDs wh DECLARE_SOA_COLUMN(Amplitude, amplitude, std::vector); //! Amplitudes of non-zero channels. The channel IDs are given in ChannelT (at the same index) DECLARE_SOA_COLUMN(Time, time, std::vector); //! Times of non-zero channels. The channel IDs are given in ChannelT (at the same index) DECLARE_SOA_COLUMN(ChannelT, channelT, std::vector); //! Channel IDs which had non-zero amplitudes. There are at maximum 26 channels. + +DECLARE_SOA_COLUMN(TimeZNA, timeZNA, float); +DECLARE_SOA_COLUMN(TimeZNC, timeZNC, float); +DECLARE_SOA_COLUMN(EnergyCommonZNA, energyCommonZNA, float); +DECLARE_SOA_COLUMN(EnergyCommonZNC, energyCommonZNC, float); } // namespace udzdc DECLARE_SOA_TABLE(UDZdcs, "AOD", "UDZDC", //! ZDC information @@ -446,6 +452,16 @@ DECLARE_SOA_TABLE(UDZdcs, "AOD", "UDZDC", //! ZDC information using UDZdc = UDZdcs::iterator; +// reduced ZDC table +DECLARE_SOA_TABLE(UDZdcsReduced, "AOD", "UDZDCREDUCE", + udzdc::UDCollisionId, + udzdc::TimeZNA, + udzdc::TimeZNC, + udzdc::EnergyCommonZNA, + udzdc::EnergyCommonZNC); + +using UDZdcReduced = UDZdcsReduced::iterator; + } // namespace o2::aod #endif // PWGUD_DATAMODEL_UDTABLES_H_ diff --git a/PWGUD/TableProducer/UPCCandidateProducer.cxx b/PWGUD/TableProducer/UPCCandidateProducer.cxx index 37771672862..ff81786fc3f 100644 --- a/PWGUD/TableProducer/UPCCandidateProducer.cxx +++ b/PWGUD/TableProducer/UPCCandidateProducer.cxx @@ -48,6 +48,8 @@ struct UpcCandProducer { Produces eventCandidatesSelsCent; Produces eventCandidatesSelsFwd; + Produces udZdcsReduced; + std::vector fwdSelectors; std::vector barrelSelectors; @@ -693,6 +695,7 @@ struct UpcCandProducer { o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, o2::aod::FV0As const& fv0as, + o2::aod::Zdcs const& zdcs, const o2::aod::McTrackLabels* mcBarrelTrackLabels) { // pairs of global BCs and vectors of matched track IDs: @@ -722,7 +725,7 @@ struct UpcCandProducer { std::map mapGlobalBcWithTOR{}; std::map mapGlobalBcWithTVX{}; std::map mapGlobalBcWithTSC{}; - for (auto ft0 : ft0s) { + for (const auto& ft0 : ft0s) { uint64_t globalBC = ft0.bc_as().globalBC(); int32_t globalIndex = ft0.globalIndex(); if (!(std::abs(ft0.timeA()) > 2.f && std::abs(ft0.timeC()) > 2.f)) @@ -741,17 +744,26 @@ struct UpcCandProducer { } std::map mapGlobalBcWithV0A{}; - for (auto fv0a : fv0as) { + for (const auto& fv0a : fv0as) { if (std::abs(fv0a.time()) > 15.f) continue; uint64_t globalBC = fv0a.bc_as().globalBC(); mapGlobalBcWithV0A[globalBC] = fv0a.globalIndex(); } + std::map mapGlobalBcWithZdc{}; + for (const auto& zdc : zdcs) { + if (std::abs(zdc.timeZNA()) > 2.f && std::abs(zdc.timeZNC()) > 2.f) + continue; + auto globalBC = zdc.bc_as().globalBC(); + mapGlobalBcWithZdc[globalBC] = zdc.globalIndex(); + } + auto nTORs = mapGlobalBcWithTOR.size(); auto nTSCs = mapGlobalBcWithTSC.size(); auto nTVXs = mapGlobalBcWithTVX.size(); auto nFV0As = mapGlobalBcWithV0A.size(); + auto nZdcs = mapGlobalBcWithZdc.size(); auto nBcsWithITSTPC = bcsMatchedTrIdsITSTPC.size(); // todo: calculate position of UD collision? @@ -845,6 +857,17 @@ struct UpcCandProducer { upchelpers::FITInfo fitInfo{}; if (!updateFitInfo(globalBC, fitInfo)) continue; + if (nZdcs > 0) { + auto itZDC = mapGlobalBcWithZdc.find(globalBC); + if (itZDC != mapGlobalBcWithZdc.end()) { + const auto& zdc = zdcs.iteratorAt(itZDC->second); + float timeZNA = zdc.timeZNA(); + float timeZNC = zdc.timeZNC(); + float eComZNA = zdc.energyCommonZNA(); + float eComZNC = zdc.energyCommonZNC(); + udZdcsReduced(candID, timeZNA, timeZNC, eComZNA, eComZNC); + } + } uint16_t numContrib = fNBarProngs; int8_t netCharge = 0; float RgtrwTOF = 0.; @@ -867,7 +890,8 @@ struct UpcCandProducer { fitInfo.BBFDDApf, fitInfo.BBFDDCpf, fitInfo.BGFDDApf, fitInfo.BGFDDCpf); eventCandidatesSelsCent(fitInfo.distClosestBcTOR, fitInfo.distClosestBcTSC, - fitInfo.distClosestBcTVX); + fitInfo.distClosestBcTVX, + fitInfo.distClosestBcV0A); candID++; } @@ -898,6 +922,17 @@ struct UpcCandProducer { upchelpers::FITInfo fitInfo{}; if (!updateFitInfo(globalBC, fitInfo)) continue; + if (nZdcs > 0) { + auto itZDC = mapGlobalBcWithZdc.find(globalBC); + if (itZDC != mapGlobalBcWithZdc.end()) { + const auto& zdc = zdcs.iteratorAt(itZDC->second); + float timeZNA = zdc.timeZNA(); + float timeZNC = zdc.timeZNC(); + float eComZNA = zdc.energyCommonZNA(); + float eComZNC = zdc.energyCommonZNC(); + udZdcsReduced(candID, timeZNA, timeZNC, eComZNA, eComZNC); + } + } uint16_t numContrib = fNBarProngs; int8_t netCharge = 0; float RgtrwTOF = 0.; @@ -920,7 +955,8 @@ struct UpcCandProducer { fitInfo.BBFDDApf, fitInfo.BBFDDCpf, fitInfo.BGFDDApf, fitInfo.BGFDDCpf); eventCandidatesSelsCent(fitInfo.distClosestBcTOR, fitInfo.distClosestBcTSC, - fitInfo.distClosestBcTVX); + fitInfo.distClosestBcTVX, + fitInfo.distClosestBcV0A); barrelTrackIDs.clear(); candID++; } @@ -1141,6 +1177,7 @@ struct UpcCandProducer { o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, o2::aod::FV0As const& fv0as, + o2::aod::Zdcs const& zdcs, const o2::aod::McFwdTrackLabels* mcFwdTrackLabels) { // pairs of global BCs and vectors of matched track IDs: @@ -1190,8 +1227,17 @@ struct UpcCandProducer { mapGlobalBcWithV0A[globalBC] = fv0a.globalIndex(); } + std::map mapGlobalBcWithZdc{}; + for (const auto& zdc : zdcs) { + if (std::abs(zdc.timeZNA()) > 2.f && std::abs(zdc.timeZNC()) > 2.f) + continue; + auto globalBC = zdc.bc_as().globalBC(); + mapGlobalBcWithZdc[globalBC] = zdc.globalIndex(); + } + auto nFT0s = mapGlobalBcWithT0A.size(); auto nFV0As = mapGlobalBcWithV0A.size(); + auto nZdcs = mapGlobalBcWithZdc.size(); auto nBcsWithMCH = bcsMatchedTrIdsMCH.size(); // todo: calculate position of UD collision? @@ -1241,7 +1287,7 @@ struct UpcCandProducer { if (nFT0s > 0) { uint64_t closestBcT0A = findClosestBC(globalBC, mapGlobalBcWithT0A); int64_t distClosestBcT0A = globalBC - static_cast(closestBcT0A); - if (std::abs(distClosestBcT0A) < fFilterFT0) + if (std::abs(distClosestBcT0A) <= fFilterFT0) continue; fitInfo.distClosestBcT0A = distClosestBcT0A; auto ft0Id = mapGlobalBcWithT0A.at(closestBcT0A); @@ -1257,7 +1303,7 @@ struct UpcCandProducer { if (nFV0As > 0) { uint64_t closestBcV0A = findClosestBC(globalBC, mapGlobalBcWithV0A); int64_t distClosestBcV0A = globalBC - static_cast(closestBcV0A); - if (std::abs(distClosestBcV0A) < fFilterFV0) + if (std::abs(distClosestBcV0A) <= fFilterFV0) continue; fitInfo.distClosestBcV0A = distClosestBcV0A; auto fv0aId = mapGlobalBcWithV0A.at(closestBcV0A); @@ -1267,6 +1313,17 @@ struct UpcCandProducer { fitInfo.ampFV0A = std::accumulate(v0Amps.begin(), v0Amps.end(), 0.f); fillAmplitudes(fv0as, mapGlobalBcWithV0A, amplitudesV0A, relBCsV0A, globalBC); } + if (nZdcs > 0) { + auto itZDC = mapGlobalBcWithZdc.find(globalBC); + if (itZDC != mapGlobalBcWithZdc.end()) { + const auto& zdc = zdcs.iteratorAt(itZDC->second); + float timeZNA = zdc.timeZNA(); + float timeZNC = zdc.timeZNC(); + float eComZNA = zdc.energyCommonZNA(); + float eComZNC = zdc.energyCommonZNC(); + udZdcsReduced(candID, timeZNA, timeZNC, eComZNA, eComZNC); + } + } uint16_t numContrib = fNFwdProngs; int8_t netCharge = 0; float RgtrwTOF = 0.; @@ -1331,12 +1388,13 @@ struct UpcCandProducer { o2::aod::Collisions const& collisions, o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, - o2::aod::FV0As const& fv0as) + o2::aod::FV0As const& fv0as, + o2::aod::Zdcs const& zdcs) { fDoMC = false; createCandidatesCentral(barrelTracks, ambBarrelTracks, bcs, collisions, - ft0s, fdds, fv0as, + ft0s, fdds, fv0as, zdcs, (o2::aod::McTrackLabels*)nullptr); } @@ -1376,6 +1434,7 @@ struct UpcCandProducer { o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, o2::aod::FV0As const& fv0as, + o2::aod::Zdcs const& zdcs, o2::aod::McCollisions const& mcCollisions, o2::aod::McParticles const& mcParticles, o2::aod::McTrackLabels const& mcBarrelTrackLabels) { @@ -1383,7 +1442,7 @@ struct UpcCandProducer { skimMCInfo(mcCollisions, mcParticles, bcs); createCandidatesCentral(barrelTracks, ambBarrelTracks, bcs, collisions, - ft0s, fdds, fv0as, + ft0s, fdds, fv0as, zdcs, &mcBarrelTrackLabels); fNewPartIDs.clear(); } @@ -1396,12 +1455,13 @@ struct UpcCandProducer { o2::aod::Collisions const& collisions, o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, - o2::aod::FV0As const& fv0as) + o2::aod::FV0As const& fv0as, + o2::aod::Zdcs const& zdcs) { fDoMC = false; createCandidatesFwd(fwdTracks, ambFwdTracks, bcs, collisions, - ft0s, fdds, fv0as, + ft0s, fdds, fv0as, zdcs, (o2::aod::McFwdTrackLabels*)nullptr); } @@ -1412,6 +1472,7 @@ struct UpcCandProducer { o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, o2::aod::FV0As const& fv0as, + o2::aod::Zdcs const& zdcs, o2::aod::McCollisions const& mcCollisions, o2::aod::McParticles const& mcParticles, o2::aod::McFwdTrackLabels const& mcFwdTrackLabels) { @@ -1419,7 +1480,7 @@ struct UpcCandProducer { skimMCInfo(mcCollisions, mcParticles, bcs); createCandidatesFwd(fwdTracks, ambFwdTracks, bcs, collisions, - ft0s, fdds, fv0as, + ft0s, fdds, fv0as, zdcs, &mcFwdTrackLabels); } From f64af44dd7a98be8782a9dda39e86b5731c0483d Mon Sep 17 00:00:00 2001 From: Sigurd Nese <32108009+sigurdnese@users.noreply.github.com> Date: Tue, 30 Jan 2024 16:53:09 +0100 Subject: [PATCH 06/33] PWGDQ: Add track cut on hasTOF (#4520) --- PWGDQ/Core/CutsLibrary.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PWGDQ/Core/CutsLibrary.cxx b/PWGDQ/Core/CutsLibrary.cxx index 2e20789d91d..3622f2b052d 100644 --- a/PWGDQ/Core/CutsLibrary.cxx +++ b/PWGDQ/Core/CutsLibrary.cxx @@ -420,6 +420,11 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) return cut; } + if (!nameStr.compare("hasTOF")) { + cut->AddCut(GetAnalysisCut("hasTOF")); + return cut; + } + if (!nameStr.compare("PIDCalib")) { cut->AddCut(GetAnalysisCut("PIDStandardKine")); // standard kine cuts usually are applied via Filter in the task cut->AddCut(GetAnalysisCut("electronStandardQuality")); @@ -2963,6 +2968,11 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("hasTOF")) { + cut->AddCut(VarManager::kHasTOF, 0.5, 1.5); + return cut; + } + // ----------------------------------------------------- // V0 and Dalitz legs selections From c27ca9bb2837fc0104f348804289d9e33ac2e130 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Tue, 30 Jan 2024 19:11:26 +0100 Subject: [PATCH 07/33] PWGHF: optimise HF combinatorial (#4513) * PWGHF: properly define filters and partitions to speedup HF combinatorial * Please consider the following formatting changes * Apply the same for V0s and cascades and remove cut on max pT for soft pi * Factorise loop for 3 prongs and for D* * Please consider the following formatting changes --------- Co-authored-by: ALICE Action Bot --- .../DataModel/CandidateReconstructionTables.h | 8 +- PWGHF/TableProducer/trackIndexSkimCreator.cxx | 286 +++++++++--------- 2 files changed, 145 insertions(+), 149 deletions(-) diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 38cd029e209..873347ac0ec 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -152,13 +152,15 @@ DECLARE_SOA_TABLE(HfSelCollision, "AOD", "HFSELCOLLISION", //! namespace hf_sel_track { -DECLARE_SOA_COLUMN(IsSelProng, isSelProng, int); //! -DECLARE_SOA_COLUMN(IsProton, isProton, int8_t); //! +DECLARE_SOA_COLUMN(IsSelProng, isSelProng, uint32_t); //! +DECLARE_SOA_COLUMN(IsProton, isProton, int8_t); //! +DECLARE_SOA_COLUMN(IsPositive, isPositive, bool); //! } // namespace hf_sel_track DECLARE_SOA_TABLE(HfSelTrack, "AOD", "HFSELTRACK", //! hf_sel_track::IsSelProng, - hf_sel_track::IsProton); + hf_sel_track::IsProton, + hf_sel_track::IsPositive); namespace hf_pv_refit_track { diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 4fa5c5cb068..7c9c425e724 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -380,7 +380,6 @@ struct HfTrackIndexSkimCreatorTagSelTracks { Configurable useIsQualityTrackITSForBachLfCasc{"useIsQualityTrackITSForBachLfCasc", true, "check isQualityTrackITS status for bachelor in cascade + bachelor decays"}; // soft pion cuts for D* Configurable ptMinSoftPionForDstar{"ptMinSoftPionForDstar", 0.05, "min. track pT for soft pion in D* candidate"}; - Configurable ptMaxSoftPionForDstar{"ptMaxSoftPionForDstar", 2., "max. track pT for soft pion in D* candidate"}; Configurable etaMinSoftPionForDstar{"etaMinSoftPionForDstar", -99999., "min. pseudorapidity for soft pion in D* candidate"}; Configurable etaMaxSoftPionForDstar{"etaMaxSoftPionForDstar", 0.8, "max. pseudorapidity for soft pion in D* candidate"}; Configurable> cutsTrackDstar{"cutsTrackDstar", {hf_cuts_single_track::cutsTrackPrimary[0], hf_cuts_single_track::nBinsPtTrack, hf_cuts_single_track::nCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections per pT bin for the soft pion of D* candidates"}; @@ -619,7 +618,7 @@ struct HfTrackIndexSkimCreatorTagSelTracks { registry.fill(HIST("hRejTracks"), (nCuts + 1) * CandidateType::CandV0bachelor + iCut); } } - if (trackPt < ptMinSoftPionForDstar || trackPt > ptMaxSoftPionForDstar) { + if (trackPt < ptMinSoftPionForDstar) { CLRBIT(statusProng, CandidateType::CandDstar); if (fillHistograms) { registry.fill(HIST("hRejTracks"), (nCuts + 1) * CandidateType::CandDstar + iCut); @@ -1073,7 +1072,8 @@ struct HfTrackIndexSkimCreatorTagSelTracks { isSelectedTrack(track, trackPt, trackEta, pvRefitDcaXYDcaZ, statusProng); int8_t isProton = isSelectedProton(track); - rowSelectedTrack(statusProng, isProton); + bool isPositive = track.sign() > 0; + rowSelectedTrack(statusProng, isProton, isPositive); } } @@ -1264,6 +1264,8 @@ struct HfTrackIndexSkimCreatorTagSelTracks { /// Pre-selection of 2-prong and 3-prong secondary vertices struct HfTrackIndexSkimCreator { + SliceCache cache; + Produces rowTrackIndexProng2; Produces rowProng2CutStatus; Produces rowProng2PVrefit; @@ -1369,12 +1371,14 @@ struct HfTrackIndexSkimCreator { Preslice tracksPerCollision = aod::track::collisionId; // needed for PV refit // filter track indices - Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng > 0); + Filter filterSelectTrackIds = ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand2Prong))) != 0u) || ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand3Prong))) != 0u) || ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandDstar))) != 0u); Preslice trackIndicesPerCollision = aod::track_association::collisionId; - // FIXME - // Partition tracksPos = aod::track::signed1Pt > 0.f; - // Partition tracksNeg = aod::track::signed1Pt < 0.f; + // define partitions + Partition positiveFor2And3Prongs = aod::hf_sel_track::isPositive == true && (((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand2Prong))) != 0u) || ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand3Prong))) != 0u)); + Partition negativeFor2And3Prongs = aod::hf_sel_track::isPositive == false && (((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand2Prong))) != 0u) || ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand3Prong))) != 0u)); + Partition positiveSoftPions = aod::hf_sel_track::isPositive == true && ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandDstar))) != 0u); + Partition negativeSoftPions = aod::hf_sel_track::isPositive == false && ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandDstar))) != 0u); // QA of PV refit ConfigurableAxis axisPvRefitDeltaX{"axisPvRefitDeltaX", {1000, -0.5f, 0.5f}, "DeltaX binning PV refit"}; @@ -1493,9 +1497,10 @@ struct HfTrackIndexSkimCreator { /// \param dcaTrack1 is the dcaXY of the second daughter track /// \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 ia s bitmap with selection outcome + /// \param isSelected is a bitmap with selection outcome + /// \param pt2Prong is the pt of the 2-prong candidate template - void is2ProngPreselected(T1 const& pVecTrack0, T1 const& pVecTrack1, T2 const& dcaTrack0, T2 const& dcaTrack1, T3& cutStatus, T4& whichHypo, int& isSelected) + void is2ProngPreselected(T1 const& pVecTrack0, T1 const& pVecTrack1, T2 const& dcaTrack0, T2 const& dcaTrack1, T3& cutStatus, T4& whichHypo, int& isSelected, float& pt2Prong) { /// 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; @@ -1514,8 +1519,17 @@ struct HfTrackIndexSkimCreator { }; cacheIndices(cut2Prong, massMinIndex, massMaxIndex, d0d0Index); + int deltaMassD0Index; + static auto cacheIndicesForDstar = [](LabeledArray& cutDstar, int& deltaMassD0Idx) { + deltaMassD0Idx = cutDstar.colmap.find("deltaMassD0")->second; + return true; + }; + cacheIndicesForDstar(cutsDstarToD0Pi.value, deltaMassD0Index); + whichHypo[kN2ProngDecays] = 0; // D0 for D* + auto arrMom = std::array{pVecTrack0, pVecTrack1}; - auto pT = RecoDecay::pt(pVecTrack0, pVecTrack1) + ptTolerance; // add tolerance because of no reco decay vertex + pt2Prong = RecoDecay::pt(pVecTrack0, pVecTrack1); + auto pT = pt2Prong + ptTolerance; // add tolerance because of no reco decay vertex for (int iDecay2P = 0; iDecay2P < kN2ProngDecays; iDecay2P++) { @@ -1531,7 +1545,7 @@ struct HfTrackIndexSkimCreator { } // invariant mass - double massHypos[2]; + double massHypos[2] = {0.f, 0.f}; whichHypo[iDecay2P] = 3; double min2 = pow(cut2Prong[iDecay2P].get(pTBin, massMinIndex[iDecay2P]), 2); double max2 = pow(cut2Prong[iDecay2P].get(pTBin, massMaxIndex[iDecay2P]), 2); @@ -1563,6 +1577,22 @@ struct HfTrackIndexSkimCreator { } } } + + // additional check for D0 to be used in D* finding + if (iDecay2P == hf_cand_2prong::DecayType::D0ToPiK && doDstar && TESTBIT(isSelected, iDecay2P)) { + auto pTBinDstar = findBin(binsPtDstarToD0Pi, pT * 1.2); // assuming the D* pT about 20% higher than the one of the D0 to be safe + if (pTBinDstar >= 0) { + whichHypo[kN2ProngDecays] = whichHypo[hf_cand_2prong::DecayType::D0ToPiK]; + double deltaMass = cutsDstarToD0Pi->get(pTBinDstar, deltaMassD0Index); + + if (TESTBIT(whichHypo[iDecay2P], 0) && (massHypos[0] > (massDzero + deltaMass) * (massDzero + deltaMass) || massHypos[0] < (massDzero - deltaMass) * (massDzero - deltaMass))) { + CLRBIT(whichHypo[kN2ProngDecays], 0); + } + if (TESTBIT(whichHypo[iDecay2P], 1) && (massHypos[1] > (massDzero + deltaMass) * (massDzero + deltaMass) || massHypos[1] < (massDzero - deltaMass) * (massDzero - deltaMass))) { + CLRBIT(whichHypo[kN2ProngDecays], 1); + } + } + } } } @@ -2072,7 +2102,7 @@ struct HfTrackIndexSkimCreator { cutStatus3Prong[iDecay3P] = std::vector(kNCuts3Prong[iDecay3P], true); } - int whichHypo2Prong[kN2ProngDecays]; + int whichHypo2Prong[kN2ProngDecays + 1]; // we also put D0 for D* in the last slot int whichHypo3Prong[kN3ProngDecays]; // set the magnetic field from CCDB @@ -2110,28 +2140,18 @@ struct HfTrackIndexSkimCreator { // return; //} - // first loop over positive tracks - // for (auto trackPos1 = tracksPos.begin(); trackPos1 != tracksPos.end(); ++trackPos1) { - auto thisCollId = collision.globalIndex(); - auto groupedTrackIndices = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + + // first loop over positive tracks + auto groupedTrackIndicesPos1 = positiveFor2And3Prongs->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); int lastFilledD0 = -1; // index to be filled in table for D* mesons - int counterTrackPos1{0}; - for (auto trackIndexPos1 = groupedTrackIndices.begin(); trackIndexPos1 != groupedTrackIndices.end(); ++trackIndexPos1) { - counterTrackPos1++; + for (auto trackIndexPos1 = groupedTrackIndicesPos1.begin(); trackIndexPos1 != groupedTrackIndicesPos1.end(); ++trackIndexPos1) { auto trackPos1 = trackIndexPos1.template track_as(); - if (trackPos1.signed1Pt() < 0) { - continue; - } - // retrieve the selection flag that corresponds to this collision auto isSelProngPos1 = trackIndexPos1.isSelProng(); bool sel2ProngStatusPos = TESTBIT(isSelProngPos1, CandidateType::Cand2Prong); bool sel3ProngStatusPos1 = TESTBIT(isSelProngPos1, CandidateType::Cand3Prong); - if (!sel2ProngStatusPos && !sel3ProngStatusPos1) { - continue; - } auto trackParVarPos1 = getTrackParCov(trackPos1); std::array pVecTrackPos1{trackPos1.px(), trackPos1.py(), trackPos1.pz()}; @@ -2142,22 +2162,14 @@ struct HfTrackIndexSkimCreator { } // first loop over negative tracks - // for (auto trackNeg1 = tracksNeg.begin(); trackNeg1 != tracksNeg.end(); ++trackNeg1) { - int counterTrackNeg1{0}; - for (auto trackIndexNeg1 = groupedTrackIndices.begin(); trackIndexNeg1 != groupedTrackIndices.end(); ++trackIndexNeg1) { - counterTrackNeg1++; + auto groupedTrackIndicesNeg1 = negativeFor2And3Prongs->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + for (auto trackIndexNeg1 = groupedTrackIndicesNeg1.begin(); trackIndexNeg1 != groupedTrackIndicesNeg1.end(); ++trackIndexNeg1) { auto trackNeg1 = trackIndexNeg1.template track_as(); - if (trackNeg1.signed1Pt() > 0) { - continue; - } // retrieve the selection flag that corresponds to this collision auto isSelProngNeg1 = trackIndexNeg1.isSelProng(); bool sel2ProngStatusNeg = TESTBIT(isSelProngNeg1, CandidateType::Cand2Prong); bool sel3ProngStatusNeg1 = TESTBIT(isSelProngNeg1, CandidateType::Cand3Prong); - if (!sel2ProngStatusNeg && !sel3ProngStatusNeg1) { - continue; - } auto trackParVarNeg1 = getTrackParCov(trackNeg1); std::array pVecTrackNeg1{trackNeg1.px(), trackNeg1.py(), trackNeg1.pz()}; @@ -2182,11 +2194,12 @@ struct HfTrackIndexSkimCreator { std::array pvRefitCovMatrix2Prong = getPrimaryVertex(collision).getCov(); /// initialize to the original PV // 2-prong vertex reconstruction + float pt2Prong{-1.}; if (sel2ProngStatusPos && sel2ProngStatusNeg) { // 2-prong preselections // TODO: in case of PV refit, the single-track DCA is calculated wrt two different PV vertices (only 1 track excluded) - is2ProngPreselected(pVecTrackPos1, pVecTrackNeg1, dcaInfoPos1[0], dcaInfoNeg1[0], cutStatus2Prong, whichHypo2Prong, isSelected2ProngCand); + is2ProngPreselected(pVecTrackPos1, pVecTrackNeg1, dcaInfoPos1[0], dcaInfoNeg1[0], cutStatus2Prong, whichHypo2Prong, isSelected2ProngCand, pt2Prong); // secondary vertex reconstruction and further 2-prong selections int nVtxFrom2ProngFitter = 0; @@ -2340,64 +2353,20 @@ struct HfTrackIndexSkimCreator { isSelected2ProngCand = 0; // reset to 0 not to use the D0 to build a D* meson } - // 3-prong vertex and D* reconstruction - if (do3Prong == 1 || doDstar) { - if (!doDstar && (!sel3ProngStatusPos1 || !sel3ProngStatusNeg1)) { - continue; - } - + if (do3Prong == 1 && sel3ProngStatusPos1 && sel3ProngStatusNeg1) { // if 3 prongs are enabled and the first 2 tracks are selected for the 3-prong channels // second loop over positive tracks - // for (auto trackPos2 = trackPos1 + 1; trackPos2 != tracksPos.end(); ++trackPos2) { - int counterTrackPos2{0}; - auto startTrackIndexPos2 = (doDstar) ? groupedTrackIndices.begin() : trackIndexPos1 + 1; - for (auto trackIndexPos2 = startTrackIndexPos2; trackIndexPos2 != groupedTrackIndices.end(); ++trackIndexPos2) { - counterTrackPos2++; + for (auto trackIndexPos2 = trackIndexPos1 + 1; trackIndexPos2 != groupedTrackIndicesPos1.end(); ++trackIndexPos2) { + auto trackPos2 = trackIndexPos2.template track_as(); - if (trackPos2.signed1Pt() < 0) { - continue; - } auto trackParVarPos2 = getTrackParCov(trackPos2); std::array pVecTrackPos2{trackPos2.px(), trackPos2.py(), trackPos2.pz()}; o2::gpu::gpustd::array dcaInfoPos2{trackPos2.dcaXY(), trackPos2.dcaZ()}; - bool propagatedPos2{false}; - - // first we build D*+ candidates if enabled - auto isSelProngPos2 = trackIndexPos2.isSelProng(); - uint8_t isSelectedDstar{0}; - if (doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && TESTBIT(whichHypo2Prong[0], 0)) { // the 2-prong decay is compatible with a D0 - if (TESTBIT(isSelProngPos2, CandidateType::CandDstar) && trackPos2.globalIndex() != trackPos1.globalIndex()) { // compatible with a soft pion - if (thisCollId != trackPos2.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarPos2, 2.f, noMatCorr, &dcaInfoPos2); - getPxPyPz(trackParVarPos2, pVecTrackPos2); - propagatedPos2 = true; - } - uint8_t cutStatus{BIT(kNCutsDstar) - 1}; - float deltaMass{-1.}; - isSelectedDstar = isDstarSelected(pVecTrackPos1, pVecTrackNeg1, pVecTrackPos2, cutStatus, deltaMass); // we do not compute the D* decay vertex at this stage because we are not interested in applying topological selections - if (isSelectedDstar) { - rowTrackIndexDstar(thisCollId, trackPos2.globalIndex(), lastFilledD0); - if (fillHistograms) { - registry.fill(HIST("hMassDstarToD0Pi"), deltaMass); - } - if constexpr (doPvRefit) { - // fill table row with coordinates of PV refit (same as 2-prong because we do not remove the soft pion) - rowDstarPVrefit(pvRefitCoord2Prong[0], pvRefitCoord2Prong[1], pvRefitCoord2Prong[2], - pvRefitCovMatrix2Prong[0], pvRefitCovMatrix2Prong[1], pvRefitCovMatrix2Prong[2], pvRefitCovMatrix2Prong[3], pvRefitCovMatrix2Prong[4], pvRefitCovMatrix2Prong[5]); - } - } - if (debug) { - rowDstarCutStatus(cutStatus); - } - } - } // end of D* // preselection of 3-prong candidates - if (doDstar && counterTrackPos2 < counterTrackPos1 + 1) { // we avoid duplication for 3-prongs - continue; - } int isSelected3ProngCand = n3ProngBit; - if (do3Prong && TESTBIT(isSelProngPos2, CandidateType::Cand3Prong) && (sel3ProngStatusPos1 && sel3ProngStatusNeg1)) { - if (thisCollId != trackPos2.collisionId() && !propagatedPos2) { // this is not the "default" collision for this track and we still did not re-propagate it, we have to re-propagate it + auto isSelProngPos2 = trackIndexPos2.isSelProng(); + if (TESTBIT(isSelProngPos2, CandidateType::Cand3Prong)) { + if (thisCollId != trackPos2.collisionId()) { // this is not the "default" collision for this track and we still did not re-propagate it, we have to re-propagate it o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarPos2, 2.f, noMatCorr, &dcaInfoPos2); getPxPyPz(trackParVarPos2, pVecTrackPos2); } @@ -2609,58 +2578,17 @@ struct HfTrackIndexSkimCreator { } // second loop over negative tracks - // for (auto trackNeg2 = trackNeg1 + 1; trackNeg2 != tracksNeg.end(); ++trackNeg2) { - int counterTrackNeg2{0}; - auto startTrackIndexNeg2 = (doDstar) ? groupedTrackIndices.begin() : trackIndexNeg1 + 1; - for (auto trackIndexNeg2 = startTrackIndexNeg2; trackIndexNeg2 != groupedTrackIndices.end(); ++trackIndexNeg2) { - counterTrackNeg2++; + for (auto trackIndexNeg2 = trackIndexNeg1 + 1; trackIndexNeg2 != groupedTrackIndicesNeg1.end(); ++trackIndexNeg2) { auto trackNeg2 = trackIndexNeg2.template track_as(); - if (trackNeg2.signed1Pt() > 0) { - continue; - } - auto trackParVarNeg2 = getTrackParCov(trackNeg2); std::array pVecTrackNeg2{trackNeg2.px(), trackNeg2.py(), trackNeg2.pz()}; o2::gpu::gpustd::array dcaInfoNeg2{trackNeg2.dcaXY(), trackNeg2.dcaZ()}; - bool propagatedNeg2{false}; - - // first we build D*+ candidates if enabled - auto isSelProngNeg2 = trackIndexNeg2.isSelProng(); - uint8_t isSelectedDstar{0}; - if (doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && TESTBIT(whichHypo2Prong[0], 1)) { // the 2-prong decay is compatible with a D0bar - if (TESTBIT(isSelProngNeg2, CandidateType::CandDstar) && trackNeg2.globalIndex() != trackNeg1.globalIndex()) { // compatible with a soft pion - if (thisCollId != trackNeg2.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarNeg2, 2.f, noMatCorr, &dcaInfoNeg2); - getPxPyPz(trackParVarNeg2, pVecTrackNeg2); - propagatedNeg2 = true; - } - uint8_t cutStatus{BIT(kNCutsDstar) - 1}; - float deltaMass{-1.}; - isSelectedDstar = isDstarSelected(pVecTrackNeg1, pVecTrackPos1, pVecTrackNeg2, cutStatus, deltaMass); // we do not compute the D* decay vertex at this stage because we are not interested in applying topological selections - if (isSelectedDstar) { - rowTrackIndexDstar(thisCollId, trackNeg2.globalIndex(), lastFilledD0); - if (fillHistograms) { - registry.fill(HIST("hMassDstarToD0Pi"), deltaMass); - } - if constexpr (doPvRefit) { - // fill table row with coordinates of PV refit (same as 2-prong because we do not remove the soft pion) - rowDstarPVrefit(pvRefitCoord2Prong[0], pvRefitCoord2Prong[1], pvRefitCoord2Prong[2], - pvRefitCovMatrix2Prong[0], pvRefitCovMatrix2Prong[1], pvRefitCovMatrix2Prong[2], pvRefitCovMatrix2Prong[3], pvRefitCovMatrix2Prong[4], pvRefitCovMatrix2Prong[5]); - } - } - if (debug) { - rowDstarCutStatus(cutStatus); - } - } - } // end of D* // preselection of 3-prong candidates - if (doDstar && counterTrackNeg2 < counterTrackNeg1 + 1) { // we avoid duplication for 3-prongs - continue; - } int isSelected3ProngCand = n3ProngBit; - if (do3Prong && TESTBIT(isSelProngNeg2, CandidateType::Cand3Prong) && (sel3ProngStatusPos1 && sel3ProngStatusNeg1)) { - if (thisCollId != trackNeg2.collisionId() && !propagatedNeg2) { // this is not the "default" collision for this track and we still did not re-propagate it, we have to re-propagate it + auto isSelProngNeg2 = trackIndexNeg2.isSelProng(); + if (TESTBIT(isSelProngNeg2, CandidateType::Cand3Prong)) { + if (thisCollId != trackNeg2.collisionId()) { // this is not the "default" collision for this track and we still did not re-propagate it, we have to re-propagate it o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarNeg2, 2.f, noMatCorr, &dcaInfoNeg2); getPxPyPz(trackParVarNeg2, pVecTrackNeg2); } @@ -2684,7 +2612,7 @@ struct HfTrackIndexSkimCreator { isSelected3ProngCand = 0; } - // if we did not preselected any D* or 3-prong candidate, continue + // if we did not preselected any 3-prong candidate, continue if (!debug && isSelected3ProngCand == 0) { continue; } @@ -2871,6 +2799,82 @@ struct HfTrackIndexSkimCreator { } } } + + if (doDstar && TESTBIT(isSelected2ProngCand, hf_cand_2prong::DecayType::D0ToPiK) && (pt2Prong + ptTolerance) * 1.2 > binsPtDstarToD0Pi->at(0) && whichHypo2Prong[kN2ProngDecays] != 0) { // if D* enabled and pt of the D0 is larger than the minimum of the D* one within 20% (D* and D0 momenta are very similar, always within 20% according to PYTHIA8) + // second loop over positive tracks + if (TESTBIT(whichHypo2Prong[kN2ProngDecays], 0)) { // only for D0 candidates + auto groupedTrackIndicesSoftPionsPos = positiveSoftPions->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + for (auto trackIndexPos2 = groupedTrackIndicesSoftPionsPos.begin(); trackIndexPos2 != groupedTrackIndicesSoftPionsPos.end(); ++trackIndexPos2) { + if (trackIndexPos2 == trackIndexPos1) { + continue; + } + auto trackPos2 = trackIndexPos2.template track_as(); + auto trackParVarPos2 = getTrackParCov(trackPos2); + std::array pVecTrackPos2{trackPos2.px(), trackPos2.py(), trackPos2.pz()}; + o2::gpu::gpustd::array dcaInfoPos2{trackPos2.dcaXY(), trackPos2.dcaZ()}; + if (thisCollId != trackPos2.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarPos2, 2.f, noMatCorr, &dcaInfoPos2); + getPxPyPz(trackParVarPos2, pVecTrackPos2); + } + + uint8_t isSelectedDstar{0}; + uint8_t cutStatus{BIT(kNCutsDstar) - 1}; + float deltaMass{-1.}; + isSelectedDstar = isDstarSelected(pVecTrackPos1, pVecTrackNeg1, pVecTrackPos2, cutStatus, deltaMass); // we do not compute the D* decay vertex at this stage because we are not interested in applying topological selections + if (isSelectedDstar) { + rowTrackIndexDstar(thisCollId, trackPos2.globalIndex(), lastFilledD0); + if (fillHistograms) { + registry.fill(HIST("hMassDstarToD0Pi"), deltaMass); + } + if constexpr (doPvRefit) { + // fill table row with coordinates of PV refit (same as 2-prong because we do not remove the soft pion) + rowDstarPVrefit(pvRefitCoord2Prong[0], pvRefitCoord2Prong[1], pvRefitCoord2Prong[2], + pvRefitCovMatrix2Prong[0], pvRefitCovMatrix2Prong[1], pvRefitCovMatrix2Prong[2], pvRefitCovMatrix2Prong[3], pvRefitCovMatrix2Prong[4], pvRefitCovMatrix2Prong[5]); + } + } + if (debug) { + rowDstarCutStatus(cutStatus); + } + } + } + + // second loop over negative tracks + if (TESTBIT(whichHypo2Prong[kN2ProngDecays], 1)) { // only for D0bar candidates + auto groupedTrackIndicesSoftPionsNeg = negativeSoftPions->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); + for (auto trackIndexNeg2 = groupedTrackIndicesSoftPionsNeg.begin(); trackIndexNeg2 != groupedTrackIndicesSoftPionsNeg.end(); ++trackIndexNeg2) { + if (trackIndexNeg1 == trackIndexNeg2) { + continue; + } + auto trackNeg2 = trackIndexNeg2.template track_as(); + auto trackParVarNeg2 = getTrackParCov(trackNeg2); + std::array pVecTrackNeg2{trackNeg2.px(), trackNeg2.py(), trackNeg2.pz()}; + o2::gpu::gpustd::array dcaInfoNeg2{trackNeg2.dcaXY(), trackNeg2.dcaZ()}; + if (thisCollId != trackNeg2.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarNeg2, 2.f, noMatCorr, &dcaInfoNeg2); + getPxPyPz(trackParVarNeg2, pVecTrackNeg2); + } + + uint8_t isSelectedDstar{0}; + uint8_t cutStatus{BIT(kNCutsDstar) - 1}; + float deltaMass{-1.}; + isSelectedDstar = isDstarSelected(pVecTrackNeg1, pVecTrackPos1, pVecTrackNeg2, cutStatus, deltaMass); // we do not compute the D* decay vertex at this stage because we are not interested in applying topological selections + if (isSelectedDstar) { + rowTrackIndexDstar(thisCollId, trackNeg2.globalIndex(), lastFilledD0); + if (fillHistograms) { + registry.fill(HIST("hMassDstarToD0Pi"), deltaMass); + } + if constexpr (doPvRefit) { + // fill table row with coordinates of PV refit (same as 2-prong because we do not remove the soft pion) + rowDstarPVrefit(pvRefitCoord2Prong[0], pvRefitCoord2Prong[1], pvRefitCoord2Prong[2], + pvRefitCovMatrix2Prong[0], pvRefitCovMatrix2Prong[1], pvRefitCovMatrix2Prong[2], pvRefitCovMatrix2Prong[3], pvRefitCovMatrix2Prong[4], pvRefitCovMatrix2Prong[5]); + } + } + if (debug) { + rowDstarCutStatus(cutStatus); + } + } + } + } // end of D* } } @@ -2988,8 +2992,7 @@ struct HfTrackIndexSkimCreatorCascades { double mass2K0sP{0.}; // WHY HERE? Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == 0); - Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng > 0); - // Partition TracksWithPVRefitAndDCA = aod::hf_sel_track::isSelProng >= 4; + Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandV0bachelor))) != 0u; using SelectedCollisions = soa::Filtered>; using FilteredTrackAssocSel = soa::Filtered>; @@ -3070,13 +3073,8 @@ struct HfTrackIndexSkimCreatorCascades { // selections on the bachelor - // // retrieve the selection flag that corresponds to this collision - auto isSelProngBach = bachIdx.isSelProng(); - // pT cut - if (!TESTBIT(isSelProngBach, CandidateType::CandV0bachelor)) { - continue; - } + // FIXME: this should go in the tag-sel-tracks if (tpcRefitBach) { if (!(bach.trackType() & o2::aod::track::TPCrefit)) { continue; @@ -3350,7 +3348,7 @@ struct HfTrackIndexSkimCreatorLfCascades { using V0Full = soa::Join; Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == 0); - Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng > 0); + Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandCascadeBachelor))) != 0u; Preslice tracksPerCollision = aod::track::collisionId; // needed for PV refit Preslice trackIndicesPerCollision = aod::track_association::collisionId; // aod::hf_track_association::collisionId @@ -3517,10 +3515,6 @@ struct HfTrackIndexSkimCreatorLfCascades { hfFlag = 0; - if (!TESTBIT(trackIdPion1.isSelProng(), CandidateType::CandCascadeBachelor)) { - continue; - } - auto trackPion1 = trackIdPion1.track_as(); if ((rejDiffCollTrack) && (trackXiDauCharged.collisionId() != trackPion1.collisionId())) { From 8b22a6a436b66b20bb4c2c8d7cb48a61ab181241 Mon Sep 17 00:00:00 2001 From: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Date: Tue, 30 Jan 2024 19:40:14 +0100 Subject: [PATCH 08/33] Add task for studying fake ITS-TPC matchings (#4525) * Add task for studying fake ITS-TPC matchings * Fix megalinter --- PWGLF/Tasks/QC/CMakeLists.txt | 5 + PWGLF/Tasks/QC/lfITSTPCMatchingQA.cxx | 217 ++++++++++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100644 PWGLF/Tasks/QC/lfITSTPCMatchingQA.cxx diff --git a/PWGLF/Tasks/QC/CMakeLists.txt b/PWGLF/Tasks/QC/CMakeLists.txt index e12ebdf755c..22c48a048f9 100644 --- a/PWGLF/Tasks/QC/CMakeLists.txt +++ b/PWGLF/Tasks/QC/CMakeLists.txt @@ -39,6 +39,11 @@ o2physics_add_dpl_workflow(kfperformancestudy PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(its-tpc-matching-qa + SOURCES lfITSTPCMatchingQA.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(lfpropstudy SOURCES lfpropStudy.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGLF/Tasks/QC/lfITSTPCMatchingQA.cxx b/PWGLF/Tasks/QC/lfITSTPCMatchingQA.cxx new file mode 100644 index 00000000000..247a702758e --- /dev/null +++ b/PWGLF/Tasks/QC/lfITSTPCMatchingQA.cxx @@ -0,0 +1,217 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "ReconstructionDataFormats/Track.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "DataFormatsTPC/BetheBlochAleph.h" +#include "Common/Core/PID/PIDTOF.h" +#include "Common/TableProducer/PID/pidTOFBase.h" + +#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/DataModel/PIDResponse.h" + +#include "TDatabasePDG.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +using TracksFull = soa::Join; + +namespace +{ +// PID custom parametrisation for d and He3 +constexpr double betheBlochDefault[2][6]{ + {-136.71, 0.441, 0.2269, 1.347, 0.8035, 0.09}, + {-321.34, 0.6539, 1.591, 0.8225, 2.363, 0.09}}; +static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; +static const std::vector particleNamesBB{"d", "He3"}; +static const std::vector pidHypotheses{"Electron", "Muon", "Pion", "Kaon", "Proton", "Deuteron", "Triton", "He3", "Alpha", "Pion0", "Photon", "K0", "Lambda", "HyperTriton", "Hyperhydrog4", "XiMinus", "OmegaMinus"}; +} // namespace + +struct lfmatchingqa { + + // ConfigurableAxis for the histograms + ConfigurableAxis zVtxAxis{"zVtxBins", {100, -20.f, 20.f}, "Binning for the vertex z in cm"}; + Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 2, 6, particleNamesBB, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for d and He3"}; + ConfigurableAxis tpcNsigmaAxis{"tpcNsigmaAxis", {100, -4.f, 4.f}, "tpc nsigma axis"}; + ConfigurableAxis momAxis{"momAxis", {60., -3.f, 3.f}, "momentum axis binning"}; + ConfigurableAxis momAxisFine{"momAxisFine", {2.e3, -5.f, 5.f}, "momentum axis binning"}; + ConfigurableAxis momResAxis{"momResAxis", {2.e2, -2.f, 2.f}, "momentum resolution binning"}; + ConfigurableAxis tpcAxis{"tpcAxis", {4e3, 0.f, 4.e3f}, "tpc signal axis binning"}; + ConfigurableAxis trackingPidAxis{"trackingPidAxis", {static_cast(pidHypotheses.size()), 0, static_cast(pidHypotheses.size())}, "tracking pid hypothesis binning"}; + + // Cut values + Configurable zVtxMax{"zVtxMax", 10.0f, "maximum z position of the primary vertex"}; + Configurable etaMax{"etaMax", 0.8f, "maximum eta"}; + Configurable ptMin{"ptMin", 0.05f, "minimum pT (GeV/c)"}; + Configurable nClusITSCut{"nClusITSCut", 7, "Minimum number of ITS clusters"}; + Configurable nClusTPCCut{"nClusTPCCut", 70, "Minimum number of TPC clusters"}; + Configurable dcaCut{"dcaCut", 0.05f, "DCA to PV"}; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + template + bool selectTrack(T const& track) + { + if (std::abs(track.eta()) > etaMax || track.pt() < ptMin) { + return false; + } + if (track.itsNCls() < nClusITSCut || + track.tpcNClsFound() < nClusTPCCut || + track.tpcNClsCrossedRows() < 100 || + track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() || + track.tpcChi2NCl() > 4.f || + track.itsChi2NCl() > 36.f) { + return false; + } + return true; + } + + template + float getITSClSize(T const& track) + { + float sum{0.f}; + for (int iL{0}; iL < 6; ++iL) { + sum += (track.itsClusterSizes() >> (iL * 4)) & 0xf; + } + return sum / track.itsNCls(); + } + + void init(o2::framework::InitContext&) + { + histos.add("zVtx", ";#it{z}_{vtx} (cm);Entries", HistType::kTH1F, {zVtxAxis}); + + histos.add("tpcSignal", ";#it{p}_{TPC} (GeV/#it{c});TPC signal (a.u.)", {HistType::kTH2F}, {momAxisFine, tpcAxis}); + histos.add("tpcSignalPIDHypo", ";#it{p}_{TPC} (GeV/#it{c});TPC signal (a.u.); PID hypothesis", {HistType::kTH3F}, {momAxisFine, tpcAxis, trackingPidAxis}); + histos.add("tpcNsigmaPi", ";#it{p}_{TPC}; #it{p}_{GLO}; n#sigma_{TPC} (#pi)", {HistType::kTH3F, {momAxis, momAxis, tpcNsigmaAxis}}); + histos.add("tpcNsigmaKa", ";#it{p}_{TPC}; #it{p}_{GLO}; n#sigma_{TPC} (K)", {HistType::kTH3F, {momAxis, momAxis, tpcNsigmaAxis}}); + histos.add("tpcNsigmaPr", ";#it{p}_{TPC}; #it{p}_{GLO}; n#sigma_{TPC} (p)", {HistType::kTH3F, {momAxis, momAxis, tpcNsigmaAxis}}); + histos.add("tpcNsigmaDe", ";#it{p}_{TPC}; #it{p}_{GLO}; n#sigma_{TPC} (d)", {HistType::kTH3F, {momAxis, momAxis, tpcNsigmaAxis}}); + histos.add("tpcNsigmaHe", ";#it{p}_{TPC}; #it{p}_{GLO}; n#sigma_{TPC} (He3)", {HistType::kTH3F, {momAxis, momAxis, tpcNsigmaAxis}}); + + auto pidHypoPi = histos.add("pidHypoPi", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (#pi);", {HistType::kTH3F}, {momAxisFine, momResAxis, trackingPidAxis}); + auto pidHypoKa = histos.add("pidHypoKa", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (K);", {HistType::kTH3F}, {momAxisFine, momResAxis, trackingPidAxis}); + auto pidHypoPr = histos.add("pidHypoPr", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (p);", {HistType::kTH3F}, {momAxisFine, momResAxis, trackingPidAxis}); + auto pidHypoDe = histos.add("pidHypoDe", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (d);", {HistType::kTH3F}, {momAxisFine, momResAxis, trackingPidAxis}); + auto pidHypoHe = histos.add("pidHypoHe", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (He3);", {HistType::kTH3F}, {momAxisFine, momResAxis, trackingPidAxis}); + for (int i{1}; i < pidHypoPi->GetNbinsZ() + 1; ++i) { + pidHypoPi->GetZaxis()->SetBinLabel(i, pidHypotheses[i - 1].data()); + pidHypoKa->GetZaxis()->SetBinLabel(i, pidHypotheses[i - 1].data()); + pidHypoPr->GetZaxis()->SetBinLabel(i, pidHypotheses[i - 1].data()); + pidHypoDe->GetZaxis()->SetBinLabel(i, pidHypotheses[i - 1].data()); + pidHypoHe->GetZaxis()->SetBinLabel(i, pidHypotheses[i - 1].data()); + } + + histos.add("momCorrPi", ";#it{p}_{TPC}; #it{p}_{GLO};#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); + histos.add("momCorrKa", ";#it{p}_{TPC}; #it{p}_{GLO};#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); + histos.add("momCorrPr", ";#it{p}_{TPC}; #it{p}_{GLO};#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); + histos.add("momCorrDe", ";#it{p}_{TPC}; #it{p}_{GLO};#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); + histos.add("momCorrHe", ";#it{p}_{TPC}; #it{p}_{GLO};#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); + + histos.add("itsClusSizePi", ";#it{p}_{TPC}; #it{p}_{GLO}; (#pi)", {HistType::kTH3F, {momAxis, momAxis, {10, 0, 10}}}); + histos.add("itsClusSizeKa", ";#it{p}_{TPC}; #it{p}_{GLO}; (K)", {HistType::kTH3F, {momAxis, momAxis, {10, 0, 10}}}); + histos.add("itsClusSizePr", ";#it{p}_{TPC}; #it{p}_{GLO}; (p)", {HistType::kTH3F, {momAxis, momAxis, {10, 0, 10}}}); + histos.add("itsClusSizeDe", ";#it{p}_{TPC}; #it{p}_{GLO}; (d)", {HistType::kTH3F, {momAxis, momAxis, {10, 0, 10}}}); + histos.add("itsClusSizeHe", ";#it{p}_{TPC}; #it{p}_{GLO}; (He3)", {HistType::kTH3F, {momAxis, momAxis, {10, 0, 10}}}); + } + + void process(soa::Join::iterator const& collision, TracksFull const& tracks, aod::BCs const&) + { + + if (!collision.sel8()) + return; + + if (std::abs(collision.posZ()) > zVtxMax) + return; + + histos.fill(HIST("zVtx"), collision.posZ()); + + for (const auto& track : tracks) { + if (!selectTrack(track)) { + continue; + } + + auto sign = track.sign(); + auto signTPCMom = sign * track.tpcInnerParam(); + auto signGloMom = sign * track.p(); + + // compute custom tpcNsigmaDeu and tpcNsigmaHe3 + double expBetheDeu{tpc::BetheBlochAleph(static_cast(track.tpcInnerParam() / constants::physics::MassDeuteron), cfgBetheBlochParams->get("d", "p0"), cfgBetheBlochParams->get("d", "p1"), cfgBetheBlochParams->get("d", "p2"), cfgBetheBlochParams->get("d", "p3"), cfgBetheBlochParams->get("d", "p4"))}; + double expSigmaDeu{expBetheDeu * cfgBetheBlochParams->get("d", "resolution")}; + double expBetheHe3{tpc::BetheBlochAleph(static_cast(track.tpcInnerParam() / constants::physics::MassHelium3), cfgBetheBlochParams->get("He3", "p0"), cfgBetheBlochParams->get("He3", "p1"), cfgBetheBlochParams->get("He3", "p2"), cfgBetheBlochParams->get("He3", "p3"), cfgBetheBlochParams->get("He3", "p4"))}; + double expSigmaHe3{expBetheHe3 * cfgBetheBlochParams->get("He3", "resolution")}; + auto tpcNSigmaDeu = static_cast((track.tpcSignal() - expBetheDeu) / expSigmaDeu); + auto tpcNSigmaHe3 = static_cast((track.tpcSignal() - expBetheHe3) / expSigmaHe3); + + // filling the nsigma histograms + histos.fill(HIST("tpcSignal"), signTPCMom, track.tpcSignal()); + histos.fill(HIST("tpcSignalPIDHypo"), signTPCMom, track.tpcSignal(), track.pidForTracking()); + if (abs(track.tpcNSigmaPi()) < 4) { + histos.fill(HIST("tpcNsigmaPi"), signTPCMom, signGloMom, track.tpcNSigmaPi()); + histos.fill(HIST("pidHypoPi"), signTPCMom, track.tpcNSigmaPi(), track.pidForTracking()); + } + if (abs(track.tpcNSigmaKa()) < 4) { + histos.fill(HIST("tpcNsigmaKa"), signTPCMom, signGloMom, track.tpcNSigmaKa()); + histos.fill(HIST("pidHypoKa"), signTPCMom, track.tpcNSigmaKa(), track.pidForTracking()); + } + if (abs(track.tpcNSigmaPr()) < 4) { + histos.fill(HIST("tpcNsigmaPr"), signTPCMom, signGloMom, track.tpcNSigmaPr()); + histos.fill(HIST("pidHypoPr"), signTPCMom, track.tpcNSigmaPr(), track.pidForTracking()); + } + if (abs(tpcNSigmaDeu) < 4) { + histos.fill(HIST("tpcNsigmaDe"), signTPCMom, signGloMom, tpcNSigmaDeu); + histos.fill(HIST("pidHypoDe"), signTPCMom, tpcNSigmaDeu, track.pidForTracking()); + } + if (abs(tpcNSigmaHe3) < 4) { + histos.fill(HIST("tpcNsigmaHe"), signTPCMom, signGloMom, tpcNSigmaHe3); + histos.fill(HIST("pidHypoHe"), signTPCMom, tpcNSigmaHe3, track.pidForTracking()); + } + + // Filling the mom corr and cl sizes histograms (nSigma < 2 required) + if (abs(track.tpcNSigmaPi()) < 2) { + histos.fill(HIST("momCorrPi"), signTPCMom, signGloMom, track.tpcInnerParam() - track.p()); + histos.fill(HIST("itsClusSizePi"), signTPCMom, signGloMom, getITSClSize(track)); + } + if (abs(track.tpcNSigmaKa()) < 2) { + histos.fill(HIST("momCorrKa"), signTPCMom, signGloMom, track.tpcInnerParam() - track.p()); + histos.fill(HIST("itsClusSizeKa"), signTPCMom, signGloMom, getITSClSize(track)); + } + if (abs(track.tpcNSigmaPr()) < 2) { + histos.fill(HIST("momCorrPr"), signTPCMom, signGloMom, track.tpcInnerParam() - track.p()); + histos.fill(HIST("itsClusSizePr"), signTPCMom, signGloMom, getITSClSize(track)); + } + if (abs(tpcNSigmaDeu) < 2) { + histos.fill(HIST("momCorrDe"), signTPCMom, signGloMom, track.tpcInnerParam() - track.p()); + histos.fill(HIST("itsClusSizeDe"), signTPCMom, signGloMom, getITSClSize(track)); + } + if (abs(tpcNSigmaHe3) < 2) { + histos.fill(HIST("momCorrHe"), signTPCMom, signGloMom, track.tpcInnerParam() - track.p()); + histos.fill(HIST("itsClusSizeHe"), signTPCMom, signGloMom, getITSClSize(track)); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From 731e31fd92c2fef0f12b614fca42bc824afa629d Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Tue, 30 Jan 2024 21:12:20 +0100 Subject: [PATCH 09/33] Fix: PID selection for MC particle missing (#4521) --- PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx index 555f717765c..25a4ec71c5a 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx @@ -50,14 +50,17 @@ struct femtoDreamDebugTrack { ConfigurableAxis ConfDummy{"ConfDummy", {1, 0, 1}, "Dummy axis for inv mass"}; using FemtoFullParticles = soa::Join; - - Partition partsOne = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ncheckbit(aod::femtodreamparticle::cut, ConfTrk1_CutBit) && - ifnode(aod::femtodreamparticle::pt * (nexp(aod::femtodreamparticle::eta) + nexp(-1.f * aod::femtodreamparticle::eta)) / 2.f <= ConfTrk1_PIDThres, ncheckbit(aod::femtodreamparticle::pidcut, ConfTrk1_TPCBit), ncheckbit(aod::femtodreamparticle::pidcut, ConfTrk1_TPCTOFBit)); - + Partition partsOne = + (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && + ncheckbit(aod::femtodreamparticle::cut, ConfTrk1_CutBit) && + ifnode(aod::femtodreamparticle::pt * (nexp(aod::femtodreamparticle::eta) + nexp(-1.f * aod::femtodreamparticle::eta)) / 2.f <= ConfTrk1_PIDThres, ncheckbit(aod::femtodreamparticle::pidcut, ConfTrk1_TPCBit), ncheckbit(aod::femtodreamparticle::pidcut, ConfTrk1_TPCTOFBit)); Preslice perColReco = aod::femtodreamparticle::fdCollisionId; using FemtoFullParticlesMC = soa::Join; - Partition partsOneMC = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ncheckbit(aod::femtodreamparticle::cut, ConfTrk1_CutBit); + Partition partsOneMC = + (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && + ncheckbit(aod::femtodreamparticle::cut, ConfTrk1_CutBit) && + ifnode(aod::femtodreamparticle::pt * (nexp(aod::femtodreamparticle::eta) + nexp(-1.f * aod::femtodreamparticle::eta)) / 2.f <= ConfTrk1_PIDThres, ncheckbit(aod::femtodreamparticle::pidcut, ConfTrk1_TPCBit), ncheckbit(aod::femtodreamparticle::pidcut, ConfTrk1_TPCTOFBit)); Preslice perColGen = aod::femtodreamparticle::fdCollisionId; /// Histogramming for Event From c4515a42439442544eae2eb72a64c7e4bcd3832f Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Tue, 30 Jan 2024 21:14:48 +0100 Subject: [PATCH 10/33] PWGCF/FemtoUniverse : Adding centrality selection cuts (#4522) * Adding centrality selection cuts * Adding centrality selection cuts * Adding centrality selection cuts * Adding centrality selection cuts * Adding centrality selection cuts * 3D CFs in mult and kT bins * 3D CFs in mult and kT bins * 3D CFs in mult and kT bins * Adding centrality selection cuts * Adding centrality selection cuts --- .../Core/FemtoUniverseCollisionSelection.h | 20 ++- .../Core/FemtoUniversePairWithCentMultKt.h | 119 +++++++++++++++++- .../femtoUniverseProducerMCTruthTask.cxx | 6 +- .../femtoUniverseProducerReducedTask.cxx | 8 +- .../femtoUniverseProducerTask.cxx | 10 +- .../femtoUniverseProducerTaskV0Only.cxx | 6 +- ...ersePairTaskTrackTrack3DMultKtExtended.cxx | 51 ++++---- ...iversePairTaskTrackTrackMultKtExtended.cxx | 13 +- 8 files changed, 188 insertions(+), 45 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h index 5aa132eb963..4b53e1034b5 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h @@ -13,6 +13,7 @@ /// \brief FemtoUniverseCollisionSelection - event selection within the o2femtouniverse framework /// \author Andi Mathis, TU München, andreas.mathis@ph.tum.de /// \author Zuzanna Chochulska, WUT Warsaw, zuzanna.chochulska.stud@pw.edu.pl +/// \author Pritam Chakraborty, WUT Warsaw, pritam.chakraborty@pw.edu.pl #ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECOLLISIONSELECTION_H_ #define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECOLLISIONSELECTION_H_ @@ -38,10 +39,14 @@ class FemtoUniverseCollisionSelection /// Pass the selection criteria to the class /// \param zvtxMax Maximal value of the z-vertex - /// \param checkTrigger whether or not to check for the trigger alias + /// \param checkTrigger Whether or not to check for the trigger alias /// \param trig Requested trigger alias - /// \param checkOffline whether or not to check for offline selection criteria - void setCuts(float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool checkRun3) + /// \param checkOffline Whether or not to check for offline selection criteria + /// \param checkRun3 To check for the Run3 data + /// \param centmin Minimum value of centrality selection + /// \param centmax Maximum value of centrality selection + void setCuts(float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool checkRun3, float centmin, float centmax) + // void setCuts(float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool checkRun3) { mCutsSet = true; mZvtxMax = zvtxMax; @@ -49,6 +54,8 @@ class FemtoUniverseCollisionSelection mTrigger = static_cast(trig); mCheckOffline = checkOffline; mCheckIsRun3 = checkRun3; + mCentMin = centmin; + mCentMax = centmax; } /// Initializes histograms for the task @@ -75,6 +82,8 @@ class FemtoUniverseCollisionSelection LOG(info) << "Check trigger: " << mCheckTrigger; LOG(info) << "Trigger: " << mTrigger; LOG(info) << " Check offline: " << mCheckOffline; + LOG(info) << " Minimum Centrality: " << mCentMin; + LOG(info) << " Maximum Centrality: " << mCentMax; } /// Check whether the collisions fulfills the specified selections @@ -91,6 +100,9 @@ class FemtoUniverseCollisionSelection if (mCheckOffline && !col.sel8()) { return false; } + if ((col.centFT0C() < mCentMin) || (col.centFT0C() > mCentMax)) { + return false; + } } else { if (mCheckTrigger && !col.alias_bit(mTrigger)) { return false; @@ -145,6 +157,8 @@ class FemtoUniverseCollisionSelection bool mCheckIsRun3 = false; ///< Check if running on Pilot Beam triggerAliases mTrigger = kINT7; ///< Trigger to check for float mZvtxMax = 999.f; ///< Maximal deviation from nominal z-vertex (cm) + float mCentMin = 0.0; ///< Minimum centrality value + float mCentMax = 100.0; ///< Maximum centrality value }; } // namespace o2::analysis::femtoUniverse diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h b/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h index d4c449041cc..c3ef4ca4fad 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniversePairWithCentMultKt.h @@ -34,15 +34,19 @@ class PairWithCentMultKt /// @param kstarbins /// @param centmultbins template - void init(HistogramRegistry* registry, t1& kstarbins, t1& centmultbins, t1& ktbins, bool processKT) + void init(HistogramRegistry* registry, t1& kstarbins, t1& centmultbins, t1& ktbins, bool processKT, bool process3D) { PairWithCentMultKtRegistry = registry; AxisSpec kstarAxis = {kstarbins, "#it{k*} (GeV/#it{c})"}; + AxisSpec kOutAxis = {kstarbins, "#it{q}_{out} (GeV/#it{c})"}; + AxisSpec kSideAxis = {kstarbins, "#it{q}_{side} (GeV/#it{c})"}; + AxisSpec kLongAxis = {kstarbins, "#it{q}_{long} (GeV/#it{c})"}; CentMultBins = centmultbins; KtBins = ktbins; KtBins.erase(KtBins.begin()); CentMultBins.erase(CentMultBins.begin()); UseKt = processKT; + Use3D = process3D; for (int i = 0; i < static_cast(CentMultBins.size() - 1); i++) { int lowBin = static_cast((CentMultBins[i])); @@ -50,11 +54,16 @@ class PairWithCentMultKt std::string HistTitle = "mult_" + std::to_string(lowBin) + "-" + std::to_string(highBin); std::string HistSuffix1 = static_cast(HistSuffix[i]); std::string HistSuffix2 = static_cast(HistSuffix[i + 1]); + std::cout << "HistSuffix1 " << HistSuffix1 << " HistSuffix2 " << HistSuffix2 << std::endl; std::string HistFolderMult = "mult_" + HistSuffix1 + "_" + HistSuffix2; std::string HistName = HistFolderMult + "/kstar"; + std::string HistName3D = HistFolderMult + "/q3D"; PairWithCentMultKtRegistry->add(HistName.c_str(), HistTitle.c_str(), HistType::kTH1F, {kstarAxis}); + PairWithCentMultKtRegistry->add(HistName3D.c_str(), HistTitle.c_str(), HistType::kTH3F, {kOutAxis, kSideAxis, kLongAxis}); if (UseKt) { + std::cout << "Working 0" << std::endl; for (int i = 0; i < static_cast(KtBins.size() - 1); i++) { + std::cout << "Working 1" << std::endl; std::string kt_bin1_string = std::to_string(KtBins[i]); std::replace(kt_bin1_string.begin(), kt_bin1_string.end(), '.', '_'); std::string kt_bin2_string = std::to_string(KtBins[i + 1]); @@ -65,11 +74,30 @@ class PairWithCentMultKt std::string HistSuffix1Kt = static_cast(HistSuffix[i]); std::string HistSuffix2Kt = static_cast(HistSuffix[i + 1]); std::string HistNameKt = HistFolderMult + "/kstar_kt_" + HistSuffix1Kt + "_" + HistSuffix2Kt; + std::cout << "HistNameKt " << HistNameKt << std::endl; PairWithCentMultKtRegistry->add(HistNameKt.c_str(), HistTitleKt.c_str(), HistType::kTH1F, {kstarAxis}); } } + if (Use3D) { + for (int i = 0; i < static_cast(KtBins.size() - 1); i++) { + std::cout << "Working 2" << std::endl; + std::string kt_bin1_string = std::to_string(KtBins[i]); + std::replace(kt_bin1_string.begin(), kt_bin1_string.end(), '.', '_'); + std::string kt_bin2_string = std::to_string(KtBins[i + 1]); + std::replace(kt_bin2_string.begin(), kt_bin2_string.end(), '.', '_'); + kt_bin1_string.resize(4); + kt_bin2_string.resize(4); + std::string HistTitleKt = "kt_" + kt_bin1_string + "-" + kt_bin2_string; + std::string HistSuffix1Kt = static_cast(HistSuffix[i]); + std::string HistSuffix2Kt = static_cast(HistSuffix[i + 1]); + std::string HistNameKt = HistFolderMult + "/q3D_kt_" + HistSuffix1Kt + "_" + HistSuffix2Kt; + std::cout << "HistNameKt " << HistNameKt << std::endl; + PairWithCentMultKtRegistry->add(HistNameKt.c_str(), HistTitleKt.c_str(), HistType::kTH3F, {kOutAxis, kSideAxis, kLongAxis}); + } + } } PairWithCentMultKtRegistry->add("Beyond_Max", "Beyond_Max", HistType::kTH1F, {kstarAxis}); + PairWithCentMultKtRegistry->add("Beyond_Max_3D", "Beyond_Max_3D", HistType::kTH3F, {kOutAxis, kSideAxis, kLongAxis}); } /// @brief @@ -169,11 +197,100 @@ class PairWithCentMultKt } } + /// @brief + /// @tparam t1 + /// @param qout_value + /// @param qside_value + /// @param qlong_value + /// @param cent_mult_value + template + void fill_3D(t1 qout_value, t1 qside_value, t1 qlong_value, t1 cent_mult_value, t1 kt_value) + { + + if (cent_mult_value > CentMultBins[CentMultBins.size() - 1] || cent_mult_value < CentMultBins[0]) { + PairWithCentMultKtRegistry->fill(HIST("Beyond_Max_3D"), qout_value, qside_value, qlong_value); + } else if (cent_mult_value <= CentMultBins[1]) { + PairWithCentMultKtRegistry->fill(HIST("mult_0_1/q3D"), qout_value, qside_value, qlong_value); + if (Use3D) { + auto histMultFolder = HIST("mult_0_1/"); + fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); + } + } else if (cent_mult_value <= CentMultBins[2]) { + // PairWithCentMultKtRegistry->fill(HIST("mult_1_2/q3D"), qout_value, qside_value, qlong_value); + if (Use3D) { + auto histMultFolder = HIST("mult_1_2/"); + fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); + } + } else if (cent_mult_value <= CentMultBins[3]) { + // PairWithCentMultKtRegistry->fill(HIST("mult_2_3/q3D"), qout_value, qside_value, qlong_value); + if (Use3D) { + auto histMultFolder = HIST("mult_2_3/"); + fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); + } + } else if (cent_mult_value <= CentMultBins[4]) { + // PairWithCentMultKtRegistry->fill(HIST("mult_3_4/q3D"), qout_value, qside_value, qlong_value); + if (Use3D) { + auto histMultFolder = HIST("mult_3_4/"); + fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); + } + } else if (cent_mult_value <= CentMultBins[5]) { + // PairWithCentMultKtRegistry->fill(HIST("mult_4_5/q3D"), qout_value, qside_value, qlong_value); + if (Use3D) { + auto histMultFolder = HIST("mult_4_5/"); + fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); + } + } else if (cent_mult_value <= CentMultBins[6]) { + // PairWithCentMultKtRegistry->fill(HIST("mult_5_6/q3D"), qout_value, qside_value, qlong_value); + if (Use3D) { + auto histMultFolder = HIST("mult_5_6/"); + fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); + } + } else if (cent_mult_value <= CentMultBins[7]) { + // PairWithCentMultKtRegistry->fill(HIST("mult_6_7/q3D"), qout_value, qside_value, qlong_value); + if (Use3D) { + auto histMultFolder = HIST("mult_6_7/"); + fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); + } + } else if (cent_mult_value <= CentMultBins[8]) { + // PairWithCentMultKtRegistry->fill(HIST("mult_7_8/q3D"), qout_value, qside_value, qlong_value); + if (Use3D) { + auto histMultFolder = HIST("mult_7_8/"); + fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); + } + } else if (cent_mult_value <= CentMultBins[9]) { + // PairWithCentMultKtRegistry->fill(HIST("mult_8_9/q3D"), qout_value, qside_value, qlong_value); + if (Use3D) { + auto histMultFolder = HIST("mult_8_9/"); + fill_kT_3d(qout_value, qside_value, qlong_value, kt_value, histMultFolder); + } + } + } + + /// @brief + /// @tparam t1 + /// @tparam t2 + /// @param qout_value + /// @param qside_value + /// @param qlong_value + /// @param folder + template + void fill_kT_3d(t1 qout_value, t1 qside_value, t1 qlong_value, t1 kt_value, t2 folder) + { + if (kt_value <= KtBins[1]) { + PairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_0_1"), qout_value, qside_value, qlong_value); + } else if (kt_value <= KtBins[2]) { + PairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_1_2"), qout_value, qside_value, qlong_value); + } else if (kt_value <= KtBins[3]) { + PairWithCentMultKtRegistry->fill(folder + HIST("q3D_kt_2_3"), qout_value, qside_value, qlong_value); + } + } + protected: HistogramRegistry* PairWithCentMultKtRegistry = nullptr; std::vector CentMultBins; std::vector KtBins; bool UseKt = false; + bool Use3D = false; static constexpr std::string_view HistSuffix[10] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}; }; } // namespace o2::analysis::femtoUniverse diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx index 03456e25d87..6590ce32056 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx @@ -47,7 +47,7 @@ using namespace o2::framework::expressions; namespace o2::aod { -using FemtoFullCollisionMC = soa::Join::iterator; +using FemtoFullCollisionMC = soa::Join::iterator; } // namespace o2::aod @@ -98,6 +98,8 @@ struct femtoUniverseProducerMCTruthTask { Configurable ConfEvtTriggerCheck{"ConfEvtTriggerCheck", true, "Evt sel: check for trigger"}; Configurable ConfEvtTriggerSel{"ConfEvtTriggerSel", kINT7, "Evt sel: trigger"}; Configurable ConfEvtOfflineCheck{"ConfEvtOfflineCheck", false, "Evt sel: check for offline selection"}; + Configurable ConfCentFT0Min{"ConfCentFT0Min", 0.f, "Min CentFT0 value for centrality selection"}; + Configurable ConfCentFT0Max{"ConfCentFT0Max", 200.f, "Max CentFT0 value for centrality selection"}; // Track cuts struct : o2::framework::ConfigurableGroup { @@ -116,7 +118,7 @@ struct femtoUniverseProducerMCTruthTask { LOGF(fatal, "Neither processFullData nor processFullMC enabled. Please choose one."); } - colCuts.setCuts(ConfEvtZvtx, ConfEvtTriggerCheck, ConfEvtTriggerSel, ConfEvtOfflineCheck, ConfIsRun3); + colCuts.setCuts(ConfEvtZvtx, ConfEvtTriggerCheck, ConfEvtTriggerSel, ConfEvtOfflineCheck, ConfIsRun3, ConfCentFT0Min, ConfCentFT0Max); colCuts.init(&qaRegistry); trackCuts.init(&qaRegistry); diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerReducedTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerReducedTask.cxx index fe46d7509ba..658b70b2367 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerReducedTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerReducedTask.cxx @@ -48,10 +48,12 @@ namespace o2::aod using FemtoFullCollision = soa::Join::iterator; + aod::Mults, + aod::CentFT0Cs>::iterator; using FemtoFullCollisionMC = soa::Join::iterator; using FemtoFullTracks = soa::Join ConfEvtTriggerCheck{"ConfEvtTriggerCheck", true, "Evt sel: check for trigger"}; Configurable ConfEvtTriggerSel{"ConfEvtTriggerSel", kINT7, "Evt sel: trigger"}; Configurable ConfEvtOfflineCheck{"ConfEvtOfflineCheck", false, "Evt sel: check for offline selection"}; + Configurable ConfCentFT0Min{"ConfCentFT0Min", 0.f, "Min CentFT0 value for centrality selection"}; + Configurable ConfCentFT0Max{"ConfCentFT0Max", 200.f, "Max CentFT0 value for centrality selection"}; Configurable ConfRejectNotPropagatedTracks{"ConfRejectNotPropagatedTracks", false, "True: reject not propagated tracks"}; Configurable ConfRejectITSHitandTOFMissing{"ConfRejectITSHitandTOFMissing", false, "True: reject if neither ITS hit nor TOF timing satisfied"}; @@ -116,7 +120,7 @@ struct femtoUniverseProducerReducedTask { void init(InitContext&) { - colCuts.setCuts(ConfEvtZvtx, ConfEvtTriggerCheck, ConfEvtTriggerSel, ConfEvtOfflineCheck, ConfIsRun3); + colCuts.setCuts(ConfEvtZvtx, ConfEvtTriggerCheck, ConfEvtTriggerSel, ConfEvtOfflineCheck, ConfIsRun3, ConfCentFT0Min, ConfCentFT0Max); colCuts.init(&qaRegistry); trackCuts.setSelection(ConfTrkCharge, femtoUniverseTrackSelection::kSign, femtoUniverseSelection::kEqual); diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 838567876fb..bb61a42151a 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -55,12 +55,12 @@ namespace o2::aod { using FemtoFullCollision = - soa::Join::iterator; + soa::Join::iterator; using FemtoFullCollisionCentRun2 = - soa::Join::iterator; + soa::Join::iterator; using FemtoFullCollisionCentRun3 = soa::Join::iterator; -using FemtoFullCollisionMC = soa::Join::iterator; +using FemtoFullCollisionMC = soa::Join::iterator; using FemtoFullTracks = soa::Join>::iterator const& col, + processTrackCentRun3Data(aod::FemtoFullCollisionCentRun3 const& col, aod::BCsWithTimestamps const&, aod::FemtoFullTracks const& tracks) { diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTaskV0Only.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTaskV0Only.cxx index c4cc6a67835..f72e1324c0c 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTaskV0Only.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTaskV0Only.cxx @@ -44,7 +44,7 @@ namespace o2::aod { using FemtoFullCollision = - soa::Join::iterator; + soa::Join::iterator; using FemtoFullTracks = soa::Join ConfEvtTriggerCheck{"ConfEvtTriggerCheck", true, "Evt sel: check for trigger"}; Configurable ConfEvtTriggerSel{"ConfEvtTriggerSel", kINT7, "Evt sel: trigger"}; Configurable ConfEvtOfflineCheck{"ConfEvtOfflineCheck", false, "Evt sel: check for offline selection"}; + Configurable ConfCentFT0Min{"ConfCentFT0Min", 0.f, "Min CentFT0 value for centrality selection"}; + Configurable ConfCentFT0Max{"ConfCentFT0Max", 200.f, "Max CentFT0 value for centrality selection"}; Configurable ConfStoreV0{"ConfStoreV0", true, "True: store V0 table"}; // just sanity check to make sure in case there are problems in conversion or @@ -215,7 +217,7 @@ struct femtoUniverseProducerTaskV0Only { void init(InitContext&) { colCuts.setCuts(ConfEvtZvtx, ConfEvtTriggerCheck, ConfEvtTriggerSel, - ConfEvtOfflineCheck, ConfIsRun3); + ConfEvtOfflineCheck, ConfIsRun3, ConfCentFT0Min, ConfCentFT0Max); colCuts.init(&qaRegistry); /// \todo fix how to pass array to setSelection, getRow() passing a diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx index a1cdd4312a9..45598235207 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx @@ -143,8 +143,8 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { /// Correlation part ConfigurableAxis ConfMultBins{"ConfMultBins", {VARIABLE_WIDTH, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f, 24.0f, 28.0f, 32.0f, 36.0f, 40.0f, 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 68.0f, 72.0f, 76.0f, 80.0f, 84.0f, 88.0f, 92.0f, 96.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity or centrality"}; // \todo to be obtained from the hash task - ConfigurableAxis ConfMultKstarBins{"ConfMultKstarBins", {VARIABLE_WIDTH, 0.0f, 13.0f, 20.0f, 30.0f, 40.0f, 50.0f, 100.0f, 99999.f}, "Bins for kstar analysis in multiplicity or centrality bins (10 is maximum)"}; - ConfigurableAxis ConfKtKstarBins{"ConfKtKstarBins", {VARIABLE_WIDTH, 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f, 2.0f, 99999.f}, "Bins for kstar analysis in kT bins (10 is maximum)"}; + ConfigurableAxis ConfMultKstarBins{"ConfMultKstarBins", {VARIABLE_WIDTH, 0.0f, 200.0f}, "Bins for kstar analysis in multiplicity or centrality bins (10 is maximum)"}; + ConfigurableAxis ConfKtKstarBins{"ConfKtKstarBins", {VARIABLE_WIDTH, 0.1f, 0.2f, 0.3f, 0.4f}, "Bins for kstar analysis in kT bins"}; ConfigurableAxis ConfVtxBins{"ConfVtxBins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; ConfigurableAxis ConfmTBins3D{"ConfmTBins3D", {VARIABLE_WIDTH, 1.02f, 1.14f, 1.20f, 1.26f, 1.38f, 1.56f, 1.86f, 4.50f}, "mT Binning for the 3Dimensional plot: k* vs multiplicity vs mT (set <> to true in order to use)"}; @@ -169,6 +169,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { Configurable cfgProcessMM{"cfgProcessMM", true, "Process particles of the same, positice charge"}; Configurable cfgProcessMultBins{"cfgProcessMultBins", true, "Process kstar histograms in multiplicity bins (in multiplicity bins)"}; Configurable cfgProcessKtBins{"cfgProcessKtBins", true, "Process kstar histograms in kT bins (if cfgProcessMultBins is set false, this will not be processed regardless this Configurable state)"}; + Configurable cfgProcessKtMt3DCF{"cfgProcessKtMt3DCF", false, "Process 3D histograms in kT and Mult bins"}; FemtoUniverse3DContainer sameEventCont; FemtoUniverse3DContainer mixedEventCont; @@ -359,8 +360,8 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { mixedEventCont.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); if (cfgProcessMultBins) { - sameEventMultCont.init(&SameMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); - mixedEventMultCont.init(&MixedMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); + sameEventMultCont.init(&SameMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + mixedEventMultCont.init(&MixedMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); } } @@ -371,8 +372,8 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { mixedEventContPP.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); if (cfgProcessMultBins) { - sameEventMultContPP.init(&SameMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); - mixedEventMultContPP.init(&MixedMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); + sameEventMultContPP.init(&SameMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + mixedEventMultContPP.init(&MixedMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); } } @@ -383,8 +384,8 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { mixedEventContMM.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); if (cfgProcessMultBins) { - sameEventMultContMM.init(&SameMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); - mixedEventMultContMM.init(&MixedMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); + sameEventMultContMM.init(&SameMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + mixedEventMultContMM.init(&MixedMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); } } @@ -462,12 +463,11 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { continue; } - float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass2); float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); - sameEventCont.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden, ConfIsLCMS); + std::vector k3d = FemtoUniverseMath::getpairmom3d(p1, mass1, p2, mass2, ConfIsIden, ConfIsLCMS); if (cfgProcessMultBins) - sameEventMultCont.fill(kstar, multCol, kT); + sameEventMultCont.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); } } else { /// Now build the combinations for identical particles pairs @@ -496,31 +496,34 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { switch (ContType) { case 2: { - float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass1); - float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass1); + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + std::vector k3d; rand = randgen->Rndm(); if (rand > 0.5) { sameEventContPP.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden, ConfIsLCMS); + k3d = FemtoUniverseMath::getpairmom3d(p1, mass1, p2, mass2, ConfIsIden, ConfIsLCMS); } else { sameEventContPP.setPair(p2, p1, multCol, twotracksconfigs.ConfUse3D, ConfIsIden, ConfIsLCMS); + k3d = FemtoUniverseMath::getpairmom3d(p2, mass2, p1, mass1, ConfIsIden, ConfIsLCMS); } if (cfgProcessMultBins) - sameEventMultContPP.fill(kstar, multCol, kT); + sameEventMultContPP.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); break; } case 3: { - float kstar = FemtoUniverseMath::getkstar(p1, mass2, p2, mass2); - float kT = FemtoUniverseMath::getkT(p1, mass2, p2, mass2); - + float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); + std::vector k3d; rand = randgen->Rndm(); if (rand > 0.5) { sameEventContMM.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden, ConfIsLCMS); + k3d = FemtoUniverseMath::getpairmom3d(p1, mass1, p2, mass2, ConfIsIden, ConfIsLCMS); } else { sameEventContMM.setPair(p2, p1, multCol, twotracksconfigs.ConfUse3D, ConfIsIden, ConfIsLCMS); + k3d = FemtoUniverseMath::getpairmom3d(p2, mass2, p1, mass1, ConfIsIden, ConfIsLCMS); } if (cfgProcessMultBins) - sameEventMultContMM.fill(kstar, multCol, kT); + sameEventMultContMM.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); break; } default: @@ -616,28 +619,28 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { switch (ContType) { case 1: { - float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass2); float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2); mixedEventCont.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden, ConfIsLCMS); + std::vector k3d = FemtoUniverseMath::getpairmom3d(p1, mass1, p2, mass2, ConfIsIden, ConfIsLCMS); if (cfgProcessMultBins) - mixedEventMultCont.fill(kstar, multCol, kT); + mixedEventMultCont.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); break; } case 2: { - float kstar = FemtoUniverseMath::getkstar(p1, mass1, p2, mass1); float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass1); mixedEventContPP.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden, ConfIsLCMS); + std::vector k3d = FemtoUniverseMath::getpairmom3d(p1, mass1, p2, mass2, ConfIsIden, ConfIsLCMS); if (cfgProcessMultBins) - mixedEventMultContPP.fill(kstar, multCol, kT); + mixedEventMultContPP.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); break; } case 3: { - float kstar = FemtoUniverseMath::getkstar(p1, mass2, p2, mass2); float kT = FemtoUniverseMath::getkT(p1, mass2, p2, mass2); mixedEventContMM.setPair(p1, p2, multCol, twotracksconfigs.ConfUse3D, ConfIsIden, ConfIsLCMS); + std::vector k3d = FemtoUniverseMath::getpairmom3d(p1, mass1, p2, mass2, ConfIsIden, ConfIsLCMS); if (cfgProcessMultBins) - mixedEventMultContMM.fill(kstar, multCol, kT); + mixedEventMultContMM.fill_3D(k3d[1], k3d[2], k3d[3], multCol, kT); break; } default: diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx index a264835b731..508ce7dbdf2 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx @@ -170,6 +170,7 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { Configurable cfgProcessMM{"cfgProcessMM", true, "Process particles of the same, positice charge"}; Configurable cfgProcessMultBins{"cfgProcessMultBins", true, "Process kstar histograms in multiplicity bins (in multiplicity bins)"}; Configurable cfgProcessKtBins{"cfgProcessKtBins", true, "Process kstar histograms in kT bins (if cfgProcessMultBins is set false, this will not be processed regardless this Configurable state)"}; + Configurable cfgProcessKtMt3DCF{"cfgProcessKtMt3DCF", false, "Process 3D histograms in kT and Mult bins"}; FemtoUniverseFemtoContainer sameEventCont; FemtoUniverseFemtoContainer mixedEventCont; @@ -360,8 +361,8 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { mixedEventCont.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); if (cfgProcessMultBins) { - sameEventMultCont.init(&SameMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); - mixedEventMultCont.init(&MixedMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); + sameEventMultCont.init(&SameMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + mixedEventMultCont.init(&MixedMultRegistryPM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); } } @@ -372,8 +373,8 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { mixedEventContPP.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); if (cfgProcessMultBins) { - sameEventMultContPP.init(&SameMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); - mixedEventMultContPP.init(&MixedMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); + sameEventMultContPP.init(&SameMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + mixedEventMultContPP.init(&MixedMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); } } @@ -384,8 +385,8 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { mixedEventContMM.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); if (cfgProcessMultBins) { - sameEventMultContMM.init(&SameMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); - mixedEventMultContMM.init(&MixedMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins); + sameEventMultContMM.init(&SameMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); + mixedEventMultContMM.init(&MixedMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF); } } From 7e0111a14ab35331a362815ae82a9d5fb52b16da Mon Sep 17 00:00:00 2001 From: Mario Ciacco Date: Tue, 30 Jan 2024 22:02:21 +0100 Subject: [PATCH 11/33] check secondary efficiency + add eta axis (#4524) * check secondary efficiency + add eta axis * Please consider the following formatting changes * add binomially test with tag-and-probe --------- Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/QC/efficiencyQA.cxx | 113 +++++++++++++++++++++++++------- 1 file changed, 89 insertions(+), 24 deletions(-) diff --git a/PWGLF/Tasks/QC/efficiencyQA.cxx b/PWGLF/Tasks/QC/efficiencyQA.cxx index dc77953f874..ea0978994f0 100644 --- a/PWGLF/Tasks/QC/efficiencyQA.cxx +++ b/PWGLF/Tasks/QC/efficiencyQA.cxx @@ -41,13 +41,14 @@ using SelCollisions = soa::Join; namespace { const float piMass = o2::constants::physics::MassPionCharged; -std::shared_ptr hPiRec; -std::shared_ptr hPiRecMass; +std::shared_ptr hPiRec; +std::shared_ptr hPiRecMass; std::shared_ptr hTagCuts; std::shared_ptr hTpcSegment; std::shared_ptr hPtRes; std::shared_ptr hEtaRes; std::shared_ptr hPhiRes; +std::shared_ptr hPiRecSec; float invMass2Body(std::array& momA, std::array const& momB, std::array const& momC, float const& massB, float const& massC) { float p2B = momB[0] * momB[0] + momB[1] * momB[1] + momB[2] * momB[2]; @@ -147,6 +148,8 @@ struct efficiencyQA { ConfigurableAxis collIdResAxis{"collIdResAxis", {1.e2, -50., 50.}, "binning for the collision ID resolution"}; ConfigurableAxis timeResAxis{"timeResAxis", {1000, -50., 50.}, "binning for the collision ID resolution"}; + ConfigurableAxis nGenRecAxis{"nGenRecAxis", {20, 0, 20}, "binning for the detector response matrix axis"}; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; int mRunNumber; @@ -166,17 +169,20 @@ struct efficiencyQA { ccdb->setFatalWhenNull(false); histos.add("zVtx", ";#it{z}_{vtx} (cm);Entries", HistType::kTH1F, {zVtxAxis}); - hPiRec = histos.add("piRec", ";;#it{p}_{T} (GeV/#it{c});Entries", HistType::kTH2F, {recAxis, ptAxis}); + hPiRec = histos.add("piRec", ";;#it{p}_{T} (GeV/#it{c});#it{#eta}", HistType::kTH3F, {recAxis, ptAxis, etaAxis}); std::string binLabels[]{"Decays", "ITS", "ITS only", "TPC", "TPC only", "ITS+TPC", "TPC+TOF", " "}; for (int iB{0}; iB < hPiRec->GetNbinsX(); ++iB) { hPiRec->GetXaxis()->SetBinLabel(iB + 1, binLabels[iB].data()); } if (doprocessMcTracks) { + hPiRecSec = histos.add("piRecSec", ";;#it{p}_{T} (GeV/#it{c});#it{#eta}", HistType::kTH3F, {recAxis, ptAxis, etaAxis}); hPiRec->GetXaxis()->SetBinLabel(1, "Generated"); + hPiRecSec->GetXaxis()->SetBinLabel(1, "Generated"); hPtRes = histos.add("ptRes", ";;#it{p}_{T}^{rec} (GeV/#it{c});#it{p}_{T}^{rec} - #it{p}_{T}^{MC} (GeV/#it{c})", HistType::kTH3F, {recAxis, ptAxis, ptResAxis}); hEtaRes = histos.add("etaRes", ";;#it{p}_{T}^{rec} (GeV/#it{c});#eta^{rec} - #eta^{MC} (rad)", HistType::kTH3F, {recAxis, ptAxis, etaResAxis}); hPhiRes = histos.add("phiRes", ";;#it{p}_{T}^{rec} (GeV/#it{c});#phi^{rec} - #phi^{MC} (rad)", HistType::kTH3F, {recAxis, ptAxis, phiResAxis}); for (int iB{1}; iB < hPtRes->GetNbinsX(); ++iB) { + hPiRecSec->GetXaxis()->SetBinLabel(iB + 1, binLabels[iB].data()); hPtRes->GetXaxis()->SetBinLabel(iB + 1, binLabels[iB].data()); hEtaRes->GetXaxis()->SetBinLabel(iB + 1, binLabels[iB].data()); hPhiRes->GetXaxis()->SetBinLabel(iB + 1, binLabels[iB].data()); @@ -203,7 +209,7 @@ struct efficiencyQA { fitter.setMatCorrType(static_cast(mat)); histos.add("massV0", ";#it{M}(#pi^{+} + #pi^{-}) (GeV/#it{c}^{2});Entries", HistType::kTH1F, {massK0sAxis}); - hPiRecMass = histos.add("piRecMass", ";;#it{p}_{T} (GeV/#it{c});#it{M}(#pi^{+} + #pi^{-}) (GeV/#it{c}^{2})", HistType::kTH3F, {recAxis, ptAxis, massK0sAxis}); + hPiRecMass = histos.add("piRecMass", ";;#it{p}_{T} (GeV/#it{c});#it{#eta};#it{M}(#pi^{+} + #pi^{-}) (GeV/#it{c}^{2})", HistType::kTHnSparseF, {recAxis, ptAxis, etaAxis, massK0sAxis}); hTagCuts = histos.add("tagCuts", ";;#it{p}_{T} (GeV/#it{c})", HistType::kTH2F, {recAxis, ptAxis}); histos.add("massTagTpc", ";#it{p} (GeV/#it{c});#it{M}(#pi^{+} + #pi^{-}) (GeV/#it{c}^{2})", HistType::kTH2F, {ptAxis, massK0sAxis}); @@ -215,10 +221,10 @@ struct efficiencyQA { for (int iB{0}; iB < hTagCuts->GetNbinsX(); ++iB) { hTagCuts->GetXaxis()->SetBinLabel(iB + 1, binLabelsTag[iB].data()); } - for (int iB{0}; iB < hPiRecMass->GetNbinsX(); ++iB) { - hPiRecMass->GetXaxis()->SetBinLabel(iB + 1, binLabels[iB].data()); + for (int iB{0}; iB < hPiRecMass->GetAxis(0)->GetNbins(); ++iB) { + hPiRecMass->GetAxis(0)->SetBinLabel(iB + 1, binLabels[iB].data()); } - hPiRecMass->GetXaxis()->SetBinLabel(8, "ITS w/ TPC leg"); + hPiRecMass->GetAxis(0)->SetBinLabel(8, "ITS w/ TPC leg"); if (doprocessTagAndProbeMC) { std::string binLabelsTpc[]{"hasTPCsegment", "foundTPCsegment", "allFoundTPCsegment", "foundTPCsegment (w/ fake)"}; @@ -238,6 +244,8 @@ struct efficiencyQA { histos.add("collTpcV0", ";ID_{coll}^{TPC} - ID_{coll}^{V0};Entries", HistType::kTH1F, {collIdResAxis}); histos.add("timeTpcIts", ";(#it{t}^{TPC} - #it{t}^{ITS}) / #sigma (a.u.);Entries", HistType::kTH1F, {timeResAxis}); } + + histos.add("detRespMatrix", ";#it{N}_{gen};#it{N}_{rec}", HistType::kTH2F, {nGenRecAxis, nGenRecAxis}); } } @@ -302,9 +310,35 @@ struct efficiencyQA { } } + template + void fillHistTrack(T const& track, std::shared_ptr hist, float const& y, float const& z = 1, float const& t = 1) + { + bool itsAccept = !(track.itsChi2NCl() > 36. || track.itsNCls() < 4); + bool tpcAccept = !(track.tpcCrossedRowsOverFindableCls() < 0.8 || track.tpcNClsCrossedRows() < 70 || track.tpcChi2NCl() > 4. || track.tpcNClsFound() < 90); + if (track.hasITS()) { + hist->Fill(std::array{1., y, z, t}.data()); + } + if (track.hasITS() && itsAccept && !track.hasTPC()) { + hist->Fill(std::array{2., y, z, t}.data()); + } + if (track.hasTPC() && tpcAccept) { + hist->Fill(std::array{3., y, z, t}.data()); + if (!track.hasITS()) { + hist->Fill(std::array{4., y, z, t}.data()); + } + if (track.hasITS() && itsAccept) { + hist->Fill(std::array{5., y, z, t}.data()); + } + if (track.hasTOF() && !track.hasITS()) { + hist->Fill(std::array{6., y, z, t}.data()); + } + } + } + template void fillTagAndProbe(SelCollisions::iterator const& collision, aod::V0s const& V0s, TracksFull const& tracks, SelCollisions const&) { + float nGenRec[]{0.f, 0.f}; auto tpcTracks = useTpcTracksFromSameColl ? tracks.sliceBy(perCollisionTracks, collision.globalIndex()) : tracks; for (auto& v0 : V0s) { auto posTrack = v0.posTrack_as(); @@ -415,8 +449,11 @@ struct efficiencyQA { histos.fill(HIST("massV0"), massV0); + nGenRec[0] += 1.f; + auto trackPt = probeTrack.sign() * std::hypot(momProbe[0], momProbe[1]); auto trackP = probeTrack.sign() * std::hypot(trackPt, momProbe[2]); + auto trackEta = probeTrackCov.getEta(); ProbeTrack probe; probe.globalIndex = probeTrack.globalIndex(); @@ -554,20 +591,26 @@ struct efficiencyQA { } } - hPiRecMass->Fill(0., trackPt, massV0); + hPiRecMass->Fill(0., trackPt, trackEta, massV0); if (probe.globalIndexTpc > 0) { - hPiRecMass->Fill(7., trackPt, massV0); + hPiRecMass->Fill(7., trackPt, trackEta, massV0); } - fillHistTrack(probeTrack, hPiRecMass, trackPt, massV0); + fillHistTrack(probeTrack, hPiRecMass, trackPt, trackEta, massV0); if (std::abs(massV0 - o2::constants::physics::MassKaonNeutral) < massMax) { probeTracks.push_back(probe); - hPiRec->Fill(0., trackPt); - fillHistTrack(probeTrack, hPiRec, trackPt); + hPiRec->Fill(0., trackPt, trackEta); + fillHistTrack(probeTrack, hPiRec, trackPt, trackEta); if (probe.globalIndexTpc > 0) { - hPiRec->Fill(7., trackPt); + hPiRec->Fill(7., trackPt, trackEta); + } + bool itsAccept = !(probeTrack.itsChi2NCl() > 36. || probeTrack.itsNCls() < 4); + bool tpcAccept = !(probeTrack.tpcCrossedRowsOverFindableCls() < 0.8 || probeTrack.tpcNClsCrossedRows() < 70 || probeTrack.tpcChi2NCl() > 4. || probeTrack.tpcNClsFound() < 90); + if (probeTrack.hasITS() && probeTrack.hasTPC() && itsAccept && tpcAccept) { + nGenRec[1] += 1.f; } } } + histos.fill(HIST("detRespMatrix"), nGenRec[0], nGenRec[1]); } void fillProbeMC(SelCollisions::iterator const& collision, TracksFull const& tracks, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC, SelCollisions const&) @@ -768,9 +811,6 @@ struct efficiencyQA { if (std::abs(mcTrack.pdgCode()) != 211) { continue; } - if (!mcTrack.isPhysicalPrimary()) { - continue; - } const o2::math_utils::Point3D collVtx{collision.posX(), collision.posY(), collision.posZ()}; auto trackParCov = getTrackParCov(track); @@ -778,11 +818,25 @@ struct efficiencyQA { o2::base::Propagator::Instance()->propagateToDCA(collVtx, trackParCov, d_bz, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfo); auto trackPt = track.sign() * trackParCov.getPt(); - fillHistTrack(track, hPiRec, trackPt); - - fillHistTrack(track, hPtRes, track.sign() * trackParCov.getPt(), trackParCov.getPt() - mcTrack.pt()); - fillHistTrack(track, hEtaRes, track.sign() * trackParCov.getPt(), trackParCov.getEta() - mcTrack.eta()); - fillHistTrack(track, hPhiRes, track.sign() * trackParCov.getPt(), trackParCov.getPhi() - mcTrack.phi()); + auto trackEta = trackParCov.getEta(); + if (mcTrack.isPhysicalPrimary()) { + fillHistTrack(track, hPiRec, trackPt, trackEta); + fillHistTrack(track, hPtRes, track.sign() * trackParCov.getPt(), trackParCov.getPt() - mcTrack.pt()); + fillHistTrack(track, hEtaRes, track.sign() * trackParCov.getPt(), trackParCov.getEta() - mcTrack.eta()); + fillHistTrack(track, hPhiRes, track.sign() * trackParCov.getPt(), trackParCov.getPhi() - mcTrack.phi()); + } else { + for (auto& mother : mcTrack.template mothers_as()) { + if (mother.pdgCode() != 310) { + continue; + } + auto radius = std::hypot(mcTrack.vx(), mcTrack.vy()); + if (radius > v0radiusMax) { + continue; + } + fillHistTrack(track, hPiRecSec, trackPt, trackEta); + break; + } + } } } } @@ -795,10 +849,21 @@ struct efficiencyQA { if (std::abs(pdgCode) != 211) { continue; } - if (!partMC.isPhysicalPrimary()) { - continue; + if (partMC.isPhysicalPrimary()) { + hPiRec->Fill(0., pdgCode / std::abs(pdgCode) * partMC.pt(), partMC.eta()); + } else { + for (auto& mother : partMC.template mothers_as()) { + if (mother.pdgCode() != 310) { + continue; + } + auto radius = std::hypot(partMC.vx(), partMC.vy()); + if (radius > v0radiusMax) { + continue; + } + hPiRecSec->Fill(0., pdgCode / std::abs(pdgCode) * partMC.pt(), partMC.eta()); + break; + } } - hPiRec->Fill(0., pdgCode / std::abs(pdgCode) * partMC.pt()); } } PROCESS_SWITCH(efficiencyQA, processMcTracks, "MC tracks analysis", false); From b64cdd7354cefb6257ff1c3e98656a392c87ffe9 Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Tue, 30 Jan 2024 22:20:35 +0100 Subject: [PATCH 12/33] PWGHF: add Lc ML scores in Sc output. (#4523) * Add Lc ML scores in Sc output. * Fix comment. * Fixe template name and fill BDT score only if non-empty. --------- Co-authored-by: Mattia Faggin --- PWGHF/D2H/Tasks/taskSigmac.cxx | 282 ++++++++++++++++++++++++++++----- 1 file changed, 241 insertions(+), 41 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskSigmac.cxx b/PWGHF/D2H/Tasks/taskSigmac.cxx index 5ff2edd58f3..6701c87880c 100644 --- a/PWGHF/D2H/Tasks/taskSigmac.cxx +++ b/PWGHF/D2H/Tasks/taskSigmac.cxx @@ -48,6 +48,8 @@ struct HfTaskSigmac { ConfigurableAxis thnConfigAxisCPAXY{"thnConfigAxisCPAXY", {20, 0.8, 1}, ""}; ConfigurableAxis configAxisMassLambdaC{"configAxisMassLambdaC", {600, 1.98, 2.58}, ""}; ConfigurableAxis configAxisDeltaMassSigmaC{"configAxisDeltaMassSigmaC", {200, 0.13, 0.23}, ""}; + ConfigurableAxis thnConfigAxisBdtScoreLcBkg{"thnConfigAxisBdtScoreLcBkg", {100, 0., 1.}, ""}; + ConfigurableAxis thnConfigAxisBdtScoreLcNonPrompt{"thnConfigAxisBdtScoreLcNonPrompt", {100, 0., 1.}, ""}; HfHelper hfHelper; @@ -96,11 +98,39 @@ struct HfTaskSigmac { using RecoLc = soa::Join; + bool isMc; + /// @brief init function, to define the additional analysis histograms /// @param void init(InitContext&) { + /// To be considered in the future, let's keep the possibility to run in MC also with "data-like" mode (just for TH1 objects) + // std::array processes {doprocessDataWoMl, doprocessDataWithMl, doprocessMcWoMl, doprocessMcWithMl}; + // if( std::accumulate(processes.begin(), processes.end(), 0) != 1 ) { + // LOG(fatal) << "One and only one process function must be enabled. Fix it!"; + // } + + // avoid 2 enabled process functions on data + if (doprocessDataWoMl && doprocessDataWithMl) { + LOG(fatal) << "processDataWoMl and processDataWithMl both enabled. Fix it!"; + } + // avoid 2 enabled process functions on MC + if (doprocessMcWoMl && doprocessMcWithMl) { + LOG(fatal) << "processMcWoMl and processMcWithMl both enabled. Fix it!"; + } + // avoid that in data no ML is used while in MC yes, and viceversa + if ((doprocessDataWithMl && doprocessMcWoMl) || (doprocessDataWoMl && doprocessMcWithMl)) { + LOG(fatal) << "process functions with and w/o ML enabled not consistently between data and MC. Fix it! processDataWoMl: " << doprocessDataWoMl << "processDataWithMl: " << doprocessDataWithMl << "processMcWoMl: " << doprocessMcWoMl << "processMcWithMl: " << doprocessMcWithMl; + } + + /// establish if the analysis is done on Data or MC + if (doprocessMcWoMl || doprocessMcWithMl) { + isMc = true; + } else { + isMc = false; + } + const AxisSpec axisDeltaMassSigmaC{configAxisDeltaMassSigmaC, "#it{M}(pK#pi#pi) - #it{M}(pK#pi) (GeV/#it{c}^{2})"}; registry.add("Data/hDeltaMassSc0", "#Sigma_{c}^{0} candidates; #it{M}(pK#pi#pi) - #it{M}(pK#pi) (GeV/#it{c}^{2}); #it{p}_{T}(#Sigma_{c}^{0}) (GeV/#it{c});", {HistType::kTH2D, {axisDeltaMassSigmaC, {36, 0., 36.}}}); registry.add("Data/hDeltaMassScPlusPlus", "#Sigma_{c}^{++} candidates; #it{M}(pK#pi#pi) - #it{M}(pK#pi) (GeV/#it{c}^{2}); #it{p}_{T}(#Sigma_{c}^{++}) (GeV/#it{c});", {HistType::kTH2D, {axisDeltaMassSigmaC, {36, 0., 36.}}}); @@ -108,7 +138,7 @@ struct HfTaskSigmac { registry.add("Data/hDeltaMassLcFromSc0", "#Lambda_{c}^{+} #leftarrow #Sigma_{c}^{0} candidates; #it{M}(pK#pi#pi) - #it{M}(pK#pi) (GeV/#it{c}^{2}); #it{p}_{T}(#Lambda_{c}^{+} #leftarrow #Sigma_{c}^{0}) (GeV/#it{c});", {HistType::kTH2D, {axisDeltaMassSigmaC, {36, 0., 36.}}}); registry.add("Data/hDeltaMassLcFromScPlusPlus", "#Lambda_{c}^{+} #leftarrow #Sigma_{c}^{++} candidates; #it{M}(pK#pi#pi) - #it{M}(pK#pi) (GeV/#it{c}^{2}); #it{p}_{T}(#Lambda_{c}^{+} #leftarrow #Sigma_{c}^{++}) (GeV/#it{c});", {HistType::kTH2D, {axisDeltaMassSigmaC, {36, 0., 36.}}}); registry.add("Data/hDeltaMassLcFromSc0PlusPlus", "#Lambda_{c}^{+} #leftarrow #Sigma_{c}^{0,++} candidates; #it{M}(pK#pi#pi) - #it{M}(pK#pi) (GeV/#it{c}^{2}); #it{p}_{T}(#Lambda_{c}^{+} #leftarrow #Sigma_{c}^{0,++}) (GeV/#it{c});", {HistType::kTH2D, {axisDeltaMassSigmaC, {36, 0., 36.}}}); - if (doprocessMc) { + if (isMc) { ///////////////////// /// Generated /// ///////////////////// @@ -223,8 +253,15 @@ struct HfTaskSigmac { const AxisSpec thnAxisOriginMc{3, -0.5, 2.5, "0: none, 1: prompt, 2: non-prompt"}; const AxisSpec thnAxisChargeSigmaC{3, -0.5, 2.5, "#Sigma_{c}-baryon charge"}; const AxisSpec thnAxisChannel{4, -0.5, 3.5, "0: direct 1,2,3: resonant"}; - registry.add("hnLambdaC", "THn for Lambdac", HistType::kTHnSparseF, {thnAxisPtLambdaC, thnAxisMassLambdaC, thnAxisDecLength, thnAxisDecLengthXY, thnAxisCPA, thnAxisCPAXY, thnAxisOriginMc, thnAxisChannel}); - registry.add("hnSigmaC", "THn for Sigmac", HistType::kTHnSparseF, {thnAxisPtLambdaC, axisDeltaMassSigmaC, thnAxisDecLength, thnAxisDecLengthXY, thnAxisCPA, thnAxisCPAXY, thnAxisOriginMc, thnAxisChannel, thnAxisPtSigmaC, thnAxisChargeSigmaC}); + const AxisSpec thnAxisBdtScoreLcBkg{thnConfigAxisBdtScoreLcBkg, "BDT bkg score (Lc)"}; + const AxisSpec thnAxisBdtScoreLcNonPrompt{thnConfigAxisBdtScoreLcNonPrompt, "BDT non-prompt score (Lc)"}; + if (doprocessDataWithMl || doprocessMcWithMl) { + registry.add("hnLambdaC", "THn for Lambdac", HistType::kTHnSparseF, {thnAxisPtLambdaC, thnAxisMassLambdaC, thnAxisBdtScoreLcBkg, thnAxisBdtScoreLcNonPrompt, thnAxisOriginMc, thnAxisChannel}); + registry.add("hnSigmaC", "THn for Sigmac", HistType::kTHnSparseF, {thnAxisPtLambdaC, axisDeltaMassSigmaC, thnAxisBdtScoreLcBkg, thnAxisBdtScoreLcNonPrompt, thnAxisOriginMc, thnAxisChannel, thnAxisPtSigmaC, thnAxisChargeSigmaC}); + } else { + registry.add("hnLambdaC", "THn for Lambdac", HistType::kTHnSparseF, {thnAxisPtLambdaC, thnAxisMassLambdaC, thnAxisDecLength, thnAxisDecLengthXY, thnAxisCPA, thnAxisCPAXY, thnAxisOriginMc, thnAxisChannel}); + registry.add("hnSigmaC", "THn for Sigmac", HistType::kTHnSparseF, {thnAxisPtLambdaC, axisDeltaMassSigmaC, thnAxisDecLength, thnAxisDecLengthXY, thnAxisCPA, thnAxisCPAXY, thnAxisOriginMc, thnAxisChannel, thnAxisPtSigmaC, thnAxisChargeSigmaC}); + } } }; /// end init @@ -250,12 +287,13 @@ struct HfTaskSigmac { return channel; /// 0: none; 1: pK-Ï€+ only; 2: Ï€+K-p only; 3: both possible } - /// @brief process function to fill the histograms needed in analysis (data) + /// @brief function to fill the histograms needed in analysis (data) /// @param candidatesSc are the reconstructed candidate Σc0,++ /// @param - void process(aod::HfCandSc const& candidatesSc, - RecoLc const& candidatesLc, - aod::Tracks const&) + template + void fillHistosData(aod::HfCandSc const& candidatesSc, + CandsLc const& candidatesLc, + aod::Tracks const&) { /// loop over the candidate Σc0,++ @@ -265,7 +303,7 @@ struct HfTaskSigmac { /// get the candidate Λc+ used to build the candidate Σc0,++ /// and understand which mass hypotheses are possible - const auto& candidateLc = candSc.prongLc_as(); + const auto& candidateLc = candSc.prongLc_as(); // const int iscandidateLcpKpi = (candidateLc.isSelLcToPKPi() >= 1) && candSc.statusSpreadLcMinvPKPiFromPDG(); // Λc+ → pK-Ï€+ and within the requested mass to build the Σc0,++ // const int iscandidateLcpiKp = (candidateLc.isSelLcToPiKP() >= 1) && candSc.statusSpreadLcMinvPiKPFromPDG(); // Λc+ → Ï€+K-p and within the requested mass to build the Σc0,++ const int isCandPKPiPiKP = isDecayToPKPiToPiKP(candidateLc, candSc); @@ -331,9 +369,21 @@ struct HfTaskSigmac { } /// THn for candidate Σc0,++ cut variation if (enableTHn) { - if (!doprocessMc) { + if (!isMc) { /// fill it only if no MC operations are enabled, otherwise fill it in the processMC with the right origin and channel! - registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, 0, 0, ptSc, std::abs(chargeSc)); + if constexpr (useMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 2: non-prompt score + std::array outputMl{-1., -1.}; + if (candidateLc.mlProbLcToPKPi().size() > 0) { + outputMl.at(0) = candidateLc.mlProbLcToPKPi()[0]; /// bkg score + outputMl.at(1) = candidateLc.mlProbLcToPKPi()[2]; /// non-prompt score + } + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, outputMl.at(0), outputMl.at(1), 0, 0, ptSc, std::abs(chargeSc)); + } else { + /// fill w/o BDT information + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, 0, 0, ptSc, std::abs(chargeSc)); + } } } } /// end candidate Λc+ → pK-Ï€+ (and charge conjugate) @@ -392,9 +442,21 @@ struct HfTaskSigmac { } /// THn for candidate Σc0,++ cut variation if (enableTHn) { - /// fill it only if no MC operations are enabled, otherwise fill it in the processMC with the right origin and channel! - if (!doprocessMc) { - registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, 0, 0, ptSc, std::abs(chargeSc)); + if (!isMc) { + /// fill it only if no MC operations are enabled, otherwise fill it in the processMC with the right origin and channel! + if constexpr (useMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 2: non-prompt score + std::array outputMl{-1., -1.}; + if (candidateLc.mlProbLcToPiKP().size() > 0) { + outputMl.at(0) = candidateLc.mlProbLcToPiKP()[0]; /// bkg score + outputMl.at(1) = candidateLc.mlProbLcToPiKP()[2]; /// non-prompt score + } + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, outputMl.at(0), outputMl.at(1), 0, 0, ptSc, std::abs(chargeSc)); + } else { + /// fill w/o BDT information + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, 0, 0, ptSc, std::abs(chargeSc)); + } } } } /// end candidate Λc+ → Ï€+K-p (and charge conjugate) @@ -403,7 +465,7 @@ struct HfTaskSigmac { /// THn for candidate Λc+ cut variation w/o Σc0,++ mass-window cut if (enableTHn) { /// fill it only if no MC operations are enabled, otherwise fill it in the processMC with the right origin and channel! - if (!doprocessMc) { + if (!isMc) { /// loop over Λc+ candidates w/o Σc0,++ mass-window cut for (const auto& candidateLc : candidatesLc) { double massLc(-1.); @@ -412,27 +474,52 @@ struct HfTaskSigmac { double cpaLc(candidateLc.cpa()), cpaXYLc(candidateLc.cpaXY()); if (candidateLc.isSelLcToPKPi() >= 1) { massLc = hfHelper.invMassLcToPKPi(candidateLc); - registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, 0, 0); + if constexpr (useMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 2: non-prompt score + std::array outputMl{-1., -1.}; + if (candidateLc.mlProbLcToPKPi().size() > 0) { + outputMl.at(0) = candidateLc.mlProbLcToPKPi()[0]; /// bkg score + outputMl.at(1) = candidateLc.mlProbLcToPKPi()[2]; /// non-prompt score + } + registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, outputMl.at(0), outputMl.at(1), 0, 0); + } else { + /// fill w/o BDT information + registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, 0, 0); + } } if (candidateLc.isSelLcToPiKP() >= 1) { massLc = hfHelper.invMassLcToPiKP(candidateLc); - registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, 0, 0); + if constexpr (useMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 2: non-prompt score + std::array outputMl{-1., -1.}; + if (candidateLc.mlProbLcToPiKP().size() > 0) { + outputMl.at(0) = candidateLc.mlProbLcToPiKP()[0]; /// bkg score + outputMl.at(1) = candidateLc.mlProbLcToPiKP()[2]; /// non-prompt score + } + registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, outputMl.at(0), outputMl.at(1), 0, 0); + } else { + /// fill w/o BDT information + registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, 0, 0); + } } } } } /// end THn for candidate Λc+ cut variation w/o Σc0,++ mass-window cut - }; /// end process + }; /// end fillHistosData - /// @brief process function to fill the histograms needed in analysis (MC) + /// @brief function to fill the histograms needed in analysis (MC) /// @param candidatesSc are the reconstructed candidate Σc0,++ with MC info /// @param mcParticles are the generated particles with flags wheter they are Σc0,++ or not /// @param - void processMc(soa::Join const& candidatesSc, - soa::Join const& mcParticlesSc, - soa::Join const& mcParticlesLc, - aod::McParticles const& mcParticles, // this establishes the type of particle obtained with the .mcParticle() getter - soa::Join const& candidatesLc, - aod::TracksWMc const&) + template + void fillHistosMc(soa::Join const& candidatesSc, + soa::Join const& mcParticlesSc, + soa::Join const& mcParticlesLc, + aod::McParticles const& mcParticles, // this establishes the type of particle obtained with the .mcParticle() getter + CandsLc const& candidatesLc, + aod::TracksWMc const&) { /// MC generated particles @@ -564,7 +651,7 @@ struct HfTaskSigmac { /// get the candidate Λc+ used to build the Σc0 /// and understand which mass hypotheses are possible - const auto& candidateLc = candSc.prongLc_as>(); + const auto& candidateLc = candSc.prongLc_as(); const int isCandPKPiPiKP = isDecayToPKPiToPiKP(candidateLc, candSc); // candidateLc.flagMcDecayChanRec(); @@ -575,7 +662,7 @@ struct HfTaskSigmac { auto indexMcScRec = RecoDecay::getMother(mcParticles, candSc.prong1_as().mcParticle(), o2::constants::physics::Pdg::kSigmaC0, true); auto particleSc = mcParticles.rawIteratorAt(indexMcScRec); // Get the corresponding MC particle for Lc - auto arrayDaughtersLc = std::array{candidateLc.prong0_as(), candidateLc.prong1_as(), candidateLc.prong2_as()}; + auto arrayDaughtersLc = std::array{candidateLc.template prong0_as(), candidateLc.template prong1_as(), candidateLc.template prong2_as()}; int8_t sign = 0; int indexMcLcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); auto particleLc = mcParticles.rawIteratorAt(indexMcLcRec); @@ -596,7 +683,7 @@ struct HfTaskSigmac { auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π± /// candidate Λc+ → pK-Ï€+ (and charge conjugate) within the range of M(pK-Ï€+) chosen in the Σc0,++ builder - if ((isCandPKPiPiKP == 1 || isCandPKPiPiKP == 3) && std::abs(candidateLc.prong0_as().mcParticle().pdgCode()) == kProton) { + if ((isCandPKPiPiKP == 1 || isCandPKPiPiKP == 3) && std::abs(candidateLc.template prong0_as().mcParticle().pdgCode()) == kProton) { massSc = hfHelper.invMassScRecoLcToPKPi(candSc, candidateLc); massLc = hfHelper.invMassLcToPKPi(candidateLc); deltaMass = massSc - massLc; @@ -653,12 +740,24 @@ struct HfTaskSigmac { /// THn for candidate Σc0,++ cut variation if (enableTHn) { - registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel, ptSc, std::abs(chargeSc)); + if constexpr (useMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 2: non-prompt score + std::array outputMl{-1., -1.}; + if (candidateLc.mlProbLcToPKPi().size() > 0) { + outputMl.at(0) = candidateLc.mlProbLcToPKPi()[0]; /// bkg score + outputMl.at(1) = candidateLc.mlProbLcToPKPi()[2]; /// non-prompt score + } + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, outputMl.at(0), outputMl.at(1), origin, channel, ptSc, std::abs(chargeSc)); + } else { + /// fill w/o BDT information + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel, ptSc, std::abs(chargeSc)); + } } } /// end candidate Λc+ → pK-Ï€+ (and charge conjugate) /// candidate Λc+ → Ï€+K-p (and charge conjugate) within the range of M(Ï€+K-p) chosen in the Σc0,++ builder - if ((isCandPKPiPiKP == 2 || isCandPKPiPiKP == 3) && std::abs(candidateLc.prong0_as().mcParticle().pdgCode()) == kPiPlus) { + if ((isCandPKPiPiKP == 2 || isCandPKPiPiKP == 3) && std::abs(candidateLc.template prong0_as().mcParticle().pdgCode()) == kPiPlus) { massSc = hfHelper.invMassScRecoLcToPiKP(candSc, candidateLc); massLc = hfHelper.invMassLcToPiKP(candidateLc); deltaMass = massSc - massLc; @@ -715,7 +814,19 @@ struct HfTaskSigmac { /// THn for candidate Σc0,++ cut variation if (enableTHn) { - registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel, ptSc, std::abs(chargeSc)); + if constexpr (useMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 2: non-prompt score + std::array outputMl{-1., -1.}; + if (candidateLc.mlProbLcToPiKP().size() > 0) { + outputMl.at(0) = candidateLc.mlProbLcToPiKP()[0]; /// bkg score + outputMl.at(1) = candidateLc.mlProbLcToPiKP()[2]; /// non-prompt score + } + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, outputMl.at(0), outputMl.at(1), origin, channel, ptSc, std::abs(chargeSc)); + } else { + /// fill w/o BDT information + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel, ptSc, std::abs(chargeSc)); + } } } /// end candidate Λc+ → Ï€+K-p (and charge conjugate) @@ -726,7 +837,7 @@ struct HfTaskSigmac { auto indexMcScRec = RecoDecay::getMother(mcParticles, candSc.prong1_as().mcParticle(), o2::constants::physics::Pdg::kSigmaCPlusPlus, true); auto particleSc = mcParticles.rawIteratorAt(indexMcScRec); // Get the corresponding MC particle for Lc - auto arrayDaughtersLc = std::array{candidateLc.prong0_as(), candidateLc.prong1_as(), candidateLc.prong2_as()}; + auto arrayDaughtersLc = std::array{candidateLc.template prong0_as(), candidateLc.template prong1_as(), candidateLc.template prong2_as()}; int8_t sign = 0; int indexMcLcRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, o2::constants::physics::Pdg::kLambdaCPlus, std::array{+kProton, -kKPlus, +kPiPlus}, true, &sign, 2); auto particleLc = mcParticles.rawIteratorAt(indexMcLcRec); @@ -747,7 +858,7 @@ struct HfTaskSigmac { auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π± /// candidate Λc+ → pK-Ï€+ (and charge conjugate) within the range of M(pK-Ï€+) chosen in the Σc0,++ builder - if ((isCandPKPiPiKP == 1 || isCandPKPiPiKP == 3) && std::abs(candidateLc.prong0_as().mcParticle().pdgCode()) == kProton) { + if ((isCandPKPiPiKP == 1 || isCandPKPiPiKP == 3) && std::abs(candidateLc.template prong0_as().mcParticle().pdgCode()) == kProton) { massSc = hfHelper.invMassScRecoLcToPKPi(candSc, candidateLc); massLc = hfHelper.invMassLcToPKPi(candidateLc); deltaMass = massSc - massLc; @@ -804,12 +915,24 @@ struct HfTaskSigmac { /// THn for candidate Σc0,++ cut variation if (enableTHn) { - registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel, ptSc, std::abs(chargeSc)); + if constexpr (useMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 2: non-prompt score + std::array outputMl{-1., -1.}; + if (candidateLc.mlProbLcToPKPi().size() > 0) { + outputMl.at(0) = candidateLc.mlProbLcToPKPi()[0]; /// bkg score + outputMl.at(1) = candidateLc.mlProbLcToPKPi()[2]; /// non-prompt score + } + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, outputMl.at(0), outputMl.at(1), origin, channel, ptSc, std::abs(chargeSc)); + } else { + /// fill w/o BDT information + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel, ptSc, std::abs(chargeSc)); + } } } /// end candidate Λc+ → pK-Ï€+ (and charge conjugate) /// candidate Λc+ → Ï€+K-p (and charge conjugate) within the range of M(Ï€+K-p) chosen in the Σc0,++ builder - if ((isCandPKPiPiKP == 2 || isCandPKPiPiKP == 3) && std::abs(candidateLc.prong0_as().mcParticle().pdgCode()) == kPiPlus) { + if ((isCandPKPiPiKP == 2 || isCandPKPiPiKP == 3) && std::abs(candidateLc.template prong0_as().mcParticle().pdgCode()) == kPiPlus) { massSc = hfHelper.invMassScRecoLcToPiKP(candSc, candidateLc); massLc = hfHelper.invMassLcToPiKP(candidateLc); deltaMass = massSc - massLc; @@ -864,7 +987,19 @@ struct HfTaskSigmac { /// THn for candidate Σc0,++ cut variation if (enableTHn) { - registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel, ptSc, std::abs(chargeSc)); + if constexpr (useMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 2: non-prompt score + std::array outputMl{-1., -1.}; + if (candidateLc.mlProbLcToPiKP().size() > 0) { + outputMl.at(0) = candidateLc.mlProbLcToPiKP()[0]; /// bkg score + outputMl.at(1) = candidateLc.mlProbLcToPiKP()[2]; /// non-prompt score + } + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, outputMl.at(0), outputMl.at(1), origin, channel, ptSc, std::abs(chargeSc)); + } else { + /// fill w/o BDT information + registry.get(HIST("hnSigmaC"))->Fill(ptLc, deltaMass, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel, ptSc, std::abs(chargeSc)); + } } } /// end candidate Λc+ → Ï€+K-p (and charge conjugate) @@ -886,23 +1021,88 @@ struct HfTaskSigmac { int origin = candidateLc.originMcRec(); auto channel = candidateLc.flagMcDecayChanRec(); /// 0: direct; 1: Λc± → p± K*; 2: Λc± → Δ(1232)±± K∓; 3: Λc± → Λ(1520) π± int pdgAbs = -1; - if (candidateLc.prong0_as().has_mcParticle()) { - pdgAbs = std::abs(candidateLc.prong0_as().mcParticle().pdgCode()); + if (candidateLc.template prong0_as().has_mcParticle()) { + pdgAbs = std::abs(candidateLc.template prong0_as().mcParticle().pdgCode()); } if (candidateLc.isSelLcToPKPi() >= 1 && pdgAbs == kProton) { massLc = hfHelper.invMassLcToPKPi(candidateLc); - registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel); + if constexpr (useMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 2: non-prompt score + std::array outputMl{-1., -1.}; + if (candidateLc.mlProbLcToPKPi().size() > 0) { + outputMl.at(0) = candidateLc.mlProbLcToPKPi()[0]; /// bkg score + outputMl.at(1) = candidateLc.mlProbLcToPKPi()[2]; /// non-prompt score + } + registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, outputMl.at(0), outputMl.at(1), origin, channel); + } else { + /// fill w/o BDT information + registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel); + } } if (candidateLc.isSelLcToPiKP() >= 1 && pdgAbs == kPiPlus) { massLc = hfHelper.invMassLcToPiKP(candidateLc); - registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel); + if constexpr (useMl) { + /// fill with ML information + /// BDT index 0: bkg score; BDT index 2: non-prompt score + std::array outputMl{-1., -1.}; + if (candidateLc.mlProbLcToPiKP().size() > 0) { + outputMl.at(0) = candidateLc.mlProbLcToPiKP()[0]; /// bkg score + outputMl.at(1) = candidateLc.mlProbLcToPiKP()[2]; /// non-prompt score + } + registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, outputMl.at(0), outputMl.at(1), origin, channel); + } else { + /// fill w/o BDT information + registry.get(HIST("hnLambdaC"))->Fill(ptLc, massLc, decLengthLc, decLengthXYLc, cpaLc, cpaXYLc, origin, channel); + } } } } /// end THn for candidate Λc+ cut variation w/o Σc0,++ mass-window cut - }; /// end processMc - PROCESS_SWITCH(HfTaskSigmac, processMc, "Process MC", false); + }; /// end fillHistosMc + + /// @brief process function to fill the histograms needed in analysis w/o ML information (data) + void processDataWoMl(aod::HfCandSc const& candidatesSc, + RecoLc const& candidatesLc, + aod::Tracks const& tracks) + { + fillHistosData(candidatesSc, candidatesLc, tracks); + } + PROCESS_SWITCH(HfTaskSigmac, processDataWoMl, "Process data w/o ML information on Lc", true); + + /// @brief process function to fill the histograms needed in analysis with ML information (data) + void processDataWithMl(aod::HfCandSc const& candidatesSc, + soa::Join const& candidatesLc, + aod::Tracks const& tracks) + { + fillHistosData(candidatesSc, candidatesLc, tracks); + } + PROCESS_SWITCH(HfTaskSigmac, processDataWithMl, "Process data with ML information on Lc", false); + + /// @brief process function to fill the histograms needed in analysis w/o ML information (MC) + void processMcWoMl(soa::Join const& candidatesSc, + soa::Join const& mcParticlesSc, + soa::Join const& mcParticlesLc, + aod::McParticles const& mcParticles, // this establishes the type of particle obtained with the .mcParticle() getter + soa::Join const& candidatesLc, + aod::TracksWMc const& tracksWithMc) + { + fillHistosMc(candidatesSc, mcParticlesSc, mcParticlesLc, mcParticles, candidatesLc, tracksWithMc); + } + PROCESS_SWITCH(HfTaskSigmac, processMcWoMl, "Process MC w/o ML information on Lc", false); + + /// @brief process function to fill the histograms needed in analysis with ML information (MC) + void processMcWithMl(soa::Join const& candidatesSc, + soa::Join const& mcParticlesSc, + soa::Join const& mcParticlesLc, + aod::McParticles const& mcParticles, // this establishes the type of particle obtained with the .mcParticle() getter + soa::Join const& candidatesLc, + aod::TracksWMc const& tracksWithMc) + { + fillHistosMc(candidatesSc, mcParticlesSc, mcParticlesLc, mcParticles, candidatesLc, tracksWithMc); + } + PROCESS_SWITCH(HfTaskSigmac, processMcWithMl, "Process MC with ML information on Lc", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From f7ef6363e042fae2287f5cfff1bbe8f781f52b1e Mon Sep 17 00:00:00 2001 From: Paul Buehler Date: Tue, 30 Jan 2024 22:25:40 +0100 Subject: [PATCH 13/33] PWG-UD: Implement and use FIT triggers for vetoing in DGCandProducer (#4528) * Implement FIT triggers * Add new QA histograms * clang-format --- PWGUD/Core/DGSelector.h | 51 +++++--------------- PWGUD/Core/UDHelpers.h | 47 +++++++++++++++--- PWGUD/TableProducer/DGCandProducer.cxx | 67 +++++++++++++++++++++++++- 3 files changed, 117 insertions(+), 48 deletions(-) diff --git a/PWGUD/Core/DGSelector.h b/PWGUD/Core/DGSelector.h index 0bb7e80bde2..57892e0771d 100644 --- a/PWGUD/Core/DGSelector.h +++ b/PWGUD/Core/DGSelector.h @@ -36,7 +36,7 @@ class DGSelector return 1; } - // Function to check if collisions passes DG filter + // Function to check if collision passes DG filter template int IsSelected(DGCutparHolder diffCuts, CC& collision, BCs& bcRange, TCs& tracks, FWs& fwdtracks) { @@ -50,43 +50,9 @@ class DGSelector // 1 TSC // 2 TCE // 3 TOR - int vetoToApply = -1; - if (diffCuts.withTVX()) { - vetoToApply = 0; - } else if (diffCuts.withTSC()) { - vetoToApply = 1; - } else if (diffCuts.withTCE()) { - vetoToApply = 2; - } else if (diffCuts.withTOR()) { - vetoToApply = 3; - } - if (vetoToApply >= 0) { - for (auto const& bc : bcRange) { - switch (vetoToApply) { - case 0: - if (udhelpers::TVX(bc)) { - return 1; - } - break; - case 1: - if (udhelpers::TSC(bc)) { - return 1; - } - break; - case 2: - if (udhelpers::TCE(bc)) { - return 1; - } - break; - case 3: - if (!udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { - return 1; - } - break; - default: - LOGF(info, "Invalid veto trigger value: %d", vetoToApply); - break; - } + for (auto const& bc : bcRange) { + if (udhelpers::FITveto(bc, diffCuts)) { + return 1; } } @@ -188,10 +154,15 @@ class DGSelector template int IsSelected(DGCutparHolder diffCuts, BCs& bcRange, TCs& tracks, FWs& fwdtracks) { - // check that there are no FIT signals in bcRange + // return if FIT veto is found in any of the compatible BCs // Double Gap (DG) condition + // 4 types of vetoes: + // 0 TVX + // 1 TSC + // 2 TCE + // 3 TOR for (auto const& bc : bcRange) { - if (!udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { + if (udhelpers::FITveto(bc, diffCuts)) { return 1; } } diff --git a/PWGUD/Core/UDHelpers.h b/PWGUD/Core/UDHelpers.h index 408dce94f9f..6c5b524bd74 100644 --- a/PWGUD/Core/UDHelpers.h +++ b/PWGUD/Core/UDHelpers.h @@ -295,28 +295,32 @@ bool hasGoodPID(DGCutparHolder diffCuts, TC track) } // ----------------------------------------------------------------------------- -float FV0AmplitudeA(aod::FV0A&& fv0) +template +float FV0AmplitudeA(TFV0 fv0) { const auto& ampsA = fv0.amplitude(); return std::accumulate(ampsA.begin(), ampsA.end(), 0.f); } // ----------------------------------------------------------------------------- -float FT0AmplitudeA(aod::FT0&& ft0) +template +float FT0AmplitudeA(TFT0 ft0) { const auto& ampsA = ft0.amplitudeA(); return std::accumulate(ampsA.begin(), ampsA.end(), 0.f); } // ----------------------------------------------------------------------------- -float FT0AmplitudeC(aod::FT0&& ft0) +template +float FT0AmplitudeC(TFT0 ft0) { const auto& ampsC = ft0.amplitudeC(); return std::accumulate(ampsC.begin(), ampsC.end(), 0.f); } // ----------------------------------------------------------------------------- -float FDDAmplitudeA(aod::FDD&& fdd) +template +float FDDAmplitudeA(TFDD fdd) { float totAmplitude = 0; for (auto amp : fdd.chargeA()) { @@ -327,7 +331,8 @@ float FDDAmplitudeA(aod::FDD&& fdd) } // ----------------------------------------------------------------------------- -float FDDAmplitudeC(aod::FDD&& fdd) +template +float FDDAmplitudeC(TFDD fdd) { float totAmplitude = 0; for (auto amp : fdd.chargeC()) { @@ -510,11 +515,39 @@ bool TCE(T& bc) template bool TOR(T& bc, float maxFITtime, std::vector lims) { - auto torA = !cleanFT0A(bc, maxFITtime, lims); - auto torC = !cleanFT0C(bc, maxFITtime, lims); + auto torA = !cleanFT0A(bc, maxFITtime, lims[1]); + auto torC = !cleanFT0C(bc, maxFITtime, lims[2]); return torA || torC; } +// ----------------------------------------------------------------------------- +// returns true if veto is active +// return false if veto is not active +template +bool FITveto(T const& bc, DGCutparHolder const& diffCuts) +{ + // return if FIT veto is found in bc + // Double Gap (DG) condition + // 4 types of vetoes: + // 0 TVX + // 1 TSC + // 2 TCE + // 3 TOR + if (diffCuts.withTVX()) { + return TVX(bc); + } + if (diffCuts.withTSC()) { + return TSC(bc); + } + if (diffCuts.withTCE()) { + return TCE(bc); + } + if (diffCuts.withTOR()) { + return !cleanFIT(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()); + } + return false; +} + // ----------------------------------------------------------------------------- // fill BB and BG information into FITInfo template diff --git a/PWGUD/TableProducer/DGCandProducer.cxx b/PWGUD/TableProducer/DGCandProducer.cxx index aec55e0c8af..4c319873ef2 100644 --- a/PWGUD/TableProducer/DGCandProducer.cxx +++ b/PWGUD/TableProducer/DGCandProducer.cxx @@ -11,7 +11,6 @@ // // \brief Saves relevant information of DG candidates // \author Paul Buehler, paul.buehler@oeaw.ac.at -// \since 20.05.2022 #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -129,6 +128,53 @@ struct DGCandProducer { outputTracksLabel(track.globalIndex()); } + template + void fillFIThistograms(TBC const& bc) + { + std::array triggers{{true, udhelpers::TOR(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()), + udhelpers::TVX(bc), udhelpers::TSC(bc), udhelpers::TCE(bc)}}; + + if (bc.has_foundFV0()) { + auto fv0 = bc.foundFV0(); + auto ampA = udhelpers::FV0AmplitudeA(fv0); + registry.get(HIST("reco/fv0"))->Fill(ampA, 0); + registry.get(HIST("reco/fv0"))->Fill(ampA, triggers[1] ? 1 : 5); + registry.get(HIST("reco/fv0"))->Fill(ampA, triggers[2] ? 2 : 6); + registry.get(HIST("reco/fv0"))->Fill(ampA, triggers[3] ? 3 : 7); + registry.get(HIST("reco/fv0"))->Fill(ampA, triggers[4] ? 4 : 8); + } + if (bc.has_foundFT0()) { + auto ft0 = bc.foundFT0(); + auto ampA = udhelpers::FT0AmplitudeA(ft0); + auto ampC = udhelpers::FT0AmplitudeC(ft0); + registry.get(HIST("reco/ft0A"))->Fill(ampA, 0); + registry.get(HIST("reco/ft0C"))->Fill(ampC, 0); + registry.get(HIST("reco/ft0A"))->Fill(ampA, triggers[1] ? 1 : 5); + registry.get(HIST("reco/ft0C"))->Fill(ampC, triggers[1] ? 1 : 5); + registry.get(HIST("reco/ft0A"))->Fill(ampA, triggers[2] ? 2 : 6); + registry.get(HIST("reco/ft0C"))->Fill(ampC, triggers[2] ? 2 : 6); + registry.get(HIST("reco/ft0A"))->Fill(ampA, triggers[3] ? 3 : 7); + registry.get(HIST("reco/ft0C"))->Fill(ampC, triggers[3] ? 3 : 7); + registry.get(HIST("reco/ft0A"))->Fill(ampA, triggers[4] ? 4 : 8); + registry.get(HIST("reco/ft0C"))->Fill(ampC, triggers[4] ? 4 : 8); + } + if (bc.has_foundFDD()) { + auto fdd = bc.foundFDD(); + auto ampA = udhelpers::FDDAmplitudeA(fdd); + auto ampC = udhelpers::FDDAmplitudeC(fdd); + registry.get(HIST("reco/fddA"))->Fill(ampA, 0); + registry.get(HIST("reco/fddC"))->Fill(ampC, 0); + registry.get(HIST("reco/fddA"))->Fill(ampA, triggers[1] ? 1 : 5); + registry.get(HIST("reco/fddC"))->Fill(ampC, triggers[1] ? 1 : 5); + registry.get(HIST("reco/fddA"))->Fill(ampA, triggers[2] ? 2 : 6); + registry.get(HIST("reco/fddC"))->Fill(ampC, triggers[2] ? 2 : 6); + registry.get(HIST("reco/fddA"))->Fill(ampA, triggers[3] ? 3 : 7); + registry.get(HIST("reco/fddC"))->Fill(ampC, triggers[3] ? 3 : 7); + registry.get(HIST("reco/fddA"))->Fill(ampA, triggers[4] ? 4 : 8); + registry.get(HIST("reco/fddC"))->Fill(ampC, triggers[4] ? 4 : 8); + } + } + void init(InitContext&) { diffCuts = (DGCutparHolder)DGCuts; @@ -139,6 +185,18 @@ struct DGCandProducer { registry.add("reco/TPCsignal1", "2 prong events, TPC signal versus p_{T} of particle 1", {HistType::kTH2F, {{200, -3., 3.}, {200, 0., 100.0}}}); registry.add("reco/TPCsignal2", "2 prong events, TPC signal versus p_{T} of particle 2", {HistType::kTH2F, {{200, -3., 3.}, {200, 0., 100.0}}}); registry.add("reco/sig1VsSig2TPC", "2 prong events, TPC signal versus TPC signal", {HistType::kTH2F, {{100, 0., 100.}, {100, 0., 100.}}}); + + // FIT amplitudes + // 0: unconditional + // 1: TOR 5: no TOR + // 2: TVX 6: no TVX + // 3: TSC 7: no TSC + // 4: TCE 8: no TCE + registry.add("reco/fv0", "FV0 amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {9, -0.5, 8.5}}}); + registry.add("reco/ft0A", "FT0A amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {9, -0.5, 8.5}}}); + registry.add("reco/ft0C", "FT0C amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {9, -0.5, 8.5}}}); + registry.add("reco/fddA", "FDDA amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {9, -0.5, 8.5}}}); + registry.add("reco/fddC", "FDDC amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {9, -0.5, 8.5}}}); } // process function for real data @@ -153,6 +211,9 @@ struct DGCandProducer { auto bc = collision.foundBC_as(); LOGF(debug, " BC id %d", bc.globalBC()); + // fill FIT histograms + fillFIThistograms(bc); + // obtain slice of compatible BCs auto bcRange = udhelpers::compatibleBCs(collision, diffCuts.NDtcoll(), bcs, diffCuts.minNBCs()); LOGF(debug, " Size of bcRange %d", bcRange.size()); @@ -420,6 +481,10 @@ struct McDGCandProducer { LOGF(info, "Number of McCollisions %d", mccols.size()); LOGF(info, "Number of DG candidates %d", dgcands.size()); LOGF(info, "Number of UD tracks %d", udtracks.size()); + if (dgcands.size() <= 0) { + LOGF(info, "No DG candidates to save!"); + return; + } // use a hash table to keep track of the McCollisions which have been added to the UDMcCollision table // {McCollisionId : udMcCollisionId} From 4203f5904d4d0cd853c5844c9ef6dc955eac2cd1 Mon Sep 17 00:00:00 2001 From: jaelpark Date: Tue, 30 Jan 2024 22:44:31 +0100 Subject: [PATCH 14/33] PWGCF correlations task 2-prong work (#4466) * Fix missing nabs, add mixed processing for 2-prongs * Make 2-prongs the trigger particles * Limit efficiency cache allocations * Trigger histogram names --- PWGCF/TableProducer/filter2Prong.cxx | 3 +- PWGCF/Tasks/correlations.cxx | 105 +++++++++++++++++++-------- 2 files changed, 76 insertions(+), 32 deletions(-) diff --git a/PWGCF/TableProducer/filter2Prong.cxx b/PWGCF/TableProducer/filter2Prong.cxx index 00584f804f5..74191f70ddc 100644 --- a/PWGCF/TableProducer/filter2Prong.cxx +++ b/PWGCF/TableProducer/filter2Prong.cxx @@ -56,10 +56,9 @@ struct Filter2Prong { } } // look-up the collision id - auto collisionId = cfcollisions.begin().globalIndex(); if ((c.hfflag() & (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) == 0) continue; - output2ProngTracks(collisionId, + output2ProngTracks(cfcollisions.begin().globalIndex(), prongCFId[0], prongCFId[1], c.pt(), c.eta(), c.phi(), aod::cf2prongtrack::D0ToPiK); } } diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index 0cbbfba5f39..85c2b3b331d 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -107,12 +107,14 @@ struct CorrelationTask { Filter cfMCParticleFilter = (nabs(aod::cfmcparticle::eta) < cfgCutEta) && (aod::cfmcparticle::pt > cfgCutPt) && (aod::cfmcparticle::sign != 0); // HF filters - Filter track2pFilter = (aod::cf2prongtrack::eta < cfgCutEta) && (aod::cf2prongtrack::pt > cfgCutPt); + Filter track2pFilter = (nabs(aod::cf2prongtrack::eta) < cfgCutEta) && (aod::cf2prongtrack::pt > cfgCutPt); // Output definitions OutputObj same{"sameEvent"}; OutputObj mixed{"mixedEvent"}; + std::vector efficiencyAssociatedCache; + struct Config { bool mPairCuts = false; THn* mEfficiencyTrigger = nullptr; @@ -135,9 +137,9 @@ struct CorrelationTask { { registry.add("yields", "multiplicity/centrality vs pT vs eta", {HistType::kTH3F, {{100, 0, 100, "/multiplicity/centrality"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); registry.add("etaphi", "multiplicity/centrality vs eta vs phi", {HistType::kTH3F, {{100, 0, 100, "multiplicity/centrality"}, {100, -2, 2, "#eta"}, {200, 0, 2 * M_PI, "#varphi"}}}); - if (doprocessSame2ProngDerived) { - registry.add("yieldsTrack2", "multiplicity/centrality vs pT vs eta (track2)", {HistType::kTH3F, {{100, 0, 100, "/multiplicity/centrality"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); - registry.add("etaphiTrack2", "multiplicity/centrality vs eta vs phi (track2)", {HistType::kTH3F, {{100, 0, 100, "multiplicity/centrality"}, {100, -2, 2, "#eta"}, {200, 0, 2 * M_PI, "#varphi"}}}); + if (doprocessSame2ProngDerived || doprocessMixed2ProngDerived) { + registry.add("yieldsTrigger", "multiplicity/centrality vs pT vs eta (triggers)", {HistType::kTH3F, {{100, 0, 100, "/multiplicity/centrality"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("etaphiTrigger", "multiplicity/centrality vs eta vs phi (triggers)", {HistType::kTH3F, {{100, 0, 100, "multiplicity/centrality"}, {100, -2, 2, "#eta"}, {200, 0, 2 * M_PI, "#varphi"}}}); } const int maxMixBin = AxisSpec(axisMultiplicity).getNbins() * AxisSpec(axisVertex).getNbins(); @@ -176,6 +178,8 @@ struct CorrelationTask { same->setTrackEtaCut(cfgCutEta); mixed->setTrackEtaCut(cfgCutEta); + efficiencyAssociatedCache.reserve(512); + // o2-ccdb-upload -p Users/jgrosseo/correlations/LHC15o -f /tmp/correction_2011_global.root -k correction ccdb->setURL("http://alice-ccdb.cern.ch"); @@ -215,15 +219,15 @@ struct CorrelationTask { template void fillQA(const TCollision& collision, float multiplicity, const TTracks1& tracks1, const TTracks2& tracks2) { - fillQA(collision, multiplicity, tracks1); - for (auto& track2 : tracks2) { - if constexpr (std::is_same::value) { - if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << (uint32_t)track2.decay())) == 0u) + for (auto& track1 : tracks1) { + if constexpr (std::is_same::value) { + if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << (uint32_t)track1.decay())) == 0u) continue; } - registry.fill(HIST("yieldsTrack2"), multiplicity, track2.pt(), track2.eta()); - registry.fill(HIST("etaphiTrack2"), multiplicity, track2.eta(), track2.phi()); + registry.fill(HIST("yieldsTrigger"), multiplicity, track1.pt(), track1.eta()); + registry.fill(HIST("etaphiTrigger"), multiplicity, track1.eta(), track1.phi()); } + fillQA(collision, multiplicity, tracks2); } template @@ -261,13 +265,12 @@ struct CorrelationTask { void fillCorrelations(TTarget target, TTracks1& tracks1, TTracks2& tracks2, float multiplicity, float posZ, int magField, float eventWeight) { // Cache efficiency for particles (too many FindBin lookups) - float* efficiencyAssociated = nullptr; if constexpr (step == CorrelationContainer::kCFStepCorrected) { if (cfg.mEfficiencyAssociated) { - efficiencyAssociated = new float[tracks2.size()]; - int i = 0; + efficiencyAssociatedCache.clear(); + efficiencyAssociatedCache.reserve(tracks2.size()); for (auto& track : tracks2) { - efficiencyAssociated[i++] = getEfficiencyCorrection(cfg.mEfficiencyAssociated, track.eta(), track.pt(), multiplicity, posZ); + efficiencyAssociatedCache.push_back(getEfficiencyCorrection(cfg.mEfficiencyAssociated, track.eta(), track.pt(), multiplicity, posZ)); } } } @@ -281,8 +284,15 @@ struct CorrelationTask { } } - if (cfgTriggerCharge != 0 && cfgTriggerCharge * track1.sign() < 0) { - continue; + if constexpr (std::is_same::value) { + if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << (uint32_t)track1.decay())) == 0u) + continue; + } + + if constexpr (std::experimental::is_detected::value) { + if (cfgTriggerCharge != 0 && cfgTriggerCharge * track1.sign() < 0) { + continue; + } } float triggerWeight = eventWeight; @@ -301,10 +311,8 @@ struct CorrelationTask { continue; } } - if constexpr (std::is_same::value) { - if (track1.globalIndex() == track2.cfTrackProng0Id() || track1.globalIndex() == track2.cfTrackProng1Id()) // do not correlate daughter tracks of the same event - continue; - if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << (uint32_t)track2.decay())) == 0u) + if constexpr (std::is_same::value) { + if (track2.globalIndex() == track1.cfTrackProng0Id() || track2.globalIndex() == track1.cfTrackProng1Id()) // do not correlate daughter tracks of the same event continue; } @@ -318,10 +326,11 @@ struct CorrelationTask { continue; } - if constexpr (std::experimental::is_detected::value) { - if (cfgAssociatedCharge != 0 && cfgAssociatedCharge * track2.sign() < 0) { - continue; - } + if (cfgAssociatedCharge != 0 && cfgAssociatedCharge * track2.sign() < 0) { + continue; + } + + if constexpr (std::experimental::is_detected::value) { if (cfgPairCharge != 0 && cfgPairCharge * track1.sign() * track2.sign() < 0) { continue; } @@ -342,7 +351,7 @@ struct CorrelationTask { float associatedWeight = triggerWeight; if constexpr (step == CorrelationContainer::kCFStepCorrected) { if (cfg.mEfficiencyAssociated) { - associatedWeight *= efficiencyAssociated[track2.filteredIndex()]; + associatedWeight *= efficiencyAssociatedCache[track2.filteredIndex()]; } } @@ -358,8 +367,6 @@ struct CorrelationTask { track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, associatedWeight); } } - - delete[] efficiencyAssociated; } void loadEfficiency(uint64_t timestamp) @@ -456,14 +463,14 @@ struct CorrelationTask { int bin = configurableBinningDerived.getBin({collision.posZ(), collision.multiplicity()}); registry.fill(HIST("eventcount_same"), bin); - fillQA(collision, multiplicity, tracks, p2tracks); + fillQA(collision, multiplicity, p2tracks, tracks); same->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(same, tracks, p2tracks, multiplicity, collision.posZ(), 0, 1.0f); + fillCorrelations(same, p2tracks, tracks, multiplicity, collision.posZ(), 0, 1.0f); if (cfg.mEfficiencyAssociated || cfg.mEfficiencyTrigger) { same->fillEvent(multiplicity, CorrelationContainer::kCFStepCorrected); - fillCorrelations(same, tracks, p2tracks, multiplicity, collision.posZ(), 0, 1.0f); + fillCorrelations(same, p2tracks, tracks, multiplicity, collision.posZ(), 0, 1.0f); } } PROCESS_SWITCH(CorrelationTask, processSame2ProngDerived, "Process same event on derived data", false); @@ -553,6 +560,44 @@ struct CorrelationTask { } PROCESS_SWITCH(CorrelationTask, processMixedDerived, "Process mixed events on derived data", false); + void processMixed2ProngDerived(derivedCollisions& collisions, derivedTracks const& tracks, soa::Filtered const& p2tracks) + { + // Strictly upper categorised collisions, for cfgNoMixedEvents combinations per bin, skipping those in entry -1 + auto tracksTuple = std::make_tuple(p2tracks, tracks); + Pair, derivedTracks, BinningTypeDerived> pairs{configurableBinningDerived, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + + for (auto it = pairs.begin(); it != pairs.end(); it++) { + auto& [collision1, tracks1, collision2, tracks2] = *it; + int bin = configurableBinningDerived.getBin({collision1.posZ(), collision1.multiplicity()}); + float eventWeight = 1.0f / it.currentWindowNeighbours(); + int field = 0; + if (cfgTwoTrackCut > 0) { + field = getMagneticField(collision1.timestamp()); + } + + if (cfgVerbosity > 0) { + LOGF(info, "processMixed2ProngDerived: Mixed collisions bin: %d pair: [%d, %d] %d (%.3f, %.3f), %d (%.3f, %.3f)", bin, it.isNewWindow(), it.currentWindowNeighbours(), collision1.globalIndex(), collision1.posZ(), collision1.multiplicity(), collision2.globalIndex(), collision2.posZ(), collision2.multiplicity()); + } + + if (it.isNewWindow()) { + loadEfficiency(collision1.timestamp()); + + mixed->fillEvent(collision1.multiplicity(), CorrelationContainer::kCFStepReconstructed); + } + + registry.fill(HIST("eventcount_mixed"), bin); + fillCorrelations(mixed, tracks1, tracks2, collision1.multiplicity(), collision1.posZ(), field, eventWeight); + + if (cfg.mEfficiencyAssociated || cfg.mEfficiencyTrigger) { + if (it.isNewWindow()) { + mixed->fillEvent(collision1.multiplicity(), CorrelationContainer::kCFStepCorrected); + } + fillCorrelations(mixed, tracks1, tracks2, collision1.multiplicity(), collision1.posZ(), field, eventWeight); + } + } + } + PROCESS_SWITCH(CorrelationTask, processMixed2ProngDerived, "Process mixed events on derived data", false); + // Version with combinations /*void processWithCombinations(soa::Join::iterator const& collision, aod::BCsWithTimestamps const&, soa::Filtered const& tracks) { From 8812dc6cd5166614433212a098a9a3b701fd246c Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 31 Jan 2024 18:11:53 +0900 Subject: [PATCH 15/33] EventFiltering/PWGEM: update photon trigger (#4445) --- EventFiltering/PWGEM/EMPhotonFilter.cxx | 222 +++++++++++++--------- EventFiltering/PWGEM/EMPhotonFilterQC.cxx | 106 +++-------- EventFiltering/filterTables.h | 4 +- 3 files changed, 162 insertions(+), 170 deletions(-) diff --git a/EventFiltering/PWGEM/EMPhotonFilter.cxx b/EventFiltering/PWGEM/EMPhotonFilter.cxx index 390646f6140..03c06c6ae84 100644 --- a/EventFiltering/PWGEM/EMPhotonFilter.cxx +++ b/EventFiltering/PWGEM/EMPhotonFilter.cxx @@ -32,8 +32,8 @@ using namespace o2::framework::expressions; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -// using MyPrimaryElectrons = soa::Join; -// using MyPrimaryElectron = MyPrimaryElectrons::iterator; +using MyPrimaryElectrons = soa::Join; +using MyPrimaryElectron = MyPrimaryElectrons::iterator; struct EMPhotonFilter { @@ -49,10 +49,7 @@ struct EMPhotonFilter { kPHOS_Pair = 2, kPHOS_Nbar = 3, kPCM_HighPtPhoton = 4, - kPCM_MatCalib = 5, - kPCM_EtaDalitz = 6, - kPCM_EtaGG = 7, - kPCM_EE = 8, + kPCM_EE = 5, kNtrg }; @@ -64,16 +61,33 @@ struct EMPhotonFilter { Configurable nNbar{"nNbar", 2, "Minimal number of nbar clusters"}; // for PCM - Configurable min_pt_tagging{"min_pt_tagging", 0.f, "min. pT for tagging"}; - Configurable max_mee_pi0_dalitz{"max_mee_pi0_dalitz", 0.12, "max. mee for pi0 dalitz decay"}; - Configurable min_meeg_pi0{"min_meeg_pi0", 0.04, "min. meeg for pi0"}; - Configurable max_meeg_pi0{"max_meeg_pi0", 0.24, "max. meeg for pi0"}; - Configurable max_mee_eta_dalitz{"max_mee_eta_dalitz", 0.5, "max. mee for eta dalitz decay"}; - Configurable min_meeg_eta{"min_meeg_eta", 0.35, "min. meeg for eta"}; - Configurable max_meeg_eta{"max_meeg_eta", 0.75, "max. meeg for eta"}; + Configurable minpt_v0{"minpt_v0", 0.1, "min pt for v0"}; + Configurable maxeta_v0{"maxeta_v0", 0.9, "eta acceptance for v0"}; + Configurable min_pt_pcm_photon{"min_pt_pcm_photon", 0.f, "min. pT for PCM photon"}; + Configurable minTPCNsigmaEl_v0{"minTPCNsigmaEl_v0", -3.5, "min. TPC n sigma for electron inclusion"}; + Configurable maxTPCNsigmaEl_v0{"maxTPCNsigmaEl_v0", +3.5, "max. TPC n sigma for electron inclusion"}; + Configurable max_dcatopv_xy_v0{"max_dcatopv_xy_v0", +1e+10, "max. DCAxy to PV for V0"}; + Configurable max_dcatopv_z_v0{"max_dcatopv_z_v0", +1e+10, "max. DCAz to PV for V0"}; + + // for prompt dielectron + Configurable minpt{"minpt", 0.2, "min pt for track"}; + Configurable maxeta{"maxeta", 0.9, "eta acceptance"}; + Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 1.0f, "max DCA 3D in sigma"}; // for single track + Configurable mincrossedrows{"mincrossedrows", 80, "min crossed rows"}; + Configurable minTPCNsigmaEl_primary{"minTPCNsigmaEl_primary", -3.0, "min. TPC n sigma for electron inclusion"}; + Configurable maxTPCNsigmaEl_primary{"maxTPCNsigmaEl_primary", +4.0, "max. TPC n sigma for electron inclusion"}; + Configurable minTOFNsigmaEl_primary{"minTOFNsigmaEl_primary", -4.0, "min. TOF n sigma for electron inclusion"}; // require TOF + Configurable maxTOFNsigmaEl_primary{"maxTOFNsigmaEl_primary", +4.0, "max. TOF n sigma for electron inclusion"}; // require TOF + Configurable minTPCNsigmaPi{"minTPCNsigmaPi", -2.0, "min. TPC n sigma for pion exclusion"}; // set to -2 for lowB, -999 for nominalB + Configurable maxTPCNsigmaPi{"maxTPCNsigmaPi", 2.0, "max. TPC n sigma for pion exclusion"}; + Configurable min_pin_tof{"min_pin_tof", 0.4, "tof is required above this threshold in pin"}; Configurable slope{"slope", 0.0185, "slope for m vs. phiv"}; Configurable intercept{"intercept", -0.0280, "intercept for m vs. phiv"}; - Configurable min_pt_pcm_photon{"min_pt_pcm_photon", 4.f, "min. pT for PCM photon"}; + Configurable min_mee{"min_mee", 0.0, "min. mee"}; + Configurable max_mee{"max_mee", 0.5, "max. mee"}; + Configurable min_meeg{"min_meeg", 0.3, "min. meeg"}; + Configurable max_meeg{"max_meeg", 0.8, "max. meeg"}; + Configurable applyPF{"applyPF", false, "apply pre-filter for primary electron"}; // i.e. reject electron from photon conversion with phiv HistogramRegistry mHistManager{"events", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -92,14 +106,64 @@ struct EMPhotonFilter { scalers->GetXaxis()->SetBinLabel(10, "PHOS photon & pair"); scalers->GetXaxis()->SetBinLabel(11, "events with PHOS"); scalers->GetXaxis()->SetBinLabel(12, "PCM high p_{T} photon"); - scalers->GetXaxis()->SetBinLabel(13, "PCM Material budget calibration"); - scalers->GetXaxis()->SetBinLabel(14, "PCM #eta #rightarrow ee#gamma"); - scalers->GetXaxis()->SetBinLabel(15, "PCM #eta #rightarrow #gamma#gamma"); - scalers->GetXaxis()->SetBinLabel(16, "PCM DalitzEE #gamma-#gamma^{*} BEC"); + scalers->GetXaxis()->SetBinLabel(13, "PCM #gamma and dielectron"); + } + + template + bool isSelectedSecondary(TTrack const& track) + { + if (track.hasTPC() && (track.tpcNSigmaEl() < minTPCNsigmaEl_v0 || maxTPCNsigmaEl_v0 < track.tpcNSigmaEl())) { + return false; + } + return true; + } + template + bool isSelectedPrimary(TTrack const& track) + { + if (!track.hasITS() || !track.hasTPC()) { + return false; + } + + if (track.pt() < minpt || abs(track.eta()) > maxeta) { + return false; + } + + if (track.tpcNClsCrossedRows() < mincrossedrows) { + return false; + } + + if (track.tpcNSigmaEl() < minTPCNsigmaEl_primary || maxTPCNsigmaEl_primary < track.tpcNSigmaEl()) { + return false; + } + + if ((track.tofNSigmaEl() < minTOFNsigmaEl_primary || maxTOFNsigmaEl_primary < track.tofNSigmaEl()) && track.tpcInnerParam() > min_pin_tof) { + return false; + } + + if (minTPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < maxTPCNsigmaPi) { + return false; + } + + if (applyPF && track.pfb() > 0) { + return false; + } + + float dca_3d = 999.f; + float det = track.cYY() * track.cZZ() - track.cZY() * track.cZY(); + if (det < 0) { + dca_3d = 999.f; + } else { + float chi2 = (track.dcaXY() * track.dcaXY() * track.cZZ() + track.dcaZ() * track.dcaZ() * track.cYY() - 2. * track.dcaXY() * track.dcaZ() * track.cZY()) / det; + dca_3d = std::sqrt(std::abs(chi2) / 2.); + } + if (dca_3d > dca_3d_sigma_max) { + return false; + } + return true; } Preslice perCollision_pcm = aod::v0photonkf::collisionId; - // Preslice perCollision_ee = aod::dalitzee::collisionId; + Preslice perCollision_ee = aod::dalitzee::collisionId; Preslice perCollision_phos = aod::calocluster::collisionId; // Preslice perCollision_emc = aod::skimmedcluster::collisionId; @@ -122,9 +186,14 @@ struct EMPhotonFilter { if constexpr (static_cast(system & EM_Filter_PhotonType::kPCM)) { auto photons1_per_coll = photons1.sliceBy(perCollision_pcm, collision.globalIndex()); - // auto dielectrons_per_coll = dielectrons.sliceBy(perCollision_ee, collision.globalIndex()); + auto dielectrons_per_coll = dielectrons.sliceBy(perCollision_ee, collision.globalIndex()); for (auto& v0photon : photons1_per_coll) { + auto pos_sv = v0photon.template posTrack_as(); + auto ele_sv = v0photon.template negTrack_as(); + if (!isSelectedSecondary(pos_sv) || !isSelectedSecondary(ele_sv)) { + continue; + } if (v0photon.pt() > min_pt_pcm_photon) { keepEvent[kPCM_HighPtPhoton] = true; mHistManager.fill(HIST("hEventCounter"), 12); @@ -132,67 +201,34 @@ struct EMPhotonFilter { } } // end of single v0 photon loop - // for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_coll, dielectrons_per_coll))) { - // if (g2.pt() < min_pt_tagging) { // this is only to increase rejection factor - // continue; - // } - // if (g2.mass() > max_mee_pi0_dalitz) { // select only pi0 candidates - // continue; - // } - // if (g2.mass() < slope * g2.phiv() + intercept) { - // continue; - // } - // ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); - // ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), g2.mass()); - // ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - - // if (min_meeg_pi0 < v12.M() && v12.M() < max_meeg_pi0) { - // keepEvent[kPCM_MatCalib] = true; - // mHistManager.fill(HIST("hEventCounter"), 13); - // break; - // } - - // } // end of dielectron-photon pair loop - - // for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_coll, dielectrons_per_coll))) { - // if (g2.mass() > max_mee_eta_dalitz) { // select only eta candidates - // continue; - // } - // if (g2.mass() < slope * g2.phiv() + intercept) { - // continue; - // } - - // ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); - // ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), g2.mass()); - // ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - - // if (min_meeg_eta < v12.M() && v12.M() < max_meeg_eta) { // eta -> eeg - // keepEvent[kPCM_EtaDalitz] = true; - // mHistManager.fill(HIST("hEventCounter"), 14); - // break; - // } - // } // end of dielectron-photon pair loop - - // for (auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons1_per_coll, photons1_per_coll))) { - // ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); - // ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); - // ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - - // if (min_meeg_eta < v12.M() && v12.M() < max_meeg_eta) { // eta -> gg - // keepEvent[kPCM_EtaGG] = true; - // mHistManager.fill(HIST("hEventCounter"), 15); - // break; - // } - // } // end of photon-photon pair loop - - // for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_coll, dielectrons_per_coll))) { - // if (g2.mass() < slope * g2.phiv() + intercept) { - // continue; - // } - // keepEvent[kPCM_EE] = true; - // mHistManager.fill(HIST("hEventCounter"), 16); - // break; - // } // end of dielectron-photon pair loop + for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_coll, dielectrons_per_coll))) { + auto pos_sv = g1.template posTrack_as(); + auto ele_sv = g1.template negTrack_as(); + if (!isSelectedSecondary(pos_sv) || !isSelectedSecondary(ele_sv)) { + continue; + } + + auto pos_pv = g2.template posTrack_as(); + auto ele_pv = g2.template negTrack_as(); + if (!isSelectedPrimary(pos_pv) || !isSelectedPrimary(ele_pv)) { + continue; + } + if (g2.mass() < min_mee || max_mee < g2.mass()) { + continue; + } + if (g2.mass() < slope * g2.phiv() + intercept) { + continue; + } + + ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), g2.mass()); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + if (min_meeg < v12.M() && v12.M() < max_meeg) { + keepEvent[kPCM_EE] = true; + mHistManager.fill(HIST("hEventCounter"), 13); + break; + } + } // end of photon + dielectron pair loop } // end of PCM decision @@ -264,19 +300,25 @@ struct EMPhotonFilter { // if constexpr (static_cast(system & EM_Filter_PhotonType::kEMC)) { // // so far, do nothing. // } - tags(keepEvent[kPHOS_Photon], keepEvent[kPHOS_Nbar], keepEvent[kPCM_HighPtPhoton]); + + tags(keepEvent[kPHOS_Photon], keepEvent[kPHOS_Nbar], keepEvent[kPCM_HighPtPhoton], keepEvent[kPCM_EE]); } // end of collision loop } - // void process_PCM(MyCollisions const& collisions, aod::V0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, aod::DalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons) - void process_PCM(MyCollisions const& collisions, aod::V0PhotonsKF const& v0photons, aod::V0Legs const& v0legs) + Filter PCMFilter = o2::aod::v0photonkf::dcaXYtopv < max_dcatopv_xy_v0 && o2::aod::v0photonkf::dcaZtopv < max_dcatopv_z_v0; + using filteredV0PhotonsKF = Filtered; + + Filter DalitzEEFilter = o2::aod::dalitzee::sign == 0; // analyze only uls + using filteredDalitzEEs = Filtered; + + void process_PCM(MyCollisions const& collisions, filteredV0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, filteredDalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons) { const uint8_t system = EM_Filter_PhotonType::kPCM; - runFilter(collisions, v0photons, nullptr, nullptr, v0legs, nullptr, nullptr); + runFilter(collisions, v0photons, nullptr, nullptr, v0legs, dielectrons, emprimaryelectrons); } Filter phosCluFilter = (o2::aod::calocluster::e > 0.3f); - using CluCandidates = o2::soa::Filtered; + using CluCandidates = Filtered; void process_PHOS(MyCollisions const& collisions, CluCandidates const& clusters) { const uint8_t system = EM_Filter_PhotonType::kPHOS; @@ -289,18 +331,16 @@ struct EMPhotonFilter { runFilter(collisions, nullptr, nullptr, clusters, nullptr, nullptr, nullptr); } - // void process_PCM_PHOS(MyCollisions const& collisions, aod::V0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, aod::DalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons, CluCandidates const& clusters) - void process_PCM_PHOS(MyCollisions const& collisions, aod::V0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, CluCandidates const& clusters) + void process_PCM_PHOS(MyCollisions const& collisions, filteredV0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, filteredDalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons, CluCandidates const& clusters) { const uint8_t system = EM_Filter_PhotonType::kPCM | EM_Filter_PhotonType::kPHOS; - // runFilter(collisions, v0photons, clusters, nullptr, v0legs, dielectrons, emprimaryelectrons); - runFilter(collisions, v0photons, clusters, nullptr, v0legs, nullptr, nullptr); + runFilter(collisions, v0photons, clusters, nullptr, v0legs, dielectrons, emprimaryelectrons); } void processDummy(MyCollisions const& collisions) { for (int i = 0; i < collisions.size(); i++) { - tags(false, false, false); + tags(false, false, false, false); } } diff --git a/EventFiltering/PWGEM/EMPhotonFilterQC.cxx b/EventFiltering/PWGEM/EMPhotonFilterQC.cxx index 65a0cbbce47..92ee1cd5c30 100644 --- a/EventFiltering/PWGEM/EMPhotonFilterQC.cxx +++ b/EventFiltering/PWGEM/EMPhotonFilterQC.cxx @@ -44,35 +44,25 @@ struct EMPhotonFilterQC { void addhistograms() { - auto hEventCounter = registry.add("hEventCounter", "hEventCounter", kTH1F, {{20, 0.5f, 20.5f}}); + auto hEventCounter = registry.add("hEventCounter", "hEventCounter", kTH1F, {{10, 0.5f, 10.5f}}); hEventCounter->GetXaxis()->SetBinLabel(1, "all"); hEventCounter->GetXaxis()->SetBinLabel(2, "sel8 && |Z_{vtx}| < 10 cm"); hEventCounter->GetXaxis()->SetBinLabel(3, "PCM High p_{T} photon"); hEventCounter->GetXaxis()->SetBinLabel(4, "PCM High p_{T} photon && sel8 && |Z_{vtx}| < 10 cm"); - hEventCounter->GetXaxis()->SetBinLabel(5, "PCM MB calibration"); - hEventCounter->GetXaxis()->SetBinLabel(6, "PCM MB calibration && sel8 && |Z_{vtx}| < 10 cm"); - hEventCounter->GetXaxis()->SetBinLabel(7, "PCM #eta #rightarrow ee#gamma"); - hEventCounter->GetXaxis()->SetBinLabel(8, "PCM #eta #rightarrow ee#gamma && sel8 && |Z_{vtx}| < 10 cm"); - hEventCounter->GetXaxis()->SetBinLabel(9, "PCM #eta #rightarrow #gamma#gamma"); - hEventCounter->GetXaxis()->SetBinLabel(10, "PCM #eta #rightarrow #gamma#gamma && sel8 && |Z_{vtx}| < 10 cm"); - hEventCounter->GetXaxis()->SetBinLabel(11, "PCM and ee"); - hEventCounter->GetXaxis()->SetBinLabel(12, "PCM and ee && sel8 && |Z_{vtx}| < 10 cm"); + hEventCounter->GetXaxis()->SetBinLabel(5, "PCM and dielectron"); + hEventCounter->GetXaxis()->SetBinLabel(6, "PCM and dielectron && sel8 && |Z_{vtx}| < 10 cm"); registry.add("PCM_HighPt/hPt", "pT of PCM photon;p_{T,#gamma} (GeV/c)", kTH1F, {{200, 0, 20}}); registry.add("PCM_HighPt/hEtaPhi", "#eta vs. #varphi of PCM photon", kTH2F, {{72, 0, TMath::TwoPi()}, {40, -2, +2}}); - registry.add("PCM_MBCalib/hMeePt", "mass ee#gamma;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", kTH2F, {{50, 0.f, 0.5f}, {100, 0, 10}}); - registry.add("PCM_MBCalib/hMeegPt", "mass ee#gamma;m_{ee#gamma} (GeV/c^{2});p_{T,#gamma} (GeV/c)", kTH2F, {{200, 0.f, 0.4f}, {100, 0, 10}}); - registry.add("PCM_EtaDalitz/hMeePt", "mass ee;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", kTH2F, {{400, 0.f, 4.f}, {100, 0, 10}}); - registry.add("PCM_EtaDalitz/hMeegPt", "mass ee#gamma;m_{ee#gamma} (GeV/c^{2});p_{T,ee#gamma} (GeV/c)", kTH2F, {{400, 0.f, 0.8f}, {100, 0, 10}}); - registry.add("PCM_EtaGG/hMggPt", "mass ee#gamma;m_{#gamma#gamma} (GeV/c^{2});p_{T,#gamma#gamma} (GeV/c)", kTH2F, {{400, 0.f, 0.8f}, {100, 0, 10}}); registry.add("PCM_EE/hMeePt", "mass ee;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", kTH2F, {{400, 0.f, 4.f}, {100, 0, 10}}); + registry.add("PCM_EE/hMeePhiV", "mass ee;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{180, 0.f, TMath::Pi()}, {100, 0, 0.1}}); + registry.add("PCM_EE/hTPCdEdx", "n sigma TPC el vs. pin;p_{in} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0.f, 10.f}, {100, -5, 5}}); registry.add("PCM_EE/hMeegPt", "mass ee#gamma;m_{ee#gamma} (GeV/c^{2});p_{T,ee#gamma} (GeV/c)", kTH2F, {{400, 0.f, 0.8f}, {100, 0, 10}}); } Preslice perCollision_pcm = aod::v0photonkf::collisionId; - // Preslice perCollision_ee = aod::dalitzee::collisionId; - // void processPCM(MyCollisions const& collisions, aod::V0PhotonsKF const& v0photons, aod::DalitzEEs const& dielectrons) - void processPCM(MyCollisions const& collisions, aod::V0PhotonsKF const& v0photons) + Preslice perCollision_ee = aod::dalitzee::collisionId; + void processPCM(MyCollisions const& collisions, aod::V0PhotonsKF const& v0photons, aod::V0Legs const&, aod::DalitzEEs const& dielectrons, aod::EMPrimaryElectrons const&) { for (auto& collision : collisions) { registry.fill(HIST("hEventCounter"), 1); @@ -80,7 +70,7 @@ struct EMPhotonFilterQC { registry.fill(HIST("hEventCounter"), 2); } auto v0photons_coll = v0photons.sliceBy(perCollision_pcm, collision.globalIndex()); - // auto dielectrons_coll = dielectrons.sliceBy(perCollision_ee, collision.globalIndex()); + auto dielectrons_coll = dielectrons.sliceBy(perCollision_ee, collision.globalIndex()); if (collision.hasPCMHighPtPhoton()) { registry.fill(HIST("hEventCounter"), 3); @@ -93,65 +83,27 @@ struct EMPhotonFilterQC { } // end of v0 photon loop } - // if (collision.hasPCMMatCalib()) { - // registry.fill(HIST("hEventCounter"), 5); - // if (collision.sel8() && abs(collision.posZ()) < 10.f) { - // registry.fill(HIST("hEventCounter"), 6); - // } - // for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(v0photons_coll, dielectrons_coll))) { - // registry.fill(HIST("PCM_MBCalib/hMeePt"), g2.mass(), g2.pt()); - // ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); - // ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), g2.mass()); - // ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - // registry.fill(HIST("PCM_MBCalib/hMeegPt"), v12.M(), g1.pt()); - // } // end of dielectron-photon pair loop - // } - - // if (collision.hasPCMEtaDalitz()) { - // registry.fill(HIST("hEventCounter"), 7); - // if (collision.sel8() && abs(collision.posZ()) < 10.f) { - // registry.fill(HIST("hEventCounter"), 8); - // } - // for (auto& dielectron : dielectrons_coll) { - // registry.fill(HIST("PCM_EtaDalitz/hMeePt"), dielectron.mass(), dielectron.pt()); - // } - // for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(v0photons_coll, dielectrons_coll))) { - // ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); - // ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), g2.mass()); - // ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - // registry.fill(HIST("PCM_EtaDalitz/hMeegPt"), v12.M(), v12.Pt()); - // } // end of dielectron-photon pair loop - // } - - // if (collision.hasPCMEtaGG()) { - // registry.fill(HIST("hEventCounter"), 9); - // if (collision.sel8() && abs(collision.posZ()) < 10.f) { - // registry.fill(HIST("hEventCounter"), 10); - // } - // for (auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(v0photons_coll, v0photons_coll))) { - // ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); - // ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); - // ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - // registry.fill(HIST("PCM_EtaGG/hMggPt"), v12.M(), v12.Pt()); - // } // end of dielectron-photon pair loop - // } - - // if (collision.hasPCMandEE()) { - // registry.fill(HIST("hEventCounter"), 11); - // if (collision.sel8() && abs(collision.posZ()) < 10.f) { - // registry.fill(HIST("hEventCounter"), 12); - // } - - // for (auto& dielectron : dielectrons_coll) { - // registry.fill(HIST("PCM_EE/hMeePt"), dielectron.mass(), dielectron.pt()); - // } - // for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(v0photons_coll, dielectrons_coll))) { - // ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); - // ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), g2.mass()); - // ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; - // registry.fill(HIST("PCM_EE/hMeegPt"), v12.M(), v12.Pt()); - // } // end of dielectron-photon pair loop - // } + if (collision.hasPCMandEE()) { + registry.fill(HIST("hEventCounter"), 5); + if (collision.sel8() && abs(collision.posZ()) < 10.f) { + registry.fill(HIST("hEventCounter"), 6); + } + + for (auto& dielectron : dielectrons_coll) { + registry.fill(HIST("PCM_EE/hMeePt"), dielectron.mass(), dielectron.pt()); + registry.fill(HIST("PCM_EE/hMeePhiV"), dielectron.phiv(), dielectron.mass()); + auto pos_pv = dielectron.template posTrack_as(); + auto ele_pv = dielectron.template negTrack_as(); + registry.fill(HIST("PCM_EE/hTPCdEdx"), pos_pv.tpcInnerParam(), pos_pv.tpcNSigmaEl()); + registry.fill(HIST("PCM_EE/hTPCdEdx"), ele_pv.tpcInnerParam(), ele_pv.tpcNSigmaEl()); + } + for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(v0photons_coll, dielectrons_coll))) { + ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); + ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), g2.mass()); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + registry.fill(HIST("PCM_EE/hMeegPt"), v12.M(), v12.Pt()); + } // end of dielectron-photon pair loop + } } // end of collision loop } diff --git a/EventFiltering/filterTables.h b/EventFiltering/filterTables.h index 1dfd08cc23f..5493f5c3b65 100644 --- a/EventFiltering/filterTables.h +++ b/EventFiltering/filterTables.h @@ -113,7 +113,7 @@ DECLARE_SOA_COLUMN(PCMHighPtPhoton, hasPCMHighPtPhoton, bool); //! PCM high pT p // DECLARE_SOA_COLUMN(PCMMatCalib, hasPCMMatCalib, bool); //! PCM material budget calibration // DECLARE_SOA_COLUMN(PCMEtaDalitz, hasPCMEtaDalitz, bool); //! PCM eta -> ee gamma // DECLARE_SOA_COLUMN(PCMEtaGG, hasPCMEtaGG, bool); //! PCM eta -> ee gamma -// DECLARE_SOA_COLUMN(PCMandEE, hasPCMandEE, bool); //! PCM and ee +DECLARE_SOA_COLUMN(PCMandEE, hasPCMandEE, bool); //! PCM and ee } // namespace filtering namespace decision @@ -196,7 +196,7 @@ using MultFilter = MultFilters::iterator; // photons DECLARE_SOA_TABLE(PhotonFilters, "AOD", "PhotonFilters", //! - filtering::PHOSPhoton, filtering::PHOSnbar, filtering::PCMHighPtPhoton); + filtering::PHOSPhoton, filtering::PHOSnbar, filtering::PCMHighPtPhoton, filtering::PCMandEE); using PhotonFilter = PhotonFilters::iterator; From c36775adf7114926a030f358874e1a638ad2fb19 Mon Sep 17 00:00:00 2001 From: ddobrigk Date: Wed, 31 Jan 2024 10:58:38 +0100 Subject: [PATCH 16/33] PWGLF: min ITS clu length for QA studies (#4530) --- PWGLF/TableProducer/lambdakzerobuilder.cxx | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/PWGLF/TableProducer/lambdakzerobuilder.cxx b/PWGLF/TableProducer/lambdakzerobuilder.cxx index 2a124b73fa7..a79ea55d94d 100644 --- a/PWGLF/TableProducer/lambdakzerobuilder.cxx +++ b/PWGLF/TableProducer/lambdakzerobuilder.cxx @@ -1054,10 +1054,11 @@ struct lambdakzeroPreselector { Configurable dTPCNCrossedRows{"dTPCNCrossedRows", 50, "Minimum TPC crossed rows"}; // context-aware selections - Configurable dPreselectOnlyBaryons{"dPreselectOnlyBaryons", false, "apply TPC dE/dx and quality only to baryon daughters"}; + Configurable dPreselectOnlyBaryons{"dPreselectOnlyBaryons", false, "apply TPC dE/dx only to baryon daughters"}; // for debugging and further tests Configurable forceITSOnlyMesons{"forceITSOnlyMesons", false, "force meson-like daughters to be ITS-only to pass Lambda/AntiLambda selections (yes/no)"}; + Configurable minITSCluITSOnly{"minITSCluITSOnly", 0, "minimum number of ITS clusters to ask for if daughter track does not have TPC"}; // for bit-packed maps std::vector selectionMask; @@ -1104,25 +1105,31 @@ struct lambdakzeroPreselector { // check track explicitly for absence of TPC bool posITSonly = !lPosTrack.hasTPC(); bool negITSonly = !lNegTrack.hasTPC(); + bool longPosITSonly = posITSonly && lPosTrack.itsNCls() >= minITSCluITSOnly; + bool longNegITSonly = negITSonly && lNegTrack.itsNCls() >= minITSCluITSOnly; // No baryons in decay if (((bitcheck(maskElement, bitdEdxGamma) || bitcheck(maskElement, bitdEdxK0Short)) || passdEdx) && (posRowsOK && negRowsOK) && (!forceITSOnlyMesons || (posITSonly && negITSonly))) bitset(maskElement, bitTrackQuality); // With baryons in decay - if ((bitcheck(maskElement, bitdEdxLambda) || passdEdx) && - (posRowsOK && (negRowsOK || dPreselectOnlyBaryons)) && + if ((bitcheck(maskElement, bitdEdxLambda) || passdEdx) && // logical AND with dEdx + (posRowsOK && (negRowsOK || dPreselectOnlyBaryons)) && // rows requirement + ((posRowsOK || longPosITSonly) && (negRowsOK || longNegITSonly)) && // if ITS-only, check for min length (!forceITSOnlyMesons || negITSonly)) bitset(maskElement, bitTrackQuality); - if ((bitcheck(maskElement, bitdEdxAntiLambda) || passdEdx) && - (negRowsOK && (posRowsOK || dPreselectOnlyBaryons)) && + if ((bitcheck(maskElement, bitdEdxAntiLambda) || passdEdx) && // logical AND with dEdx + (negRowsOK && (posRowsOK || dPreselectOnlyBaryons)) && // rows requirement + ((posRowsOK || longPosITSonly) && (negRowsOK || longNegITSonly)) && // if ITS-only, check for min length (!forceITSOnlyMesons || posITSonly)) bitset(maskElement, bitTrackQuality); - if ((bitcheck(maskElement, bitdEdxHypertriton) || passdEdx) && - (posRowsOK && (negRowsOK || dPreselectOnlyBaryons)) && + if ((bitcheck(maskElement, bitdEdxHypertriton) || passdEdx) && // logical AND with dEdx + (posRowsOK && (negRowsOK || dPreselectOnlyBaryons)) && // rows requirement + ((posRowsOK || longPosITSonly) && (negRowsOK || longNegITSonly)) && // if ITS-only, check for min length (!forceITSOnlyMesons || negITSonly)) bitset(maskElement, bitTrackQuality); - if ((bitcheck(maskElement, bitdEdxAntiHypertriton) || passdEdx) && - (negRowsOK && (posRowsOK || dPreselectOnlyBaryons)) && + if ((bitcheck(maskElement, bitdEdxAntiHypertriton) || passdEdx) && // logical AND with dEdx + (negRowsOK && (posRowsOK || dPreselectOnlyBaryons)) && // rows requirement + ((posRowsOK || longPosITSonly) && (negRowsOK || longNegITSonly)) && // if ITS-only, check for min length (!forceITSOnlyMesons || posITSonly)) bitset(maskElement, bitTrackQuality); } From 7b95d90084465d2f4c686aa6ab0efba11ae8f800 Mon Sep 17 00:00:00 2001 From: ariedel-cern <85537041+ariedel-cern@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:13:31 +0100 Subject: [PATCH 17/33] PWGCF: trigger update (#4509) * Feat: set cut on ITS cluster separately for different particles * Feat: add separate cut on ITSncls for protons and deuterons * Fix: fix description --- EventFiltering/PWGCF/CFFilterAll.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/EventFiltering/PWGCF/CFFilterAll.cxx b/EventFiltering/PWGCF/CFFilterAll.cxx index fb719a02bcf..af82533681a 100644 --- a/EventFiltering/PWGCF/CFFilterAll.cxx +++ b/EventFiltering/PWGCF/CFFilterAll.cxx @@ -139,6 +139,8 @@ static const float MomCorLimits[2][nMomCorCuts] = static const float PIDForTrackingTable[2][nTracks]{ {-1, 0.75}, {-1, 1.2}}; +static const float ITSCutsTable[1][nTracks] = { + {1, 1}}; static const float triggerSwitches[1][nAllTriggers]{ {1, 1, 1, 1, 1, 1}}; @@ -298,13 +300,13 @@ struct CFFilter { "ConfTrkTPCsClsMax", 160, "Maximum number of shared TPC clusters"}; - Configurable ConfTrkITSnclsMin{ + Configurable> ConfTrkITSnclsMin{ "ConfTrkITSnclsMin", - 0, + {CFTrigger::ITSCutsTable[0], 1, CFTrigger::nTracks, std::vector{"Cut"}, CFTrigger::SpeciesName}, "Minimum number of ITS clusters"}; - Configurable ConfTrkITSnclsIbMin{ - "ConfTrkITSnclsIbMin", - 0, + Configurable> ConfTrkITSnclsIBMin{ + "ConfTrkITSnclsIBMin", + {CFTrigger::ITSCutsTable[0], 1, CFTrigger::nTracks, std::vector{"Cut"}, CFTrigger::SpeciesName}, "Minimum number of ITS clusters in the inner barrel"}; Configurable ConfTrkDCAxyMax{ "ConfTrkDCAxyMax", @@ -898,10 +900,10 @@ struct CFFilter { if (tpcNClsS > ConfTrkTPCsClsMax) { return false; } - if (itsNCls < ConfTrkITSnclsMin) { + if (itsNCls < ConfTrkITSnclsMin->get(static_cast(0), partSpecies)) { return false; } - if (itsNClsIB < ConfTrkITSnclsIbMin) { + if (itsNClsIB < ConfTrkITSnclsIBMin->get(static_cast(0), partSpecies)) { return false; } if (std::abs(dcaXY) > ConfTrkDCAxyMax) { From cbe3f5bb2d9d0d12c255fabd981841a0279e4d69 Mon Sep 17 00:00:00 2001 From: glromane <95305986+glromane@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:19:42 +0100 Subject: [PATCH 18/33] fixing index referencing and adding minor improvements and adjustments (#4527) * fixing index referencing and adding minor improvements and adjustments * fixing formating --- PWGCF/Femto3D/Core/femto3dPairTask.h | 24 ++++--- PWGCF/Femto3D/Tasks/femto3dPairTask.cxx | 76 ++++++++++++++++------- PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx | 74 +++++++++++++++++----- PWGCF/Femto3D/Tasks/femto3dQA.cxx | 2 +- 4 files changed, 125 insertions(+), 51 deletions(-) diff --git a/PWGCF/Femto3D/Core/femto3dPairTask.h b/PWGCF/Femto3D/Core/femto3dPairTask.h index 531ed6da942..43baeb6a9bc 100755 --- a/PWGCF/Femto3D/Core/femto3dPairTask.h +++ b/PWGCF/Femto3D/Core/femto3dPairTask.h @@ -70,27 +70,25 @@ float GetKstarFrom4vectors(TLorentzVector& first4momentum, TLorentzVector& secon return 0.5 * abs(fourmomentadiff.Mag()); } else { TLorentzVector fourmomentasum = first4momentum + second4momentum; + TLorentzVector fourmomentadif = first4momentum - second4momentum; - first4momentum.Boost((-1) * fourmomentasum.BoostVector()); - second4momentum.Boost((-1) * fourmomentasum.BoostVector()); + fourmomentadif.Boost((-1) * fourmomentasum.BoostVector()); - TVector3 qinv = first4momentum.Vect() - second4momentum.Vect(); - return 0.5 * abs(qinv.Mag()); + return 0.5 * abs(fourmomentadif.Vect().Mag()); } } //==================================================================================== -TVector3 Get3dKstarFrom4vectors(TLorentzVector& first4momentum, TLorentzVector& second4momentum) +TVector3 GetQLCMSFrom4vectors(TLorentzVector& first4momentum, TLorentzVector& second4momentum) { TLorentzVector fourmomentasum = first4momentum + second4momentum; - first4momentum.Boost(0.0, 0.0, (-1) * fourmomentasum.BoostVector().Z()); // boost to LCMS - second4momentum.Boost(0.0, 0.0, (-1) * fourmomentasum.BoostVector().Z()); // boost to LCMS + TLorentzVector fourmomentadif = first4momentum - second4momentum; - TVector3 qinv = first4momentum.Vect() - second4momentum.Vect(); - qinv.RotateZ((-1) * fourmomentasum.Phi()); // rotate so the X axis is along pair's kT + fourmomentadif.Boost(0.0, 0.0, (-1) * fourmomentasum.BoostVector().Z()); // boost to LCMS + fourmomentadif.RotateZ((-1) * fourmomentasum.Phi()); // rotate so the X axis is along pair's kT - return 0.5 * qinv; + return fourmomentadif.Vect(); } //==================================================================================== @@ -169,7 +167,7 @@ class FemtoPair return 1000; } float GetKstar() const; - TVector3 Get3dKstar() const; + TVector3 GetQLCMS() const; float GetKt() const; float GetMt() const; // test @@ -232,7 +230,7 @@ float FemtoPair::GetKstar() const } template -TVector3 FemtoPair::Get3dKstar() const +TVector3 FemtoPair::GetQLCMS() const { if (_first == NULL || _second == NULL) return TVector3(-1000, -1000, -1000); @@ -246,7 +244,7 @@ TVector3 FemtoPair::Get3dKstar() const TLorentzVector second4momentum; second4momentum.SetPtEtaPhiM(_second->pt(), _second->eta(), _second->phi(), particle_mass(_PDG2)); - return Get3dKstarFrom4vectors(first4momentum, second4momentum); + return GetQLCMSFrom4vectors(first4momentum, second4momentum); } template diff --git a/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx b/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx index f19a4a0de79..056560f8a4a 100755 --- a/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx +++ b/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx @@ -13,6 +13,10 @@ /// \author Sofia Tomassini, Gleb Romanenko, Nicolò Jacazio /// \since 31 May 2023 +#include +#include // std::random_shuffle +#include +#include #include #include #include @@ -84,7 +88,15 @@ struct FemtoCorrelations { ConfigurableAxis CFkStarBinning{"CFkStarBinning", {500, 0.005, 5.005}, "k* binning of the CF (Nbins, lowlimit, uplimit)"}; Configurable _fill3dCF{"fill3dCF", false, "flag for filling 3D LCMS histos: true -- fill; false -- not"}; - ConfigurableAxis CF3DkStarBinning{"CF3DkStarBinning", {100, -0.25, 0.25}, "k* binning of the CF 3D in LCMS (Nbins, lowlimit, uplimit)"}; + ConfigurableAxis CF3DqLCMSBinning{"CF3DqLCMSBinning", {60, -0.3, 0.3}, "q_out/side/long binning of the CF 3D in LCMS (Nbins, lowlimit, uplimit)"}; + // the next configarable is responsible for skipping (pseudo)randomly chosen ($value -1) pairs of events in the mixing process + // migth be useful (for the sake of execution time and the output file size ...) in case of too many events per DF since in the SE thacks are mixed in N_ev and in the ME 0.5*N_ev*(N_ev - 1) + // note that in the SE number of pairs per event = 0.5*N_trks*(N_trks - 1) BUT in the ME its = N_trks^2 so final differense in the SE & ME pairs histos will be more + // P.S.: the explanation might be not very clear (sorry for that) as well as the name of the variable so, feel free to change it! + // P.P.S. the chosen way of optimizing the mixing midgt not be the correct one -- feel free to propose the right one! + // P.P.P.S. choose wisely.... + // P.P.P.P.S this way is still being testing i might be reconsidered; might change in the future, keep looking at the source code + Configurable _MEreductionFactor{"MEreductionFactor", 1, "only one (pseudo)randomly choosen event out per pair $value events will be processed and contribute to the final mixing (if < 1 -> all the possible event pairs (per vertex¢ bin) will be processed); implemented for the sake of efficiency; look at the source code;"}; bool IsIdentical; @@ -128,7 +140,7 @@ struct FemtoCorrelations { std::vector>> SEhistos_3D; std::vector>> MEhistos_3D; - std::vector>> kStarVSkStar3D; + std::vector>> qLCMSvskStar; void init(o2::framework::InitContext&) { @@ -179,19 +191,19 @@ struct FemtoCorrelations { if (_fill3dCF) { std::vector> SEperMult_3D; std::vector> MEperMult_3D; - std::vector> kStarVSkStar3DperMult; + std::vector> qLCMSvskStarperMult; for (int j = 0; j < _kTbins.value.size() - 1; j++) { - auto hSE_3D = registry.add(Form("Cent%i/SE_3D_cent%i_kT%i", i, i, j), Form("SE_3D_cent%i_kT%i", i, j), kTH3F, {{CF3DkStarBinning, "k*_out (GeV/c)"}, {CF3DkStarBinning, "k*_side (GeV/c)"}, {CF3DkStarBinning, "k*_long (GeV/c)"}}); - auto hME_3D = registry.add(Form("Cent%i/ME_3D_cent%i_kT%i", i, i, j), Form("ME_3D_cent%i_kT%i", i, j), kTH3F, {{CF3DkStarBinning, "k*_out (GeV/c)"}, {CF3DkStarBinning, "k*_side (GeV/c)"}, {CF3DkStarBinning, "k*_long (GeV/c)"}}); - auto hkStarVSkStar3D = registry.add(Form("Cent%i/kStarVSkStar3D_cent%i_kT%i", i, i, j), Form("kStarVSkStar3D_3D_cent%i_kT%i", i, j), kTH3F, {{CF3DkStarBinning, "k*_out (GeV/c)"}, {CF3DkStarBinning, "k*_side (GeV/c)"}, {CF3DkStarBinning, "k*_long (GeV/c)"}}); + auto hSE_3D = registry.add(Form("Cent%i/SE_3D_cent%i_kT%i", i, i, j), Form("SE_3D_cent%i_kT%i", i, j), kTH3F, {{CF3DqLCMSBinning, "q_out (GeV/c)"}, {CF3DqLCMSBinning, "q_side (GeV/c)"}, {CF3DqLCMSBinning, "q_long (GeV/c)"}}); + auto hME_3D = registry.add(Form("Cent%i/ME_3D_cent%i_kT%i", i, i, j), Form("ME_3D_cent%i_kT%i", i, j), kTH3F, {{CF3DqLCMSBinning, "q_out (GeV/c)"}, {CF3DqLCMSBinning, "q_side (GeV/c)"}, {CF3DqLCMSBinning, "q_long (GeV/c)"}}); + auto hqLCMSvskStar = registry.add(Form("Cent%i/qLCMSvskStar_cent%i_kT%i", i, i, j), Form("qLCMSvskStar_cent%i_kT%i", i, j), kTH3F, {{CF3DqLCMSBinning, "q_out (GeV/c)"}, {CF3DqLCMSBinning, "q_side (GeV/c)"}, {CF3DqLCMSBinning, "q_long (GeV/c)"}}); SEperMult_3D.push_back(std::move(hSE_3D)); MEperMult_3D.push_back(std::move(hME_3D)); - kStarVSkStar3DperMult.push_back(std::move(hkStarVSkStar3D)); + qLCMSvskStarperMult.push_back(std::move(hqLCMSvskStar)); } SEhistos_3D.push_back(std::move(SEperMult_3D)); MEhistos_3D.push_back(std::move(MEperMult_3D)); - kStarVSkStar3D.push_back(std::move(kStarVSkStar3DperMult)); + qLCMSvskStar.push_back(std::move(qLCMSvskStarperMult)); } } @@ -242,8 +254,8 @@ struct FemtoCorrelations { SEhistos_1D[multBin][kTbin]->Fill(Pair->GetKstar()); // close pair rejection and fillig the SE histo if (_fill3dCF) { - TVector3 KstarLCMS = Pair->Get3dKstar(); - SEhistos_3D[multBin][kTbin]->Fill(KstarLCMS.X(), KstarLCMS.Y(), KstarLCMS.Z()); + TVector3 qLCMS = Pair->GetQLCMS(); + SEhistos_3D[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z()); } } Pair->ResetPair(); @@ -289,16 +301,16 @@ struct FemtoCorrelations { mThistos[multBin][kTbin]->Fill(Pair->GetMt()); // test if (_fill3dCF) { - TVector3 KstarLCMS = Pair->Get3dKstar(); - SEhistos_3D[multBin][kTbin]->Fill(KstarLCMS.X(), KstarLCMS.Y(), KstarLCMS.Z()); + TVector3 qLCMS = Pair->GetQLCMS(); + SEhistos_3D[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z()); } } else { MEhistos_1D[multBin][kTbin]->Fill(Pair->GetKstar()); if (_fill3dCF) { - TVector3 KstarLCMS = Pair->Get3dKstar(); - MEhistos_3D[multBin][kTbin]->Fill(KstarLCMS.X(), KstarLCMS.Y(), KstarLCMS.Z()); - kStarVSkStar3D[multBin][kTbin]->Fill(KstarLCMS.X(), KstarLCMS.Y(), KstarLCMS.Z(), Pair->GetKstar()); + TVector3 qLCMS = Pair->GetQLCMS(); + MEhistos_3D[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z()); + qLCMSvskStar[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z(), Pair->GetKstar()); } } } @@ -313,11 +325,11 @@ struct FemtoCorrelations { LOGF(fatal, "One of passed PDG is 0!!!"); for (auto track : tracks) { - if (abs(track.singleCollSel().posZ()) > _vertexZ) + if (abs(track.template singleCollSel_as>().posZ()) > _vertexZ) continue; if (track.tpcNClsShared() > _tpcNClsShared || track.itsNCls() < _itsNCls) continue; - if (track.singleCollSel().multPerc() < *_centBins.value.begin() || track.singleCollSel().multPerc() >= *(_centBins.value.end() - 1)) + if (track.template singleCollSel_as>().multPerc() < *_centBins.value.begin() || track.template singleCollSel_as>().multPerc() >= *(_centBins.value.end() - 1)) continue; if (track.sign() == _sign_1 && (track.p() < _PIDtrshld_1 ? o2::aod::singletrackselector::TPCselection(track, TPCcuts_1) : o2::aod::singletrackselector::TOFselection(track, TOFcuts_1, _tpcNSigmaResidual_1))) { // filling the map: eventID <-> selected particles1 @@ -388,8 +400,9 @@ struct FemtoCorrelations { if (IsIdentical) { //====================================== mixing identical ====================================== for (auto i = mixbins.begin(); i != mixbins.end(); i++) { // iterating over all vertex&mult bins + int EvPerBin = (i->second).size(); - for (int indx1 = 0; indx1 < (i->second).size(); indx1++) { // loop over all the events in each vertex&mult bin + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin auto col1 = (i->second)[indx1]; @@ -399,9 +412,19 @@ struct FemtoCorrelations { int centBin = std::floor((i->first).second); MultHistos[centBin]->Fill(col1->mult()); + if (_fill3dCF) { // shuffling is important only for 3D because if there are any sudden order/correlation in the tables, it could couse unwanted asymmetries in the final 3d rel. momentum distributions; irrelevant in 1D case because the absolute value of the rel.momentum is taken + std::mt19937 gen(std::chrono::steady_clock::now().time_since_epoch().count()); + std::shuffle(selectedtracks_1[col1->index()].begin(), selectedtracks_1[col1->index()].end(), gen); + } + mixTracks(selectedtracks_1[col1->index()], centBin); // mixing SE identical - for (int indx2 = indx1 + 1; indx2 < (i->second).size(); indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + if (_MEreductionFactor.value > 1) { + std::mt19937 mt(std::chrono::steady_clock::now().time_since_epoch().count()); + if ((mt() % (_MEreductionFactor.value + 1)) < _MEreductionFactor.value) + continue; + } auto col2 = (i->second)[indx2]; @@ -414,8 +437,9 @@ struct FemtoCorrelations { } else { //====================================== mixing non-identical ====================================== for (auto i = mixbins.begin(); i != mixbins.end(); i++) { // iterating over all vertex&mult bins + int EvPerBin = (i->second).size(); - for (int indx1 = 0; indx1 < (i->second).size(); indx1++) { // loop over all the events in each vertex&mult bin + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin auto col1 = (i->second)[indx1]; @@ -425,9 +449,19 @@ struct FemtoCorrelations { int centBin = std::floor((i->first).second); MultHistos[centBin]->Fill(col1->mult()); + if (_fill3dCF) { + std::mt19937 gen(std::chrono::steady_clock::now().time_since_epoch().count()); + std::shuffle(selectedtracks_1[col1->index()].begin(), selectedtracks_1[col1->index()].end(), gen); + } + mixTracks<0>(selectedtracks_1[col1->index()], selectedtracks_2[col1->index()], centBin); // mixing SE non-identical, in <> brackets: 0 -- SE; 1 -- ME - for (int indx2 = indx1 + 1; indx2 < (i->second).size(); indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + if (_MEreductionFactor.value > 1) { + std::mt19937 mt(std::chrono::steady_clock::now().time_since_epoch().count()); + if (mt() % (_MEreductionFactor.value + 1) < _MEreductionFactor.value) + continue; + } auto col2 = (i->second)[indx2]; diff --git a/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx b/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx index 44fbe8adf53..b7d83d8d6a7 100755 --- a/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx +++ b/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx @@ -77,6 +77,9 @@ struct FemtoCorrelationsMC { ConfigurableAxis CFkStarBinning{"CFkStarBinning", {500, 0.005, 5.005}, "k* binning of the res. matrix (Nbins, lowlimit, uplimit)"}; + Configurable _vertexNbinsToMix{"vertexNbinsToMix", 10, "Number of vertexZ bins for the mixing"}; + Configurable _multNsubBins{"multSubBins", 10, "number of sub-bins to perform the mixing within"}; + bool IsIdentical; std::pair> TPCcuts_1; @@ -93,6 +96,7 @@ struct FemtoCorrelationsMC { std::map> selectedtracks_1; std::map> selectedtracks_2; + std::map, std::vector> mixbins; std::unique_ptr> Pair = std::make_unique>(); @@ -158,8 +162,6 @@ struct FemtoCorrelationsMC { for (int iii = ii + 1; iii < tracks.size(); iii++) { Pair->SetPair(tracks[ii], tracks[iii]); - Pair->SetMagField1((tracks[ii]->singleCollSel()).magField()); - Pair->SetMagField2((tracks[iii]->singleCollSel()).magField()); registry.fill(HIST("DoubleTrackEffects"), Pair->GetPhiStarDiff(_radiusTPC), Pair->GetEtaDiff()); Pair->ResetPair(); @@ -174,8 +176,6 @@ struct FemtoCorrelationsMC { for (auto iii : tracks2) { Pair->SetPair(ii, iii); - Pair->SetMagField1((ii->singleCollSel()).magField()); - Pair->SetMagField2((iii->singleCollSel()).magField()); registry.fill(HIST("DoubleTrackEffects"), Pair->GetPhiStarDiff(_radiusTPC), Pair->GetEtaDiff()); Pair->ResetPair(); @@ -209,7 +209,7 @@ struct FemtoCorrelationsMC { int trackPDG, trackOrigin; for (auto track : tracks) { - if (abs(track.singleCollSel().posZ()) > _vertexZ) + if (abs(track.template singleCollSel_as>().posZ()) > _vertexZ) continue; if (track.tpcNClsShared() > _tpcNClsShared || track.itsNCls() < _itsNCls) continue; @@ -305,29 +305,67 @@ struct FemtoCorrelationsMC { } } + for (auto collision : collisions) { + if (selectedtracks_1.find(collision.globalIndex()) == selectedtracks_1.end()) { + if (IsIdentical) + continue; + else if (selectedtracks_2.find(collision.globalIndex()) == selectedtracks_2.end()) + continue; + } + int vertexBinToMix = std::floor((collision.posZ() + _vertexZ) / (2 * _vertexZ / _vertexNbinsToMix)); + int centBinToMix = std::floor(collision.multPerc() / (100.0 / _multNsubBins)); + + mixbins[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + } + //====================================== filling deta(dphi*) & res. matrix starts here ====================================== if (IsIdentical) { //====================================== identical ====================================== - for (auto i = selectedtracks_1.begin(); i != selectedtracks_1.end(); i++) { // iterating over all selected collisions with selected tracks - fillEtaPhi(i->second); // filling deta(dphi*) -- SE identical - auto j = i; + for (auto i = mixbins.begin(); i != mixbins.end(); i++) { // iterating over all vertex&mult bins + + for (int indx1 = 0; indx1 < (i->second).size(); indx1++) { // iterating over all selected collisions with selected tracks + + auto col1 = (i->second)[indx1]; + + Pair->SetMagField1(col1->magField()); + Pair->SetMagField2(col1->magField()); + + fillEtaPhi(selectedtracks_1[col1->index()]); // filling deta(dphi*) -- SE identical + + for (int indx2 = indx1 + 1; indx2 < (i->second).size(); indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin - for (++j; j != selectedtracks_1.end(); j++) { // nested loop to do all the ME identical combinations - fillResMatrix(i->second, j->second); // filling res. matrix -- ME identical + auto col2 = (i->second)[indx2]; + + Pair->SetMagField2(col2->magField()); + fillResMatrix(selectedtracks_1[col1->index()], selectedtracks_1[col2->index()]); // filling res. matrix -- ME identical + } } } + } else { //====================================== non-identical ====================================== - for (auto i = selectedtracks_1.begin(); i != selectedtracks_1.end(); i++) { // iterating over all selected collisions with selected tracks1 - auto ii = selectedtracks_2.find(i->first); - if (ii != selectedtracks_2.end()) - fillEtaPhi(i->second, ii->second); // checking if there are tracks2 for the choosen collision and filling deta(dphi*) -- SE non-identical + for (auto i = mixbins.begin(); i != mixbins.end(); i++) { // iterating over all vertex&mult bins + + for (int indx1 = 0; indx1 < (i->second).size(); indx1++) { // iterating over all selected collisions with selected tracks1 + + auto col1 = (i->second)[indx1]; + + Pair->SetMagField1(col1->magField()); + Pair->SetMagField2(col1->magField()); + + fillEtaPhi(selectedtracks_1[col1->index()], selectedtracks_2[col1->index()]); // filling deta(dphi*) -- SE non-identical - for (auto j = selectedtracks_2.begin(); j != selectedtracks_2.end(); j++) { // nested loop to do all the ME non-identical combinations - fillResMatrix(i->second, j->second); // filling res. matrix -- ME non-identical + for (int indx2 = indx1 + 1; indx2 < (i->second).size(); indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + + auto col2 = (i->second)[indx2]; + + Pair->SetMagField2(col2->magField()); + fillResMatrix(selectedtracks_1[col1->index()], selectedtracks_2[col2->index()]); // filling res. matrix -- ME non-identical + } } } + } //====================================== end of mixing non-identical ====================================== // clearing up @@ -340,6 +378,10 @@ struct FemtoCorrelationsMC { (i->second).clear(); selectedtracks_2.clear(); } + + for (auto i = mixbins.begin(); i != mixbins.end(); i++) + (i->second).clear(); + mixbins.clear(); } }; diff --git a/PWGCF/Femto3D/Tasks/femto3dQA.cxx b/PWGCF/Femto3D/Tasks/femto3dQA.cxx index 38ac8f26c5b..1a0483114d0 100755 --- a/PWGCF/Femto3D/Tasks/femto3dQA.cxx +++ b/PWGCF/Femto3D/Tasks/femto3dQA.cxx @@ -144,7 +144,7 @@ struct QAHistograms { } for (auto& track : tracks) { - if (abs(track.singleCollSel().posZ()) > _vertexZ) + if (abs(track.template singleCollSel_as().posZ()) > _vertexZ) continue; if ((track.tpcNClsShared()) > _tpcNClsShared || (track.itsNCls()) < _itsNCls) continue; From 258634feea0f970b4861461b49c06ac82fd99839 Mon Sep 17 00:00:00 2001 From: Tanu Gahlaut <154991749+TGahlaut1@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:01:33 +0530 Subject: [PATCH 19/33] PWGCF: Update MeanPtFlucIdentified.cxx (#4529) --- .../Tasks/MeanPtFlucIdentified.cxx | 664 +++++++----------- 1 file changed, 257 insertions(+), 407 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx b/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx index ddbbe9d6a9b..b5bf728875a 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx @@ -19,13 +19,15 @@ #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/HistogramSpec.h" + #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Centrality.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/HistogramSpec.h" + #include "TDatabasePDG.h" #include "TLorentzVector.h" @@ -49,7 +51,7 @@ struct meanPtFlucId { Configurable rapCut{"rapCut", 0.5, "Rapidity Cut"}; Configurable dcaXYCut{"dcaXYCut", 0.12, "DCAxy cut"}; Configurable dcaZCut{"dcaZCut", 1.0, "DCAz cut"}; - Configurable posZCut{"posZCut", 7.0, "cut for vertex Z"}; + Configurable posZCut{"posZCut", 10.0, "cut for vertex Z"}; Configurable nSigCut1{"nSigCut1", 1.0, "nSigma cut (1)"}; Configurable nSigCut2{"nSigCut2", 2.0, "nSigma cut (2)"}; Configurable nSigCut3{"nSigCut3", 3.0, "nSigma cut (3)"}; @@ -75,8 +77,8 @@ struct meanPtFlucId { Configurable prP4{"prP4", 1.05, "proton p (4)"}; Configurable prP5{"prP5", 1.13, "proton p (5)"}; Configurable prP6{"prP6", 1.18, "proton p (6)"}; - ConfigurableAxis multTPCBins{"multTPCBins", {200, 0, 1000}, "TPC Multiplicity bins"}; - ConfigurableAxis multFT0MBins{"multFT0MBins", {150, 0, 15000}, "Forward Multiplicity bins"}; + ConfigurableAxis multTPCBins{"multTPCBins", {150, 0, 150}, "TPC Multiplicity bins"}; + ConfigurableAxis multFT0MBins{"multFT0MBins", {150, 0, 1500}, "Forward Multiplicity bins"}; ConfigurableAxis dcaXYBins{"dcaXYBins", {100, -0.15, 0.15}, "dcaXY bins"}; ConfigurableAxis dcaZBins{"dcaZBins", {100, -1.2, 1.2}, "dcaZ bins"}; @@ -84,7 +86,8 @@ struct meanPtFlucId { aod::pidTOFFullPi, aod::pidTPCFullPi, aod::pidTOFFullPr, aod::pidTPCFullPr, aod::pidTOFFullKa, aod::pidTPCFullKa, aod::pidTOFFullEl, aod::pidTPCFullEl, aod::pidTOFbeta>; - using MyAllCollisions = soa::Join; + using MyRun2Collisions = soa::Join; + using MyRun3Collisions = soa::Join; HistogramRegistry hist{"hist", {}, OutputObjHandlingPolicy::AnalysisObject}; void init(InitContext const&) @@ -110,7 +113,7 @@ struct meanPtFlucId { const AxisSpec axisChi2{50, 0., 50., "Chi2"}; const AxisSpec axisCrossedTPC{500, 0, 500, "Crossed TPC"}; - HistogramConfigSpec QnHist({HistType::kTHnSparseD, {axisMultTPC, axisPart, axisMultFT0M}}); + HistogramConfigSpec QnHist({HistType::kTHnSparseD, {axisMultTPC, axisPart, axisCentFT0M}}); HistogramConfigSpec TOFnSigmaHist({HistType::kTH2D, {axisP, axisTOFNsigma}}); HistogramConfigSpec TOFSignalHist({HistType::kTH2D, {axisP, axisTOFSignal}}); HistogramConfigSpec TPCnSigmaHist({HistType::kTH2D, {axisP, axisTPCNsigma}}); @@ -143,7 +146,6 @@ struct meanPtFlucId { hist.add("QA/after/p_NTPC_Cent", "N_{TPC} vs FT0M(%) (Profile)", kTProfile, {{axisCentFT0M}}); hist.add("QA/after/h2_NTPC_Nch", "N_{ch} vs N_{TPC}", kTH2D, {{axisMultTPC}, {axisMult}}); - hist.add("QA/Pion/h_Mult", "Multiplicity", kTH1D, {axisMult}); hist.add("QA/Pion/h_Pt", "p_{T} (TPC & TPC+TOF)", kTH1D, {axisPt}); hist.add("QA/Pion/h_rap", "y (TPC & TPC+TOF)", kTH1D, {axisY}); hist.add("QA/Pion/h2_Pt_rap", "p_{T} vs y", kTH2D, {{axisY}, {axisPt}}); @@ -158,14 +160,6 @@ struct meanPtFlucId { hist.add("QA/Pion/h2_TPCSignal", "TPC Signal Pions", TPCSignalHist); hist.add("QA/Pion/h2_TOFSignal", "TOF Signal Pions", TOFSignalHist); hist.add("QA/Pion/h2_ExpTPCSignal", "Expected TPC Signal Pions", TPCSignalHist); - // extra QA - hist.add("QA/Pion/TPC/h_Pt_TPC", "p_{T} TPC", kTH1D, {axisPt}); - hist.add("QA/Pion/TPC/h_rap_TPC", "y TPC ", kTH1D, {axisY}); - hist.add("QA/Pion/TPC/h2_TPCSignal", "TPC Signal ", TPCSignalHist); - hist.add("QA/Pion/TPC/h2_ExpTPCSignal", "Expected TPC Signal", TPCSignalHist); - hist.add("QA/Pion/TOF/h_Pt_TOF", "p_{T} TPC+TOF", kTH1D, {axisPt}); - hist.add("QA/Pion/TOF/h_rap_TOF", "y TPC+TOF ", kTH1D, {axisY}); - hist.add("QA/Pion/TOF/h2_TOFSignal", "TOF Signal ", TOFSignalHist); hist.addClone("QA/Pion/", "QA/Kaon/"); hist.addClone("QA/Pion/", "QA/Proton/"); @@ -178,10 +172,6 @@ struct meanPtFlucId { hist.add("Analysis/Charged/h_twopart_Mult", "Twopart vs N_{ch} ", QnHist); hist.add("Analysis/Charged/h_threepart_Mult", "Threepart vs N_{ch} ", QnHist); hist.add("Analysis/Charged/h_fourpart_Mult", "Fourpart vs N_{ch} ", QnHist); - hist.add("Analysis/Charged/h_mean_Q1_Mult_tpc", "mean_Q1_Mult (TPC)", QnHist); - hist.add("Analysis/Charged/h_twopart_Mult_tpc", "twopart_Mult (TPC)", QnHist); - hist.add("Analysis/Charged/h_mean_Q1_Mult_tof", "mean_Q1_Mult (TOF+TPC)", QnHist); - hist.add("Analysis/Charged/h_twopart_Mult_tof", "twopart_Mult (TOF+TPC)", QnHist); hist.addClone("Analysis/Charged/", "Analysis/Pion/"); hist.addClone("Analysis/Charged/", "Analysis/Kaon/"); @@ -189,109 +179,52 @@ struct meanPtFlucId { } template - bool selCol(T const& col) - { - if (col.posZ() > posZCut) - return false; - - if (!col.sel8()) - return false; - - return true; - } - - template - bool selTrack(T const& track) + bool selRun2Col(T const& col) { - - if (track.pt() < ptMin) - return false; - - if (track.pt() > ptMax) - return false; - - if (std::abs(track.eta()) > etaCut) - return false; - - if (std::abs(track.dcaZ()) > dcaZCut) + if (std::abs(col.posZ()) > posZCut) return false; - if (std::abs(track.dcaXY()) > dcaXYCut) - return false; - - if (!track.isGlobalTrack()) - return false; - - return true; - } - - template - bool selPiTPC(T const& track) - { - if (abs(track.tpcNSigmaPi()) > nSigCut3) + if (!col.sel7()) return false; - if (abs(track.rapidity(massPi)) >= 0.5) + if (!col.alias_bit(kINT7)) return false; return true; } template - bool selKaTPC(T const& track) + bool selRun3Col(T const& col) { - if (abs(track.tpcNSigmaKa()) > nSigCut3) + if (std::abs(col.posZ()) > posZCut) return false; - if (abs(track.rapidity(massKa)) >= 0.5) + if (!col.sel8()) return false; return true; } template - bool selPrTPC(T const& track) + bool selTrack(T const& track) { - if (abs(track.tpcNSigmaPr()) > nSigCut3) - return false; - - if (abs(track.rapidity(massPr)) >= 0.5) - return false; - - return true; - } - template - bool selPiTOF(T const& track) - { - if ((std::pow(track.tpcNSigmaPi(), 2) + std::pow(track.tofNSigmaPi(), 2)) > 6.0) + if (track.pt() < ptMin) return false; - if (abs(track.rapidity(massPi)) >= 0.5) + if (track.pt() > ptMax) return false; - return true; - } - - template - bool selKaTOF(T const& track) - { - if ((std::pow(track.tpcNSigmaKa(), 2) + std::pow(track.tofNSigmaKa(), 2)) > 6.0) + if (std::abs(track.eta()) > etaCut) return false; - if (abs(track.rapidity(massKa)) >= 0.5) + if (std::abs(track.dcaZ()) > dcaZCut) return false; - return true; - } - - template - bool selPrTOF(T const& track) - { - if ((std::pow(track.tpcNSigmaPr(), 2) + std::pow(track.tofNSigmaPr(), 2)) > 6.0) + if (std::abs(track.dcaXY()) > dcaXYCut) return false; - if (abs(track.rapidity(massPr)) >= 0.5) + if (!track.isGlobalTrack()) return false; return true; @@ -338,8 +271,7 @@ struct meanPtFlucId { return false; } - template - void moments(U pt, T Q1, T Q2, T Q3, T Q4) + void moments(double pt, double* Q1, double* Q2, double* Q3, double* Q4) { *Q1 += pt; *Q2 += pt * pt; @@ -347,8 +279,7 @@ struct meanPtFlucId { *Q4 += pt * pt * pt * pt; } - template - void parts(V Q1, V Q2, V Q3, V Q4, U N, T mean_Q1, T twopart, T threepart, T fourpart) + void parts(double Q1, double Q2, double Q3, double Q4, int N, double* mean_Q1, double* twopart, double* threepart, double* fourpart) { if (N > 1) { *mean_Q1 = Q1 / static_cast(N); @@ -362,17 +293,199 @@ struct meanPtFlucId { } } - template - void testParts(V Q1, V Q2, U N, T mean_Q1, T twopart) + template + void FillHistos(T const& col, U const& tracks, double Cent_FT0M, double N_FT0M, int NTPC) { - if (N > 1) { - *mean_Q1 = Q1 / static_cast(N); - *twopart = ((Q1 * Q1) - Q2) / (static_cast(N) * (static_cast(N) - 1)); + int N_Pi = 0, N_Ka = 0, N_Pr = 0; + int Nch = 0; + double pt_ch = 0, Q1_ch = 0, Q2_ch = 0, Q3_ch = 0, Q4_ch = 0; + double pt_Pi = 0, Q1_Pi = 0, Q2_Pi = 0, Q3_Pi = 0, Q4_Pi = 0; + double pt_Pr = 0, Q1_Pr = 0, Q2_Pr = 0, Q3_Pr = 0, Q4_Pr = 0; + double pt_Ka = 0, Q1_Ka = 0, Q2_Ka = 0, Q3_Ka = 0, Q4_Ka = 0; + double mean_Q1_Ch, mean_Q1_Pi, mean_Q1_Ka, mean_Q1_Pr; + double twopart_Ch, twopart_Pi, twopart_Ka, twopart_Pr; + double threepart_Ch, threepart_Pi, threepart_Ka, threepart_Pr; + double fourpart_Ch, fourpart_Pi, fourpart_Ka, fourpart_Pr; + + for (auto& track : tracks) { + if (!selTrack(track)) + continue; + + Nch++; + pt_ch = track.pt(); + moments(pt_ch, &Q1_ch, &Q2_ch, &Q3_ch, &Q4_ch); + + hist.fill(HIST("QA/after/h_Eta"), track.eta()); + hist.fill(HIST("QA/after/h_Pt"), track.pt()); + hist.fill(HIST("QA/after/h2_Pt_Eta"), track.eta(), track.pt()); + hist.fill(HIST("QA/after/h2_DcaXY"), track.pt(), track.dcaXY()); + hist.fill(HIST("QA/after/h2_DcaZ"), track.pt(), track.dcaZ()); + + hist.fill(HIST("QA/after/h_TPCChi2perCluster"), track.tpcChi2NCl()); + hist.fill(HIST("QA/after/h_ITSChi2perCluster"), track.itsChi2NCl()); + hist.fill(HIST("QA/after/h_crossedTPC"), track.tpcNClsCrossedRows()); + + hist.fill(HIST("QA/before/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/before/h2_TPCSignal"), track.p(), track.tpcSignal()); + + hist.fill(HIST("QA/Pion/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaPi()); + hist.fill(HIST("QA/Pion/before/h2_TOFNsigma"), track.p(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Pion/before/h2_TpcTofNsigma"), track.tpcNSigmaPi(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Proton/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaPr()); + hist.fill(HIST("QA/Proton/before/h2_TOFNsigma"), track.p(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Proton/before/h2_TpcTofNsigma"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Kaon/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaKa()); + hist.fill(HIST("QA/Kaon/before/h2_TOFNsigma"), track.p(), track.tofNSigmaKa()); + hist.fill(HIST("QA/Kaon/before/h2_TpcTofNsigma"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + + // For Pions: + if (selPions(track)) { + N_Pi++; + pt_Pi = track.pt(); + moments(pt_Pi, &Q1_Pi, &Q2_Pi, &Q3_Pi, &Q4_Pi); + hist.fill(HIST("QA/Pion/h_Pt"), track.pt()); + hist.fill(HIST("QA/Pion/h_rap"), track.rapidity(massPi)); + hist.fill(HIST("QA/Pion/h2_Pt_rap"), track.rapidity(massPi), track.pt()); + hist.fill(HIST("QA/Pion/h2_DcaXY"), track.pt(), track.dcaXY()); + hist.fill(HIST("QA/Pion/h2_DcaZ"), track.pt(), track.dcaZ()); + + hist.fill(HIST("QA/Pion/h2_TPCNsigma"), track.p(), track.tpcNSigmaPi()); + hist.fill(HIST("QA/Pion/h2_TOFNsigma"), track.p(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Pion/h2_TpcTofNsigma"), track.tpcNSigmaPi(), track.tofNSigmaPi()); + hist.fill(HIST("QA/Pion/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/Pion/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/Pion/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalPi(track.tpcSignal())); + hist.fill(HIST("QA/after/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/after/h2_TPCSignal"), track.p(), track.tpcSignal()); + } + + // For Kaons: + if (selKaons(track)) { + N_Ka++; + pt_Ka = track.pt(); + moments(pt_Ka, &Q1_Ka, &Q2_Ka, &Q3_Ka, &Q4_Ka); + hist.fill(HIST("QA/Kaon/h_Pt"), track.pt()); + hist.fill(HIST("QA/Kaon/h_rap"), track.rapidity(massKa)); + hist.fill(HIST("QA/Kaon/h2_Pt_rap"), track.rapidity(massKa), track.pt()); + hist.fill(HIST("QA/Kaon/h2_DcaXY"), track.pt(), track.dcaXY()); + hist.fill(HIST("QA/Kaon/h2_DcaZ"), track.pt(), track.dcaZ()); + + hist.fill(HIST("QA/Kaon/h2_TPCNsigma"), track.p(), track.tpcNSigmaKa()); + hist.fill(HIST("QA/Kaon/h2_TOFNsigma"), track.p(), track.tofNSigmaKa()); + hist.fill(HIST("QA/Kaon/h2_TpcTofNsigma"), track.tpcNSigmaKa(), track.tofNSigmaKa()); + hist.fill(HIST("QA/Kaon/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/Kaon/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/Kaon/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalKa(track.tpcSignal())); + hist.fill(HIST("QA/after/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/after/h2_TPCSignal"), track.p(), track.tpcSignal()); + } + + // For Protons: + if (selProtons(track)) { + N_Pr++; + pt_Pr = track.pt(); + moments(pt_Pr, &Q1_Pr, &Q2_Pr, &Q3_Pr, &Q4_Pr); + hist.fill(HIST("QA/Proton/h_Pt"), track.pt()); + hist.fill(HIST("QA/Proton/h_rap"), track.rapidity(massPr)); + hist.fill(HIST("QA/Proton/h2_Pt_rap"), track.rapidity(massPr), track.pt()); + hist.fill(HIST("QA/Proton/h2_DcaZ"), track.pt(), track.dcaZ()); + hist.fill(HIST("QA/Proton/h2_DcaXY"), track.pt(), track.dcaXY()); + + hist.fill(HIST("QA/Proton/h2_TPCNsigma"), track.p(), track.tpcNSigmaPr()); + hist.fill(HIST("QA/Proton/h2_TOFNsigma"), track.p(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Proton/h2_TpcTofNsigma"), track.tpcNSigmaPr(), track.tofNSigmaPr()); + hist.fill(HIST("QA/Proton/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/Proton/h2_TOFSignal"), track.p(), track.beta()); + hist.fill(HIST("QA/Proton/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalPr(track.tpcSignal())); + hist.fill(HIST("QA/after/h2_TPCSignal"), track.p(), track.tpcSignal()); + hist.fill(HIST("QA/after/h2_TOFSignal"), track.p(), track.beta()); + } } - } - void process(MyAllCollisions::iterator const& col, MyAllTracks const& tracks) + hist.fill(HIST("QA/after/h_VtxZ"), col.posZ()); + hist.fill(HIST("QA/after/h_Counts"), 2); + hist.fill(HIST("QA/after/h_NTPC"), NTPC); + hist.fill(HIST("QA/after/h_Cent"), Cent_FT0M); + hist.fill(HIST("QA/after/h_NFT0M"), N_FT0M); + hist.fill(HIST("QA/after/h2_NTPC_NFT0M"), N_FT0M, NTPC); + hist.fill(HIST("QA/after/h2_NTPC_Cent"), Cent_FT0M, NTPC); + hist.fill(HIST("QA/after/p_NTPC_Cent"), Cent_FT0M, NTPC); + hist.fill(HIST("QA/after/p_NTPC_NFT0M"), N_FT0M, NTPC); + hist.fill(HIST("QA/after/p_NFT0M_NTPC"), NTPC, N_FT0M); + hist.fill(HIST("QA/after/h2_NTPC_Nch"), NTPC, Nch); + + static constexpr std::string_view dire[] = {"Analysis/Charged/", "Analysis/Pion/", "Analysis/Kaon/", "Analysis/Proton/"}; + + hist.fill(HIST(dire[0]) + HIST("h_Mult"), Nch); + hist.fill(HIST(dire[1]) + HIST("h_Mult"), N_Pi); + hist.fill(HIST(dire[2]) + HIST("h_Mult"), N_Ka); + hist.fill(HIST(dire[3]) + HIST("h_Mult"), N_Pr); + + parts(Q1_ch, Q2_ch, Q3_ch, Q4_ch, Nch, &mean_Q1_Ch, &twopart_Ch, &threepart_Ch, &fourpart_Ch); + if (Nch > 0) { + hist.fill(HIST(dire[0]) + HIST("h_mean_Q1"), mean_Q1_Ch); + hist.fill(HIST(dire[0]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Ch); + hist.fill(HIST(dire[0]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Ch, Cent_FT0M); + } + if (Nch > 1) + hist.fill(HIST(dire[0]) + HIST("h_twopart_Mult"), NTPC, twopart_Ch, Cent_FT0M); + + if (Nch > 2) + hist.fill(HIST(dire[0]) + HIST("h_threepart_Mult"), NTPC, threepart_Ch, Cent_FT0M); + + if (Nch > 3) + hist.fill(HIST(dire[0]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Ch, Cent_FT0M); + + parts(Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi, N_Pi, &mean_Q1_Pi, &twopart_Pi, &threepart_Pi, &fourpart_Pi); + if (N_Pi > 0) { + hist.fill(HIST(dire[1]) + HIST("h_mean_Q1"), mean_Q1_Pi); + hist.fill(HIST(dire[1]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Pi); + hist.fill(HIST(dire[1]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Pi, Cent_FT0M); + } + if (N_Pi > 1) + hist.fill(HIST(dire[1]) + HIST("h_twopart_Mult"), NTPC, twopart_Pi, Cent_FT0M); + + if (N_Pi > 2) + hist.fill(HIST(dire[1]) + HIST("h_threepart_Mult"), NTPC, threepart_Pi, Cent_FT0M); + + if (N_Pi > 3) + hist.fill(HIST(dire[1]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Pi, Cent_FT0M); + + parts(Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka, N_Ka, &mean_Q1_Ka, &twopart_Ka, &threepart_Ka, &fourpart_Ka); + if (N_Ka > 0) { + hist.fill(HIST(dire[2]) + HIST("h_mean_Q1"), mean_Q1_Ka); + hist.fill(HIST(dire[2]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Ka); + hist.fill(HIST(dire[2]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Ka, Cent_FT0M); + } + if (N_Ka > 1) + hist.fill(HIST(dire[2]) + HIST("h_twopart_Mult"), NTPC, twopart_Ka, Cent_FT0M); + + if (N_Ka > 2) + hist.fill(HIST(dire[2]) + HIST("h_threepart_Mult"), NTPC, threepart_Ka, Cent_FT0M); + + if (N_Ka > 3) + hist.fill(HIST(dire[2]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Ka, Cent_FT0M); + + parts(Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr, N_Pr, &mean_Q1_Pr, &twopart_Pr, &threepart_Pr, &fourpart_Pr); + if (N_Pr > 0) { + hist.fill(HIST(dire[3]) + HIST("h_mean_Q1"), mean_Q1_Pr); + hist.fill(HIST(dire[3]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Pr); + hist.fill(HIST(dire[3]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Pr, N_FT0M); + } + if (N_Pr > 1) + hist.fill(HIST(dire[3]) + HIST("h_twopart_Mult"), NTPC, twopart_Pr, Cent_FT0M); + + if (N_Pr > 2) + hist.fill(HIST(dire[3]) + HIST("h_threepart_Mult"), NTPC, threepart_Pr, Cent_FT0M); + + if (N_Pr > 3) + hist.fill(HIST(dire[3]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Pr, Cent_FT0M); + } + void process_Run2(MyRun2Collisions::iterator const& col, MyAllTracks const& tracks) { + double Cent_V0M = 0, N_FV0M = 0; + int NTPC = 0; + // Before Collision and Track Cuts: for (auto& myTrack : tracks) { hist.fill(HIST("QA/before/h_Eta"), myTrack.eta()); @@ -388,320 +501,57 @@ struct meanPtFlucId { hist.fill(HIST("QA/before/h_Counts"), 2); hist.fill(HIST("QA/before/h_NTPC"), col.multTPC()); - hist.fill(HIST("QA/before/h_Cent"), col.centFT0M()); - hist.fill(HIST("QA/before/h_NFT0M"), col.multFT0M()); - hist.fill(HIST("QA/before/h2_NTPC_NFT0M"), col.multFT0M(), col.multTPC()); - hist.fill(HIST("QA/before/h2_NTPC_Cent"), col.centFT0M(), col.multTPC()); + hist.fill(HIST("QA/before/h_Cent"), col.centRun2V0M()); + hist.fill(HIST("QA/before/h_NFT0M"), col.multFV0M()); + hist.fill(HIST("QA/before/h2_NTPC_NFT0M"), col.multFV0M(), col.multTPC()); + hist.fill(HIST("QA/before/h2_NTPC_Cent"), col.centRun2V0M(), col.multTPC()); // After Collision and Track Cuts: - if (selCol(col)) { - int N_Pi = 0, N_Ka = 0, N_Pr = 0; - int Nch = 0, NTPC = 0, N_FT0M = 0; - int N_Ka_tpc = 0, N_Pr_tpc = 0, N_Pi_tpc = 0; - int Nch_tof = 0, N_Ka_tof = 0, N_Pr_tof = 0, N_Pi_tof = 0; - double Cent_FT0M = 0; - double pt_ch = 0, Q1_ch = 0, Q2_ch = 0, Q3_ch = 0, Q4_ch = 0; - double pt_Pi = 0, Q1_Pi = 0, Q2_Pi = 0, Q3_Pi = 0, Q4_Pi = 0; - double pt_Pr = 0, Q1_Pr = 0, Q2_Pr = 0, Q3_Pr = 0, Q4_Pr = 0; - double pt_Ka = 0, Q1_Ka = 0, Q2_Ka = 0, Q3_Ka = 0, Q4_Ka = 0; - double Q1_Pi_tpc = 0, Q1_Pr_tpc = 0, Q1_Ka_tpc = 0; - double Q2_Pi_tpc = 0, Q2_Pr_tpc = 0, Q2_Ka_tpc = 0; - double Q1_Ch_tof = 0, Q1_Pi_tof = 0, Q1_Pr_tof = 0, Q1_Ka_tof = 0; - double Q2_Ch_tof = 0, Q2_Pi_tof = 0, Q2_Pr_tof = 0, Q2_Ka_tof = 0; - double mean_Q1_Ch, mean_Q1_Pi, mean_Q1_Ka, mean_Q1_Pr; - double twopart_Ch, twopart_Pi, twopart_Ka, twopart_Pr; - double threepart_Ch, threepart_Pi, threepart_Ka, threepart_Pr; - double fourpart_Ch, fourpart_Pi, fourpart_Ka, fourpart_Pr; - double mean_Q1_Pi_tpc, mean_Q1_Ka_tpc, mean_Q1_Pr_tpc; - double twopart_Pi_tpc, twopart_Ka_tpc, twopart_Pr_tpc; - double mean_Q1_Ch_tof, mean_Q1_Pi_tof, mean_Q1_Ka_tof, mean_Q1_Pr_tof; - double twopart_Ch_tof, twopart_Pi_tof, twopart_Ka_tof, twopart_Pr_tof; - + if (selRun2Col(col)) { + Cent_V0M = col.centRun2V0M(); + N_FV0M = col.multFV0M(); for (auto& track : tracks) { - if (!selTrack(track)) - continue; - - Nch++; - pt_ch = track.pt(); - moments(pt_ch, &Q1_ch, &Q2_ch, &Q3_ch, &Q4_ch); - - hist.fill(HIST("QA/after/h_Eta"), track.eta()); - hist.fill(HIST("QA/after/h_Pt"), track.pt()); - hist.fill(HIST("QA/after/h2_Pt_Eta"), track.eta(), track.pt()); - hist.fill(HIST("QA/after/h2_DcaXY"), track.pt(), track.dcaXY()); - hist.fill(HIST("QA/after/h2_DcaZ"), track.pt(), track.dcaZ()); - - hist.fill(HIST("QA/after/h_TPCChi2perCluster"), track.tpcChi2NCl()); - hist.fill(HIST("QA/after/h_ITSChi2perCluster"), track.itsChi2NCl()); - hist.fill(HIST("QA/after/h_crossedTPC"), track.tpcNClsCrossedRows()); - - hist.fill(HIST("QA/before/h2_TOFSignal"), track.p(), track.beta()); - hist.fill(HIST("QA/before/h2_TPCSignal"), track.p(), track.tpcSignal()); - - hist.fill(HIST("QA/Pion/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaPi()); - hist.fill(HIST("QA/Pion/before/h2_TOFNsigma"), track.p(), track.tofNSigmaPi()); - hist.fill(HIST("QA/Pion/before/h2_TpcTofNsigma"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - hist.fill(HIST("QA/Proton/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaPr()); - hist.fill(HIST("QA/Proton/before/h2_TOFNsigma"), track.p(), track.tofNSigmaPr()); - hist.fill(HIST("QA/Proton/before/h2_TpcTofNsigma"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - hist.fill(HIST("QA/Kaon/before/h2_TPCNsigma"), track.p(), track.tpcNSigmaKa()); - hist.fill(HIST("QA/Kaon/before/h2_TOFNsigma"), track.p(), track.tofNSigmaKa()); - hist.fill(HIST("QA/Kaon/before/h2_TpcTofNsigma"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - - // For Pions: - if (selPions(track)) { - N_Pi++; - pt_Pi = track.pt(); - moments(pt_Pi, &Q1_Pi, &Q2_Pi, &Q3_Pi, &Q4_Pi); - hist.fill(HIST("QA/Pion/h_Pt"), track.pt()); - hist.fill(HIST("QA/Pion/h_rap"), track.rapidity(massPi)); - hist.fill(HIST("QA/Pion/h2_Pt_rap"), track.rapidity(massPi), track.pt()); - hist.fill(HIST("QA/Pion/h2_DcaXY"), track.pt(), track.dcaXY()); - hist.fill(HIST("QA/Pion/h2_DcaZ"), track.pt(), track.dcaZ()); - - hist.fill(HIST("QA/Pion/h2_TPCNsigma"), track.p(), track.tpcNSigmaPi()); - hist.fill(HIST("QA/Pion/h2_TOFNsigma"), track.p(), track.tofNSigmaPi()); - hist.fill(HIST("QA/Pion/h2_TpcTofNsigma"), track.tpcNSigmaPi(), track.tofNSigmaPi()); - hist.fill(HIST("QA/Pion/h2_TOFSignal"), track.p(), track.beta()); - hist.fill(HIST("QA/Pion/h2_TPCSignal"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/Pion/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalPi(track.tpcSignal())); - hist.fill(HIST("QA/after/h2_TOFSignal"), track.p(), track.beta()); - hist.fill(HIST("QA/after/h2_TPCSignal"), track.p(), track.tpcSignal()); - } - - // For Kaons: - if (selKaons(track)) { - N_Ka++; - pt_Ka = track.pt(); - moments(pt_Ka, &Q1_Ka, &Q2_Ka, &Q3_Ka, &Q4_Ka); - hist.fill(HIST("QA/Kaon/h_Pt"), track.pt()); - hist.fill(HIST("QA/Kaon/h_rap"), track.rapidity(massKa)); - hist.fill(HIST("QA/Kaon/h2_Pt_rap"), track.rapidity(massKa), track.pt()); - hist.fill(HIST("QA/Kaon/h2_DcaXY"), track.pt(), track.dcaXY()); - hist.fill(HIST("QA/Kaon/h2_DcaZ"), track.pt(), track.dcaZ()); - - hist.fill(HIST("QA/Kaon/h2_TPCNsigma"), track.p(), track.tpcNSigmaKa()); - hist.fill(HIST("QA/Kaon/h2_TOFNsigma"), track.p(), track.tofNSigmaKa()); - hist.fill(HIST("QA/Kaon/h2_TpcTofNsigma"), track.tpcNSigmaKa(), track.tofNSigmaKa()); - hist.fill(HIST("QA/Kaon/h2_TOFSignal"), track.p(), track.beta()); - hist.fill(HIST("QA/Kaon/h2_TPCSignal"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/Kaon/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalKa(track.tpcSignal())); - hist.fill(HIST("QA/after/h2_TOFSignal"), track.p(), track.beta()); - hist.fill(HIST("QA/after/h2_TPCSignal"), track.p(), track.tpcSignal()); - } - - // For Protons: - if (selProtons(track)) { - N_Pr++; - pt_Pr = track.pt(); - moments(pt_Pr, &Q1_Pr, &Q2_Pr, &Q3_Pr, &Q4_Pr); - hist.fill(HIST("QA/Proton/h_Pt"), track.pt()); - hist.fill(HIST("QA/Proton/h_rap"), track.rapidity(massPr)); - hist.fill(HIST("QA/Proton/h2_Pt_rap"), track.rapidity(massPr), track.pt()); - hist.fill(HIST("QA/Proton/h2_DcaZ"), track.pt(), track.dcaZ()); - hist.fill(HIST("QA/Proton/h2_DcaXY"), track.pt(), track.dcaXY()); - - hist.fill(HIST("QA/Proton/h2_TPCNsigma"), track.p(), track.tpcNSigmaPr()); - hist.fill(HIST("QA/Proton/h2_TOFNsigma"), track.p(), track.tofNSigmaPr()); - hist.fill(HIST("QA/Proton/h2_TpcTofNsigma"), track.tpcNSigmaPr(), track.tofNSigmaPr()); - hist.fill(HIST("QA/Proton/h2_TPCSignal"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/Proton/h2_TOFSignal"), track.p(), track.beta()); - hist.fill(HIST("QA/Proton/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalPr(track.tpcSignal())); - hist.fill(HIST("QA/after/h2_TPCSignal"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/after/h2_TOFSignal"), track.p(), track.beta()); - } - - // ---------------- only TPC (no p-dependent cuts) ----------------------// - // Pions: - if (selPiTPC(track)) { - N_Pi_tpc++; - Q1_Pi_tpc += track.pt(); - Q2_Pi_tpc += track.pt() * track.pt(); - hist.fill(HIST("QA/Pion/TPC/h_Pt_TPC"), track.pt()); - hist.fill(HIST("QA/Pion/TPC/h_rap_TPC"), track.rapidity(massPi)); - hist.fill(HIST("QA/Pion/TPC/h2_TPCSignal"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/Pion/TPC/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalPi(track.tpcSignal())); - } - // Kaons: - if (selKaTPC(track)) { - N_Ka_tpc++; - Q1_Ka_tpc += track.pt(); - Q2_Ka_tpc += track.pt() * track.pt(); - hist.fill(HIST("QA/Kaon/TPC/h_Pt_TPC"), track.pt()); - hist.fill(HIST("QA/Kaon/TPC/h_rap_TPC"), track.rapidity(massKa)); - hist.fill(HIST("QA/Kaon/TPC/h2_TPCSignal"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/Kaon/TPC/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalKa(track.tpcSignal())); - } - // Protons: - if (selPrTPC(track)) { - N_Pr_tpc++; - Q1_Pr_tpc += track.pt(); - Q2_Pr_tpc += track.pt() * track.pt(); - hist.fill(HIST("QA/Proton/TPC/h_Pt_TPC"), track.pt()); - hist.fill(HIST("QA/Proton/TPC/h_rap_TPC"), track.rapidity(massPr)); - hist.fill(HIST("QA/Proton/TPC/h2_TPCSignal"), track.p(), track.tpcSignal()); - hist.fill(HIST("QA/Proton/TPC/h2_ExpTPCSignal"), track.p(), track.tpcExpSignalPr(track.tpcSignal())); - } - - // ----------------- TPC with TOF (no p-dependent cuts) ---------------// - if (track.hasTOF()) { - Nch_tof++; - Q1_Ch_tof += track.pt(); - Q2_Ch_tof += track.pt() * track.pt(); - // Pions: - if (selPiTOF(track)) { - N_Pi_tof++; - Q1_Pi_tof += track.pt(); - Q2_Pi_tof += track.pt() * track.pt(); - hist.fill(HIST("QA/Pion/TOF/h_Pt_TOF"), track.pt()); - hist.fill(HIST("QA/Pion/TOF/h_rap_TOF"), track.rapidity(massPi)); - hist.fill(HIST("QA/Pion/TOF/h2_TOFSignal"), track.p(), track.beta()); - } - // Kaons: - if (selKaTOF(track)) { - N_Ka_tof++; - Q1_Ka_tof += track.pt(); - Q2_Ka_tof += track.pt() * track.pt(); - hist.fill(HIST("QA/Kaon/TOF/h_Pt_TOF"), track.pt()); - hist.fill(HIST("QA/Kaon/TOF/h_rap_TOF"), track.rapidity(massKa)); - hist.fill(HIST("QA/Kaon/TOF/h2_TOFSignal"), track.p(), track.beta()); - } - // Protons: - if (selPrTOF(track)) { - N_Pr_tof++; - Q1_Pr_tof += track.pt(); - Q2_Pr_tof += track.pt() * track.pt(); - hist.fill(HIST("QA/Proton/TOF/h_Pt_TOF"), track.pt()); - hist.fill(HIST("QA/Proton/TOF/h_rap_TOF"), track.rapidity(massPr)); - hist.fill(HIST("QA/Proton/TOF/h2_TOFSignal"), track.p(), track.beta()); - } - } - } - NTPC = col.multTPC(); - N_FT0M = col.multFT0M(); - Cent_FT0M = col.centFT0M(); - - hist.fill(HIST("QA/after/h_VtxZ"), col.posZ()); - hist.fill(HIST("QA/after/h_Counts"), 2); - hist.fill(HIST("QA/after/h_NTPC"), NTPC); - hist.fill(HIST("QA/after/h_Cent"), Cent_FT0M); - hist.fill(HIST("QA/after/h_NFT0M"), N_FT0M); - hist.fill(HIST("QA/after/h2_NTPC_NFT0M"), N_FT0M, NTPC); - hist.fill(HIST("QA/after/h2_NTPC_Cent"), Cent_FT0M, NTPC); - hist.fill(HIST("QA/after/p_NTPC_Cent"), Cent_FT0M, NTPC); - hist.fill(HIST("QA/after/p_NTPC_NFT0M"), N_FT0M, NTPC); - hist.fill(HIST("QA/after/p_NFT0M_NTPC"), NTPC, N_FT0M); - hist.fill(HIST("QA/after/h2_NTPC_Nch"), NTPC, Nch); - - static constexpr std::string_view dire[] = {"Analysis/Charged/", "Analysis/Pion/", "Analysis/Kaon/", "Analysis/Proton/"}; - - hist.fill(HIST(dire[0]) + HIST("h_Mult"), Nch); - hist.fill(HIST(dire[1]) + HIST("h_Mult"), N_Pi); - hist.fill(HIST(dire[2]) + HIST("h_Mult"), N_Ka); - hist.fill(HIST(dire[3]) + HIST("h_Mult"), N_Pr); - - parts(Q1_ch, Q2_ch, Q3_ch, Q4_ch, Nch, &mean_Q1_Ch, &twopart_Ch, &threepart_Ch, &fourpart_Ch); - if (Nch > 1) { - hist.fill(HIST(dire[0]) + HIST("h_mean_Q1"), mean_Q1_Ch); - hist.fill(HIST(dire[0]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Ch); - hist.fill(HIST(dire[0]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Ch, N_FT0M); - hist.fill(HIST(dire[0]) + HIST("h_twopart_Mult"), NTPC, twopart_Ch, N_FT0M); - } - if (Nch > 2) { - hist.fill(HIST(dire[0]) + HIST("h_threepart_Mult"), NTPC, threepart_Ch, N_FT0M); - } - if (Nch > 3) { - hist.fill(HIST(dire[0]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Ch, N_FT0M); - } - - parts(Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi, N_Pi, &mean_Q1_Pi, &twopart_Pi, &threepart_Pi, &fourpart_Pi); - if (N_Pi > 1) { - hist.fill(HIST(dire[1]) + HIST("h_mean_Q1"), mean_Q1_Pi); - hist.fill(HIST(dire[1]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Pi); - hist.fill(HIST(dire[1]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Pi, N_FT0M); - hist.fill(HIST(dire[1]) + HIST("h_twopart_Mult"), NTPC, twopart_Pi, N_FT0M); - } - if (N_Pi > 2) { - hist.fill(HIST(dire[1]) + HIST("h_threepart_Mult"), NTPC, threepart_Pi, N_FT0M); - } - if (N_Pi > 3) { - hist.fill(HIST(dire[1]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Pi, N_FT0M); - } - - parts(Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka, N_Ka, &mean_Q1_Ka, &twopart_Ka, &threepart_Ka, &fourpart_Ka); - if (N_Ka > 1) { - hist.fill(HIST(dire[2]) + HIST("h_mean_Q1"), mean_Q1_Ka); - hist.fill(HIST(dire[2]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Ka); - hist.fill(HIST(dire[2]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Ka, N_FT0M); - hist.fill(HIST(dire[2]) + HIST("h_twopart_Mult"), NTPC, twopart_Ka, N_FT0M); - } - if (N_Ka > 2) { - hist.fill(HIST(dire[2]) + HIST("h_threepart_Mult"), NTPC, threepart_Ka, N_FT0M); - } - if (N_Ka > 3) { - hist.fill(HIST(dire[2]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Ka, N_FT0M); - } - - parts(Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr, N_Pr, &mean_Q1_Pr, &twopart_Pr, &threepart_Pr, &fourpart_Pr); - if (N_Pr > 1) { - hist.fill(HIST(dire[3]) + HIST("h_mean_Q1"), mean_Q1_Pr); - hist.fill(HIST(dire[3]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Pr); - hist.fill(HIST(dire[3]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Pr, N_FT0M); - hist.fill(HIST(dire[3]) + HIST("h_twopart_Mult"), NTPC, twopart_Pr, N_FT0M); - } - if (N_Pr > 2) { - hist.fill(HIST(dire[3]) + HIST("h_threepart_Mult"), NTPC, threepart_Pr, N_FT0M); - } - if (N_Pr > 3) { - hist.fill(HIST(dire[3]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Pr, N_FT0M); - } - - //----------------------------- TPC (No p cuts) ---------------------------// - testParts(Q1_Pi_tpc, Q2_Pi_tpc, N_Pi_tpc, &mean_Q1_Pi_tpc, &twopart_Pi_tpc); - if (N_Pi_tpc > 1) { - hist.fill(HIST(dire[1]) + HIST("h_mean_Q1_Mult_tpc"), NTPC, mean_Q1_Pi_tpc, N_FT0M); - hist.fill(HIST(dire[1]) + HIST("h_twopart_Mult_tpc"), NTPC, twopart_Pi_tpc, N_FT0M); - } - - testParts(Q1_Ka_tpc, Q2_Ka_tpc, N_Ka_tpc, &mean_Q1_Ka_tpc, &twopart_Ka_tpc); - if (N_Ka_tpc > 1) { - hist.fill(HIST(dire[2]) + HIST("h_mean_Q1_Mult_tpc"), NTPC, mean_Q1_Ka_tpc, N_FT0M); - hist.fill(HIST(dire[2]) + HIST("h_twopart_Mult_tpc"), NTPC, twopart_Ka_tpc, N_FT0M); - } - - testParts(Q1_Pr_tpc, Q2_Pr_tpc, N_Pr_tpc, &mean_Q1_Pr_tpc, &twopart_Pr_tpc); - if (N_Pr_tpc > 1) { - hist.fill(HIST(dire[3]) + HIST("h_mean_Q1_Mult_tpc"), NTPC, mean_Q1_Pr_tpc, N_FT0M); - hist.fill(HIST(dire[3]) + HIST("h_twopart_Mult_tpc"), NTPC, twopart_Pr_tpc, N_FT0M); - } - - //----------------------- TPC + TOF (No p cuts) --------------------------// - - testParts(Q1_Ch_tof, Q2_Ch_tof, Nch_tof, &mean_Q1_Ch_tof, &twopart_Ch_tof); - if (Nch_tof > 1) { - hist.fill(HIST(dire[0]) + HIST("h_mean_Q1_Mult_tof"), NTPC, mean_Q1_Ch_tof, N_FT0M); - hist.fill(HIST(dire[0]) + HIST("h_twopart_Mult_tof"), NTPC, twopart_Ch_tof, N_FT0M); + if (track.hasTPC() && track.hasITS()) + NTPC++; } + FillHistos(col, tracks, Cent_V0M, N_FV0M, NTPC); + } + } + PROCESS_SWITCH(meanPtFlucId, process_Run2, "Process for Run2", false); - testParts(Q1_Pi_tof, Q2_Pi_tof, N_Pi_tof, &mean_Q1_Pi_tof, &twopart_Pi_tof); - if (N_Pi_tpc > 1) { - hist.fill(HIST(dire[1]) + HIST("h_mean_Q1_Mult_tof"), NTPC, mean_Q1_Pi_tof, N_FT0M); - hist.fill(HIST(dire[1]) + HIST("h_twopart_Mult_tof"), NTPC, twopart_Pi_tof, N_FT0M); - } + void process_Run3(MyRun3Collisions::iterator const& col, MyAllTracks const& tracks) + { + double N_FT0M = 0, Cent_FT0M = 0; + int NTPC = 0; + // Before Collision and Track Cuts: + for (auto& myTrack : tracks) { + hist.fill(HIST("QA/before/h_Eta"), myTrack.eta()); + hist.fill(HIST("QA/before/h_Pt"), myTrack.pt()); + hist.fill(HIST("QA/before/h2_Pt_Eta"), myTrack.eta(), myTrack.pt()); + hist.fill(HIST("QA/before/h_TPCChi2perCluster"), myTrack.tpcChi2NCl()); + hist.fill(HIST("QA/before/h_ITSChi2perCluster"), myTrack.itsChi2NCl()); + hist.fill(HIST("QA/before/h_crossedTPC"), myTrack.tpcNClsCrossedRows()); + hist.fill(HIST("QA/before/h2_DcaXY"), myTrack.pt(), myTrack.dcaXY()); + hist.fill(HIST("QA/before/h2_DcaZ"), myTrack.pt(), myTrack.dcaZ()); + } + hist.fill(HIST("QA/before/h_VtxZ"), col.posZ()); + hist.fill(HIST("QA/before/h_Counts"), 2); - testParts(Q1_Ka_tof, Q2_Ka_tof, N_Ka_tof, &mean_Q1_Ka_tof, &twopart_Ka_tof); - if (N_Ka_tpc > 1) { - hist.fill(HIST(dire[2]) + HIST("h_mean_Q1_Mult_tof"), NTPC, mean_Q1_Ka_tof, N_FT0M); - hist.fill(HIST(dire[2]) + HIST("h_twopart_Mult_tof"), NTPC, twopart_Ka_tof, N_FT0M); - } + hist.fill(HIST("QA/before/h_NTPC"), col.multTPC()); + hist.fill(HIST("QA/before/h_Cent"), col.centFT0C()); + hist.fill(HIST("QA/before/h_NFT0M"), col.multFT0M()); + hist.fill(HIST("QA/before/h2_NTPC_NFT0M"), col.multFT0M(), col.multTPC()); + hist.fill(HIST("QA/before/h2_NTPC_Cent"), col.centFT0C(), col.multTPC()); - testParts(Q1_Pr_tof, Q2_Pr_tof, N_Pr_tof, &mean_Q1_Pr_tof, &twopart_Pr_tof); - if (N_Pr_tpc > 1) { - hist.fill(HIST(dire[3]) + HIST("h_mean_Q1_Mult_tof"), NTPC, mean_Q1_Pr_tof, N_FT0M); - hist.fill(HIST(dire[3]) + HIST("h_twopart_Mult_tof"), NTPC, twopart_Pr_tof, N_FT0M); - } + // After Collision and Track Cuts: + if (selRun3Col(col)) { + N_FT0M = col.multFT0C(); + Cent_FT0M = col.centFT0C(); + NTPC = col.multNTracksHasTPC(); + FillHistos(col, tracks, Cent_FT0M, N_FT0M, NTPC); } } + PROCESS_SWITCH(meanPtFlucId, process_Run3, "Process for Run3", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 71696145268979c17666fbe5322c3ebe113cb39e Mon Sep 17 00:00:00 2001 From: Nasir Mehdi Malik <89008506+nasirmehdimalik@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:20:21 +0530 Subject: [PATCH 20/33] new tasks for Lambda(1520) for pbpb (#4532) --- PWGLF/Tasks/Resonances/CMakeLists.txt | 5 + PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx | 590 +++++++++++++++++++++ 2 files changed, 595 insertions(+) create mode 100644 PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index 65d9feff83f..faae0fcac1e 100644 --- a/PWGLF/Tasks/Resonances/CMakeLists.txt +++ b/PWGLF/Tasks/Resonances/CMakeLists.txt @@ -78,3 +78,8 @@ o2physics_add_dpl_workflow(chargedkstaranalysis SOURCES chargedkstaranalysis.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(lambda1520-pbpb + SOURCES lambda1520_PbPb.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx b/PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx new file mode 100644 index 00000000000..2fe41e136f4 --- /dev/null +++ b/PWGLF/Tasks/Resonances/lambda1520_PbPb.cxx @@ -0,0 +1,590 @@ +// 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 +/// /// Invariant Mass Reconstruction of Lambda(1520) Resonance. +/// +/// \author Yash Patley +/// \author Naisr Mehdi Malik + +#include +#include +#include + +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/runDataProcessing.h" +#include "PWGLF/DataModel/LFResonanceTables.h" +#include "CommonConstants/PhysicsConstants.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::constants::physics; + +struct lambdaAnalysis_pb { + + SliceCache cache; + Preslice perRCol = aod::resodaughter::resoCollisionId; + Preslice perCollision = aod::track::collisionId; + + // Configurables. + Configurable nBinsPt{"nBinsPt", 100, "N bins in pT histogram"}; + Configurable nBinsInvM{"nBinsInvM", 120, "N bins in InvMass histogram"}; + Configurable nBinsSp{"nBinsSp", 120, "N bins in spherocity histogram"}; + Configurable doRotate{"doRotate", true, "rotated inv mass spectra"}; + + // Tracks + Configurable cPtMin{"cPtMin", 0.15, "Minimum Track pT"}; + Configurable cEtaCut{"cEtaCut", 0.8, "Pseudorapidity cut"}; + Configurable cDcaz{"cDcazMin", 1., "Minimum DCAz"}; + Configurable cDcaxy{"cDcaxyMin", 0.1, "Minimum DCAxy"}; + Configurable cKinCuts{"cKinCuts", false, "Kinematic Cuts for p-K pair opening angle"}; + Configurable cITSRefit{"cITSRefit", false, "ITS TPC refit"}; + Configurable cTPCRefit{"cTPCRefit", false, "ITS TPC refit"}; + Configurable cPrimaryTrack{"cPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cGlobalWoDCATrack{"cGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) + Configurable cPVContributor{"cPVContributor", true, "PV contributor track selection"}; // PV Contriuibutor + + // PID Selections + Configurable cUseOnlyTOFTrackPr{"cUseOnlyTOFTrackPr", false, "Use only TOF track for PID selection"}; // Use only TOF track for Proton PID selection + Configurable cUseOnlyTOFTrackKa{"cUseOnlyTOFTrackKa", false, "Use only TOF track for PID selection"}; // Use only TOF track for Kaon PID selection + Configurable cUseTpcOnly{"cUseTpcOnly", false, "Use TPC Only selection"}; // TPC And TOF tracks + Configurable cRejNsigmaTpc{"cRejNsigmaTpc", 3.0, "Reject tracks to improve purity of TPC PID"}; // Reject missidentified particles when tpc bands merge + Configurable cRejNsigmaTof{"cRejNsigmaTof", 3.0, "Reject tracks to improve purity of TOF PID"}; // Reject missidentified particles when tpc bands merge + // Proton + Configurable cMaxTPCnSigmaProton{"cMaxTPCnSigmaProton", 3.0, "TPC nSigma cut for Proton"}; // TPC + Configurable cMaxTOFnSigmaProton{"cMaxTOFnSigmaProton", 3.0, "TOF nSigma cut for Proton"}; // TOF + Configurable nsigmaCutCombinedProton{"nsigmaCutCombinedProton", 3.0, "Combined nSigma cut for Proton"}; // Combined + Configurable> protonTPCPIDp{"protonTPCPIDp", {0, 0.5, 0.7, 0.8}, "p dependent TPC cuts protons"}; + Configurable> protonTPCPIDcut{"protonTPCPIDcut", {5., 3.5, 2.5}, "TPC nsigma cuts protons"}; + // Kaon + Configurable cMaxTPCnSigmaKaon{"cMaxTPCnSigmaKaon", 3.0, "TPC nSigma cut for Kaon"}; // TPC + Configurable cMaxTOFnSigmaKaon{"cMaxTOFnSigmaKaon", 3.0, "TOF nSigma cut for Kaon"}; // TOF + Configurable nsigmaCutCombinedKaon{"nsigmaCutCombinedKaon", 3.0, "Combined nSigma cut for Kaon"}; // Combined + Configurable> kaonTPCPIDp{"kaonTPCPIDp", {0., 0.25, 0.3, 0.45}, "pT dependent TPC cuts kaons"}; + Configurable> kaonTPCPIDcut{"kaonTPCPIDcut", {6, 3.5, 2.5}, "TPC nsigma cuts kaons"}; + // Event Mixing. + Configurable cMixnoBin{"cMixnoBin", false, " BinsType to be mixed"}; + Configurable cNumMixEv{"cNumMixEv", 20, "Number of Events to be mixed"}; + Configurable MultDiff{"nMultDiffn", 10, "mult diff"}; + Configurable VzDiff{"VzDiff", 1, "vz diff"}; + ConfigurableAxis cMixVtxBins{"cMixVtxBins", {VARIABLE_WIDTH, -10.0f, -9.f, -8.f, -7.f, -6.f, -5.f, -4.f, -3.f, -2.f, -1.f, 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis cMixMultBins{"cMixMultBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 200.0f}, "Mixing bins - multiplicity"}; + + // Histogram Registry. + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext const&) + { + + // Define Axis. + const AxisSpec axisCent(110, 0, 110, "FT0 (%)"); + const AxisSpec axisP_pid(200, 0., 10., "p (GeV/c)"); + const AxisSpec axisPt_pid(200, 0., 10., "p_{T} (GeV/c)"); + const AxisSpec axisPt(nBinsPt, 0., 10., "p_{T} (GeV/c)"); + const AxisSpec axisEta(40, -1, 1, "#eta"); + const AxisSpec axisDCAz(500, -0.5, 0.5, {"DCA_{z} (cm)"}); + const AxisSpec axisDCAxy(240, -0.12, 0.12, {"DCA_{xy} (cm)"}); + const AxisSpec axisTPCNCls(200, 0, 200, {"TPCNCls"}); + const AxisSpec axisTPCNsigma(401, -10.025, 10.025, {"n#sigma^{TPC}"}); + const AxisSpec axisTOFNsigma(401, -10.025, 10.025, {"n#sigma^{TOF}"}); + const AxisSpec axisdEdx(380, 10, 200, {"#frac{dE}{dx}"}); + const AxisSpec axisInvM(nBinsInvM, 1.44, 2.04, {"M_{inv} (GeV/c^{2})"}); + + // Create Histograms. + // Event + histos.add("Event/h1d_ft0_mult_percentile", "FT0 (%)", kTH1F, {axisCent}); + + histos.add("Event/mixing_vzVsmultpercentile", "FT0(%)", kTH1F, {axisCent}); + + // QA Before + histos.add("QAbefore/Proton/h2d_pr_nsigma_tpc_p", "n#sigma^{TPC} Protons", kTH2F, {axisP_pid, axisTPCNsigma}); + histos.add("QAbefore/Proton/h2d_pr_nsigma_tof_p", "n#sigma^{TOF} Protons", kTH2F, {axisP_pid, axisTOFNsigma}); + histos.add("QAbefore/Proton/h2d_pr_nsigma_tof_vs_tpc", "n#sigma^{TPC} vs n#sigma^{TOF} Protons", kTH2F, {axisTPCNsigma, axisTOFNsigma}); + histos.add("QAbefore/Kaon/h2d_ka_nsigma_tpc_p", "n#sigma^{TPC} Kaons", kTH2F, {axisP_pid, axisTPCNsigma}); + histos.add("QAbefore/Kaon/h2d_ka_nsigma_tof_p", "n#sigma^{TOF} Kaons", kTH2F, {axisP_pid, axisTOFNsigma}); + histos.add("QAbefore/Kaon/h2d_ka_nsigma_tof_vs_tpc", "n#sigma^{TPC} vs n#sigma^{TOF} Kaons", kTH2F, {axisTPCNsigma, axisTOFNsigma}); + + // QA After + histos.add("QAafter/Proton/h1d_pr_pt", "p_{T}-spectra Protons", kTH1F, {axisPt_pid}); + histos.add("QAafter/Proton/h2d_pr_dca_z", "dca_{z} Protons", kTH2F, {axisPt_pid, axisDCAz}); + histos.add("QAafter/Proton/h2d_pr_dca_xy", "dca_{xy} Protons", kTH2F, {axisPt_pid, axisDCAxy}); + histos.add("QAafter/Proton/h2d_pr_dEdx_p", "TPC Signal Protons", kTH2F, {axisP_pid, axisdEdx}); + histos.add("QAafter/Proton/h2d_pr_nsigma_tpc_pt", " Protons", kTH2F, {axisPt_pid, axisTPCNsigma}); + histos.add("QAafter/Proton/h2d_pr_nsigma_tpc_p", " Protons", kTH2F, {axisP_pid, axisTPCNsigma}); + histos.add("QAafter/Proton/h2d_pr_nsigma_tof_pt", " Protons", kTH2F, {axisPt_pid, axisTOFNsigma}); + histos.add("QAafter/Proton/h2d_pr_nsigma_tof_p", " Protons", kTH2F, {axisP_pid, axisTOFNsigma}); + histos.add("QAafter/Proton/h2d_pr_nsigma_tof_vs_tpc", "n#sigma(TOF) vs n#sigma(TPC) Protons", kTH2F, {axisTPCNsigma, axisTOFNsigma}); + histos.add("QAafter/Kaon/h1d_ka_pt", "p_{T}-spectra Kaons", kTH1F, {axisPt_pid}); + histos.add("QAafter/Kaon/h2d_ka_dca_z", "dca_{z} Kaons", kTH2F, {axisPt_pid, axisDCAz}); + histos.add("QAafter/Kaon/h2d_ka_dca_xy", "dca_{xy} Kaons", kTH2F, {axisPt_pid, axisDCAxy}); + histos.add("QAafter/Kaon/h2d_ka_dEdx_p", "TPC Signal Kaon", kTH2F, {axisP_pid, axisdEdx}); + histos.add("QAafter/Kaon/h2d_ka_nsigma_tpc_pt", " Kaons", kTH2F, {axisPt_pid, axisTPCNsigma}); + histos.add("QAafter/Kaon/h2d_ka_nsigma_tpc_p", " Kaons", kTH2F, {axisP_pid, axisTPCNsigma}); + histos.add("QAafter/Kaon/h2d_ka_nsigma_tof_pt", " Kaons", kTH2F, {axisPt_pid, axisTOFNsigma}); + histos.add("QAafter/Kaon/h2d_ka_nsigma_tof_p", " Kaons", kTH2F, {axisP_pid, axisTOFNsigma}); + histos.add("QAafter/Kaon/h2d_ka_nsigma_tof_vs_tpc", "n#sigma(TOF) vs n#sigma(TPC) Kaons", kTH2F, {axisTPCNsigma, axisTOFNsigma}); + + // QA checks for protons and kaons + histos.add("QAChecks/h1d_pr_pt", "p_{T}-spectra Protons", kTH1F, {axisPt_pid}); + histos.add("QAChecks/h1d_ka_pt", "p_{T}-spectra Kaons", kTH1F, {axisPt_pid}); + histos.add("QAChecks/h1d_pr_rec_pt", "Reconstructed p_{T}-spectra Protons", kTH1F, {axisPt_pid}); + histos.add("QAChecks/h1d_ka_rec_pt", "Recondstucted p_{T}-spectra Kaons", kTH1F, {axisPt_pid}); + histos.add("QAChecks/h1d_pr_gen_pt", "Generated p_{T}-spectra Protons", kTH1F, {axisPt_pid}); + histos.add("QAChecks/h1d_ka_gen_pt", "Generated p_{T}-spectra Kaons", kTH1F, {axisPt_pid}); + + // Analysis + // Lambda Invariant Mass + histos.add("Analysis/h1d_lstar_invm_US", "#Lambda(1520) M_{inv}", kTH1D, {axisInvM}); + histos.add("Analysis/h1d_lstar_invm_PP", "Like Signs M_{inv} p K^{+}", kTH1D, {axisInvM}); + histos.add("Analysis/h1d_lstar_invm_MM", "Like Signs M_{inv} #bar{p} K^{-}", kTH1D, {axisInvM}); + histos.add("Analysis/h1d_lstar_invm_rot", "Rotated Spectra", kTH1D, {axisInvM}); + histos.add("Analysis/h1d_lstar_invm_US_mix", "Mixed Events M_{inv}", kTH1D, {axisInvM}); + histos.add("Analysis/h1d_lstar_invm_LS_mix", "Mixed Events M_{inv}", kTH1D, {axisInvM}); + histos.add("Analysis/h4d_lstar_invm_US", "THn #Lambda(1520)", kTHnSparseD, {axisInvM, axisPt, axisCent}); + histos.add("Analysis/h4d_lstar_invm_PP", "THn Like Signs p K^{+}", kTHnSparseD, {axisInvM, axisPt, axisCent}); + histos.add("Analysis/h4d_lstar_invm_MM", "THn Like Signs #bar{p} K^{-}", kTHnSparseD, {axisInvM, axisPt, axisCent}); + histos.add("Analysis/h4d_lstar_invm_rot", "THn Rotated", kTHnSparseD, {axisInvM, axisPt, axisCent}); + histos.add("Analysis/h4d_lstar_invm_US_mix", "THn Mixed Events", kTHnSparseD, {axisInvM, axisPt, axisCent}); + histos.add("Analysis/h4d_lstar_invm_LS_mix", "THn Mixed Events", kTHnSparseD, {axisInvM, axisPt, axisCent}); + + // MC + if (doprocessMC) { + + histos.add("Event/h1d_rec_cent", "Reconstructed FT0(%)", kTH2F, {axisCent}); + histos.add("Analysis/h1d_gen_lstar", "Generated #Lambda(1520) p_{T}", kTH1D, {axisPt}); + histos.add("Analysis/h1d_gen_lstar_anti", "Generated #bar{#Lambda}(1520) p_{T}", kTH1D, {axisPt}); + histos.add("Analysis/h1d_rec_lstar", "Reconstructed #Lambda(1520) p_{T}", kTH1D, {axisPt}); + histos.add("Analysis/h1d_rec_lstar_anti", "Reconstructed #bar{#Lambda}(1520) p_{T}", kTH1D, {axisPt}); + histos.add("Analysis/h1d_rec_invm_lstar", "Recostructed #Lambda(1520)", kTH1D, {axisInvM}); + histos.add("Analysis/h1d_rec_invm_lstar_anti", "Recostructed #bar{#Lambda}(1520)", kTH1D, {axisInvM}); + } + } + + template + bool selTracks(T const& track) + { + + if (track.pt() < cPtMin) + return false; + + if (std::abs(track.eta()) > cEtaCut) + return false; + + if (std::abs(track.dcaZ()) > cDcaz) + return false; + + if (std::abs(track.dcaXY()) > cDcaxy) + return false; + + if (cPrimaryTrack && !track.isPrimaryTrack()) + return false; + + if (cGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + return false; + + if (cPVContributor && !track.isPVContributor()) + return false; + + return true; + } + // PID selection tools + template + bool selectionPIDProton(const T& candidate, float p) + { + bool tpcPIDPassed{false}, tofPIDPassed{false}; + auto tpcPIDp = static_cast>(protonTPCPIDp); + auto tpcPIDcut = static_cast>(protonTPCPIDcut); + int nitr = static_cast(tpcPIDp.size()); + + float tpcNsigmaPi = std::abs(candidate.tpcNSigmaPi()); + float tpcNsigmaKa = std::abs(candidate.tpcNSigmaKa()); + float tpcNsigmaPr = std::abs(candidate.tpcNSigmaPr()); + float tofNsigmaPi = std::abs(candidate.tofNSigmaPi()); + float tofNsigmaKa = std::abs(candidate.tofNSigmaKa()); + float tofNsigmaPr = std::abs(candidate.tofNSigmaPr()); + + float tpcTofNsigmaPi = tpcNsigmaPi * tpcNsigmaPi + tofNsigmaPi * tofNsigmaPi; + float tpcTofNsigmaKa = tpcNsigmaKa * tpcNsigmaKa + tofNsigmaKa * tofNsigmaKa; + float tpcTofNsigmaPr = tpcNsigmaPr * tpcNsigmaPr + tofNsigmaPr * tofNsigmaPr; + float combinedCut = nsigmaCutCombinedProton * nsigmaCutCombinedProton; + float combinedRejCut = cRejNsigmaTof * cRejNsigmaTpc; + + if (!cUseTpcOnly && candidate.hasTOF()) { + if (tofNsigmaPr < cMaxTOFnSigmaProton && tofNsigmaPi > cRejNsigmaTof && tofNsigmaKa > cRejNsigmaTof) { + tofPIDPassed = true; + } + // square cut + if ((nsigmaCutCombinedProton < 0) && (tpcNsigmaPr < cMaxTPCnSigmaProton)) { + tpcPIDPassed = true; + } + // circular cut + if ((nsigmaCutCombinedProton > 0) && (tpcTofNsigmaPr < combinedCut && tpcTofNsigmaPi > combinedRejCut && tpcTofNsigmaKa > combinedRejCut)) { + tofPIDPassed = true; + tpcPIDPassed = true; + } + } else { + tofPIDPassed = true; + if (cUseTpcOnly) { + if (tpcNsigmaPr < cMaxTPCnSigmaProton && tpcNsigmaPi > cRejNsigmaTpc && tpcNsigmaKa > cRejNsigmaTpc) { + tpcPIDPassed = true; + } + } else { + for (int i = 0; i < nitr - 1; ++i) { + if (p >= tpcPIDp[i] && p < tpcPIDp[i + 1] && (tpcNsigmaPr < tpcPIDcut[i] && tpcNsigmaPi > cRejNsigmaTpc && tpcNsigmaKa > cRejNsigmaTpc)) { + tpcPIDPassed = true; + } + } + } + } + if (tpcPIDPassed && tofPIDPassed) { + return true; + } + return false; + } + template + bool selectionPIDKaon(const T& candidate, float p) + { + bool tpcPIDPassed{false}, tofPIDPassed{false}; + auto tpcPIDp = static_cast>(kaonTPCPIDp); + auto tpcPIDcut = static_cast>(kaonTPCPIDcut); + int nitr = static_cast(tpcPIDp.size()); + + float tpcNsigmaPi = std::abs(candidate.tpcNSigmaPi()); + float tpcNsigmaKa = std::abs(candidate.tpcNSigmaKa()); + float tpcNsigmaPr = std::abs(candidate.tpcNSigmaPr()); + float tofNsigmaPi = std::abs(candidate.tofNSigmaPi()); + float tofNsigmaKa = std::abs(candidate.tofNSigmaKa()); + float tofNsigmaPr = std::abs(candidate.tofNSigmaPr()); + // float tofNsigmaEl = std::abs(); + + float tpcTofNsigmaPi = tpcNsigmaPi * tpcNsigmaPi + tofNsigmaPi * tofNsigmaPi; + float tpcTofNsigmaKa = tpcNsigmaKa * tpcNsigmaKa + tofNsigmaKa * tofNsigmaKa; + float tpcTofNsigmaPr = tpcNsigmaPr * tpcNsigmaPr + tofNsigmaPr * tofNsigmaPr; + float combinedCut = nsigmaCutCombinedKaon * nsigmaCutCombinedKaon; + float combinedRejCut = cRejNsigmaTpc * cRejNsigmaTof; + + if (!cUseTpcOnly && candidate.hasTOF()) { + if (tofNsigmaKa < cMaxTOFnSigmaKaon && tofNsigmaPi > cRejNsigmaTof && tofNsigmaPr > cRejNsigmaTof) { + tofPIDPassed = true; + } + // square cut + if ((nsigmaCutCombinedKaon < 0) && (tpcNsigmaKa < cMaxTPCnSigmaKaon)) { + tpcPIDPassed = true; + } + // circular + if ((nsigmaCutCombinedKaon > 0) && (tpcTofNsigmaKa < combinedCut && tpcTofNsigmaPi > combinedRejCut && tpcTofNsigmaPr > combinedRejCut)) { + tofPIDPassed = true; + tpcPIDPassed = true; + } + } else { + tofPIDPassed = true; + if (cUseTpcOnly) { + if (tpcNsigmaKa < cMaxTPCnSigmaKaon && tpcNsigmaPi > cRejNsigmaTpc && tpcNsigmaPr > cRejNsigmaTpc) { + tpcPIDPassed = true; + } + } else { + for (int i = 0; i < nitr - 1; ++i) { + if (p >= tpcPIDp[i] && p < tpcPIDp[i + 1] && (tpcNsigmaKa < tpcPIDcut[i] && tpcNsigmaPi > cRejNsigmaTpc && tpcNsigmaPr > cRejNsigmaTpc)) { + tpcPIDPassed = true; + } + } + } + } + if (tpcPIDPassed && tofPIDPassed) { + return true; + } + return false; + } + + template + void fillDataHistos(trackType const& trk1, trackType const& trk2, float const& mult) + { + TLorentzVector p1, p2, p; + TRandom* rn = new TRandom(); + float p_ptot = 0., k_ptot = 0.; + + for (auto const& [trkPr, trkKa] : soa::combinations(soa::CombinationsFullIndexPolicy(trk1, trk2))) { + // Do not analyse same index tracks. + if (trkPr.index() == trkKa.index() && !mix) + continue; + + // pT, DCA, Global Tracks and PVcontrib selection. + if (!selTracks(trkPr) || !selTracks(trkKa)) + continue; + + if (cITSRefit && !trkPr.passedITSRefit()) + continue; + if (cITSRefit && !trkKa.passedITSRefit()) + continue; + if (cTPCRefit && !trkPr.passedTPCRefit()) + continue; + if (cTPCRefit && !trkKa.passedTPCRefit()) + continue; + + p_ptot = TMath::Sqrt(trkPr.px() * trkPr.px() + trkPr.py() * trkPr.py() + trkPr.pz() * trkPr.pz()); + k_ptot = TMath::Sqrt(trkKa.px() * trkKa.px() + trkKa.py() * trkKa.py() + trkKa.pz() * trkKa.pz()); + + // Fill QA before track selection. + if (!mix) { + histos.fill(HIST("QAbefore/Proton/h2d_pr_nsigma_tpc_p"), p_ptot, trkPr.tpcNSigmaPr()); + if (trkPr.hasTOF()) { + histos.fill(HIST("QAbefore/Proton/h2d_pr_nsigma_tof_p"), p_ptot, trkPr.tofNSigmaPr()); + histos.fill(HIST("QAbefore/Proton/h2d_pr_nsigma_tof_vs_tpc"), trkPr.tpcNSigmaPr(), trkPr.tofNSigmaPr()); + } + histos.fill(HIST("QAbefore/Kaon/h2d_ka_nsigma_tpc_p"), k_ptot, trkKa.tpcNSigmaKa()); + if (trkKa.hasTOF()) { + histos.fill(HIST("QAbefore/Kaon/h2d_ka_nsigma_tof_p"), k_ptot, trkKa.tofNSigmaKa()); + histos.fill(HIST("QAbefore/Kaon/h2d_ka_nsigma_tof_vs_tpc"), trkKa.tpcNSigmaKa(), trkKa.tofNSigmaKa()); + } + } + + // Apply PID Selection + if (cUseOnlyTOFTrackPr && !trkPr.hasTOF()) + continue; + if (cUseOnlyTOFTrackKa && !trkKa.hasTOF()) + continue; + if (!selectionPIDProton(trkPr, p_ptot) || !selectionPIDKaon(trkKa, k_ptot)) + continue; + + // Fill QA after track selection. + if constexpr (!mix) { + // Proton + histos.fill(HIST("QAafter/Proton/h1d_pr_pt"), trkPr.pt()); + histos.fill(HIST("QAafter/Proton/h2d_pr_dca_z"), trkPr.pt(), trkPr.dcaZ()); + histos.fill(HIST("QAafter/Proton/h2d_pr_dca_xy"), trkPr.pt(), trkPr.dcaXY()); + histos.fill(HIST("QAafter/Proton/h2d_pr_dEdx_p"), p_ptot, trkPr.tpcSignal()); + histos.fill(HIST("QAafter/Proton/h2d_pr_nsigma_tpc_p"), p_ptot, trkPr.tpcNSigmaPr()); + histos.fill(HIST("QAafter/Proton/h2d_pr_nsigma_tpc_pt"), trkPr.pt(), trkPr.tpcNSigmaPr()); + if (!cUseTpcOnly && trkPr.hasTOF()) { + histos.fill(HIST("QAafter/Proton/h2d_pr_nsigma_tof_p"), p_ptot, trkPr.tofNSigmaPr()); + histos.fill(HIST("QAafter/Proton/h2d_pr_nsigma_tof_pt"), trkPr.pt(), trkPr.tofNSigmaPr()); + histos.fill(HIST("QAafter/Proton/h2d_pr_nsigma_tof_vs_tpc"), trkPr.tpcNSigmaPr(), trkPr.tofNSigmaPr()); + } + // Kaon + histos.fill(HIST("QAafter/Kaon/h1d_ka_pt"), trkKa.pt()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_dca_z"), trkKa.pt(), trkKa.dcaZ()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_dca_xy"), trkKa.pt(), trkKa.dcaXY()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_dEdx_p"), k_ptot, trkKa.tpcSignal()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_nsigma_tpc_p"), k_ptot, trkKa.tpcNSigmaKa()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_nsigma_tpc_pt"), trkKa.pt(), trkKa.tpcNSigmaKa()); + if (!cUseTpcOnly && trkKa.hasTOF()) { + histos.fill(HIST("QAafter/Kaon/h2d_ka_nsigma_tof_p"), k_ptot, trkKa.tofNSigmaKa()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_nsigma_tof_pt"), trkKa.pt(), trkKa.tofNSigmaKa()); + histos.fill(HIST("QAafter/Kaon/h2d_ka_nsigma_tof_vs_tpc"), trkKa.tpcNSigmaKa(), trkKa.tofNSigmaKa()); + } + } + + // Invariant mass reconstruction. + p1.SetXYZM(trkPr.px(), trkPr.py(), trkPr.pz(), MassProton); + p2.SetXYZM(trkKa.px(), trkKa.py(), trkKa.pz(), MassKaonCharged); + p = p1 + p2; + + if (std::abs(p.Rapidity()) > 0.5) + continue; + + // Apply kinematic cuts. + if (cKinCuts) { + TVector3 v1(trkPr.px(), trkPr.py(), trkPr.pz()); + TVector3 v2(trkKa.px(), trkKa.py(), trkKa.pz()); + float alpha = v1.Angle(v2); + if (alpha > 1.4 && alpha < 2.4) + continue; + } + + // Fill Invariant Mass Histograms. + if constexpr (!mix && !mc) { + if (trkPr.sign() * trkKa.sign() < 0) { + histos.fill(HIST("Analysis/h1d_lstar_invm_US"), p.M()); + histos.fill(HIST("Analysis/h4d_lstar_invm_US"), p.M(), p.Pt(), mult); + if (doRotate) { + float theta = rn->Uniform(1.56, 1.58); + p1.RotateZ(theta); + p = p1 + p2; + if (std::abs(p.Rapidity()) < 0.5) { + histos.fill(HIST("Analysis/h1d_lstar_invm_rot"), p.M()); + histos.fill(HIST("Analysis/h4d_lstar_invm_rot"), p.M(), p.Pt(), mult); + } + } + } else { + if (trkPr.sign() == 1) { + histos.fill(HIST("Analysis/h1d_lstar_invm_PP"), p.M()); + histos.fill(HIST("Analysis/h4d_lstar_invm_PP"), p.M(), p.Pt(), mult); + } else { + histos.fill(HIST("Analysis/h1d_lstar_invm_MM"), p.M()); + histos.fill(HIST("Analysis/h4d_lstar_invm_MM"), p.M(), p.Pt(), mult); + } + } + } + + if constexpr (mix) { + if (trkPr.sign() * trkKa.sign() < 0) { + histos.fill(HIST("Analysis/h1d_lstar_invm_US_mix"), p.M()); + histos.fill(HIST("Analysis/h4d_lstar_invm_US_mix"), p.M(), p.Pt(), mult); + } else { + histos.fill(HIST("Analysis/h1d_lstar_invm_LS_mix"), p.M()); + histos.fill(HIST("Analysis/h4d_lstar_invm_LS_mix"), p.M(), p.Pt(), mult); + } + } + + if constexpr (mc) { + if (std::abs(trkPr.pdgCode()) != 2212 || std::abs(trkKa.pdgCode()) != 321) + continue; + + if (trkPr.motherId() != trkKa.motherId()) + continue; + + if (std::abs(trkPr.motherPDG()) != 3124) // L* pdg_code = 3124 + continue; + + // MC histograms + if (trkPr.motherPDG() > 0) { + histos.fill(HIST("Analysis/h1d_rec_lstar"), p.Pt()); + histos.fill(HIST("Analysis/h1d_rec_invm_lstar"), p.M()); + } else { + histos.fill(HIST("Analysis/h1d_rec_lstar_anti"), p.Pt()); + histos.fill(HIST("Analysis/h1d_rec_invm_lstar_anti"), p.M()); + } + } + } + } + + using resoCols = aod::ResoCollisions; + using resoTracks = aod::ResoTracks; + + void processData(resoCols::iterator const& collision, resoTracks const& tracks) + { + + histos.fill(HIST("Event/h1d_ft0_mult_percentile"), collision.cent()); + fillDataHistos(tracks, tracks, collision.cent()); + + // get proton and kaon pT-spectra + for (auto const& track : tracks) { + if (!selTracks(track)) + continue; + + float p = TMath::Sqrt(track.px() * track.px() + track.py() * track.py() + track.pz() * track.pz()); + + if (selectionPIDKaon(track, p)) { + histos.fill(HIST("QAChecks/h1d_ka_pt"), track.pt()); + } + + if (selectionPIDProton(track, p)) { + histos.fill(HIST("QAChecks/h1d_pr_pt"), track.pt()); + } + } + } + + PROCESS_SWITCH(lambdaAnalysis_pb, processData, "Process for Same Event Data", true); + + void processMC(resoCols::iterator const& collision, + soa::Join const& tracks) + { + + fillDataHistos(tracks, tracks, collision.cent()); + + // get MC pT-spectra + for (auto const& track : tracks) { + + // get the generated level pT spectra of protons and kaons + if (std::abs(track.pdgCode()) == 321) + histos.fill(HIST("QAChecks/h1d_ka_gen_pt"), track.pt()); + + if (std::abs(track.pdgCode()) == 2212) + histos.fill(HIST("QAChecks/h1d_pr_gen_pt"), track.pt()); + + // get the reconstructed level pT spectra of protons and kaons + if (!selTracks(track)) + continue; + + float p = TMath::Sqrt(track.px() * track.px() + track.py() * track.py() + track.pz() * track.pz()); + + if (selectionPIDKaon(track, p) && std::abs(track.pdgCode()) == 321) { + histos.fill(HIST("QAChecks/h1d_ka_rec_pt"), track.pt()); + } + + if (selectionPIDProton(track, p) && std::abs(track.pdgCode()) == 2212) { + histos.fill(HIST("QAChecks/h1d_pr_rec_pt"), track.pt()); + } + } + } + PROCESS_SWITCH(lambdaAnalysis_pb, processMC, "Process Event for MC", false); + + void processMCTrue(aod::ResoMCParents const& resoParents) + { + + for (auto const& part : resoParents) { + + if (abs(part.pdgCode()) != 3124) // // L* pdg_code = 3124 + continue; + if (abs(part.y()) > 0.5) { // rapidity cut + continue; + } + + bool pass1 = false; + bool pass2 = false; + + if (abs(part.daughterPDG1()) == 2212 || abs(part.daughterPDG2()) == 2212) { // At least one decay to Proton + pass1 = true; + } + if (abs(part.daughterPDG1()) == 321 || abs(part.daughterPDG2()) == 321) { // At least one decay to Kaon + pass2 = true; + } + + if (!pass1 || !pass2) // If we have both decay products + continue; + + if (part.pdgCode() > 0) + histos.fill(HIST("Analysis/h1d_gen_lstar"), part.pt()); + else + histos.fill(HIST("Analysis/h1d_gen_lstar_anti"), part.pt()); + } + } + PROCESS_SWITCH(lambdaAnalysis_pb, processMCTrue, "Process Event for MC", false); + + // Processing Event Mixing + + using BinningType2 = ColumnBinningPolicy; + void processMix(resoCols& collisions, resoTracks const& tracks) + { + + LOGF(debug, "Event Mixing Started"); + + BinningType2 binningPositions2{{cMixVtxBins, cMixMultBins}, true}; + auto tracksTuple = std::make_tuple(tracks); + if (cMixnoBin) { + SameKindPair pairs{binningPositions2, cNumMixEv, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + for (auto& [c1, t1, c2, t2] : pairs) { + if (abs(c1.size() - c2.size()) > MultDiff || abs(c1.posZ() - c2.posZ()) > VzDiff) + continue; + histos.fill(HIST("Event/mixing_vzVsmultpercentile"), c1.cent()); + fillDataHistos(t1, t2, c1.cent()); + } + } else { + SameKindPair pairs{binningPositions2, cNumMixEv, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip + for (auto& [c1, t1, c2, t2] : pairs) { + histos.fill(HIST("Event/mixing_vzVsmultpercentile"), c1.cent()); + fillDataHistos(t1, t2, c1.cent()); + } + } + } + + PROCESS_SWITCH(lambdaAnalysis_pb, processMix, "Process for Mixed Events", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 85041dda5c636a8f7bdc6d454847677b4c7c4d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrea=20Tavira=20Garc=C3=ADa?= <118979672+atavirag@users.noreply.github.com> Date: Wed, 31 Jan 2024 12:55:59 +0100 Subject: [PATCH 21/33] PWGHF: add THnSparse to taskD0 to perform cut variation method (#4506) * PWGHF: add sparse to taskD0 to perform cut variation method * Please consider the following formatting changes * fix MegaLinter * Address Mattia's comments * Add reflections to sparse * Please consider the following formatting changes --------- Co-authored-by: ALICE Action Bot --- PWGHF/D2H/Tasks/taskD0.cxx | 99 +++++++++++++++++++++++++++++++++----- 1 file changed, 88 insertions(+), 11 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index 3b50057b720..f4488a83d28 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -30,6 +30,15 @@ using namespace o2::framework; using namespace o2::framework::expressions; /// D0 analysis task +namespace +{ +enum CandTypeSel { + SigD0 = 0, // Signal D0 + SigD0bar, // Signal D0bar + ReflectedD0, // Reflected D0 + ReflectedD0bar // Reflected D0bar +}; +} // namespace struct HfTaskD0 { Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; @@ -40,6 +49,8 @@ struct HfTaskD0 { Configurable selectionCand{"selectionCand", 1, "Selection Flag for conj. topol. selected candidates"}; Configurable selectionPid{"selectionPid", 1, "Selection Flag for reco PID candidates"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits"}; + // ML inference + Configurable applyMl{"applyMl", false, "Flag to apply ML selections"}; HfHelper hfHelper; @@ -48,11 +59,23 @@ struct HfTaskD0 { using D0CandidatesKF = soa::Join; using D0CandidatesMcKF = soa::Join; + using D0CandidatesMl = soa::Join; + using D0CandidatesMlMc = soa::Join; + using D0CandidatesMlKF = soa::Join; + using D0CandidatesMlMcKF = soa::Join; + Partition selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; Partition selectedD0CandidatesKF = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; Partition selectedD0CandidatesMc = aod::hf_sel_candidate_d0::isRecoHfFlag >= selectionFlagHf; Partition selectedD0CandidatesMcKF = aod::hf_sel_candidate_d0::isRecoHfFlag >= selectionFlagHf; + Partition selectedD0CandidatesMl = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + Partition selectedD0CandidatesMlKF = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + Partition selectedD0CandidatesMlMc = aod::hf_sel_candidate_d0::isRecoHfFlag >= selectionFlagHf; + Partition selectedD0CandidatesMlMcKF = aod::hf_sel_candidate_d0::isRecoHfFlag >= selectionFlagHf; + + HistogramConfigSpec hTHnBdtScoreVsMassVsPtVsYVsOriginVsD0Type{HistType::kTHnSparseD, {{100, 0.f, 1.f}, {100, 0.f, 1.f}, {120, 1.5848, 2.1848}, {360, 0., 36.}, {100, -5., 5.}, {3, -0.5, 2.5}, {4, -0.5, 3.5}}}; + HistogramRegistry registry{ "registry", {{"hPtCand", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, @@ -131,11 +154,11 @@ struct HfTaskD0 { void init(InitContext&) { - std::array doprocess{doprocessDataWithDCAFitterN, doprocessDataWithKFParticle, doprocessMcWithDCAFitterN, doprocessMcWithKFParticle}; + std::array doprocess{doprocessDataWithDCAFitterN, doprocessDataWithKFParticle, doprocessMcWithDCAFitterN, doprocessMcWithKFParticle, doprocessDataWithDCAFitterNMl, doprocessDataWithKFParticleMl, doprocessMcWithDCAFitterNMl, doprocessMcWithKFParticleMl}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) == 0) { LOGP(fatal, "At least one process function should be enabled at a time."); } - if ((doprocessDataWithDCAFitterN || doprocessMcWithDCAFitterN) && (doprocessDataWithKFParticle || doprocessMcWithKFParticle)) { + if ((doprocessDataWithDCAFitterN || doprocessMcWithDCAFitterN || doprocessDataWithDCAFitterNMl || doprocessMcWithDCAFitterNMl) && (doprocessDataWithKFParticle || doprocessMcWithKFParticle || doprocessDataWithKFParticleMl || doprocessMcWithKFParticleMl)) { LOGP(fatal, "DCAFitterN and KFParticle can not be enabled at a time."); } @@ -177,9 +200,14 @@ struct HfTaskD0 { registry.add("hNormalisedDecLengthxyVsPtSig", "2-prong candidates;decay length xy (cm) vs #it{p}_{T} for signal;entries", {HistType::kTH2F, {{800, 0., 40.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hDecLengthVsPtSig", "2-prong candidates;decay length (cm) vs #it{p}_{T} for signal;entries", {HistType::kTH2F, {{800, 0., 4.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hDecLengthxyVsPtSig", "2-prong candidates;decay length xy (cm) vs #it{p}_{T} for signal;entries", {HistType::kTH2F, {{800, 0., 4.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + + if (applyMl) { + registry.add("hBdtScoreVsMassVsPtVsYVsOriginVsD0Type", "2-prong candidates;BDT score bkg.;BDT score non-prompt;inv. mass (#pi K) (GeV/#it{c}^{2});#it{p}_{T};y;Origin;D0 Type;", hTHnBdtScoreVsMassVsPtVsYVsOriginVsD0Type); + registry.get(HIST("hBdtScoreVsMassVsPtVsYVsOriginVsD0Type"))->Sumw2(); + } } - template + template void processData(CandType const& candidates) { for (const auto& candidate : candidates) { @@ -238,21 +266,42 @@ struct HfTaskD0 { registry.fill(HIST("hCtFinerBinning"), hfHelper.ctD0(candidate), ptCandidate); registry.fill(HIST("hCPAFinerBinning"), candidate.cpa(), ptCandidate); registry.fill(HIST("hCPAXYFinerBinning"), candidate.cpaXY(), ptCandidate); + + if constexpr (applyMl) { + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], massD0, ptCandidate, hfHelper.yD0(candidate), 0, SigD0); + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], massD0bar, ptCandidate, hfHelper.yD0(candidate), 0, SigD0bar); + } + } } } void processDataWithDCAFitterN(D0Candidates const&) { - processData(selectedD0Candidates); + processData(selectedD0Candidates); } PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterN, "process taskD0 with DCAFitterN", true); void processDataWithKFParticle(D0CandidatesKF const&) { - processData(selectedD0CandidatesKF); + processData(selectedD0CandidatesKF); } PROCESS_SWITCH(HfTaskD0, processDataWithKFParticle, "process taskD0 with KFParticle", false); - template + void processDataWithDCAFitterNMl(D0CandidatesMl const&) + { + processData(selectedD0CandidatesMl); + } + PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterNMl, "process taskD0 with DCAFitterN and ML selections", false); + + void processDataWithKFParticleMl(D0CandidatesMlKF const&) + { + processData(selectedD0CandidatesMlKF); + } + PROCESS_SWITCH(HfTaskD0, processDataWithKFParticleMl, "process taskD0 with KFParticle and ML selections", false); + + template void processMc(CandType const& candidates, soa::Join const& mcParticles, aod::TracksWMc const& tracks) @@ -277,9 +326,9 @@ struct HfTaskD0 { // Get the corresponding MC particle. auto indexMother = RecoDecay::getMother(mcParticles, candidate.template prong0_as().template mcParticle_as>(), o2::constants::physics::Pdg::kD0, true); auto particleMother = mcParticles.rawIteratorAt(indexMother); - auto ptGen = particleMother.pt(); // gen. level pT - auto yGen = RecoDecay::y(std::array{particleMother.px(), particleMother.py(), particleMother.pz()}, o2::constants::physics::MassD0); // gen. level y - registry.fill(HIST("hPtGenSig"), ptGen); // gen. level pT + auto ptGen = particleMother.pt(); // gen. level pT + auto yGen = RecoDecay::y(std::array{particleMother.px(), particleMother.py(), particleMother.pz()}, o2::constants::physics::MassD0); // gen. level y + registry.fill(HIST("hPtGenSig"), ptGen); // gen. level pT auto ptRec = candidate.pt(); auto yRec = hfHelper.yD0(candidate); if (candidate.isRecoHfFlag() >= selectionFlagHf) { @@ -389,6 +438,9 @@ struct HfTaskD0 { registry.fill(HIST("hDecLengthVsPtSig"), declengthCandidate, ptCandidate); registry.fill(HIST("hDecLengthxyVsPtSig"), declengthxyCandidate, ptCandidate); registry.fill(HIST("hMassSigD0"), massD0, ptCandidate, rapidityCandidate); + if constexpr (applyMl) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], massD0, ptCandidate, rapidityCandidate, candidate.originMcRec(), SigD0); + } } else { registry.fill(HIST("hPtProng0Bkg"), ptProng0, rapidityCandidate); registry.fill(HIST("hPtProng1Bkg"), ptProng1, rapidityCandidate); @@ -406,6 +458,9 @@ struct HfTaskD0 { registry.fill(HIST("hMassBkgD0"), massD0, ptCandidate, rapidityCandidate); if (candidate.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { registry.fill(HIST("hMassReflBkgD0"), massD0, ptCandidate, rapidityCandidate); + if constexpr (applyMl) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], massD0, ptCandidate, rapidityCandidate, candidate.originMcRec(), ReflectedD0); + } } } } @@ -413,10 +468,16 @@ struct HfTaskD0 { registry.fill(HIST("hMassSigBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); if (candidate.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { registry.fill(HIST("hMassSigD0bar"), massD0bar, ptCandidate, rapidityCandidate); + if constexpr (applyMl) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], massD0bar, ptCandidate, rapidityCandidate, candidate.originMcRec(), SigD0bar); + } } else { registry.fill(HIST("hMassBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); if (candidate.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { registry.fill(HIST("hMassReflBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); + if constexpr (applyMl) { + registry.fill(HIST("hBdtScoreVsMassVsPtVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], massD0bar, ptCandidate, rapidityCandidate, candidate.originMcRec(), ReflectedD0bar); + } } } } @@ -449,7 +510,7 @@ struct HfTaskD0 { soa::Join const& mcParticles, aod::TracksWMc const& tracks) { - processMc(selectedD0CandidatesMc, mcParticles, tracks); + processMc(selectedD0CandidatesMc, mcParticles, tracks); } PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterN, "Process MC with DCAFitterN", false); @@ -457,9 +518,25 @@ struct HfTaskD0 { soa::Join const& mcParticles, aod::TracksWMc const& tracks) { - processMc(selectedD0CandidatesMcKF, mcParticles, tracks); + processMc(selectedD0CandidatesMcKF, mcParticles, tracks); } PROCESS_SWITCH(HfTaskD0, processMcWithKFParticle, "Process MC with KFParticle", false); + + void processMcWithDCAFitterNMl(D0CandidatesMlMc const&, + soa::Join const& mcParticles, + aod::TracksWMc const& tracks) + { + processMc(selectedD0CandidatesMlMc, mcParticles, tracks); + } + PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterNMl, "Process MC with DCAFitterN and ML selection", false); + + void processMcWithKFParticleMl(D0CandidatesMlMcKF const&, + soa::Join const& mcParticles, + aod::TracksWMc const& tracks) + { + processMc(selectedD0CandidatesMlMcKF, mcParticles, tracks); + } + PROCESS_SWITCH(HfTaskD0, processMcWithKFParticleMl, "Process MC with KFParticle and ML selections", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From c6a7d0b66b02d17a6a3503470a089fbfda7c9f49 Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Wed, 31 Jan 2024 21:46:07 +0900 Subject: [PATCH 22/33] PWGEM/PhotonMeson: update PCM analysis (#4533) --- PWGEM/PhotonMeson/Core/CutsLibrary.cxx | 136 +++++++-- PWGEM/PhotonMeson/Core/DalitzEECut.cxx | 5 + PWGEM/PhotonMeson/Core/DalitzEECut.h | 4 +- PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx | 108 ++++--- PWGEM/PhotonMeson/Core/HistogramsLibrary.h | 4 +- PWGEM/PhotonMeson/Core/V0PhotonCut.h | 18 +- PWGEM/PhotonMeson/DataModel/gammaTables.h | 190 ++++++++++-- .../TableProducer/photonconversionbuilder.cxx | 6 +- .../TableProducer/skimmerDalitzEE.cxx | 95 ++++-- .../TableProducer/skimmerDalitzMuMu.cxx | 99 ++++-- .../TableProducer/skimmerGammaConversion.cxx | 2 +- .../TableProducer/skimmerPrimaryElectron.cxx | 11 +- .../TableProducer/skimmerPrimaryMuon.cxx | 35 ++- PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx | 2 +- PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx | 2 +- PWGEM/PhotonMeson/Tasks/PhotonHBT.cxx | 281 +++++++++++------- .../PhotonMeson/Tasks/Pi0EtaToGammaGamma.cxx | 6 +- .../Tasks/Pi0EtaToGammaGammaMC.cxx | 11 +- PWGEM/PhotonMeson/Tasks/TaggingPi0.cxx | 37 +-- PWGEM/PhotonMeson/Tasks/TaggingPi0MC.cxx | 54 +--- PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx | 72 +++-- PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx | 1 - PWGEM/PhotonMeson/Tasks/dalitzMuMuQC.cxx | 4 - PWGEM/PhotonMeson/Tasks/dalitzMuMuQCMC.cxx | 17 +- PWGEM/PhotonMeson/Tasks/pcmQC.cxx | 2 +- PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx | 12 +- PWGEM/PhotonMeson/Utils/MCUtilities.h | 5 + PWGEM/PhotonMeson/Utils/PCMUtilities.h | 28 +- PWGEM/PhotonMeson/Utils/PairUtilities.h | 3 +- 29 files changed, 864 insertions(+), 386 deletions(-) diff --git a/PWGEM/PhotonMeson/Core/CutsLibrary.cxx b/PWGEM/PhotonMeson/Core/CutsLibrary.cxx index 1dc4e213e9e..1d8691261c4 100644 --- a/PWGEM/PhotonMeson/Core/CutsLibrary.cxx +++ b/PWGEM/PhotonMeson/Core/CutsLibrary.cxx @@ -20,7 +20,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) if (!nameStr.compare("analysis")) { // for track - cut->SetTrackPtRange(0.02f, 1e10f); + cut->SetTrackPtRange(0.04f, 1e10f); // cut->SetTrackEtaRange(-0.9, +0.9); cut->SetMinNCrossedRowsTPC(20); cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); @@ -37,7 +37,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) } if (!nameStr.compare("qc")) { // for track - cut->SetTrackPtRange(0.02f, 1e10f); + cut->SetTrackPtRange(0.04f, 1e10f); // cut->SetTrackEtaRange(-0.9, +0.9); cut->SetMinNCrossedRowsTPC(20); cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); @@ -47,7 +47,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) // for v0 cut->SetV0PtRange(0.1f, 1e10f); cut->SetV0EtaRange(-0.9, +0.9); - cut->SetMinCosPA(0.95); + cut->SetMinCosPA(0.99); cut->SetMaxPCA(3.0); cut->SetRxyRange(1, 90); cut->SetAPRange(0.95, 0.01); @@ -55,7 +55,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) } if (!nameStr.compare("qc_ITSTPC")) { // for track - cut->SetTrackPtRange(0.02f, 1e10f); + cut->SetTrackPtRange(0.04f, 1e10f); // cut->SetTrackEtaRange(-0.9, +0.9); cut->SetMinNCrossedRowsTPC(20); cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); @@ -74,7 +74,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) } if (!nameStr.compare("qc_ITSonly")) { // for track - cut->SetTrackPtRange(0.02f, 1e10f); + cut->SetTrackPtRange(0.04f, 1e10f); // cut->SetTrackEtaRange(-0.9, +0.9); cut->SetIsWithinBeamPipe(true); cut->SetRequireITSonly(true); @@ -89,7 +89,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) } if (!nameStr.compare("qc_TPConly")) { // for track - cut->SetTrackPtRange(0.02f, 1e10f); + cut->SetTrackPtRange(0.04f, 1e10f); // cut->SetTrackEtaRange(-0.9, +0.9); cut->SetMinNCrossedRowsTPC(20); cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); @@ -100,15 +100,15 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) // for v0 cut->SetV0PtRange(0.1f, 1e10f); cut->SetV0EtaRange(-0.9, +0.9); - cut->SetMinCosPA(0.95); + cut->SetMinCosPA(0.99); cut->SetMaxPCA(3.0); - cut->SetRxyRange(1, 90); + cut->SetRxyRange(36, 90); cut->SetAPRange(0.95, 0.01); return cut; } if (!nameStr.compare("wwire")) { // conversion only on tungstate wire // for track - cut->SetTrackPtRange(0.02f, 1e10f); + cut->SetTrackPtRange(0.04f, 1e10f); // cut->SetTrackEtaRange(-0.9, +0.9); cut->SetMinNCrossedRowsTPC(20); cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); @@ -120,7 +120,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) cut->SetV0PtRange(0.1f, 1e10f); cut->SetV0EtaRange(-0.9, +0.9); cut->SetMinCosPA(0.99); - cut->SetMaxPCA(0.5); + cut->SetMaxPCA(0.3); cut->SetOnWwireIB(true); cut->SetOnWwireOB(true); cut->SetAPRange(0.95, 0.01); @@ -128,7 +128,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) } if (!nameStr.compare("wwire_ib")) { // conversion only on tungstate wire outside of ITSib // for track - cut->SetTrackPtRange(0.02f, 1e10f); + cut->SetTrackPtRange(0.04f, 1e10f); // cut->SetTrackEtaRange(-0.9, +0.9); cut->SetMinNCrossedRowsTPC(20); cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); @@ -140,7 +140,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) cut->SetV0PtRange(0.1f, 1e10f); cut->SetV0EtaRange(-0.9, +0.9); cut->SetMinCosPA(0.99); - cut->SetMaxPCA(0.5); + cut->SetMaxPCA(0.3); cut->SetOnWwireIB(true); cut->SetOnWwireOB(false); cut->SetAPRange(0.95, 0.01); @@ -148,7 +148,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) } if (!nameStr.compare("wwire_ob")) { // conversion only on tungstate wire outside of ITSob (middle layer) // for track - cut->SetTrackPtRange(0.02f, 1e10f); + cut->SetTrackPtRange(0.04f, 1e10f); // cut->SetTrackEtaRange(-0.9, +0.9); cut->SetMinNCrossedRowsTPC(20); cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); @@ -160,24 +160,98 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) cut->SetV0PtRange(0.1f, 1e10f); cut->SetV0EtaRange(-0.9, +0.9); cut->SetMinCosPA(0.99); - cut->SetMaxPCA(0.5); + cut->SetMaxPCA(0.3); cut->SetOnWwireIB(false); cut->SetOnWwireOB(true); cut->SetAPRange(0.95, 0.01); return cut; } - if (!nameStr.compare("nopid")) { + + // for low B=0.2T + if (!nameStr.compare("qc_lowB")) { + // for track + cut->SetTrackPtRange(0.02f, 1e10f); + // cut->SetTrackEtaRange(-0.9, +0.9); + cut->SetMinNCrossedRowsTPC(20); + cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); + cut->SetChi2PerClusterTPC(0.0, 4.0); + cut->SetTPCNsigmaElRange(-3, +3); + cut->SetIsWithinBeamPipe(true); + // for v0 + cut->SetV0PtRange(0.05f, 1e10f); + cut->SetV0EtaRange(-0.9, +0.9); + cut->SetMinCosPA(0.99); + cut->SetMaxPCA(3.0); + cut->SetRxyRange(1, 90); + cut->SetAPRange(0.95, 0.01); + return cut; + } + if (!nameStr.compare("qc_ITSTPC_lowB")) { // for track cut->SetTrackPtRange(0.02f, 1e10f); // cut->SetTrackEtaRange(-0.9, +0.9); cut->SetMinNCrossedRowsTPC(20); cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); cut->SetChi2PerClusterTPC(0.0, 4.0); + cut->SetTPCNsigmaElRange(-3, +3); + cut->SetIsWithinBeamPipe(true); + cut->SetRequireITSTPC(true); + // for v0 + cut->SetV0PtRange(0.05f, 1e10f); + cut->SetV0EtaRange(-0.9, +0.9); + cut->SetMinCosPA(0.99); + cut->SetMaxPCA(0.5); + cut->SetRxyRange(1, 90); + cut->SetAPRange(0.95, 0.01); + return cut; + } + if (!nameStr.compare("qc_ITSonly_lowB")) { + // for track + cut->SetTrackPtRange(0.02f, 1e10f); + // cut->SetTrackEtaRange(-0.9, +0.9); + cut->SetIsWithinBeamPipe(true); + cut->SetRequireITSonly(true); + // for v0 + cut->SetV0PtRange(0.05f, 1e10f); + cut->SetV0EtaRange(-0.9, +0.9); + cut->SetMinCosPA(0.99); + cut->SetMaxPCA(0.5); + cut->SetRxyRange(1, 90); + cut->SetAPRange(0.95, 0.01); + return cut; + } + if (!nameStr.compare("qc_TPConly_lowB")) { + // for track + cut->SetTrackPtRange(0.02f, 1e10f); + // cut->SetTrackEtaRange(-0.9, +0.9); + cut->SetMinNCrossedRowsTPC(20); + cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); + cut->SetChi2PerClusterTPC(0.0, 4.0); + cut->SetTPCNsigmaElRange(-3, +3); + cut->SetIsWithinBeamPipe(true); + cut->SetRequireTPConly(true); + // for v0 + cut->SetV0PtRange(0.05f, 1e10f); + cut->SetV0EtaRange(-0.9, +0.9); + cut->SetMinCosPA(0.99); + cut->SetMaxPCA(3.0); + cut->SetRxyRange(36, 90); + cut->SetAPRange(0.95, 0.01); + return cut; + } + + if (!nameStr.compare("nopid")) { + // for track + cut->SetTrackPtRange(0.04f, 1e10f); + // cut->SetTrackEtaRange(-0.9, +0.9); + cut->SetMinNCrossedRowsTPC(20); + cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); + cut->SetChi2PerClusterTPC(0.0, 4.0); cut->SetIsWithinBeamPipe(true); // for v0 cut->SetV0PtRange(0.1f, 1e10f); cut->SetV0EtaRange(-0.9, +0.9); - cut->SetMinCosPA(0.95); + cut->SetMinCosPA(0.99); cut->SetMaxPCA(3.0); cut->SetRxyRange(1, 90); cut->SetAPRange(0.95, 0.01); @@ -185,7 +259,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) } if (!nameStr.compare("nocut")) { // for track - cut->SetTrackPtRange(0.02f, 1e10f); + cut->SetTrackPtRange(0.04f, 1e10f); // cut->SetTrackEtaRange(-0.9, +0.9); cut->SetMinNCrossedRowsTPC(20); cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); @@ -203,7 +277,7 @@ V0PhotonCut* o2::aod::pcmcuts::GetCut(const char* cutName) } if (!nameStr.compare("tag_track")) { // for track - cut->SetTrackPtRange(0.02f, 1e10f); + cut->SetTrackPtRange(0.04f, 1e10f); // cut->SetTrackEtaRange(-0.9, +0.9); cut->SetMinNCrossedRowsTPC(20); cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); @@ -231,6 +305,32 @@ DalitzEECut* o2::aod::dalitzeecuts::GetCut(const char* cutName) DalitzEECut* cut = new DalitzEECut(cutName, cutName); std::string nameStr = cutName; + if (!nameStr.compare("pc_itsib")) { + // for pair + cut->SelectPhotonConversion(true); + cut->SetMaxPhivPairMeeDep([](float mee) { + return (mee - -0.028) / 0.0185; + }); + + // for track + cut->SetTrackPtRange(0.05f, 1e10f); + cut->SetTrackEtaRange(-0.9, +0.9); + cut->SetMinNCrossedRowsTPC(80); + cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); + cut->SetChi2PerClusterTPC(0.0, 4.0); + cut->SetChi2PerClusterITS(0.0, 5.0); + cut->SetNClustersITS(2, 7); + cut->SetMaxDcaXY(1.0); + cut->SetMaxDcaZ(1.0); + + // for PID + cut->SetPIDScheme(DalitzEECut::PIDSchemes::kTPConly_lowB); + cut->SetTOFbetaRange(true, 0.0, 0.95); + cut->SetTPCNsigmaElRange(-3, +3); + cut->SetTPCNsigmaPiRange(0, 0); + return cut; + } + if (!nameStr.compare("mee_all_tpchadrejortofreq_wo_phiv_lowB")) { // for pair diff --git a/PWGEM/PhotonMeson/Core/DalitzEECut.cxx b/PWGEM/PhotonMeson/Core/DalitzEECut.cxx index d6ec8536f8f..df7369fb3a1 100644 --- a/PWGEM/PhotonMeson/Core/DalitzEECut.cxx +++ b/PWGEM/PhotonMeson/Core/DalitzEECut.cxx @@ -43,6 +43,11 @@ void DalitzEECut::SetMaxPhivPairMeeDep(std::function meeDepCut) mMaxPhivPairMeeDep = meeDepCut; LOG(info) << "DalitzEE Cut, set max phiv pair mee dep: " << mMaxPhivPairMeeDep(0.02); } +void DalitzEECut::SelectPhotonConversion(bool flag) +{ + mSelectPC = flag; + LOG(info) << "DalitzEE Cut, select photon conversion: " << mSelectPC; +} void DalitzEECut::SetTrackPtRange(float minPt, float maxPt) { mMinTrackPt = minPt; diff --git a/PWGEM/PhotonMeson/Core/DalitzEECut.h b/PWGEM/PhotonMeson/Core/DalitzEECut.h index c7a543287c6..9db1cb72747 100644 --- a/PWGEM/PhotonMeson/Core/DalitzEECut.h +++ b/PWGEM/PhotonMeson/Core/DalitzEECut.h @@ -320,7 +320,7 @@ class DalitzEECut : public TNamed return mMinMee <= pair.mass() && pair.mass() <= mMaxMee; case DalitzEECuts::kPhiV: - return mMinPhivPair <= pair.phiv() && pair.phiv() <= (mMaxPhivPairMeeDep ? mMaxPhivPairMeeDep(pair.mass()) : mMaxPhivPair); + return (mMinPhivPair <= pair.phiv() && pair.phiv() <= (mMaxPhivPairMeeDep ? mMaxPhivPairMeeDep(pair.mass()) : mMaxPhivPair)) ^ mSelectPC; default: return false; @@ -385,6 +385,7 @@ class DalitzEECut : public TNamed void SetPairEtaRange(float minEta = -1e10f, float maxEta = 1e10f); void SetMeeRange(float min = 0.f, float max = 0.5); void SetMaxPhivPairMeeDep(std::function meeDepCut); + void SelectPhotonConversion(bool flag); void SetTrackPtRange(float minPt = 0.f, float maxPt = 1e10f); void SetTrackEtaRange(float minEta = -1e10f, float maxEta = 1e10f); @@ -427,6 +428,7 @@ class DalitzEECut : public TNamed float mMinPairEta{-1e10f}, mMaxPairEta{1e10f}; // range in eta float mMinPhivPair{0.f}, mMaxPhivPair{+3.2}; std::function mMaxPhivPairMeeDep{}; // max phiv as a function of mee + bool mSelectPC{false}; // flag to select photon conversion used in mMaxPhivPairMeeDep // kinematic cuts float mMinTrackPt{0.f}, mMaxTrackPt{1e10f}; // range in pT diff --git a/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx b/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx index e37fb605f24..42367303130 100644 --- a/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx +++ b/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx @@ -63,15 +63,17 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* list->Add(new TH1F("hNclsITS", "number of ITS clusters", 8, -0.5, 7.5)); list->Add(new TH1F("hChi2ITS", "chi2/number of ITS clusters", 100, 0, 10)); list->Add(new TH1F("hITSClusterMap", "ITS cluster map", 128, -0.5, 127.5)); + list->Add(new TH1F("hMeanClusterSizeITS", "mean cluster size ITS; on ITS", 34, -0.5, 16.5)); list->Add(new TH2F("hXY", "X vs. Y;X (cm);Y (cm)", 100, 0, 100, 100, -50, 50)); list->Add(new TH2F("hZX", "Z vs. X;Z (cm);X (cm)", 200, -100, 100, 100, 0, 100)); list->Add(new TH2F("hZY", "Z vs. Y;Z (cm);Y (cm)", 200, -100, 100, 100, -50, 50)); - list->Add(new TH2F("hDCAxyZ", "DCAxy vs. Z;Z (cm);DCA_{xy} (cm)", 200, -100, +100, 100, -50, 50)); - list->Add(new TH2F("hXZ_tgl", "correlation of tgl vs. z/x;tgl;z/x - tgl", 300, -1.5, 1.5, 300, -1.5, 1.5)); if (TString(subGroup) == "mc") { list->Add(new TH2F("hPtGen_DeltaPtOverPtGen", "electron p_{T} resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", 1000, 0, 10, 400, -1.0f, 1.0f)); list->Add(new TH2F("hPtGen_DeltaEta", "electron #eta resolution;p_{T}^{gen} (GeV/c);#eta^{rec} - #eta^{gen}", 1000, 0, 10, 400, -1.0f, 1.0f)); list->Add(new TH2F("hPtGen_DeltaPhi", "electron #varphi resolution;p_{T}^{gen} (GeV/c);#varphi^{rec} - #varphi^{gen} (rad.)", 1000, 0, 10, 400, -1.0f, 1.0f)); + list->Add(new TH2F("hEtaRec_DeltaPtOverPtGen", "electron p_{T} resolution;#eta^{rec} of conversion point;(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", 400, -2, +2, 400, -1.0f, 1.0f)); + list->Add(new TH2F("hEtaRec_DeltaEta", "electron #eta resolution;#eta^{rec} of conversion point;#eta^{rec} - #eta^{gen}", 400, -2, +2, 400, -1.0f, 1.0f)); + list->Add(new TH2F("hEtaRec_DeltaPhi", "electron #varphi resolution;#eta^{rec} of conversion point;#varphi^{rec} - #varphi^{gen} (rad.)", 400, -2, +2, 400, -1.0f, 1.0f)); } } if (TString(histClass) == "V0") { @@ -79,9 +81,9 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* list->Add(new TH2F("hEtaPhi", "#eta vs. #varphi;#varphi (rad.);#eta", 180, 0, TMath::TwoPi(), 40, -2.0f, 2.0f)); list->Add(new TH2F("hRadius", "V0Radius; radius in Z (cm);radius in XY (cm)", 200, -100, 100, 200, 0.0f, 100.0f)); list->Add(new TH1F("hCosPA", "V0CosPA;cosine pointing angle", 100, 0.9f, 1.0f)); - list->Add(new TH2F("hCosPA_Rxy", "cos PA vs. R_{xy};R_{xy} (cm);cosine pointing angle", 100, 0.f, 100.f, 100, 0.9f, 1.0f)); + list->Add(new TH2F("hCosPA_Rxy", "cos PA vs. R_{xy};R_{xy} (cm);cosine pointing angle", 200, 0.f, 100.f, 100, 0.9f, 1.0f)); list->Add(new TH1F("hPCA", "distance between 2 legs;PCA (cm)", 500, 0.0f, 5.0f)); - list->Add(new TH2F("hPCA_Rxy", "distance between 2 legs vs. R_{xy};R_{xy} (cm);PCA (cm)", 100, 0.f, 100.f, 500, 0.0f, 5.0f)); + list->Add(new TH2F("hPCA_Rxy", "distance between 2 legs vs. R_{xy};R_{xy} (cm);PCA (cm)", 200, 0.f, 100.f, 500, 0.0f, 5.0f)); list->Add(new TH2F("hDCAxyz", "DCA to PV;DCA_{xy} (cm);DCA_{z} (cm)", 200, -5.f, +5.f, 200, -5.f, +5.f)); list->Add(new TH2F("hAPplot", "AP plot;#alpha;q_{T} (GeV/c)", 200, -1.0f, +1.0f, 250, 0.0f, 0.25f)); list->Add(new TH2F("hMassGamma", "hMassGamma;R_{xy} (cm);m_{ee} (GeV/c^{2})", 200, 0.0f, 100.0f, 100, 0.0f, 0.1f)); @@ -119,6 +121,9 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* list->Add(new TH2F("hPtGen_DeltaPtOverPtGen", "photon p_{T} resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", 1000, 0, 10, 400, -1.0f, 1.0f)); list->Add(new TH2F("hPtGen_DeltaEta", "photon #eta resolution;p_{T}^{gen} (GeV/c);#eta^{rec} - #eta^{gen}", 1000, 0, 10, 400, -1.0f, 1.0f)); list->Add(new TH2F("hPtGen_DeltaPhi", "photon #varphi resolution;p_{T}^{gen} (GeV/c);#varphi^{rec} - #varphi^{gen} (rad.)", 1000, 0, 10, 400, -1.0f, 1.0f)); + list->Add(new TH2F("hEtaRec_DeltaPtOverPtGen", "photon p_{T} resolution;#eta^{rec} of conversion point;(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", 400, -2, +2, 400, -1.0f, 1.0f)); + list->Add(new TH2F("hEtaRec_DeltaEta", "photon #eta resolution;#eta^{rec} of conversion point;#eta^{rec} - #eta^{gen}", 400, -2, +2, 400, -1.0f, 1.0f)); + list->Add(new TH2F("hEtaRec_DeltaPhi", "photon #varphi resolution;#eta^{rec} of conversion point;#varphi^{rec} - #varphi^{gen} (rad.)", 400, -2, +2, 400, -1.0f, 1.0f)); } // end of mc } // end of V0 @@ -178,28 +183,43 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* hs_dilepton_lsmm_same->Sumw2(); list->Add(hs_dilepton_lsmm_same); - const int ndim_dca = 4; // mee, dca1, dca2 - const int nbins_dca[ndim_dca] = {nm - 1, 50, 50, 50}; - const double xmin_dca[ndim_dca] = {0.0, 0.0, 0.0, 0.0}; - const double xmax_dca[ndim_dca] = {3.5, 5.0, 5.0, 5.0}; - - hs_dilepton_uls_dca_same = new THnSparseF("hs_dilepton_uls_dca_same", "hs_dilepton_uls_dca;m_{ee} (GeV/c^{2});DCA_{e^{+}}^{3D} (#sigma);DCA_{e^{-}}^{3D} (#sigma);DCA_{ee}^{3D} (#sigma);", ndim_dca, nbins_dca, xmin_dca, xmax_dca); - hs_dilepton_uls_dca_same->SetBinEdges(0, mee); - hs_dilepton_uls_dca_same->Sumw2(); - list->Add(hs_dilepton_uls_dca_same); - - hs_dilepton_lspp_dca_same = reinterpret_cast(hs_dilepton_uls_dca_same->Clone("hs_dilepton_lspp_dca_same")); - hs_dilepton_lsmm_dca_same = reinterpret_cast(hs_dilepton_uls_dca_same->Clone("hs_dilepton_lsmm_dca_same")); - list->Add(hs_dilepton_lspp_dca_same); - list->Add(hs_dilepton_lsmm_dca_same); - - if (TString(subGroup) == "mix") { + if (TString(subGroup).Contains("mix")) { THnSparseF* hs_dilepton_uls_mix = reinterpret_cast(hs_dilepton_uls_same->Clone("hs_dilepton_uls_mix")); THnSparseF* hs_dilepton_lspp_mix = reinterpret_cast(hs_dilepton_lspp_same->Clone("hs_dilepton_lspp_mix")); THnSparseF* hs_dilepton_lsmm_mix = reinterpret_cast(hs_dilepton_lsmm_same->Clone("hs_dilepton_lsmm_mix")); list->Add(hs_dilepton_uls_mix); list->Add(hs_dilepton_lspp_mix); list->Add(hs_dilepton_lsmm_mix); + } + + if (TString(subGroup).Contains("dca")) { + const int ndim_dca = 4; // mee, dca1, dca2, dca12 + + const int ndca = 27; + double dca[ndca] = {0.f}; + for (int i = 0; i < 20; i++) { + dca[i] = 0.1 * i; + } + for (int i = 20; i < ndca; i++) { + dca[i] = 0.5 * (i - 20) + 2.0; + } + + const int nbins_dca[ndim_dca] = {nm - 1, ndca - 1, ndca - 1, ndca - 1}; + const double xmin_dca[ndim_dca] = {0.0, 0.0, 0.0, 0.0}; + const double xmax_dca[ndim_dca] = {3.5, 5.0, 5.0, 5.0}; + + hs_dilepton_uls_dca_same = new THnSparseF("hs_dilepton_uls_dca_same", "hs_dilepton_uls_dca;m_{ee} (GeV/c^{2});DCA_{e^{+}}^{3D} (#sigma);DCA_{e^{-}}^{3D} (#sigma);DCA_{ee}^{3D} (#sigma);", ndim_dca, nbins_dca, xmin_dca, xmax_dca); + hs_dilepton_uls_dca_same->SetBinEdges(0, mee); + hs_dilepton_uls_dca_same->SetBinEdges(1, dca); + hs_dilepton_uls_dca_same->SetBinEdges(2, dca); + hs_dilepton_uls_dca_same->SetBinEdges(3, dca); + hs_dilepton_uls_dca_same->Sumw2(); + list->Add(hs_dilepton_uls_dca_same); + + hs_dilepton_lspp_dca_same = reinterpret_cast(hs_dilepton_uls_dca_same->Clone("hs_dilepton_lspp_dca_same")); + hs_dilepton_lsmm_dca_same = reinterpret_cast(hs_dilepton_uls_dca_same->Clone("hs_dilepton_lsmm_dca_same")); + list->Add(hs_dilepton_lspp_dca_same); + list->Add(hs_dilepton_lsmm_dca_same); THnSparseF* hs_dilepton_uls_dca_mix = reinterpret_cast(hs_dilepton_uls_dca_same->Clone("hs_dilepton_uls_dca_mix")); THnSparseF* hs_dilepton_lspp_dca_mix = reinterpret_cast(hs_dilepton_lspp_dca_same->Clone("hs_dilepton_lspp_dca_mix")); @@ -287,6 +307,7 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* list->Add(new TH1F("hNclsITS", "number of ITS clusters", 8, -0.5, 7.5)); list->Add(new TH1F("hChi2ITS", "chi2/number of ITS clusters", 100, 0, 10)); list->Add(new TH1F("hITSClusterMap", "ITS cluster map", 128, -0.5, 127.5)); + list->Add(new TH1F("hMeanClusterSizeITS", "mean cluster size ITS; on ITS", 34, -0.5, 16.5)); if (TString(subGroup).Contains("mc")) { list->Add(new TH2F("hPtGen_DeltaPtOverPtGen", "electron p_{T} resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", 1000, 0, maxP, 400, -1.0f, 1.0f)); list->Add(new TH2F("hPtGen_DeltaEta", "electron #eta resolution;p_{T}^{gen} (GeV/c);#eta^{rec} - #eta^{gen}", 1000, 0, maxP, 400, -1.0f, 1.0f)); @@ -501,23 +522,36 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* if (TString(histClass) == "photon_hbt") { const int nm_hbt = 6; double m_hbt[nm_hbt] = {0.0, 0.14, 0.5, 1.1, 2.0, 2.7}; - - const int ndim = 8; // m1, m2, kt, qinv, qlong_cms, qout_cms, qside_cms, qlong_lcms - const int nbins[ndim] = {nm_hbt - 1, nm_hbt - 1, 10, 40, 80, 80, 80, 80}; - const double xmin[ndim] = {0.0, 0.0, 0.0, 0.0, -0.4, -0.4, -0.4, -0.4}; - const double xmax[ndim] = {2.7, 2.7, 1.0, 0.4, +0.4, +0.4, +0.4, +0.4}; - - THnSparseF* hs_q_same = new THnSparseF("hs_q_same", "hs_q_same;m_{1} (GeV/c^{2});m_{2} (GeV/c^{2});k_{T} (GeV/c);q_{inv} (GeV/c);q_{long}^{CMS} (GeV/c);q_{out}^{CMS} (GeV/c);q_{side}^{CMS} (GeV/c);q_{long}^{LCMS} (GeV/c);", ndim, nbins, xmin, xmax); - THnSparseF* hs_q_mix = new THnSparseF("hs_q_mix", "hs_q_mix;m_{1} (GeV/c^{2});m_{2} (GeV/c^{2});k_{T} (GeV/c);q_{inv} (GeV/c);q_{long}^{CMS} (GeV/c);q_{out}^{CMS} (GeV/c);q_{side}^{CMS} (GeV/c);q_{long}^{LCMS} (GeV/c);", ndim, nbins, xmin, xmax); - hs_q_same->Sumw2(); - hs_q_mix->Sumw2(); - hs_q_same->SetBinEdges(0, m_hbt); - hs_q_same->SetBinEdges(1, m_hbt); - hs_q_mix->Sumw2(); - hs_q_mix->SetBinEdges(0, m_hbt); - hs_q_mix->SetBinEdges(1, m_hbt); - list->Add(hs_q_same); - list->Add(hs_q_mix); + THnSparseF* hs_q_same = nullptr; + THnSparseF* hs_q_mix = nullptr; + + if (TString(subGroup) == "1d") { + const int ndim_1d = 4; // m1, m2, kt, qinv + const int nbins_1d[ndim_1d] = {nm_hbt - 1, nm_hbt - 1, 10, 40}; + const double xmin_1d[ndim_1d] = {0.0, 0.0, 0.0, 0.0}; + const double xmax_1d[ndim_1d] = {2.7, 2.7, 1.0, 0.4}; + + hs_q_same = new THnSparseF("hs_q_same", "hs_q_same;m_{1} (GeV/c^{2});m_{2} (GeV/c^{2});k_{T} (GeV/c);q_{inv} (GeV/c);q_{long}^{CMS} (GeV/c);q_{out}^{CMS} (GeV/c);q_{side}^{CMS} (GeV/c);q_{long}^{LCMS} (GeV/c);", ndim_1d, nbins_1d, xmin_1d, xmax_1d); + hs_q_same->Sumw2(); + hs_q_same->SetBinEdges(0, m_hbt); + hs_q_same->SetBinEdges(1, m_hbt); + hs_q_mix = reinterpret_cast(hs_q_same->Clone("hs_q_mix")); + list->Add(hs_q_same); + list->Add(hs_q_mix); + } else if (TString(subGroup) == "3d") { + const int ndim_3d = 8; // m1, m2, kt, qinv, qlong_cms, qout_cms, qside_cms, qlong_lcms + const int nbins_3d[ndim_3d] = {nm_hbt - 1, nm_hbt - 1, 10, 40, 80, 80, 80, 80}; + const double xmin_3d[ndim_3d] = {0.0, 0.0, 0.0, 0.0, -0.4, -0.4, -0.4, -0.4}; + const double xmax_3d[ndim_3d] = {2.7, 2.7, 1.0, 0.4, +0.4, +0.4, +0.4, +0.4}; + + hs_q_same = new THnSparseF("hs_q_same", "hs_q_same;m_{1} (GeV/c^{2});m_{2} (GeV/c^{2});k_{T} (GeV/c);q_{inv} (GeV/c);q_{long}^{CMS} (GeV/c);q_{out}^{CMS} (GeV/c);q_{side}^{CMS} (GeV/c);q_{long}^{LCMS} (GeV/c);", ndim_3d, nbins_3d, xmin_3d, xmax_3d); + hs_q_same->Sumw2(); + hs_q_same->SetBinEdges(0, m_hbt); + hs_q_same->SetBinEdges(1, m_hbt); + hs_q_mix = reinterpret_cast(hs_q_same->Clone("hs_q_mix")); + list->Add(hs_q_same); + list->Add(hs_q_mix); + } } } THashList* o2::aod::emphotonhistograms::AddHistClass(THashList* list, const char* histClass) diff --git a/PWGEM/PhotonMeson/Core/HistogramsLibrary.h b/PWGEM/PhotonMeson/Core/HistogramsLibrary.h index 6fb568c1f90..3de3f8e24a3 100644 --- a/PWGEM/PhotonMeson/Core/HistogramsLibrary.h +++ b/PWGEM/PhotonMeson/Core/HistogramsLibrary.h @@ -98,14 +98,13 @@ void FillHistClass(THashList* list, const char* subGroup, T const& obj) reinterpret_cast(list->FindObject("hChi2TPC"))->Fill(obj.tpcChi2NCl()); reinterpret_cast(list->FindObject("hChi2ITS"))->Fill(obj.itsChi2NCl()); reinterpret_cast(list->FindObject("hITSClusterMap"))->Fill(obj.itsClusterMap()); + reinterpret_cast(list->FindObject("hMeanClusterSizeITS"))->Fill(obj.meanClusterSizeITS()); reinterpret_cast(list->FindObject("hTPCdEdx"))->Fill(obj.tpcInnerParam(), obj.tpcSignal()); reinterpret_cast(list->FindObject("hTPCNsigmaEl"))->Fill(obj.tpcInnerParam(), obj.tpcNSigmaEl()); reinterpret_cast(list->FindObject("hTPCNsigmaPi"))->Fill(obj.tpcInnerParam(), obj.tpcNSigmaPi()); reinterpret_cast(list->FindObject("hXY"))->Fill(obj.x(), obj.y()); reinterpret_cast(list->FindObject("hZX"))->Fill(obj.z(), obj.x()); reinterpret_cast(list->FindObject("hZY"))->Fill(obj.z(), obj.y()); - reinterpret_cast(list->FindObject("hDCAxyZ"))->Fill(obj.z(), obj.dcaXY()); - reinterpret_cast(list->FindObject("hXZ_tgl"))->Fill(obj.tgl(), obj.z() / obj.x() - obj.tgl()); } else if constexpr (htype == EMHistType::kTrack) { reinterpret_cast(list->FindObject("hPt"))->Fill(obj.pt()); reinterpret_cast(list->FindObject("hQoverPt"))->Fill(obj.sign() / obj.pt()); @@ -122,6 +121,7 @@ void FillHistClass(THashList* list, const char* subGroup, T const& obj) reinterpret_cast(list->FindObject("hChi2TPC"))->Fill(obj.tpcChi2NCl()); reinterpret_cast(list->FindObject("hChi2ITS"))->Fill(obj.itsChi2NCl()); reinterpret_cast(list->FindObject("hITSClusterMap"))->Fill(obj.itsClusterMap()); + reinterpret_cast(list->FindObject("hMeanClusterSizeITS"))->Fill(obj.meanClusterSizeITS()); reinterpret_cast(list->FindObject("hTPCdEdx"))->Fill(obj.tpcInnerParam(), obj.tpcSignal()); reinterpret_cast(list->FindObject("hTPCNsigmaEl"))->Fill(obj.tpcInnerParam(), obj.tpcNSigmaEl()); reinterpret_cast(list->FindObject("hTPCNsigmaMu"))->Fill(obj.tpcInnerParam(), obj.tpcNSigmaMu()); diff --git a/PWGEM/PhotonMeson/Core/V0PhotonCut.h b/PWGEM/PhotonMeson/Core/V0PhotonCut.h index f772ceadb86..15d68256064 100644 --- a/PWGEM/PhotonMeson/Core/V0PhotonCut.h +++ b/PWGEM/PhotonMeson/Core/V0PhotonCut.h @@ -301,17 +301,17 @@ class V0PhotonCut : public TNamed // const float z_max = +31.15; // cm float x = abs(v0.vx()); // cm, measured secondary vertex of gamma->ee float y = v0.vy(); // cm, measured secondary vertex of gamma->ee - // float z = v0.vz(); // cm, measured secondary vertex of gamma->ee + float z = v0.vz(); // cm, measured secondary vertex of gamma->ee float rxy = sqrt(x * x + y * y); - if (rxy < 7.0 || 16.0 < rxy) { + if (rxy < 7.0 || 15.0 < rxy) { return false; } - // float z_exp = z_min + (rxy - rxy_min) / TMath::Tan(10.86 * TMath::DegToRad()); // cm, expected position rxy of W wire as a function of z - // if (abs(z - z_exp) > margin_z) { - // return false; - // } + // r = 0.192 * z + 8.88 (cm) expected wire position in RZ plane.TMath::Tan(10.86 * TMath::DegToRad()) = 0.192 + if (rxy > 0.192 * z + 14.0) { // upper limit + return false; + } float dxy = abs(1.0 * y - x * TMath::Tan(-8.52 * TMath::DegToRad())) / sqrt(pow(1.0, 2) + pow(TMath::Tan(-8.52 * TMath::DegToRad()), 2)); return !(dxy > margin_xy); @@ -382,6 +382,10 @@ class V0PhotonCut : public TNamed return mMinChi2PerClusterITS < track.itsChi2NCl() && track.itsChi2NCl() < mMaxChi2PerClusterITS; case V0PhotonCuts::kIsWithinBeamPipe: { + if (!isTPConlyTrack(track)) { // TPC-TRD, TPC-TOF, TPC-TRD-TOF are constrained. + return true; + } + // if (abs(track.y()) > abs(track.x() * TMath::Tan(10.f * TMath::DegToRad())) + 15.f) { // return false; // } @@ -391,7 +395,7 @@ class V0PhotonCut : public TNamed if (track.x() > 82.9 && abs(track.y()) > abs(track.x() * TMath::Tan(10.f * TMath::DegToRad())) + 5.f) { return false; } - if (track.x() > 82.9 && abs(track.y()) < 15.0 && abs(abs(track.z()) - 45.0) < 2.0) { + if (track.x() > 82.9 && abs(track.y()) < 15.0 && abs(abs(track.z()) - 44.5) < 2.5) { return false; } return true; diff --git a/PWGEM/PhotonMeson/DataModel/gammaTables.h b/PWGEM/PhotonMeson/DataModel/gammaTables.h index e71651bcf06..b43275269c8 100644 --- a/PWGEM/PhotonMeson/DataModel/gammaTables.h +++ b/PWGEM/PhotonMeson/DataModel/gammaTables.h @@ -228,7 +228,51 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float px, float py, float pz) -> float { ret DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float px, float py) -> float { return RecoDecay::sqrtSumOfSquares(px, py); }); DECLARE_SOA_DYNAMIC_COLUMN(Eta, eta, [](float px, float py, float pz) -> float { return RecoDecay::eta(std::array{px, py, pz}); }); DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, [](float px, float py) -> float { return RecoDecay::phi(px, py); }); -// DECLARE_SOA_COLUMN(IsAmbTrack, isAmbTrack, bool); //! +DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITS, meanClusterSizeITS, [](uint32_t itsClusterSizes) -> float { + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 0; layer < 7; layer++) { + int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; + if (cluster_size_per_layer > 0) { + nl++; + } + total_cluster_size += cluster_size_per_layer; + } + if (nl > 0) { + return static_cast(total_cluster_size) / static_cast(nl); + } else { + return 0; + } +}); +DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSib, meanClusterSizeITSib, [](uint32_t itsClusterSizes) -> float { + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 0; layer < 3; layer++) { + int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; + if (cluster_size_per_layer > 0) { + nl++; + } + total_cluster_size += cluster_size_per_layer; + } + if (nl > 0) { + return static_cast(total_cluster_size) / static_cast(nl); + } else { + return 0; + } +}); +DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSob, meanClusterSizeITSob, [](uint32_t itsClusterSizes) -> float { + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 4; layer < 7; layer++) { + int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; + if (cluster_size_per_layer > 0) { + nl++; + } + total_cluster_size += cluster_size_per_layer; + } + if (nl > 0) { + return static_cast(total_cluster_size) / static_cast(nl); + } else { + return 0; + } +}); } // namespace v0leg DECLARE_SOA_TABLE(V0Legs, "AOD", "V0LEG", //! o2::soa::Index<>, v0leg::CollisionId, v0leg::TrackId, v0leg::Sign, @@ -237,7 +281,7 @@ DECLARE_SOA_TABLE(V0Legs, "AOD", "V0LEG", //! track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCChi2NCl, track::TPCInnerParam, track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, - track::ITSClusterMap, track::ITSChi2NCl, track::DetectorMap, + track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, track::X, track::Y, track::Z, track::Tgl, track::Signed1Pt, // dynamic column @@ -249,9 +293,12 @@ DECLARE_SOA_TABLE(V0Legs, "AOD", "V0LEG", //! track::TPCNClsCrossedRows, track::TPCCrossedRowsOverFindableCls, track::TPCFoundOverFindableCls, - track::ITSNCls, + track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, track::HasITS, track::HasTPC, - track::HasTRD, track::HasTOF); + track::HasTRD, track::HasTOF, + v0leg::MeanClusterSizeITS, + v0leg::MeanClusterSizeITSib, + v0leg::MeanClusterSizeITSob); // iterators using V0Leg = V0Legs::iterator; @@ -269,14 +316,13 @@ DECLARE_SOA_COLUMN(Px, px, float); //! px f DECLARE_SOA_COLUMN(Py, py, float); //! py for photon kf DECLARE_SOA_COLUMN(Pz, pz, float); //! pz for photon kf DECLARE_SOA_COLUMN(MGamma, mGamma, float); //! invariant mass of dielectron at SV -// DECLARE_SOA_COLUMN(MGammaPV, mGammaPV, float); //! invariant mass of dielectron at PV -DECLARE_SOA_COLUMN(DCAxyToPV, dcaXYtopv, float); //! DCAxy of V0 to PV -DECLARE_SOA_COLUMN(DCAzToPV, dcaZtopv, float); //! DCAz of V0 to PV -DECLARE_SOA_COLUMN(CosPA, cospa, float); //! -DECLARE_SOA_COLUMN(PCA, pca, float); //! -DECLARE_SOA_COLUMN(Alpha, alpha, float); //! -DECLARE_SOA_COLUMN(QtArm, qtarm, float); //! -DECLARE_SOA_COLUMN(ChiSquareNDF, chiSquareNDF, float); // Chi2 / NDF of the reconstructed V0 +DECLARE_SOA_COLUMN(DCAxyToPV, dcaXYtopv, float); //! DCAxy of V0 to PV +DECLARE_SOA_COLUMN(DCAzToPV, dcaZtopv, float); //! DCAz of V0 to PV +DECLARE_SOA_COLUMN(CosPA, cospa, float); //! +DECLARE_SOA_COLUMN(PCA, pca, float); //! +DECLARE_SOA_COLUMN(Alpha, alpha, float); //! +DECLARE_SOA_COLUMN(QtArm, qtarm, float); //! +DECLARE_SOA_COLUMN(ChiSquareNDF, chiSquareNDF, float); // Chi2 / NDF of the reconstructed V0 DECLARE_SOA_DYNAMIC_COLUMN(E, e, [](float px, float py, float pz, float m = 0) -> float { return RecoDecay::sqrtSumOfSquares(px, py, pz, m); }); //! energy of v0 photn, mass to be given as argument when getter is called! DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float px, float py) -> float { return RecoDecay::sqrtSumOfSquares(px, py); }); @@ -319,6 +365,51 @@ DECLARE_SOA_COLUMN(PrefilterBit, pfb, uint8_t); //! DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); }); DECLARE_SOA_DYNAMIC_COLUMN(Py, py, [](float pt, float phi) -> float { return pt * std::sin(phi); }); DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, [](float pt, float eta) -> float { return pt * std::sinh(eta); }); +DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITS, meanClusterSizeITS, [](uint32_t itsClusterSizes) -> float { + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 0; layer < 7; layer++) { + int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; + if (cluster_size_per_layer > 0) { + nl++; + } + total_cluster_size += cluster_size_per_layer; + } + if (nl > 0) { + return static_cast(total_cluster_size) / static_cast(nl); + } else { + return 0; + } +}); +DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSib, meanClusterSizeITSib, [](uint32_t itsClusterSizes) -> float { + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 0; layer < 3; layer++) { + int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; + if (cluster_size_per_layer > 0) { + nl++; + } + total_cluster_size += cluster_size_per_layer; + } + if (nl > 0) { + return static_cast(total_cluster_size) / static_cast(nl); + } else { + return 0; + } +}); +DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSob, meanClusterSizeITSob, [](uint32_t itsClusterSizes) -> float { + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 4; layer < 7; layer++) { + int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; + if (cluster_size_per_layer > 0) { + nl++; + } + total_cluster_size += cluster_size_per_layer; + } + if (nl > 0) { + return static_cast(total_cluster_size) / static_cast(nl); + } else { + return 0; + } +}); } // namespace emprimaryelectron DECLARE_SOA_TABLE(EMPrimaryElectrons, "AOD", "EMPRIMARYEL", //! o2::soa::Index<>, emprimaryelectron::CollisionId, @@ -328,19 +419,22 @@ DECLARE_SOA_TABLE(EMPrimaryElectrons, "AOD", "EMPRIMARYEL", //! track::TPCChi2NCl, track::TPCInnerParam, track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaMu, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr, pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaMu, pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr, - track::ITSClusterMap, track::ITSChi2NCl, track::DetectorMap, track::Signed1Pt, track::CYY, track::CZZ, track::CZY, + track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, track::Signed1Pt, track::CYY, track::CZZ, track::CZY, // dynamic column track::TPCNClsFound, track::TPCNClsCrossedRows, track::TPCCrossedRowsOverFindableCls, track::TPCFoundOverFindableCls, - track::ITSNCls, + track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, emprimaryelectron::Px, emprimaryelectron::Py, - emprimaryelectron::Pz); + emprimaryelectron::Pz, + emprimaryelectron::MeanClusterSizeITS, + emprimaryelectron::MeanClusterSizeITSib, + emprimaryelectron::MeanClusterSizeITSob); // iterators using EMPrimaryElectron = EMPrimaryElectrons::iterator; @@ -362,16 +456,16 @@ DECLARE_SOA_COLUMN(Pt, pt, float); DECLARE_SOA_COLUMN(Eta, eta, float); DECLARE_SOA_COLUMN(Phi, phi, float); DECLARE_SOA_COLUMN(Mass, mass, float); +DECLARE_SOA_COLUMN(Rapidity, rapidity, float); DECLARE_SOA_COLUMN(PhiV, phiv, float); DECLARE_SOA_COLUMN(OpeningAngle, opangle, float); -DECLARE_SOA_COLUMN(DCAXY, dcaXY, float); -DECLARE_SOA_COLUMN(DCAZ, dcaZ, float); DECLARE_SOA_COLUMN(Sign, sign, int); //! DECLARE_SOA_DYNAMIC_COLUMN(Energy, e, [](float pt, float eta, float m) { return RecoDecay::sqrtSumOfSquares(pt * std::cosh(eta), m); }); // e = sqrt(p*p + m*m) } // namespace dalitzee DECLARE_SOA_TABLE(DalitzEEs, "AOD", "DALITZEE", //! o2::soa::Index<>, dalitzee::CollisionId, dalitzee::PosTrackId, dalitzee::NegTrackId, - dalitzee::Pt, dalitzee::Eta, dalitzee::Phi, dalitzee::Mass, dalitzee::PhiV, dalitzee::OpeningAngle, dalitzee::DCAXY, dalitzee::DCAZ, dalitzee::Sign, + dalitzee::Pt, dalitzee::Eta, dalitzee::Phi, dalitzee::Mass, dalitzee::Rapidity, + dalitzee::PhiV, dalitzee::OpeningAngle, dalitzee::Sign, dalitzee::Energy); // iterators using DalitzEE = DalitzEEs::iterator; @@ -390,6 +484,51 @@ DECLARE_SOA_COLUMN(PrefilterBit, pfb, uint8_t); //! DECLARE_SOA_DYNAMIC_COLUMN(Px, px, [](float pt, float phi) -> float { return pt * std::cos(phi); }); DECLARE_SOA_DYNAMIC_COLUMN(Py, py, [](float pt, float phi) -> float { return pt * std::sin(phi); }); DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, [](float pt, float eta) -> float { return pt * std::sinh(eta); }); +DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITS, meanClusterSizeITS, [](uint32_t itsClusterSizes) -> float { + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 0; layer < 7; layer++) { + int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; + if (cluster_size_per_layer > 0) { + nl++; + } + total_cluster_size += cluster_size_per_layer; + } + if (nl > 0) { + return static_cast(total_cluster_size) / static_cast(nl); + } else { + return 0; + } +}); +DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSib, meanClusterSizeITSib, [](uint32_t itsClusterSizes) -> float { + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 0; layer < 3; layer++) { + int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; + if (cluster_size_per_layer > 0) { + nl++; + } + total_cluster_size += cluster_size_per_layer; + } + if (nl > 0) { + return static_cast(total_cluster_size) / static_cast(nl); + } else { + return 0; + } +}); +DECLARE_SOA_DYNAMIC_COLUMN(MeanClusterSizeITSob, meanClusterSizeITSob, [](uint32_t itsClusterSizes) -> float { + int total_cluster_size = 0, nl = 0; + for (unsigned int layer = 4; layer < 7; layer++) { + int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; + if (cluster_size_per_layer > 0) { + nl++; + } + total_cluster_size += cluster_size_per_layer; + } + if (nl > 0) { + return static_cast(total_cluster_size) / static_cast(nl); + } else { + return 0; + } +}); } // namespace emprimarymuon DECLARE_SOA_TABLE(EMPrimaryMuons, "AOD", "EMPRIMARYMU", //! o2::soa::Index<>, emprimarymuon::CollisionId, @@ -399,19 +538,22 @@ DECLARE_SOA_TABLE(EMPrimaryMuons, "AOD", "EMPRIMARYMU", //! track::TPCChi2NCl, track::TPCInnerParam, track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaMu, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr, pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaMu, pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr, - track::ITSClusterMap, track::ITSChi2NCl, track::DetectorMap, track::Signed1Pt, track::CYY, track::CZZ, track::CZY, + track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, track::Signed1Pt, track::CYY, track::CZZ, track::CZY, // dynamic column track::TPCNClsFound, track::TPCNClsCrossedRows, track::TPCCrossedRowsOverFindableCls, track::TPCFoundOverFindableCls, - track::ITSNCls, + track::v001::ITSClusterMap, track::v001::ITSNCls, track::v001::ITSNClsInnerBarrel, track::HasITS, track::HasTPC, track::HasTRD, track::HasTOF, emprimarymuon::Px, emprimarymuon::Py, - emprimarymuon::Pz); + emprimarymuon::Pz, + emprimarymuon::MeanClusterSizeITS, + emprimarymuon::MeanClusterSizeITSib, + emprimarymuon::MeanClusterSizeITSob); // iterators using EMPrimaryMuon = EMPrimaryMuons::iterator; @@ -433,16 +575,16 @@ DECLARE_SOA_COLUMN(Pt, pt, float); DECLARE_SOA_COLUMN(Eta, eta, float); DECLARE_SOA_COLUMN(Phi, phi, float); DECLARE_SOA_COLUMN(Mass, mass, float); +DECLARE_SOA_COLUMN(Rapidity, rapidity, float); DECLARE_SOA_COLUMN(PhiV, phiv, float); DECLARE_SOA_COLUMN(OpeningAngle, opangle, float); -DECLARE_SOA_COLUMN(DCAXY, dcaXY, float); -DECLARE_SOA_COLUMN(DCAZ, dcaZ, float); DECLARE_SOA_COLUMN(Sign, sign, int); //! DECLARE_SOA_DYNAMIC_COLUMN(Energy, e, [](float pt, float eta, float m) { return RecoDecay::sqrtSumOfSquares(pt * std::cosh(eta), m); }); // e = sqrt(p*p + m*m) } // namespace dalitzmumu DECLARE_SOA_TABLE(DalitzMuMus, "AOD", "DALITZMUMU", //! o2::soa::Index<>, dalitzmumu::CollisionId, dalitzmumu::PosTrackId, dalitzmumu::NegTrackId, - dalitzmumu::Pt, dalitzmumu::Eta, dalitzmumu::Phi, dalitzmumu::Mass, dalitzmumu::PhiV, dalitzmumu::OpeningAngle, dalitzmumu::DCAXY, dalitzmumu::DCAZ, dalitzmumu::Sign, + dalitzmumu::Pt, dalitzmumu::Eta, dalitzmumu::Phi, dalitzmumu::Mass, dalitzmumu::Rapidity, + dalitzmumu::PhiV, dalitzmumu::OpeningAngle, dalitzmumu::Sign, dalitzmumu::Energy); // iterators using DalitzMuMu = DalitzMuMus::iterator; diff --git a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx index 81a3d980faa..c328d150da4 100644 --- a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx +++ b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx @@ -281,7 +281,7 @@ struct PhotonConversionBuilder { track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaPi(), - track.itsClusterMap(), track.itsChi2NCl(), track.detectorMap(), + track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), track.x(), track.y(), track.z(), track.tgl(), track.signed1Pt()); } @@ -455,6 +455,10 @@ struct PhotonConversionBuilder { if (pca_kf > max_dcav0dau_its) { return; } + } else { + if (pca_kf > max_dcav0dau_tpconly) { + return; + } } } diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx index 809f8f3a263..2aaaa07e161 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx @@ -52,6 +52,19 @@ struct skimmerDalitzEE { // Configurables Configurable maxMee{"maxMee", 0.5, "max. mee to store ee pairs"}; Configurable storeLS{"storeLS", false, "flag to store LS pairs"}; + Configurable minpt{"minpt", 0.2, "min pt for track for loose track sample"}; + Configurable maxeta{"maxeta", 0.9, "eta acceptance for loose track sample"}; + Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -2.0, "min. TPC n sigma for electron inclusion"}; + Configurable maxTPCNsigmaEl{"maxTPCNsigmaEl", 3.0, "max. TPC n sigma for electron inclusion"}; + Configurable min_ncluster_tpc{"min_ncluster_tpc", 10, "min ncluster tpc"}; + Configurable mincrossedrows{"mincrossedrows", 100, "min. crossed rows"}; + Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; + Configurable minitsncls{"minitsncls", 5, "min. number of ITS clusters"}; + Configurable maxchi2tpc{"maxchi2tpc", 4.0, "max. chi2/NclsTPC"}; + Configurable maxchi2its{"maxchi2its", 5.0, "max. chi2/NclsITS"}; + Configurable dca_xy_max{"dca_xy_max", 1.0f, "max DCAxy in cm"}; + Configurable dca_z_max{"dca_z_max", 1.0f, "max DCAz in cm"}; + Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 1.f, "max DCA 3D in sigma"}; HistogramRegistry fRegistry{ "fRegistry", @@ -61,15 +74,62 @@ struct skimmerDalitzEE { {"hNpos", "hNpos;centrality FT0C;Number of positrons", {HistType::kTH2F, {{110, 0, 110}, {101, -0.5f, +100.5f}}}}, }, }; + std::pair> itsRequirement = {1, {0, 1, 2}}; // any hits on 3 ITS ib layers. void init(InitContext const&) {} + template + bool checkTrack(TTrack const& track) + { + if (!track.hasITS() || !track.hasTPC()) { + return false; + } + if (track.itsNCls() < minitsncls) { + return false; + } + + auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); + if (hits < itsRequirement.first) { + return false; + } + + if (track.tpcNClsFound() < min_ncluster_tpc) { + return false; + } + + if (track.tpcNClsCrossedRows() < mincrossedrows) { + return false; + } + + if (track.tpcCrossedRowsOverFindableCls() < min_tpc_cr_findable_ratio) { + return false; + } + + float dca_3d = 999.f; + float det = track.cYY() * track.cZZ() - track.cZY() * track.cZY(); + if (det < 0) { + dca_3d = 999.f; + } else { + float chi2 = (track.dcaXY() * track.dcaXY() * track.cZZ() + track.dcaZ() * track.dcaZ() * track.cYY() - 2. * track.dcaXY() * track.dcaZ() * track.cZY()) / det; + dca_3d = std::sqrt(std::abs(chi2) / 2.); + } + if (dca_3d > dca_3d_sigma_max) { + return false; + } + + return true; + } + template int fillPairTable(TCollision const& collision, TTracks1 const& tracks1, TTracks2 const& tracks2) { int npair = 0; if constexpr (pairtype == EM_EEPairType::kULS) { // ULS for (auto& [t1, t2] : combinations(CombinationsFullIndexPolicy(tracks1, tracks2))) { + if (!checkTrack(t1) || !checkTrack(t2)) { + continue; + } + ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; @@ -78,18 +138,16 @@ struct skimmerDalitzEE { } float phiv = getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), collision.bz()); float opangle = getOpeningAngle(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz()); - float dcaxy1 = t1.dcaXY() / sqrt(t1.cYY()); - float dcaxy2 = t2.dcaXY() / sqrt(t2.cYY()); - float dcaeexy = sqrt((pow(dcaxy1, 2) + pow(dcaxy2, 2)) / 2.); - float dcaz1 = t1.dcaZ() / sqrt(t1.cZZ()); - float dcaz2 = t2.dcaZ() / sqrt(t2.cZZ()); - float dcaeez = sqrt((pow(dcaz1, 2) + pow(dcaz2, 2)) / 2.); + + if (!std::isfinite(phiv)) { + LOGF(info, "t1.px() = %f, t1.py() = %f, t1.pz() = %f, t2.px() = %f, t2.py() = %f, t2.pz() = %f", t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz()); + } if constexpr (isCEFP) { - dalitzees(collision.globalIndex(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), phiv, opangle, dcaeexy, dcaeez, static_cast(pairtype)); + dalitzees(collision.globalIndex(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), v12.Rapidity(), phiv, opangle, static_cast(pairtype)); dalitz_ee_eventid(collision.globalIndex()); } else { // for analysis - dalitzees(collision.collisionId(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), phiv, opangle, dcaeexy, dcaeez, static_cast(pairtype)); + dalitzees(collision.collisionId(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), v12.Rapidity(), phiv, opangle, static_cast(pairtype)); dalitz_ee_eventid(collision.globalIndex()); } @@ -98,6 +156,9 @@ struct skimmerDalitzEE { } // end of pairing loop } else { // LS for (auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(tracks1, tracks2))) { + if (!checkTrack(t1) || !checkTrack(t2)) { + continue; + } ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; @@ -106,18 +167,12 @@ struct skimmerDalitzEE { } float phiv = getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), collision.bz()); float opangle = getOpeningAngle(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz()); - float dcaxy1 = t1.dcaXY() / sqrt(t1.cYY()); - float dcaxy2 = t2.dcaXY() / sqrt(t2.cYY()); - float dcaeexy = sqrt((pow(dcaxy1, 2) + pow(dcaxy2, 2)) / 2.); - float dcaz1 = t1.dcaZ() / sqrt(t1.cZZ()); - float dcaz2 = t2.dcaZ() / sqrt(t2.cZZ()); - float dcaeez = sqrt((pow(dcaz1, 2) + pow(dcaz2, 2)) / 2.); if constexpr (isCEFP) { - dalitzees(collision.globalIndex(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), phiv, opangle, dcaeexy, dcaeez, static_cast(pairtype)); + dalitzees(collision.globalIndex(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), v12.M(), phiv, opangle, static_cast(pairtype)); dalitz_ee_eventid(collision.globalIndex()); } else { // for analysis - dalitzees(collision.collisionId(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), phiv, opangle, dcaeexy, dcaeez, static_cast(pairtype)); + dalitzees(collision.collisionId(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), v12.Rapidity(), phiv, opangle, static_cast(pairtype)); dalitz_ee_eventid(collision.globalIndex()); } @@ -128,8 +183,8 @@ struct skimmerDalitzEE { return npair; } - Partition posTracks = o2::aod::emprimaryelectron::sign > 0; - Partition negTracks = o2::aod::emprimaryelectron::sign < 0; + Partition posTracks = o2::aod::emprimaryelectron::sign > 0 && o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl&& o2::aod::pidtpc::tpcNSigmaEl < maxTPCNsigmaEl; + Partition negTracks = o2::aod::emprimaryelectron::sign < 0 && o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl&& o2::aod::pidtpc::tpcNSigmaEl < maxTPCNsigmaEl; void processAnalysis(MyCollisions const& collisions, MyTracks const& tracks) { for (auto& collision : collisions) { @@ -150,8 +205,8 @@ struct skimmerDalitzEE { } PROCESS_SWITCH(skimmerDalitzEE, processAnalysis, "Process dalitz ee for analysis", true); - Partition posTracks_cefp = o2::aod::emprimaryelectron::sign > 0; - Partition negTracks_cefp = o2::aod::emprimaryelectron::sign < 0; + Partition posTracks_cefp = o2::aod::emprimaryelectron::sign > 0 && o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl&& o2::aod::pidtpc::tpcNSigmaEl < maxTPCNsigmaEl; + Partition negTracks_cefp = o2::aod::emprimaryelectron::sign < 0 && o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& minTPCNsigmaEl < o2::aod::pidtpc::tpcNSigmaEl&& o2::aod::pidtpc::tpcNSigmaEl < maxTPCNsigmaEl; void processCEFP(soa::Join const& collisions, aod::EMPrimaryElectrons const& tracks) { for (auto& collision : collisions) { diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerDalitzMuMu.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerDalitzMuMu.cxx index 5f725831bf7..860ff89713f 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerDalitzMuMu.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerDalitzMuMu.cxx @@ -48,6 +48,20 @@ struct skimmerDalitzMuMu { // Configurables Configurable maxMmumu{"maxMmumu", 1.1, "max. mmumu to store mumu pairs"}; Configurable storeLS{"storeLS", false, "flag to store LS pairs"}; + Configurable minpt{"minpt", 0.05, "min pt for track"}; + Configurable maxpt{"maxpt", 0.6, "max pt for track"}; + Configurable maxeta{"maxeta", 0.9, "eta acceptance"}; + Configurable min_ncluster_tpc{"min_ncluster_tpc", 10, "min ncluster tpc"}; + Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; + Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; + Configurable minitsncls{"minitsncls", 5, "min. number of ITS clusters"}; + Configurable maxchi2tpc{"maxchi2tpc", 4.0, "max. chi2/NclsTPC"}; + Configurable maxchi2its{"maxchi2its", 5.0, "max. chi2/NclsITS"}; + Configurable dca_xy_max{"dca_xy_max", 1.0f, "max DCAxy in cm"}; + Configurable dca_z_max{"dca_z_max", 1.0f, "max DCAz in cm"}; + Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 1.0f, "max DCA 3D in sigma"}; + Configurable minTPCNsigmaMu{"minTPCNsigmaMu", -3.0, "min. TPC n sigma for muon inclusion"}; + Configurable maxTPCNsigmaMu{"maxTPCNsigmaMu", 3.0, "max. TPC n sigma for muon inclusion"}; HistogramRegistry fRegistry{ "fRegistry", @@ -58,50 +72,90 @@ struct skimmerDalitzMuMu { void init(InitContext const&) {} + std::pair> itsRequirement = {1, {0, 1, 2}}; // any hits on 3 ITS ib layers. + + template + bool checkTrack(TTrack const& track) + { + if (!track.hasITS() || !track.hasTPC()) { + return false; + } + + if (track.itsNCls() < minitsncls) { + return false; + } + + auto hits = std::count_if(itsRequirement.second.begin(), itsRequirement.second.end(), [&](auto&& requiredLayer) { return track.itsClusterMap() & (1 << requiredLayer); }); + if (hits < itsRequirement.first) { + return false; + } + + if (track.tpcNClsFound() < min_ncluster_tpc) { + return false; + } + + if (track.tpcNClsCrossedRows() < mincrossedrows) { + return false; + } + + if (track.tpcCrossedRowsOverFindableCls() < min_tpc_cr_findable_ratio) { + return false; + } + + // float rel_diff = (track.tpcInnerParam() - track.p())/track.p(); + // if (rel_diff < -0.0156432+-0.00154524/pow(track.p(),2.29244) - 0.02 || -0.0156432+-0.00154524/pow(track.p(),2.29244) + 0.02 < rel_diff) { + // return false; + // } + + float dca_3d = 999.f; + float det = track.cYY() * track.cZZ() - track.cZY() * track.cZY(); + if (det < 0) { + dca_3d = 999.f; + } else { + float chi2 = (track.dcaXY() * track.dcaXY() * track.cZZ() + track.dcaZ() * track.dcaZ() * track.cYY() - 2. * track.dcaXY() * track.dcaZ() * track.cZY()) / det; + dca_3d = std::sqrt(std::abs(chi2) / 2.); + } + if (dca_3d > dca_3d_sigma_max) { + return false; + } + + return true; + } + template int fillPairTable(TCollision const& collision, TTracks1 const& tracks1, TTracks2 const& tracks2) { int npair = 0; + const float phiv = 0.f; + const float opangle = 0.f; if constexpr (pairtype == EM_MuMuPairType::kULS) { // ULS for (auto& [t1, t2] : combinations(CombinationsFullIndexPolicy(tracks1, tracks2))) { + if (!checkTrack(t1) || !checkTrack(t2)) { + continue; + } ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon); ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; if (v12.M() > maxMmumu) { // don't store continue; } - float phiv = 0.f; - float opangle = 0.f; - float dcaxy1 = t1.dcaXY() / sqrt(t1.cYY()); - float dcaxy2 = t2.dcaXY() / sqrt(t2.cYY()); - float dcamumuxy = sqrt((pow(dcaxy1, 2) + pow(dcaxy2, 2)) / 2.); - float dcaz1 = t1.dcaZ() / sqrt(t1.cZZ()); - float dcaz2 = t2.dcaZ() / sqrt(t2.cZZ()); - float dcamumuz = sqrt((pow(dcaz1, 2) + pow(dcaz2, 2)) / 2.); - - dalitzmumus(collision.collisionId(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), phiv, opangle, dcamumuxy, dcamumuz, static_cast(pairtype)); + dalitzmumus(collision.collisionId(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), v12.Rapidity(), phiv, opangle, static_cast(pairtype)); dalitz_mumu_eventid(collision.globalIndex()); fRegistry.fill(HIST("hNpairs"), static_cast(pairtype)); npair++; } // end of pairing loop } else { // LS for (auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(tracks1, tracks2))) { + if (!checkTrack(t1) || !checkTrack(t2)) { + continue; + } ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon); ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; if (v12.M() > maxMmumu) { // don't store continue; } - float phiv = 0.f; - float opangle = 0.f; - float dcaxy1 = t1.dcaXY() / sqrt(t1.cYY()); - float dcaxy2 = t2.dcaXY() / sqrt(t2.cYY()); - float dcamumuxy = sqrt((pow(dcaxy1, 2) + pow(dcaxy2, 2)) / 2.); - float dcaz1 = t1.dcaZ() / sqrt(t1.cZZ()); - float dcaz2 = t2.dcaZ() / sqrt(t2.cZZ()); - float dcamumuz = sqrt((pow(dcaz1, 2) + pow(dcaz2, 2)) / 2.); - - dalitzmumus(collision.collisionId(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), phiv, opangle, dcamumuxy, dcamumuz, static_cast(pairtype)); + dalitzmumus(collision.collisionId(), t1.globalIndex(), t2.globalIndex(), v12.Pt(), v12.Eta(), v12.Phi() > 0 ? v12.Phi() : v12.Phi() + TMath::TwoPi(), v12.M(), v12.Rapidity(), phiv, opangle, static_cast(pairtype)); dalitz_mumu_eventid(collision.globalIndex()); fRegistry.fill(HIST("hNpairs"), static_cast(pairtype)); npair++; @@ -110,9 +164,8 @@ struct skimmerDalitzMuMu { return npair; } - Partition posTracks = o2::aod::emprimarymuon::sign > 0; - Partition negTracks = o2::aod::emprimarymuon::sign < 0; - + Partition posTracks = minpt < o2::aod::track::pt && o2::aod::track::pt < maxpt && nabs(o2::aod::track::eta) < maxeta && o2::aod::emprimarymuon::sign > 0 && minTPCNsigmaMu < o2::aod::pidtpc::tpcNSigmaMu&& o2::aod::pidtpc::tpcNSigmaMu < maxTPCNsigmaMu; + Partition negTracks = minpt < o2::aod::track::pt && o2::aod::track::pt < maxpt && nabs(o2::aod::track::eta) < maxeta && o2::aod::emprimarymuon::sign < 0 && minTPCNsigmaMu < o2::aod::pidtpc::tpcNSigmaMu && o2::aod::pidtpc::tpcNSigmaMu < maxTPCNsigmaMu; void process(MyCollisions const& collisions, MyTracks const& tracks) { for (auto& collision : collisions) { diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx index 1ad9a8be8bb..bce0662dc69 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx @@ -189,7 +189,7 @@ struct skimmerGammaConversion { theTrack.tpcNClsFindable(), theTrack.tpcNClsFindableMinusFound(), theTrack.tpcNClsFindableMinusCrossedRows(), theTrack.tpcChi2NCl(), theTrack.tpcInnerParam(), theTrack.tpcSignal(), theTrack.tpcNSigmaEl(), theTrack.tpcNSigmaPi(), - theTrack.itsClusterMap(), theTrack.itsChi2NCl(), theTrack.detectorMap(), + theTrack.itsClusterSizes(), theTrack.itsChi2NCl(), theTrack.detectorMap(), theTrack.x(), theTrack.y(), theTrack.z(), theTrack.tgl(), theTrack.signed1Pt()); } diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectron.cxx index 680cc4768bc..b9ab1ccc06c 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectron.cxx @@ -61,6 +61,7 @@ struct skimmerPrimaryElectron { // Operation and minimisation criteria Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; + Configurable min_ncluster_tpc{"min_ncluster_tpc", 10, "min ncluster tpc"}; Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; Configurable minitsncls{"minitsncls", 4, "min. number of ITS clusters"}; @@ -70,8 +71,8 @@ struct skimmerPrimaryElectron { Configurable maxeta{"maxeta", 0.9, "eta acceptance"}; Configurable dca_xy_max{"dca_xy_max", 1.0f, "max DCAxy in cm"}; Configurable dca_z_max{"dca_z_max", 1.0f, "max DCAz in cm"}; - Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 1.5f, "max DCA 3D in sigma"}; - Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -4.0, "min. TPC n sigma for electron inclusion"}; + Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 100.f, "max DCA 3D in sigma"}; + Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -3.0, "min. TPC n sigma for electron inclusion"}; Configurable maxTPCNsigmaEl{"maxTPCNsigmaEl", 4.0, "max. TPC n sigma for electron inclusion"}; Configurable maxTOFNsigmaEl{"maxTOFNsigmaEl", 4.0, "max. TOF n sigma for electron inclusion"}; Configurable minTPCNsigmaPi{"minTPCNsigmaPi", -2.0, "min. TPC n sigma for pion exclusion"}; // set to -2 for lowB, -999 for nominalB @@ -185,6 +186,10 @@ struct skimmerPrimaryElectron { return false; } + if (track.tpcNClsFound() < min_ncluster_tpc) { + return false; + } + if (track.tpcNClsCrossedRows() < mincrossedrows) { return false; } @@ -278,7 +283,7 @@ struct skimmerPrimaryElectron { track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterMap(), track.itsChi2NCl(), track.detectorMap(), track.signed1Pt(), track.cYY(), track.cZZ(), track.cZY()); + track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), track.signed1Pt(), track.cYY(), track.cZZ(), track.cZY()); fRegistry.fill(HIST("Track/hTPCdEdx_Pin_after"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/hTOFbeta_Pin_after"), track.tpcInnerParam(), track.beta()); fRegistry.fill(HIST("Track/hTPCNsigmaEl_after"), track.tpcInnerParam(), track.tpcNSigmaEl()); diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryMuon.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryMuon.cxx index 06f55d6d422..750ca3a2a9c 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryMuon.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryMuon.cxx @@ -44,6 +44,7 @@ struct skimmerPrimaryMuon { Produces muon_pfb; // Configurables + Configurable min_ncluster_tpc{"min_ncluster_tpc", 10, "min ncluster tpc"}; Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; Configurable minitsncls{"minitsncls", 4, "min. number of ITS clusters"}; @@ -54,7 +55,7 @@ struct skimmerPrimaryMuon { Configurable maxeta{"maxeta", 0.9, "eta acceptance"}; Configurable dca_xy_max{"dca_xy_max", 1.0f, "max DCAxy in cm"}; Configurable dca_z_max{"dca_z_max", 1.0f, "max DCAz in cm"}; - Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 1.0f, "max DCA 3D in sigma"}; + Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 2.0f, "max DCA 3D in sigma"}; Configurable minTPCNsigmaMu{"minTPCNsigmaMu", -4.0, "min. TPC n sigma for muon inclusion"}; Configurable maxTPCNsigmaMu{"maxTPCNsigmaMu", 4.0, "max. TPC n sigma for muon inclusion"}; Configurable maxPin{"maxPin", 1.0, "max pin for PID"}; @@ -92,6 +93,8 @@ struct skimmerPrimaryMuon { // for MC primary muon {"MC/Primary/hPt_Gen", "generated pT;p_{T,#mu}^{gen} (GeV/c)", {HistType::kTH1F, {{100, 0.f, 1.f}}}}, {"MC/Primary/hPt_Rec", "reconstructed pT;p_{T,#mu}^{rec} (GeV/c)", {HistType::kTH1F, {{100, 0.f, 1.f}}}}, + {"MC/Primary/hP_Correlation", "p vs. pin correlation;p_{pv} (GeV/c);(p_{in} - p_{pv})/p_{pv}", {HistType::kTH2F, {{100, 0.f, 1.f}, {200, -1, +1}}}}, + {"MC/Primary/hP_Correlation_Profile", "p vs. pin correlation;p_{pv} (GeV/c);(p_{in} - p_{pv})/p_{pv}", {HistType::kTProfile, {{100, 0.f, 1.f}}}}, {"MC/Primary/hTPCdEdx_Pin", "TPC dE/dx vs. p_{in};p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 1.f}, {200, 0.f, 200.f}}}}, {"MC/Primary/hTOFbeta_Pin", "TOF beta vs. p_{in};p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 1.f}, {250, 0.6f, 1.1f}}}}, {"MC/Primary/hNclsITS", "Ncls ITS;N_{cls}^{ITS}", {HistType::kTH1F, {{8, -0.5f, +7.5f}}}}, @@ -112,6 +115,8 @@ struct skimmerPrimaryMuon { // for MC seconday muon {"MC/Secondary/hPt_Gen", "generated pT;p_{T,#mu}^{gen} (GeV/c)", {HistType::kTH1F, {{100, 0.f, 1.f}}}}, {"MC/Secondary/hPt_Rec", "reconstructed pT;p_{T,#mu}^{rec} (GeV/c)", {HistType::kTH1F, {{100, 0.f, 1.f}}}}, + {"MC/Secondary/hP_Correlation", "p vs. pin correlation;p_{pv} (GeV/c);(p_{in} - p_{pv})/p_{pv}", {HistType::kTH2F, {{100, 0.f, 1.f}, {200, -1, +1}}}}, + {"MC/Secondary/hP_Correlation_Profile", "p vs. pin correlation;p_{pv} (GeV/c);(p_{in} - p_{pv})/p_{pv}", {HistType::kTProfile, {{100, 0.f, 1.f}}}}, {"MC/Secondary/hTPCdEdx_Pin", "TPC dE/dx vs. p_{in};p_{in} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{1000, 0.f, 1.f}, {200, 0.f, 200.f}}}}, {"MC/Secondary/hTOFbeta_Pin", "TOF beta vs. p_{in};p_{in} (GeV/c);TOF #beta", {HistType::kTH2F, {{1000, 0.f, 1.f}, {250, 0.6f, 1.1f}}}}, {"MC/Secondary/hNclsITS", "Ncls ITS;N_{cls}^{ITS}", {HistType::kTH1F, {{8, -0.5f, +7.5f}}}}, @@ -158,6 +163,10 @@ struct skimmerPrimaryMuon { return false; } + if (track.tpcNClsFound() < min_ncluster_tpc) { + return false; + } + if (track.tpcNClsCrossedRows() < mincrossedrows) { return false; } @@ -166,6 +175,11 @@ struct skimmerPrimaryMuon { return false; } + // float rel_diff = (track.tpcInnerParam() - track.p())/track.p(); + // if (rel_diff < -0.0156432+-0.00154524/pow(track.p(),2.29244) - 0.02 || -0.0156432+-0.00154524/pow(track.p(),2.29244) + 0.02 < rel_diff) { + // return false; + // } + float dca_3d = 999.f; float det = track.cYY() * track.cZZ() - track.cZY() * track.cZY(); if (det < 0) { @@ -220,6 +234,15 @@ struct skimmerPrimaryMuon { fRegistry.fill(HIST("Track/hTPCNsigmaEl_before"), track.tpcInnerParam(), track.tpcNSigmaEl()); fRegistry.fill(HIST("Track/hTOFNsigmaEl_before"), track.tpcInnerParam(), track.tofNSigmaEl()); + float dca_3d = 999.f; + float det = track.cYY() * track.cZZ() - track.cZY() * track.cZY(); + if (det < 0) { + dca_3d = 999.f; + } else { + float chi2 = (track.dcaXY() * track.dcaXY() * track.cZZ() + track.dcaZ() * track.dcaZ() * track.cYY() - 2. * track.dcaXY() * track.dcaZ() * track.cZY()) / det; + dca_3d = std::sqrt(std::abs(chi2) / 2.); + } + if constexpr (isMC) { auto mctrack = track.template mcParticle_as(); if (abs(mctrack.pdgCode()) == 13 /* && mctrack.has_mothers()*/) { @@ -228,6 +251,8 @@ struct skimmerPrimaryMuon { if (isMuon(track)) { fRegistry.fill(HIST("MC/Primary/hPt_Rec"), track.pt()); } + fRegistry.fill(HIST("MC/Primary/hP_Correlation"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); + fRegistry.fill(HIST("MC/Primary/hP_Correlation_Profile"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); fRegistry.fill(HIST("MC/Primary/hTPCdEdx_Pin"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("MC/Primary/hTOFbeta_Pin"), track.tpcInnerParam(), track.beta()); fRegistry.fill(HIST("MC/Primary/hNclsITS"), track.itsNCls()); @@ -243,12 +268,14 @@ struct skimmerPrimaryMuon { fRegistry.fill(HIST("MC/Primary/hDCAxy_resolution"), sqrt(track.cYY())); fRegistry.fill(HIST("MC/Primary/hDCAz_resolution"), sqrt(track.cZZ())); fRegistry.fill(HIST("MC/Primary/hDCAxyz_sigma"), track.dcaXY() / sqrt(track.cYY()), track.dcaZ() / sqrt(track.cZZ())); - fRegistry.fill(HIST("MC/Primary/hDCA3D_sigma"), sqrt(pow(track.dcaXY() / sqrt(track.cYY()), 2) + pow(track.dcaZ() / sqrt(track.cZZ()), 2))); + fRegistry.fill(HIST("MC/Primary/hDCA3D_sigma"), dca_3d); fRegistry.fill(HIST("MC/Primary/hProdVtx"), mctrack.vx(), mctrack.vy()); } else { if (isMuon(track)) { fRegistry.fill(HIST("MC/Secondary/hPt_Rec"), track.pt()); } + fRegistry.fill(HIST("MC/Secondary/hP_Correlation"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); + fRegistry.fill(HIST("MC/Secondary/hP_Correlation_Profile"), track.p(), (track.tpcInnerParam() - track.p()) / track.p()); fRegistry.fill(HIST("MC/Secondary/hTPCdEdx_Pin"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("MC/Secondary/hTOFbeta_Pin"), track.tpcInnerParam(), track.beta()); fRegistry.fill(HIST("MC/Secondary/hNclsITS"), track.itsNCls()); @@ -264,7 +291,7 @@ struct skimmerPrimaryMuon { fRegistry.fill(HIST("MC/Secondary/hDCAxy_resolution"), sqrt(track.cYY())); fRegistry.fill(HIST("MC/Secondary/hDCAz_resolution"), sqrt(track.cZZ())); fRegistry.fill(HIST("MC/Secondary/hDCAxyz_sigma"), track.dcaXY() / sqrt(track.cYY()), track.dcaZ() / sqrt(track.cZZ())); - fRegistry.fill(HIST("MC/Secondary/hDCA3D_sigma"), sqrt(pow(track.dcaXY() / sqrt(track.cYY()), 2) + pow(track.dcaZ() / sqrt(track.cZZ()), 2))); + fRegistry.fill(HIST("MC/Secondary/hDCA3D_sigma"), dca_3d); fRegistry.fill(HIST("MC/Secondary/hProdVtx"), mctrack.vx(), mctrack.vy()); } } @@ -283,7 +310,7 @@ struct skimmerPrimaryMuon { track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterMap(), track.itsChi2NCl(), track.detectorMap(), track.signed1Pt(), track.cYY(), track.cZZ(), track.cZY()); + track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), track.signed1Pt(), track.cYY(), track.cZZ(), track.cZY()); fRegistry.fill(HIST("Track/hTPCdEdx_Pin_after"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/hTOFbeta_Pin_after"), track.tpcInnerParam(), track.beta()); fRegistry.fill(HIST("Track/hTPCNsigmaMu_after"), track.tpcInnerParam(), track.tpcNSigmaMu()); diff --git a/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx b/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx index 8fe9c101211..01e49b0b362 100644 --- a/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx +++ b/PWGEM/PhotonMeson/Tasks/MaterialBudget.cxx @@ -109,7 +109,7 @@ struct MaterialBudget { } // end of cut1 loop } - static constexpr std::string_view pairnames[8] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC"}; + static constexpr std::string_view pairnames[9] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC", "DalitzEEDalitzEE"}; void addhistograms() { fMainList->SetOwner(true); diff --git a/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx b/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx index 3e54e537358..cf8424bf93f 100644 --- a/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/MaterialBudgetMC.cxx @@ -121,7 +121,7 @@ struct MaterialBudgetMC { } // end of tagcut loop } - static constexpr std::string_view pairnames[8] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC"}; + static constexpr std::string_view pairnames[9] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC", "DalitzEEDalitzEE"}; void addhistograms() { fMainList->SetOwner(true); diff --git a/PWGEM/PhotonMeson/Tasks/PhotonHBT.cxx b/PWGEM/PhotonMeson/Tasks/PhotonHBT.cxx index e2124a09911..0b9d9454415 100644 --- a/PWGEM/PhotonMeson/Tasks/PhotonHBT.cxx +++ b/PWGEM/PhotonMeson/Tasks/PhotonHBT.cxx @@ -51,7 +51,7 @@ using namespace o2::framework::expressions; using namespace o2::soa; using namespace o2::aod::photonpair; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; using MyV0Photons = soa::Join; @@ -69,6 +69,8 @@ struct PhotonHBT { Configurable fConfigDalitzEECuts{"cfgDalitzEECuts", "mee_all_tpchadrejortofreq_prompt", "Comma separated list of DalitzEE cuts"}; Configurable fConfigPHOSCuts{"cfgPHOSCuts", "test02,test03", "Comma separated list of PHOS photon cuts"}; Configurable fConfigPairCuts{"cfgPairCuts", "nocut", "Comma separated list of pair cuts"}; + Configurable fConfigDo3D{"cfgDo3D", false, "Flag to analyze 3D BE correlation"}; // it is very heavy. + Configurable maxY_dielectron{"maxY_dielectron", 0.9, "maximum rapidity for dielectron"}; OutputObj fOutputEvent{"Event"}; OutputObj fOutputPair{"Pair"}; // 2-photon pair @@ -88,6 +90,9 @@ struct PhotonHBT { if (context.mOptions.get("processPCMDalitzEE")) { fPairNames.push_back("PCMDalitzEE"); } + if (context.mOptions.get("processDalitzEEDalitzEE")) { + fPairNames.push_back("DalitzEEDalitzEE"); + } if (context.mOptions.get("processPHOSPHOS")) { fPairNames.push_back("PHOSPHOS"); } @@ -113,8 +118,9 @@ struct PhotonHBT { std::string cutname1 = cut1.GetName(); std::string cutname2 = cut2.GetName(); - if ((pairname == "PCMPCM" || pairname == "PHOSPHOS" || pairname == "EMCEMC") && (cutname1 != cutname2)) + if ((pairname == "PCMPCM" || pairname == "PHOSPHOS" || pairname == "EMCEMC" || pairname == "DalitzEEDalitzEE") && (cutname1 != cutname2)) { continue; + } THashList* list_pair_subsys = reinterpret_cast(list_pair->FindObject(pairname.data())); std::string photon_cut_name = cutname1 + "_" + cutname2; @@ -125,13 +131,17 @@ struct PhotonHBT { std::string pair_cut_name = cut3.GetName(); o2::aod::emphotonhistograms::AddHistClass(list_pair_subsys_photoncut, pair_cut_name.data()); THashList* list_pair_subsys_paircut = reinterpret_cast(list_pair_subsys_photoncut->FindObject(pair_cut_name.data())); - o2::aod::emphotonhistograms::DefineHistograms(list_pair_subsys_paircut, "photon_hbt"); + if (fConfigDo3D) { + o2::aod::emphotonhistograms::DefineHistograms(list_pair_subsys_paircut, "photon_hbt", "3d"); + } else { + o2::aod::emphotonhistograms::DefineHistograms(list_pair_subsys_paircut, "photon_hbt", "1d"); + } } // end of pair cut3 loop } // end of cut2 loop } // end of cut1 loop } - static constexpr std::string_view pairnames[8] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC"}; + static constexpr std::string_view pairnames[9] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC", "DalitzEEDalitzEE"}; void addhistograms() { fMainList->SetOwner(true); @@ -159,6 +169,9 @@ struct PhotonHBT { if (pairname == "PCMDalitzEE") { add_pair_histograms(list_pair, pairname, fPCMCuts, fDalitzEECuts, fPairCuts); } + if (pairname == "DalitzEEDalitzEE") { + add_pair_histograms(list_pair, pairname, fDalitzEECuts, fDalitzEECuts, fPairCuts); + } if (pairname == "PHOSPHOS") { add_pair_histograms(list_pair, pairname, fPHOSCuts, fPHOSCuts, fPairCuts); } @@ -233,6 +246,8 @@ struct PhotonHBT { is_selected_pair = o2::aod::photonpair::IsSelectedPair(g1, g2, cut1, cut2); } else if constexpr (pairtype == PairType::kPCMDalitzEE) { is_selected_pair = o2::aod::photonpair::IsSelectedPair(g1, g2, cut1, cut2); + } else if constexpr (pairtype == PairType::kDalitzEEDalitzEE) { + is_selected_pair = o2::aod::photonpair::IsSelectedPair(g1, g2, cut1, cut2); } else if constexpr (pairtype == PairType::kPHOSPHOS) { is_selected_pair = o2::aod::photonpair::IsSelectedPair(g1, g2, cut1, cut2); // dummy, because track matching is not ready. } else if constexpr (pairtype == PairType::kPCMPHOS) { @@ -276,9 +291,11 @@ struct PhotonHBT { auto photons1_coll = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_coll = photons2.sliceBy(perCollision2, collision.globalIndex()); + // LOGF(info, "photons1_coll.size() = %d, photons2_coll.size() = %d", photons1_coll.size(), photons2_coll.size()); - double values[9] = {0.f}; - if constexpr (pairtype == PairType::kPCMPCM || pairtype == PairType::kPHOSPHOS || pairtype == PairType::kEMCEMC) { + double values_1d[4] = {0.f}; + double values_3d[8] = {0.f}; + if constexpr (pairtype == PairType::kPCMPCM || pairtype == PairType::kPHOSPHOS || pairtype == PairType::kEMCEMC || pairtype == PairType::kDalitzEEDalitzEE) { for (auto& cut : cuts1) { for (auto& paircut : paircuts) { for (auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons1_coll, photons2_coll))) { @@ -286,53 +303,72 @@ struct PhotonHBT { continue; } - values[0] = 0.0; - values[1] = 0.0; + values_1d[0] = 0.0, values_1d[1] = 0.0; + values_3d[0] = 0.0, values_3d[1] = 0.0; // center-of-mass system (CMS) ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); - if constexpr (pairtype == PairType::kPCMDalitzEE) { + if constexpr (pairtype == PairType::kDalitzEEDalitzEE) { + auto pos1 = g1.template posTrack_as(); + auto ele1 = g1.template negTrack_as(); + auto pos2 = g2.template posTrack_as(); + auto ele2 = g2.template negTrack_as(); + if (pos1.trackId() == pos2.trackId() || ele1.trackId() == ele2.trackId()) { + continue; + } + v1.SetM(g1.mass()); v2.SetM(g2.mass()); - values[1] = g2.mass(); + values_1d[0] = g1.mass(); + values_1d[1] = g2.mass(); + values_3d[0] = g1.mass(); + values_3d[1] = g2.mass(); } + ROOT::Math::PtEtaPhiMVector q12 = v1 - v2; ROOT::Math::PtEtaPhiMVector k12 = 0.5 * (v1 + v2); float qinv = -q12.M(); float kt = k12.Pt(); - // float qt = q12.Pt(); - float qlong_cms = q12.Pz(); - - ROOT::Math::XYZVector q_3d = q12.Vect(); // 3D q vector - ROOT::Math::XYZVector uv_out(k12.Px() / k12.Pt(), k12.Py() / k12.Pt(), 0); // unit vector for out. i.e. parallel to kt - ROOT::Math::XYZVector uv_long(0, 0, 1); // unit vector for long, beam axis - ROOT::Math::XYZVector uv_side = uv_out.Cross(uv_long); // unit vector for side - float qout_cms = q_3d.Dot(uv_out); - float qside_cms = q_3d.Dot(uv_side); - - // longitudinally co-moving system (LCMS) - ROOT::Math::PxPyPzEVector v1_cartesian(v1.Px(), v1.Py(), v1.Pz(), v1.E()); - ROOT::Math::PxPyPzEVector v2_cartesian(v2.Px(), v2.Py(), v2.Pz(), v2.E()); - ROOT::Math::PxPyPzEVector q12_cartesian = v1_cartesian - v2_cartesian; - float beta_z = (v1 + v2).Pz() / (v1 + v2).E(); - ROOT::Math::Boost bst_z(0, 0, -beta_z); // Boost supports only PxPyPzEVector - ROOT::Math::PxPyPzEVector q12_lcms = bst_z(q12_cartesian); - float qlong_lcms = q12_lcms.Pz(); - - // ROOT::Math::PxPyPzEVector v1_lcms_cartesian = bst_z(v1_cartesian); - // ROOT::Math::PxPyPzEVector v2_lcms_cartesian = bst_z(v2_cartesian); - // ROOT::Math::PxPyPzEVector q12_lcms_cartesian = bst_z(q12_cartesian); - // LOGF(info, "q12.Pz() = %f, q12_cartesian.Pz() = %f",q12.Pz(), q12_cartesian.Pz()); - // LOGF(info, "v1.Pz() = %f, v2.Pz() = %f",v1.Pz(), v2.Pz()); - // LOGF(info, "v1_lcms_cartesian.Pz() = %f, v2_lcms_cartesian.Pz() = %f",v1_lcms_cartesian.Pz(), v2_lcms_cartesian.Pz()); - // LOGF(info, "q12_lcms_cartesian.Pz() = %f", q12_lcms_cartesian.Pz()); - - values[2] = kt; - values[3] = qinv; - values[4] = qlong_cms; - values[5] = qout_cms; - values[6] = qside_cms; - values[7] = qlong_lcms; - reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut.GetName(), cut.GetName()))->FindObject(paircut.GetName())->FindObject("hs_q_same"))->Fill(values); + + values_1d[2] = kt; + values_1d[3] = qinv; + + if (fConfigDo3D) { + // float qt = q12.Pt(); + float qlong_cms = q12.Pz(); + + ROOT::Math::XYZVector q_3d = q12.Vect(); // 3D q vector + ROOT::Math::XYZVector uv_out(k12.Px() / k12.Pt(), k12.Py() / k12.Pt(), 0); // unit vector for out. i.e. parallel to kt + ROOT::Math::XYZVector uv_long(0, 0, 1); // unit vector for long, beam axis + ROOT::Math::XYZVector uv_side = uv_out.Cross(uv_long); // unit vector for side + float qout_cms = q_3d.Dot(uv_out); + float qside_cms = q_3d.Dot(uv_side); + + // longitudinally co-moving system (LCMS) + ROOT::Math::PxPyPzEVector v1_cartesian(v1.Px(), v1.Py(), v1.Pz(), v1.E()); + ROOT::Math::PxPyPzEVector v2_cartesian(v2.Px(), v2.Py(), v2.Pz(), v2.E()); + ROOT::Math::PxPyPzEVector q12_cartesian = v1_cartesian - v2_cartesian; + float beta_z = (v1 + v2).Pz() / (v1 + v2).E(); + ROOT::Math::Boost bst_z(0, 0, -beta_z); // Boost supports only PxPyPzEVector + ROOT::Math::PxPyPzEVector q12_lcms = bst_z(q12_cartesian); + float qlong_lcms = q12_lcms.Pz(); + + // ROOT::Math::PxPyPzEVector v1_lcms_cartesian = bst_z(v1_cartesian); + // ROOT::Math::PxPyPzEVector v2_lcms_cartesian = bst_z(v2_cartesian); + // ROOT::Math::PxPyPzEVector q12_lcms_cartesian = bst_z(q12_cartesian); + // LOGF(info, "q12.Pz() = %f, q12_cartesian.Pz() = %f",q12.Pz(), q12_cartesian.Pz()); + // LOGF(info, "v1.Pz() = %f, v2.Pz() = %f",v1.Pz(), v2.Pz()); + // LOGF(info, "v1_lcms_cartesian.Pz() = %f, v2_lcms_cartesian.Pz() = %f",v1_lcms_cartesian.Pz(), v2_lcms_cartesian.Pz()); + // LOGF(info, "q12_lcms_cartesian.Pz() = %f", q12_lcms_cartesian.Pz()); + values_3d[2] = kt; + values_3d[3] = qinv; + values_3d[4] = qlong_cms; + values_3d[5] = qout_cms; + values_3d[6] = qside_cms; + values_3d[7] = qlong_lcms; + reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut.GetName(), cut.GetName()))->FindObject(paircut.GetName())->FindObject("hs_q_same"))->Fill(values_3d); + } else { + reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut.GetName(), cut.GetName()))->FindObject(paircut.GetName())->FindObject("hs_q_same"))->Fill(values_1d); + } } // end of combination } // end of pair cut loop } // end of cut loop @@ -355,45 +391,53 @@ struct PhotonHBT { } } - values[0] = 0.0; - values[1] = 0.0; + values_1d[0] = 0.0, values_1d[1] = 0.0; + values_3d[0] = 0.0, values_3d[1] = 0.0; // center-of-mass system (CMS) ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); if constexpr (pairtype == PairType::kPCMDalitzEE) { v2.SetM(g2.mass()); - values[1] = g2.mass(); + values_1d[1] = g2.mass(); + values_3d[1] = g2.mass(); } ROOT::Math::PtEtaPhiMVector q12 = v1 - v2; ROOT::Math::PtEtaPhiMVector k12 = 0.5 * (v1 + v2); float qinv = -q12.M(); float kt = k12.Pt(); - // float qt = q12.Pt(); - float qlong_cms = q12.Pz(); - - ROOT::Math::XYZVector q_3d = q12.Vect(); // 3D q vector - ROOT::Math::XYZVector uv_out(k12.Px() / k12.Pt(), k12.Py() / k12.Pt(), 0); // unit vector for out. i.e. parallel to kt - ROOT::Math::XYZVector uv_long(0, 0, 1); // unit vector for long, beam axis - ROOT::Math::XYZVector uv_side = uv_out.Cross(uv_long); // unit vector for side - float qout_cms = q_3d.Dot(uv_out); - float qside_cms = q_3d.Dot(uv_side); - // longitudinally co-moving system (LCMS) - ROOT::Math::PxPyPzEVector v1_cartesian(v1.Px(), v1.Py(), v1.Pz(), v1.E()); - ROOT::Math::PxPyPzEVector v2_cartesian(v2.Px(), v2.Py(), v2.Pz(), v2.E()); - ROOT::Math::PxPyPzEVector q12_cartesian = v1_cartesian - v2_cartesian; - float beta_z = (v1 + v2).Pz() / (v1 + v2).E(); - ROOT::Math::Boost bst_z(0, 0, -beta_z); // Boost supports only PxPyPzEVector - ROOT::Math::PxPyPzEVector q12_lcms = bst_z(q12_cartesian); - float qlong_lcms = q12_lcms.Pz(); - - values[2] = kt; - values[3] = qinv; - values[4] = qlong_cms; - values[5] = qout_cms; - values[6] = qside_cms; - values[7] = qlong_lcms; - reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut1.GetName(), cut2.GetName()))->FindObject(paircut.GetName())->FindObject("hs_q_same"))->Fill(values); + values_1d[2] = kt; + values_1d[3] = qinv; + + if (fConfigDo3D) { + // float qt = q12.Pt(); + float qlong_cms = q12.Pz(); + + ROOT::Math::XYZVector q_3d = q12.Vect(); // 3D q vector + ROOT::Math::XYZVector uv_out(k12.Px() / k12.Pt(), k12.Py() / k12.Pt(), 0); // unit vector for out. i.e. parallel to kt + ROOT::Math::XYZVector uv_long(0, 0, 1); // unit vector for long, beam axis + ROOT::Math::XYZVector uv_side = uv_out.Cross(uv_long); // unit vector for side + float qout_cms = q_3d.Dot(uv_out); + float qside_cms = q_3d.Dot(uv_side); + + // longitudinally co-moving system (LCMS) + ROOT::Math::PxPyPzEVector v1_cartesian(v1.Px(), v1.Py(), v1.Pz(), v1.E()); + ROOT::Math::PxPyPzEVector v2_cartesian(v2.Px(), v2.Py(), v2.Pz(), v2.E()); + ROOT::Math::PxPyPzEVector q12_cartesian = v1_cartesian - v2_cartesian; + float beta_z = (v1 + v2).Pz() / (v1 + v2).E(); + ROOT::Math::Boost bst_z(0, 0, -beta_z); // Boost supports only PxPyPzEVector + ROOT::Math::PxPyPzEVector q12_lcms = bst_z(q12_cartesian); + float qlong_lcms = q12_lcms.Pz(); + values_3d[2] = kt; + values_3d[3] = qinv; + values_3d[4] = qlong_cms; + values_3d[5] = qout_cms; + values_3d[6] = qside_cms; + values_3d[7] = qlong_lcms; + reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut1.GetName(), cut2.GetName()))->FindObject(paircut.GetName())->FindObject("hs_q_same"))->Fill(values_3d); + } else { + reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut1.GetName(), cut2.GetName()))->FindObject(paircut.GetName())->FindObject("hs_q_same"))->Fill(values_1d); + } } // end of combination } // end of pair cut loop } // end of cut2 loop @@ -422,14 +466,15 @@ struct PhotonHBT { // LOGF(info, "collision1: posZ = %f, numContrib = %d , sel8 = %d | collision2: posZ = %f, numContrib = %d , sel8 = %d", // collision1.posZ(), collision1.numContrib(), collision1.sel8(), collision2.posZ(), collision2.numContrib(), collision2.sel8()); - double values[9] = {0.f}; + double values_1d[4] = {0.f}; + double values_3d[8] = {0.f}; for (auto& cut1 : cuts1) { for (auto& cut2 : cuts2) { for (auto& paircut : paircuts) { for (auto& [g1, g2] : combinations(soa::CombinationsFullIndexPolicy(photons_coll1, photons_coll2))) { // LOGF(info, "Mixed event photon pair: (%d, %d) from events (%d, %d), photon event: (%d, %d)", g1.index(), g2.index(), collision1.index(), collision2.index(), g1.globalIndex(), g2.globalIndex()); - if ((pairtype == PairType::kPCMPCM || pairtype == PairType::kPHOSPHOS || pairtype == PairType::kEMCEMC) && (TString(cut1.GetName()) != TString(cut2.GetName()))) { + if ((pairtype == PairType::kPCMPCM || pairtype == PairType::kPHOSPHOS || pairtype == PairType::kEMCEMC || pairtype == PairType::kDalitzEEDalitzEE) && (TString(cut1.GetName()) != TString(cut2.GetName()))) { continue; } if (!IsSelectedPair(g1, g2, cut1, cut2)) { @@ -440,44 +485,60 @@ struct PhotonHBT { } // center-of-mass system (CMS) - values[0] = 0.0; - values[1] = 0.0; + values_1d[0] = 0.0, values_1d[1] = 0.0; + values_3d[0] = 0.0, values_3d[1] = 0.0; ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); if constexpr (pairtype == PairType::kPCMDalitzEE) { v2.SetM(g2.mass()); - values[1] = g2.mass(); + values_1d[1] = g2.mass(); + values_3d[1] = g2.mass(); + } else if constexpr (pairtype == PairType::kDalitzEEDalitzEE) { + v1.SetM(g1.mass()); + v2.SetM(g2.mass()); + values_1d[0] = g1.mass(); + values_1d[1] = g2.mass(); + values_3d[0] = g1.mass(); + values_3d[1] = g2.mass(); } ROOT::Math::PtEtaPhiMVector q12 = v1 - v2; ROOT::Math::PtEtaPhiMVector k12 = 0.5 * (v1 + v2); float qinv = -q12.M(); float kt = k12.Pt(); - // float qt = q12.Pt(); - float qlong_cms = q12.Pz(); - - ROOT::Math::XYZVector q_3d = q12.Vect(); // 3D q vector - ROOT::Math::XYZVector uv_out(k12.Px() / k12.Pt(), k12.Py() / k12.Pt(), 0); // unit vector for out. i.e. parallel to kt - ROOT::Math::XYZVector uv_long(0, 0, 1); // unit vector for long, beam axis - ROOT::Math::XYZVector uv_side = uv_out.Cross(uv_long); // unit vector for side - float qout_cms = q_3d.Dot(uv_out); - float qside_cms = q_3d.Dot(uv_side); - - // longitudinally co-moving system (LCMS) - ROOT::Math::PxPyPzEVector v1_cartesian(v1.Px(), v1.Py(), v1.Pz(), v1.E()); - ROOT::Math::PxPyPzEVector v2_cartesian(v2.Px(), v2.Py(), v2.Pz(), v2.E()); - ROOT::Math::PxPyPzEVector q12_cartesian = v1_cartesian - v2_cartesian; - float beta_z = (v1 + v2).Pz() / (v1 + v2).E(); - ROOT::Math::Boost bst_z(0, 0, -beta_z); // Boost supports only PxPyPzEVector - ROOT::Math::PxPyPzEVector q12_lcms = bst_z(q12_cartesian); - float qlong_lcms = q12_lcms.Pz(); - - values[2] = kt; - values[3] = qinv; - values[4] = qlong_cms; - values[5] = qout_cms; - values[6] = qside_cms; - values[7] = qlong_lcms; - reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut1.GetName(), cut2.GetName()))->FindObject(paircut.GetName())->FindObject("hs_q_mix"))->Fill(values); + values_1d[2] = kt; + values_1d[3] = qinv; + + if (fConfigDo3D) { + // float qt = q12.Pt(); + float qlong_cms = q12.Pz(); + + ROOT::Math::XYZVector q_3d = q12.Vect(); // 3D q vector + ROOT::Math::XYZVector uv_out(k12.Px() / k12.Pt(), k12.Py() / k12.Pt(), 0); // unit vector for out. i.e. parallel to kt + ROOT::Math::XYZVector uv_long(0, 0, 1); // unit vector for long, beam axis + ROOT::Math::XYZVector uv_side = uv_out.Cross(uv_long); // unit vector for side + float qout_cms = q_3d.Dot(uv_out); + float qside_cms = q_3d.Dot(uv_side); + + // longitudinally co-moving system (LCMS) + ROOT::Math::PxPyPzEVector v1_cartesian(v1.Px(), v1.Py(), v1.Pz(), v1.E()); + ROOT::Math::PxPyPzEVector v2_cartesian(v2.Px(), v2.Py(), v2.Pz(), v2.E()); + ROOT::Math::PxPyPzEVector q12_cartesian = v1_cartesian - v2_cartesian; + float beta_z = (v1 + v2).Pz() / (v1 + v2).E(); + ROOT::Math::Boost bst_z(0, 0, -beta_z); // Boost supports only PxPyPzEVector + ROOT::Math::PxPyPzEVector q12_lcms = bst_z(q12_cartesian); + float qlong_lcms = q12_lcms.Pz(); + + values_3d[2] = kt; + values_3d[3] = qinv; + values_3d[4] = qlong_cms; + values_3d[5] = qout_cms; + values_3d[6] = qside_cms; + values_3d[7] = qlong_lcms; + reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut1.GetName(), cut2.GetName()))->FindObject(paircut.GetName())->FindObject("hs_q_mix"))->Fill(values_3d); + } else { + reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut1.GetName(), cut2.GetName()))->FindObject(paircut.GetName())->FindObject("hs_q_mix"))->Fill(values_1d); + } + } // end of different photon combinations } // end of pair cut loop } // end of cut2 loop @@ -489,8 +550,11 @@ struct PhotonHBT { Preslice perCollision_dalitzee = aod::dalitzee::emreducedeventId; Preslice perCollision_phos = aod::skimmedcluster::collisionId; + Filter eeFilter = o2::aod::dalitzee::sign == 0 && nabs(o2::aod::dalitzee::rapidity) < maxY_dielectron; // analyze only uls + using filteredMyDalitzEEs = soa::Filtered; + Filter collisionFilter_common = nabs(o2::aod::collision::posZ) < 10.f && o2::aod::collision::numContrib > (uint16_t)0 && o2::aod::evsel::sel8 == true; - Filter collisionFilter_subsys = (o2::aod::emreducedevent::ngpcm >= 1) || (o2::aod::emreducedevent::neeuls >= 1); + Filter collisionFilter_subsys = (o2::aod::emreducedevent::ngpcm >= 1); using MyFilteredCollisions = soa::Filtered; void processPCMPCM(MyCollisions const& collisions, MyFilteredCollisions const& filtered_collisions, MyV0Photons const& v0photons, aod::V0Legs const& legs) @@ -499,12 +563,18 @@ struct PhotonHBT { MixedEventPairing(filtered_collisions, v0photons, v0photons, perCollision_pcm, perCollision_pcm, fPCMCuts, fPCMCuts, fPairCuts, legs, nullptr); } - void processPCMDalitzEE(MyCollisions const& collisions, MyFilteredCollisions const& filtered_collisions, MyV0Photons const& v0photons, aod::V0Legs const& legs, MyDalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons) + void processPCMDalitzEE(MyCollisions const& collisions, MyFilteredCollisions const& filtered_collisions, MyV0Photons const& v0photons, aod::V0Legs const& legs, filteredMyDalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons) { SameEventPairing(collisions, v0photons, dielectrons, perCollision_pcm, perCollision_dalitzee, fPCMCuts, fDalitzEECuts, fPairCuts, legs, emprimaryelectrons); MixedEventPairing(filtered_collisions, v0photons, dielectrons, perCollision_pcm, perCollision_dalitzee, fPCMCuts, fDalitzEECuts, fPairCuts, legs, emprimaryelectrons); } + void processDalitzEEDalitzEE(MyCollisions const& collisions, MyFilteredCollisions const& filtered_collisions, filteredMyDalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons) + { + SameEventPairing(collisions, dielectrons, dielectrons, perCollision_dalitzee, perCollision_dalitzee, fDalitzEECuts, fDalitzEECuts, fPairCuts, nullptr, emprimaryelectrons); + MixedEventPairing(filtered_collisions, dielectrons, dielectrons, perCollision_dalitzee, perCollision_dalitzee, fDalitzEECuts, fDalitzEECuts, fPairCuts, nullptr, emprimaryelectrons); + } + void processPHOSPHOS(MyCollisions const& collisions, MyFilteredCollisions const& filtered_collisions, aod::PHOSClusters const& phosclusters) { SameEventPairing(collisions, phosclusters, phosclusters, perCollision_phos, perCollision_phos, fPHOSCuts, fPHOSCuts, fPairCuts, nullptr, nullptr); @@ -521,6 +591,7 @@ struct PhotonHBT { PROCESS_SWITCH(PhotonHBT, processPCMPCM, "pairing PCM-PCM", false); PROCESS_SWITCH(PhotonHBT, processPCMDalitzEE, "pairing PCM-DalitzEE", false); + PROCESS_SWITCH(PhotonHBT, processDalitzEEDalitzEE, "pairing DalitzEE-DalitzEE", false); PROCESS_SWITCH(PhotonHBT, processPHOSPHOS, "pairing PHOS-PHOS", false); PROCESS_SWITCH(PhotonHBT, processPCMPHOS, "pairing PCM-PHOS", false); PROCESS_SWITCH(PhotonHBT, processDummy, "Dummy function", true); diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGamma.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGamma.cxx index 6631f9666e5..969e6f49bee 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGamma.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGamma.cxx @@ -71,9 +71,9 @@ struct Pi0EtaToGammaGamma { Configurable CentEstimator{"CentEstimator", "FT0M", "centrality estimator"}; Configurable maxY{"maxY", 0.9, "maximum rapidity for reconstructed particles"}; - Configurable fConfigPCMCuts{"cfgPCMCuts", "analysis,qc,nocut", "Comma separated list of V0 photon cuts"}; + Configurable fConfigPCMCuts{"cfgPCMCuts", "qc,nocut", "Comma separated list of V0 photon cuts"}; Configurable fConfigDalitzEECuts{"cfgDalitzEECuts", "mee_0_120_tpchadrejortofreq_lowB,mee_120_500_tpchadrejortofreq_lowB,mee_0_500_tpchadrejortofreq_lowB", "Comma separated list of Dalitz ee cuts"}; - Configurable fConfigDalitzMuMuCuts{"cfgDalitzMuMuCuts", "mee_0_500_lowB", "Comma separated list of Dalitz mumu cuts"}; + Configurable fConfigDalitzMuMuCuts{"cfgDalitzMuMuCuts", "mmumu_0_500_lowB", "Comma separated list of Dalitz mumu cuts"}; Configurable fConfigPHOSCuts{"cfgPHOSCuts", "test02,test03", "Comma separated list of PHOS photon cuts"}; Configurable fConfigPairCuts{"cfgPairCuts", "nocut,asym08", "Comma separated list of pair cuts"}; @@ -169,7 +169,7 @@ struct Pi0EtaToGammaGamma { } // end of cut1 loop } - static constexpr std::string_view pairnames[8] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC"}; + static constexpr std::string_view pairnames[9] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC", "DalitzEEDalitzEE"}; void addhistograms() { fMainList->SetOwner(true); diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMC.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMC.cxx index e14dd178272..bd51b070739 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGammaMC.cxx @@ -140,7 +140,7 @@ struct Pi0EtaToGammaGammaMC { } // end of cut1 loop } - static constexpr std::string_view pairnames[8] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC"}; + static constexpr std::string_view pairnames[9] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC", "DalitzEEDalitzEE"}; static constexpr std::string_view parnames[3] = {"Gamma", "Pi0", "Eta"}; void addhistograms() { @@ -507,9 +507,12 @@ struct Pi0EtaToGammaGammaMC { void processPHOSEMC(MyCollisions const& collisions) {} + Filter collisionFilter = nabs(o2::aod::collision::posZ) < 10.f && o2::aod::collision::numContrib > (uint16_t)0 && o2::aod::evsel::sel8 == true; + using filteredMyCollisions = soa::Filtered; + PresliceUnsorted perMcCollision = aod::emmcparticle::emreducedmceventId; PresliceUnsorted rec_perMcCollision = aod::emmceventlabel::emreducedmceventId; - void processGen(MyCollisions const& collisions, aod::EMReducedMCEvents const& mccollisions, aod::EMMCParticles const& mcparticles) + void processGen(filteredMyCollisions const& collisions, aod::EMReducedMCEvents const& mccollisions, aod::EMMCParticles const& mcparticles) { // loop over mc stack and fill histograms for pure MC truth signals // all MC tracks which belong to the MC event corresponding to the current reconstructed event @@ -520,7 +523,6 @@ struct Pi0EtaToGammaGammaMC { } for (auto& collision : collisions) { - auto mccollision = collision.emreducedmcevent(); reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hZvtx_before"))->Fill(mccollision.posZ()); reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(1.0); // all @@ -551,8 +553,7 @@ struct Pi0EtaToGammaGammaMC { reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPt_Pi0"))->Fill(mctrack.pt()); reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hY_Pi0"))->Fill(mctrack.y()); reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhi_Pi0"))->Fill(mctrack.phi()); - } - if (abs(pdg) == 221 && IsPhysicalPrimary(mctrack.emreducedmcevent(), mctrack, mcparticles)) { + } else if (abs(pdg) == 221 && IsPhysicalPrimary(mctrack.emreducedmcevent(), mctrack, mcparticles)) { reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPt_Eta"))->Fill(mctrack.pt()); reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hY_Eta"))->Fill(mctrack.y()); reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hPhi_Eta"))->Fill(mctrack.phi()); diff --git a/PWGEM/PhotonMeson/Tasks/TaggingPi0.cxx b/PWGEM/PhotonMeson/Tasks/TaggingPi0.cxx index f9898e0ca7f..7b099c0b6d7 100644 --- a/PWGEM/PhotonMeson/Tasks/TaggingPi0.cxx +++ b/PWGEM/PhotonMeson/Tasks/TaggingPi0.cxx @@ -41,7 +41,7 @@ using namespace o2::framework::expressions; using namespace o2::soa; using namespace o2::aod::photonpair; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; using MyV0Photons = soa::Join; @@ -58,7 +58,6 @@ struct TaggingPi0 { // Configurable maxY{"maxY", 0.9, "maximum rapidity for reconstructed particles"}; Configurable fConfigPCMCuts{"cfgPCMCuts", "analysis", "Comma separated list of V0 photon cuts"}; Configurable fConfigDalitzEECuts{"cfgDalitzEECuts", "mee_0_120_tpchadrejortofreq,mee_0_120_tpchadrejortofreq_lowB", "Comma separated list of Dalitz ee cuts"}; - Configurable fConfigPCMibwCuts{"cfgPCMibwCuts", "wwire_ib", "Comma separated list of V0 photon cuts"}; Configurable fConfigPHOSCuts{"cfgPHOSCuts", "test02,test03", "Comma separated list of PHOS photon cuts"}; Configurable fConfigEMCCuts{"cfgEMCCuts", "standard", "Comma separated list of EMCal photon cuts"}; Configurable fConfigPairCuts{"cfgPairCuts", "nocut", "Comma separated list of pair cuts"}; @@ -81,7 +80,6 @@ struct TaggingPi0 { std::vector fPCMCuts; std::vector fDalitzEECuts; - std::vector fPCMibwCuts; std::vector fPHOSCuts; std::vector fEMCCuts; std::vector fPairCuts; @@ -89,9 +87,6 @@ struct TaggingPi0 { std::vector fPairNames; void init(InitContext& context) { - if (context.mOptions.get("processPCMPCMibw")) { - fPairNames.push_back("PCMPCMibw"); - } if (context.mOptions.get("processPCMDalitzEE")) { fPairNames.push_back("PCMDalitzEE"); } @@ -104,7 +99,6 @@ struct TaggingPi0 { DefinePCMCuts(); DefineDalitzEECuts(); - DefinePCMibwCuts(); DefinePHOSCuts(); DefineEMCCuts(); DefinePairCuts(); @@ -140,7 +134,7 @@ struct TaggingPi0 { } // end of cut1 loop } - static constexpr std::string_view pairnames[8] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC"}; + static constexpr std::string_view pairnames[9] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC", "DalitzEEDalitzEE"}; void addhistograms() { fMainList->SetOwner(true); @@ -162,9 +156,6 @@ struct TaggingPi0 { o2::aod::emphotonhistograms::AddHistClass(list_pair, pairname.data()); - if (pairname == "PCMPCMibw") { - add_pair_histograms(list_pair, pairname, fPCMCuts, fPCMibwCuts, fPairCuts); - } if (pairname == "PCMPHOS") { add_pair_histograms(list_pair, pairname, fPCMCuts, fPHOSCuts, fPairCuts); } @@ -206,20 +197,6 @@ struct TaggingPi0 { LOGF(info, "Number of DalitzEE cuts = %d", fDalitzEECuts.size()); } - void DefinePCMibwCuts() - { - TString cutNamesStr = fConfigPCMibwCuts.value; - if (!cutNamesStr.IsNull()) { - std::unique_ptr objArray(cutNamesStr.Tokenize(",")); - for (int icut = 0; icut < objArray->GetEntries(); ++icut) { - const char* cutname = objArray->At(icut)->GetName(); - LOGF(info, "add cut : %s", cutname); - fPCMibwCuts.push_back(*pcmcuts::GetCut(cutname)); - } - } - LOGF(info, "Number of PCM cuts = %d", fPCMibwCuts.size()); - } - void DefinePHOSCuts() { TString cutNamesStr = fConfigPHOSCuts.value; @@ -294,9 +271,7 @@ struct TaggingPi0 { bool IsSelectedPair(TG1 const& g1, TG2 const& g2, TCut1 const& cut1, TCut2 const& cut2) { bool is_selected_pair = false; - if constexpr (pairtype == PairType::kPCMPCMibw) { - is_selected_pair = o2::aod::photonpair::IsSelectedPair(g1, g2, cut1, cut2); - } else if constexpr (pairtype == PairType::kPCMPHOS) { + if constexpr (pairtype == PairType::kPCMPHOS) { is_selected_pair = o2::aod::photonpair::IsSelectedPair(g1, g2, cut1, cut2); } else if constexpr (pairtype == PairType::kPCMEMC) { is_selected_pair = o2::aod::photonpair::IsSelectedPair(g1, g2, cut1, cut2); @@ -462,11 +437,6 @@ struct TaggingPi0 { Preslice perCollision_phos = aod::skimmedcluster::collisionId; Preslice perCollision_emc = aod::skimmedcluster::collisionId; - void processPCMPCMibw(MyCollisions const& collisions, MyFilteredCollisions const& filtered_collisions, MyV0Photons const& v0photons, aod::V0Legs const& legs) - { - SameEventPairing(collisions, v0photons, v0photons, perCollision_pcm, perCollision_pcm, fPCMCuts, fPCMibwCuts, fPairCuts, legs, nullptr); - MixedEventPairing(filtered_collisions, v0photons, v0photons, perCollision_pcm, perCollision_pcm, fPCMCuts, fPCMibwCuts, fPairCuts, legs, nullptr); - } void processPCMDalitzEE(MyCollisions const& collisions, MyFilteredCollisions const& filtered_collisions, MyV0Photons const& v0photons, aod::V0Legs const& legs, MyFilteredDalitzEEs const& dielectrons, MyPrimaryElectrons const& emprimaryelectrons) { SameEventPairing(collisions, v0photons, dielectrons, perCollision_pcm, perCollision_dalitz, fPCMCuts, fDalitzEECuts, fPairCuts, legs, emprimaryelectrons); @@ -490,7 +460,6 @@ struct TaggingPi0 { // do nothing } - PROCESS_SWITCH(TaggingPi0, processPCMPCMibw, "pairing PCM-PCMibw", false); PROCESS_SWITCH(TaggingPi0, processPCMDalitzEE, "pairing PCM-Dalitz", false); PROCESS_SWITCH(TaggingPi0, processPCMPHOS, "pairing PCM-PHOS", false); PROCESS_SWITCH(TaggingPi0, processPCMEMC, "pairing PCM-EMCal", false); diff --git a/PWGEM/PhotonMeson/Tasks/TaggingPi0MC.cxx b/PWGEM/PhotonMeson/Tasks/TaggingPi0MC.cxx index 178a8618766..1f30ea0edf2 100644 --- a/PWGEM/PhotonMeson/Tasks/TaggingPi0MC.cxx +++ b/PWGEM/PhotonMeson/Tasks/TaggingPi0MC.cxx @@ -60,7 +60,6 @@ struct TaggingPi0MC { Configurable maxY{"maxY", 0.9, "maximum rapidity for reconstructed particles"}; Configurable fConfigPCMCuts{"cfgPCMCuts", "analysis", "Comma separated list of V0 photon cuts"}; Configurable fConfigDalitzEECuts{"cfgDalitzEECuts", "mee_0_120_tpchadrejortofreq,mee_0_120_tpchadrejortofreq_lowB", "Comma separated list of Dalitz ee cuts"}; - Configurable fConfigPCMibwCuts{"cfgPCMibwCuts", "wwire_ib", "Comma separated list of V0 photon cuts"}; Configurable fConfigPHOSCuts{"cfgPHOSCuts", "test02,test03", "Comma separated list of PHOS photon cuts"}; Configurable fConfigEMCCuts{"fConfigEMCCuts", "standard", "Comma separated list of EMCal photon cuts"}; Configurable fConfigPairCuts{"cfgPairCuts", "nocut", "Comma separated list of pair cuts"}; @@ -84,7 +83,6 @@ struct TaggingPi0MC { std::vector fPCMCuts; std::vector fDalitzEECuts; - std::vector fPCMibwCuts; std::vector fPHOSCuts; std::vector fEMCCuts; std::vector fPairCuts; @@ -92,9 +90,6 @@ struct TaggingPi0MC { std::vector fPairNames; void init(InitContext& context) { - if (context.mOptions.get("processPCMPCMibw")) { - fPairNames.push_back("PCMPCMibw"); - } if (context.mOptions.get("processPCMDalitzEE")) { fPairNames.push_back("PCMDalitzEE"); } @@ -107,7 +102,6 @@ struct TaggingPi0MC { DefinePCMCuts(); DefineDalitzEECuts(); - DefinePCMibwCuts(); DefinePHOSCuts(); DefineEMCCuts(); DefinePairCuts(); @@ -144,7 +138,7 @@ struct TaggingPi0MC { } // end of cut1 loop } - static constexpr std::string_view pairnames[8] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC"}; + static constexpr std::string_view pairnames[9] = {"PCMPCM", "PHOSPHOS", "EMCEMC", "PCMPHOS", "PCMEMC", "PCMDalitzEE", "PCMDalitzMuMu", "PHOSEMC", "DalitzEEDalitzEE"}; void addhistograms() { fMainList->SetOwner(true); @@ -173,9 +167,6 @@ struct TaggingPi0MC { o2::aod::emphotonhistograms::AddHistClass(list_pair, pairname.data()); - if (pairname == "PCMPCMibw") { - add_pair_histograms(list_pair, pairname, fPCMCuts, fPCMibwCuts, fPairCuts); - } if (pairname == "PCMDalitzEE") { add_pair_histograms(list_pair, pairname, fPCMCuts, fDalitzEECuts, fPairCuts); } @@ -217,20 +208,6 @@ struct TaggingPi0MC { LOGF(info, "Number of DalitzEE cuts = %d", fDalitzEECuts.size()); } - void DefinePCMibwCuts() - { - TString cutNamesStr = fConfigPCMibwCuts.value; - if (!cutNamesStr.IsNull()) { - std::unique_ptr objArray(cutNamesStr.Tokenize(",")); - for (int icut = 0; icut < objArray->GetEntries(); ++icut) { - const char* cutname = objArray->At(icut)->GetName(); - LOGF(info, "add cut : %s", cutname); - fPCMibwCuts.push_back(*pcmcuts::GetCut(cutname)); - } - } - LOGF(info, "Number of PCMibw cuts = %d", fPCMibwCuts.size()); - } - void DefinePHOSCuts() { TString cutNamesStr = fConfigPHOSCuts.value; @@ -305,9 +282,7 @@ struct TaggingPi0MC { bool IsSelectedPair(TG1 const& g1, TG2 const& g2, TCut1 const& cut1, TCut2 const& cut2) { bool is_selected_pair = false; - if constexpr (pairtype == PairType::kPCMPCMibw) { - is_selected_pair = o2::aod::photonpair::IsSelectedPair(g1, g2, cut1, cut2); - } else if constexpr (pairtype == PairType::kPCMPHOS) { + if constexpr (pairtype == PairType::kPCMPHOS) { is_selected_pair = o2::aod::photonpair::IsSelectedPair(g1, g2, cut1, cut2); } else if constexpr (pairtype == PairType::kPCMEMC) { is_selected_pair = o2::aod::photonpair::IsSelectedPair(g1, g2, cut1, cut2); @@ -428,25 +403,7 @@ struct TaggingPi0MC { } int pi0id = -1; - if constexpr (pairtype == PairType::kPCMPCMibw) { - auto pos2 = g2.template posTrack_as(); - auto ele2 = g2.template negTrack_as(); - auto pos2mc = pos2.template emmcparticle_as(); - auto ele2mc = ele2.template emmcparticle_as(); - - int photonid2 = FindCommonMotherFrom2Prongs(pos2mc, ele2mc, -11, 11, 22, mcparticles); - if (photonid2 < 0) { // check swap, true electron is reconstructed as positron and vice versa. - photonid2 = FindCommonMotherFrom2Prongs(pos2mc, ele2mc, 11, -11, 22, mcparticles); - } - - if (photonid1 < 0 || photonid2 < 0) { - continue; - } - - auto g1mc = mcparticles.iteratorAt(photonid1); - auto g2mc = mcparticles.iteratorAt(photonid2); - pi0id = FindCommonMotherFrom2Prongs(g1mc, g2mc, 22, 22, 111, mcparticles); - } else if constexpr (pairtype == PairType::kPCMDalitzEE) { + if constexpr (pairtype == PairType::kPCMDalitzEE) { auto g1mc = mcparticles.iteratorAt(photonid1); auto pos2 = g2.template posTrack_as(); auto ele2 = g2.template negTrack_as(); @@ -496,10 +453,6 @@ struct TaggingPi0MC { Preslice perCollision_phos = aod::skimmedcluster::collisionId; Preslice perCollision_emc = aod::skimmedcluster::collisionId; - void processPCMPCMibw(MyCollisions const& collisions, MyV0Photons const& v0photons, MyMCV0Legs const& legs, aod::EMMCParticles const& mcparticles, aod::EMReducedMCEvents const& mccollisions) - { - TruePairing(collisions, v0photons, v0photons, perCollision_pcm, perCollision_pcm, fPCMCuts, fPCMibwCuts, fPairCuts, legs, nullptr, mcparticles, mccollisions); - } void processPCMDalitzEE(MyCollisions const& collisions, MyV0Photons const& v0photons, MyMCV0Legs const& legs, MyFilteredDalitzEEs const& dielectrons, MyMCTracks const& emprimaryelectrons, aod::EMMCParticles const& mcparticles, aod::EMReducedMCEvents const& mccollisions) { TruePairing(collisions, v0photons, dielectrons, perCollision_pcm, perCollision_dalitz, fPCMCuts, fDalitzEECuts, fPairCuts, legs, emprimaryelectrons, mcparticles, mccollisions); @@ -517,7 +470,6 @@ struct TaggingPi0MC { void processDummy(MyCollisions const& collision) {} - PROCESS_SWITCH(TaggingPi0MC, processPCMPCMibw, "pairing PCM-PCMibw", false); PROCESS_SWITCH(TaggingPi0MC, processPCMDalitzEE, "pairing PCM-Dalitz", false); PROCESS_SWITCH(TaggingPi0MC, processPCMPHOS, "pairing PCM-PHOS", false); PROCESS_SWITCH(TaggingPi0MC, processPCMEMC, "pairing PCM-EMCal", false); diff --git a/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx index 19e0c9ea345..6effd822cbc 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx @@ -50,6 +50,7 @@ struct DalitzEEQC { Configurable fConfigDalitzEECuts{"cfgDalitzEECuts", "mee_all_tpchadrejortofreq_lowB,nocut", "Comma separated list of dalitz ee cuts"}; std::vector fDalitzEECuts; + Configurable cfgDoDCAstudy{"cfgDoDCAstudy", false, "flag to fill histograms for DCA"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable> cfgArrCentMin{"cfgArrCentMin", {0.0f, 10.0f, 20.0f, 40.0f, 60.0f, 80.0f}, "cent min array"}; Configurable> cfgArrCentMax{"cfgArrCentMax", {10.0f, 20.0f, 40.0f, 60.0f, 80.0f, 999.f}, "cent max array"}; @@ -88,11 +89,14 @@ struct DalitzEEQC { o2::aod::emphotonhistograms::DefineHistograms(list_track_cent_cut, "Track"); THashList* list_dalitzee_cent_cut = reinterpret_cast(o2::aod::emphotonhistograms::AddHistClass(list_dalitzee_cent, cutname)); + std::string histo_sub_group = ""; if (doMix) { - o2::aod::emphotonhistograms::DefineHistograms(list_dalitzee_cent_cut, "DalitzEE", "mix"); - } else { - o2::aod::emphotonhistograms::DefineHistograms(list_dalitzee_cent_cut, "DalitzEE", ""); + histo_sub_group += "mix"; } + if (cfgDoDCAstudy) { + histo_sub_group += "dca"; + } + o2::aod::emphotonhistograms::DefineHistograms(list_dalitzee_cent_cut, "DalitzEE", histo_sub_group.data()); } // end of cut loop } // end of centrality loop } @@ -160,6 +164,9 @@ struct DalitzEEQC { auto lspp_pairs_per_coll = lspp_pairs->sliceByCached(o2::aod::dalitzee::emreducedeventId, collision.globalIndex(), cache); auto lsmm_pairs_per_coll = lsmm_pairs->sliceByCached(o2::aod::dalitzee::emreducedeventId, collision.globalIndex(), cache); + // auto tracks_coll = tracks.sliceBy(perCollision_track, collision.globalIndex()); + // LOGF(info, "tracks_coll.size() = %d", tracks_coll.size()); + for (size_t icen = 0; icen < vec_cent_min.size(); icen++) { if (centrality < vec_cent_min[icen] || vec_cent_max[icen] < centrality) { continue; @@ -203,7 +210,6 @@ struct DalitzEEQC { det_ele = ele.cYY() * ele.cZZ() - ele.cZY() * ele.cZY(); if (det_pos < 0 || det_ele < 0) { dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; - LOGF(info, "determinant is negative."); } else { float chi2pos = (pos.dcaXY() * pos.dcaXY() * pos.cZZ() + pos.dcaZ() * pos.dcaZ() * pos.cYY() - 2. * pos.dcaXY() * pos.dcaZ() * pos.cZY()) / det_pos; float chi2ele = (ele.dcaXY() * ele.dcaXY() * ele.cZZ() + ele.dcaZ() * ele.dcaZ() * ele.cYY() - 2. * ele.dcaXY() * ele.dcaZ() * ele.cZY()) / det_ele; @@ -211,18 +217,20 @@ struct DalitzEEQC { dca_ele_3d = std::sqrt(std::abs(chi2ele) / 2.); dca_ee_3d = std::sqrt((dca_pos_3d * dca_pos_3d + dca_ele_3d * dca_ele_3d) / 2.); } - values_single[0] = uls_pair.mass(); - values_single[1] = dca_pos_3d; - values_single[2] = dca_ele_3d; - values_single[3] = dca_ee_3d; - reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_uls_dca_same"))->Fill(values_single); + + if (cfgDoDCAstudy) { + values_single[0] = uls_pair.mass(); + values_single[1] = dca_pos_3d; + values_single[2] = dca_ele_3d; + values_single[3] = dca_ee_3d; + reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_uls_dca_same"))->Fill(values_single); + } values[0] = uls_pair.mass(); values[1] = uls_pair.pt(); values[2] = dca_ee_3d; values[3] = uls_pair.phiv(); reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_uls_same"))->Fill(values); - nuls++; for (auto& track : {pos, ele}) { if (std::find(used_trackIds.begin(), used_trackIds.end(), track.globalIndex()) == used_trackIds.end()) { @@ -242,7 +250,6 @@ struct DalitzEEQC { det_ele = ele.cYY() * ele.cZZ() - ele.cZY() * ele.cZY(); if (det_pos < 0 || det_ele < 0) { dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; - LOGF(info, "determinant is negative."); } else { float chi2pos = (pos.dcaXY() * pos.dcaXY() * pos.cZZ() + pos.dcaZ() * pos.dcaZ() * pos.cYY() - 2. * pos.dcaXY() * pos.dcaZ() * pos.cZY()) / det_pos; float chi2ele = (ele.dcaXY() * ele.dcaXY() * ele.cZZ() + ele.dcaZ() * ele.dcaZ() * ele.cYY() - 2. * ele.dcaXY() * ele.dcaZ() * ele.cZY()) / det_ele; @@ -250,12 +257,13 @@ struct DalitzEEQC { dca_ele_3d = std::sqrt(std::abs(chi2ele) / 2.); dca_ee_3d = std::sqrt((dca_pos_3d * dca_pos_3d + dca_ele_3d * dca_ele_3d) / 2.); } - values_single[0] = lspp_pair.mass(); - values_single[1] = dca_pos_3d; - values_single[2] = dca_ele_3d; - values_single[3] = dca_ee_3d; - reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_lspp_dca_same"))->Fill(values_single); - + if (cfgDoDCAstudy) { + values_single[0] = lspp_pair.mass(); + values_single[1] = dca_pos_3d; + values_single[2] = dca_ele_3d; + values_single[3] = dca_ee_3d; + reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_lspp_dca_same"))->Fill(values_single); + } values[0] = lspp_pair.mass(); values[1] = lspp_pair.pt(); values[2] = dca_ee_3d; @@ -274,7 +282,6 @@ struct DalitzEEQC { det_ele = ele.cYY() * ele.cZZ() - ele.cZY() * ele.cZY(); if (det_pos < 0 || det_ele < 0) { dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; - LOGF(info, "determinant is negative."); } else { float chi2pos = (pos.dcaXY() * pos.dcaXY() * pos.cZZ() + pos.dcaZ() * pos.dcaZ() * pos.cYY() - 2. * pos.dcaXY() * pos.dcaZ() * pos.cZY()) / det_pos; float chi2ele = (ele.dcaXY() * ele.dcaXY() * ele.cZZ() + ele.dcaZ() * ele.dcaZ() * ele.cYY() - 2. * ele.dcaXY() * ele.dcaZ() * ele.cZY()) / det_ele; @@ -282,11 +289,14 @@ struct DalitzEEQC { dca_ele_3d = std::sqrt(std::abs(chi2ele) / 2.); dca_ee_3d = std::sqrt((dca_pos_3d * dca_pos_3d + dca_ele_3d * dca_ele_3d) / 2.); } - values_single[0] = lsmm_pair.mass(); - values_single[1] = dca_pos_3d; - values_single[2] = dca_ele_3d; - values_single[3] = dca_ee_3d; - reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_lsmm_dca_same"))->Fill(values_single); + + if (cfgDoDCAstudy) { + values_single[0] = lsmm_pair.mass(); + values_single[1] = dca_pos_3d; + values_single[2] = dca_ele_3d; + values_single[3] = dca_ee_3d; + reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_lsmm_dca_same"))->Fill(values_single); + } values[0] = lsmm_pair.mass(); values[1] = lsmm_pair.pt(); @@ -359,7 +369,6 @@ struct DalitzEEQC { det_ele = t2.cYY() * t2.cZZ() - t2.cZY() * t2.cZY(); if (det_pos < 0 || det_ele < 0) { dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; - LOGF(info, "determinant is negative."); } else { float chi2pos = (t1.dcaXY() * t1.dcaXY() * t1.cZZ() + t1.dcaZ() * t1.dcaZ() * t1.cYY() - 2. * t1.dcaXY() * t1.dcaZ() * t1.cZY()) / det_pos; float chi2ele = (t2.dcaXY() * t2.dcaXY() * t2.cZZ() + t2.dcaZ() * t2.dcaZ() * t2.cYY() - 2. * t2.dcaXY() * t2.dcaZ() * t2.cZY()) / det_ele; @@ -380,16 +389,25 @@ struct DalitzEEQC { if (cut.IsSelectedTrack(t1) && cut.IsSelectedTrack(t2) && cut.IsSelectedPair(v12.M(), phiv)) { if (t1.sign() * t2.sign() < 0) { reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_uls_mix"))->Fill(values); - reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_uls_dca_mix"))->Fill(values_single); } else if (t1.sign() > 0 && t2.sign() > 0) { reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_lspp_mix"))->Fill(values); - reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_lspp_dca_mix"))->Fill(values_single); } else if (t1.sign() < 0 && t2.sign() < 0) { reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_lsmm_mix"))->Fill(values); - reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_lsmm_dca_mix"))->Fill(values_single); } else { LOGF(info, "This should not happen."); } + + if (cfgDoDCAstudy) { + if (t1.sign() * t2.sign() < 0) { + reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_uls_dca_mix"))->Fill(values_single); + } else if (t1.sign() > 0 && t2.sign() > 0) { + reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_lspp_dca_mix"))->Fill(values_single); + } else if (t1.sign() < 0 && t2.sign() < 0) { + reinterpret_cast(list_dalitzee_cent_cut->FindObject("hs_dilepton_lsmm_dca_mix"))->Fill(values_single); + } else { + LOGF(info, "This should not happen."); + } + } } } // end of different dileptn combinations } // end of centrality list loop diff --git a/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx index 8f711631939..d88aab36870 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx @@ -199,7 +199,6 @@ struct DalitzEEQCMC { det_ele = ele.cYY() * ele.cZZ() - ele.cZY() * ele.cZY(); if (det_pos < 0 || det_ele < 0) { dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; - LOGF(info, "determinant is negative."); } else { float chi2pos = (pos.dcaXY() * pos.dcaXY() * pos.cZZ() + pos.dcaZ() * pos.dcaZ() * pos.cYY() - 2. * pos.dcaXY() * pos.dcaZ() * pos.cZY()) / det_pos; float chi2ele = (ele.dcaXY() * ele.dcaXY() * ele.cZZ() + ele.dcaZ() * ele.dcaZ() * ele.cYY() - 2. * ele.dcaXY() * ele.dcaZ() * ele.cZY()) / det_ele; diff --git a/PWGEM/PhotonMeson/Tasks/dalitzMuMuQC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzMuMuQC.cxx index 3cb4c6cff45..f2fffd1935d 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzMuMuQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzMuMuQC.cxx @@ -183,7 +183,6 @@ struct DalitzMuMuQC { det_ele = ele.cYY() * ele.cZZ() - ele.cZY() * ele.cZY(); if (det_pos < 0 || det_ele < 0) { dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; - LOGF(info, "determinant is negative."); } else { float chi2pos = (pos.dcaXY() * pos.dcaXY() * pos.cZZ() + pos.dcaZ() * pos.dcaZ() * pos.cYY() - 2. * pos.dcaXY() * pos.dcaZ() * pos.cZY()) / det_pos; float chi2ele = (ele.dcaXY() * ele.dcaXY() * ele.cZZ() + ele.dcaZ() * ele.dcaZ() * ele.cYY() - 2. * ele.dcaXY() * ele.dcaZ() * ele.cZY()) / det_ele; @@ -216,7 +215,6 @@ struct DalitzMuMuQC { det_ele = ele.cYY() * ele.cZZ() - ele.cZY() * ele.cZY(); if (det_pos < 0 || det_ele < 0) { dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; - LOGF(info, "determinant is negative."); } else { float chi2pos = (pos.dcaXY() * pos.dcaXY() * pos.cZZ() + pos.dcaZ() * pos.dcaZ() * pos.cYY() - 2. * pos.dcaXY() * pos.dcaZ() * pos.cZY()) / det_pos; float chi2ele = (ele.dcaXY() * ele.dcaXY() * ele.cZZ() + ele.dcaZ() * ele.dcaZ() * ele.cYY() - 2. * ele.dcaXY() * ele.dcaZ() * ele.cZY()) / det_ele; @@ -242,7 +240,6 @@ struct DalitzMuMuQC { det_ele = ele.cYY() * ele.cZZ() - ele.cZY() * ele.cZY(); if (det_pos < 0 || det_ele < 0) { dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; - LOGF(info, "determinant is negative."); } else { float chi2pos = (pos.dcaXY() * pos.dcaXY() * pos.cZZ() + pos.dcaZ() * pos.dcaZ() * pos.cYY() - 2. * pos.dcaXY() * pos.dcaZ() * pos.cZY()) / det_pos; float chi2ele = (ele.dcaXY() * ele.dcaXY() * ele.cZZ() + ele.dcaZ() * ele.dcaZ() * ele.cYY() - 2. * ele.dcaXY() * ele.dcaZ() * ele.cZY()) / det_ele; @@ -302,7 +299,6 @@ struct DalitzMuMuQC { det_ele = t2.cYY() * t2.cZZ() - t2.cZY() * t2.cZY(); if (det_pos < 0 || det_ele < 0) { dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; - LOGF(info, "determinant is negative."); } else { float chi2pos = (t1.dcaXY() * t1.dcaXY() * t1.cZZ() + t1.dcaZ() * t1.dcaZ() * t1.cYY() - 2. * t1.dcaXY() * t1.dcaZ() * t1.cZY()) / det_pos; float chi2ele = (t2.dcaXY() * t2.dcaXY() * t2.cZZ() + t2.dcaZ() * t2.dcaZ() * t2.cYY() - 2. * t2.dcaXY() * t2.dcaZ() * t2.cZY()) / det_ele; diff --git a/PWGEM/PhotonMeson/Tasks/dalitzMuMuQCMC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzMuMuQCMC.cxx index f936c95a462..3cc645ca879 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzMuMuQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzMuMuQCMC.cxx @@ -145,6 +145,8 @@ struct DalitzMuMuQCMC { THashList* list_dalitzmumu = static_cast(fMainList->FindObject("DalitzMuMu")); THashList* list_track = static_cast(fMainList->FindObject("Track")); double values[4] = {0, 0, 0, 0}; + float dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; + float det_pos = 999.f, det_ele = 999.f; for (auto& collision : collisions) { reinterpret_cast(fMainList->FindObject("Event")->FindObject("hZvtx_before"))->Fill(collision.posZ()); @@ -192,9 +194,22 @@ struct DalitzMuMuQCMC { if (mother_id > 0) { auto mcmother = mcparticles.iteratorAt(mother_id); if (IsPhysicalPrimary(mcmother.emreducedmcevent(), mcmother, mcparticles)) { + + det_pos = pos.cYY() * pos.cZZ() - pos.cZY() * pos.cZY(); + det_ele = ele.cYY() * ele.cZZ() - ele.cZY() * ele.cZY(); + if (det_pos < 0 || det_ele < 0) { + dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; + } else { + float chi2pos = (pos.dcaXY() * pos.dcaXY() * pos.cZZ() + pos.dcaZ() * pos.dcaZ() * pos.cYY() - 2. * pos.dcaXY() * pos.dcaZ() * pos.cZY()) / det_pos; + float chi2ele = (ele.dcaXY() * ele.dcaXY() * ele.cZZ() + ele.dcaZ() * ele.dcaZ() * ele.cYY() - 2. * ele.dcaXY() * ele.dcaZ() * ele.cZY()) / det_ele; + dca_pos_3d = std::sqrt(std::abs(chi2pos) / 2.); + dca_ele_3d = std::sqrt(std::abs(chi2ele) / 2.); + dca_ee_3d = std::sqrt((dca_pos_3d * dca_pos_3d + dca_ele_3d * dca_ele_3d) / 2.); + } + values[0] = uls_pair.mass(); values[1] = uls_pair.pt(); - values[2] = uls_pair.dcaXY(); + values[2] = dca_ee_3d; values[3] = uls_pair.phiv(); reinterpret_cast(list_dalitzmumu_cut->FindObject("hs_dilepton_uls_same"))->Fill(values); diff --git a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx index 86a40466102..941ebdb4bc9 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx @@ -56,7 +56,7 @@ using MyV0Photon = MyV0Photons::iterator; struct PCMQC { - Configurable fConfigPCMCuts{"cfgPCMCuts", "analysis,wwire_ib,qc,qc_ITSTPC,qc_ITSonly,qc_TPConly,nocut", "Comma separated list of v0 photon cuts"}; + Configurable fConfigPCMCuts{"cfgPCMCuts", "qc,qc_ITSTPC,qc_ITSonly,qc_TPConly,wwire_ib,nocut", "Comma separated list of v0 photon cuts"}; std::vector fPCMCuts; diff --git a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx index acebc53ae55..2dbb484ea57 100644 --- a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx @@ -57,9 +57,9 @@ using MyV0Photon = MyV0Photons::iterator; struct PCMQCMC { using MyMCV0Legs = soa::Join; - Configurable fConfigPCMCuts{"cfgPCMCuts", "analysis,qc,nocut", "Comma separated list of v0 photon cuts"}; + Configurable fConfigPCMCuts{"cfgPCMCuts", "qc,qc_ITSTPC,qc_ITSonly,qc_TPConly,wwire_ib,nocut", "Comma separated list of v0 photon cuts"}; Configurable maxY{"maxY", 0.9f, "maximum rapidity for generated particles"}; - Configurable maxRgen{"maxRgen", 90.f, "maximum radius for generated particles"}; + Configurable maxRgen{"maxRgen", 100.f, "maximum radius for generated particles"}; Configurable margin_z_mc{"margin_z_mc", 7.0, "margin for z cut in cm for MC"}; std::vector fPCMCuts; @@ -185,6 +185,7 @@ struct PCMQCMC { auto mcphoton = mcparticles.iteratorAt(photonid); float rxy_rec = sqrt(v0.vx() * v0.vx() + v0.vy() * v0.vy()); float rxy_mc = sqrt(posmc.vx() * posmc.vx() + posmc.vy() * posmc.vy()); + float eta_cp = std::atanh(v0.vz() / sqrt(pow(v0.vx(), 2) + pow(v0.vy(), 2) + pow(v0.vz(), 2))); o2::aod::emphotonhistograms::FillHistClass(list_v0_cut, "", v0); if (IsPhysicalPrimary(mcphoton.emreducedmcevent(), mcphoton, mcparticles)) { @@ -199,6 +200,10 @@ struct PCMQCMC { reinterpret_cast(fMainList->FindObject("V0")->FindObject(cut.GetName())->FindObject("hPtGen_DeltaEta"))->Fill(mcphoton.pt(), v0.eta() - mcphoton.eta()); reinterpret_cast(fMainList->FindObject("V0")->FindObject(cut.GetName())->FindObject("hPtGen_DeltaPhi"))->Fill(mcphoton.pt(), v0.phi() - mcphoton.phi()); + reinterpret_cast(fMainList->FindObject("V0")->FindObject(cut.GetName())->FindObject("hEtaRec_DeltaPtOverPtGen"))->Fill(eta_cp, (v0.pt() - mcphoton.pt()) / mcphoton.pt()); + reinterpret_cast(fMainList->FindObject("V0")->FindObject(cut.GetName())->FindObject("hEtaRec_DeltaEta"))->Fill(eta_cp, v0.eta() - mcphoton.eta()); + reinterpret_cast(fMainList->FindObject("V0")->FindObject(cut.GetName())->FindObject("hEtaRec_DeltaPhi"))->Fill(eta_cp, v0.phi() - mcphoton.phi()); + } else if (IsFromWD(mcphoton.emreducedmcevent(), mcphoton, mcparticles)) { reinterpret_cast(fMainList->FindObject("V0")->FindObject(cut.GetName())->FindObject("hPt_Photon_FromWD"))->Fill(v0.pt()); reinterpret_cast(fMainList->FindObject("V0")->FindObject(cut.GetName())->FindObject("hEtaPhi_Photon_FromWD"))->Fill(v0.phi(), v0.eta()); @@ -227,6 +232,9 @@ struct PCMQCMC { reinterpret_cast(fMainList->FindObject("V0Leg")->FindObject(cut.GetName())->FindObject("hPtGen_DeltaPtOverPtGen"))->Fill(mcleg.pt(), (leg.pt() - mcleg.pt()) / mcleg.pt()); reinterpret_cast(fMainList->FindObject("V0Leg")->FindObject(cut.GetName())->FindObject("hPtGen_DeltaEta"))->Fill(mcleg.pt(), leg.eta() - mcleg.eta()); reinterpret_cast(fMainList->FindObject("V0Leg")->FindObject(cut.GetName())->FindObject("hPtGen_DeltaPhi"))->Fill(mcleg.pt(), leg.phi() - mcleg.phi()); + reinterpret_cast(fMainList->FindObject("V0Leg")->FindObject(cut.GetName())->FindObject("hEtaRec_DeltaPtOverPtGen"))->Fill(eta_cp, (leg.pt() - mcleg.pt()) / mcleg.pt()); + reinterpret_cast(fMainList->FindObject("V0Leg")->FindObject(cut.GetName())->FindObject("hEtaRec_DeltaEta"))->Fill(eta_cp, leg.eta() - mcleg.eta()); + reinterpret_cast(fMainList->FindObject("V0Leg")->FindObject(cut.GetName())->FindObject("hEtaRec_DeltaPhi"))->Fill(eta_cp, leg.phi() - mcleg.phi()); } } } // end of v0 loop diff --git a/PWGEM/PhotonMeson/Utils/MCUtilities.h b/PWGEM/PhotonMeson/Utils/MCUtilities.h index 26e5bdb80f5..9eab29bda5c 100644 --- a/PWGEM/PhotonMeson/Utils/MCUtilities.h +++ b/PWGEM/PhotonMeson/Utils/MCUtilities.h @@ -50,6 +50,11 @@ bool IsPhysicalPrimary(TCollision const& mccollision, TTrack const& mctrack, TMC } if (mp.has_mothers()) { motherid = mp.mothersIds()[0]; // first mother index + auto mp_tmp = mcTracks.iteratorAt(motherid); + int pdg_mother_tmp = mp_tmp.pdgCode(); + if (pdg_mother_tmp == pdg_mother) { // strange protection. mother of 111 is 111. observed in LHC23k6d on 25.January.2024 + return false; + } } else { motherid = -999; } diff --git a/PWGEM/PhotonMeson/Utils/PCMUtilities.h b/PWGEM/PhotonMeson/Utils/PCMUtilities.h index 3493abb6434..389eb79ed0f 100644 --- a/PWGEM/PhotonMeson/Utils/PCMUtilities.h +++ b/PWGEM/PhotonMeson/Utils/PCMUtilities.h @@ -76,13 +76,13 @@ void Vtx_recalculation(o2::base::Propagator* prop, T1 lTrackPos, T2 lTrackNeg, f // I think this calculation gets the closest point on the track to the conversion point // This alpha is a different alpha than the usual alpha and I think it is the angle between X axis and conversion point - Double_t alphaPos = TMath::Pi() + TMath::ATan2(-(xyz[1] - helixPos.yC), -(xyz[0] - helixPos.xC)); - Double_t alphaNeg = TMath::Pi() + TMath::ATan2(-(xyz[1] - helixNeg.yC), -(xyz[0] - helixNeg.xC)); + float alphaPos = TMath::Pi() + TMath::ATan2(-(xyz[1] - helixPos.yC), -(xyz[0] - helixPos.xC)); + float alphaNeg = TMath::Pi() + TMath::ATan2(-(xyz[1] - helixNeg.yC), -(xyz[0] - helixNeg.xC)); - Double_t vertexXPos = helixPos.xC + helixPos.rC * TMath::Cos(alphaPos); - Double_t vertexYPos = helixPos.yC + helixPos.rC * TMath::Sin(alphaPos); - Double_t vertexXNeg = helixNeg.xC + helixNeg.rC * TMath::Cos(alphaNeg); - Double_t vertexYNeg = helixNeg.yC + helixNeg.rC * TMath::Sin(alphaNeg); + float vertexXPos = helixPos.xC + helixPos.rC * TMath::Cos(alphaPos); + float vertexYPos = helixPos.yC + helixPos.rC * TMath::Sin(alphaPos); + float vertexXNeg = helixNeg.xC + helixNeg.rC * TMath::Cos(alphaNeg); + float vertexYNeg = helixNeg.yC + helixNeg.rC * TMath::Sin(alphaNeg); TVector2 vertexPos(vertexXPos, vertexYPos); TVector2 vertexNeg(vertexXNeg, vertexYNeg); @@ -173,7 +173,18 @@ float getPhivPair(float pxpos, float pypos, float pzpos, float pxneg, float pyne float wy = uz * vx - ux * vz; // by construction, (wx,wy,wz) must be a unit vector. Measure angle between (wx,wy,wz) and (ax,ay,0). // The angle between them should be small if the pair is conversion. This function then returns values close to pi! - return TMath::ACos(wx * ax + wy * ay); // phiv in [0,pi] //cosPhiV = wx * ax + wy * ay; + auto clipToPM1 = [](float x) { return x < -1.f ? -1.f : (x > 1.f ? 1.f : x); }; + + // if(!std::isfinite(std::acos(wx * ax + wy * ay))){ + // LOGF(info, "pos_x_ele[0] = %f, pos_x_ele[1] = %f, pos_x_ele[2] = %f", pos_x_ele[0], pos_x_ele[1], pos_x_ele[2]); + // LOGF(info, "ux = %f, uy = %f, uz = %f", ux, uy, uz); + // LOGF(info, "ax = %f, ay = %f", ax, ay); + // LOGF(info, "wx = %f, wy = %f", wx, wy); + // LOGF(info, "wx * ax + wy * ay = %f", wx * ax + wy * ay); + // LOGF(info, "std::acos(wx * ax + wy * ay) = %f", std::acos(clipToPM1(wx * ax + wy * ay))); + // } + + return std::acos(clipToPM1(wx * ax + wy * ay)); // phiv in [0,pi] //cosPhiV = wx * ax + wy * ay; } //_______________________________________________________________________ float getPsiPair(float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) @@ -196,9 +207,10 @@ float getPsiPair(float pxpos, float pypos, float pzpos, float pxneg, float pyneg //_______________________________________________________________________ float getOpeningAngle(float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) { + auto clipToPM1 = [](float x) { return x < -1.f ? -1.f : (x > 1.f ? 1.f : x); }; float ptot2 = RecoDecay::p2(pxpos, pypos, pzpos) * RecoDecay::p2(pxneg, pyneg, pzneg); float argcos = RecoDecay::dotProd(std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}) / std::sqrt(ptot2); - return std::acos(argcos); + return std::acos(clipToPM1(argcos)); } //_______________________________________________________________________ #endif // PWGEM_PHOTONMESON_UTILS_PCMUTILITIES_H_ diff --git a/PWGEM/PhotonMeson/Utils/PairUtilities.h b/PWGEM/PhotonMeson/Utils/PairUtilities.h index c4c62546e17..39b41bfd655 100644 --- a/PWGEM/PhotonMeson/Utils/PairUtilities.h +++ b/PWGEM/PhotonMeson/Utils/PairUtilities.h @@ -29,7 +29,8 @@ enum PairType { kPCMDalitzEE = 5, kPCMDalitzMuMu = 6, kPHOSEMC = 7, - kPCMPCMibw = 8, + kDalitzEEDalitzEE = 8, + kNpair, }; template From 70f31befd07ca6b48defc41f8b2fa21e93a05a42 Mon Sep 17 00:00:00 2001 From: Mario Ciacco Date: Wed, 31 Jan 2024 17:29:44 +0100 Subject: [PATCH 23/33] add chi2tof cut + test temporary cut on tpcinnerparam (#4536) --- PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx | 61 +++++++++++++++++--------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx b/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx index b2846532a66..c114183d49d 100644 --- a/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx +++ b/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx @@ -94,11 +94,14 @@ struct antidLambdaEbye { Configurable lambdaPtMin{"lambdaPtMin", 0.5f, "minimum (anti)lambda pT (GeV/c)"}; Configurable lambdaPtMax{"lambdaPtMax", 3.0f, "maximum (anti)lambda pT (GeV/c)"}; + Configurable antidNcrossedRows{"antidNcrossedRows", 70, "Minimum number of crossed TPC rows"}; Configurable antidNclusItsCut{"antidNclusITScut", 5, "Minimum number of ITS clusters"}; Configurable antidNclusTpcCut{"antidNclusTPCcut", 70, "Minimum number of TPC clusters"}; Configurable antidNsigmaTpcCut{"antidNsigmaTpcCut", 4.f, "TPC PID cut"}; Configurable antidNsigmaTofCut{"antidNsigmaTofCut", 4.f, "TOF PID cut"}; Configurable antidDcaCut{"antidDcaCut", 0.1f, "DCA antid to PV"}; + Configurable tpcInnerParamMax{"tpcInnerParamMax", 0.6f, "(temporary) tpc inner param cut"}; + Configurable tofMassMax{"tofMassMax", 0.3f, "(temporary) tof mass cut"}; Configurable v0setting_dcav0dau{"v0setting_dcav0dau", 1, "DCA V0 Daughters"}; Configurable v0setting_dcapostopv{"v0setting_dcapostopv", 0.1f, "DCA Pos To PV"}; @@ -142,7 +145,7 @@ struct antidLambdaEbye { } if (track.itsNCls() < antidNclusItsCut || track.tpcNClsFound() < antidNclusTpcCut || - track.tpcNClsCrossedRows() < 70 || + track.tpcNClsCrossedRows() < antidNcrossedRows || track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() || track.tpcChi2NCl() > 4.f || track.itsChi2NCl() > 36.f) { @@ -189,17 +192,18 @@ struct antidLambdaEbye { histos.add("dcaNegPv", ";dcaNegPv;Entries", {HistType::kTH1F}, {dcaDaughPvAxis}); // antid QA - histos.add("tpcNsigma", ";#it{p}_{TPC};tpcNsigma", {HistType::kTH2F, {momAxis, tpcNsigmaAxis}}); - histos.add("tpcNsigmaGlo", ";#it{p}_{glo};tpcNsigma", {HistType::kTH2F, {momAxis, tpcNsigmaAxis}}); + histos.add("tpcNsigma", ";#it{p}_{TPC} (GeV/#it{c});tpcNsigma", {HistType::kTH2F}, {momAxis, tpcNsigmaAxis}); + histos.add("tpcNsigmaGlo", ";#it{p}_{T} (GeV/#it{c});tpcNsigma", {HistType::kTH2F}, {momAxis, tpcNsigmaAxis}); // histos.add("tofNsigma", ";#it{p}_{glo};tofNsigma;Entries", {HistType::kTH2F}, {momAxis, tofNsigmaAxis}); - histos.add("tofMass", ";#it{p}_{glo};Mass (GeV/#it{c}^{2});Entries", {HistType::kTH2F}, {momAxis, tofMassAxis}); + histos.add("tofMass", ";#it{p}_{glo} (GeV/#it{c});Mass (GeV/#it{c}^{2});Entries", {HistType::kTH2F}, {momAxis, tofMassAxis}); + histos.add("tofMassFull", ";#it{p}_{glo} (GeV/#it{c});Mass (GeV/#it{c}^{2});Entries", {HistType::kTH2F}, {momAxis, tofMassAxis}); auto hmomCorr = histos.add("momCorr", ";#it{p}_{glo} (GeV/#it{c});#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c});", {HistType::kTH3F}, {momAxisFine, momResAxis, trackingPidAxis}); histos.add("tpcSignal", ";#it{p}_{TPC} (GeV/#it{c});TPC signal (a.u.)", {HistType::kTH2F}, {momAxisFine, tpcAxis}); histos.add("tpcSignalBkg", ";#it{p}_{TPC} (GeV/#it{c});TPC signal (a.u.)", {HistType::kTH2F}, {momAxisFine, tpcAxis}); auto htpcSignal_glo = histos.add("tpcSignal_glo", ";#it{p}_{glo} (GeV/#it{c});TPC signal (a.u.);", {HistType::kTH3F}, {momAxisFine, tpcAxis, trackingPidAxis}); auto htpcSignalBkg_glo = histos.add("tpcSignalBkg_glo", ";#it{p}_{glo} (GeV/#it{c});TPC signal (a.u.);", {HistType::kTH3F}, {momAxisFine, tpcAxis, trackingPidAxis}); histos.add("tofSignal", ";#it{p}_{TPC} (GeV/#it{c});TOF signal (a.u.)", {HistType::kTH2F}, {momAxisFine, tofAxis}); - histos.add("tofSignal_glo", ";#it{p} (GeV/#it{c});TOF signal (a.u.)", {HistType::kTH2F}, {momAxisFine, tofAxis}); + histos.add("tofSignal_glo", ";#it{p}_{T} (GeV/#it{c});TOF signal (a.u.)", {HistType::kTH2F}, {momAxisFine, tofAxis}); for (int i{1}; i < hmomCorr->GetNbinsZ() + 1; ++i) { hmomCorr->GetZaxis()->SetBinLabel(i, pidHypotheses[i - 1].data()); @@ -274,7 +278,7 @@ struct antidLambdaEbye { } histos.fill(HIST("tpcSignal"), track.tpcInnerParam(), track.tpcSignal()); - histos.fill(HIST("tpcSignal_glo"), track.p(), track.tpcSignal(), track.pidForTracking()); + histos.fill(HIST("tpcSignal_glo"), trackParCov.getP(), track.tpcSignal(), track.pidForTracking()); if (trackParCov.getPt() < antidPtMin || trackParCov.getPt() > antidPtMax) { continue; @@ -284,30 +288,45 @@ struct antidLambdaEbye { double expSigma{expBethe * cfgBetheBlochParams->get("d", "resolution")}; auto nSigmaTPC = static_cast((track.tpcSignal() - expBethe) / expSigma); - if (std::abs(nSigmaTPC) > antidNsigmaTpcCut) { - continue; - } float beta{track.hasTOF() ? responseBeta.GetBeta(track) : -999.f}; beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); float mass{track.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f)}; + bool hasTof = track.hasTOF() && track.tofChi2() < 3; - if (trackParCov.getPt() > antidPtTof) { - histos.fill(HIST("tofMass"), track.p(), mass); - histos.fill(HIST("tofSignal_glo"), track.p(), beta); - histos.fill(HIST("tofSignal"), track.tpcInnerParam(), beta); + if (std::abs(nSigmaTPC) > antidNsigmaTpcCut) { + continue; } - histos.fill(HIST("tpcNsigma"), track.tpcInnerParam(), nSigmaTPC); - histos.fill(HIST("tpcNsigmaGlo"), track.p(), nSigmaTPC); - - histos.fill(HIST("momCorr"), track.p(), track.tpcInnerParam() - track.p(), track.pidForTracking()); + histos.fill(HIST("momCorr"), trackParCov.getP(), track.tpcInnerParam() - trackParCov.getP(), track.pidForTracking()); // check contamination - if (std::abs((track.tpcInnerParam() - track.p() + 1.8 / 1.7 * (track.p() - 0.3))) < 0.2) { + if (track.tpcInnerParam() < tpcInnerParamMax) { histos.fill(HIST("tpcSignalBkg"), track.tpcInnerParam(), track.tpcSignal()); - histos.fill(HIST("tpcSignalBkg_glo"), track.p(), track.tpcSignal(), track.pidForTracking()); + histos.fill(HIST("tpcSignalBkg_glo"), trackParCov.getP(), track.tpcSignal(), track.pidForTracking()); + } + + if (trackParCov.getPt() > antidPtTof && hasTof) { + histos.fill(HIST("tofSignal_glo"), trackParCov.getP(), beta); + histos.fill(HIST("tofSignal"), track.tpcInnerParam(), beta); + } + + // temporary cut to reject fake matches + if (track.tpcInnerParam() < tpcInnerParamMax) { + continue; + } + if (trackParCov.getPt() > antidPtTof && !track.hasTOF()) { + continue; + } + histos.fill(HIST("tofMassFull"), trackParCov.getPt(), mass); + if (trackParCov.getPt() > antidPtTof && track.tofChi2() > 3) { + continue; + } + histos.fill(HIST("tofMass"), trackParCov.getPt(), mass); + + if (trackParCov.getPt() <= antidPtTof || (trackParCov.getPt() > antidPtTof && hasTof && std::abs(mass - o2::constants::physics::MassDeuteron) < tofMassMax)) { + histos.fill(HIST("tpcNsigmaGlo"), trackParCov.getPt(), nSigmaTPC); + q1antid += 1.; // TODO: correct for efficiency + q2antid += 1.; } - q1antid += 1.; // TODO: correct for efficiency - q2antid += 1.; } double q1L{0.}, q2L{0.}, q1antiL{0.}, q2antiL{0.}; From 785a0daab99ecc34a8451f774819ad6ecbc59422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Mart=C3=ADnez=20Garc=C3=ADa?= Date: Wed, 31 Jan 2024 11:03:17 -0600 Subject: [PATCH 24/33] PWGMM: Luminosity stability analysis. (#4479) --- PWGMM/Lumi/Tasks/CMakeLists.txt | 6 +++ PWGMM/Lumi/Tasks/lumiStability.cxx | 84 ++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 PWGMM/Lumi/Tasks/lumiStability.cxx diff --git a/PWGMM/Lumi/Tasks/CMakeLists.txt b/PWGMM/Lumi/Tasks/CMakeLists.txt index 154414e30cd..87b7e7fe919 100644 --- a/PWGMM/Lumi/Tasks/CMakeLists.txt +++ b/PWGMM/Lumi/Tasks/CMakeLists.txt @@ -34,3 +34,9 @@ o2physics_add_dpl_workflow(fitvdm O2::DetectorsCommonDataFormats O2::DetectorsVertexing COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(lumistab + SOURCES lumiStability.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + O2::ReconstructionDataFormats + COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGMM/Lumi/Tasks/lumiStability.cxx b/PWGMM/Lumi/Tasks/lumiStability.cxx new file mode 100644 index 00000000000..dc80cf5811d --- /dev/null +++ b/PWGMM/Lumi/Tasks/lumiStability.cxx @@ -0,0 +1,84 @@ +// 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. +/// +/// \brief This task is an empty skeleton that fills a simple eta histogram. +/// it is meant to be a blank page for further developments. +/// \author everyone + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Framework/ASoAHelpers.h" +#include "DataFormatsFDD/Digit.h" +#include "Framework/ASoA.h" + +using namespace o2; +using namespace o2::framework; +using BCsWithTimestamps = soa::Join; + +int nBCsPerOrbit = 3564; + +struct lumiStabilityTask { + // Histogram registry: an object to hold your histograms + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext const&) + { + const AxisSpec axisFDDTrigggerVertex{nBCsPerOrbit + 1, 0.5f, nBCsPerOrbit + 0.5f}; + const AxisSpec axisFT0TrigggerVertex{nBCsPerOrbit + 1, 0.5f, nBCsPerOrbit + 0.5f}; + + // histo about triggers + histos.add("FDD/bcVertexTrigger", "vertex trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisFDDTrigggerVertex}); + histos.add("FT0/bcVertexTrigger", "vertex trigger per BC (FT0);BC in FDD; counts", kTH1F, {axisFT0TrigggerVertex}); + } + + void process(aod::FT0s const& ft0s, aod::FDDs const& fdds, aod::BCsWithTimestamps const&) + { + for (auto const& fdd : fdds) { + auto bc = fdd.bc_as(); + if (!bc.timestamp()) + continue; + + Long64_t globalBC = bc.globalBC(); + int localBC = globalBC % nBCsPerOrbit; + + std::bitset<8> fddTriggers = fdd.triggerMask(); + bool vertex = fddTriggers[o2::fdd::Triggers::bitVertex]; + + if (vertex) { + histos.fill(HIST("FDD/bcVertexTrigger"), localBC); + } // vertex true + } // loop over FDD events + + for (auto const& ft0 : ft0s) { + auto bc = ft0.bc_as(); + if (!bc.timestamp()) + continue; + + Long64_t globalBC = bc.globalBC(); + int localBC = globalBC % nBCsPerOrbit; + + std::bitset<8> fT0Triggers = ft0.triggerMask(); + bool vertex = fT0Triggers[o2::fdd::Triggers::bitVertex]; + + if (vertex) { + histos.fill(HIST("FT0/bcVertexTrigger"), localBC); + } // vertex true + } // loop over FT0 events + } // end process +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} From b0607c8e6e605faca14a21d8a5d3bb11b8a63d9b Mon Sep 17 00:00:00 2001 From: Tanu Gahlaut <154991749+TGahlaut1@users.noreply.github.com> Date: Wed, 31 Jan 2024 22:51:45 +0530 Subject: [PATCH 25/33] Update MeanPtFlucIdentified.cxx (#4534) --- .../Tasks/MeanPtFlucIdentified.cxx | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx b/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx index b5bf728875a..69fd424d532 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx @@ -78,7 +78,7 @@ struct meanPtFlucId { Configurable prP5{"prP5", 1.13, "proton p (5)"}; Configurable prP6{"prP6", 1.18, "proton p (6)"}; ConfigurableAxis multTPCBins{"multTPCBins", {150, 0, 150}, "TPC Multiplicity bins"}; - ConfigurableAxis multFT0MBins{"multFT0MBins", {150, 0, 1500}, "Forward Multiplicity bins"}; + ConfigurableAxis multFT0MBins{"multFT0MBins", {150, 0, 10000}, "Forward Multiplicity bins"}; ConfigurableAxis dcaXYBins{"dcaXYBins", {100, -0.15, 0.15}, "dcaXY bins"}; ConfigurableAxis dcaZBins{"dcaZBins", {100, -1.2, 1.2}, "dcaZ bins"}; @@ -302,10 +302,10 @@ struct meanPtFlucId { double pt_Pi = 0, Q1_Pi = 0, Q2_Pi = 0, Q3_Pi = 0, Q4_Pi = 0; double pt_Pr = 0, Q1_Pr = 0, Q2_Pr = 0, Q3_Pr = 0, Q4_Pr = 0; double pt_Ka = 0, Q1_Ka = 0, Q2_Ka = 0, Q3_Ka = 0, Q4_Ka = 0; - double mean_Q1_Ch, mean_Q1_Pi, mean_Q1_Ka, mean_Q1_Pr; - double twopart_Ch, twopart_Pi, twopart_Ka, twopart_Pr; - double threepart_Ch, threepart_Pi, threepart_Ka, threepart_Pr; - double fourpart_Ch, fourpart_Pi, fourpart_Ka, fourpart_Pr; + double mean_Q1_Ch = 0, mean_Q1_Pi = 0, mean_Q1_Ka = 0, mean_Q1_Pr = 0; + double twopart_Ch = 0, twopart_Pi = 0, twopart_Ka = 0, twopart_Pr = 0; + double threepart_Ch = 0, threepart_Pi = 0, threepart_Ka = 0, threepart_Pr = 0; + double fourpart_Ch = 0, fourpart_Pi = 0, fourpart_Ka = 0, fourpart_Pr = 0; for (auto& track : tracks) { if (!selTrack(track)) @@ -422,63 +422,63 @@ struct meanPtFlucId { hist.fill(HIST(dire[3]) + HIST("h_Mult"), N_Pr); parts(Q1_ch, Q2_ch, Q3_ch, Q4_ch, Nch, &mean_Q1_Ch, &twopart_Ch, &threepart_Ch, &fourpart_Ch); - if (Nch > 0) { + if (Nch > 0 && mean_Q1_Ch != 0) { hist.fill(HIST(dire[0]) + HIST("h_mean_Q1"), mean_Q1_Ch); hist.fill(HIST(dire[0]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Ch); hist.fill(HIST(dire[0]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Ch, Cent_FT0M); } - if (Nch > 1) + if (Nch > 1 && twopart_Ch != 0) hist.fill(HIST(dire[0]) + HIST("h_twopart_Mult"), NTPC, twopart_Ch, Cent_FT0M); - if (Nch > 2) + if (Nch > 2 && threepart_Ch != 0) hist.fill(HIST(dire[0]) + HIST("h_threepart_Mult"), NTPC, threepart_Ch, Cent_FT0M); - if (Nch > 3) + if (Nch > 3 && fourpart_Ch != 0) hist.fill(HIST(dire[0]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Ch, Cent_FT0M); parts(Q1_Pi, Q2_Pi, Q3_Pi, Q4_Pi, N_Pi, &mean_Q1_Pi, &twopart_Pi, &threepart_Pi, &fourpart_Pi); - if (N_Pi > 0) { + if (N_Pi > 0 && mean_Q1_Pi != 0) { hist.fill(HIST(dire[1]) + HIST("h_mean_Q1"), mean_Q1_Pi); hist.fill(HIST(dire[1]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Pi); hist.fill(HIST(dire[1]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Pi, Cent_FT0M); } - if (N_Pi > 1) + if (N_Pi > 1 && twopart_Pi != 0) hist.fill(HIST(dire[1]) + HIST("h_twopart_Mult"), NTPC, twopart_Pi, Cent_FT0M); - if (N_Pi > 2) + if (N_Pi > 2 && threepart_Pi != 0) hist.fill(HIST(dire[1]) + HIST("h_threepart_Mult"), NTPC, threepart_Pi, Cent_FT0M); - if (N_Pi > 3) + if (N_Pi > 3 && fourpart_Pi != 0) hist.fill(HIST(dire[1]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Pi, Cent_FT0M); parts(Q1_Ka, Q2_Ka, Q3_Ka, Q4_Ka, N_Ka, &mean_Q1_Ka, &twopart_Ka, &threepart_Ka, &fourpart_Ka); - if (N_Ka > 0) { + if (N_Ka > 0 && mean_Q1_Ka != 0) { hist.fill(HIST(dire[2]) + HIST("h_mean_Q1"), mean_Q1_Ka); hist.fill(HIST(dire[2]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Ka); hist.fill(HIST(dire[2]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Ka, Cent_FT0M); } - if (N_Ka > 1) + if (N_Ka > 1 && twopart_Ka != 0) hist.fill(HIST(dire[2]) + HIST("h_twopart_Mult"), NTPC, twopart_Ka, Cent_FT0M); - if (N_Ka > 2) + if (N_Ka > 2 && threepart_Ka != 0) hist.fill(HIST(dire[2]) + HIST("h_threepart_Mult"), NTPC, threepart_Ka, Cent_FT0M); - if (N_Ka > 3) + if (N_Ka > 3 && fourpart_Ka != 0) hist.fill(HIST(dire[2]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Ka, Cent_FT0M); parts(Q1_Pr, Q2_Pr, Q3_Pr, Q4_Pr, N_Pr, &mean_Q1_Pr, &twopart_Pr, &threepart_Pr, &fourpart_Pr); - if (N_Pr > 0) { + if (N_Pr > 0 && mean_Q1_Pr != 0) { hist.fill(HIST(dire[3]) + HIST("h_mean_Q1"), mean_Q1_Pr); hist.fill(HIST(dire[3]) + HIST("p_mean_Q1"), NTPC, mean_Q1_Pr); hist.fill(HIST(dire[3]) + HIST("h_mean_Q1_Mult"), NTPC, mean_Q1_Pr, N_FT0M); } - if (N_Pr > 1) + if (N_Pr > 1 && twopart_Pr != 0) hist.fill(HIST(dire[3]) + HIST("h_twopart_Mult"), NTPC, twopart_Pr, Cent_FT0M); - if (N_Pr > 2) + if (N_Pr > 2 && threepart_Pr != 0) hist.fill(HIST(dire[3]) + HIST("h_threepart_Mult"), NTPC, threepart_Pr, Cent_FT0M); - if (N_Pr > 3) + if (N_Pr > 3 && fourpart_Pr != 0) hist.fill(HIST(dire[3]) + HIST("h_fourpart_Mult"), NTPC, fourpart_Pr, Cent_FT0M); } void process_Run2(MyRun2Collisions::iterator const& col, MyAllTracks const& tracks) From 8d43855fcb744207ca7fe3f44b517b45937c4db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20L=C3=B6mker?= Date: Thu, 1 Feb 2024 09:53:21 +0100 Subject: [PATCH 26/33] [PWGJE] Fixing reduction factor and adding centrality axis for trackJetqa.cxx (#4535) * fix merge conflict due to old PR * adding changes in comments * remove comments * fix range * MegaLinter fixes --------- Co-authored-by: ALICE Action Bot --- PWGJE/DataModel/TrackJetQa.h | 28 +- PWGJE/TableProducer/jettrackderived.cxx | 105 ++++--- PWGJE/Tasks/jetvalidationqa.cxx | 15 - PWGJE/Tasks/trackJetqa.cxx | 370 +++++++++++++----------- 4 files changed, 268 insertions(+), 250 deletions(-) diff --git a/PWGJE/DataModel/TrackJetQa.h b/PWGJE/DataModel/TrackJetQa.h index 297704d7911..858aa53b0db 100644 --- a/PWGJE/DataModel/TrackJetQa.h +++ b/PWGJE/DataModel/TrackJetQa.h @@ -43,27 +43,28 @@ namespace o2::aod namespace jetcollisions { // Collision info -DECLARE_SOA_COLUMN(GlobalIdx, globalIdx, int64_t); +DECLARE_SOA_COLUMN(GlobalIdx, globalIdx, int); DECLARE_SOA_COLUMN(RunNumber, runNumber, int); DECLARE_SOA_COLUMN(Sel8, sel8, bool); +DECLARE_SOA_COLUMN(MultTracks, multTracks, int); DECLARE_SOA_COLUMN(MultNTracksPV, multNTracksPV, int); -DECLARE_SOA_COLUMN(MultFT0C, multFT0C, float); -DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); DECLARE_SOA_COLUMN(MultFT0A, multFT0A, float); +DECLARE_SOA_COLUMN(MultFT0C, multFT0C, float); DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float); +DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float); } // namespace jetcollisions namespace jettrack { // Track info -DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! Id of collision -DECLARE_SOA_COLUMN(IsPVContributor, isPVContributor, bool); //! IsPVContributor -DECLARE_SOA_COLUMN(HasTRD, hasTRD, bool); //! Has or not the TRD match -DECLARE_SOA_COLUMN(HasITS, hasITS, bool); //! Has or not the ITS match -DECLARE_SOA_COLUMN(HasTPC, hasTPC, bool); //! Has or not the TPC match // Addtional selections for trackJetqa // -DECLARE_SOA_COLUMN(IsGlobalTrack, isGlobalTrack, bool); // if a track passed the isGlobalTrack requirement -DECLARE_SOA_COLUMN(IsGlobalTrackWoDCA, isGlobalTrackWoDCA, bool); // if a track passed the isGlobalTrackWoDCA requirement -DECLARE_SOA_COLUMN(IsGlobalTrackWoPtEta, isGlobalTrackWoPtEta, bool); // if a track passed the isGlobalTrackWoPtEta requirement +DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! Id of collision +DECLARE_SOA_COLUMN(IsPVContributor, isPVContributor, bool); //! IsPVContributor +DECLARE_SOA_COLUMN(HasTRD, hasTRD, bool); //! Has or not the TRD match +DECLARE_SOA_COLUMN(HasITS, hasITS, bool); //! Has or not the ITS match +DECLARE_SOA_COLUMN(HasTPC, hasTPC, bool); //! Has or not the TPC match // Addtional selections for trackJetqa // +DECLARE_SOA_COLUMN(IsGlobalTrack, isGlobalTrack, bool); // if a track passed the isGlobalTrack requirement +DECLARE_SOA_COLUMN(IsGlobalTrackWoDCA, isGlobalTrackWoDCA, bool); // if a track passed the isGlobalTrackWoDCA requirement +DECLARE_SOA_COLUMN(IsGlobalTrackWoPtEta, isGlobalTrackWoPtEta, bool); // if a track passed the isGlobalTrackWoPtEta requirement DECLARE_SOA_COLUMN(ITSNCls, itsNCls, uint8_t); DECLARE_SOA_COLUMN(TPCFractionSharedCls, tpcFractionSharedCls, float); DECLARE_SOA_COLUMN(ITSClusterMap, itsClusterMap, float); @@ -71,16 +72,17 @@ DECLARE_SOA_COLUMN(TPCNClsFound, tpcNClsFound, int16_t); DECLARE_SOA_COLUMN(TPCNClsCrossedRows, tpcNClsCrossedRows, int16_t); DECLARE_SOA_COLUMN(TPCCrossedRowsOverFindableCls, tpcCrossedRowsOverFindableCls, float); DECLARE_SOA_COLUMN(TPCFoundOverFindableCls, tpcFoundOverFindableCls, float); - } // namespace jettrack DECLARE_SOA_TABLE(JeColls, "AOD", "JECOLLS", o2::soa::Index<>, + jetcollisions::GlobalIdx, collision::CollisionTime, collision::NumContrib, collision::PosX, collision::PosY, collision::PosZ, + jetcollisions::MultTracks, jetcollisions::Sel8, jetcollisions::MultNTracksPV, jetcollisions::MultFT0A, @@ -89,8 +91,6 @@ DECLARE_SOA_TABLE(JeColls, "AOD", "JECOLLS", jetcollisions::CentFT0C, jetcollisions::RunNumber); -// using JeColl = JeColls::iterator; - DECLARE_SOA_TABLE(JeTracks, "AOD", "JETRACKS", o2::soa::Index<>, jettrack::CollisionId, diff --git a/PWGJE/TableProducer/jettrackderived.cxx b/PWGJE/TableProducer/jettrackderived.cxx index e8c369fd07e..827ec6c1c15 100644 --- a/PWGJE/TableProducer/jettrackderived.cxx +++ b/PWGJE/TableProducer/jettrackderived.cxx @@ -56,8 +56,7 @@ struct jetspectraDerivedMaker { Configurable minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.7f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; Configurable maxChi2PerClusterTPC{"maxChi2PerClusterTPC", 7.f, "Additional cut on the maximum value of the chi2 per cluster in the TPC"}; Configurable maxChi2PerClusterITS{"maxChi2PerClusterITS", 36.f, "Additional cut on the maximum value of the chi2 per cluster in the ITS"}; - Configurable maxDcaXYFactor{"maxDcaXYFactor", 1.f, "Additional cut on the maximum value of the DCA xy (multiplicative factor)"}; - Configurable maxDcaXY{"maxDcaXY", 3.f, "Additional cut on the maximum value of the DCA xy"}; + Configurable maxDcaXY{"maxDcaXY", 0.25f, "Cut on the maximum value of the DCA xy "}; Configurable maxDcaZ{"maxDcaZ", 3.f, "Additional cut on the maximum value of the DCA z"}; Configurable minTPCNClsFound{"minTPCNClsFound", 0.f, "Additional cut on the minimum value of the number of found clusters in the TPC"}; @@ -79,8 +78,8 @@ struct jetspectraDerivedMaker { LOG(info) << "\tminTPCNClsFound=" << minTPCNClsFound.value; LOG(info) << "\tmaxChi2PerClusterITS=" << maxChi2PerClusterITS.value; LOG(info) << "\tRequireHitsInITSLayers=" << maxChi2PerClusterITS.value; - LOG(info) << "\tmaxDcaZ=" << maxDcaZ.value; LOG(info) << "\tmaxDcaXY=" << maxDcaXY.value; + LOG(info) << "\tmaxDcaZ=" << maxDcaZ.value; LOG(info) << "\tminPt=" << minPt.value; LOG(info) << "\tmaxPt=" << maxPt.value; LOG(info) << "\tmaxEta=" << ValCutEta.value; @@ -96,17 +95,14 @@ struct jetspectraDerivedMaker { customTrackCuts.SetMaxChi2PerClusterITS(maxChi2PerClusterITS.value); customTrackCuts.SetMinNCrossedRowsTPC(minNCrossedRowsTPC.value); customTrackCuts.SetMinNClustersTPC(minTPCNClsFound.value); - // customTrackCuts.SetRequireHitsInITSLayers(nHits.value, {0, 1}); // one hit in any SPD layer (#hits, {layer0, layer1,...}) -> Defaults (1, {0, 1}) + // customTrackCuts.SetRequireHitsInITSLayers(nHits.value, {0, 1}); // one hit in any SPD layer (#hits, {layer0, layer1,...}) customTrackCuts.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value); - customTrackCuts.SetMaxDcaXYPtDep([](float pt) { return 1e+10; }); customTrackCuts.SetMaxDcaXY(maxDcaXY.value); customTrackCuts.SetMaxDcaZ(maxDcaZ.value); customTrackCuts.print(); // event property histograms histos.add("EventProp/collisionVtxZ", "Collsion Vertex Z;#it{Vtx}_{z} [cm];number of entries", HistType::kTH1F, {{nBins, -20, 20}}); - histos.add("EventProp/collisionVtxZnoSel", "Collsion Vertex Z without event selection;#it{Vtx}_{z} [cm];number of entries", HistType::kTH1F, {{nBins, -20, 20}}); - histos.add("EventProp/collisionVtxZSel8", "Collsion Vertex Z with event selection;#it{Vtx}_{z} [cm];number of entries", HistType::kTH1F, {{nBins, -20, 20}}); histos.add("EventProp/sampledvertexz", "Sampled collsion Vertex Z with event (sel8) selection;#it{Vtx}_{z} [cm];number of entries", HistType::kTH1F, {{nBins, -20, 20}}); histos.add("EventProp/NumContrib", "Number of contributors to vertex of collision; number of contributors to vtx; number of entries", HistType::kTH1F, {{nBins, 0, 600}}); histos.add("EventProp/rejectedCollId", "CollisionId of collisions that did not pass the event selection; collisionId; number of entries", HistType::kTH1F, {{10, 0, 5}}); @@ -155,55 +151,74 @@ struct jetspectraDerivedMaker { return true; } + Preslice trackPerColl = aod::track::collisionId; Produces tableTrack; + Produces tableColl; using CollisionCandidate = soa::Join; using TrackCandidates = soa::Join; unsigned int randomSeed = 0; void processData(CollisionCandidate const& collisions, - TrackCandidates const& tracks) + TrackCandidates const& tracks, aod::BCs const&) { for (const auto& collision : collisions) { if (!isEventSelected(collision)) { histos.fill(HIST("EventProp/rejectedCollId"), 1); - } - } - tableTrack.reserve(tracks.size()); - for (const auto& trk : tracks) { - if (!customTrackCuts.IsSelected(trk)) { // we fill all tracks that have a collision(rejected or not) and pass this check ! continue; } else { - tableTrack(trk.collisionId(), - trk.trackTime(), - trk.signed1Pt(), trk.eta(), trk.phi(), trk.pt(), - trk.sigma1Pt(), - trk.alpha(), - trk.x(), trk.y(), trk.z(), - trk.snp(), - trk.tgl(), - trk.isPVContributor(), - trk.hasTRD(), - trk.hasITS(), - trk.hasTPC(), - trk.isGlobalTrack(), - trk.isGlobalTrackWoDCA(), - trk.isGlobalTrackWoPtEta(), - trk.flags(), - trk.trackType(), - trk.length(), - trk.tpcChi2NCl(), trk.itsChi2NCl(), trk.tofChi2(), - trk.tpcNClsShared(), - trk.tpcNClsFindable(), - trk.tpcNClsFindableMinusFound(), - trk.tpcNClsFindableMinusCrossedRows(), - trk.itsClusterMap(), - trk.itsNCls(), - trk.tpcFractionSharedCls(), - trk.tpcNClsFound(), - trk.tpcNClsCrossedRows(), - trk.tpcCrossedRowsOverFindableCls(), - trk.tpcFoundOverFindableCls(), - trk.dcaXY(), - trk.dcaZ()); + auto tracksInCollision = tracks.sliceBy(trackPerColl, collision.globalIndex()); + tableColl(collision.globalIndex(), + collision.collisionTime(), + collision.numContrib(), + collision.posX(), + collision.posY(), + collision.posZ(), + collision.sel8(), + tracksInCollision.size(), + collision.multNTracksPV(), + collision.multFT0A(), + collision.multFT0C(), + collision.centFT0A(), + collision.centFT0C(), + collision.bc().runNumber()); + tableTrack.reserve(tracks.size()); + for (const auto& trk : tracksInCollision) { + if (!customTrackCuts.IsSelected(trk)) { + continue; + } else { + tableTrack(trk.collisionId(), + trk.trackTime(), + trk.signed1Pt(), trk.eta(), trk.phi(), trk.pt(), + trk.sigma1Pt(), + trk.alpha(), + trk.x(), trk.y(), trk.z(), + trk.snp(), + trk.tgl(), + trk.isPVContributor(), + trk.hasTRD(), + trk.hasITS(), + trk.hasTPC(), + trk.isGlobalTrack(), + trk.isGlobalTrackWoDCA(), + trk.isGlobalTrackWoPtEta(), + trk.flags(), + trk.trackType(), + trk.length(), + trk.tpcChi2NCl(), trk.itsChi2NCl(), trk.tofChi2(), + trk.tpcNClsShared(), + trk.tpcNClsFindable(), + trk.tpcNClsFindableMinusFound(), + trk.tpcNClsFindableMinusCrossedRows(), + trk.itsClusterMap(), + trk.itsNCls(), + trk.tpcFractionSharedCls(), + trk.tpcNClsFound(), + trk.tpcNClsCrossedRows(), + trk.tpcCrossedRowsOverFindableCls(), + trk.tpcFoundOverFindableCls(), + trk.dcaXY(), + trk.dcaZ()); + } + } } } } diff --git a/PWGJE/Tasks/jetvalidationqa.cxx b/PWGJE/Tasks/jetvalidationqa.cxx index f8161f01532..c9dcd9cb8a4 100644 --- a/PWGJE/Tasks/jetvalidationqa.cxx +++ b/PWGJE/Tasks/jetvalidationqa.cxx @@ -11,21 +11,6 @@ /// /// \author Johanna Lömker // \since Dec 2022 -////////////////=============================================//////////////// -// TODO's: -//============== 1)template in mcJetTrackCollisionQa to validate JetMatching ! -// loop over matched jets -// make additional TH2F's for matched jets in pt, phi, eta (just what i did for the ones for tracks and collisions) -// i) with mcrec vs mcpart -// ii)with (mcrec-mcpart)/mcpart as function of mcpart -// -//============== 2) Add processes for: -// i) processRun3AOD, process ESD: Full (doesn't work yet) and Neutral Jets -// ii)processMcRun3, processMcRun2: Full (doesn't work yet) and Neutral Jets -// -//============== 3) prepare plotting macros for Run3 and MCrun2, MCrun3 ! -// -////////////////=============================================//////////////// #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" diff --git a/PWGJE/Tasks/trackJetqa.cxx b/PWGJE/Tasks/trackJetqa.cxx index 03c6a168120..9477f88d66e 100644 --- a/PWGJE/Tasks/trackJetqa.cxx +++ b/PWGJE/Tasks/trackJetqa.cxx @@ -10,11 +10,11 @@ // or submit itself to any jurisdiction. /// \author Alice Caluisi -// \since July 2023 - -// -// Task producing jet tracking qa histograms -// +/// \since July 2023 +/// \author Johanna Lömker +/// \since 2023-10-02 +/// \brief Task producing jet tracking qa histograms +/// #include #include "Framework/AnalysisDataModel.h" @@ -61,160 +61,173 @@ struct TrackJetQa { Configurable minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.7f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; Configurable maxChi2PerClusterTPC{"maxChi2PerClusterTPC", 7.f, "Additional cut on the maximum value of the chi2 per cluster in the TPC"}; Configurable maxChi2PerClusterITS{"maxChi2PerClusterITS", 36.f, "Additional cut on the maximum value of the chi2 per cluster in the ITS"}; - Configurable maxDcaXYFactor{"maxDcaXYFactor", 1.f, "Additional cut on the maximum value of the DCA xy (multiplicative factor)"}; + Configurable maxDcaXY{"maxDcaXY", 0.25f, "Cut on the maximum value of the DCA xy "}; Configurable maxDcaZ{"maxDcaZ", 3.f, "Additional cut on the maximum value of the DCA z"}; Configurable minTPCNClsFound{"minTPCNClsFound", 0.f, "Additional cut on the minimum value of the number of found clusters in the TPC"}; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - Configurable nBins{"nBins", 200, "N bins in histos"}; - ConfigurableAxis binsMultiplicity{"binsMultiplicity", {100, 0, 100}, "Binning for multiplicity"}; + ConfigurableAxis binsMultiplicity{"binsMultiplicity", {2000, 0, 2000}, "Binning for multiplicity"}; + ConfigurableAxis binsMultPV{"binsMultNTracksPV", {10000, 0, 50000}, "Binning for the multNTracksPV axis"}; ConfigurableAxis binsPercentile{"binsPercentile", {100, 0, 100}, "Binning for percentiles"}; + ConfigurableAxis binsVtx{"binsVtx", {200, -20, 20}, "Binning for the vertex position z axis"}; ConfigurableAxis binsPt{"binsPt", {200, 0, 200}, "Binning for the pT axis"}; - ConfigurableAxis binsSigma1OverPt{"binsSigma1OverPt", {200, 0, 200}, "Binning for the sigma 1 over pT"}; + ConfigurableAxis binsSigma1OverPt{"binsSigma1OverPt", {100, 0, 1}, "Binning for the sigma 1 over pT * pT"}; + ConfigurableAxis binsPhi{"binsPhi", {180, 0, 2 * M_PI}, "Binning for the phi axis"}; + ConfigurableAxis binsEta{"binsEta", {100, -1, 1}, "Binning for the eta axis"}; + ConfigurableAxis binsTrackXY{"binsTrackXY", {100, -0.5, 0.5}, "Binning for the x and y track position at dca in local coordinate system axis"}; + ConfigurableAxis binsTrackZ{"binsTrackZ", {100, -11, 11}, "Binning for the z track position at dca in local coordinate system axis"}; + ConfigurableAxis binsRot{"binsRot", {36, -M_PI, M_PI}, "Binning for the rotation angle axis"}; + ConfigurableAxis binsSignedPt{"binsSignedPt", {200, -8, 8}, "Binning for the q over pt axis"}; + ConfigurableAxis binsDcaXY{"binsDcaXY", {100, -0.5, 0.5}, "Binning for the dcaXY axis"}; + ConfigurableAxis binsDcaZ{"binsDcaZ", {100, -5, 5}, "Binning for the dcaXY axis"}; + ConfigurableAxis binsLength{"binsLength", {200, 0, 1000}, "Binning for the track length axis"}; void init(o2::framework::InitContext&) { - // Custom track cuts - LOG(info) << "Using custom track cuts from values:"; - LOG(info) << "\trequireITS=" << requireITS.value; - LOG(info) << "\trequireTPC=" << requireTPC.value; - LOG(info) << "\trequireGoldenChi2=" << requireGoldenChi2.value; - LOG(info) << "\tmaxChi2PerClusterTPC=" << maxChi2PerClusterTPC.value; - LOG(info) << "\tminNCrossedRowsTPC=" << minNCrossedRowsTPC.value; - LOG(info) << "\tminTPCNClsFound=" << minTPCNClsFound.value; - LOG(info) << "\tmaxChi2PerClusterITS=" << maxChi2PerClusterITS.value; - LOG(info) << "\tRequireHitsInITSLayers=" << maxChi2PerClusterITS.value; - LOG(info) << "\tmaxDcaZ=" << maxDcaZ.value; - LOG(info) << "\tminPt=" << minPt.value; - LOG(info) << "\tmaxPt=" << maxPt.value; - LOG(info) << "\tmaxEta=" << ValCutEta.value; + if (customTrack) { + // Custom track cuts + LOG(info) << "Using custom track cuts from values:"; + LOG(info) << "\trequireITS=" << requireITS.value; + LOG(info) << "\trequireTPC=" << requireTPC.value; + LOG(info) << "\trequireGoldenChi2=" << requireGoldenChi2.value; + LOG(info) << "\tmaxChi2PerClusterTPC=" << maxChi2PerClusterTPC.value; + LOG(info) << "\tminNCrossedRowsTPC=" << minNCrossedRowsTPC.value; + LOG(info) << "\tminTPCNClsFound=" << minTPCNClsFound.value; + LOG(info) << "\tmaxChi2PerClusterITS=" << maxChi2PerClusterITS.value; + LOG(info) << "\tRequireHitsInITSLayers=" << maxChi2PerClusterITS.value; + LOG(info) << "\tmaxDcaXY=" << maxDcaXY.value; + LOG(info) << "\tmaxDcaZ=" << maxDcaZ.value; + LOG(info) << "\tminPt=" << minPt.value; + LOG(info) << "\tmaxPt=" << maxPt.value; + LOG(info) << "\tmaxEta=" << ValCutEta.value; - customTrackCuts = getGlobalTrackSelectionRun3ITSMatch(itsPattern.value); - LOG(info) << "Customizing track cuts:"; - customTrackCuts.SetEtaRange(-ValCutEta.value, ValCutEta.value); - customTrackCuts.SetPtRange(minPt.value, maxPt.value); - customTrackCuts.SetRequireITSRefit(requireITS.value); - customTrackCuts.SetRequireTPCRefit(requireTPC.value); - customTrackCuts.SetRequireGoldenChi2(requireGoldenChi2.value); - customTrackCuts.SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC.value); - customTrackCuts.SetMaxChi2PerClusterITS(maxChi2PerClusterITS.value); - customTrackCuts.SetMinNCrossedRowsTPC(minNCrossedRowsTPC.value); - customTrackCuts.SetMinNClustersTPC(minTPCNClsFound.value); - // customTrackCuts.SetRequireHitsInITSLayers(nHits.value, {0, 1}); // one hit in any SPD layer (#hits, {layer0, layer1,...}) - customTrackCuts.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value); - customTrackCuts.SetMaxDcaXYPtDep([](float pt) { return 10.f; }); // No DCAxy cut will be used, this is done via the member function of the task - customTrackCuts.SetMaxDcaZ(maxDcaZ.value); - customTrackCuts.print(); - - // kinetic histograms - histos.add("Kine/pt", "#it{p}_{T};#it{p}_{T} [GeV/c];number of entries", HistType::kTH1F, {{nBins, 0, 200}}); - histos.add("Kine/pt_TRD", "#it{p}_{T} if track has a TRD match;#it{p}_{T} [GeV/c];number of entries", HistType::kTH1F, {{nBins, 0, 200}}); - histos.add("Kine/eta", "#eta;#it{p}_{T} [GeV/c];#eta", {HistType::kTH2F, {{nBins, 0, 200}, {180, -0.9, 0.9}}}); - histos.add("Kine/phi", "#phi;#it{p}_{T} [GeV/c];#phi [rad]", {HistType::kTH2F, {{nBins, 0, 200}, {180, 0., 2 * M_PI}}}); - histos.add("Kine/etaVSphi", "#eta VS phi;#eta;#phi [rad]", {HistType::kTH2F, {{180, -0.9, 0.9}, {180, 0., 2 * M_PI}}}); - histos.add("Kine/EtaPhiPt", "Correlation of #eta, #phi and #it{p}_{T}; #it{p}_{T} [GeV/c]; #eta; #phi [rad]", {HistType::kTH3F, {{nBins, 0, 200}, {180, -0.9, 0.9}, {180, 0., 2 * M_PI}}}); - - // track parameter histograms - histos.add("TrackPar/x", "track #it{x} position at dca in local coordinate system;#it{p}_{T} [GeV/c];#it{x} [cm]", {HistType::kTH2F, {{nBins, 0, 200}, {200, -0.36, 0.36}}}); - histos.add("TrackPar/y", "track #it{y} position at dca in local coordinate system;#it{p}_{T} [GeV/c];#it{y} [cm]", {HistType::kTH2F, {{nBins, 0, 200}, {200, -0.5, 0.5}}}); - histos.add("TrackPar/z", "track #it{z} position at dca in local coordinate system;#it{p}_{T} [GeV/c];#it{z} [cm]", {HistType::kTH2F, {{nBins, 0, 200}, {200, -11., 11.}}}); - histos.add("TrackPar/alpha", "rotation angle of local wrt. global coordinate system;#it{p}_{T} [GeV/c];#alpha [rad]", {HistType::kTH2F, {{nBins, 0, 200}, {36, -M_PI, M_PI}}}); - histos.add("TrackPar/signed1Pt", "track signed 1/#it{p}_{T};#it{p}_{T} [GeV/c];#it{q}/#it{p}_{T}", {HistType::kTH2F, {{nBins, 0, 200}, {200, -8, 8}}}); - histos.add("TrackPar/snp", "sinus of track momentum azimuthal angle;#it{p}_{T} [GeV/c];snp", {HistType::kTH2F, {{nBins, 0, 200}, {11, -0.1, 0.1}}}); - histos.add("TrackPar/tgl", "tangent of the track momentum dip angle;#it{p}_{T} [GeV/c];tgl;", {HistType::kTH2F, {{nBins, 0, 200}, {200, -1., 1.}}}); - histos.add("TrackPar/flags", "track flag;#it{p}_{T} [GeV/c];flag bit", {HistType::kTH2F, {{nBins, 0, 200}, {64, -0.5, 63.5}}}); - histos.add("TrackPar/dcaXY", "distance of closest approach in #it{xy} plane;#it{p}_{T} [GeV/c];#it{dcaXY} [cm];", {HistType::kTH2F, {{nBins, 0, 200}, {200, -0.15, 0.15}}}); - histos.add("TrackPar/dcaZ", "distance of closest approach in #it{z};#it{p}_{T} [GeV/c];#it{dcaZ} [cm];", {HistType::kTH2F, {{nBins, 0, 200}, {200, -0.15, 0.15}}}); - histos.add("TrackPar/length", "track length in cm;#it{p}_{T} [GeV/c];#it{Length} [cm];", {HistType::kTH2F, {{nBins, 0, 200}, {200, 0, 1000}}}); - histos.add("TrackPar/Sigma1Pt", "uncertainty over #it{p}_{T};#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_hasTRD", "uncertainty over #it{p}_{T} for tracks with TRD;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_hasNoTRD", "uncertainty over #it{p}_{T} for tracks without TRD;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_Layer1", "uncertainty over #it{p}_{T} with only 1st ITS layer active;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_Layer2", "uncertainty over #it{p}_{T} with only 2nd ITS layer active;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_Layers12", "uncertainty over #it{p}_{T} with only 1st and 2nd ITS layers active;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_Layer4", "uncertainty over #it{p}_{T} with only 4th ITS layer active;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_Layer5", "uncertainty over #it{p}_{T} with only 5th ITS layer active;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_Layer6", "uncertainty over #it{p}_{T} with only 6th ITS layer active;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_Layers45", "uncertainty over #it{p}_{T} with only 4th and 5th ITS layers active;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_Layers56", "uncertainty over #it{p}_{T} with only 5th and 6th ITS layers active;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_Layers46", "uncertainty over #it{p}_{T} with only 4th and 6th ITS layers active;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - histos.add("TrackPar/Sigma1Pt_Layers456", "uncertainty over #it{p}_{T} with only 4th, 5th and 6th ITS layers active;#it{p}_{T} [GeV/c];#it{p}_{T}*#it{sigma1}{p}_{T};", {HistType::kTH2F, {{nBins, 0, 200}, {100, 0, 1}}}); - - // event property histograms - histos.add("EventProp/collisionVtxZ", "Collsion Vertex Z;#it{Vtx}_{z} [cm];number of entries", HistType::kTH1F, {{nBins, -20, 20}}); - histos.add("EventProp/collisionVtxZnoSel", "Collsion Vertex Z without event selection;#it{Vtx}_{z} [cm];number of entries", HistType::kTH1F, {{nBins, -20, 20}}); - histos.add("EventProp/collisionVtxZSel8", "Collsion Vertex Z with event selection;#it{Vtx}_{z} [cm];number of entries", HistType::kTH1F, {{nBins, -20, 20}}); - histos.add("EventProp/rejectedCollId", "CollisionId of collisions that did not pass the event selection; collisionId; number of entries", HistType::kTH1F, {{10, 0, 5}}); + customTrackCuts = getGlobalTrackSelectionRun3ITSMatch(itsPattern.value); + LOG(info) << "Customizing track cuts:"; + customTrackCuts.SetEtaRange(-ValCutEta.value, ValCutEta.value); + customTrackCuts.SetPtRange(minPt.value, maxPt.value); + customTrackCuts.SetRequireITSRefit(requireITS.value); + customTrackCuts.SetRequireTPCRefit(requireTPC.value); + customTrackCuts.SetRequireGoldenChi2(requireGoldenChi2.value); + customTrackCuts.SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC.value); + customTrackCuts.SetMaxChi2PerClusterITS(maxChi2PerClusterITS.value); + customTrackCuts.SetMinNCrossedRowsTPC(minNCrossedRowsTPC.value); + customTrackCuts.SetMinNClustersTPC(minTPCNClsFound.value); + // customTrackCuts.SetRequireHitsInITSLayers(nHits.value, {0, 1}); // one hit in any SPD layer (#hits, {layer0, layer1,...}) + customTrackCuts.SetMinNCrossedRowsOverFindableClustersTPC(minNCrossedRowsOverFindableClustersTPC.value); + customTrackCuts.SetMaxDcaXY(maxDcaXY.value); + customTrackCuts.SetMaxDcaZ(maxDcaZ.value); + customTrackCuts.print(); + } + if (globalTrack) { + LOG(info) << "Using globalTracks"; + } + if (globalTrackWoPtEta) { + LOG(info) << "Using globalTracksWoPtEta"; + } + if (globalTrackWoDCA) { + LOG(info) << "Using globalTracksWoDCA"; + } else { + LOG(info) << "No trackselection enabled !"; + } // Common axes const AxisSpec axisPercentileFT0M{binsPercentile, "Centrality FT0M"}; const AxisSpec axisPercentileFT0A{binsPercentile, "Centrality FT0A"}; const AxisSpec axisPercentileFT0C{binsPercentile, "Centrality FT0C"}; - const AxisSpec axisMultiplicityPV{binsMultiplicity, "MultNTracksPV"}; + const AxisSpec axisMultiplicityPV{binsMultPV, "Multiplicity N TracksPV"}; + const AxisSpec axisMultiplicityTracks{binsMultiplicity, "Multiplicity tracks.size()"}; const AxisSpec axisMultiplicityFT0M{binsMultiplicity, "Multiplicity FT0M"}; const AxisSpec axisMultiplicityFT0A{binsMultiplicity, "Multiplicity FT0A"}; const AxisSpec axisMultiplicityFT0C{binsMultiplicity, "Multiplicity FT0C"}; + const AxisSpec axisVtx{binsVtx, "#it{Vtx}_{z} [cm]"}; const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec axisSigma1OverPt{binsSigma1OverPt, "#sigma(1/#it{p}_{T}) (GeV/#it{c})^{-1}"}; + const AxisSpec axisPhi{binsPhi, "#phi [rad]"}; + const AxisSpec axisEta{binsEta, " #eta"}; + const AxisSpec axisSigma1OverPt{binsSigma1OverPt, "#sigma(1/#it{p}_{T})*#it{p}_{T}"}; + const AxisSpec axisTrackX{binsTrackXY, "track #it{x} [cm]"}; + const AxisSpec axisTrackY{binsTrackXY, "track #it{y} [cm]"}; + const AxisSpec axisTrackZ{binsTrackZ, "track #it{z} [cm]"}; + const AxisSpec axisRotation{binsRot, "#alpha [rad]"}; + const AxisSpec axisSignedPt{binsSignedPt, "#it{q}/#it{p}_{T}"}; + const AxisSpec axisDcaXY{binsDcaXY, "#it{dcaXY} [cm]"}; + const AxisSpec axisDcaZ{binsDcaZ, "#it{dcaZ} [cm]"}; + const AxisSpec axisTrackLength{binsLength, "#it{Length} [cm]"}; - histos.add("Centrality/FT0M", "CentFT0M", HistType::kTH1D, {axisPercentileFT0M}); - histos.add("Centrality/FT0A", "CentFT0A", HistType::kTH1D, {axisPercentileFT0A}); - histos.add("Centrality/FT0C", "CentFT0C", HistType::kTH1D, {axisPercentileFT0C}); - histos.add("Mult/NTracksPV", "MultNTracksPV", HistType::kTH1D, {axisMultiplicityPV}); - histos.add("Mult/FT0M", "MultFT0M", HistType::kTH1D, {axisMultiplicityFT0M}); - histos.add("Mult/FT0A", "MultFT0A", HistType::kTH1D, {axisMultiplicityFT0A}); - histos.add("Mult/FT0C", "MultFT0C", HistType::kTH1D, {axisMultiplicityFT0C}); - histos.add("Mult/MultCorrelations", "MultCorrelations", HistType::kTHnSparseD, {axisPercentileFT0A, axisPercentileFT0C, axisMultiplicityFT0A, axisMultiplicityFT0C, axisMultiplicityPV}); + // event property histograms + histos.add("EventProp/collisionVtxZ", "Collsion Vertex Z position", HistType::kTHnSparseD, {axisVtx, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("EventProp/collisionVtxZnoSel", "Collsion Vertex Z position without event selection", HistType::kTHnSparseD, {axisVtx, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("EventProp/collisionVtxZSel8", "Collsion Vertex Z position with event selection", HistType::kTHnSparseD, {axisVtx, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("EventProp/rejectedCollId", "CollisionId of collisions that did not pass the event selection; collisionId; number of entries", HistType::kTH1F, {{10, 0, 5}}); + histos.add("EventProp/MultCorrelations", "Multiplicity and Centrality Correlations", HistType::kTHnSparseD, {axisPercentileFT0A, axisPercentileFT0C, axisPercentileFT0M, axisMultiplicityFT0A, axisMultiplicityFT0C, axisMultiplicityFT0M, axisMultiplicityPV, axisMultiplicityTracks}); + + histos.add("TrackEventPar/MultCorrelations", "Sigma1Pt*pT vs Multiplicity and Centrality Correlations", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C, axisPercentileFT0M, axisMultiplicityFT0A, axisMultiplicityFT0C, axisMultiplicityFT0M, axisMultiplicityPV, axisMultiplicityTracks}); + + // kinetic histograms + histos.add("Kine/pt", "#it{p}_{T}", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("Kine/pt_TRD", "#it{p}_{T} if track has a TRD match", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("Kine/EtaPhiPt", "Correlation of #eta #phi and #it{p}_{T}", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisEta, axisPhi, axisPercentileFT0A, axisPercentileFT0C}); - histos.add("TrackEventPar/Sigma1PtFT0Mcent", "Sigma1Pt vs pT vs FT0M centrality", HistType::kTHnSparseD, {axisPercentileFT0M, axisPt, axisSigma1OverPt}); - histos.add("TrackEventPar/Sigma1PtFT0Mmult", "Sigma1Pt vs pT vs FT0A,C multiplicity", HistType::kTHnSparseD, {axisMultiplicityFT0M, axisPt, axisSigma1OverPt}); - histos.add("TrackEventPar/Sigma1PtNTracksPV", "Sigma1Pt vs pT vs NTracksPV", HistType::kTHnSparseD, {axisMultiplicityPV, axisPt, axisSigma1OverPt}); - histos.add("TrackEventPar/MultCorrelations", "Sigma1Pt vs pT vs MultCorrelations", HistType::kTHnSparseD, {axisSigma1OverPt, axisPt, axisPercentileFT0A, axisPercentileFT0C, axisMultiplicityFT0A, axisMultiplicityFT0C, axisMultiplicityPV}); + // track parameter histograms - add sigma 1pt to all of them ! then cp this part to below + histos.add("TrackPar/xyz", "track #it{x}, #it{y}, #it{z} position at dca in local coordinate system", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisTrackX, axisTrackY, axisTrackZ, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/alpha", "rotation angle of local wrt. global coordinate system", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisRotation, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/signed1Pt", "track signed 1/#it{p}_{T}", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisSignedPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/snp", "sinus of track momentum azimuthal angle (snp)", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {11, -0.05, 0.5, "snp"}, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/tgl", "tangent of the track momentum dip angle (tgl)", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {200, -1., 1., "tgl"}, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/flags", "track flag;#it{p}_{T} [GeV/c];flag bit", {HistType::kTH2F, {{200, 0, 200}, {64, -0.5, 63.5}}}); + histos.add("TrackPar/dcaXY", "distance of closest approach in #it{xy} plane", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisDcaXY, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/dcaZ", "distance of closest approach in #it{z}", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisDcaZ, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/length", "track length in cm", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisTrackLength, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt", "uncertainty over #it{p}_{T}", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_hasTRD", "uncertainty over #it{p}_{T} for tracks with TRD", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_hasNoTRD", "uncertainty over #it{p}_{T} for tracks without TRD", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_Layer1", "uncertainty over #it{p}_{T} with only 1st ITS layer active", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_Layer2", "uncertainty over #it{p}_{T} with only 2nd ITS layer active", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_Layers12", "uncertainty over #it{p}_{T} with only 1st and 2nd ITS layers active", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_Layer4", "uncertainty over #it{p}_{T} with only 4th ITS layer active", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_Layer5", "uncertainty over #it{p}_{T} with only 5th ITS layer active", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_Layer6", "uncertainty over #it{p}_{T} with only 6th ITS layer active", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_Layers45", "uncertainty over #it{p}_{T} with only 4th and 5th ITS layers active", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_Layers56", "uncertainty over #it{p}_{T} with only 5th and 6th ITS layers active", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_Layers46", "uncertainty over #it{p}_{T} with only 4th and 6th ITS layers active", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TrackPar/Sigma1Pt_Layers456", "uncertainty over #it{p}_{T} with only 4th, 5th and 6th ITS layers active", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, axisPercentileFT0A, axisPercentileFT0C}); // ITS histograms - histos.add("ITS/itsNCls", "number of found ITS clusters", {HistType::kTH2F, {axisPt, {8, -0.5, 7.5, "# clusters ITS"}}}); - histos.add("ITS/itsChi2NCl", "chi2 per ITS cluster", {HistType::kTH2F, {axisPt, {100, 0, 40, "chi2 / cluster ITS"}}}); - histos.add("ITS/itsHits", "hitmap ITS", {HistType::kTH2F, {axisPt, {7, -0.5, 6.5, "layer ITS"}}}); + histos.add("ITS/itsNCls", "number of found ITS clusters", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {8, -0.5, 7.5, "# clusters ITS"}, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("ITS/itsChi2NCl", "chi2 per ITS cluster", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {100, 0, 40, "chi2 / cluster ITS"}, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("ITS/itsHits", "hitmap ITS", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {7, -0.5, 6.5, "layer ITS"}, axisPercentileFT0A, axisPercentileFT0C}); // TPC histograms - histos.add("TPC/tpcNClsFindable", "number of findable TPC clusters", {HistType::kTH2F, {axisPt, {165, -0.5, 164.5, "# findable clusters TPC"}}}); - histos.add("TPC/tpcNClsFound", "number of found TPC clusters", {HistType::kTH2F, {axisPt, {165, -0.5, 164.5, "# clusters TPC"}}}); - histos.add("TPC/tpcNClsShared", "number of shared TPC clusters", {HistType::kTH2F, {axisPt, {165, -0.5, 164.5, "# shared clusters TPC"}}}); - histos.add("TPC/tpcNClsCrossedRows", "number of crossed TPC rows", {HistType::kTH2F, {axisPt, {165, -0.5, 164.5, "# crossed rows TPC"}}}); - histos.add("TPC/tpcFractionSharedCls", "fraction of shared TPC clusters", {HistType::kTH2F, {axisPt, {100, 0., 1., "fraction shared clusters TPC"}}}); - histos.add("TPC/tpcCrossedRowsOverFindableCls", "crossed TPC rows over findable clusters", {HistType::kTH2F, {axisPt, {120, 0.0, 1.2, "crossed rows / findable clusters TPC"}}}); - histos.add("TPC/tpcChi2NCl", "chi2 per cluster in TPC", {HistType::kTH2F, {axisPt, {100, 0, 10, "chi2 / cluster TPC"}}}); + histos.add("TPC/tpcNClsFindable", "number of findable TPC clusters", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {165, -0.5, 164.5, "# findable clusters TPC"}, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TPC/tpcNClsFound", "number of found TPC clusters", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {165, -0.5, 164.5, "# clusters TPC"}, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TPC/tpcNClsShared", "number of shared TPC clusters", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {165, -0.5, 164.5, "# shared clusters TPC"}, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TPC/tpcNClsCrossedRows", "number of crossed TPC rows", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {165, -0.5, 164.5, "# crossed rows TPC"}, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TPC/tpcFractionSharedCls", "fraction of shared TPC clusters", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {100, 0., 1., "fraction shared clusters TPC"}, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TPC/tpcCrossedRowsOverFindableCls", "crossed TPC rows over findable clusters", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {120, 0.0, 1.2, "crossed rows / findable clusters TPC"}, axisPercentileFT0A, axisPercentileFT0C}); + histos.add("TPC/tpcChi2NCl", "chi2 per cluster in TPC", HistType::kTHnSparseD, {axisPt, axisSigma1OverPt, {100, 0, 10, "chi2 / cluster TPC"}, axisPercentileFT0A, axisPercentileFT0C}); histos.print(); } template - bool fillEventQa(eventInfo const& collision) + bool checkEventSelection(eventInfo const& collision) { // fill event property variables - histos.fill(HIST("EventProp/collisionVtxZnoSel"), collision.posZ()); + histos.fill(HIST("EventProp/collisionVtxZnoSel"), collision.posZ(), collision.centFT0A(), collision.centFT0C()); if (!collision.sel8()) { histos.fill(HIST("EventProp/rejectedCollId"), 2); return false; } - histos.fill(HIST("EventProp/collisionVtxZSel8"), collision.posZ()); + histos.fill(HIST("EventProp/collisionVtxZSel8"), collision.posZ(), collision.centFT0A(), collision.centFT0C()); if (fabs(collision.posZ()) > ValVtx) { histos.fill(HIST("EventProp/rejectedCollId"), 3); return false; } - histos.fill(HIST("EventProp/collisionVtxZ"), collision.posZ()); - if (fillMultiplicity) { - histos.fill(HIST("Centrality/FT0A"), collision.centFT0A()); - histos.fill(HIST("Centrality/FT0C"), collision.centFT0C()); - histos.fill(HIST("Mult/NTracksPV"), collision.multNTracksPV()); - histos.fill(HIST("Mult/FT0A"), collision.multFT0A()); - histos.fill(HIST("Mult/FT0C"), collision.multFT0C()); - } + histos.fill(HIST("EventProp/collisionVtxZ"), collision.posZ(), collision.centFT0A(), collision.centFT0C()); return true; } template - bool fillTrackQa(Tracks const& track) + bool checkTrackSelection(Tracks const& track) { // check track selection if ((globalTrack == true) && (!track.isGlobalTrack())) { @@ -229,36 +242,37 @@ struct TrackJetQa { if ((customTrack == true) && (!customTrackCuts.IsSelected(track))) { return false; } + return true; + } + + template + void fillTrackQa(Tracks const& track, eventInfo const& collision) + { // fill kinematic variables - histos.fill(HIST("Kine/pt"), track.pt()); + histos.fill(HIST("Kine/pt"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); if (track.hasTRD()) { - histos.fill(HIST("Kine/pt_TRD"), track.pt()); - histos.fill(HIST("TrackPar/Sigma1Pt_hasTRD"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("Kine/pt_TRD"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TrackPar/Sigma1Pt_hasTRD"), track.pt(), track.sigma1Pt() * track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } if (!track.hasTRD()) { - histos.fill(HIST("TrackPar/Sigma1Pt_hasNoTRD"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/Sigma1Pt_hasNoTRD"), track.pt(), track.sigma1Pt() * track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } - histos.fill(HIST("Kine/eta"), track.pt(), track.eta()); - histos.fill(HIST("Kine/phi"), track.pt(), track.phi()); - histos.fill(HIST("Kine/etaVSphi"), track.eta(), track.phi()); - histos.fill(HIST("Kine/EtaPhiPt"), track.pt(), track.eta(), track.phi()); + histos.fill(HIST("Kine/EtaPhiPt"), track.pt(), track.sigma1Pt() * track.pt(), track.eta(), track.phi(), collision.centFT0A(), collision.centFT0C()); // fill track parameter variables - histos.fill(HIST("TrackPar/alpha"), track.pt(), track.alpha()); - histos.fill(HIST("TrackPar/x"), track.pt(), track.x()); - histos.fill(HIST("TrackPar/y"), track.pt(), track.y()); - histos.fill(HIST("TrackPar/z"), track.pt(), track.z()); - histos.fill(HIST("TrackPar/signed1Pt"), track.pt(), track.signed1Pt()); - histos.fill(HIST("TrackPar/snp"), track.pt(), track.snp()); - histos.fill(HIST("TrackPar/tgl"), track.pt(), track.tgl()); + histos.fill(HIST("TrackPar/alpha"), track.pt(), track.sigma1Pt() * track.pt(), track.alpha(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TrackPar/xyz"), track.pt(), track.sigma1Pt() * track.pt(), track.x(), track.y(), track.z(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TrackPar/signed1Pt"), track.pt(), track.sigma1Pt() * track.pt(), track.signed1Pt(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TrackPar/snp"), track.pt(), track.sigma1Pt() * track.pt(), track.snp(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TrackPar/tgl"), track.pt(), track.sigma1Pt() * track.pt(), track.tgl(), collision.centFT0A(), collision.centFT0C()); for (unsigned int i = 0; i < 64; i++) { if (track.flags() & (1 << i)) { - histos.fill(HIST("TrackPar/flags"), track.pt(), i); + histos.fill(HIST("TrackPar/flags"), track.pt(), track.sigma1Pt() * track.pt(), i); } } - histos.fill(HIST("TrackPar/dcaXY"), track.pt(), track.dcaXY()); - histos.fill(HIST("TrackPar/dcaZ"), track.pt(), track.dcaZ()); - histos.fill(HIST("TrackPar/length"), track.pt(), track.length()); - histos.fill(HIST("TrackPar/Sigma1Pt"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/dcaXY"), track.pt(), track.sigma1Pt() * track.pt(), track.dcaXY(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TrackPar/dcaZ"), track.pt(), track.sigma1Pt() * track.pt(), track.dcaZ(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TrackPar/length"), track.pt(), track.sigma1Pt() * track.pt(), track.length(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TrackPar/Sigma1Pt"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); //// check the uncertainty over pT activating several ITS layers bool firstLayerActive = track.itsClusterMap() & (1 << 0); bool secondLayerActive = track.itsClusterMap() & (1 << 1); @@ -266,58 +280,54 @@ struct TrackJetQa { bool fifthLayerActive = track.itsClusterMap() & (1 << 4); bool sixthLayerActive = track.itsClusterMap() & (1 << 5); if (firstLayerActive) { - histos.fill(HIST("TrackPar/Sigma1Pt_Layer1"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/Sigma1Pt_Layer1"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } if (secondLayerActive) { - histos.fill(HIST("TrackPar/Sigma1Pt_Layer2"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/Sigma1Pt_Layer2"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } if (firstLayerActive && secondLayerActive) { - histos.fill(HIST("TrackPar/Sigma1Pt_Layers12"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/Sigma1Pt_Layers12"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } if (fourthLayerActive) { - histos.fill(HIST("TrackPar/Sigma1Pt_Layer4"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/Sigma1Pt_Layer4"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } if (fifthLayerActive) { - histos.fill(HIST("TrackPar/Sigma1Pt_Layer5"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/Sigma1Pt_Layer5"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } if (sixthLayerActive) { - histos.fill(HIST("TrackPar/Sigma1Pt_Layer6"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/Sigma1Pt_Layer6"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } if (fourthLayerActive && fifthLayerActive) { - histos.fill(HIST("TrackPar/Sigma1Pt_Layers45"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/Sigma1Pt_Layers45"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } if (fifthLayerActive && sixthLayerActive) { - histos.fill(HIST("TrackPar/Sigma1Pt_Layers56"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/Sigma1Pt_Layers56"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } if (fourthLayerActive && sixthLayerActive) { - histos.fill(HIST("TrackPar/Sigma1Pt_Layers46"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/Sigma1Pt_Layers46"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } if (fourthLayerActive && fifthLayerActive && sixthLayerActive) { - histos.fill(HIST("TrackPar/Sigma1Pt_Layers456"), track.pt(), track.sigma1Pt() * track.pt()); + histos.fill(HIST("TrackPar/Sigma1Pt_Layers456"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C()); } // fill ITS variables - histos.fill(HIST("ITS/itsNCls"), track.pt(), track.itsNCls()); - histos.fill(HIST("ITS/itsChi2NCl"), track.pt(), track.itsChi2NCl()); + histos.fill(HIST("ITS/itsNCls"), track.pt(), track.sigma1Pt() * track.pt(), track.itsNCls(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("ITS/itsChi2NCl"), track.pt(), track.sigma1Pt() * track.pt(), track.itsChi2NCl(), collision.centFT0A(), collision.centFT0C()); for (unsigned int i = 0; i < 7; i++) { if (track.itsClusterMap() & (1 << i)) { - histos.fill(HIST("ITS/itsHits"), track.pt(), i); + histos.fill(HIST("ITS/itsHits"), track.pt(), track.sigma1Pt() * track.pt(), i, collision.centFT0A(), collision.centFT0C()); } } // fill TPC variables - histos.fill(HIST("TPC/tpcNClsFindable"), track.pt(), track.tpcNClsFindable()); - histos.fill(HIST("TPC/tpcNClsFound"), track.pt(), track.tpcNClsFound()); - histos.fill(HIST("TPC/tpcNClsShared"), track.pt(), track.tpcNClsShared()); - histos.fill(HIST("TPC/tpcNClsCrossedRows"), track.pt(), track.tpcNClsCrossedRows()); - histos.fill(HIST("TPC/tpcCrossedRowsOverFindableCls"), track.pt(), track.tpcCrossedRowsOverFindableCls()); - histos.fill(HIST("TPC/tpcFractionSharedCls"), track.pt(), track.tpcFractionSharedCls()); - histos.fill(HIST("TPC/tpcChi2NCl"), track.pt(), track.tpcChi2NCl()); - - return true; + histos.fill(HIST("TPC/tpcNClsFindable"), track.pt(), track.sigma1Pt() * track.pt(), track.tpcNClsFindable(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TPC/tpcNClsFound"), track.pt(), track.sigma1Pt() * track.pt(), track.tpcNClsFound(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TPC/tpcNClsShared"), track.pt(), track.sigma1Pt() * track.pt(), track.tpcNClsShared(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TPC/tpcNClsCrossedRows"), track.pt(), track.sigma1Pt() * track.pt(), track.tpcNClsCrossedRows(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TPC/tpcCrossedRowsOverFindableCls"), track.pt(), track.sigma1Pt() * track.pt(), track.tpcCrossedRowsOverFindableCls(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TPC/tpcFractionSharedCls"), track.pt(), track.sigma1Pt() * track.pt(), track.tpcFractionSharedCls(), collision.centFT0A(), collision.centFT0C()); + histos.fill(HIST("TPC/tpcChi2NCl"), track.pt(), track.sigma1Pt() * track.pt(), track.tpcChi2NCl(), collision.centFT0A(), collision.centFT0C()); } - // Preslice> trackPerColl = aod::track::collisionId; Preslice trackPerColl = aod::track::collisionId; - // SliceCache cacheTrk; using CollisionCandidate = soa::Join; using TrackCandidates = soa::Join; @@ -325,22 +335,14 @@ struct TrackJetQa { TrackCandidates const& tracks) { for (const auto& collision : collisions) { - if (fillEventQa(collision)) { - - if (fillMultiplicity) { - histos.fill(HIST("Centrality/FT0M"), collision.centFT0M()); - histos.fill(HIST("Mult/FT0M"), collision.multFT0M()); - histos.fill(HIST("Mult/MultCorrelations"), collision.centFT0A(), collision.centFT0C(), collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV()); - } - auto tracksInCollision = tracks.sliceBy(trackPerColl, collision.globalIndex()); - + auto tracksInCollision = tracks.sliceBy(trackPerColl, collision.globalIndex()); + if (checkEventSelection(collision)) { + histos.fill(HIST("EventProp/MultCorrelations"), collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.multFT0A(), collision.multFT0C(), collision.multFT0M(), collision.multNTracksPV(), tracksInCollision.size()); for (const auto& track : tracksInCollision) { - if (track.has_collision() && (collision.globalIndex() == track.collisionId())) { // double check - if (fillTrackQa(track)) { - if (fillMultiplicity) { - histos.fill(HIST("TrackEventPar/Sigma1PtFT0Mcent"), collision.centFT0M(), track.pt(), track.sigma1Pt()); - histos.fill(HIST("TrackEventPar/MultCorrelations"), track.sigma1Pt(), track.pt(), collision.centFT0A(), collision.centFT0C(), collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV()); - } + if (track.has_collision() && (collision.globalIndex() == track.collisionId())) { + if (checkTrackSelection(track)) { + histos.fill(HIST("TrackEventPar/MultCorrelations"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.multFT0A(), collision.multFT0C(), collision.multFT0M(), collision.multNTracksPV(), tracksInCollision.size()); + fillTrackQa(track, collision); } } } @@ -351,9 +353,25 @@ struct TrackJetQa { } PROCESS_SWITCH(TrackJetQa, processFull, "Standard data processor", true); - void processDerived(aod::JeTracks::iterator const& track) + void processDerived(aod::JeColls const& collisions, aod::JeTracks const& tracks) { - fillTrackQa(track); + for (const auto& collision : collisions) { + if (checkEventSelection(collision)) { + histos.fill(HIST("EventProp/MultCorrelations"), collision.centFT0A(), collision.centFT0C(), collision.centFT0A() + collision.centFT0C(), collision.multFT0A(), collision.multFT0C(), collision.multFT0A() + collision.multFT0C(), collision.multNTracksPV(), collision.multTracks()); + for (const auto& track : tracks) { + if (!(track.collisionId() == collision.globalIdx())) { + continue; + } + // LOGF(info, "Compatible Id's: %d (tracks) and %d (collisions)", track.collisionId(), collision.globalIdx()); + if (checkTrackSelection(track)) { + histos.fill(HIST("TrackEventPar/MultCorrelations"), track.pt(), track.sigma1Pt() * track.pt(), collision.centFT0A(), collision.centFT0C(), collision.centFT0A() + collision.centFT0C(), collision.multFT0A(), collision.multFT0C(), collision.multFT0A() + collision.multFT0C(), collision.multNTracksPV(), collision.multTracks()); + fillTrackQa(track, collision); + } + } + } else { + histos.fill(HIST("EventProp/rejectedCollId"), 1); + } + } } PROCESS_SWITCH(TrackJetQa, processDerived, "Derived data processor", false); }; From 3168c8e8373213f190ea6d9b735c2aff2ddb6991 Mon Sep 17 00:00:00 2001 From: Francesco Mazzaschi <43742195+fmazzasc@users.noreply.github.com> Date: Thu, 1 Feb 2024 10:26:30 +0100 Subject: [PATCH 27/33] Add DCA monitoring (#4543) --- PWGLF/Tasks/QC/lfITSTPCMatchingQA.cxx | 62 +++++++++++++++++---------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/PWGLF/Tasks/QC/lfITSTPCMatchingQA.cxx b/PWGLF/Tasks/QC/lfITSTPCMatchingQA.cxx index 247a702758e..9dc152e0935 100644 --- a/PWGLF/Tasks/QC/lfITSTPCMatchingQA.cxx +++ b/PWGLF/Tasks/QC/lfITSTPCMatchingQA.cxx @@ -56,6 +56,8 @@ struct lfmatchingqa { ConfigurableAxis momAxisFine{"momAxisFine", {2.e3, -5.f, 5.f}, "momentum axis binning"}; ConfigurableAxis momResAxis{"momResAxis", {2.e2, -2.f, 2.f}, "momentum resolution binning"}; ConfigurableAxis tpcAxis{"tpcAxis", {4e3, 0.f, 4.e3f}, "tpc signal axis binning"}; + ConfigurableAxis dcaAxis{"dcaAxis", {100, -0.1f, 0.1f}, "dca axis binning"}; + ConfigurableAxis itsClusSizeAxis{"itsClusSizeAxis", {90, 1, 15}, "its cluster size axis binning"}; ConfigurableAxis trackingPidAxis{"trackingPidAxis", {static_cast(pidHypotheses.size()), 0, static_cast(pidHypotheses.size())}, "tracking pid hypothesis binning"}; // Cut values @@ -64,14 +66,14 @@ struct lfmatchingqa { Configurable ptMin{"ptMin", 0.05f, "minimum pT (GeV/c)"}; Configurable nClusITSCut{"nClusITSCut", 7, "Minimum number of ITS clusters"}; Configurable nClusTPCCut{"nClusTPCCut", 70, "Minimum number of TPC clusters"}; - Configurable dcaCut{"dcaCut", 0.05f, "DCA to PV"}; + Configurable dcaCut{"dcaCut", 0.1f, "DCA to PV"}; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; template bool selectTrack(T const& track) { - if (std::abs(track.eta()) > etaMax || track.pt() < ptMin) { + if (std::abs(track.eta()) > etaMax || track.pt() < ptMin || std::abs(track.dcaXY()) > dcaCut) { return false; } if (track.itsNCls() < nClusITSCut || @@ -107,11 +109,11 @@ struct lfmatchingqa { histos.add("tpcNsigmaDe", ";#it{p}_{TPC}; #it{p}_{GLO}; n#sigma_{TPC} (d)", {HistType::kTH3F, {momAxis, momAxis, tpcNsigmaAxis}}); histos.add("tpcNsigmaHe", ";#it{p}_{TPC}; #it{p}_{GLO}; n#sigma_{TPC} (He3)", {HistType::kTH3F, {momAxis, momAxis, tpcNsigmaAxis}}); - auto pidHypoPi = histos.add("pidHypoPi", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (#pi);", {HistType::kTH3F}, {momAxisFine, momResAxis, trackingPidAxis}); - auto pidHypoKa = histos.add("pidHypoKa", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (K);", {HistType::kTH3F}, {momAxisFine, momResAxis, trackingPidAxis}); - auto pidHypoPr = histos.add("pidHypoPr", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (p);", {HistType::kTH3F}, {momAxisFine, momResAxis, trackingPidAxis}); - auto pidHypoDe = histos.add("pidHypoDe", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (d);", {HistType::kTH3F}, {momAxisFine, momResAxis, trackingPidAxis}); - auto pidHypoHe = histos.add("pidHypoHe", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (He3);", {HistType::kTH3F}, {momAxisFine, momResAxis, trackingPidAxis}); + auto pidHypoPi = histos.add("pidHypoPi", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (#pi);", {HistType::kTH3F}, {momAxisFine, tpcNsigmaAxis, trackingPidAxis}); + auto pidHypoKa = histos.add("pidHypoKa", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (K);", {HistType::kTH3F}, {momAxisFine, tpcNsigmaAxis, trackingPidAxis}); + auto pidHypoPr = histos.add("pidHypoPr", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (p);", {HistType::kTH3F}, {momAxisFine, tpcNsigmaAxis, trackingPidAxis}); + auto pidHypoDe = histos.add("pidHypoDe", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (d);", {HistType::kTH3F}, {momAxisFine, tpcNsigmaAxis, trackingPidAxis}); + auto pidHypoHe = histos.add("pidHypoHe", ";#it{p}_{TPC} (GeV/#it{c}); n#sigma_{TPC} (He3);", {HistType::kTH3F}, {momAxisFine, tpcNsigmaAxis, trackingPidAxis}); for (int i{1}; i < pidHypoPi->GetNbinsZ() + 1; ++i) { pidHypoPi->GetZaxis()->SetBinLabel(i, pidHypotheses[i - 1].data()); pidHypoKa->GetZaxis()->SetBinLabel(i, pidHypotheses[i - 1].data()); @@ -120,17 +122,23 @@ struct lfmatchingqa { pidHypoHe->GetZaxis()->SetBinLabel(i, pidHypotheses[i - 1].data()); } - histos.add("momCorrPi", ";#it{p}_{TPC}; #it{p}_{GLO};#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); - histos.add("momCorrKa", ";#it{p}_{TPC}; #it{p}_{GLO};#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); - histos.add("momCorrPr", ";#it{p}_{TPC}; #it{p}_{GLO};#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); - histos.add("momCorrDe", ";#it{p}_{TPC}; #it{p}_{GLO};#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); - histos.add("momCorrHe", ";#it{p}_{TPC}; #it{p}_{GLO};#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); - - histos.add("itsClusSizePi", ";#it{p}_{TPC}; #it{p}_{GLO}; (#pi)", {HistType::kTH3F, {momAxis, momAxis, {10, 0, 10}}}); - histos.add("itsClusSizeKa", ";#it{p}_{TPC}; #it{p}_{GLO}; (K)", {HistType::kTH3F, {momAxis, momAxis, {10, 0, 10}}}); - histos.add("itsClusSizePr", ";#it{p}_{TPC}; #it{p}_{GLO}; (p)", {HistType::kTH3F, {momAxis, momAxis, {10, 0, 10}}}); - histos.add("itsClusSizeDe", ";#it{p}_{TPC}; #it{p}_{GLO}; (d)", {HistType::kTH3F, {momAxis, momAxis, {10, 0, 10}}}); - histos.add("itsClusSizeHe", ";#it{p}_{TPC}; #it{p}_{GLO}; (He3)", {HistType::kTH3F, {momAxis, momAxis, {10, 0, 10}}}); + histos.add("momCorrPi", ";#it{p}_{TPC} (GeV/#it{c}); #it{p}_{GLO} (GeV/#it{c});#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); + histos.add("momCorrKa", ";#it{p}_{TPC} (GeV/#it{c}); #it{p}_{GLO} (GeV/#it{c});#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); + histos.add("momCorrPr", ";#it{p}_{TPC} (GeV/#it{c}); #it{p}_{GLO} (GeV/#it{c});#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); + histos.add("momCorrDe", ";#it{p}_{TPC} (GeV/#it{c}); #it{p}_{GLO} (GeV/#it{c});#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); + histos.add("momCorrHe", ";#it{p}_{TPC} (GeV/#it{c}); #it{p}_{GLO} (GeV/#it{c});#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c})", {HistType::kTH3F, {momAxis, momAxis, momResAxis}}); + + histos.add("dcaPi", "; #it{p}_{GLO} (GeV/#it{c});#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c}); DCA_{xy} (cm)", {HistType::kTH3F, {momAxis, momResAxis, dcaAxis}}); + histos.add("dcaKa", "; #it{p}_{GLO} (GeV/#it{c});#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c}); DCA_{xy} (cm)", {HistType::kTH3F, {momAxis, momResAxis, dcaAxis}}); + histos.add("dcaPr", "; #it{p}_{GLO} (GeV/#it{c});#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c}); DCA_{xy} (cm)", {HistType::kTH3F, {momAxis, momResAxis, dcaAxis}}); + histos.add("dcaDe", "; #it{p}_{GLO} (GeV/#it{c});#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c}); DCA_{xy} (cm)", {HistType::kTH3F, {momAxis, momResAxis, dcaAxis}}); + histos.add("dcaHe", "; #it{p}_{GLO} (GeV/#it{c});#it{p}_{TPC} - #it{p}_{glo} (GeV/#it{c}); DCA_{xy} (cm)", {HistType::kTH3F, {momAxis, momResAxis, dcaAxis}}); + + histos.add("itsClusSizePi", ";#it{p}_{TPC} (GeV/#it{c}); #it{p}_{GLO} (GeV/#it{c}); x cos(#lambda) (#pi)", {HistType::kTH3F, {momAxis, momAxis, itsClusSizeAxis}}); + histos.add("itsClusSizeKa", ";#it{p}_{TPC} (GeV/#it{c}); #it{p}_{GLO} (GeV/#it{c}); x cos(#lambda) (K)", {HistType::kTH3F, {momAxis, momAxis, itsClusSizeAxis}}); + histos.add("itsClusSizePr", ";#it{p}_{TPC} (GeV/#it{c}); #it{p}_{GLO} (GeV/#it{c}); x cos(#lambda) (p)", {HistType::kTH3F, {momAxis, momAxis, itsClusSizeAxis}}); + histos.add("itsClusSizeDe", ";#it{p}_{TPC} (GeV/#it{c}); #it{p}_{GLO} (GeV/#it{c}); x cos(#lambda) (d)", {HistType::kTH3F, {momAxis, momAxis, itsClusSizeAxis}}); + histos.add("itsClusSizeHe", ";#it{p}_{TPC} (GeV/#it{c}); #it{p}_{GLO} (GeV/#it{c}); x cos(#lambda) (He3)", {HistType::kTH3F, {momAxis, momAxis, itsClusSizeAxis}}); } void process(soa::Join::iterator const& collision, TracksFull const& tracks, aod::BCs const&) @@ -186,25 +194,33 @@ struct lfmatchingqa { } // Filling the mom corr and cl sizes histograms (nSigma < 2 required) + // calculating cos(L) of the track + float cosL = 1 / std::sqrt(1.f + track.tgl() * track.tgl()); + if (abs(track.tpcNSigmaPi()) < 2) { histos.fill(HIST("momCorrPi"), signTPCMom, signGloMom, track.tpcInnerParam() - track.p()); - histos.fill(HIST("itsClusSizePi"), signTPCMom, signGloMom, getITSClSize(track)); + histos.fill(HIST("dcaPi"), signGloMom, track.tpcInnerParam() - track.p(), track.dcaXY()); + histos.fill(HIST("itsClusSizePi"), signTPCMom, signGloMom, getITSClSize(track) * cosL); } if (abs(track.tpcNSigmaKa()) < 2) { histos.fill(HIST("momCorrKa"), signTPCMom, signGloMom, track.tpcInnerParam() - track.p()); - histos.fill(HIST("itsClusSizeKa"), signTPCMom, signGloMom, getITSClSize(track)); + histos.fill(HIST("dcaKa"), signGloMom, track.tpcInnerParam() - track.p(), track.dcaXY()); + histos.fill(HIST("itsClusSizeKa"), signTPCMom, signGloMom, getITSClSize(track) * cosL); } if (abs(track.tpcNSigmaPr()) < 2) { histos.fill(HIST("momCorrPr"), signTPCMom, signGloMom, track.tpcInnerParam() - track.p()); - histos.fill(HIST("itsClusSizePr"), signTPCMom, signGloMom, getITSClSize(track)); + histos.fill(HIST("dcaPr"), signGloMom, track.tpcInnerParam() - track.p(), track.dcaXY()); + histos.fill(HIST("itsClusSizePr"), signTPCMom, signGloMom, getITSClSize(track) * cosL); } if (abs(tpcNSigmaDeu) < 2) { histos.fill(HIST("momCorrDe"), signTPCMom, signGloMom, track.tpcInnerParam() - track.p()); - histos.fill(HIST("itsClusSizeDe"), signTPCMom, signGloMom, getITSClSize(track)); + histos.fill(HIST("dcaDe"), signGloMom, track.tpcInnerParam() - track.p(), track.dcaXY()); + histos.fill(HIST("itsClusSizeDe"), signTPCMom, signGloMom, getITSClSize(track) * cosL); } if (abs(tpcNSigmaHe3) < 2) { histos.fill(HIST("momCorrHe"), signTPCMom, signGloMom, track.tpcInnerParam() - track.p()); - histos.fill(HIST("itsClusSizeHe"), signTPCMom, signGloMom, getITSClSize(track)); + histos.fill(HIST("dcaHe"), signGloMom, track.tpcInnerParam() - track.p(), track.dcaXY()); + histos.fill(HIST("itsClusSizeHe"), signTPCMom, signGloMom, getITSClSize(track) * cosL); } } } From e4c85d848fd2f426b2c31fa3854fec0eab31acd3 Mon Sep 17 00:00:00 2001 From: yuanzhe <90246048+wang-yuanzhe@users.noreply.github.com> Date: Thu, 1 Feb 2024 10:28:57 +0100 Subject: [PATCH 28/33] PWGLF: Change analysis procedure for hypertriton 3-body decay (#4538) * Merge data and MC analysis process * Code formatting * Merge 3-body decayed hypertirton matter and antimatter selections * Add MC production check for hypertirton in analysis process * Fix elseif position --- .../TableProducer/hypertriton3bodyfinder.cxx | 117 ++-- PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx | 488 +--------------- .../Tasks/Nuspex/hypertriton3bodyanalysis.cxx | 530 +++++++++++++----- 3 files changed, 442 insertions(+), 693 deletions(-) diff --git a/PWGLF/TableProducer/hypertriton3bodyfinder.cxx b/PWGLF/TableProducer/hypertriton3bodyfinder.cxx index 124dde6c847..9341c3d7bff 100644 --- a/PWGLF/TableProducer/hypertriton3bodyfinder.cxx +++ b/PWGLF/TableProducer/hypertriton3bodyfinder.cxx @@ -46,9 +46,7 @@ using namespace o2::framework::expressions; using std::array; using FullTracksExtIU = soa::Join; -using FullTracksExtMCIU = soa::Join; - -using LabeledTracks = soa::Join; +using MCLabeledFullTracksExtIU = soa::Join; template bool is3bodyDecayedH3L(TMCParticle const& particle) @@ -157,13 +155,13 @@ struct trackprefilter { // process function for MC d3body check // void processCheck(aod::Collision const& collision, aod::Decay3Bodys const& decay3bodys, void processCheck(aod::Decay3Bodys const& decay3bodys, - FullTracksExtMCIU const& tracks, aod::McParticles const& particlesMC) + MCLabeledFullTracksExtIU const& tracks, aod::McParticles const& particlesMC) { for (auto& d3body : decay3bodys) { registry.fill(HIST("h3bodyCounter"), 0.5); - auto lTrack0 = d3body.track0_as(); - auto lTrack1 = d3body.track1_as(); - auto lTrack2 = d3body.track2_as(); + auto lTrack0 = d3body.track0_as(); + auto lTrack1 = d3body.track1_as(); + auto lTrack2 = d3body.track2_as(); if (!lTrack0.has_mcParticle() || !lTrack1.has_mcParticle() || !lTrack2.has_mcParticle()) { continue; } @@ -485,7 +483,7 @@ struct hypertriton3bodyFinder { //------------------------------------------------------------------ // Check the info of good tracks template - void CheckGoodTracks(TGoodTrackTable const& dGoodtracks, aod::McParticles const& mcparticles) + void CheckGoodTracks(TGoodTrackTable const& dGoodtracks, aod::McParticles const& particlesMC) { for (auto& goodtrackid : dGoodtracks) { auto goodtrack = goodtrackid.template goodTrack_as(); @@ -605,7 +603,7 @@ struct hypertriton3bodyFinder { return true; } //------------------------------------------------------------------ - // 3body decay finder + // 3body decay vertex finder template void Decay3bodyFinder(TCollisionTable const& dCollision, TTrackTable const& dPtrack, TTrackTable const& dNtrack, TTrackTable const& dBachtrack, float const& rv0, bool isTrue3bodyVtx = false) { @@ -635,8 +633,7 @@ struct hypertriton3bodyFinder { } FillVtxCounter(kVtxhasSV, isTrue3bodyVtx); - int cand3B = 0; - const auto& vertexXYZ = fitter3body.getPCACandidatePos(cand3B); + const auto& vertexXYZ = fitter3body.getPCACandidatePos(); // make sure the cascade radius is smaller than that of the vertex float dxc = vertexXYZ[0] - dCollision.posX(), dyc = vertexXYZ[1] - dCollision.posY(), dzc = vertexXYZ[2] - dCollision.posZ(), r2vertex = dxc * dxc + dyc * dyc; float rvertex = std::sqrt(r2vertex); @@ -652,9 +649,9 @@ struct hypertriton3bodyFinder { return; } - auto& tr0 = fitter3body.getTrack(0, cand3B); - auto& tr1 = fitter3body.getTrack(1, cand3B); - auto& tr2 = fitter3body.getTrack(2, cand3B); + auto& tr0 = fitter3body.getTrack(0); + auto& tr1 = fitter3body.getTrack(1); + auto& tr2 = fitter3body.getTrack(2); std::array p0, p1, p2; tr0.getPxPyPzGlo(p0); tr1.getPxPyPzGlo(p1); @@ -700,7 +697,7 @@ struct hypertriton3bodyFinder { auto Track2dcaXY = dcaInfo[0]; // H3L DCA Check - // auto track3B = o2::track::TrackParCov(vertexXYZ, p3B, fitter3body.calcPCACovMatrixFlat(cand3B), t2.sign()); + // auto track3B = o2::track::TrackParCov(vertexXYZ, p3B, fitter3body.calcPCACovMatrixFlat(), t2.sign()); auto track3B = o2::track::TrackParCov(vertexXYZ, p3B, dBachtrack.sign()); o2::dataformats::DCA dca; if (d_UseH3LDCACut && (!track3B.propagateToDCA({{dCollision.posX(), dCollision.posY(), dCollision.posZ()}, {dCollision.covXX(), dCollision.covXY(), dCollision.covYY(), dCollision.covXZ(), dCollision.covYZ(), dCollision.covZZ()}}, fitter3body.getBz(), &dca, 5.) || @@ -717,7 +714,7 @@ struct hypertriton3bodyFinder { Track0dcaXY, Track1dcaXY, Track2dcaXY); } //------------------------------------------------------------------ - // 3body decay finder + // 3body decay finder for a collsion template void DecayFinder(TCollisionTable const& dCollision, TPosTrackTable const& dPtracks, TNegTrackTable const& dNtracks, TGoodTrackTable const& dGoodtracks) { @@ -741,7 +738,7 @@ struct hypertriton3bodyFinder { resetHistos(); } //------------------------------------------------------------------ - // MC 3body decay finder + // MC 3body decay vertex finder template void DecayFinderMC(TCollisionTable const& dCollision, TPosTrackTable const& dPtracks, TNegTrackTable const& dNtracks, TGoodTrackTable const& dGoodtracks) { @@ -873,18 +870,18 @@ struct hypertriton3bodyFinder { } PROCESS_SWITCH(hypertriton3bodyFinder, processCFFilteredData, "Produce StoredVtx3BodyDatas with data using CFtriggers", false); - void processMC(aod::Collision const& collision, aod::V0GoodPosTracks const& ptracks, aod::V0GoodNegTracks const& ntracks, aod::V0GoodTracks const& goodtracks, aod::McParticles const& mcparticles, FullTracksExtMCIU const&, aod::BCsWithTimestamps const&) + void processMC(aod::Collision const& collision, aod::V0GoodPosTracks const& ptracks, aod::V0GoodNegTracks const& ntracks, aod::V0GoodTracks const& goodtracks, aod::McParticles const& particlesMC, MCLabeledFullTracksExtIU const&, aod::BCsWithTimestamps const&) { auto bc = collision.bc_as(); initCCDB(bc); registry.fill(HIST("hEventCounter"), 0.5); - CheckGoodTracks(goodtracks, mcparticles); - DecayFinderMC(collision, ptracks, ntracks, goodtracks); + CheckGoodTracks(goodtracks, particlesMC); + DecayFinderMC(collision, ptracks, ntracks, goodtracks); } PROCESS_SWITCH(hypertriton3bodyFinder, processMC, "Produce StoredVtx3BodyDatas with MC", false); - void processCFFilteredMC(aod::Collisions const& collisions, aod::CFFilters const& cffilters, aod::V0GoodPosTracks const& Ptracks, aod::V0GoodNegTracks const& Ntracks, aod::V0GoodTracks const& Goodtracks, aod::V0s const& V0s, aod::V0Datas const& fullV0s, aod::McParticles const& mcparticles, FullTracksExtMCIU const&, aod::BCsWithTimestamps const&) + void processCFFilteredMC(aod::Collisions const& collisions, aod::CFFilters const& cffilters, aod::V0GoodPosTracks const& Ptracks, aod::V0GoodNegTracks const& Ntracks, aod::V0GoodTracks const& Goodtracks, aod::V0s const& V0s, aod::V0Datas const& fullV0s, aod::McParticles const& particlesMC, MCLabeledFullTracksExtIU const&, aod::BCsWithTimestamps const&) { for (int i{0}; i < collisions.size(); i++) { auto collision = collisions.iteratorAt(i); @@ -894,11 +891,11 @@ struct hypertriton3bodyFinder { registry.fill(HIST("hEventCounter"), 0.5); auto goodtracks = Goodtracks.sliceBy(perCollisionGoodTracks, collision.globalIndex()); - CheckGoodTracks(goodtracks, mcparticles); + CheckGoodTracks(goodtracks, particlesMC); auto v0s = V0s.sliceBy(perCollisionV0s, collision.globalIndex()); auto fullv0s = fullV0s.sliceBy(perCollisionV0Datas, collision.globalIndex()); - VirtualLambdaCheck(collision, v0s, 0); - VirtualLambdaCheck(collision, fullv0s, 3); + VirtualLambdaCheck(collision, v0s, 0); + VirtualLambdaCheck(collision, fullv0s, 3); if (!cffilter.hasLD() && UseCFFilter) { continue; @@ -908,9 +905,9 @@ struct hypertriton3bodyFinder { auto ptracks = Ptracks.sliceBy(perCollisionGoodPosTracks, collision.globalIndex()); auto ntracks = Ntracks.sliceBy(perCollisionGoodNegTracks, collision.globalIndex()); - VirtualLambdaCheck(collision, v0s, 6); - VirtualLambdaCheck(collision, fullv0s, 9); - DecayFinderMC(collision, ptracks, ntracks, goodtracks); + VirtualLambdaCheck(collision, v0s, 6); + VirtualLambdaCheck(collision, fullv0s, 9); + DecayFinderMC(collision, ptracks, ntracks, goodtracks); } } PROCESS_SWITCH(hypertriton3bodyFinder, processCFFilteredMC, "Produce StoredVtx3BodyDatas with MC using CFtriggers", false); @@ -960,7 +957,7 @@ struct hypertriton3bodyLabelBuilder { } PROCESS_SWITCH(hypertriton3bodyLabelBuilder, processDoNotBuildLabels, "Do not produce MC label tables", true); - void processBuildLabels(aod::Vtx3BodyDatas const& vtx3bodydatas, LabeledTracks const&, aod::McParticles const& particlesMC) + void processBuildLabels(aod::Vtx3BodyDatas const& vtx3bodydatas, MCLabeledFullTracksExtIU const&, aod::McParticles const& particlesMC) { std::vector lIndices; lIndices.reserve(vtx3bodydatas.size()); @@ -977,9 +974,9 @@ struct hypertriton3bodyLabelBuilder { bool is3bodyDecay = false; int lGlobalIndex = -1; - auto lTrack0 = vtx3body.track0_as(); - auto lTrack1 = vtx3body.track1_as(); - auto lTrack2 = vtx3body.track2_as(); + auto lTrack0 = vtx3body.track0_as(); + auto lTrack1 = vtx3body.track1_as(); + auto lTrack2 = vtx3body.track2_as(); registry.fill(HIST("hLabelCounter"), 0.5); // Association check @@ -1074,8 +1071,7 @@ struct hypertriton3bodyComparewithDecay3body { HistogramRegistry registry{ "registry", { - {"hTestCounter", "hTestCounter", {HistType::kTH1F, {{8, 0.0f, 8.0f}}}}, - {"hMotherCounter", "hMotherCounter", {HistType::kTH1F, {{10, 0.0f, 10.0f}}}}, + {"hMCInfoCounter", "hMCInfoCounter", {HistType::kTH1F, {{8, 0.0f, 8.0f}}}}, {"hCheckCounter", "hCheckCounter", {HistType::kTH1F, {{5, 0.0f, 5.0f}}}}, {"hHypertritonMCPtTotal", "hHypertritonMCPtTotal", {HistType::kTH1F, {{20, 0.0f, 10.0f}}}}, {"hHypertritonMCPt", "hHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, @@ -1112,64 +1108,46 @@ struct hypertriton3bodyComparewithDecay3body { } PROCESS_SWITCH(hypertriton3bodyComparewithDecay3body, processDoNotCompare, "Do not do comparison", true); - void processDoComparison(aod::Decay3Bodys const& decay3bodytable, soa::Join const& vtx3bodydatas, LabeledTracks const&, aod::McParticles const& particlesMC) + void processDoComparison(aod::Decay3Bodys const& decay3bodytable, soa::Join const& vtx3bodydatas, MCLabeledFullTracksExtIU const&, aod::McParticles const& particlesMC) { std::vector set_pair; for (auto d3body : decay3bodytable) { registry.fill(HIST("hCheckCounter"), 0.5); - registry.fill(HIST("hTestCounter"), 0.5); - auto lTrack0 = d3body.track0_as(); - auto lTrack1 = d3body.track1_as(); - auto lTrack2 = d3body.track2_as(); + registry.fill(HIST("hMCInfoCounter"), 0.5); + auto lTrack0 = d3body.track0_as(); + auto lTrack1 = d3body.track1_as(); + auto lTrack2 = d3body.track2_as(); if (!lTrack0.has_mcParticle() || !lTrack1.has_mcParticle() || !lTrack2.has_mcParticle()) { continue; } - registry.fill(HIST("hTestCounter"), 1.5); + registry.fill(HIST("hMCInfoCounter"), 1.5); auto lMCTrack0 = lTrack0.mcParticle_as(); auto lMCTrack1 = lTrack1.mcParticle_as(); auto lMCTrack2 = lTrack2.mcParticle_as(); - /*if (lMCTrack0.isPhysicalPrimary() || lMCTrack1.isPhysicalPrimary() || lMCTrack2.isPhysicalPrimary()) { + if (lMCTrack0.isPhysicalPrimary() || lMCTrack1.isPhysicalPrimary() || lMCTrack2.isPhysicalPrimary()) { continue; - }*/ - /*if (lMCTrack0.producedByGenerator() || lMCTrack1.producedByGenerator() || lMCTrack2.producedByGenerator()) { + } + if (lMCTrack0.producedByGenerator() || lMCTrack1.producedByGenerator() || lMCTrack2.producedByGenerator()) { continue; - }*/ - registry.fill(HIST("hTestCounter"), 2.5); + } + registry.fill(HIST("hMCInfoCounter"), 2.5); if (!lMCTrack0.has_mothers() || !lMCTrack1.has_mothers() || !lMCTrack2.has_mothers()) { continue; } - registry.fill(HIST("hTestCounter"), 3.5); + registry.fill(HIST("hMCInfoCounter"), 3.5); int lPDG = -1; float lPt = -1; bool is3bodyDecayedH3L = false; int lGlobalIndex = -1; - int nmother = 0, dummyindex; - for (auto& lMother0 : lMCTrack0.mothers_as()) { - ++nmother; - dummyindex = lMother0.globalIndex(); - } - registry.fill(HIST("hMotherCounter"), nmother); - nmother = 0; - for (auto& lMother1 : lMCTrack1.mothers_as()) { - ++nmother; - dummyindex = lMother1.globalIndex(); - } - registry.fill(HIST("hMotherCounter"), nmother); - nmother = 0; - for (auto& lMother2 : lMCTrack2.mothers_as()) { - ++nmother; - dummyindex = lMother2.globalIndex(); - } - registry.fill(HIST("hMotherCounter"), nmother); for (auto& lMother0 : lMCTrack0.mothers_as()) { for (auto& lMother1 : lMCTrack1.mothers_as()) { for (auto& lMother2 : lMCTrack2.mothers_as()) { - registry.fill(HIST("hTestCounter"), 4.5); + registry.fill(HIST("hMCInfoCounter"), 4.5); if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { // vtxs with the same mother - registry.fill(HIST("hTestCounter"), 7.5); + registry.fill(HIST("hMCInfoCounter"), 7.5); lGlobalIndex = lMother1.globalIndex(); lPDG = lMother1.pdgCode(); lPt = lMother1.pt(); @@ -1195,20 +1173,15 @@ struct hypertriton3bodyComparewithDecay3body { } registry.fill(HIST("hCheckCounter"), 1.5); - registry.fill(HIST("hTestCounter"), 5.5); + registry.fill(HIST("hMCInfoCounter"), 5.5); // for check registry.fill(HIST("hHypertritonMCPtTotal"), lPt); - /*if ( (lPt >= 3.5 && lPt < 4.0) || (lPt >= 8.5 && lPt < 9.0) ) { - std::cout << "---------------------- Num:" << registry.get(HIST("hCheckCounter"))->GetBinContent(1) << "-----------------------------" << std::endl; - std::cout << "track0Pt=" << lMCTrack0.pt() << " track1Pt=" << lMCTrack1.pt() << " track2Pt=" << lMCTrack2.pt() << std::endl; - std::cout << "MotherTrackPt=" << lPt << std::endl; - }*/ Indexdaughters temp = {lMCTrack0.globalIndex(), lMCTrack1.globalIndex(), lMCTrack2.globalIndex()}; auto p = std::find(set_pair.begin(), set_pair.end(), temp); if (p == set_pair.end()) { set_pair.push_back(temp); - registry.fill(HIST("hTestCounter"), 6.5); + registry.fill(HIST("hMCInfoCounter"), 6.5); } if (lTrack0.collisionId() != lTrack1.collisionId() || lTrack0.collisionId() != lTrack2.collisionId()) { diff --git a/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx b/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx index d6720e6f8b4..56a626d5009 100644 --- a/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx +++ b/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx @@ -8,14 +8,11 @@ // 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. -// -// Example StoredVtx3BodyDatas analysis task // ======================== // -// This code loops over a StoredVtx3BodyDatas table and produces some -// standard analysis output. It requires either -// the hypertriton3bodybuilder or hypertriton3bodyfinder (not recommended) tasks -// to have been executed in the workflow (before). +// This code perform a check for all mcparticles and tracks +// which has corresponding mcparticles to find out the properties +// of hypertriton 3-body decay // // author: yuanzhe.wang@cern.ch @@ -32,7 +29,6 @@ #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" #include "PWGLF/DataModel/LFStrangenessTables.h" -#include "PWGLF/DataModel/Vtx3BodyTables.h" #include "Common/Core/TrackSelection.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/EventSelection.h" @@ -45,7 +41,8 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using MyTracks = soa::Join; +using FullTracksExtIU = soa::Join; +using MCLabeledFullTracksExtIU = soa::Join; template bool is3bodyDecayedH3L(TMCParticle const& particle) @@ -102,458 +99,6 @@ bool isPairedH3LDaughters(TMCParticle const& mctrack0, TMCParticle const& mctrac return false; } -struct hypertriton3bodyQaMc { - // Basic checks - HistogramRegistry registry{ - "registry", - { - {"hVtxRadius", "hVtxRadius", {HistType::kTH1F, {{1000, 0.0f, 100.0f, "cm"}}}}, - {"hVtxCosPA", "hVtxCosPA", {HistType::kTH1F, {{1000, 0.95f, 1.0f}}}}, - {"hDCATrack0ToPV", "hDCAPosToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCATrack1ToPV", "hDCANegToPV", {HistType::kTH1F, {{1000, 10.0f, 10.0f, "cm"}}}}, - {"hDCATrack2ToPV", "hDCANegToPV", {HistType::kTH1F, {{1000, 10.0f, 10.0f, "cm"}}}}, - {"hDCAVtxDau", "hDCAVtxDau", {HistType::kTH1F, {{1000, 0.0f, 10.0f, "cm^{2}"}}}}, - {"hVtxPt", "hVtxPt", {HistType::kTH1F, {{200, 0.0f, 10.0f, "p_{T}"}}}}, - {"hTrack0Pt", "hTrack0Pt", {HistType::kTH1F, {{200, 0.0f, 10.0f, "p_{T}"}}}}, - {"hTrack1Pt", "hTrack1Pt", {HistType::kTH1F, {{200, 0.0f, 10.0f, "p_{T}"}}}}, - {"hTrack2Pt", "hTrack2Pt", {HistType::kTH1F, {{200, 0.0f, 10.0f, "p_{T}"}}}}, - }, - }; - void init(InitContext const&) - { - AxisSpec massAxis = {120, 2.9f, 3.2f, "Inv. Mass (GeV/c^{2})"}; - - registry.add("hMassHypertriton", "hMassHypertriton", {HistType::kTH1F, {massAxis}}); - registry.add("hMassAntiHypertriton", "hMassAntiHypertriton", {HistType::kTH1F, {massAxis}}); - } - void process(aod::Collision const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, MyTracks const& tracks) - { - - for (auto& vtx : vtx3bodydatas) { - registry.fill(HIST("hVtxRadius"), vtx.vtxradius()); - registry.fill(HIST("hVtxCosPA"), vtx.vtxcosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("hDCATrack0ToPV"), vtx.dcatrack0topv()); - registry.fill(HIST("hDCATrack1ToPV"), vtx.dcatrack1topv()); - registry.fill(HIST("hDCATrack2ToPV"), vtx.dcatrack2topv()); - registry.fill(HIST("hDCAVtxDau"), vtx.dcaVtxdaughters()); - registry.fill(HIST("hVtxPt"), vtx.pt()); - registry.fill(HIST("hTrack0Pt"), vtx.track0pt()); - registry.fill(HIST("hTrack1Pt"), vtx.track1pt()); - registry.fill(HIST("hTrack2Pt"), vtx.track2pt()); - registry.fill(HIST("hMassHypertriton"), vtx.mHypertriton()); - registry.fill(HIST("hMassAntiHypertriton"), vtx.mAntiHypertriton()); - } - } -}; - -struct hypertriton3bodyAnalysisMc { - - // Selection criteria - Configurable vtxcospa{"vtxcospa", 0.9, "Vtx CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0) - Configurable dcavtxdau{"dcavtxdau", 1.0, "DCA Vtx Daughters"}; // loose cut - Configurable dcapiontopv{"dcapiontopv", .00, "DCA Pion To PV"}; - Configurable etacut{"etacut", 1, "etacut"}; - Configurable rapidity{"rapidity", 1, "rapidity"}; - Configurable TofPidNsigmaMin{"TofPidNsigmaMin", -4, "TofPidNsigmaMin"}; - Configurable TofPidNsigmaMax{"TofPidNsigmaMax", 8, "TofPidNsigmaMax"}; - Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; - Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; - Configurable lifetimecut{"lifetimecut", 40., "lifetimecut"}; - Configurable minProtonPt{"minProtonPt", 0.3, "minProtonPt"}; - Configurable maxProtonPt{"maxProtonPt", 5, "maxProtonPt"}; - Configurable minPionPt{"minPionPt", 0.1, "minPionPt"}; - Configurable maxPionPt{"maxPionPt", 1.2, "maxPionPt"}; - Configurable minDeuteronPt{"minDeuteronPt", 0.6, "minDeuteronPt"}; - Configurable maxDeuteronPt{"maxDeuteronPt", 10, "maxDeuteronPt"}; - Configurable minDeuteronPUseTOF{"minDeuteronPUseTOF", 1, "minDeuteronPt Enable TOF PID"}; - Configurable h3LMassLowerlimit{"h3LMassLowerlimit", 2.96, "Hypertriton mass lower limit"}; - Configurable h3LMassUpperlimit{"h3LMassUpperlimit", 3.04, "Hypertriton mass upper limit"}; - Configurable mincrossedrowsproton{"mincrossedrowsproton", 90, "min tpc crossed rows for pion"}; - Configurable mincrossedrowspion{"mincrossedrowspion", 70, "min tpc crossed rows"}; - Configurable mincrossedrowsdeuteron{"mincrossedrowsdeuteron", 100, "min tpc crossed rows for deuteron"}; - Configurable mcsigma{"mcsigma", 0.0015, "sigma of mc invariant mass fit"}; // obtained from MC - - HistogramRegistry registry{ - "registry", - { - {"hSelectedEventCounter", "hSelectedEventCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, - {"hSelectedCandidatesCounter", "hSelectedCandidatesCounter", {HistType::kTH1F, {{11, 0.0f, 11.0f}}}}, - {"hSelectedTrueHypertritonCounter", "hSelectedTrueHypertritonCounter", {HistType::kTH1F, {{11, 0.0f, 11.0f}}}}, - {"hTestCounter", "hTestCounter", {HistType::kTH1F, {{9, 0.0f, 9.0f}}}}, - {"hMassHypertriton", "hMassHypertriton", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, - {"hMassAntiHypertriton", "hMassAntiHypertriton", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, - {"hMassHypertritonTotal", "hMassHypertritonTotal", {HistType::kTH1F, {{300, 2.9f, 3.2f}}}}, - {"hPtProton", "hPtProton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtAntiPion", "hPtAntiPion", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtDeuteron", "hPtDeuteron", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtAntiProton", "hPtAntiProton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtPion", "hPtPion", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtAntiDeuteron", "hPtAntiDeuteron", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDCAProtonToPV", "hDCAProtonToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAPionToPV", "hDCAPionToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCADeuteronToPV", "hDCADeuteronToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hProtonTPCNcls", "hProtonTPCNcls", {HistType::kTH1F, {{180, 0, 180, "TPC cluster"}}}}, - {"hPionTPCNcls", "hPionTPCNcls", {HistType::kTH1F, {{180, 0, 180, "TPC cluster"}}}}, - {"hDeuteronTPCNcls", "hDeuteronTPCNcls", {HistType::kTH1F, {{180, 0, 180, "TPC cluster"}}}}, - {"hVtxCosPA", "hVtxCosPA", {HistType::kTH1F, {{1000, 0.9f, 1.0f}}}}, - {"hDCAVtxDau", "hDCAVtxDau", {HistType::kTH1F, {{1000, 0.0f, 10.0f, "cm^{2}"}}}}, - {"hTOFPIDDeuteron", "hTOFPIDDeuteron", {HistType::kTH1F, {{2000, -100.0f, 100.0f}}}}, - {"hTPCPIDProton", "hTPCPIDProton", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, - {"hTPCPIDPion", "hTPCPIDPion", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, - {"hTPCPIDDeuteron", "hTPCPIDDeuteron", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, - {"hProtonTPCBB", "hProtonTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hPionTPCBB", "hPionTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hDeuteronTPCBB", "hDeuteronTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, - {"hProtonTPCVsPt", "hProtonTPCVsPt", {HistType::kTH2F, {{50, 0.0f, 5.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hPionTPCVsPt", "hPionTPCVsPt", {HistType::kTH2F, {{20, 0.0f, 2.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hDeuteronTPCVsPt", "hDeuteronTPCVsPt", {HistType::kTH2F, {{80, 0.0f, 8.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hDeuteronTOFVsPBeforeTOFCut", "hDeuteronTOFVsPBeforeTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"hDeuteronTOFVsPBeforeTOFCutSig", "hDeuteronTOFVsPBeforeTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"hDeuteronTOFVsPAtferTOFCut", "hDeuteronTOFVsPAtferTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"hDeuteronTOFVsPAtferTOFCutSig", "hDeuteronTOFVsPAtferTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - - {"hDalitz", "hDalitz", {HistType::kTH2F, {{120, 7.85, 8.45, "M^{2}(dp) (GeV^{2}/c^{4})"}, {60, 1.1, 1.4, "M^{2}(p#pi) (GeV^{2}/c^{4})"}}}}, - {"h3dMassHypertriton", "h3dMassHypertriton", {HistType::kTH3F, {{20, 0.0f, 100.0f, "Cent (%)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - {"h3dMassAntiHypertriton", "h3dMassAntiHypertriton", {HistType::kTH3F, {{20, 0.0f, 100.0f, "Cent (%)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - {"h3dTotalHypertriton", "h3dTotalHypertriton", {HistType::kTH3F, {{50, 0, 50, "ct(cm)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - {"h3dTotalTrueHypertriton", "h3dTotalTrueHypertriton", {HistType::kTH3F, {{50, 0, 50, "ct(cm)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - }, - }; - - //------------------------------------------------------------------ - // Fill stats histograms - enum vtxstep { kCandAll = 0, - kCandCosPA, - kCandDauEta, - kCandRapidity, - kCandct, - kCandDcaDau, - kCandTOFPID, - kCandTPCPID, - kCandTPCNcls, - kCandDauPt, - kCandDcaToPV, - kNVtxSteps }; - - Configurable saveDcaHist{"saveDcaHist", 0, "saveDcaHist"}; - ConfigurableAxis dcaBinning{"dca-binning", {200, 0.0f, 1.0f}, ""}; - ConfigurableAxis ptBinning{"pt-binning", {200, 0.0f, 10.0f}, ""}; - - void FillCandCounter(int kn, bool istrue = false) - { - registry.fill(HIST("hSelectedCandidatesCounter"), kn); - if (istrue) { - registry.fill(HIST("hSelectedTrueHypertritonCounter"), kn); - } - } - - void init(InitContext const&) - { - AxisSpec dcaAxis = {dcaBinning, "DCA (cm)"}; - AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/c)"}; - AxisSpec massAxisHypertriton = {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}; - - if (saveDcaHist == 1) { - registry.add("h3dMassHypertritonDca", "h3dMassHypertritonDca", {HistType::kTH3F, {dcaAxis, ptAxis, massAxisHypertriton}}); - registry.add("h3dMassAntiHypertritonDca", "h3dMassAntiHypertritonDca", {HistType::kTH3F, {dcaAxis, ptAxis, massAxisHypertriton}}); - } - - TString CandCounterbinLabel[11] = {"Total", "VtxCosPA", "TrackEta", "MomRapidity", "Lifetime", "VtxDcaDau", "d TOFPID", "TPCPID&Mass", "TPCNcls", "DauPt", "PionDcatoPV"}; - for (int i{0}; i < kNVtxSteps; i++) { - registry.get(HIST("hSelectedCandidatesCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); - registry.get(HIST("hSelectedTrueHypertritonCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); - } - } - - void process(soa::Join::iterator const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, MyTracks const& tracks, aod::McParticles const& particlesMC) - { - registry.fill(HIST("hSelectedEventCounter"), 0.5); - if (event_sel8_selection && !collision.sel8()) { - return; - } - registry.fill(HIST("hSelectedEventCounter"), 1.5); - - bool if_hasvtx = false; - - for (auto& vtx : vtx3bodydatas) { - // couldn't filter cosPA and radius variables (dynamic columns) - - // int lLabel = -1; - int lPDG = -1; - float lPt = -1; - double MClifetime = -1; - bool isFromHypertriton = false; - auto track0 = vtx.track0_as(); - auto track1 = vtx.track1_as(); - auto track2 = vtx.track2_as(); - if (track0.has_mcParticle() && track1.has_mcParticle() && track2.has_mcParticle()) { - auto lMCTrack0 = track0.mcParticle_as(); - auto lMCTrack1 = track1.mcParticle_as(); - auto lMCTrack2 = track2.mcParticle_as(); - if (lMCTrack0.has_mothers() && lMCTrack1.has_mothers() && lMCTrack2.has_mothers()) { - for (auto& lMother0 : lMCTrack0.mothers_as()) { - for (auto& lMother1 : lMCTrack1.mothers_as()) { - for (auto& lMother2 : lMCTrack2.mothers_as()) { - if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { - // lLabel = lMother1.globalIndex(); - lPt = lMother1.pt(); - lPDG = lMother1.pdgCode(); - if ((lPDG == 1010010030 && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == 1000010020) || - (lPDG == -1010010030 && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -1000010020)) { - isFromHypertriton = true; - MClifetime = RecoDecay::sqrtSumOfSquares(lMCTrack2.vx() - lMother2.vx(), lMCTrack2.vy() - lMother2.vy(), lMCTrack2.vz() - lMother2.vz()) * o2::constants::physics::MassHyperTriton / lMother2.p(); - } - } - } - } - } - } - } - - FillCandCounter(kCandAll, isFromHypertriton); - - if (vtx.vtxcosPA(collision.posX(), collision.posY(), collision.posZ()) < vtxcospa) { - continue; - } - FillCandCounter(kCandCosPA, isFromHypertriton); - if (TMath::Abs(vtx.track0_as().eta()) > etacut || TMath::Abs(vtx.track1_as().eta()) > etacut || TMath::Abs(vtx.track2_as().eta()) > etacut) { - continue; - } - FillCandCounter(kCandDauEta, isFromHypertriton); - if (TMath::Abs(vtx.yHypertriton()) > rapidity) { - continue; - } - FillCandCounter(kCandRapidity, isFromHypertriton); - double ct = vtx.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassHyperTriton; - if (ct > lifetimecut) { - continue; - } - FillCandCounter(kCandct, isFromHypertriton); - if (vtx.dcaVtxdaughters() > dcavtxdau) { - continue; - } - FillCandCounter(kCandDcaDau, isFromHypertriton); - registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCut"), track2.sign() * track2.p(), track2.tofNSigmaDe()); - if (isFromHypertriton) { - registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCutSig"), track2.sign() * track2.p(), track2.tofNSigmaDe()); - } - if ((track2.tofNSigmaDe() < TofPidNsigmaMin || track2.tofNSigmaDe() > TofPidNsigmaMax) && track2.p() > minDeuteronPUseTOF) { - continue; - } - FillCandCounter(kCandTOFPID, isFromHypertriton); - registry.fill(HIST("hDeuteronTOFVsPAtferTOFCut"), track2.sign() * track2.p(), track2.tofNSigmaDe()); - if (isFromHypertriton) { - registry.fill(HIST("hDeuteronTOFVsPAtferTOFCutSig"), track2.sign() * track2.p(), track2.tofNSigmaDe()); - } - - // 3sigma region for Dalitz plot - double lowerlimit = o2::constants::physics::MassHyperTriton - 3 * mcsigma; - double upperlimit = o2::constants::physics::MassHyperTriton + 3 * mcsigma; - - // Hypertriton - if (TMath::Abs(vtx.track0_as().tpcNSigmaPr()) < TpcPidNsigmaCut && TMath::Abs(vtx.track1_as().tpcNSigmaPi()) < TpcPidNsigmaCut && TMath::Abs(vtx.track2_as().tpcNSigmaDe()) < TpcPidNsigmaCut && vtx.mHypertriton() > h3LMassLowerlimit && vtx.mHypertriton() < h3LMassUpperlimit) { - - FillCandCounter(kCandTPCPID, isFromHypertriton); - - if (track0.tpcNClsCrossedRows() > mincrossedrowsproton && track1.tpcNClsCrossedRows() > mincrossedrowspion && track2.tpcNClsCrossedRows() > mincrossedrowsdeuteron) { - - FillCandCounter(kCandTPCNcls, isFromHypertriton); - - registry.fill(HIST("hTestCounter"), 0.5); - if (vtx.track1pt() > minPionPt && vtx.track1pt() < maxPionPt) { - registry.fill(HIST("hTestCounter"), 1.5); - if (vtx.track0pt() > minProtonPt && vtx.track0pt() < maxProtonPt) { - registry.fill(HIST("hTestCounter"), 2.5); - if (vtx.track2pt() > minDeuteronPt && vtx.track2pt() < maxDeuteronPt) { - registry.fill(HIST("hTestCounter"), 3.5); - } - } - } - - if (vtx.track0pt() > minProtonPt && vtx.track0pt() < maxProtonPt && vtx.track1pt() > minPionPt && vtx.track1pt() < maxPionPt && vtx.track2pt() > minDeuteronPt && vtx.track2pt() < maxDeuteronPt) { - FillCandCounter(kCandDauPt, isFromHypertriton); - - if (TMath::Abs(vtx.dcatrack1topv()) > dcapiontopv) { - if_hasvtx = true; - FillCandCounter(kCandDcaToPV, isFromHypertriton); - - registry.fill(HIST("hVtxCosPA"), vtx.vtxcosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("hDCAVtxDau"), vtx.dcaVtxdaughters()); - registry.fill(HIST("hPtProton"), vtx.track0pt()); - registry.fill(HIST("hPtAntiPion"), vtx.track1pt()); - registry.fill(HIST("hPtDeuteron"), vtx.track2pt()); - registry.fill(HIST("hDCAProtonToPV"), vtx.dcatrack0topv()); - registry.fill(HIST("hDCAPionToPV"), vtx.dcatrack1topv()); - registry.fill(HIST("hDCADeuteronToPV"), vtx.dcatrack2topv()); - registry.fill(HIST("hProtonTPCNcls"), track0.tpcNClsCrossedRows()); - registry.fill(HIST("hPionTPCNcls"), track1.tpcNClsCrossedRows()); - registry.fill(HIST("hDeuteronTPCNcls"), track2.tpcNClsCrossedRows()); - registry.fill(HIST("hTOFPIDDeuteron"), track2.tofNSigmaDe()); - registry.fill(HIST("hTPCPIDProton"), track0.tpcNSigmaPr()); - registry.fill(HIST("hTPCPIDPion"), track1.tpcNSigmaPi()); - registry.fill(HIST("hTPCPIDDeuteron"), track2.tpcNSigmaDe()); - registry.fill(HIST("hProtonTPCBB"), track0.p(), track0.tpcSignal()); - registry.fill(HIST("hPionTPCBB"), -track1.p(), track1.tpcSignal()); - registry.fill(HIST("hDeuteronTPCBB"), track2.p(), track0.tpcSignal()); - registry.fill(HIST("hProtonTPCVsPt"), vtx.track0pt(), track0.tpcNSigmaPr()); - registry.fill(HIST("hPionTPCVsPt"), vtx.track1pt(), track1.tpcNSigmaPi()); - registry.fill(HIST("hDeuteronTPCVsPt"), vtx.track2pt(), track2.tpcNSigmaDe()); - registry.fill(HIST("hMassHypertriton"), vtx.mHypertriton()); - registry.fill(HIST("hMassHypertritonTotal"), vtx.mHypertriton()); - registry.fill(HIST("h3dMassHypertriton"), 0., vtx.pt(), vtx.mHypertriton()); // collision.centV0M() instead of 0. once available - registry.fill(HIST("h3dTotalHypertriton"), ct, vtx.pt(), vtx.mHypertriton()); - if (vtx.mHypertriton() > lowerlimit && vtx.mHypertriton() < upperlimit) { - registry.fill(HIST("hDalitz"), RecoDecay::m2(array{array{vtx.pxtrack0(), vtx.pytrack0(), vtx.pztrack0()}, array{vtx.pxtrack2(), vtx.pytrack2(), vtx.pztrack2()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), - RecoDecay::m2(array{array{vtx.pxtrack0(), vtx.pytrack0(), vtx.pztrack0()}, array{vtx.pxtrack1(), vtx.pytrack1(), vtx.pztrack1()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); - } - - if (isFromHypertriton) { - registry.fill(HIST("h3dTotalTrueHypertriton"), MClifetime, lPt, vtx.mHypertriton()); - } - if (saveDcaHist == 1) { - registry.fill(HIST("h3dMassHypertritonDca"), vtx.dcaVtxdaughters(), vtx.pt(), vtx.mHypertriton()); - } - } - } - } - } - - // AntiHypertriton - if (TMath::Abs(vtx.track0_as().tpcNSigmaPi()) < TpcPidNsigmaCut && TMath::Abs(vtx.track1_as().tpcNSigmaPr()) < TpcPidNsigmaCut && TMath::Abs(vtx.track2_as().tpcNSigmaDe()) < TpcPidNsigmaCut && vtx.mAntiHypertriton() > h3LMassLowerlimit && vtx.mAntiHypertriton() < h3LMassUpperlimit) { - FillCandCounter(kCandTPCPID, isFromHypertriton); - - if (track0.tpcNClsCrossedRows() > mincrossedrowspion && track1.tpcNClsCrossedRows() > mincrossedrowsproton && track2.tpcNClsCrossedRows() > mincrossedrowsdeuteron) { - - FillCandCounter(kCandTPCNcls, isFromHypertriton); - - registry.fill(HIST("hTestCounter"), 0.5); - if (vtx.track0pt() > minPionPt && vtx.track0pt() < maxPionPt) { - registry.fill(HIST("hTestCounter"), 1.5); - if (vtx.track1pt() > minProtonPt && vtx.track1pt() < maxProtonPt) { - registry.fill(HIST("hTestCounter"), 2.5); - if (vtx.track2pt() > minDeuteronPt && vtx.track2pt() < maxDeuteronPt) { - registry.fill(HIST("hTestCounter"), 3.5); - } - } - } - - if (vtx.track0pt() > minPionPt && vtx.track0pt() < maxPionPt && vtx.track1pt() > minProtonPt && vtx.track1pt() < maxProtonPt && vtx.track2pt() > minDeuteronPt && vtx.track2pt() < maxDeuteronPt) { - FillCandCounter(kCandDauPt, isFromHypertriton); - - if (TMath::Abs(vtx.dcatrack0topv()) > dcapiontopv) { - if_hasvtx = true; - FillCandCounter(kCandDcaToPV, isFromHypertriton); - - registry.fill(HIST("hVtxCosPA"), vtx.vtxcosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("hDCAVtxDau"), vtx.dcaVtxdaughters()); - registry.fill(HIST("hPtAntiProton"), vtx.track1pt()); - registry.fill(HIST("hPtPion"), vtx.track0pt()); - registry.fill(HIST("hPtAntiDeuteron"), vtx.track2pt()); - registry.fill(HIST("hDCAProtonToPV"), vtx.dcatrack1topv()); - registry.fill(HIST("hDCAPionToPV"), vtx.dcatrack0topv()); - registry.fill(HIST("hDCADeuteronToPV"), vtx.dcatrack2topv()); - registry.fill(HIST("hProtonTPCNcls"), track1.tpcNClsCrossedRows()); - registry.fill(HIST("hPionTPCNcls"), track0.tpcNClsCrossedRows()); - registry.fill(HIST("hDeuteronTPCNcls"), track2.tpcNClsCrossedRows()); - registry.fill(HIST("hTOFPIDDeuteron"), track2.tofNSigmaDe()); - registry.fill(HIST("hTPCPIDProton"), track1.tpcNSigmaPr()); - registry.fill(HIST("hTPCPIDPion"), track0.tpcNSigmaPi()); - registry.fill(HIST("hTPCPIDDeuteron"), track2.tpcNSigmaDe()); - registry.fill(HIST("hProtonTPCBB"), -track1.p(), track1.tpcSignal()); - registry.fill(HIST("hPionTPCBB"), track0.p(), track0.tpcSignal()); - registry.fill(HIST("hDeuteronTPCBB"), -track2.p(), track0.tpcSignal()); - registry.fill(HIST("hProtonTPCVsPt"), vtx.track1pt(), track1.tpcNSigmaPr()); - registry.fill(HIST("hPionTPCVsPt"), vtx.track0pt(), track0.tpcNSigmaPi()); - registry.fill(HIST("hDeuteronTPCVsPt"), vtx.track2pt(), track2.tpcNSigmaDe()); - registry.fill(HIST("hMassAntiHypertriton"), vtx.mAntiHypertriton()); - registry.fill(HIST("hMassHypertritonTotal"), vtx.mAntiHypertriton()); - registry.fill(HIST("h3dMassAntiHypertriton"), 0., vtx.pt(), vtx.mAntiHypertriton()); // collision.centV0M() instead of 0. once available - registry.fill(HIST("h3dTotalHypertriton"), ct, vtx.pt(), vtx.mAntiHypertriton()); - if (vtx.mAntiHypertriton() > lowerlimit && vtx.mAntiHypertriton() < upperlimit) { - registry.fill(HIST("hDalitz"), RecoDecay::m2(array{array{vtx.pxtrack1(), vtx.pytrack1(), vtx.pztrack1()}, array{vtx.pxtrack2(), vtx.pytrack2(), vtx.pztrack2()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), - RecoDecay::m2(array{array{vtx.pxtrack1(), vtx.pytrack1(), vtx.pztrack1()}, array{vtx.pxtrack0(), vtx.pytrack0(), vtx.pztrack0()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); - } - - if (isFromHypertriton) { - registry.fill(HIST("h3dTotalTrueHypertriton"), MClifetime, lPt, vtx.mAntiHypertriton()); - } - if (saveDcaHist == 1) { - registry.fill(HIST("h3dMassAntiHypertritonDca"), vtx.dcaVtxdaughters(), vtx.pt(), vtx.mAntiHypertriton()); - } - } - } - } - } - } - - if (if_hasvtx) - registry.fill(HIST("hSelectedEventCounter"), 2.5); - } -}; - -// check vtx3body with mclabels -struct hypertriton3bodyLabelCheck { - HistogramRegistry registry{ - "registry", - { - {"hLabeledVtxCounter", "hLabeledVtxCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, - {"hMassTrueH3L", "hMassTrueH3L", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, - {"hMassTrueH3LMatter", "hMassTrueH3LMatter", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, - {"hMassTrueH3LAntiMatter", "hMassTrueH3LAntiMatter", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, - }, - }; - - void init(InitContext const&) - { - registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(1, "Readin"); - registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(2, "TrueMCH3L"); - registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(3, "Nonrepetitive"); - } - - Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; - - void process(soa::Join::iterator const& collision) - { - // dummy function - } - PROCESS_SWITCH(hypertriton3bodyLabelCheck, process, "Donot check MC label tables", true); - - void processCheckLabel(soa::Join::iterator const& collision, soa::Join const& vtx3bodydatas, MyTracks const& tracks, aod::McParticles const& particlesMC) - { - if (event_sel8_selection && !collision.sel8()) { - return; - } - - std::vector set_mothertrack; - for (auto& vtx : vtx3bodydatas) { - registry.fill(HIST("hLabeledVtxCounter"), 0.5); - if (vtx.mcParticleId() != -1) { - auto mcparticle = vtx.mcParticle_as(); - if (mcparticle.pdgCode() == 1010010030) { - registry.fill(HIST("hLabeledVtxCounter"), 1.5); - registry.fill(HIST("hMassTrueH3L"), vtx.mHypertriton()); - registry.fill(HIST("hMassTrueH3LMatter"), vtx.mHypertriton()); - auto p = std::find(set_mothertrack.begin(), set_mothertrack.end(), mcparticle.globalIndex()); - if (p == set_mothertrack.end()) { - set_mothertrack.push_back(mcparticle.globalIndex()); - registry.fill(HIST("hLabeledVtxCounter"), 2.5); - } - } else if (mcparticle.pdgCode() == -1010010030) { - registry.fill(HIST("hLabeledVtxCounter"), 1.5); - registry.fill(HIST("hMassTrueH3L"), vtx.mAntiHypertriton()); - registry.fill(HIST("hMassTrueH3LAntiMatter"), vtx.mAntiHypertriton()); - auto p = std::find(set_mothertrack.begin(), set_mothertrack.end(), mcparticle.globalIndex()); - if (p == set_mothertrack.end()) { - set_mothertrack.push_back(mcparticle.globalIndex()); - registry.fill(HIST("hLabeledVtxCounter"), 2.5); - } - } - } - } - } - PROCESS_SWITCH(hypertriton3bodyLabelCheck, processCheckLabel, "Check MC label tables", false); -}; - // check the properties of daughters candidates and true daughters struct hypertriton3bodyTrackMcinfo { // Basic checks @@ -636,7 +181,7 @@ struct hypertriton3bodyTrackMcinfo { { registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(1, "Readin"); registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(2, "Has_mcparticle"); - registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(3, "Rapidity Cut(off)"); + registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(3, "Rapidity Cut"); registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(4, "McisHypertriton"); registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(5, "McisProton"); registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(6, "McisPion"); @@ -674,7 +219,7 @@ struct hypertriton3bodyTrackMcinfo { } }; - void process(soa::Join::iterator const& collision, aod::McParticles const& mcparticles, MyTracks const& tracks) + void process(soa::Join::iterator const& collision, aod::McParticles const& particlesMC, MCLabeledFullTracksExtIU const& tracks) { registry.fill(HIST("hTotalCollCounter"), 0.5); @@ -890,13 +435,13 @@ struct hypertriton3bodyTrackMcinfo { } std::vector set_pair; - for (auto iproton = 0; iproton < protons.size(); iproton++) { + for (size_t iproton = 0; iproton < protons.size(); iproton++) { auto track0 = tracks.iteratorAt(protons[iproton]); auto mctrack0 = track0.mcParticle_as(); - for (auto ipion = 0; ipion < pions.size(); ipion++) { + for (size_t ipion = 0; ipion < pions.size(); ipion++) { auto track1 = tracks.iteratorAt(pions[ipion]); auto mctrack1 = track1.mcParticle_as(); - for (auto ideuteron = 0; ideuteron < deuterons.size(); ideuteron++) { + for (size_t ideuteron = 0; ideuteron < deuterons.size(); ideuteron++) { auto track2 = tracks.iteratorAt(deuterons[ideuteron]); auto mctrack2 = track2.mcParticle_as(); if (isPairedH3LDaughters(mctrack0, mctrack1, mctrack2)) { @@ -966,10 +511,10 @@ struct hypertriton3bodyMcParticleCount { registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(9, "PtCut"); } - Configurable rapidityMCcut{"rapidityMCcut", 0.9, "rapidity cut MC count"}; + Configurable rapidityMCcut{"rapidityMCcut", 1, "rapidity cut MC count"}; Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; - void process(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups>& collisions) + void process(aod::McCollision const& mcCollision, aod::McParticles const& particlesMC, const soa::SmallGroups>& collisions) { std::vector SelectedEvents(collisions.size()); int nevts = 0; @@ -989,7 +534,7 @@ struct hypertriton3bodyMcParticleCount { // return; } - for (auto& mcparticle : mcParticles) { + for (auto& mcparticle : particlesMC) { registry.fill(HIST("hMcPhysicalPrimaryParticleCount"), 0.5); @@ -1075,7 +620,9 @@ struct hypertriton3bodyMcParticleCount { continue; } registry.fill(HIST("hMcPhysicalPrimaryParticleCount"), 1.5); - // if (TMath::Abs(mcparticle.y()) > rapidityMCcut) {continue;} + if (TMath::Abs(mcparticle.y()) > rapidityMCcut) { + continue; + } registry.fill(HIST("hMcPhysicalPrimaryParticleCount"), 2.5); if (mcparticle.pdgCode() == 211 || mcparticle.pdgCode() == -211) { @@ -1099,10 +646,7 @@ struct hypertriton3bodyMcParticleCount { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), }; } diff --git a/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx b/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx index 159f64546cf..fa5051da954 100644 --- a/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx +++ b/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// Example StoredVtx3BodyDatas analysis task +// StoredVtx3BodyDatas analysis task // ======================== // // This code loops over a StoredVtx3BodyDatas table and produces some @@ -45,7 +45,8 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using MyTracks = soa::Join; +using FullTracksExtIU = soa::Join; +using MCLabeledFullTracksExtIU = soa::Join; struct hypertriton3bodyQa { // Basic checks @@ -73,8 +74,7 @@ struct hypertriton3bodyQa { {"hTrack2Pt", "hTrack2Pt", {HistType::kTH1F, {{200, 0.0f, 10.0f, "p_{T}"}}}}, {"hTOFPIDDeuteron", "hTOFPIDDeuteron", {HistType::kTH1F, {{2000, -100.0f, 100.0f}}}}, {"hDeuTOFNsigma", "Deuteron TOF Nsigma distribution", {HistType::kTH2F, {{1200, -6, 6, "#it{p} (GeV/#it{c})"}, {2000, -100, 100, "TOF n#sigma"}}}}, - {"hTOFPIDDeuteronWithTPC", "hTOFPIDDeuteronWithTPC", {HistType::kTH1F, {{2000, -100.0f, 100.0f}}}}, - {"hDeuTOFNsigmaWithTPC", "Deuteron TOF Nsigma distribution", {HistType::kTH2F, {{1200, -6, 6, "#it{p} (GeV/#it{c})"}, {2000, -100, 100, "TOF n#sigma"}}}}, + {"hDeuTOFNsigmaWithTPC", "Deuteron TOF Nsigma distribution", {HistType::kTH2F, {{1200, -6, 6, "#it{p} (GeV/#it{c})"}, {1000, -100, 100, "TOF n#sigma"}}}}, }, }; void init(InitContext const&) @@ -83,12 +83,12 @@ struct hypertriton3bodyQa { registry.add("hMassHypertriton", "hMassHypertriton", {HistType::kTH1F, {massAxis}}); registry.add("hMassAntiHypertriton", "hMassAntiHypertriton", {HistType::kTH1F, {massAxis}}); } - void process(aod::Collision const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, MyTracks const& tracks) + void process(aod::Collision const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const& tracks) { for (auto& vtx : vtx3bodydatas) { - auto track0 = vtx.track0_as(); - auto track1 = vtx.track1_as(); - auto track2 = vtx.track2_as(); + auto track0 = vtx.track0_as(); + auto track1 = vtx.track1_as(); + auto track2 = vtx.track2_as(); registry.fill(HIST("hVtxRadius"), vtx.vtxradius()); registry.fill(HIST("hVtxCosPA"), vtx.vtxcosPA(collision.posX(), collision.posY(), collision.posZ())); @@ -102,7 +102,6 @@ struct hypertriton3bodyQa { registry.fill(HIST("hTOFPIDDeuteron"), track2.tofNSigmaDe()); registry.fill(HIST("hDeuTOFNsigma"), track2.tpcInnerParam() * track2.sign(), track2.tofNSigmaDe()); if (std::abs(track2.tpcNSigmaDe()) < 5) { - registry.fill(HIST("hTOFPIDDeuteronWithTPC"), track2.tofNSigmaDe()); registry.fill(HIST("hDeuTOFNsigmaWithTPC"), track2.tpcInnerParam() * track2.sign(), track2.tofNSigmaDe()); } if (track2.sign() > 0) { @@ -131,13 +130,13 @@ struct hypertriton3bodyQa { struct hypertriton3bodyAnalysis { // Selection criteria - Configurable vtxcospa{"vtxcospa", 0.9, "Vtx CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0) + Configurable vtxcospa{"vtxcospa", 0.99, "Vtx CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0) Configurable dcavtxdau{"dcavtxdau", 1.0, "DCA Vtx Daughters"}; // loose cut Configurable dcapiontopv{"dcapiontopv", .00, "DCA Pion To PV"}; Configurable etacut{"etacut", 1, "etacut"}; - Configurable rapidity{"rapidity", 1, "rapidity"}; + Configurable rapiditycut{"rapiditycut", 1, "rapiditycut"}; Configurable TofPidNsigmaMin{"TofPidNsigmaMin", -4, "TofPidNsigmaMin"}; - Configurable TofPidNsigmaMax{"TofPidNsigmaMax", 8, "TofPidNsigmaMax"}; + Configurable TofPidNsigmaMax{"TofPidNsigmaMax", 4, "TofPidNsigmaMax"}; Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; Configurable lifetimecut{"lifetimecut", 40., "lifetimecut"}; // ct @@ -159,8 +158,8 @@ struct hypertriton3bodyAnalysis { HistogramRegistry registry{ "registry", { - {"hSelectedEventCounter", "hSelectedEventCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, - {"hSelectedCandidatesCounter", "hSelectedCandidatesCounter", {HistType::kTH1F, {{11, 0.0f, 11.0f}}}}, + {"hEventCounter", "hEventCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, + {"hCandidatesCounter", "hCandidatesCounter", {HistType::kTH1F, {{12, 0.0f, 12.0f}}}}, {"hMassHypertriton", "hMassHypertriton", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, {"hMassAntiHypertriton", "hMassAntiHypertriton", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, {"hMassHypertritonTotal", "hMassHypertritonTotal", {HistType::kTH1F, {{300, 2.9f, 3.2f}}}}, @@ -188,10 +187,29 @@ struct hypertriton3bodyAnalysis { {"hProtonTPCVsPt", "hProtonTPCVsPt", {HistType::kTH2F, {{50, 0.0f, 5.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, {"hPionTPCVsPt", "hPionTPCVsPt", {HistType::kTH2F, {{20, 0.0f, 2.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, {"hDeuteronTPCVsPt", "hDeuteronTPCVsPt", {HistType::kTH2F, {{80, 0.0f, 8.0f, "#it{p}_{T} (GeV/c)"}, {240, -6.0f, 6.0f, "TPC n#sigma"}}}}, + {"hDeuteronTOFVsPBeforeTOFCut", "hDeuteronTOFVsPBeforeTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, + {"hDeuteronTOFVsPAtferTOFCut", "hDeuteronTOFVsPAtferTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, + {"hDalitz", "hDalitz", {HistType::kTH2F, {{120, 7.85, 8.45, "M^{2}(dp) (GeV^{2}/c^{4})"}, {60, 1.1, 1.4, "M^{2}(p#pi) (GeV^{2}/c^{4})"}}}}, {"h3dMassHypertriton", "h3dMassHypertriton", {HistType::kTH3F, {{20, 0.0f, 100.0f, "Cent (%)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, {"h3dMassAntiHypertriton", "h3dMassAntiHypertriton", {HistType::kTH3F, {{20, 0.0f, 100.0f, "Cent (%)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, {"h3dTotalHypertriton", "h3dTotalHypertriton", {HistType::kTH3F, {{50, 0, 50, "ct(cm)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, + + {"hTrueHypertritonCounter", "hTrueHypertritonCounter", {HistType::kTH1F, {{12, 0.0f, 12.0f}}}}, + {"hDeuteronTOFVsPBeforeTOFCutSig", "hDeuteronTOFVsPBeforeTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, + {"hDeuteronTOFVsPAtferTOFCutSig", "hDeuteronTOFVsPAtferTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, + {"h3dTotalTrueHypertriton", "h3dTotalTrueHypertriton", {HistType::kTH3F, {{50, 0, 50, "ct(cm)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, + + // for mcparticles information + {"hGeneratedHypertritonCounter", "hGeneratedHypertritonCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, + {"hPtGeneratedHypertriton", "hPtGeneratedHypertriton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, + {"hctGeneratedHypertriton", "hctGeneratedHypertriton", {HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}}}, + {"hEtaGeneratedHypertriton", "hEtaGeneratedHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, + {"hRapidityGeneratedHypertriton", "hRapidityGeneratedHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, + {"hPtGeneratedAntiHypertriton", "hPtGeneratedAntiHypertriton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, + {"hctGeneratedAntiHypertriton", "hctGeneratedAntiHypertriton", {HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}}}, + {"hEtaGeneratedAntiHypertriton", "hEtaGeneratedAntiHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, + {"hRapidityGeneratedAntiHypertriton", "hRapidityGeneratedAntiHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, }, }; @@ -208,7 +226,35 @@ struct hypertriton3bodyAnalysis { kCandTPCNcls, kCandDauPt, kCandDcaToPV, - kNVtxSteps }; + kCandInvMass, + kNCandSteps }; + + struct { + std::array candstats; + std::array truecandstats; + } statisticsRegistry; + + void resetHistos() + { + for (Int_t ii = 0; ii < kNCandSteps; ii++) { + statisticsRegistry.candstats[ii] = 0; + statisticsRegistry.truecandstats[ii] = 0; + } + } + void FillCandCounter(int kn, bool istrue = false) + { + statisticsRegistry.candstats[kn]++; + if (istrue) { + statisticsRegistry.truecandstats[kn]++; + } + } + void fillHistos() + { + for (Int_t ii = 0; ii < kNCandSteps; ii++) { + registry.fill(HIST("hCandidatesCounter"), ii, statisticsRegistry.candstats[ii]); + registry.fill(HIST("hTrueHypertritonCounter"), ii, statisticsRegistry.truecandstats[ii]); + } + } Configurable saveDcaHist{"saveDcaHist", 1, "saveDcaHist"}; ConfigurableAxis dcaBinning{"dca-binning", {200, 0.0f, 1.0f}, ""}; @@ -225,170 +271,355 @@ struct hypertriton3bodyAnalysis { registry.add("h3dMassAntiHypertritonDca", "h3dMassAntiHypertritonDca", {HistType::kTH3F, {dcaAxis, ptAxis, massAxisHypertriton}}); } - TString CandCounterbinLabel[11] = {"Total", "VtxCosPA", "TrackEta", "MomRapidity", "Lifetime", "VtxDcaDau", "d TOFPID", "TPCPID&Mass", "TPCNcls", "DauPt", "PionDcatoPV"}; - for (int i{0}; i < kNVtxSteps; i++) { - registry.get(HIST("hSelectedCandidatesCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); + TString CandCounterbinLabel[12] = {"Total", "VtxCosPA", "TrackEta", "MomRapidity", "Lifetime", "VtxDcaDau", "d TOFPID", "TPCPID", "TPCNcls", "DauPt", "PionDcatoPV", "InvMass"}; + for (int i{0}; i < kNCandSteps; i++) { + registry.get(HIST("hCandidatesCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); + registry.get(HIST("hTrueHypertritonCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); } + + registry.get(HIST("hGeneratedHypertritonCounter"))->GetXaxis()->SetBinLabel(1, "Total"); + registry.get(HIST("hGeneratedHypertritonCounter"))->GetXaxis()->SetBinLabel(2, "3-body decay"); } - void process(soa::Join::iterator const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, MyTracks const& tracks) + //------------------------------------------------------------------ + Preslice perCollisionVtx3BodyDatas = o2::aod::vtx3body::collisionId; + //------------------------------------------------------------------ + // Analysis process for a single candidate + template + void CandidateAnalysis(TCollisionTable const& dCollision, TCandTable const& candData, bool& if_hasvtx, bool isTrueCand = false, double MClifetime = -1, double lPt = -1) { - registry.fill(HIST("hSelectedEventCounter"), 0.5); - if (event_sel8_selection && !collision.sel8()) { + + FillCandCounter(kCandAll, isTrueCand); + + auto track0 = candData.template track0_as(); + auto track1 = candData.template track1_as(); + auto track2 = candData.template track2_as(); + + auto& trackProton = (track2.sign() > 0) ? track0 : track1; + auto& trackPion = (track2.sign() > 0) ? track1 : track0; + auto& trackDeuteron = track2; + + if (candData.vtxcosPA(dCollision.posX(), dCollision.posY(), dCollision.posZ()) < vtxcospa) { + return; + } + FillCandCounter(kCandCosPA, isTrueCand); + if (TMath::Abs(trackProton.eta()) > etacut || TMath::Abs(trackPion.eta()) > etacut || TMath::Abs(trackDeuteron.eta()) > etacut) { + return; + } + FillCandCounter(kCandDauEta, isTrueCand); + if (TMath::Abs(candData.yHypertriton()) > rapiditycut) { + return; + } + FillCandCounter(kCandRapidity, isTrueCand); + double ct = candData.distovertotmom(dCollision.posX(), dCollision.posY(), dCollision.posZ()) * o2::constants::physics::MassHyperTriton; + if (ct > lifetimecut) { + return; + } + FillCandCounter(kCandct, isTrueCand); + if (candData.dcaVtxdaughters() > dcavtxdau) { return; } - registry.fill(HIST("hSelectedEventCounter"), 1.5); + FillCandCounter(kCandDcaDau, isTrueCand); - bool if_hasvtx = false; + registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tofNSigmaDe()); + if (isTrueCand) { + registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCutSig"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tofNSigmaDe()); + } + if ((trackDeuteron.tofNSigmaDe() < TofPidNsigmaMin || trackDeuteron.tofNSigmaDe() > TofPidNsigmaMax) && trackDeuteron.p() > minDeuteronPUseTOF) { + return; + } + FillCandCounter(kCandTOFPID, isTrueCand); + registry.fill(HIST("hDeuteronTOFVsPAtferTOFCut"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tofNSigmaDe()); + if (isTrueCand) { + registry.fill(HIST("hDeuteronTOFVsPAtferTOFCutSig"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tofNSigmaDe()); + } - for (auto& vtx : vtx3bodydatas) { + if (TMath::Abs(trackProton.tpcNSigmaPr()) > TpcPidNsigmaCut || TMath::Abs(trackPion.tpcNSigmaPi()) > TpcPidNsigmaCut || TMath::Abs(trackDeuteron.tpcNSigmaDe()) > TpcPidNsigmaCut) { + return; + } + FillCandCounter(kCandTPCPID, isTrueCand); - auto track0 = vtx.track0_as(); - auto track1 = vtx.track1_as(); - auto track2 = vtx.track2_as(); + if (trackProton.tpcNClsCrossedRows() < mincrossedrowsproton || trackPion.tpcNClsCrossedRows() < mincrossedrowspion || trackDeuteron.tpcNClsCrossedRows() < mincrossedrowsdeuteron) { + return; + } + FillCandCounter(kCandTPCNcls, isTrueCand); - registry.fill(HIST("hSelectedCandidatesCounter"), kCandAll); - if (vtx.vtxcosPA(collision.posX(), collision.posY(), collision.posZ()) < vtxcospa) { - continue; + if (trackProton.pt() < minProtonPt || trackProton.pt() > maxProtonPt || trackPion.pt() < minPionPt || trackPion.pt() > maxPionPt || trackDeuteron.pt() < minDeuteronPt || trackDeuteron.pt() > maxDeuteronPt) { + return; + } + FillCandCounter(kCandDauPt, isTrueCand); + + double dcapion = (track2.sign() > 0) ? candData.dcatrack1topv() : candData.dcatrack0topv(); + if (TMath::Abs(dcapion) < dcapiontopv) { + return; + } + FillCandCounter(kCandDcaToPV, isTrueCand); + + // 3sigma region for Dalitz plot + double lowersignallimit = o2::constants::physics::MassHyperTriton - 3 * mcsigma; + double uppersignallimit = o2::constants::physics::MassHyperTriton + 3 * mcsigma; + + // Hypertriton + if ((track2.sign() > 0 && candData.mHypertriton() > h3LMassLowerlimit && candData.mHypertriton() < h3LMassUpperlimit)) { + if_hasvtx = true; + FillCandCounter(kCandInvMass, isTrueCand); + + registry.fill(HIST("hPtProton"), trackProton.pt()); + registry.fill(HIST("hPtAntiPion"), trackPion.pt()); + registry.fill(HIST("hPtDeuteron"), trackDeuteron.pt()); + registry.fill(HIST("hDCAProtonToPV"), candData.dcatrack0topv()); + registry.fill(HIST("hDCAPionToPV"), candData.dcatrack1topv()); + + registry.fill(HIST("hMassHypertriton"), candData.mHypertriton()); + registry.fill(HIST("hMassHypertritonTotal"), candData.mHypertriton()); + registry.fill(HIST("h3dMassHypertriton"), 0., candData.pt(), candData.mHypertriton()); // dCollision.centV0M() instead of 0. once available + registry.fill(HIST("h3dTotalHypertriton"), ct, candData.pt(), candData.mHypertriton()); + if (candData.mHypertriton() > lowersignallimit && candData.mHypertriton() < uppersignallimit) { + registry.fill(HIST("hDalitz"), RecoDecay::m2(array{array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(array{array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}, array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); } - registry.fill(HIST("hSelectedCandidatesCounter"), kCandCosPA); - if (TMath::Abs(track0.eta()) > etacut || TMath::Abs(track1.eta()) > etacut || TMath::Abs(track2.eta()) > etacut) { - continue; + if (isTrueCand) { + registry.fill(HIST("h3dTotalTrueHypertriton"), MClifetime, lPt, candData.mHypertriton()); } - registry.fill(HIST("hSelectedCandidatesCounter"), kCandDauEta); - if (TMath::Abs(vtx.yHypertriton()) > rapidity) { - continue; + if (saveDcaHist == 1) { + registry.fill(HIST("h3dMassHypertritonDca"), candData.dcaVtxdaughters(), candData.pt(), candData.mHypertriton()); } - registry.fill(HIST("hSelectedCandidatesCounter"), kCandRapidity); - double ct = vtx.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassHyperTriton; - if (ct > lifetimecut) { - continue; + } else if ((track2.sign() < 0 && candData.mAntiHypertriton() > h3LMassLowerlimit && candData.mAntiHypertriton() < h3LMassUpperlimit)) { + // AntiHypertriton + if_hasvtx = true; + FillCandCounter(kCandInvMass, isTrueCand); + + registry.fill(HIST("hPtAntiProton"), trackProton.pt()); + registry.fill(HIST("hPtPion"), trackPion.pt()); + registry.fill(HIST("hPtAntiDeuteron"), trackDeuteron.pt()); + registry.fill(HIST("hDCAProtonToPV"), candData.dcatrack1topv()); + registry.fill(HIST("hDCAPionToPV"), candData.dcatrack0topv()); + + registry.fill(HIST("hMassAntiHypertriton"), candData.mAntiHypertriton()); + registry.fill(HIST("hMassHypertritonTotal"), candData.mAntiHypertriton()); + registry.fill(HIST("h3dMassAntiHypertriton"), 0., candData.pt(), candData.mAntiHypertriton()); // dCollision.centV0M() instead of 0. once available + registry.fill(HIST("h3dTotalHypertriton"), ct, candData.pt(), candData.mAntiHypertriton()); + if (candData.mAntiHypertriton() > lowersignallimit && candData.mAntiHypertriton() < uppersignallimit) { + registry.fill(HIST("hDalitz"), RecoDecay::m2(array{array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, array{candData.pxtrack2(), candData.pytrack2(), candData.pztrack2()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), RecoDecay::m2(array{array{candData.pxtrack1(), candData.pytrack1(), candData.pztrack1()}, array{candData.pxtrack0(), candData.pytrack0(), candData.pztrack0()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); } - registry.fill(HIST("hSelectedCandidatesCounter"), kCandct); - if (vtx.dcaVtxdaughters() > dcavtxdau) { - continue; + if (isTrueCand) { + registry.fill(HIST("h3dTotalTrueHypertriton"), MClifetime, lPt, candData.mHypertriton()); + } + if (saveDcaHist == 1) { + registry.fill(HIST("h3dMassAntiHypertritonDca"), candData.dcaVtxdaughters(), candData.pt(), candData.mAntiHypertriton()); } - registry.fill(HIST("hSelectedCandidatesCounter"), kCandDcaDau); - if ((track2.tofNSigmaDe() < TofPidNsigmaMin || track2.tofNSigmaDe() > TofPidNsigmaMax) && track2.p() > minDeuteronPUseTOF) { + } else { + return; + } + registry.fill(HIST("hDCADeuteronToPV"), candData.dcatrack2topv()); + registry.fill(HIST("hVtxCosPA"), candData.vtxcosPA(dCollision.posX(), dCollision.posY(), dCollision.posZ())); + registry.fill(HIST("hDCAVtxDau"), candData.dcaVtxdaughters()); + registry.fill(HIST("hProtonTPCNcls"), trackProton.tpcNClsCrossedRows()); + registry.fill(HIST("hPionTPCNcls"), trackPion.tpcNClsCrossedRows()); + registry.fill(HIST("hDeuteronTPCNcls"), trackDeuteron.tpcNClsCrossedRows()); + registry.fill(HIST("hTPCPIDProton"), trackProton.tpcNSigmaPr()); + registry.fill(HIST("hTPCPIDPion"), trackPion.tpcNSigmaPi()); + registry.fill(HIST("hTPCPIDDeuteron"), trackDeuteron.tpcNSigmaDe()); + registry.fill(HIST("hProtonTPCBB"), trackProton.sign() * trackProton.p(), trackProton.tpcSignal()); + registry.fill(HIST("hPionTPCBB"), trackPion.sign() * trackPion.p(), trackPion.tpcSignal()); + registry.fill(HIST("hDeuteronTPCBB"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tpcSignal()); + registry.fill(HIST("hProtonTPCVsPt"), trackProton.pt(), trackProton.tpcNSigmaPr()); + registry.fill(HIST("hPionTPCVsPt"), trackProton.pt(), trackPion.tpcNSigmaPi()); + registry.fill(HIST("hDeuteronTPCVsPt"), trackDeuteron.pt(), trackDeuteron.tpcNSigmaDe()); + registry.fill(HIST("hTOFPIDDeuteron"), trackDeuteron.tofNSigmaDe()); + } + + //------------------------------------------------------------------ + // collect information for generated hypertriton (should be called after event selection) + void GetGeneratedH3LInfo(aod::McParticles const& particlesMC) + { + for (auto& mcparticle : particlesMC) { + if (mcparticle.pdgCode() != 1010010030 && mcparticle.pdgCode() != -1010010030) { continue; } - registry.fill(HIST("hSelectedCandidatesCounter"), kCandTOFPID); - - // 3sigma region for Dalitz plot - double lowersignallimit = o2::constants::physics::MassHyperTriton - 3 * mcsigma; - double uppersignallimit = o2::constants::physics::MassHyperTriton + 3 * mcsigma; - - // Hypertriton - if (TMath::Abs(track0.tpcNSigmaPr()) < TpcPidNsigmaCut && TMath::Abs(track1.tpcNSigmaPi()) < TpcPidNsigmaCut && TMath::Abs(track2.tpcNSigmaDe()) < TpcPidNsigmaCut && vtx.mHypertriton() > h3LMassLowerlimit && vtx.mHypertriton() < h3LMassUpperlimit) { - - registry.fill(HIST("hSelectedCandidatesCounter"), kCandTPCPID); - - if (track0.tpcNClsCrossedRows() > mincrossedrowsproton && track1.tpcNClsCrossedRows() > mincrossedrowspion && track2.tpcNClsCrossedRows() > mincrossedrowsdeuteron) { - - registry.fill(HIST("hSelectedCandidatesCounter"), kCandTPCNcls); - - if (vtx.track0pt() > minProtonPt && vtx.track0pt() < maxProtonPt && vtx.track1pt() > minPionPt && vtx.track1pt() < maxPionPt && vtx.track2pt() > minDeuteronPt && vtx.track2pt() < maxDeuteronPt) { - registry.fill(HIST("hSelectedCandidatesCounter"), kCandDauPt); - - if (TMath::Abs(vtx.dcatrack1topv()) > dcapiontopv) { - if_hasvtx = true; - registry.fill(HIST("hSelectedCandidatesCounter"), kCandDcaToPV); - - registry.fill(HIST("hVtxCosPA"), vtx.vtxcosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("hDCAVtxDau"), vtx.dcaVtxdaughters()); - registry.fill(HIST("hPtProton"), vtx.track0pt()); - registry.fill(HIST("hPtAntiPion"), vtx.track1pt()); - registry.fill(HIST("hPtDeuteron"), vtx.track2pt()); - registry.fill(HIST("hDCAProtonToPV"), vtx.dcatrack0topv()); - registry.fill(HIST("hDCAPionToPV"), vtx.dcatrack1topv()); - registry.fill(HIST("hDCADeuteronToPV"), vtx.dcatrack2topv()); - registry.fill(HIST("hProtonTPCNcls"), track0.tpcNClsCrossedRows()); - registry.fill(HIST("hPionTPCNcls"), track1.tpcNClsCrossedRows()); - registry.fill(HIST("hDeuteronTPCNcls"), track2.tpcNClsCrossedRows()); - registry.fill(HIST("hTOFPIDDeuteron"), track2.tofNSigmaDe()); - registry.fill(HIST("hTPCPIDProton"), track0.tpcNSigmaPr()); - registry.fill(HIST("hTPCPIDPion"), track1.tpcNSigmaPi()); - registry.fill(HIST("hTPCPIDDeuteron"), track2.tpcNSigmaDe()); - registry.fill(HIST("hProtonTPCBB"), track0.p(), track0.tpcSignal()); - registry.fill(HIST("hPionTPCBB"), -track1.p(), track1.tpcSignal()); - registry.fill(HIST("hDeuteronTPCBB"), track2.p(), track0.tpcSignal()); - registry.fill(HIST("hProtonTPCVsPt"), vtx.track0pt(), track0.tpcNSigmaPr()); - registry.fill(HIST("hPionTPCVsPt"), vtx.track1pt(), track1.tpcNSigmaPi()); - registry.fill(HIST("hDeuteronTPCVsPt"), vtx.track2pt(), track2.tpcNSigmaDe()); - registry.fill(HIST("hMassHypertriton"), vtx.mHypertriton()); - registry.fill(HIST("hMassHypertritonTotal"), vtx.mHypertriton()); - registry.fill(HIST("h3dMassHypertriton"), 0., vtx.pt(), vtx.mHypertriton()); // collision.centV0M() instead of 0. once available - registry.fill(HIST("h3dTotalHypertriton"), ct, vtx.pt(), vtx.mHypertriton()); - if (vtx.mHypertriton() > lowersignallimit && vtx.mHypertriton() < uppersignallimit) { - registry.fill(HIST("hDalitz"), RecoDecay::m2(array{array{vtx.pxtrack0(), vtx.pytrack0(), vtx.pztrack0()}, array{vtx.pxtrack2(), vtx.pytrack2(), vtx.pztrack2()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), - RecoDecay::m2(array{array{vtx.pxtrack0(), vtx.pytrack0(), vtx.pztrack0()}, array{vtx.pxtrack1(), vtx.pytrack1(), vtx.pztrack1()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); - } + registry.fill(HIST("hGeneratedHypertritonCounter"), 0.5); + + bool haveProton = false, havePion = false, haveDeuteron = false; + bool haveAntiProton = false, haveAntiPion = false, haveAntiDeuteron = false; + double MClifetime = -1; + for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { + if (mcparticleDaughter.pdgCode() == 2212) + haveProton = true; + if (mcparticleDaughter.pdgCode() == -2212) + haveAntiProton = true; + if (mcparticleDaughter.pdgCode() == 211) + havePion = true; + if (mcparticleDaughter.pdgCode() == -211) + haveAntiPion = true; + if (mcparticleDaughter.pdgCode() == 1000010020) { + haveDeuteron = true; + MClifetime = RecoDecay::sqrtSumOfSquares(mcparticleDaughter.vx() - mcparticle.vx(), mcparticleDaughter.vy() - mcparticle.vy(), mcparticleDaughter.vz() - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); + } + if (mcparticleDaughter.pdgCode() == -1000010020) { + haveAntiDeuteron = true; + MClifetime = RecoDecay::sqrtSumOfSquares(mcparticleDaughter.vx() - mcparticle.vx(), mcparticleDaughter.vy() - mcparticle.vy(), mcparticleDaughter.vz() - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); + } + } + if (haveProton && haveAntiPion && haveDeuteron && mcparticle.pdgCode() == 1010010030) { + registry.fill(HIST("hGeneratedHypertritonCounter"), 1.5); + registry.fill(HIST("hPtGeneratedHypertriton"), mcparticle.pt()); + registry.fill(HIST("hctGeneratedHypertriton"), MClifetime); + registry.fill(HIST("hEtaGeneratedHypertriton"), mcparticle.eta()); + registry.fill(HIST("hRapidityGeneratedHypertriton"), mcparticle.y()); + } else if (haveAntiProton && havePion && haveAntiDeuteron && mcparticle.pdgCode() == -1010010030) { + registry.fill(HIST("hGeneratedHypertritonCounter"), 1.5); + registry.fill(HIST("hPtGeneratedAntiHypertriton"), mcparticle.pt()); + registry.fill(HIST("hctGeneratedAntiHypertriton"), MClifetime); + registry.fill(HIST("hEtaGeneratedAntiHypertriton"), mcparticle.eta()); + registry.fill(HIST("hRapidityGeneratedAntiHypertriton"), mcparticle.y()); + } + } + } - if (saveDcaHist == 1) { - registry.fill(HIST("h3dMassHypertritonDca"), vtx.dcaVtxdaughters(), vtx.pt(), vtx.mHypertriton()); + //------------------------------------------------------------------ + // process real data analysis + void processData(soa::Join::iterator const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const& tracks) + { + registry.fill(HIST("hEventCounter"), 0.5); + if (event_sel8_selection && !collision.sel8()) { + return; + } + registry.fill(HIST("hEventCounter"), 1.5); + + bool if_hasvtx = false; + + for (auto& vtx : vtx3bodydatas) { + CandidateAnalysis(collision, vtx, if_hasvtx); + } + + if (if_hasvtx) + registry.fill(HIST("hEventCounter"), 2.5); + fillHistos(); + resetHistos(); + } + PROCESS_SWITCH(hypertriton3bodyAnalysis, processData, "Real data analysis", true); + + //------------------------------------------------------------------ + // process mc analysis + void processMC(soa::Join const& collisions, aod::Vtx3BodyDatas const& vtx3bodydatas, aod::McParticles const& particlesMC, MCLabeledFullTracksExtIU const& tracks) + { + GetGeneratedH3LInfo(particlesMC); + + for (const auto& collision : collisions) { + registry.fill(HIST("hEventCounter"), 0.5); + if (event_sel8_selection && !collision.sel8()) { + continue; + } + registry.fill(HIST("hEventCounter"), 1.5); + + bool if_hasvtx = false; + auto vtxsthiscol = vtx3bodydatas.sliceBy(perCollisionVtx3BodyDatas, collision.globalIndex()); + + for (auto& vtx : vtxsthiscol) { + // int lLabel = -1; + int lPDG = -1; + float lPt = -1; + double MClifetime = -1; + bool isTrueCand = false; + auto track0 = vtx.track0_as(); + auto track1 = vtx.track1_as(); + auto track2 = vtx.track2_as(); + if (track0.has_mcParticle() && track1.has_mcParticle() && track2.has_mcParticle()) { + auto lMCTrack0 = track0.mcParticle_as(); + auto lMCTrack1 = track1.mcParticle_as(); + auto lMCTrack2 = track2.mcParticle_as(); + if (lMCTrack0.has_mothers() && lMCTrack1.has_mothers() && lMCTrack2.has_mothers()) { + for (auto& lMother0 : lMCTrack0.mothers_as()) { + for (auto& lMother1 : lMCTrack1.mothers_as()) { + for (auto& lMother2 : lMCTrack2.mothers_as()) { + if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { + // lLabel = lMother1.globalIndex(); + lPt = lMother1.pt(); + lPDG = lMother1.pdgCode(); + if ((lPDG == 1010010030 && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == 1000010020) || + (lPDG == -1010010030 && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -1000010020)) { + isTrueCand = true; + MClifetime = RecoDecay::sqrtSumOfSquares(lMCTrack2.vx() - lMother2.vx(), lMCTrack2.vy() - lMother2.vy(), lMCTrack2.vz() - lMother2.vz()) * o2::constants::physics::MassHyperTriton / lMother2.p(); + } + } + } } } } } + + CandidateAnalysis(collision, vtx, if_hasvtx, isTrueCand, MClifetime, lPt); } - // AntiHypertriton - if (TMath::Abs(track0.tpcNSigmaPi()) < TpcPidNsigmaCut && TMath::Abs(track1.tpcNSigmaPr()) < TpcPidNsigmaCut && TMath::Abs(track2.tpcNSigmaDe()) < TpcPidNsigmaCut && vtx.mAntiHypertriton() > h3LMassLowerlimit && vtx.mAntiHypertriton() < h3LMassUpperlimit) { - - registry.fill(HIST("hSelectedCandidatesCounter"), kCandTPCPID); - - if (track0.tpcNClsCrossedRows() > mincrossedrowspion && track1.tpcNClsCrossedRows() > mincrossedrowsproton && track2.tpcNClsCrossedRows() > mincrossedrowsdeuteron) { - - registry.fill(HIST("hSelectedCandidatesCounter"), kCandTPCNcls); - - if (vtx.track0pt() > minPionPt && vtx.track0pt() < maxPionPt && vtx.track1pt() > minProtonPt && vtx.track1pt() < maxProtonPt && vtx.track2pt() > minDeuteronPt && vtx.track2pt() < maxDeuteronPt) { - registry.fill(HIST("hSelectedCandidatesCounter"), kCandDauPt); - if (TMath::Abs(vtx.dcatrack0topv()) > dcapiontopv) { - if_hasvtx = true; - registry.fill(HIST("hSelectedCandidatesCounter"), kCandDcaToPV); - - registry.fill(HIST("hVtxCosPA"), vtx.vtxcosPA(collision.posX(), collision.posY(), collision.posZ())); - registry.fill(HIST("hDCAVtxDau"), vtx.dcaVtxdaughters()); - registry.fill(HIST("hPtAntiProton"), vtx.track1pt()); - registry.fill(HIST("hPtPion"), vtx.track0pt()); - registry.fill(HIST("hPtAntiDeuteron"), vtx.track2pt()); - registry.fill(HIST("hDCAProtonToPV"), vtx.dcatrack1topv()); - registry.fill(HIST("hDCAPionToPV"), vtx.dcatrack0topv()); - registry.fill(HIST("hDCADeuteronToPV"), vtx.dcatrack2topv()); - registry.fill(HIST("hProtonTPCNcls"), track1.tpcNClsCrossedRows()); - registry.fill(HIST("hPionTPCNcls"), track0.tpcNClsCrossedRows()); - registry.fill(HIST("hDeuteronTPCNcls"), track2.tpcNClsCrossedRows()); - registry.fill(HIST("hTOFPIDDeuteron"), track2.tofNSigmaDe()); - registry.fill(HIST("hTPCPIDProton"), track1.tpcNSigmaPr()); - registry.fill(HIST("hTPCPIDPion"), track0.tpcNSigmaPi()); - registry.fill(HIST("hTPCPIDDeuteron"), track2.tpcNSigmaDe()); - registry.fill(HIST("hProtonTPCBB"), -track1.p(), track1.tpcSignal()); - registry.fill(HIST("hPionTPCBB"), track0.p(), track0.tpcSignal()); - registry.fill(HIST("hDeuteronTPCBB"), -track2.p(), track0.tpcSignal()); - registry.fill(HIST("hProtonTPCVsPt"), vtx.track1pt(), track1.tpcNSigmaPr()); - registry.fill(HIST("hPionTPCVsPt"), vtx.track0pt(), track0.tpcNSigmaPi()); - registry.fill(HIST("hDeuteronTPCVsPt"), vtx.track2pt(), track2.tpcNSigmaDe()); - registry.fill(HIST("hMassAntiHypertriton"), vtx.mAntiHypertriton()); - registry.fill(HIST("hMassHypertritonTotal"), vtx.mAntiHypertriton()); - registry.fill(HIST("h3dMassAntiHypertriton"), 0., vtx.pt(), vtx.mAntiHypertriton()); // collision.centV0M() instead of 0. once available - registry.fill(HIST("h3dTotalHypertriton"), ct, vtx.pt(), vtx.mAntiHypertriton()); - if (vtx.mAntiHypertriton() > lowersignallimit && vtx.mAntiHypertriton() < uppersignallimit) { - registry.fill(HIST("hDalitz"), RecoDecay::m2(array{array{vtx.pxtrack1(), vtx.pytrack1(), vtx.pztrack1()}, array{vtx.pxtrack2(), vtx.pytrack2(), vtx.pztrack2()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}), - RecoDecay::m2(array{array{vtx.pxtrack1(), vtx.pytrack1(), vtx.pztrack1()}, array{vtx.pxtrack0(), vtx.pytrack0(), vtx.pztrack0()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged})); - } + if (if_hasvtx) + registry.fill(HIST("hEventCounter"), 2.5); + fillHistos(); + resetHistos(); + } + } + PROCESS_SWITCH(hypertriton3bodyAnalysis, processMC, "MC analysis", false); +}; - if (saveDcaHist == 1) { - registry.fill(HIST("h3dMassAntiHypertritonDca"), vtx.dcaVtxdaughters(), vtx.pt(), vtx.mAntiHypertriton()); - } - } +// check vtx3body with mclabels +struct hypertriton3bodyLabelCheck { + HistogramRegistry registry{ + "registry", + { + {"hLabeledVtxCounter", "hLabeledVtxCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, + {"hMassTrueH3L", "hMassTrueH3L", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, + {"hMassTrueH3LMatter", "hMassTrueH3LMatter", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, + {"hMassTrueH3LAntiMatter", "hMassTrueH3LAntiMatter", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, + }, + }; + + void init(InitContext const&) + { + registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(1, "Readin"); + registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(2, "TrueMCH3L"); + registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(3, "Nonrepetitive"); + } + + Configurable event_sel8_selection{"event_sel8_selection", true, "event selection count post sel8 cut"}; + + void process(soa::Join::iterator const& collision) + { + // dummy function + } + PROCESS_SWITCH(hypertriton3bodyLabelCheck, process, "Donot check MC label tables", true); + + void processCheckLabel(soa::Join::iterator const& collision, soa::Join const& vtx3bodydatas, MCLabeledFullTracksExtIU const& tracks, aod::McParticles const& particlesMC) + { + if (event_sel8_selection && !collision.sel8()) { + return; + } + + std::vector set_mothertrack; + for (auto& vtx : vtx3bodydatas) { + registry.fill(HIST("hLabeledVtxCounter"), 0.5); + if (vtx.mcParticleId() != -1) { + auto mcparticle = vtx.mcParticle_as(); + if (mcparticle.pdgCode() == 1010010030) { + registry.fill(HIST("hLabeledVtxCounter"), 1.5); + registry.fill(HIST("hMassTrueH3L"), vtx.mHypertriton()); + registry.fill(HIST("hMassTrueH3LMatter"), vtx.mHypertriton()); + auto p = std::find(set_mothertrack.begin(), set_mothertrack.end(), mcparticle.globalIndex()); + if (p == set_mothertrack.end()) { + set_mothertrack.push_back(mcparticle.globalIndex()); + registry.fill(HIST("hLabeledVtxCounter"), 2.5); + } + } else if (mcparticle.pdgCode() == -1010010030) { + registry.fill(HIST("hLabeledVtxCounter"), 1.5); + registry.fill(HIST("hMassTrueH3L"), vtx.mAntiHypertriton()); + registry.fill(HIST("hMassTrueH3LAntiMatter"), vtx.mAntiHypertriton()); + auto p = std::find(set_mothertrack.begin(), set_mothertrack.end(), mcparticle.globalIndex()); + if (p == set_mothertrack.end()) { + set_mothertrack.push_back(mcparticle.globalIndex()); + registry.fill(HIST("hLabeledVtxCounter"), 2.5); } } } } - - if (if_hasvtx) - registry.fill(HIST("hSelectedEventCounter"), 2.5); } + PROCESS_SWITCH(hypertriton3bodyLabelCheck, processCheckLabel, "Check MC label tables", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) @@ -396,5 +627,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) return WorkflowSpec{ adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), }; } From 5efa0991cd029b72588fecbdd0d3efb21ba1ddd0 Mon Sep 17 00:00:00 2001 From: Nazar Burmasov Date: Thu, 1 Feb 2024 12:50:39 +0300 Subject: [PATCH 29/33] EventSelectionQA, Fix fetched BC type (#4531) --- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index 16d6e30f15c..33b09fee4c5 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -798,7 +798,7 @@ struct EventSelectionQaTask { for (const auto& track : tracks) { auto mapAmbTrIdsIt = mapAmbTrIds.find(track.globalIndex()); int ambTrId = mapAmbTrIdsIt == mapAmbTrIds.end() ? -1 : mapAmbTrIdsIt->second; - int indexBc = ambTrId < 0 ? track.collision_as().bc_as().globalIndex() : ambTracks.iteratorAt(ambTrId).bc().begin().globalIndex(); + int indexBc = ambTrId < 0 ? track.collision_as().bc_as().globalIndex() : ambTracks.iteratorAt(ambTrId).bc_as().begin().globalIndex(); auto bc = bcs.iteratorAt(indexBc); int64_t globalBC = bc.globalBC() + floor(track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS); From 64d6097b624c2313d22038ac27d047ea5ea1e1be Mon Sep 17 00:00:00 2001 From: Junlee Kim Date: Thu, 1 Feb 2024 18:59:20 +0900 Subject: [PATCH 30/33] [Event Plane] Adding CCDB connection (#4542) * Adding CCDB connection * fix * fix * fix * fix * Please consider the following formatting changes --------- Co-authored-by: junleekim Co-authored-by: ALICE Action Bot --- Common/TableProducer/qVectorsTable.cxx | 111 ++++++++++++++++++++----- Common/Tasks/qVectorsCorrection.cxx | 30 +++---- 2 files changed, 103 insertions(+), 38 deletions(-) diff --git a/Common/TableProducer/qVectorsTable.cxx b/Common/TableProducer/qVectorsTable.cxx index 0e51ffdd6bb..dd42ed8408f 100644 --- a/Common/TableProducer/qVectorsTable.cxx +++ b/Common/TableProducer/qVectorsTable.cxx @@ -74,6 +74,8 @@ struct qVectorsTable { Configurable cfgCentEsti{"cfgCentEsti", 2, "Centrality estimator (Run3): 0 = FT0M, 1 = FT0A, 2 = FT0C, 3 = FV0A"}; + Configurable cfgCCDBConst{"cfgCCDBConst", 1, "Using constants in CCDB, 1 = CCDB, 2= Configurable"}; + // LOKI: We have here all centrality estimators for Run 3 (except FDDM and NTPV), // but the Q-vectors are calculated only for some of them. // FIXME: 6 correction factors for each centrality and 8 centrality intervals are hard-coded. @@ -147,30 +149,93 @@ struct qVectorsTable { LOGF(fatal, "Could not get the alignment parameters for FV0."); } - if (cfgFT0CCorr->size() < 48) { - LOGF(fatal, "No proper correction factor assigned for FT0C"); - } - if (cfgFT0ACorr->size() < 48) { - LOGF(fatal, "No proper correction factor assigned for FT0A"); - } - if (cfgFT0MCorr->size() < 48) { - LOGF(fatal, "No proper correction factor assigned for FT0M"); - } - if (cfgFV0ACorr->size() < 48) { - LOGF(fatal, "No proper correction factor assigned for FV0A"); - } - if (cfgBPosCorr->size() < 48) { - LOGF(fatal, "No proper correction factor assigned for positive TPC tracks"); + if (cfgCCDBConst == 1) { + if (!(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/FT0C", cfgCcdbParam.nolaterthan.value))->empty()) { + cfgCorr.push_back(*(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/FT0C", cfgCcdbParam.nolaterthan.value))); + } else { + if (cfgFT0CCorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for FT0C"); + } else { + cfgCorr.push_back(cfgFT0CCorr); + } + } + + if (!(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/FT0A", cfgCcdbParam.nolaterthan.value))->empty()) { + cfgCorr.push_back(*(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/FT0A", cfgCcdbParam.nolaterthan.value))); + } else { + if (cfgFT0ACorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for FT0A"); + } else { + cfgCorr.push_back(cfgFT0ACorr); + } + } + + if (!(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/FT0M", cfgCcdbParam.nolaterthan.value))->empty()) { + cfgCorr.push_back(*(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/FT0M", cfgCcdbParam.nolaterthan.value))); + } else { + if (cfgFT0MCorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for FT0M"); + } else { + cfgCorr.push_back(cfgFT0MCorr); + } + } + + if (!(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/FT0C", cfgCcdbParam.nolaterthan.value))->empty()) { + cfgCorr.push_back(*(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/FT0C", cfgCcdbParam.nolaterthan.value))); + } else { + if (cfgFV0ACorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for FV0A"); + } else { + cfgCorr.push_back(cfgFV0ACorr); + } + } // no FV0A + + if (!(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/BPos", cfgCcdbParam.nolaterthan.value))->empty()) { + cfgCorr.push_back(*(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/BPos", cfgCcdbParam.nolaterthan.value))); + } else { + if (cfgBPosCorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for BPos"); + } else { + cfgCorr.push_back(cfgBPosCorr); + } + } + + if (!(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/BNeg", cfgCcdbParam.nolaterthan.value))->empty()) { + cfgCorr.push_back(*(ccdb->getForTimeStamp>("Analysis/EventPlane/QVecCorrections/BNeg", cfgCcdbParam.nolaterthan.value))); + } else { + if (cfgBNegCorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for BNeg"); + } else { + cfgCorr.push_back(cfgBNegCorr); + } + } + } else if (cfgCCDBConst == 2) { + if (cfgFT0CCorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for FT0C"); + } + if (cfgFT0ACorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for FT0A"); + } + if (cfgFT0MCorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for FT0M"); + } + if (cfgFV0ACorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for FV0A"); + } + if (cfgBPosCorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for positive TPC tracks"); + } + if (cfgBNegCorr->size() < 48) { + LOGF(fatal, "No proper correction factor assigned for negative TPC tracks"); + } // will be replaced with method that call constants from CCDB + + cfgCorr.push_back(cfgFT0CCorr); + cfgCorr.push_back(cfgFT0ACorr); + cfgCorr.push_back(cfgFT0MCorr); + cfgCorr.push_back(cfgFV0ACorr); + cfgCorr.push_back(cfgBPosCorr); + cfgCorr.push_back(cfgBNegCorr); } - if (cfgBNegCorr->size() < 48) { - LOGF(fatal, "No proper correction factor assigned for negative TPC tracks"); - } // will be replaced with method that call constants from CCDB - cfgCorr.push_back(cfgFT0CCorr); - cfgCorr.push_back(cfgFT0ACorr); - cfgCorr.push_back(cfgFT0MCorr); - cfgCorr.push_back(cfgFV0ACorr); - cfgCorr.push_back(cfgBPosCorr); - cfgCorr.push_back(cfgBNegCorr); /* // Debug printing. printf("Offset for FT0A: x = %.3f y = %.3f\n", (*offsetFT0)[0].getX(), (*offsetFT0)[0].getY()); diff --git a/Common/Tasks/qVectorsCorrection.cxx b/Common/Tasks/qVectorsCorrection.cxx index b639d1e77df..e91497b4fb8 100644 --- a/Common/Tasks/qVectorsCorrection.cxx +++ b/Common/Tasks/qVectorsCorrection.cxx @@ -168,10 +168,10 @@ struct qVectorsCorrection { histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histQvecTwist"), vec.qvecRe()[DetId * 4 + 2], vec.qvecIm()[DetId * 4 + 2]); histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histQvecFinal"), vec.qvecRe()[DetId * 4 + 3], vec.qvecIm()[DetId * 4 + 3]); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlUncor"), helperEP.GetEventPlane(vec.qvecRe()[DetId * 4], vec.qvecIm()[DetId * 4], 2)); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRectr"), helperEP.GetEventPlane(vec.qvecRe()[DetId * 4 + 1], vec.qvecIm()[DetId * 4 + 1], 2)); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlTwist"), helperEP.GetEventPlane(vec.qvecRe()[DetId * 4 + 2], vec.qvecIm()[DetId * 4 + 2], 2)); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlFinal"), helperEP.GetEventPlane(vec.qvecRe()[DetId * 4 + 3], vec.qvecIm()[DetId * 4 + 3], 2)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlUncor"), helperEP.GetEventPlane(vec.qvecRe()[DetId * 4], vec.qvecIm()[DetId * 4], cfgnMod)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRectr"), helperEP.GetEventPlane(vec.qvecRe()[DetId * 4 + 1], vec.qvecIm()[DetId * 4 + 1], cfgnMod)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlTwist"), helperEP.GetEventPlane(vec.qvecRe()[DetId * 4 + 2], vec.qvecIm()[DetId * 4 + 2], cfgnMod)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlFinal"), helperEP.GetEventPlane(vec.qvecRe()[DetId * 4 + 3], vec.qvecIm()[DetId * 4 + 3], cfgnMod)); } if (vec.qvecAmp()[RefAId] > 1e-8) { @@ -180,10 +180,10 @@ struct qVectorsCorrection { histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histQvecRefATwist"), vec.qvecRe()[RefAId * 4 + 2], vec.qvecIm()[RefAId * 4 + 2]); histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histQvecRefAFinal"), vec.qvecRe()[RefAId * 4 + 3], vec.qvecIm()[RefAId * 4 + 3]); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefAUncor"), helperEP.GetEventPlane(vec.qvecRe()[RefAId * 4], vec.qvecIm()[RefAId * 4], 2)); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefARectr"), helperEP.GetEventPlane(vec.qvecRe()[RefAId * 4 + 1], vec.qvecIm()[RefAId * 4 + 1], 2)); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefATwist"), helperEP.GetEventPlane(vec.qvecRe()[RefAId * 4 + 2], vec.qvecIm()[RefAId * 4 + 2], 2)); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefAFinal"), helperEP.GetEventPlane(vec.qvecRe()[RefAId * 4 + 3], vec.qvecIm()[RefAId * 4 + 3], 2)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefAUncor"), helperEP.GetEventPlane(vec.qvecRe()[RefAId * 4], vec.qvecIm()[RefAId * 4], cfgnMod)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefARectr"), helperEP.GetEventPlane(vec.qvecRe()[RefAId * 4 + 1], vec.qvecIm()[RefAId * 4 + 1], cfgnMod)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefATwist"), helperEP.GetEventPlane(vec.qvecRe()[RefAId * 4 + 2], vec.qvecIm()[RefAId * 4 + 2], cfgnMod)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefAFinal"), helperEP.GetEventPlane(vec.qvecRe()[RefAId * 4 + 3], vec.qvecIm()[RefAId * 4 + 3], cfgnMod)); } if (vec.qvecAmp()[RefBId] > 1e-8) { @@ -192,17 +192,17 @@ struct qVectorsCorrection { histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histQvecRefBTwist"), vec.qvecRe()[RefBId * 4 + 2], vec.qvecIm()[RefBId * 4 + 2]); histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histQvecRefBFinal"), vec.qvecRe()[RefBId * 4 + 3], vec.qvecIm()[RefBId * 4 + 3]); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefBUncor"), helperEP.GetEventPlane(vec.qvecRe()[RefBId * 4], vec.qvecIm()[RefBId * 4], 2)); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefBRectr"), helperEP.GetEventPlane(vec.qvecRe()[RefBId * 4 + 1], vec.qvecIm()[RefBId * 4 + 1], 2)); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefBTwist"), helperEP.GetEventPlane(vec.qvecRe()[RefBId * 4 + 2], vec.qvecIm()[RefBId * 4 + 2], 2)); - histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefBFinal"), helperEP.GetEventPlane(vec.qvecRe()[RefBId * 4 + 3], vec.qvecIm()[RefBId * 4 + 3], 2)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefBUncor"), helperEP.GetEventPlane(vec.qvecRe()[RefBId * 4], vec.qvecIm()[RefBId * 4], cfgnMod)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefBRectr"), helperEP.GetEventPlane(vec.qvecRe()[RefBId * 4 + 1], vec.qvecIm()[RefBId * 4 + 1], cfgnMod)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefBTwist"), helperEP.GetEventPlane(vec.qvecRe()[RefBId * 4 + 2], vec.qvecIm()[RefBId * 4 + 2], cfgnMod)); + histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlRefBFinal"), helperEP.GetEventPlane(vec.qvecRe()[RefBId * 4 + 3], vec.qvecIm()[RefBId * 4 + 3], cfgnMod)); } if (vec.qvecAmp()[DetId] > 1e-8 && vec.qvecAmp()[RefAId] > 1e-8 && vec.qvecAmp()[RefBId] > 1e-8) { histosQA.fill(HIST(qV::centClasses[cBin]) + HIST("histEvtPlResolution"), helperEP.GetResolution( - helperEP.GetEventPlane(vec.qvecRe()[RefAId * 4 + 3], vec.qvecIm()[RefAId * 4 + 3], 2), - helperEP.GetEventPlane(vec.qvecRe()[RefBId * 4 + 3], vec.qvecIm()[RefBId * 4 + 3], 2), - helperEP.GetEventPlane(vec.qvecRe()[DetId * 4 + 3], vec.qvecIm()[DetId * 4 + 3], 2), 2)); + helperEP.GetEventPlane(vec.qvecRe()[RefAId * 4 + 3], vec.qvecIm()[RefAId * 4 + 3], cfgnMod), + helperEP.GetEventPlane(vec.qvecRe()[RefBId * 4 + 3], vec.qvecIm()[RefBId * 4 + 3], cfgnMod), + helperEP.GetEventPlane(vec.qvecRe()[DetId * 4 + 3], vec.qvecIm()[DetId * 4 + 3], cfgnMod), cfgnMod)); } } From 152b7afea6deee657641880e78962cef94076b1d Mon Sep 17 00:00:00 2001 From: Daiki Sekihata Date: Thu, 1 Feb 2024 22:54:02 +0900 Subject: [PATCH 31/33] PWGEM/PhotonMeson: quick fix for MC histograms (#4547) --- PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx | 8 +++---- PWGEM/PhotonMeson/Core/HistogramsLibrary.h | 4 ++-- PWGEM/PhotonMeson/DataModel/gammaTables.h | 4 ++-- .../TableProducer/skimmerPrimaryElectron.cxx | 2 +- .../TableProducer/skimmerPrimaryMuon.cxx | 2 +- PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx | 22 ++++++++++++++----- 6 files changed, 26 insertions(+), 16 deletions(-) diff --git a/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx b/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx index 42367303130..db43abf59ed 100644 --- a/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx +++ b/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx @@ -63,7 +63,7 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* list->Add(new TH1F("hNclsITS", "number of ITS clusters", 8, -0.5, 7.5)); list->Add(new TH1F("hChi2ITS", "chi2/number of ITS clusters", 100, 0, 10)); list->Add(new TH1F("hITSClusterMap", "ITS cluster map", 128, -0.5, 127.5)); - list->Add(new TH1F("hMeanClusterSizeITS", "mean cluster size ITS; on ITS", 34, -0.5, 16.5)); + list->Add(new TH1F("hMeanClusterSizeITS", "mean cluster size ITS; on ITS #times cos(#lambda)", 160, 0, 16)); list->Add(new TH2F("hXY", "X vs. Y;X (cm);Y (cm)", 100, 0, 100, 100, -50, 50)); list->Add(new TH2F("hZX", "Z vs. X;Z (cm);X (cm)", 200, -100, 100, 100, 0, 100)); list->Add(new TH2F("hZY", "Z vs. Y;Z (cm);Y (cm)", 200, -100, 100, 100, -50, 50)); @@ -229,7 +229,7 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* list->Add(hs_dilepton_lsmm_dca_mix); } - if (TString(subGroup) == "mc") { + if (TString(subGroup).Contains("mc")) { // create phiv template list->Add(new TH2F("hMvsPhiV_Pi0", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", 32, 0, 3.2, 100, 0.0f, 0.1f)); // ee from pi0 dalitz decay list->Add(new TH2F("hMvsPhiV_Eta", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", 32, 0, 3.2, 100, 0.0f, 0.1f)); // ee from eta dalitz decay @@ -257,7 +257,7 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* hs_dilepton_lsmm_same->Sumw2(); list->Add(hs_dilepton_lsmm_same); - if (TString(subGroup) == "mix") { + if (TString(subGroup).Contains("mix")) { THnSparseF* hs_dilepton_uls_mix = reinterpret_cast(hs_dilepton_uls_same->Clone("hs_dilepton_uls_mix")); THnSparseF* hs_dilepton_lspp_mix = reinterpret_cast(hs_dilepton_lspp_same->Clone("hs_dilepton_lspp_mix")); THnSparseF* hs_dilepton_lsmm_mix = reinterpret_cast(hs_dilepton_lsmm_same->Clone("hs_dilepton_lsmm_mix")); @@ -307,7 +307,7 @@ void o2::aod::emphotonhistograms::DefineHistograms(THashList* list, const char* list->Add(new TH1F("hNclsITS", "number of ITS clusters", 8, -0.5, 7.5)); list->Add(new TH1F("hChi2ITS", "chi2/number of ITS clusters", 100, 0, 10)); list->Add(new TH1F("hITSClusterMap", "ITS cluster map", 128, -0.5, 127.5)); - list->Add(new TH1F("hMeanClusterSizeITS", "mean cluster size ITS; on ITS", 34, -0.5, 16.5)); + list->Add(new TH1F("hMeanClusterSizeITS", "mean cluster size ITS; on ITS #times cos(#lambda)", 160, 0, 16)); if (TString(subGroup).Contains("mc")) { list->Add(new TH2F("hPtGen_DeltaPtOverPtGen", "electron p_{T} resolution;p_{T}^{gen} (GeV/c);(p_{T}^{rec} - p_{T}^{gen})/p_{T}^{gen}", 1000, 0, maxP, 400, -1.0f, 1.0f)); list->Add(new TH2F("hPtGen_DeltaEta", "electron #eta resolution;p_{T}^{gen} (GeV/c);#eta^{rec} - #eta^{gen}", 1000, 0, maxP, 400, -1.0f, 1.0f)); diff --git a/PWGEM/PhotonMeson/Core/HistogramsLibrary.h b/PWGEM/PhotonMeson/Core/HistogramsLibrary.h index 3de3f8e24a3..7621e103409 100644 --- a/PWGEM/PhotonMeson/Core/HistogramsLibrary.h +++ b/PWGEM/PhotonMeson/Core/HistogramsLibrary.h @@ -98,7 +98,7 @@ void FillHistClass(THashList* list, const char* subGroup, T const& obj) reinterpret_cast(list->FindObject("hChi2TPC"))->Fill(obj.tpcChi2NCl()); reinterpret_cast(list->FindObject("hChi2ITS"))->Fill(obj.itsChi2NCl()); reinterpret_cast(list->FindObject("hITSClusterMap"))->Fill(obj.itsClusterMap()); - reinterpret_cast(list->FindObject("hMeanClusterSizeITS"))->Fill(obj.meanClusterSizeITS()); + reinterpret_cast(list->FindObject("hMeanClusterSizeITS"))->Fill(obj.meanClusterSizeITS() * std::cos(std::atan(obj.tgl()))); reinterpret_cast(list->FindObject("hTPCdEdx"))->Fill(obj.tpcInnerParam(), obj.tpcSignal()); reinterpret_cast(list->FindObject("hTPCNsigmaEl"))->Fill(obj.tpcInnerParam(), obj.tpcNSigmaEl()); reinterpret_cast(list->FindObject("hTPCNsigmaPi"))->Fill(obj.tpcInnerParam(), obj.tpcNSigmaPi()); @@ -121,7 +121,7 @@ void FillHistClass(THashList* list, const char* subGroup, T const& obj) reinterpret_cast(list->FindObject("hChi2TPC"))->Fill(obj.tpcChi2NCl()); reinterpret_cast(list->FindObject("hChi2ITS"))->Fill(obj.itsChi2NCl()); reinterpret_cast(list->FindObject("hITSClusterMap"))->Fill(obj.itsClusterMap()); - reinterpret_cast(list->FindObject("hMeanClusterSizeITS"))->Fill(obj.meanClusterSizeITS()); + reinterpret_cast(list->FindObject("hMeanClusterSizeITS"))->Fill(obj.meanClusterSizeITS() * std::cos(std::atan(obj.tgl()))); reinterpret_cast(list->FindObject("hTPCdEdx"))->Fill(obj.tpcInnerParam(), obj.tpcSignal()); reinterpret_cast(list->FindObject("hTPCNsigmaEl"))->Fill(obj.tpcInnerParam(), obj.tpcNSigmaEl()); reinterpret_cast(list->FindObject("hTPCNsigmaMu"))->Fill(obj.tpcInnerParam(), obj.tpcNSigmaMu()); diff --git a/PWGEM/PhotonMeson/DataModel/gammaTables.h b/PWGEM/PhotonMeson/DataModel/gammaTables.h index b43275269c8..dc0b62252bb 100644 --- a/PWGEM/PhotonMeson/DataModel/gammaTables.h +++ b/PWGEM/PhotonMeson/DataModel/gammaTables.h @@ -419,7 +419,7 @@ DECLARE_SOA_TABLE(EMPrimaryElectrons, "AOD", "EMPRIMARYEL", //! track::TPCChi2NCl, track::TPCInnerParam, track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaMu, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr, pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaMu, pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr, - track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, track::Signed1Pt, track::CYY, track::CZZ, track::CZY, + track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, track::Tgl, track::Signed1Pt, track::CYY, track::CZZ, track::CZY, // dynamic column track::TPCNClsFound, @@ -538,7 +538,7 @@ DECLARE_SOA_TABLE(EMPrimaryMuons, "AOD", "EMPRIMARYMU", //! track::TPCChi2NCl, track::TPCInnerParam, track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaMu, pidtpc::TPCNSigmaPi, pidtpc::TPCNSigmaKa, pidtpc::TPCNSigmaPr, pidtofbeta::Beta, pidtof::TOFNSigmaEl, pidtof::TOFNSigmaMu, pidtof::TOFNSigmaPi, pidtof::TOFNSigmaKa, pidtof::TOFNSigmaPr, - track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, track::Signed1Pt, track::CYY, track::CZZ, track::CZY, + track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, track::Tgl, track::Signed1Pt, track::CYY, track::CZZ, track::CZY, // dynamic column track::TPCNClsFound, diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectron.cxx index b9ab1ccc06c..7cdb41a2a80 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryElectron.cxx @@ -283,7 +283,7 @@ struct skimmerPrimaryElectron { track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), track.signed1Pt(), track.cYY(), track.cZZ(), track.cZY()); + track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), track.tgl(), track.signed1Pt(), track.cYY(), track.cZZ(), track.cZY()); fRegistry.fill(HIST("Track/hTPCdEdx_Pin_after"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/hTOFbeta_Pin_after"), track.tpcInnerParam(), track.beta()); fRegistry.fill(HIST("Track/hTPCNsigmaEl_after"), track.tpcInnerParam(), track.tpcNSigmaEl()); diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryMuon.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryMuon.cxx index 750ca3a2a9c..6c200db8953 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryMuon.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerPrimaryMuon.cxx @@ -310,7 +310,7 @@ struct skimmerPrimaryMuon { track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaMu(), track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), track.beta(), track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), - track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), track.signed1Pt(), track.cYY(), track.cZZ(), track.cZY()); + track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), track.tgl(), track.signed1Pt(), track.cYY(), track.cZZ(), track.cZY()); fRegistry.fill(HIST("Track/hTPCdEdx_Pin_after"), track.tpcInnerParam(), track.tpcSignal()); fRegistry.fill(HIST("Track/hTOFbeta_Pin_after"), track.tpcInnerParam(), track.beta()); fRegistry.fill(HIST("Track/hTPCNsigmaMu_after"), track.tpcInnerParam(), track.tpcNSigmaMu()); diff --git a/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx index d88aab36870..a52f64f9879 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx @@ -50,6 +50,8 @@ struct DalitzEEQCMC { Configurable fConfigDalitzEECuts{"cfgDalitzEECuts", "mee_all_tpchadrejortofreq_lowB,nocut", "Comma separated list of dalitz ee cuts"}; std::vector fDalitzEECuts; + Configurable cfgDoDCAstudy{"cfgDoDCAstudy", false, "flag to fill histograms for DCA"}; + OutputObj fOutputEvent{"Event"}; OutputObj fOutputTrack{"Track"}; OutputObj fOutputDalitzEE{"DalitzEE"}; @@ -93,7 +95,12 @@ struct DalitzEEQCMC { for (auto& cut : fDalitzEECuts) { std::string_view cutname = cut.GetName(); THashList* list = reinterpret_cast(fMainList->FindObject("DalitzEE")->FindObject(cutname.data())); - o2::aod::emphotonhistograms::DefineHistograms(list, "DalitzEE", "mc"); + // o2::aod::emphotonhistograms::DefineHistograms(list, "DalitzEE", "mc"); + std::string histo_sub_group = "mc,"; + if (cfgDoDCAstudy) { + histo_sub_group += "dca"; + } + o2::aod::emphotonhistograms::DefineHistograms(list, "DalitzEE", histo_sub_group.data()); } } @@ -206,11 +213,14 @@ struct DalitzEEQCMC { dca_ele_3d = std::sqrt(std::abs(chi2ele) / 2.); dca_ee_3d = std::sqrt((dca_pos_3d * dca_pos_3d + dca_ele_3d * dca_ele_3d) / 2.); } - values_single[0] = uls_pair.mass(); - values_single[1] = dca_pos_3d; - values_single[2] = dca_ele_3d; - values_single[3] = dca_ee_3d; - reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_uls_dca_same"))->Fill(values_single); + + if (cfgDoDCAstudy) { + values_single[0] = uls_pair.mass(); + values_single[1] = dca_pos_3d; + values_single[2] = dca_ele_3d; + values_single[3] = dca_ee_3d; + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_uls_dca_same"))->Fill(values_single); + } values[0] = uls_pair.mass(); values[1] = uls_pair.pt(); From 0accdd3a385f87cccf10f584ecc0d1d9ee5c9c8e Mon Sep 17 00:00:00 2001 From: hhesouno <119694396+hhesouno@users.noreply.github.com> Date: Thu, 1 Feb 2024 15:17:35 +0100 Subject: [PATCH 32/33] PWGMM: Mcgen new histos in multiplicityPbPb.cxx (#4545) --- PWGMM/Mult/Tasks/multiplicityPbPb.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PWGMM/Mult/Tasks/multiplicityPbPb.cxx b/PWGMM/Mult/Tasks/multiplicityPbPb.cxx index 624a6d575ff..32d1abdea35 100644 --- a/PWGMM/Mult/Tasks/multiplicityPbPb.cxx +++ b/PWGMM/Mult/Tasks/multiplicityPbPb.cxx @@ -68,6 +68,7 @@ struct multiplicityPbPb { histos.add("etaHistogram", "; ", kTH1F, {axisEta}); histos.add("MCGENetaHistogram", "; ", kTH1F, {axisEta}); histos.add("ptHistogram", "; ", kTH1F, {axisPt}); + histos.add("MCGENptHistogram", "; ", kTH1F, {axisPt}); // histos.add("eventCounter", "eventCounter", kTH1F, {axisCounter}); histos.add("MCGENeventCounter", "eventCounter", kTH1F, {axisCounter}); @@ -76,9 +77,11 @@ struct multiplicityPbPb { histos.add("DCAz", "; DCA_{z} (cm)", kTH1F, {axisDCAz}); // do not know how: histos.add("Multiplicity", "; tracks; events", kTH1F, {axisNtrk}); + histos.add("MCGENMultiplicity", "; tracks; events", kTH1F, {axisNtrk}); histos.add("PhiTracks", "; #phi; tracks", kTH1F, {axisPhi}); histos.add("ZvtxEvents", "; Z_{vtx} (cm); events", kTH1F, {axisZvtx}); + histos.add("MCGENZvtxEvents", "; Z_{vtx} (cm); events", kTH1F, {axisZvtx}); histos.add("EtaZvtxTracks", "; #eta; Z_{vtx} (cm); tracks", kTH2F, {axisEta, axisZvtx}); histos.add("NtrkZvtxEvents", "; N_{trk}; Z_{vtx} (cm); events", kTH2F, {axisNtrk, axisZvtx}); @@ -87,6 +90,7 @@ struct multiplicityPbPb { histos.add("MCGENNtrkZvtxEvents", "; N_{trk}; Z_{vtx} (cm); events", kTH2F, {axisNtrk, axisZvtx}); histos.add("PhiEtaTracks", "; #phi; #eta; tracks", kTH2F, {axisPhi, axisEta}); + histos.add("MCGENPhiEtaTracks", "; #phi; #eta; tracks", kTH2F, {axisPhi, axisEta}); } // void process(aod::Collision const& collision, soa::Filtered const& tracks, aod::McParticles const&) @@ -131,14 +135,20 @@ struct multiplicityPbPb { int MCparticleCounter = 0; histos.fill(HIST("MCGENeventCounter"), 0.5); + histos.fill(HIST("MCGENZvtxEvents"), mcCollision.posZ()); for (auto& mcParticle : mcParticles) { ++MCparticleCounter; if (mcParticle.isPhysicalPrimary()) { histos.fill(HIST("MCGENetaHistogram"), mcParticle.eta()); + histos.fill(HIST("MCGENptHistogram"), mcParticle.pt()); + histos.fill(HIST("MCGENEtaZvtxTracks"), mcParticle.eta(), mcCollision.posZ()); + histos.fill(HIST("MCGENPhiEtaTracks"), mcParticle.phi(), mcParticle.eta()); } } + histos.fill(HIST("MCGENMultiplicity"), MCparticleCounter); + histos.fill(HIST("MCGENNtrkZvtxEvents"), MCparticleCounter, mcCollision.posZ()); } PROCESS_SWITCH(multiplicityPbPb, processMCGEN, "process for GEN MC data", true); From 375831a1045c397b1d5b7e10a9ecd605bf688ddd Mon Sep 17 00:00:00 2001 From: Deependra Sharma <38365215+deependra170598@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:48:15 +0530 Subject: [PATCH 33/33] PWGHF: Add more p t bin in selector cut (#4540) * Adding more pT bins for Dstar candidates and rebinning Decaylength and Impactparameter Hists * correction to binning option * Correcting default value of impact parameter cut of soft pi * Please consider the following formatting changes * correcting spelling mistake * fix spelling * MegaLinter fixes --------- Co-authored-by: ALICE Action Bot --- PWGHF/Core/SelectorCuts.h | 56 ++++++++++--------- PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx | 38 ++++++++----- .../candidateSelectorDstarToD0Pi.cxx | 2 +- 3 files changed, 55 insertions(+), 41 deletions(-) diff --git a/PWGHF/Core/SelectorCuts.h b/PWGHF/Core/SelectorCuts.h index 083a2725f5a..27aab472530 100644 --- a/PWGHF/Core/SelectorCuts.h +++ b/PWGHF/Core/SelectorCuts.h @@ -356,11 +356,13 @@ static const std::vector labelsCutVar = {"m", "DCA", "cos theta*", namespace hf_cuts_dstar_to_d0_pi { -static constexpr int nBinsPt = 23; +static constexpr int nBinsPt = 25; static constexpr int nCutVars = 8; // default values for the pT bin edges (can be used to configure histogram axis) // offset by 1 from the bin numbers in cuts array constexpr double binsPt[nBinsPt + 1] = { + 0., + 0.5, 1.0, 1.5, 2.0, @@ -411,35 +413,39 @@ static const std::vector labelsPt = { "pT bin 19", "pT bin 20", "pT bin 21", - "pT bin 22"}; + "pT bin 22", + "pT bin 23", + "pT bin 24"}; // column label static const std::vector labelsCutVar = {"ptSoftPiMin", "ptSoftPiMax", "d0SoftPi", "d0SoftPiNormalised", "deltaMInvDstar", "chi2PCA", "d0Prong0Normalised", "d0Prong1Normalised"}; // default values for the cuts -constexpr double cuts[nBinsPt][nCutVars] = {{0.05, 0.3, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 0.3, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 0.4, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 0.4, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 0.6, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 0.6, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 0.6, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}, - {0.05, 100, 0.1, 0.0, 0.2, 300.0, 0.0, 0.0}}; +constexpr double cuts[nBinsPt][nCutVars] = {{0.05, 0.2, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 0.2, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 0.3, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 0.3, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 0.4, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 0.4, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 0.6, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 0.6, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 0.6, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}, + {0.05, 100, 0.1, 1000.0, 0.2, 300.0, 0.0, 0.0}}; } // namespace hf_cuts_dstar_to_d0_pi namespace hf_cuts_lc_to_p_k_pi diff --git a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx index a7a6ece7d54..96882fe6b99 100644 --- a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx +++ b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx @@ -45,6 +45,10 @@ struct HfTaskDstarToD0Pi { Partition rowsSelectedCandDstar = aod::hf_sel_candidate_dstar::isSelDstarToD0Pi == selectionFlagDstarToD0Pi; Partition rowsSelectedCandDstarMcRec = aod::hf_sel_candidate_dstar::isRecoD0Flag == selectionFlagHfD0ToPiK; + ConfigurableAxis binningImpactParam{"binningImpactParam", {1000, 0.1, -0.1}, " Bins of Impact Parameter"}; + ConfigurableAxis binningDecayLength{"binningDecayLength", {1000, 0.0, 0.7}, "Bins of Decay Length"}; + ConfigurableAxis binningNormDecayLength{"binningNormDecayLength", {1000, 0.0, 40.0}, "Bins of Normalised Decay Length"}; + HistogramRegistry registry{ "registry", {{"QA/hPtDstar", "Dstar Candidates; Dstar candidate #it{p}_{T} (GeV/#it{c}); entries", {HistType::kTH1F, {{360, 0., 36.}}}}, @@ -59,28 +63,32 @@ struct HfTaskDstarToD0Pi { { auto vecPtBins = (std::vector)ptBins; + AxisSpec axisImpactParam = {binningImpactParam, "impact parameter (cm)"}; + AxisSpec axisDecayLength = {binningDecayLength, " decay length (cm)"}; + AxisSpec axisNormDecayLength = {binningNormDecayLength, "normalised decay length (cm)"}; + registry.add("Yield/hDeltaInvMassDstar2D", "#Delta #it{M}_{inv} D* Candidate; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{100, 0.13, 0.16}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); registry.add("Yield/hDeltaInvMassDstar1D", "#Delta #it{M}_{inv} D* Candidate; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2}); entries", {HistType::kTH1F, {{100, 0.13, 0.16}}}, true); registry.add("Yield/hInvMassDstar", "#Delta #it{M}_{inv} D* Candidate; inv. mass (#pi #pi k) (GeV/#it{c}^{2}); entries", {HistType::kTH1F, {{500, 0., 5.0}}}, true); registry.add("Yield/hInvMassD0", "#it{M}_{inv}D^{0} candidate;#it{M}_{inv} D^{0} (GeV/#it{c});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{500, 0., 5.0}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); // only QA registry.add("QA/hEtaDstar", "D* Candidate; D* Candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hCtD0", "D0 Candidate; D0 Candidate's proper life time #it{c}#tau (cm) ; entries ", {HistType::kTH2F, {{120, -20., 100.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthD0", "D0 Candidate; D0 Candidate's decay length (cm); entries", {HistType::kTH2F, {{800, 0., 4.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthXYD0", "D0 Candidate; D0 Candidate's decay length xy (cm); entries", {HistType::kTH2F, {{800, 0., 4.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthNormalisedD0", "D0 Candidates;Do Candidate's normalised decay length (cm); entries", {HistType::kTH2F, {{800, 0., 40.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthXYNormalisedD0", "D0 candidate; D0 Candidate's normalised decay length xy (cm); entries", {HistType::kTH2F, {{800, 0., 40.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hCtD0", "D0 Candidate; D0 Candidate's proper life time #it{c}#tau (cm) ; entries ", {HistType::kTH2F, {{1000, -0.1, 14.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthD0", "D0 Candidate; D0 Candidate's decay length (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthXYD0", "D0 Candidate; D0 Candidate's decay length xy (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthNormalisedD0", "D0 Candidates;Do Candidate's normalised decay length (cm); entries", {HistType::kTH2F, {axisNormDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthXYNormalisedD0", "D0 candidate; D0 Candidate's normalised decay length xy (cm); entries", {HistType::kTH2F, {axisNormDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("QA/hCPAD0", "D0 Candidates; D0 Candidate's cosine pointing angle; entries", {HistType::kTH2F, {{110, -1., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("QA/hCPAxyD0", "D0 candidates; D0 Candidate's cosine of pointing angle xy; entries", {HistType::kTH2F, {{110, -1., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hImpactParameterXYD0", "D0 Candidates; D0 Candidate's reconstructed impact parameter xy (cm); entries", {HistType::kTH2F, {{200, -1., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDeltaIPMaxNormalisedD0", "D0 Candidate; D0 Candidate's Norm. Delta IP; entries", {HistType::kTH2F, {{200, -20., 20.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hSqSumProngesImpactParameterD0", "D0 Candidates; Sqr Sum of Impact params of D0 Pronges; enteries ", {HistType::kTH2F, {{100, 0., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthErrorD0", "D0 Candidates; D0 Candidate's Decay Lenth Error (cm); entries", {HistType::kTH2F, {{100, 0., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hDecayLengthXYErrorD0", "D0 Candidates; D0 Candidate's Decay Length Error XY (cm); entries", {HistType::kTH2F, {{100, 0., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hImpactParameterError", "D0 Pronges; Impactparam error of different D0 Pronges (cm); entries", {HistType::kTH2F, {{100, 0., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hd0Prong0", "Prong0; DCAxy of Prong0 (cm); entries", {HistType::kTH2F, {{100, -1., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hd0Prong1", "Prong1; DCAxy of Prong1 (cm); entries", {HistType::kTH2F, {{100, -1., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("QA/hd0ProngSoftPi", "ProngSoftPi; DCAxy of Prong Soft Pi (cm); entries", {HistType::kTH2F, {{100, -1., 1.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hImpactParameterXYD0", "D0 Candidates; D0 Candidate's reconstructed impact parameter xy (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDeltaIPMaxNormalisedD0", "D0 Candidate; D0 Candidate's Norm. Delta IP; entries", {HistType::kTH2F, {{1000, -20., 20.}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hSqSumProngsImpactParameterD0", "D0 Candidates; Sqr Sum of Impact params of D0 Prongs; entries ", {HistType::kTH2F, {{1000, 0., 0.25}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthErrorD0", "D0 Candidates; D0 Candidate's Decay Length Error (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hDecayLengthXYErrorD0", "D0 Candidates; D0 Candidate's Decay Length Error XY (cm); entries", {HistType::kTH2F, {axisDecayLength, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hImpactParameterError", "D0 Prongs; Impact param error of different D0 Prongs (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hd0Prong0", "Prong0; DCAxy of Prong0 (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hd0Prong1", "Prong1; DCAxy of Prong1 (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("QA/hd0ProngSoftPi", "ProngSoftPi; DCAxy of Prong Soft Pi (cm); entries", {HistType::kTH2F, {axisImpactParam, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); // MC Matching at Reconstruction Level Successful registry.add("QA/hCPASkimD0RecSig", "MC Matched Skimed D* Candidates at Reconstruction Level; cosine of pointing angle", {HistType::kTH1F, {{110, -1.1, 1.1}}}); registry.add("QA/hEtaSkimD0RecSig", "MC Matched Skimed D* Candidates at Reconstruction Level; #it{#eta} of D0 Prong", {HistType::kTH1F, {{100, -2., 2.}}}); @@ -139,7 +147,7 @@ struct HfTaskDstarToD0Pi { registry.fill(HIST("QA/hCPAxyD0"), candDstar.cpaXYD0(), candDstar.pt()); registry.fill(HIST("QA/hImpactParameterXYD0"), candDstar.impactParameterXYD0(), candDstar.pt()); registry.fill(HIST("QA/hDeltaIPMaxNormalisedD0"), candDstar.deltaIPNormalisedMaxD0(), candDstar.pt()); - registry.fill(HIST("QA/hSqSumProngesImpactParameterD0"), candDstar.impactParameterProngSqSumD0(), candDstar.pt()); + registry.fill(HIST("QA/hSqSumProngsImpactParameterD0"), candDstar.impactParameterProngSqSumD0(), candDstar.pt()); registry.fill(HIST("QA/hDecayLengthErrorD0"), candDstar.errorDecayLengthD0(), candDstar.pt()); registry.fill(HIST("QA/hDecayLengthXYErrorD0"), candDstar.errorDecayLengthXYD0(), candDstar.pt()); registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpactParameter0(), candDstar.pt()); diff --git a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx index ea646f86afb..c11f1d73034 100644 --- a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx @@ -137,7 +137,7 @@ struct HfCandidateSelectorDstarToD0Pi { if (candidate.chi2PCAD0() > cutsDstar->get(binPt, "chi2PCA")) { return false; } - if (candidate.impactParameterXYD0() > cutsD0->get(binPt, "DCA")) { + if (std::abs(candidate.impactParameterXYD0()) > cutsD0->get(binPt, "DCA")) { return false; } // d0Prong0Normalised,1