diff --git a/CODEOWNERS b/CODEOWNERS index 0094c1c0e55..dc6b9054dcc 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -42,7 +42,7 @@ /PWGMM/Lumi @alibuild @aalkin /PWGMM/Mult @alibuild @aalkin @aortizve @ddobrigk /PWGMM/UE @alibuild @aalkin @aortizve -/PWGUD @alibuild @pbuehler +/PWGUD @alibuild @pbuehler @abylinkin @rolavick /PWGJE @alibuild @lhavener @maoyx @nzardosh @ddobrigk @mfasDa /Tools/PIDML @alibuild @saganatt /Tools/ML @alibuild @fcatalan92 @fmazzasc diff --git a/DPG/Tasks/AOTEvent/mshapeQa.cxx b/DPG/Tasks/AOTEvent/mshapeQa.cxx index 1744f867a3b..38f3910da21 100644 --- a/DPG/Tasks/AOTEvent/mshapeQa.cxx +++ b/DPG/Tasks/AOTEvent/mshapeQa.cxx @@ -33,6 +33,7 @@ const AxisSpec axisSparseDcaR{100, -5., 5., "DCA_{r}, cm"}; const AxisSpec axisSparseDcaZ{100, -5., 5., "DCA_{z}, cm"}; struct MshapeQaTask { + Configurable confTimeBinWidthInSec{"TimeBinWidthInSec", 0.1, "Width of time bins in seconds"}; Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; o2::tpc::TPCMShapeCorrection mshape; // object for simple access @@ -61,7 +62,9 @@ struct MshapeQaTask { auto grpecs = ccdb->getSpecific("GLO/Config/GRPECS", bcs.iteratorAt(0).timestamp(), metadata); minSec = floor(grpecs->getTimeStart() / 1000.); maxSec = ceil(grpecs->getTimeEnd() / 1000.); - const AxisSpec axisSeconds{static_cast(maxSec - minSec) * 10, 0, maxSec - minSec, "seconds"}; + int nTimeBins = static_cast((maxSec - minSec) / confTimeBinWidthInSec); + double timeInterval = nTimeBins * confTimeBinWidthInSec; + const AxisSpec axisSeconds{nTimeBins, 0, timeInterval, "seconds"}; histos.add("hSecondsAsideQoverPtSumDcaR", "", kTH2F, {axisSeconds, axisSparseQoverPt}); histos.add("hSecondsAsideQoverPtSumDcaZ", "", kTH2F, {axisSeconds, axisSparseQoverPt}); histos.add("hSecondsCsideQoverPtSumDcaR", "", kTH2F, {axisSeconds, axisSparseQoverPt}); @@ -80,6 +83,19 @@ struct MshapeQaTask { histos.add("hSecondsAsideITSTPCcontrib", "", kTH1F, {axisSeconds}); histos.add("hSecondsCsideITSTPCcontrib", "", kTH1F, {axisSeconds}); histos.add("hSecondsCollisions", "", kTH1F, {axisSeconds}); + + const AxisSpec axisPhi{64, 0, TMath::TwoPi(), "#varphi"}; + histos.add("hSecondsITSlayer0vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer1vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer2vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer3vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer4vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer5vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer6vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITS7clsVsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSglobalVsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSTRDVsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSTOFVsPhi", "", kTH2F, {axisSeconds, axisPhi}); } int64_t ts = col.bc_as().timestamp(); @@ -130,6 +146,34 @@ struct MshapeQaTask { } else { nCsideITSTPCContrib++; } + + // select straight tracks + if (track.pt() < 1) { + continue; + } + // study ITS cluster pattern vs sec + if (track.itsClusterMap() & (1 << 0)) + histos.fill(HIST("hSecondsITSlayer0vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 1)) + histos.fill(HIST("hSecondsITSlayer1vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 2)) + histos.fill(HIST("hSecondsITSlayer2vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 3)) + histos.fill(HIST("hSecondsITSlayer3vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 4)) + histos.fill(HIST("hSecondsITSlayer4vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 5)) + histos.fill(HIST("hSecondsITSlayer5vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 6)) + histos.fill(HIST("hSecondsITSlayer6vsPhi"), secFromSOR, track.phi()); + if (track.itsNCls() == 7) + histos.fill(HIST("hSecondsITS7clsVsPhi"), secFromSOR, track.phi()); + if (track.hasITS() && track.hasTPC()) + histos.fill(HIST("hSecondsITSglobalVsPhi"), secFromSOR, track.phi()); + if (track.hasTRD()) + histos.fill(HIST("hSecondsITSTRDVsPhi"), secFromSOR, track.phi()); + if (track.hasTOF()) + histos.fill(HIST("hSecondsITSTOFVsPhi"), secFromSOR, track.phi()); } } histos.fill(HIST("hSecondsCollisions"), secFromSOR); diff --git a/DPG/Tasks/AOTTrack/tagAndProbeDmesons.cxx b/DPG/Tasks/AOTTrack/tagAndProbeDmesons.cxx index 943d3c70b92..1dea5ebebe1 100644 --- a/DPG/Tasks/AOTTrack/tagAndProbeDmesons.cxx +++ b/DPG/Tasks/AOTTrack/tagAndProbeDmesons.cxx @@ -488,26 +488,31 @@ struct TagTwoProngDisplacedVertices { if (std::abs(track.tofNSigmaPi()) < trackNumSigmaTof) { return true; } + break; } case aod::tagandprobe::TagChannels::DsOrDplusToKKPi: { if (std::abs(track.tofNSigmaKa()) < trackNumSigmaTof) { return true; } + break; } case aod::tagandprobe::TagChannels::DstarPlusToDzeroPi: { if ((track.signed1Pt() > 0 && std::abs(track.tofNSigmaPi()) < trackNumSigmaTof) || (track.signed1Pt() < 0 && std::abs(track.tofNSigmaKa()) < trackNumSigmaTof)) { return true; } + break; } case aod::tagandprobe::TagChannels::DstarMinusToDzeroBarPi: { if ((track.signed1Pt() < 0 && std::abs(track.tofNSigmaPi()) < trackNumSigmaTof) || (track.signed1Pt() > 0 && std::abs(track.tofNSigmaKa()) < trackNumSigmaTof)) { return true; } + break; } case aod::tagandprobe::TagChannels::DstarToDzeroToKK: { if (std::abs(track.tofNSigmaKa()) < trackNumSigmaTof) { return true; } + break; } } return false; diff --git a/EventFiltering/PWGHF/HFFilter.cxx b/EventFiltering/PWGHF/HFFilter.cxx index bf1a247bc58..38167b92b06 100644 --- a/EventFiltering/PWGHF/HFFilter.cxx +++ b/EventFiltering/PWGHF/HFFilter.cxx @@ -129,7 +129,7 @@ struct HfFilter { // Main struct for HF triggers // array of BDT thresholds std::array, kNCharmParticles> thresholdBDTScores; - HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry registry{"registry"}; std::shared_ptr hProcessedEvents; // QA histos @@ -233,7 +233,7 @@ struct HfFilter { // Main struct for HF triggers if (activateQA > 1) { hProtonTPCPID = registry.add("fProtonTPCPID", "#it{N}_{#sigma}^{TPC} vs. #it{p} for selected protons;#it{p} (GeV/#it{c});#it{N}_{#sigma}^{TPC}", HistType::kTH2F, {pAxis, nSigmaAxis}); hProtonTOFPID = registry.add("fProtonTOFPID", "#it{N}_{#sigma}^{TOF} vs. #it{p} for selected protons;#it{p} (GeV/#it{c});#it{N}_{#sigma}^{TOF}", HistType::kTH2F, {pAxis, nSigmaAxis}); - hV0Selected = registry.add("fV0Selected", "Selections for V0s;;counts", HistType::kTH2F, {{10, -0.5, 9.5}, {kNV0, -0.5, +kNV0 - 0.5}}); + hV0Selected = registry.add("fV0Selected", "Selections for V0s;;counts", HistType::kTH2F, {{9, -0.5, 8.5}, {kNV0, -0.5, +kNV0 - 0.5}}); for (int iV0{kPhoton}; iV0 < kNV0; ++iV0) { hV0Selected->GetYaxis()->SetBinLabel(iV0 + 1, v0Labels[iV0].data()); @@ -242,12 +242,11 @@ struct HfFilter { // Main struct for HF triggers hV0Selected->GetXaxis()->SetBinLabel(2, "rej. |#eta|"); hV0Selected->GetXaxis()->SetBinLabel(3, "rej. radius"); hV0Selected->GetXaxis()->SetBinLabel(4, "rej. cos(#theta_{P})"); - hV0Selected->GetXaxis()->SetBinLabel(5, "rej. AP / Mass"); + hV0Selected->GetXaxis()->SetBinLabel(5, "rej. Mass"); hV0Selected->GetXaxis()->SetBinLabel(6, "rej. DCA V0"); hV0Selected->GetXaxis()->SetBinLabel(7, "rej. DCA V0 daughters"); - hV0Selected->GetXaxis()->SetBinLabel(8, "rej. pair cut"); - hV0Selected->GetXaxis()->SetBinLabel(9, "rej. PID"); - hV0Selected->GetXaxis()->SetBinLabel(10, "selected"); + hV0Selected->GetXaxis()->SetBinLabel(8, "rej. PID"); + hV0Selected->GetXaxis()->SetBinLabel(9, "selected"); } } @@ -283,7 +282,8 @@ struct HfFilter { // Main struct for HF triggers Hf3ProngsWithMl const& cand3Prongs, aod::TrackAssoc const& trackIndices, BigTracksPID const&, - aod::V0PhotonsKF const& photons) + aod::V0PhotonsKF const& photons, + aod::V0Legs const&) { for (const auto& collision : collisions) { @@ -341,8 +341,8 @@ struct HfFilter { // Main struct for HF triggers auto trackParNeg = getTrackPar(trackNeg); o2::gpu::gpustd::array dcaPos{trackPos.dcaXY(), trackPos.dcaZ()}; o2::gpu::gpustd::array dcaNeg{trackNeg.dcaXY(), trackNeg.dcaZ()}; - std::array pVecPos{trackPos.px(), trackPos.py(), trackPos.pz()}; - std::array pVecNeg{trackNeg.px(), trackNeg.py(), trackNeg.pz()}; + std::array pVecPos{trackPos.pVector()}; + std::array pVecNeg{trackNeg.pVector()}; if (trackPos.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParPos, 2.f, noMatCorr, &dcaPos); getPxPyPz(trackParPos, pVecPos); @@ -410,7 +410,7 @@ struct HfFilter { // Main struct for HF triggers auto trackParThird = getTrackPar(track); o2::gpu::gpustd::array dcaThird{track.dcaXY(), track.dcaZ()}; - std::array pVecThird = {track.px(), track.py(), track.pz()}; + std::array pVecThird = track.pVector(); if (track.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParThird, 2.f, noMatCorr, &dcaThird); getPxPyPz(trackParThird, pVecThird); @@ -452,7 +452,7 @@ struct HfFilter { // Main struct for HF triggers } auto trackParFourth = getTrackPar(trackB); o2::gpu::gpustd::array dcaFourth{trackB.dcaXY(), trackB.dcaZ()}; - std::array pVecFourth = {trackB.px(), trackB.py(), trackB.pz()}; + std::array pVecFourth = trackB.pVector(); if (trackB.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParFourth, 2.f, noMatCorr, &dcaFourth); getPxPyPz(trackParFourth, pVecFourth); @@ -503,9 +503,9 @@ struct HfFilter { // Main struct for HF triggers if (!keepEvent[kPhotonCharm2P] && isSignalTagged && (TESTBIT(selD0, 0) || TESTBIT(selD0, 1))) { auto photonsThisCollision = photons.sliceBy(photonsPerCollision, thisCollId); for (const auto& photon : photonsThisCollision) { - auto posTrack = photon.posTrack_as(); - auto negTrack = photon.negTrack_as(); - if (!helper.isSelectedPhoton(photon, std::array{posTrack, negTrack}, collision, activateQA, hV0Selected, hArmPod)) { + auto posTrack = photon.posTrack_as(); + auto negTrack = photon.negTrack_as(); + if (!helper.isSelectedPhoton(photon, std::array{posTrack, negTrack}, activateQA, hV0Selected, hArmPod)) { continue; } gpu::gpustd::array dcaInfo; @@ -581,7 +581,7 @@ struct HfFilter { // Main struct for HF triggers auto trackParBachelor = getTrackPar(trackBachelor); o2::gpu::gpustd::array dcaBachelor{trackBachelor.dcaXY(), trackBachelor.dcaZ()}; - std::array pVecBachelor = {trackBachelor.px(), trackBachelor.py(), trackBachelor.pz()}; + std::array pVecBachelor = trackBachelor.pVector(); if (trackBachelor.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParBachelor, 2.f, noMatCorr, &dcaBachelor); getPxPyPz(trackParBachelor, pVecBachelor); @@ -698,9 +698,9 @@ struct HfFilter { // Main struct for HF triggers o2::gpu::gpustd::array dcaFirst{trackFirst.dcaXY(), trackFirst.dcaZ()}; o2::gpu::gpustd::array dcaSecond{trackSecond.dcaXY(), trackSecond.dcaZ()}; o2::gpu::gpustd::array dcaThird{trackThird.dcaXY(), trackThird.dcaZ()}; - std::array pVecFirst = {trackFirst.px(), trackFirst.py(), trackFirst.pz()}; - std::array pVecSecond = {trackSecond.px(), trackSecond.py(), trackSecond.pz()}; - std::array pVecThird = {trackThird.px(), trackThird.py(), trackThird.pz()}; + std::array pVecFirst = trackFirst.pVector(); + std::array pVecSecond = trackSecond.pVector(); + std::array pVecThird = trackThird.pVector(); if (trackFirst.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParFirst, 2.f, noMatCorr, &dcaFirst); getPxPyPz(trackParFirst, pVecFirst); @@ -823,7 +823,7 @@ struct HfFilter { // Main struct for HF triggers auto trackParFourth = getTrackPar(track); o2::gpu::gpustd::array dcaFourth{track.dcaXY(), track.dcaZ()}; - std::array pVecFourth = {track.px(), track.py(), track.pz()}; + std::array pVecFourth = track.pVector(); if (track.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParFourth, 2.f, noMatCorr, &dcaFourth); getPxPyPz(trackParFourth, pVecFourth); @@ -905,7 +905,7 @@ struct HfFilter { // Main struct for HF triggers // select soft pion candidates auto trackParSoftPi = getTrackPar(trackSoftPi); o2::gpu::gpustd::array dcaSoftPi{trackSoftPi.dcaXY(), trackSoftPi.dcaZ()}; - std::array pVecSoftPi = {trackSoftPi.px(), trackSoftPi.py(), trackSoftPi.pz()}; + std::array pVecSoftPi = trackSoftPi.pVector(); if (trackSoftPi.collisionId() != thisCollId) { // This is a track reassociated to this PV by the track-to-collision-associator // Let's propagate this track to it, and calculate dcaXY, dcaZ @@ -984,9 +984,9 @@ struct HfFilter { // Main struct for HF triggers auto massDsPiKK = RecoDecay::m(std::array{pVecFirst, pVecSecond, pVecThird}, std::array{massPi, massKa, massKa}); auto photonsThisCollision = photons.sliceBy(photonsPerCollision, thisCollId); for (const auto& photon : photonsThisCollision) { - auto posTrack = photon.posTrack_as(); - auto negTrack = photon.negTrack_as(); - if (!helper.isSelectedPhoton(photon, std::array{posTrack, negTrack}, collision, activateQA, hV0Selected, hArmPod)) { + auto posTrack = photon.posTrack_as(); + auto negTrack = photon.negTrack_as(); + if (!helper.isSelectedPhoton(photon, std::array{posTrack, negTrack}, activateQA, hV0Selected, hArmPod)) { continue; } gpu::gpustd::array dcaInfo; @@ -1123,7 +1123,7 @@ struct HfFilter { // Main struct for HF triggers // select soft pion candidates auto trackParSoftPi = getTrackPar(trackSoftPi); o2::gpu::gpustd::array dcaSoftPi{trackSoftPi.dcaXY(), trackSoftPi.dcaZ()}; - std::array pVecSoftPi = {trackSoftPi.px(), trackSoftPi.py(), trackSoftPi.pz()}; + std::array pVecSoftPi = trackSoftPi.pVector(); if (trackSoftPi.collisionId() != thisCollId) { // This is a track reassociated to this PV by the track-to-collision-associator // Let's propagate this track to it, and calculate dcaXY, dcaZ @@ -1142,8 +1142,8 @@ struct HfFilter { // Main struct for HF triggers /// and keep it only if it is in the correct mass range float massSigmaCPKPi{-999.}, massSigmaCPiKP{-999.}, deltaMassXicResoPKPi{-999.}, deltaMassXicResoPiKP{-999.}; - std::array pVecPiPosK0s = {posTrack.px(), posTrack.py(), posTrack.pz()}; - std::array pVecPiNegK0s = {negTrack.px(), negTrack.py(), negTrack.pz()}; + std::array pVecPiPosK0s = posTrack.pVector(); + std::array pVecPiNegK0s = negTrack.pVector(); float ptSigmaCKaon = RecoDecay::pt(pVecSigmaC, pVecPiPosK0s, pVecPiNegK0s); if (ptSigmaCKaon > cutsPtDeltaMassCharmReso->get(2u, 10u)) { if (TESTBIT(whichSigmaC, 0)) { @@ -1227,7 +1227,7 @@ struct HfFilter { // Main struct for HF triggers getPxPyPz(trackParCasc, pVecCascade); auto trackParBachelor = getTrackPar(track); - std::array pVecBachelor = {track.px(), track.py(), track.pz()}; + std::array pVecBachelor = track.pVector(); if (track.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParBachelor, 2.f, noMatCorr, &dcaInfo); getPxPyPz(trackParBachelor, pVecBachelor); diff --git a/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx b/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx index 31c0b542681..11796fc9d21 100644 --- a/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx +++ b/EventFiltering/PWGHF/HFFilterCharmHadronSignals.cxx @@ -161,8 +161,8 @@ struct HfFilterCharmHadronSignals { // Main struct for HF triggers auto trackParNeg = getTrackPar(trackNeg); o2::gpu::gpustd::array dcaPos{trackPos.dcaXY(), trackPos.dcaZ()}; o2::gpu::gpustd::array dcaNeg{trackNeg.dcaXY(), trackNeg.dcaZ()}; - std::array pVecPos{trackPos.px(), trackPos.py(), trackPos.pz()}; - std::array pVecNeg{trackNeg.px(), trackNeg.py(), trackNeg.pz()}; + std::array pVecPos{trackPos.pVector()}; + std::array pVecNeg{trackNeg.pVector()}; if (trackPos.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParPos, 2.f, noMatCorr, &dcaPos); getPxPyPz(trackParPos, pVecPos); @@ -216,7 +216,7 @@ struct HfFilterCharmHadronSignals { // Main struct for HF triggers auto trackParThird = getTrackPar(track); o2::gpu::gpustd::array dcaThird{track.dcaXY(), track.dcaZ()}; - std::array pVecThird = {track.px(), track.py(), track.pz()}; + std::array pVecThird = track.pVector(); if (track.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParThird, 2.f, noMatCorr, &dcaThird); getPxPyPz(trackParThird, pVecThird); @@ -268,9 +268,9 @@ struct HfFilterCharmHadronSignals { // Main struct for HF triggers o2::gpu::gpustd::array dcaFirst{trackFirst.dcaXY(), trackFirst.dcaZ()}; o2::gpu::gpustd::array dcaSecond{trackSecond.dcaXY(), trackSecond.dcaZ()}; o2::gpu::gpustd::array dcaThird{trackThird.dcaXY(), trackThird.dcaZ()}; - std::array pVecFirst = {trackFirst.px(), trackFirst.py(), trackFirst.pz()}; - std::array pVecSecond = {trackSecond.px(), trackSecond.py(), trackSecond.pz()}; - std::array pVecThird = {trackThird.px(), trackThird.py(), trackThird.pz()}; + std::array pVecFirst = trackFirst.pVector(); + std::array pVecSecond = trackSecond.pVector(); + std::array pVecThird = trackThird.pVector(); if (trackFirst.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParFirst, 2.f, noMatCorr, &dcaFirst); getPxPyPz(trackParFirst, pVecFirst); diff --git a/EventFiltering/PWGHF/HFFilterHelpers.h b/EventFiltering/PWGHF/HFFilterHelpers.h index 3444562aeeb..e0dd03f3b75 100644 --- a/EventFiltering/PWGHF/HFFilterHelpers.h +++ b/EventFiltering/PWGHF/HFFilterHelpers.h @@ -50,7 +50,6 @@ #include "Common/Core/trackUtilities.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGEM/PhotonMeson/Utils/PCMUtilities.h" #include "EventFiltering/filterTables.h" namespace o2::aod @@ -393,8 +392,8 @@ class HfFilterHelper int8_t isSelectedXicInMassRange(const T& pTrackSameChargeFirst, const T& pTrackSameChargeSecond, const T& pTrackOppositeCharge, const float& ptXic, const int8_t isSelected, const int& activateQA, H2 hMassVsPt); template int8_t isSelectedV0(const V0& v0, const std::array& dauTracks, const Coll& collision, const int& activateQA, H2 hV0Selected, std::array& hArmPod); - template - inline bool isSelectedPhoton(const Photon& photon, const std::array& dauTracks, const Coll& collision, const int& activateQA, H2 hV0Selected, std::array& hArmPod); + template + inline bool isSelectedPhoton(const Photon& photon, const std::array& dauTracks, const int& activateQA, H2 hV0Selected, std::array& hArmPod); template bool isSelectedCascade(const Casc& casc, const std::array& dauTracks, const Coll& collision); template @@ -1122,13 +1121,13 @@ inline int8_t HfFilterHelper::isSelectedV0(const V0& v0, const std::array& if (TESTBIT(isSelected, kLambda) && ((dauTracks[0].hasTPC() && std::fabs(nSigmaPrTpc[0]) > mMaxNsigmaPrForLambda) || (dauTracks[0].hasTOF() && std::fabs(nSigmaPrTof[0]) > mMaxNsigmaPrForLambda))) { CLRBIT(isSelected, kLambda); if (activateQA > 1) { - hV0Selected->Fill(8., kLambda); + hV0Selected->Fill(7., kLambda); } } if (TESTBIT(isSelected, kAntiLambda) && ((dauTracks[1].hasTPC() && std::fabs(nSigmaPrTpc[1]) > mMaxNsigmaPrForLambda) || (dauTracks[1].hasTOF() && std::fabs(nSigmaPrTof[1]) > mMaxNsigmaPrForLambda))) { CLRBIT(isSelected, kAntiLambda); if (activateQA > 1) { - hV0Selected->Fill(8., kAntiLambda); + hV0Selected->Fill(7., kAntiLambda); } } @@ -1137,7 +1136,7 @@ inline int8_t HfFilterHelper::isSelectedV0(const V0& v0, const std::array& if (TESTBIT(isSelected, iV0)) { hArmPod[iV0]->Fill(v0.alpha(), v0.qtarm()); if (activateQA > 1) { - hV0Selected->Fill(9., iV0); + hV0Selected->Fill(8., iV0); } } } @@ -1149,15 +1148,18 @@ inline int8_t HfFilterHelper::isSelectedV0(const V0& v0, const std::array& /// Basic selection of photon candidates /// \param photon is the photon candidate /// \param dauTracks is a 2-element array with positive and negative V0 daughter tracks -/// \param collision is the current collision /// \param activateQA flag to fill QA histos /// \param hV0Selected is the pointer to the QA histo for selected V0s /// \param hArmPod is the pointer to an array of QA histo AP plot after selection /// \return an integer passes all cuts -template -inline bool HfFilterHelper::isSelectedPhoton(const Photon& photon, const std::array& dauTracks, const Coll& collision, const int& activateQA, H2 hV0Selected, std::array& hArmPod) +template +inline bool HfFilterHelper::isSelectedPhoton(const Photon& photon, const std::array& dauTracks, const int& activateQA, H2 hV0Selected, std::array& hArmPod) { + if (activateQA > 1) { + hV0Selected->Fill(0., kPhoton); + } + // eta of daughters if (std::fabs(dauTracks[0].eta()) > 1. || std::fabs(dauTracks[1].eta()) > 1.) { // cut all V0 daughters with |eta| > 1. if (activateQA > 1) { @@ -1182,26 +1184,10 @@ inline bool HfFilterHelper::isSelectedPhoton(const Photon& photon, const std::ar return false; } - // armenteros-podolanski - if (std::pow(photon.alpha() / 0.95, 2) + std::pow(photon.qtarm() / 0.05, 2)) { - if (activateQA > 1) { - hV0Selected->Fill(4., kPhoton); - } - return false; - } - - // psi pair - if (std::fabs(getPsiPair(dauTracks[0].px(), dauTracks[0].py(), dauTracks[0].pz(), dauTracks[1].px(), dauTracks[1].py(), dauTracks[1].pz())) > 0.1) { - if (activateQA > 1) { - hV0Selected->Fill(7., kPhoton); - } - return false; - } - if (activateQA) { hArmPod[kPhoton]->Fill(photon.alpha(), photon.qtarm()); if (activateQA > 1) { - hV0Selected->Fill(9., kPhoton); + hV0Selected->Fill(8., kPhoton); } } diff --git a/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx b/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx index b7a6fb2a5bb..4a37a8b63b9 100644 --- a/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx +++ b/EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx @@ -100,8 +100,8 @@ struct HfFilterPrepareMlSamples { // Main struct auto trackParNeg = getTrackPar(trackNeg); o2::gpu::gpustd::array dcaPos{trackPos.dcaXY(), trackPos.dcaZ()}; o2::gpu::gpustd::array dcaNeg{trackNeg.dcaXY(), trackNeg.dcaZ()}; - std::array pVecPos{trackPos.px(), trackPos.py(), trackPos.pz()}; - std::array pVecNeg{trackNeg.px(), trackNeg.py(), trackNeg.pz()}; + std::array pVecPos{trackPos.pVector()}; + std::array pVecNeg{trackNeg.pVector()}; if (trackPos.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParPos, 2.f, noMatCorr, &dcaPos); getPxPyPz(trackParPos, pVecPos); @@ -162,9 +162,9 @@ struct HfFilterPrepareMlSamples { // Main struct o2::gpu::gpustd::array dcaFirst{trackFirst.dcaXY(), trackFirst.dcaZ()}; o2::gpu::gpustd::array dcaSecond{trackSecond.dcaXY(), trackSecond.dcaZ()}; o2::gpu::gpustd::array dcaThird{trackThird.dcaXY(), trackThird.dcaZ()}; - std::array pVecFirst{trackFirst.px(), trackFirst.py(), trackFirst.pz()}; - std::array pVecSecond{trackSecond.px(), trackSecond.py(), trackSecond.pz()}; - std::array pVecThird{trackThird.px(), trackThird.py(), trackThird.pz()}; + std::array pVecFirst{trackFirst.pVector()}; + std::array pVecSecond{trackSecond.pVector()}; + std::array pVecThird{trackThird.pVector()}; if (trackFirst.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParFirst, 2.f, noMatCorr, &dcaFirst); getPxPyPz(trackParFirst, pVecFirst); diff --git a/EventFiltering/PWGJE/jetFilter.cxx b/EventFiltering/PWGJE/jetFilter.cxx index 93ed0a2212f..60e67d39073 100644 --- a/EventFiltering/PWGJE/jetFilter.cxx +++ b/EventFiltering/PWGJE/jetFilter.cxx @@ -59,6 +59,7 @@ struct jetFilter { Produces tags; + Configurable evSel{"evSel", "sel8", "choose event selection"}; Configurable cfgJetR{"cfgJetR", 0.6, "trigger jet resolution parameter"}; // jet cone radius @@ -93,11 +94,13 @@ struct jetFilter { Filter trackFilter = (nabs(aod::jtrack::eta) < static_cast(cfgEtaTPC)) && (aod::jtrack::pt > trackPtMin); int trackSelection = -1; + int eventSelection = -1; void init(o2::framework::InitContext&) { triggerJetR = TMath::Nint(cfgJetR * 100.0f); trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(evSel)); spectra.add("fCollZpos", "collision z position", HistType::kTH1F, {{200, -20., +20., "#it{z}_{vtx} position (cm)"}}); @@ -193,6 +196,11 @@ struct jetFilter { spectra.fill(HIST("fCollZpos"), collision.posZ()); hProcessedEvents->Fill(static_cast(kBinAllEvents) + 0.1f); // all minimum bias events + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + tags(keepEvent[kJetChLowPt], keepEvent[kJetChHighPt], keepEvent[kTrackLowPt], keepEvent[kTrackHighPt]); + return; + } + // FILL SPECTRA OF INCLUSIVE JETS IN FIDUCIAL VOLUME if (TMath::Abs(collision.posZ()) < cfgZvtx) { if constexpr (withRho) { diff --git a/EventFiltering/cefpTask.cxx b/EventFiltering/cefpTask.cxx index 78ada7704ca..d1596622d52 100644 --- a/EventFiltering/cefpTask.cxx +++ b/EventFiltering/cefpTask.cxx @@ -322,10 +322,10 @@ struct centralEventFilterTask { auto schema{tablePtr->schema()}; for (auto& colName : tableName.second) { - int bin{mScalers->GetXaxis()->FindBin(colName.first.data())}; + uint64_t bin{static_cast(mScalers->GetXaxis()->FindBin(colName.first.data()))}; double binCenter{mScalers->GetXaxis()->GetBinCenter(bin)}; - uint64_t decisionBin{BIT(bin - 2) / 64}; - uint64_t triggerBit{BIT(bin - 2) % 64}; + uint64_t decisionBin{(bin - 2) / 64}; + uint64_t triggerBit{BIT((bin - 2) % 64)}; auto column{tablePtr->GetColumnByName(colName.first)}; double downscaling{colName.second}; if (column) { diff --git a/PWGCF/DataModel/FemtoDerived.h b/PWGCF/DataModel/FemtoDerived.h index 99759c7f642..4475cedc414 100644 --- a/PWGCF/DataModel/FemtoDerived.h +++ b/PWGCF/DataModel/FemtoDerived.h @@ -66,6 +66,22 @@ DECLARE_SOA_TABLE(FDColMasks, "AOD", "FDCOLMASK", DECLARE_SOA_TABLE(FDDownSample, "AOD", "FDDOWNSAMPLE", femtodreamcollision::Downsample); +namespace femtodreamMCcollision +{ +DECLARE_SOA_COLUMN(MultMCgenPartEta08, multMCgenPartEta08, int); //! Multiplicity of the event as given by the generator in |eta|<0.8 +} + +DECLARE_SOA_TABLE(FDMCCollisions, "AOD", "FDMCCOLLISION", + o2::soa::Index<>, + femtodreamMCcollision::MultMCgenPartEta08); +using FDMCCollision = FDMCCollisions::iterator; + +namespace mcfdcolllabel +{ +DECLARE_SOA_INDEX_COLUMN(FDMCCollision, fdMCCollision); //! MC collision for femtodreamcollision +} +DECLARE_SOA_TABLE(FDMCCollLabels, "AOD", "FDMCCollLabel", mcfdcolllabel::FDMCCollisionId); + /// FemtoDreamTrack namespace femtodreamparticle { diff --git a/PWGCF/Femto3D/Core/femto3dPairTask.h b/PWGCF/Femto3D/Core/femto3dPairTask.h index 43baeb6a9bc..2bda63575a8 100755 --- a/PWGCF/Femto3D/Core/femto3dPairTask.h +++ b/PWGCF/Femto3D/Core/femto3dPairTask.h @@ -42,8 +42,8 @@ namespace o2::aod::singletrackselector template Type getBinIndex(float const& value, std::vector const& binning, int const& NsubBins = 1) { - Type res = -100; - for (int i = 0; i < binning.size() - 1; i++) { + Type res = 10e6; + for (unsigned int i = 0; i < binning.size() - 1; i++) { if (value >= binning[i] && binning[i + 1] > value) { if (NsubBins < 2) { res = (Type)i; diff --git a/PWGCF/Femto3D/DataModel/singletrackselector.h b/PWGCF/Femto3D/DataModel/singletrackselector.h index c1217abb080..e91dafc7bbd 100755 --- a/PWGCF/Femto3D/DataModel/singletrackselector.h +++ b/PWGCF/Femto3D/DataModel/singletrackselector.h @@ -104,6 +104,10 @@ DECLARE_SOA_COLUMN(MultPercentile, multPerc, float); // Percentiles of multiplic DECLARE_SOA_COLUMN(PosZ, posZ, float); // Vertex of the collision DECLARE_SOA_COLUMN(MagField, magField, float); // Magnetic field corresponding to a collision (in T) +DECLARE_SOA_COLUMN(IsNoSameBunchPileup, isNoSameBunchPileup, bool); +DECLARE_SOA_COLUMN(IsGoodZvtxFT0vsPV, isGoodZvtxFT0vsPV, bool); +DECLARE_SOA_COLUMN(IsVertexITSTPC, isVertexITSTPC, bool); + } // namespace singletrackselector DECLARE_SOA_TABLE(SingleCollSels, "AOD", "SINGLECOLLSEL", // Table of the variables for single track selection. @@ -113,6 +117,11 @@ DECLARE_SOA_TABLE(SingleCollSels, "AOD", "SINGLECOLLSEL", // Table of the variab singletrackselector::PosZ, singletrackselector::MagField); +DECLARE_SOA_TABLE(SingleCollExtras, "AOD", "SINGLECOLLEXTRA", // Joinable collision table with Pile-Up flags + singletrackselector::IsNoSameBunchPileup, + singletrackselector::IsGoodZvtxFT0vsPV, + singletrackselector::IsVertexITSTPC); + namespace singletrackselector { DECLARE_SOA_INDEX_COLUMN(SingleCollSel, singleCollSel); // Index to the collision diff --git a/PWGCF/Femto3D/TableProducer/CMakeLists.txt b/PWGCF/Femto3D/TableProducer/CMakeLists.txt index 331407e6537..48750decf2e 100755 --- a/PWGCF/Femto3D/TableProducer/CMakeLists.txt +++ b/PWGCF/Femto3D/TableProducer/CMakeLists.txt @@ -12,4 +12,9 @@ o2physics_add_dpl_workflow(single-track-selector SOURCES singleTrackSelector.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(single-track-selector-extra + SOURCES singleTrackSelectorExtra.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx b/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx old mode 100755 new mode 100644 index f61dd67ec1f..3260481ad79 --- a/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx +++ b/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx @@ -52,13 +52,15 @@ struct singleTrackSelector { Configurable centTableToUse{"centTableToUse", 1, "Flag to choose cent./mult.perc. estimator (Run3 only [FTOC for PbPb; FTOM for pp], for Run2 the V0M is used): 0 -> CentFV0As, 1 -> CentFT0Ms, 2 -> CentFT0As, 3 -> CentFT0Cs, 4 -> CentFDDMs, 5 -> CentNTPVs"}; Configurable multTableToUse{"multTableToUse", 1, "Flag to choose mult. estimator (Run3 only): 0 -> TPCMults, 1 -> MultNTracksPV, 2 -> MultNTracksPVeta1"}; Configurable rejectNotPropagatedTrks{"rejectNotPropagatedTrks", true, "rejects tracks that are not propagated to the primary vertex"}; - Configurable removeTFBorder{"removeTFBorder", false, "Remove TF border"}; + Configurable enable_gen_info{"enable_gen_info", false, "Enable MC true info"}; Configurable> _particlesToKeep{"particlesToKeepPDGs", std::vector{2212, 1000010020}, "PDG codes of perticles for which the 'singletrackselector' tables will be created (only proton and deurton are supported now)"}; Configurable> keepWithinNsigmaTPC{"keepWithinNsigmaTPC", std::vector{-4.0f, 4.0f}, "TPC range for preselection of particles specified with PDG"}; Configurable> _particlesToReject{"particlesToRejectPDGs", std::vector{211, 321}, "PDG codes of particles that will be rejected with TOF (only pion, kaon, proton and deurton are supported now)"}; Configurable> rejectWithinNsigmaTOF{"rejectWithinNsigmaTOF", std::vector{-5.0f, 5.0f}, "TOF rejection Nsigma range for particles specified with PDG to be rejected"}; + Configurable _pRemoveTofOutOfRange{"pRemoveTofOutOfRange", 100.f, "momentum starting from which request TOF nSigma to be within the stored range (-10 < Nsigma < 10)"}; + Configurable _min_P{"min_P", 0.f, "lower mometum limit"}; Configurable _max_P{"max_P", 100.f, "upper mometum limit"}; Configurable _eta{"eta", 100.f, "abs eta value limit"}; @@ -77,9 +79,11 @@ struct singleTrackSelector { using CollRun2 = soa::Join; using CollRun3 = soa::Join; + using CollRun3MC = soa::Join; - Produces tableRow; Produces tableRowColl; + Produces tableRowCollExtra; + Produces tableRow; Produces tableRowExtra; Produces tableRowMC; @@ -100,6 +104,9 @@ struct singleTrackSelector { std::vector particlesToKeep; std::vector particlesToReject; + HistogramRegistry registry{"registry"}; + SliceCache cache; + void init(InitContext&) { @@ -110,6 +117,14 @@ struct singleTrackSelector { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); + + if (enable_gen_info) { + registry.add("hNEvents_MCGen", "hNEvents_MCGen", {HistType::kTH1F, {{1, 0.f, 1.f}}}); + registry.add("hGen_EtaPhiPt_Proton", "Gen (anti)protons in true collisions", {HistType::kTH3F, {{100, -1., 1., "#eta"}, {157, 0., 2 * TMath::Pi(), "#phi"}, {100, -5.f, 5.f, "p_{T} GeV/c"}}}); + registry.add("hGen_EtaPhiPt_Deuteron", "Gen (anti)deuteron in true collisions", {HistType::kTH3F, {{100, -1., 1., "#eta"}, {157, 0., 2 * TMath::Pi(), "#phi"}, {100, -5.f, 5.f, "p_{T} GeV/c"}}}); + registry.add("hReco_EtaPhiPt_Proton", "Gen (anti)protons in reco collisions", {HistType::kTH3F, {{100, -1., 1., "#eta"}, {157, 0., 2 * TMath::Pi(), "#phi"}, {100, -5.f, 5.f, "p_{T} GeV/c"}}}); + registry.add("hReco_EtaPhiPt_Deuteron", "Gen (anti)deuteron in reco collisions", {HistType::kTH3F, {{100, -1., 1., "#eta"}, {157, 0., 2 * TMath::Pi(), "#phi"}, {100, -5.f, 5.f, "p_{T} GeV/c"}}}); + } } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) // inspired by PWGLF/TableProducer/lambdakzerobuilder.cxx @@ -169,6 +184,8 @@ struct singleTrackSelector { for (auto ii : particlesToKeep) if (o2::aod::singletrackselector::TPCselection(track, std::make_pair(ii, keepWithinNsigmaTPC))) { + if (track.p() > _pRemoveTofOutOfRange && !o2::aod::singletrackselector::TOFselection(track, std::make_pair(ii, std::vector{-10.0, 10.0}), 10.0)) + continue; tableRow(tableRowColl.lastIndex(), track.p(), @@ -261,58 +278,59 @@ struct singleTrackSelector { auto bc = collision.bc_as(); initCCDB(bc); - if (removeTFBorder && collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + float centValue = -100.0f; - float centValue = -100.0f; + switch (centTableToUse) { + case 0: + centValue = collision.centFV0A(); + break; + case 1: + centValue = collision.centFT0M(); + break; + case 2: + centValue = collision.centFT0A(); + break; + case 3: + centValue = collision.centFT0C(); + break; + case 4: + centValue = collision.centFDDM(); + break; + case 5: + centValue = collision.centNTPV(); + break; + default: + LOGF(fatal, "Invalid flag for cent./mult.perc. estimator has been choosen. Please check."); + break; + } + if (centValue >= _centCut.value.first && centValue <= _centCut.value.second) { + int multValue = -1; - switch (centTableToUse) { + switch (multTableToUse) { case 0: - centValue = collision.centFV0A(); + multValue = collision.multTPC(); break; case 1: - centValue = collision.centFT0M(); + multValue = collision.multNTracksPV(); break; case 2: - centValue = collision.centFT0A(); - break; - case 3: - centValue = collision.centFT0C(); - break; - case 4: - centValue = collision.centFDDM(); - break; - case 5: - centValue = collision.centNTPV(); + multValue = collision.multNTracksPVeta1(); break; default: - LOGF(fatal, "Invalid flag for cent./mult.perc. estimator has been choosen. Please check."); + LOGF(fatal, "Invalid flag for mult. estimator has been choosen. Please check."); break; } - if (centValue >= _centCut.value.first && centValue <= _centCut.value.second) { - int multValue = -1; - - switch (multTableToUse) { - case 0: - multValue = collision.multTPC(); - break; - case 1: - multValue = collision.multNTracksPV(); - break; - case 2: - multValue = collision.multNTracksPVeta1(); - break; - default: - LOGF(fatal, "Invalid flag for mult. estimator has been choosen. Please check."); - break; - } - tableRowColl(multValue, - centValue, - collision.posZ(), - d_bz); + tableRowColl(multValue, + centValue, + collision.posZ(), + d_bz); + + tableRowCollExtra(collision.selection_bit(aod::evsel::kNoSameBunchPileup), + collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV), + collision.selection_bit(aod::evsel::kIsVertexITSTPC)); - fillTrackTables(tracks); - } + fillTrackTables(tracks); } } PROCESS_SWITCH(singleTrackSelector, processDataRun3, "process data Run3", true); @@ -351,7 +369,7 @@ struct singleTrackSelector { } PROCESS_SWITCH(singleTrackSelector, processMCRun2, "process MC Run2", false); - void processMCRun3(soa::Filtered::iterator const& collision, soa::Filtered> const& tracks, aod::McParticles const&, aod::BCsWithTimestamps const&) + void processMCRun3(soa::Filtered::iterator const& collision, aod::McCollisions const&, soa::Filtered> const& tracks, aod::McParticles const& mcParticles, aod::BCsWithTimestamps const&) { auto bc = collision.bc_as(); initCCDB(bc); @@ -405,10 +423,72 @@ struct singleTrackSelector { collision.posZ(), d_bz); + tableRowCollExtra(collision.selection_bit(aod::evsel::kNoSameBunchPileup), + collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV), + collision.selection_bit(aod::evsel::kIsVertexITSTPC)); + fillTrackTables(tracks); + + if (!enable_gen_info) { + return; + } + + const auto particlesInCollision = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, collision.mcCollision().globalIndex(), cache); + + for (auto& mcParticle : particlesInCollision) { // loop over generated particles + + if (!mcParticle.isPhysicalPrimary()) { + continue; + } + + if (mcParticle.pdgCode() == 1000010020) { + registry.fill(HIST("hReco_EtaPhiPt_Deuteron"), mcParticle.eta(), mcParticle.phi(), mcParticle.pt()); + } else if (mcParticle.pdgCode() == -1000010020) { + registry.fill(HIST("hReco_EtaPhiPt_Deuteron"), mcParticle.eta(), mcParticle.phi(), mcParticle.pt() * -1); + } + + if (mcParticle.pdgCode() == 2212) { + registry.fill(HIST("hReco_EtaPhiPt_Proton"), mcParticle.eta(), mcParticle.phi(), mcParticle.pt()); + } else if (mcParticle.pdgCode() == -2212) { + registry.fill(HIST("hReco_EtaPhiPt_Proton"), mcParticle.eta(), mcParticle.phi(), mcParticle.pt() * -1); + } + } } } PROCESS_SWITCH(singleTrackSelector, processMCRun3, "process MC Run3", false); + + void processGenRun3(aod::McCollisions::iterator const& mcCollision, + aod::McParticles const& mcParticles) + { + if (!enable_gen_info) { + return; + } + + if (abs(mcCollision.posZ()) > _vertexZ) { + return; + } + + registry.fill(HIST("hNEvents_MCGen"), 0.5); + + for (auto& mcParticle : mcParticles) { // loop over generated particles + + if (!mcParticle.isPhysicalPrimary()) { + continue; + } + if (mcParticle.pdgCode() == 1000010020) { + registry.fill(HIST("hGen_EtaPhiPt_Deuteron"), mcParticle.eta(), mcParticle.phi(), mcParticle.pt()); + } else if (mcParticle.pdgCode() == -1000010020) { + registry.fill(HIST("hGen_EtaPhiPt_Deuteron"), mcParticle.eta(), mcParticle.phi(), mcParticle.pt() * -1); + } + + if (mcParticle.pdgCode() == 2212) { + registry.fill(HIST("hGen_EtaPhiPt_Proton"), mcParticle.eta(), mcParticle.phi(), mcParticle.pt()); + } else if (mcParticle.pdgCode() == -2212) { + registry.fill(HIST("hGen_EtaPhiPt_Proton"), mcParticle.eta(), mcParticle.phi(), mcParticle.pt() * -1); + } + } + } + PROCESS_SWITCH(singleTrackSelector, processGenRun3, "process MC Gen collisions Run3", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGCF/Femto3D/TableProducer/singleTrackSelectorExtra.cxx b/PWGCF/Femto3D/TableProducer/singleTrackSelectorExtra.cxx new file mode 100755 index 00000000000..eec6197c98f --- /dev/null +++ b/PWGCF/Femto3D/TableProducer/singleTrackSelectorExtra.cxx @@ -0,0 +1,48 @@ +// 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 create a table applying some basic cuts on the ITS and DCA. +/// \author Sofia Tomassini, Gleb Romanenko, Nicolò Jacazio +/// \since 31 May 2023 + +// this task produces a dummy "SingleCollExtras" table that is now required in the analysis tasks. Needed to have a compatibility with old der. data + +#include +#include + +#include "PWGCF/Femto3D/DataModel/singletrackselector.h" + +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::track; +using namespace o2::aod; +//::singletrackselector; // the namespace defined in .h + +struct singleTrackSelectorDummy { + + Produces tableRowCollExtra; + + void process(aod::SingleCollSels::iterator const&) + { + tableRowCollExtra(true, + true, + true); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx b/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx index f9b85d33978..6d9fd003c1b 100755 --- a/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx +++ b/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx @@ -47,6 +47,10 @@ struct FemtoCorrelations { /// Construct a registry object with direct declaration HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + Configurable _removeSameBunchPileup{"removeSameBunchPileup", false, ""}; + Configurable _requestGoodZvtxFT0vsPV{"requestGoodZvtxFT0vsPV", false, ""}; + Configurable _requestVertexITSTPC{"requestVertexITSTPC", false, ""}; + Configurable _min_P{"min_P", 0.0, "lower mometum limit"}; Configurable _max_P{"max_P", 100.0, "upper mometum limit"}; Configurable _eta{"eta", 100.0, "abs eta value limit"}; @@ -88,6 +92,7 @@ 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"}; + Configurable _fillDetaDphi{"fillDetaDphi", false, "flag for filling dEta(dPhi*) histos: true -- fill; false -- not; note: they're filled before the double track cut"}; 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) @@ -96,7 +101,7 @@ struct FemtoCorrelations { // 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;"}; + 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 < 2 -> all the possible event pairs (per vertex¢ bin) will be processed); implemented for the sake of efficiency; look at the source code;"}; bool IsIdentical; @@ -106,7 +111,7 @@ struct FemtoCorrelations { std::pair> TPCcuts_2; std::pair> TOFcuts_2; - using FilteredCollisions = aod::SingleCollSels; + using FilteredCollisions = soa::Join; using FilteredTracks = aod::SingleTrackSels; typedef std::shared_ptr::iterator> trkType; @@ -142,6 +147,9 @@ struct FemtoCorrelations { std::vector>> MEhistos_3D; std::vector>> qLCMSvskStar; + std::vector>> DoubleTrack_SE_histos; + std::vector>> DoubleTrack_ME_histos; + void init(o2::framework::InitContext&) { @@ -163,7 +171,7 @@ struct FemtoCorrelations { TPCcuts_2 = std::make_pair(_particlePDG_2, _tpcNSigma_2); TOFcuts_2 = std::make_pair(_particlePDG_2, _tofNSigma_2); - for (int i = 0; i < _centBins.value.size() - 1; i++) { + for (unsigned int i = 0; i < _centBins.value.size() - 1; i++) { std::vector> SEperMult_1D; std::vector> MEperMult_1D; std::vector> kTperMult; @@ -172,7 +180,7 @@ struct FemtoCorrelations { auto hMult = registry.add(Form("Cent%i/TPCMult_cent%i", i, i), Form("TPCMult_cent%i", i), kTH1F, {{5001, -0.5, 5000.5, "Mult."}}); MultHistos.push_back(std::move(hMult)); - for (int j = 0; j < _kTbins.value.size() - 1; j++) { + for (unsigned int j = 0; j < _kTbins.value.size() - 1; j++) { auto hSE_1D = registry.add(Form("Cent%i/SE_1D_cent%i_kT%i", i, i, j), Form("SE_1D_cent%i_kT%i", i, j), kTH1F, {{CFkStarBinning, "k* (GeV/c)"}}); auto hME_1D = registry.add(Form("Cent%i/ME_1D_cent%i_kT%i", i, i, j), Form("ME_1D_cent%i_kT%i", i, j), kTH1F, {{CFkStarBinning, "k* (GeV/c)"}}); auto hkT = registry.add(Form("Cent%i/kT_cent%i_kT%i", i, i, j), Form("kT_cent%i_kT%i", i, j), kTH1F, {{500, 0., 5., "kT"}}); @@ -193,7 +201,7 @@ struct FemtoCorrelations { std::vector> MEperMult_3D; std::vector> qLCMSvskStarperMult; - for (int j = 0; j < _kTbins.value.size() - 1; j++) { + for (unsigned 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, {{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)"}}); @@ -205,6 +213,21 @@ struct FemtoCorrelations { MEhistos_3D.push_back(std::move(MEperMult_3D)); qLCMSvskStar.push_back(std::move(qLCMSvskStarperMult)); } + + if (_fillDetaDphi) { + std::vector> DoubleTrack_SE_histos_perMult; + std::vector> DoubleTrack_ME_histos_perMult; + + for (unsigned int j = 0; j < _kTbins.value.size() - 1; j++) { + auto hDblTrk_SE = registry.add(Form("Cent%i/DoubleTrackEffects_SE_cent%i_kT%i", i, i, j), Form("DoubleTrackEffects_deta(dphi*)_SE_cent%i_kT%i", i, j), kTH2F, {{600, -M_PI, M_PI, "dphi*"}, {200, -0.5, 0.5, "deta"}}); + auto hDblTrk_ME = registry.add(Form("Cent%i/DoubleTrackEffects_ME_cent%i_kT%i", i, i, j), Form("DoubleTrackEffects_deta(dphi*)_ME_cent%i_kT%i", i, j), kTH2F, {{600, -M_PI, M_PI, "dphi*"}, {200, -0.5, 0.5, "deta"}}); + + DoubleTrack_SE_histos_perMult.push_back(std::move(hDblTrk_SE)); + DoubleTrack_ME_histos_perMult.push_back(std::move(hDblTrk_ME)); + } + DoubleTrack_SE_histos.push_back(std::move(DoubleTrack_SE_histos_perMult)); + DoubleTrack_ME_histos.push_back(std::move(DoubleTrack_ME_histos_perMult)); + } } registry.add("p_first", Form("p_%i", static_cast(_particlePDG_1)), kTH1F, {{100, 0., 5., "p"}}); @@ -218,19 +241,15 @@ struct FemtoCorrelations { } template - void mixTracks(Type const& tracks, int multBin) + void mixTracks(Type const& tracks, unsigned int multBin) { // template for identical particles from the same collision - if (multBin >= 0) { - if (multBin > SEhistos_1D.size()) - LOGF(fatal, "multBin value passed to the mixTracks function exceeds the configured number of Cent. bins (1D)"); - if (_fill3dCF && multBin > SEhistos_3D.size()) - LOGF(fatal, "multBin value passed to the mixTracks function exceeds the configured number of Cent. bins (3D)"); - } else { - LOGF(fatal, "multBin value passed to the mixTracks function is less than 0"); - } + if (multBin > SEhistos_1D.size()) + LOGF(fatal, "multBin value passed to the mixTracks function exceeds the configured number of Cent. bins (1D)"); + if (_fill3dCF && multBin > SEhistos_3D.size()) + LOGF(fatal, "multBin value passed to the mixTracks function exceeds the configured number of Cent. bins (3D)"); - for (int ii = 0; ii < tracks.size(); ii++) { // nested loop for all the combinations - for (int iii = ii + 1; iii < tracks.size(); iii++) { + for (unsigned int ii = 0; ii < tracks.size(); ii++) { // nested loop for all the combinations + for (unsigned int iii = ii + 1; iii < tracks.size(); iii++) { Pair->SetPair(tracks[ii], tracks[iii]); float pair_kT = Pair->GetKt(); @@ -238,26 +257,25 @@ struct FemtoCorrelations { if (pair_kT < *_kTbins.value.begin() || pair_kT >= *(_kTbins.value.end() - 1)) continue; - int kTbin = o2::aod::singletrackselector::getBinIndex(pair_kT, _kTbins); - if (kTbin >= 0) { - if (kTbin > SEhistos_1D[multBin].size()) - LOGF(fatal, "kTbin value obtained for a pair exceeds the configured number of kT bins (1D)"); - if (_fill3dCF && kTbin > SEhistos_3D[multBin].size()) - LOGF(fatal, "kTbin value obtained for a pair exceeds the configured number of kT bins (3D)"); - } else { - LOGF(fatal, "kTbin value obtained for a pair is less than 0"); - } + unsigned int kTbin = o2::aod::singletrackselector::getBinIndex(pair_kT, _kTbins); + if (kTbin > SEhistos_1D[multBin].size()) + LOGF(fatal, "kTbin value obtained for a pair exceeds the configured number of kT bins (1D)"); + if (_fill3dCF && kTbin > SEhistos_3D[multBin].size()) + LOGF(fatal, "kTbin value obtained for a pair exceeds the configured number of kT bins (3D)"); - if (!Pair->IsClosePair(_deta, _dphi, _radiusTPC)) { - kThistos[multBin][kTbin]->Fill(pair_kT); - mThistos[multBin][kTbin]->Fill(Pair->GetMt()); // test - SEhistos_1D[multBin][kTbin]->Fill(Pair->GetKstar()); // close pair rejection and fillig the SE histo + if (_fillDetaDphi) + DoubleTrack_SE_histos[multBin][kTbin]->Fill(Pair->GetPhiStarDiff(_radiusTPC), Pair->GetEtaDiff()); + if (Pair->IsClosePair(_deta, _dphi, _radiusTPC)) + continue; - if (_fill3dCF) { - std::mt19937 mt(std::chrono::steady_clock::now().time_since_epoch().count()); - TVector3 qLCMS = std::pow(-1, (mt() % 2)) * Pair->GetQLCMS(); // introducing randomness to the pair order ([first, second]); 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 - SEhistos_3D[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z()); - } + kThistos[multBin][kTbin]->Fill(pair_kT); + mThistos[multBin][kTbin]->Fill(Pair->GetMt()); // test + SEhistos_1D[multBin][kTbin]->Fill(Pair->GetKstar()); // close pair rejection and fillig the SE histo + + if (_fill3dCF) { + std::mt19937 mt(std::chrono::steady_clock::now().time_since_epoch().count()); + TVector3 qLCMS = std::pow(-1, (mt() % 2)) * Pair->GetQLCMS(); // introducing randomness to the pair order ([first, second]); 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 + SEhistos_3D[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z()); } Pair->ResetPair(); } @@ -265,16 +283,12 @@ struct FemtoCorrelations { } template - void mixTracks(Type const& tracks1, Type const& tracks2, int multBin) + void mixTracks(Type const& tracks1, Type const& tracks2, unsigned int multBin) { // last value: 0 -- SE; 1 -- ME - if (multBin >= 0) { - if (multBin > SEhistos_1D.size()) - LOGF(fatal, "multBin value passed to the mixTracks function exceeds the configured number of Cent. bins (1D)"); - if (_fill3dCF && multBin > SEhistos_3D.size()) - LOGF(fatal, "multBin value passed to the mixTracks function exceeds the configured number of Cent. bins (3D)"); - } else { - LOGF(fatal, "multBin value passed to the mixTracks function is less than 0"); - } + if (multBin > SEhistos_1D.size()) + LOGF(fatal, "multBin value passed to the mixTracks function exceeds the configured number of Cent. bins (1D)"); + if (_fill3dCF && multBin > SEhistos_3D.size()) + LOGF(fatal, "multBin value passed to the mixTracks function exceeds the configured number of Cent. bins (3D)"); for (auto ii : tracks1) { for (auto iii : tracks2) { @@ -285,36 +299,40 @@ struct FemtoCorrelations { if (pair_kT < *_kTbins.value.begin() || pair_kT >= *(_kTbins.value.end() - 1)) continue; - int kTbin = o2::aod::singletrackselector::getBinIndex(pair_kT, _kTbins); - if (kTbin >= 0) { - if (kTbin > SEhistos_1D[multBin].size()) - LOGF(fatal, "kTbin value obtained for a pair exceeds the configured number of kT bins (1D)"); - if (_fill3dCF && kTbin > SEhistos_3D[multBin].size()) - LOGF(fatal, "kTbin value obtained for a pair exceeds the configured number of kT bins (3D)"); - } else { - LOGF(fatal, "kTbin value obtained for a pair is less than 0"); + unsigned int kTbin = o2::aod::singletrackselector::getBinIndex(pair_kT, _kTbins); + if (kTbin > SEhistos_1D[multBin].size()) + LOGF(fatal, "kTbin value obtained for a pair exceeds the configured number of kT bins (1D)"); + if (_fill3dCF && kTbin > SEhistos_3D[multBin].size()) + LOGF(fatal, "kTbin value obtained for a pair exceeds the configured number of kT bins (3D)"); + + if (_fillDetaDphi) { + if (!SE_or_ME) + DoubleTrack_SE_histos[multBin][kTbin]->Fill(Pair->GetPhiStarDiff(_radiusTPC), Pair->GetEtaDiff()); + else + DoubleTrack_ME_histos[multBin][kTbin]->Fill(Pair->GetPhiStarDiff(_radiusTPC), Pair->GetEtaDiff()); } - if (!Pair->IsClosePair(_deta, _dphi, _radiusTPC)) { - if (!SE_or_ME) { - SEhistos_1D[multBin][kTbin]->Fill(Pair->GetKstar()); - kThistos[multBin][kTbin]->Fill(pair_kT); - mThistos[multBin][kTbin]->Fill(Pair->GetMt()); // test + if (Pair->IsClosePair(_deta, _dphi, _radiusTPC)) + continue; - if (_fill3dCF) { - std::mt19937 mt(std::chrono::steady_clock::now().time_since_epoch().count()); - TVector3 qLCMS = std::pow(-1, (mt() % 2)) * Pair->GetQLCMS(); // introducing randomness to the pair order ([first, second]); 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 - SEhistos_3D[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z()); - } - } else { - MEhistos_1D[multBin][kTbin]->Fill(Pair->GetKstar()); + if (!SE_or_ME) { + SEhistos_1D[multBin][kTbin]->Fill(Pair->GetKstar()); + kThistos[multBin][kTbin]->Fill(pair_kT); + mThistos[multBin][kTbin]->Fill(Pair->GetMt()); // test - if (_fill3dCF) { - std::mt19937 mt(std::chrono::steady_clock::now().time_since_epoch().count()); - TVector3 qLCMS = std::pow(-1, (mt() % 2)) * Pair->GetQLCMS(); // introducing randomness to the pair order ([first, second]); 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 - MEhistos_3D[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z()); - qLCMSvskStar[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z(), Pair->GetKstar()); - } + if (_fill3dCF) { + std::mt19937 mt(std::chrono::steady_clock::now().time_since_epoch().count()); + TVector3 qLCMS = std::pow(-1, (mt() % 2)) * Pair->GetQLCMS(); // introducing randomness to the pair order ([first, second]); 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 + SEhistos_3D[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z()); + } + } else { + MEhistos_1D[multBin][kTbin]->Fill(Pair->GetKstar()); + + if (_fill3dCF) { + std::mt19937 mt(std::chrono::steady_clock::now().time_since_epoch().count()); + TVector3 qLCMS = std::pow(-1, (mt() % 2)) * Pair->GetQLCMS(); // introducing randomness to the pair order ([first, second]); 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 + MEhistos_3D[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z()); + qLCMSvskStar[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z(), Pair->GetKstar()); } } Pair->ResetPair(); @@ -330,6 +348,12 @@ struct FemtoCorrelations { for (auto track : tracks) { if (abs(track.template singleCollSel_as>().posZ()) > _vertexZ) continue; + if (_removeSameBunchPileup && !track.template singleCollSel_as>().isNoSameBunchPileup()) + continue; + if (_requestGoodZvtxFT0vsPV && !track.template singleCollSel_as>().isGoodZvtxFT0vsPV()) + continue; + if (_requestVertexITSTPC && !track.template singleCollSel_as>().isVertexITSTPC()) + continue; if (track.tpcFractionSharedCls() > _tpcFractionSharedCls || track.itsNCls() < _itsNCls) continue; if (track.template singleCollSel_as>().multPerc() < *_centBins.value.begin() || track.template singleCollSel_as>().multPerc() >= *(_centBins.value.end() - 1)) @@ -386,6 +410,13 @@ struct FemtoCorrelations { if (collision.multPerc() < *_centBins.value.begin() || collision.multPerc() >= *(_centBins.value.end() - 1)) continue; + if (_removeSameBunchPileup && !collision.isNoSameBunchPileup()) + continue; + if (_requestGoodZvtxFT0vsPV && !collision.isGoodZvtxFT0vsPV()) + continue; + if (_requestVertexITSTPC && !collision.isVertexITSTPC()) + continue; + if (selectedtracks_1.find(collision.globalIndex()) == selectedtracks_1.end()) { if (IsIdentical) continue; @@ -403,21 +434,21 @@ 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(); + unsigned int EvPerBin = (i->second).size(); - for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin + for (unsigned int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin auto col1 = (i->second)[indx1]; Pair->SetMagField1(col1->magField()); Pair->SetMagField2(col1->magField()); - int centBin = std::floor((i->first).second); + unsigned int centBin = std::floor((i->first).second); MultHistos[centBin]->Fill(col1->mult()); mixTracks(selectedtracks_1[col1->index()], centBin); // mixing SE identical - for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + for (unsigned 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) @@ -435,21 +466,21 @@ 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(); + unsigned int EvPerBin = (i->second).size(); - for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin + for (unsigned int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin auto col1 = (i->second)[indx1]; Pair->SetMagField1(col1->magField()); Pair->SetMagField2(col1->magField()); - int centBin = std::floor((i->first).second); + unsigned int centBin = std::floor((i->first).second); MultHistos[centBin]->Fill(col1->mult()); 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 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + for (unsigned 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) diff --git a/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx b/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx index c14a97fcc06..596c6039933 100755 --- a/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx +++ b/PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx @@ -75,10 +75,11 @@ struct FemtoCorrelationsMC { Configurable _radiusTPC{"radiusTPC", 1.2, "TPC radius to calculate phi_star for"}; - 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"}; + Configurable> _centBins{"multBins", std::vector{0.0f, 100.0f}, "multiplicity percentile/centrality binning (min:0, max:100)"}; + Configurable _multNsubBins{"multSubBins", 1, "number of sub-bins to perform the mixing within"}; + Configurable> _kTbins{"kTbins", std::vector{0.0f, 100.0f}, "pair transverse momentum kT binning"}; + ConfigurableAxis CFkStarBinning{"CFkStarBinning", {500, 0.005, 5.005}, "k* binning of the res. matrix (Nbins, lowlimit, uplimit)"}; bool IsIdentical; @@ -111,6 +112,17 @@ struct FemtoCorrelationsMC { Filter vertexFilter = nabs(o2::aod::singletrackselector::posZ) < _vertexZ; + std::vector>> DCA_histos_1; // key -- origin; origin = 0 - primiry, 1 - weak, 2 - material; + std::vector>> DCA_histos_2; // key -- origin; origin = 0 - primiry, 1 - weak, 2 - material; + + std::vector>> Purity_histos_1; // key -- PDG; PDG == 0 -> all selected tracks + std::vector>> Purity_histos_2; // key -- PDG; PDG == 0 -> all selected tracks + + std::vector>> kThistos; + std::vector>> Resolution_histos; + std::vector>> DoubleTrack_SE_histos; + std::vector>> DoubleTrack_ME_histos; + void init(o2::framework::InitContext&) { @@ -125,77 +137,135 @@ struct FemtoCorrelationsMC { TPCcuts_2 = std::make_pair(_particlePDG_2, _tpcNSigma_2); TOFcuts_2 = std::make_pair(_particlePDG_2, _tofNSigma_2); - registry.add("FirstParticle/dcaxyz_vs_pt_primary", "dcaxyz_vs_pt_primary", kTH3F, {{100, 0., 5., "pt"}, {250, -1., 1., "DCA_XY(pt) primary"}, {250, -1., 1., "DCA_Z(pt) primary"}}); - registry.add("FirstParticle/dcaxyz_vs_pt_weakdecay", "dcaxyz_vs_pt_weakdecay", kTH3F, {{100, 0., 5., "pt"}, {250, -1., 1., "DCA_XY(pt) weakdecay"}, {250, -1., 1., "DCA_Z(pt) weakdecay"}}); - registry.add("FirstParticle/dcaxyz_vs_pt_material", "dcaxyz_vs_pt_material", kTH3F, {{100, 0., 5., "pt"}, {250, -1., 1., "DCA_XY(pt) material"}, {250, -1., 1., "DCA_Z(pt) material"}}); + for (unsigned int i = 0; i < _centBins.value.size() - 1; i++) { + + std::map> DCA_histos_1_perMult; + DCA_histos_1_perMult[0] = registry.add(Form("Cent%i/FirstParticle/dcaxyz_vs_pt_primary", i), "dcaxyz_vs_pt_primary", kTH3F, {{100, 0., 5., "pt"}, {250, -1., 1., "DCA_XY(pt) primary"}, {250, -1., 1., "DCA_Z(pt) primary"}}); + DCA_histos_1_perMult[1] = registry.add(Form("Cent%i/FirstParticle/dcaxyz_vs_pt_weakdecay", i), "dcaxyz_vs_pt_weakdecay", kTH3F, {{100, 0., 5., "pt"}, {250, -1., 1., "DCA_XY(pt) weakdecay"}, {250, -1., 1., "DCA_Z(pt) weakdecay"}}); + DCA_histos_1_perMult[2] = registry.add(Form("Cent%i/FirstParticle/dcaxyz_vs_pt_material", i), "dcaxyz_vs_pt_material", kTH3F, {{100, 0., 5., "pt"}, {250, -1., 1., "DCA_XY(pt) material"}, {250, -1., 1., "DCA_Z(pt) material"}}); + + std::map> Purity_histos_1_perMult; + Purity_histos_1_perMult[11] = registry.add(Form("Cent%i/FirstParticle/pSpectraEl", i), "pSpectraEl", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_1_perMult[13] = registry.add(Form("Cent%i/FirstParticle/pSpectraMu", i), "pSpectraMu", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_1_perMult[211] = registry.add(Form("Cent%i/FirstParticle/pSpectraPi", i), "pSpectraPi", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_1_perMult[321] = registry.add(Form("Cent%i/FirstParticle/pSpectraKa", i), "pSpectraKa", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_1_perMult[2212] = registry.add(Form("Cent%i/FirstParticle/pSpectraPr", i), "pSpectraPr", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_1_perMult[1000010020] = registry.add(Form("Cent%i/FirstParticle/pSpectraDe", i), "pSpectraDe", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_1_perMult[0] = registry.add(Form("Cent%i/FirstParticle/pSpectraAll", i), "pSpectrAll", kTH1F, {{100, 0., 5., "p"}}); + + DCA_histos_1.push_back(std::move(DCA_histos_1_perMult)); + Purity_histos_1.push_back(std::move(Purity_histos_1_perMult)); + + if (!IsIdentical) { + std::map> DCA_histos_2_perMult; + DCA_histos_2_perMult[0] = registry.add(Form("Cent%i/SecondParticle/dcaxyz_vs_pt_primary", i), "dcaxyz_vs_pt_primary", kTH3F, {{100, 0., 5., "pt"}, {200, -1., 1., "DCA_XY(pt) primary"}, {200, -1., 1., "DCA_Z(pt) primary"}}); + DCA_histos_2_perMult[1] = registry.add(Form("Cent%i/SecondParticle/dcaxyz_vs_pt_weakdecay", i), "dcaxyz_vs_pt_weakdecay", kTH3F, {{100, 0., 5., "pt"}, {200, -1., 1., "DCA_XY(pt) weakdecay"}, {200, -1., 1., "DCA_Z(pt) weakdecay"}}); + DCA_histos_2_perMult[2] = registry.add(Form("Cent%i/SecondParticle/dcaxyz_vs_pt_material", i), "dcaxyz_vs_pt_material", kTH3F, {{100, 0., 5., "pt"}, {200, -1., 1., "DCA_XY(pt) material"}, {200, -1., 1., "DCA_Z(pt) material"}}); + + std::map> Purity_histos_2_perMult; + Purity_histos_2_perMult[11] = registry.add(Form("Cent%i/SecondParticle/pSpectraEl", i), "pSpectraEl", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_2_perMult[13] = registry.add(Form("Cent%i/SecondParticle/pSpectraMu", i), "pSpectraMu", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_2_perMult[211] = registry.add(Form("Cent%i/SecondParticle/pSpectraPi", i), "pSpectraPi", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_2_perMult[321] = registry.add(Form("Cent%i/SecondParticle/pSpectraKa", i), "pSpectraKa", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_2_perMult[2212] = registry.add(Form("Cent%i/SecondParticle/pSpectraPr", i), "pSpectraPr", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_2_perMult[1000010020] = registry.add(Form("Cent%i/SecondParticle/pSpectraDe", i), "pSpectraDe", kTH1F, {{100, 0., 5., "p"}}); + Purity_histos_2_perMult[0] = registry.add(Form("Cent%i/SecondParticle/pSpectraAll", i), "pSpectrAll", kTH1F, {{100, 0., 5., "p"}}); + + DCA_histos_2.push_back(std::move(DCA_histos_2_perMult)); + Purity_histos_2.push_back(std::move(Purity_histos_2_perMult)); + } - registry.add("FirstParticle/pSpectraEl", "pSpectraEl", kTH1F, {{100, 0., 5., "p"}}); - registry.add("FirstParticle/pSpectraMu", "pSpectraMu", kTH1F, {{100, 0., 5., "p"}}); - registry.add("FirstParticle/pSpectraPi", "pSpectraPi", kTH1F, {{100, 0., 5., "p"}}); - registry.add("FirstParticle/pSpectraKa", "pSpectraKa", kTH1F, {{100, 0., 5., "p"}}); - registry.add("FirstParticle/pSpectraPr", "pSpectraPr", kTH1F, {{100, 0., 5., "p"}}); - registry.add("FirstParticle/pSpectraDe", "pSpectraDe", kTH1F, {{100, 0., 5., "p"}}); - registry.add("FirstParticle/pSpectraAll", "pSpectrAll", kTH1F, {{100, 0., 5., "p"}}); + std::vector> kThistos_perMult; + std::vector> Resolution_histos_perMult; + std::vector> DoubleTrack_SE_histos_perMult; + std::vector> DoubleTrack_ME_histos_perMult; + + for (unsigned int j = 0; j < _kTbins.value.size() - 1; j++) { + auto kT_tmp = registry.add(Form("Cent%i/kT_cent%i_kT%i", i, i, j), Form("kT_cent%i_kT%i", i, j), kTH1F, {{500, 0., 5., "kT"}}); + auto Res_tmp = registry.add(Form("Cent%i/ResolutionMatrix_cent%i_kT%i", i, i, j), Form("ResolutionMatrix_rec(gen)_cent%i_kT%i", i, j), kTH2F, {{CFkStarBinning, "k*_gen (GeV/c)"}, {CFkStarBinning, "k*_rec (GeV/c)"}}); + auto DblTrk_SE_tmp = registry.add(Form("Cent%i/DoubleTrackEffects_SE_cent%i_kT%i", i, i, j), Form("DoubleTrackEffects_deta(dphi*)_SE_cent%i_kT%i", i, j), kTH2F, {{600, -M_PI, M_PI, "dphi*"}, {200, -0.5, 0.5, "deta"}}); + auto DblTrk_ME_tmp = registry.add(Form("Cent%i/DoubleTrackEffects_ME_cent%i_kT%i", i, i, j), Form("DoubleTrackEffects_deta(dphi*)_ME_cent%i_kT%i", i, j), kTH2F, {{600, -M_PI, M_PI, "dphi*"}, {200, -0.5, 0.5, "deta"}}); + kThistos_perMult.push_back(std::move(kT_tmp)); + Resolution_histos_perMult.push_back(std::move(Res_tmp)); + DoubleTrack_SE_histos_perMult.push_back(std::move(DblTrk_SE_tmp)); + DoubleTrack_ME_histos_perMult.push_back(std::move(DblTrk_ME_tmp)); + } - if (!IsIdentical) { - registry.add("SecondParticle/dcaxyz_vs_pt_primary", "dcaxyz_vs_pt_primary", kTH3F, {{100, 0., 5., "pt"}, {200, -1., 1., "DCA_XY(pt) primary"}, {200, -1., 1., "DCA_Z(pt) primary"}}); - registry.add("SecondParticle/dcaxyz_vs_pt_weakdecay", "dcaxyz_vs_pt_weakdecay", kTH3F, {{100, 0., 5., "pt"}, {200, -1., 1., "DCA_XY(pt) weakdecay"}, {200, -1., 1., "DCA_Z(pt) weakdecay"}}); - registry.add("SecondParticle/dcaxyz_vs_pt_material", "dcaxyz_vs_pt_material", kTH3F, {{100, 0., 5., "pt"}, {200, -1., 1., "DCA_XY(pt) material"}, {200, -1., 1., "DCA_Z(pt) material"}}); - - registry.add("SecondParticle/pSpectraEl", "pSpectraEl", kTH1F, {{100, 0., 5., "p"}}); - registry.add("SecondParticle/pSpectraMu", "pSpectraMu", kTH1F, {{100, 0., 5., "p"}}); - registry.add("SecondParticle/pSpectraPi", "pSpectraPi", kTH1F, {{100, 0., 5., "p"}}); - registry.add("SecondParticle/pSpectraKa", "pSpectraKa", kTH1F, {{100, 0., 5., "p"}}); - registry.add("SecondParticle/pSpectraPr", "pSpectraPr", kTH1F, {{100, 0., 5., "p"}}); - registry.add("SecondParticle/pSpectraDe", "pSpectraDe", kTH1F, {{100, 0., 5., "p"}}); - registry.add("SecondParticle/pSpectraAll", "pSpectrAll", kTH1F, {{100, 0., 5., "p"}}); + kThistos.push_back(std::move(kThistos_perMult)); + Resolution_histos.push_back(std::move(Resolution_histos_perMult)); + DoubleTrack_SE_histos.push_back(std::move(DoubleTrack_SE_histos_perMult)); + DoubleTrack_ME_histos.push_back(std::move(DoubleTrack_ME_histos_perMult)); } - - registry.add("ResolutionMatrix", "ResolutionMatrix_rec(gen)", kTH2F, {{CFkStarBinning, "k*_gen (GeV/c)"}, {CFkStarBinning, "k*_rec (GeV/c)"}}); - registry.add("DoubleTrackEffects", "DoubleTrackEffects_deta(dphi*)", kTH2F, {{200, -M_PI, M_PI, "dphi*"}, {200, -0.5, 0.5, "deta"}}); } template - void fillEtaPhi(Type const& tracks) - { // template for particles from the same collision identical - for (int ii = 0; ii < tracks.size(); ii++) { // nested loop for all the combinations - for (int iii = ii + 1; iii < tracks.size(); iii++) { + void fillEtaPhi(Type const& tracks, unsigned int centBin) + { // template for particles from the same collision identical + for (unsigned int ii = 0; ii < tracks.size(); ii++) { // nested loop for all the combinations + for (unsigned int iii = ii + 1; iii < tracks.size(); iii++) { Pair->SetPair(tracks[ii], tracks[iii]); + float pair_kT = Pair->GetKt(); + + if (pair_kT < *_kTbins.value.begin() || pair_kT >= *(_kTbins.value.end() - 1)) + continue; + + unsigned int kTbin = o2::aod::singletrackselector::getBinIndex(pair_kT, _kTbins); + if (kTbin > DoubleTrack_SE_histos[centBin].size()) + LOGF(fatal, "kTbin value obtained for a pair exceeds the configured number of kT bins"); - registry.fill(HIST("DoubleTrackEffects"), Pair->GetPhiStarDiff(_radiusTPC), Pair->GetEtaDiff()); + kThistos[centBin][kTbin]->Fill(pair_kT); + DoubleTrack_SE_histos[centBin][kTbin]->Fill(Pair->GetPhiStarDiff(_radiusTPC), Pair->GetEtaDiff()); Pair->ResetPair(); } } } template - void fillEtaPhi(Type const& tracks1, Type const& tracks2) + void fillEtaPhi(Type const& tracks1, Type const& tracks2, unsigned int centBin) { // template for particles from the same collision non-identical for (auto ii : tracks1) { for (auto iii : tracks2) { Pair->SetPair(ii, iii); + float pair_kT = Pair->GetKt(); + + if (pair_kT < *_kTbins.value.begin() || pair_kT >= *(_kTbins.value.end() - 1)) + continue; + + unsigned int kTbin = o2::aod::singletrackselector::getBinIndex(pair_kT, _kTbins); + if (kTbin > DoubleTrack_SE_histos[centBin].size()) + LOGF(fatal, "kTbin value obtained for a pair exceeds the configured number of kT bins"); - registry.fill(HIST("DoubleTrackEffects"), Pair->GetPhiStarDiff(_radiusTPC), Pair->GetEtaDiff()); + kThistos[centBin][kTbin]->Fill(pair_kT); + DoubleTrack_SE_histos[centBin][kTbin]->Fill(Pair->GetPhiStarDiff(_radiusTPC), Pair->GetEtaDiff()); Pair->ResetPair(); } } } template - void fillResMatrix(Type const& tracks1, Type const& tracks2) + void fillResMatrix(Type const& tracks1, Type const& tracks2, unsigned int centBin) { // template for ME for (auto ii : tracks1) { for (auto iii : tracks2) { Pair->SetPair(ii, iii); + float pair_kT = Pair->GetKt(); + + if (pair_kT < *_kTbins.value.begin() || pair_kT >= *(_kTbins.value.end() - 1)) + continue; + + unsigned int kTbin = o2::aod::singletrackselector::getBinIndex(pair_kT, _kTbins); + if (kTbin > Resolution_histos[centBin].size() || kTbin > DoubleTrack_ME_histos[centBin].size()) + LOGF(fatal, "kTbin value obtained for a pair exceeds the configured number of kT bins"); TLorentzVector first4momentumGen; first4momentumGen.SetPtEtaPhiM(ii->pt_MC(), ii->eta_MC(), ii->phi_MC(), particle_mass(_particlePDG_1)); TLorentzVector second4momentumGen; second4momentumGen.SetPtEtaPhiM(iii->pt_MC(), iii->eta_MC(), iii->phi_MC(), particle_mass(_particlePDG_2)); - registry.fill(HIST("ResolutionMatrix"), o2::aod::singletrackselector::GetKstarFrom4vectors(first4momentumGen, second4momentumGen, IsIdentical), Pair->GetKstar()); + Resolution_histos[centBin][kTbin]->Fill(o2::aod::singletrackselector::GetKstarFrom4vectors(first4momentumGen, second4momentumGen, IsIdentical), Pair->GetKstar()); + DoubleTrack_ME_histos[centBin][kTbin]->Fill(Pair->GetPhiStarDiff(_radiusTPC), Pair->GetEtaDiff()); Pair->ResetPair(); } } @@ -213,109 +283,67 @@ struct FemtoCorrelationsMC { continue; if (track.tpcFractionSharedCls() > _tpcFractionSharedCls || track.itsNCls() < _itsNCls) continue; + if (track.template singleCollSel_as>().multPerc() < *_centBins.value.begin() || track.template singleCollSel_as>().multPerc() >= *(_centBins.value.end() - 1)) + continue; + + unsigned int centBin = o2::aod::singletrackselector::getBinIndex(track.template singleCollSel_as>().multPerc(), _centBins); 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))) { + trackOrigin = track.origin(); - switch (trackOrigin) { - case 0: - registry.fill(HIST("FirstParticle/dcaxyz_vs_pt_primary"), track.pt(), track.dcaXY(), track.dcaZ()); - break; - case 1: - registry.fill(HIST("FirstParticle/dcaxyz_vs_pt_weakdecay"), track.pt(), track.dcaXY(), track.dcaZ()); - break; - case 2: - registry.fill(HIST("FirstParticle/dcaxyz_vs_pt_material"), track.pt(), track.dcaXY(), track.dcaZ()); - break; - } + + if (trackOrigin > -1 && trackOrigin < 3) + DCA_histos_1[centBin][track.origin()]->Fill(track.pt(), track.dcaXY(), track.dcaZ()); + if (abs(track.dcaXY()) > _dcaXY || abs(track.dcaZ()) > _dcaZ) continue; - selectedtracks_1[track.singleCollSelId()].push_back(std::make_shared(track)); // filling the map: eventID <-> selected particles1 - trackPDG = abs(track.pdgCode()); - registry.fill(HIST("FirstParticle/pSpectraAll"), track.p_MC()); - - switch (trackPDG) { - case 11: - registry.fill(HIST("FirstParticle/pSpectraEl"), track.p_MC()); - break; - case 13: - registry.fill(HIST("FirstParticle/pSpectraMu"), track.p_MC()); - break; - case 211: - registry.fill(HIST("FirstParticle/pSpectraPi"), track.p_MC()); - break; - case 321: - registry.fill(HIST("FirstParticle/pSpectraKa"), track.p_MC()); - break; - case 2212: - registry.fill(HIST("FirstParticle/pSpectraPr"), track.p_MC()); - break; - case 1000010020: - registry.fill(HIST("FirstParticle/pSpectraDe"), track.p_MC()); - break; - } + Purity_histos_1[centBin][0]->Fill(track.p()); + if (trackPDG == 11 || trackPDG == 13 || trackPDG == 211 || trackPDG == 321 || trackPDG == 2212 || trackPDG == 1000010020) + Purity_histos_1[centBin][trackPDG]->Fill(track.p()); + + selectedtracks_1[track.singleCollSelId()].push_back(std::make_shared(track)); // filling the map: eventID <-> selected particles1 } if (IsIdentical) { continue; } else if (track.sign() != _sign_2 && !TOFselection(track, std::make_pair(_particlePDGtoReject, _rejectWithinNsigmaTOF)) && (track.p() < _PIDtrshld_2 ? o2::aod::singletrackselector::TPCselection(track, TPCcuts_2) : o2::aod::singletrackselector::TOFselection(track, TOFcuts_2, _tpcNSigmaResidual_2))) { // filling the map: eventID <-> selected particles2 if (see condition above ^) + trackOrigin = track.origin(); - switch (trackOrigin) { - case 0: - registry.fill(HIST("SecondParticle/dcaxyz_vs_pt_primary"), track.pt(), track.dcaXY(), track.dcaZ()); - break; - case 1: - registry.fill(HIST("SecondParticle/dcaxyz_vs_pt_weakdecay"), track.pt(), track.dcaXY(), track.dcaZ()); - break; - case 2: - registry.fill(HIST("SecondParticle/dcaxyz_vs_pt_material"), track.pt(), track.dcaXY(), track.dcaZ()); - break; - } + + if (trackOrigin > -1 && trackOrigin < 3) + DCA_histos_2[centBin][track.origin()]->Fill(track.pt(), track.dcaXY(), track.dcaZ()); + if (abs(track.dcaXY()) > _dcaXY || abs(track.dcaZ()) > _dcaZ) continue; - selectedtracks_2[track.singleCollSelId()].push_back(std::make_shared(track)); // filling the map: eventID <-> selected particles2 - trackPDG = abs(track.pdgCode()); - registry.fill(HIST("SecondParticle/pSpectraAll"), track.p_MC()); - - switch (trackPDG) { - case 11: - registry.fill(HIST("SecondParticle/pSpectraEl"), track.p_MC()); - break; - case 13: - registry.fill(HIST("SecondParticle/pSpectraMu"), track.p_MC()); - break; - case 211: - registry.fill(HIST("SecondParticle/pSpectraPi"), track.p_MC()); - break; - case 321: - registry.fill(HIST("SecondParticle/pSpectraKa"), track.p_MC()); - break; - case 2212: - registry.fill(HIST("SecondParticle/pSpectraPr"), track.p_MC()); - break; - case 1000010020: - registry.fill(HIST("SecondParticle/pSpectraDe"), track.p_MC()); - break; - } + Purity_histos_2[centBin][0]->Fill(track.p()); + if (trackPDG == 11 || trackPDG == 13 || trackPDG == 211 || trackPDG == 321 || trackPDG == 2212 || trackPDG == 1000010020) + Purity_histos_2[centBin][trackPDG]->Fill(track.p()); + + selectedtracks_2[track.singleCollSelId()].push_back(std::make_shared(track)); // filling the map: eventID <-> selected particles2 } } for (auto collision : collisions) { + if (collision.multPerc() < *_centBins.value.begin() || collision.multPerc() >= *(_centBins.value.end() - 1)) + continue; + 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)); + float centBinToMix = o2::aod::singletrackselector::getBinIndex(collision.multPerc(), _centBins, _multNsubBins); - mixbins[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + mixbins[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); } //====================================== filling deta(dphi*) & res. matrix starts here ====================================== @@ -324,21 +352,23 @@ struct FemtoCorrelationsMC { 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 + for (unsigned 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 + unsigned int centBin = std::floor((i->first).second); - for (int indx2 = indx1 + 1; indx2 < (i->second).size(); indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + fillEtaPhi(selectedtracks_1[col1->index()], centBin); // filling deta(dphi*) -- SE identical + + for (unsigned 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_1[col2->index()]); // filling res. matrix -- ME identical + fillResMatrix(selectedtracks_1[col1->index()], selectedtracks_1[col2->index()], centBin); // filling res. matrix -- ME identical } } } @@ -347,21 +377,23 @@ struct FemtoCorrelationsMC { 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 + for (unsigned 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 + unsigned int centBin = std::floor((i->first).second); + + fillEtaPhi(selectedtracks_1[col1->index()], selectedtracks_2[col1->index()], centBin); // filling deta(dphi*) -- SE 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 + for (unsigned 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 + fillResMatrix(selectedtracks_1[col1->index()], selectedtracks_2[col2->index()], centBin); // filling res. matrix -- ME non-identical } } } diff --git a/PWGCF/Femto3D/Tasks/femto3dQA.cxx b/PWGCF/Femto3D/Tasks/femto3dQA.cxx index cb4a6f5680a..e695c8d5a5a 100755 --- a/PWGCF/Femto3D/Tasks/femto3dQA.cxx +++ b/PWGCF/Femto3D/Tasks/femto3dQA.cxx @@ -40,6 +40,10 @@ struct QAHistograms { /// Construct a registry object with direct declaration HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + Configurable _removeSameBunchPileup{"removeSameBunchPileup", false, ""}; + Configurable _requestGoodZvtxFT0vsPV{"requestGoodZvtxFT0vsPV", false, ""}; + Configurable _requestVertexITSTPC{"requestVertexITSTPC", false, ""}; + Configurable _sign{"sign", 1, "sign of a track"}; Configurable _vertexZ{"VertexZ", 10.0, "abs vertexZ value limit"}; Configurable _min_P{"min_P", 0.0, "lower mometum limit"}; @@ -62,6 +66,8 @@ struct QAHistograms { Configurable _particlePDGtoReject{"particlePDGtoReject", 211, "PDG codes of perticles that will be rejected with TOF (only pion, kaon, proton and deurton are supported now)"}; Configurable> _rejectWithinNsigmaTOF{"rejectWithinNsigmaTOF", std::vector{-0.0f, 0.0f}, "TOF rejection Nsigma range for particles specified with PDG to be rejected"}; + Configurable> _centCut{"centCut", std::pair{0.f, 100.f}, "[min., max.] centrality range to keep tracks within"}; + std::pair> TPCcuts; std::pair> TOFcuts; @@ -132,20 +138,39 @@ struct QAHistograms { } registry.add("posZ", "posZ", kTH1F, {{300, -16., 16., "posZ"}}); - registry.add("mult", "mult", kTH1F, {{500, 0., 500., "mult"}}); + registry.add("mult", "mult", kTH1F, {{5001, -0.5, 5000.5, "mult."}}); } template void fillHistograms(ColsType const& collisions, TracksType const& tracks) { for (auto& collision : collisions) { + if (_removeSameBunchPileup && !collision.isNoSameBunchPileup()) + continue; + if (_requestGoodZvtxFT0vsPV && !collision.isGoodZvtxFT0vsPV()) + continue; + if (_requestVertexITSTPC && !collision.isVertexITSTPC()) + continue; + if (collision.multPerc() < _centCut.value.first || collision.multPerc() >= _centCut.value.second) + continue; + registry.fill(HIST("posZ"), collision.posZ()); registry.fill(HIST("mult"), collision.mult()); } for (auto& track : tracks) { + + if (_removeSameBunchPileup && !track.template singleCollSel_as().isNoSameBunchPileup()) + continue; + if (_requestGoodZvtxFT0vsPV && !track.template singleCollSel_as().isGoodZvtxFT0vsPV()) + continue; + if (_requestVertexITSTPC && !track.template singleCollSel_as().isVertexITSTPC()) + continue; + if (abs(track.template singleCollSel_as().posZ()) > _vertexZ) continue; + if (track.template singleCollSel_as().multPerc() < _centCut.value.first || track.template singleCollSel_as().multPerc() >= _centCut.value.second) + continue; if ((track.tpcFractionSharedCls()) > _tpcFractionSharedCls || (track.itsNCls()) < _itsNCls) continue; @@ -203,13 +228,13 @@ struct QAHistograms { } } - void processDefault(soa::Filtered const& collisions, soa::Filtered const& tracks) + void processDefault(soa::Filtered> const& collisions, soa::Filtered const& tracks) { fillHistograms(collisions, tracks); } PROCESS_SWITCH(QAHistograms, processDefault, "process default", true); - void processExtra(soa::Filtered const& collisions, soa::Filtered> const& tracks) + void processExtra(soa::Filtered> const& collisions, soa::Filtered> const& tracks) { fillHistograms(collisions, tracks); } diff --git a/PWGCF/FemtoDream/Core/femtoDreamContainerThreeBody.h b/PWGCF/FemtoDream/Core/femtoDreamContainerThreeBody.h index a188817c8a3..c4d1ebe5e66 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamContainerThreeBody.h +++ b/PWGCF/FemtoDream/Core/femtoDreamContainerThreeBody.h @@ -84,8 +84,8 @@ class FemtoDreamContainerThreeBody template void init_MC(std::string folderName, std::string femtoObs, T femtoObsAxis, T multAxis) { - mHistogramRegistry->add((folderName + "/relPairDist_ReconNoFake").c_str(), ("; " + femtoObs + "; Entries").c_str(), kTH1F, {femtoObsAxis}); - mHistogramRegistry->add((folderName + "/relPairQ3Mult_ReconNoFake").c_str(), ("; " + femtoObs + "; Multiplicity").c_str(), kTH2F, {femtoObsAxis, multAxis}); + mHistogramRegistry->add((folderName + "/relTripletDist_ReconNoFake").c_str(), ("; " + femtoObs + "; Entries").c_str(), kTH1F, {femtoObsAxis}); + mHistogramRegistry->add((folderName + "/relTripletQ3Mult_ReconNoFake").c_str(), ("; " + femtoObs + "; Multiplicity").c_str(), kTH2F, {femtoObsAxis, multAxis}); mHistogramRegistry->add((folderName + "/hNoMCtruthTripletCounter").c_str(), "; Counter; Entries", kTH1I, {{1, 0, 1}}); mHistogramRegistry->add((folderName + "/hFakeTripletCounter").c_str(), "; Counter; Entries", kTH1I, {{1, 0, 1}}); mHistogramRegistry->add((folderName + "/Q3_resolution").c_str(), "; #it{Q}_{3} reconstructed (GeV/#it{c}); #it{Q}_{3} truth (GeV/#it{c})", kTH2F, {femtoObsAxis, femtoObsAxis}); @@ -162,9 +162,9 @@ class FemtoDreamContainerThreeBody { if (mHistogramRegistry) { // Fill the Q3 distributions with the reconstructed information but only for particles with the right PDG code - mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/relPairDist_ReconNoFake"), femtoObs); - mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/relPairkstarMult_ReconNoFake"), femtoObs, mult); - mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/kstar_resolution"), femtoObsMC, femtoObs); + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/relTripletDist_ReconNoFake"), femtoObs); + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/relTripletQ3Mult_ReconNoFake"), femtoObs, mult); + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/Q3_resolution"), femtoObsMC, femtoObs); } } diff --git a/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h b/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h index c65fbbb221a..d9ad6d3e0c0 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h +++ b/PWGCF/FemtoDream/Core/femtoDreamDetaDphiStar.h @@ -41,11 +41,13 @@ class FemtoDreamDetaDphiStar /// Destructor virtual ~FemtoDreamDetaDphiStar() = default; /// Initialization of the histograms and setting required values - void init(HistogramRegistry* registry, HistogramRegistry* registryQA, float ldeltaPhiMax, float ldeltaEtaMax, bool lplotForEveryRadii, int meORse = 0, bool oldversion = true) + void init(HistogramRegistry* registry, HistogramRegistry* registryQA, float ldeltaPhiMax, float ldeltaEtaMax, bool lplotForEveryRadii, int meORse = 0, bool oldversion = true, float Q3Limit = 8., bool isMELambda = false) { deltaPhiMax = ldeltaPhiMax; deltaEtaMax = ldeltaEtaMax; plotForEveryRadii = lplotForEveryRadii; + upperQ3LimitForPlotting = Q3Limit; + isMixedEventLambda = isMELambda; runOldVersion = oldversion; mHistogramRegistry = registry; mHistogramRegistryQA = registryQA; @@ -75,7 +77,7 @@ class FemtoDreamDetaDphiStar } /// Check if pair is close or not template - bool isClosePair(Part const& part1, Part const& part2, Parts const& particles, float lmagfield) + bool isClosePair(Part const& part1, Part const& part2, Parts const& particles, float lmagfield, float Q3 = 999.) { magfield = lmagfield; @@ -87,12 +89,25 @@ class FemtoDreamDetaDphiStar return false; } auto deta = part1.eta() - part2.eta(); - auto dphiAvg = AveragePhiStar(part1, part2, 0); - histdetadpi[0][0]->Fill(deta, dphiAvg); - if (pow(dphiAvg, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { - return true; + bool sameCharge = false; + auto dphiAvg = AveragePhiStar(part1, part2, 0, &sameCharge); + if (Q3 == 999) { + histdetadpi[0][0]->Fill(deta, dphiAvg); + } else if (Q3 < upperQ3LimitForPlotting) { + histdetadpi[0][0]->Fill(deta, dphiAvg); + } + if (sameCharge) { + if (pow(dphiAvg, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + return true; + } else { + if (Q3 == 999) { + histdetadpi[0][1]->Fill(deta, dphiAvg); + } else if (Q3 < upperQ3LimitForPlotting) { + histdetadpi[0][1]->Fill(deta, dphiAvg); + } + return false; + } } else { - histdetadpi[0][1]->Fill(deta, dphiAvg); return false; } @@ -106,15 +121,31 @@ class FemtoDreamDetaDphiStar bool pass = false; for (int i = 0; i < 2; i++) { - auto indexOfDaughter = part2.index() - 2 + i; + int indexOfDaughter; + if (isMixedEventLambda) { + indexOfDaughter = part2.globalIndex() - 2 + i; + } else { + indexOfDaughter = part2.index() - 2 + i; + } auto daughter = particles.begin() + indexOfDaughter; auto deta = part1.eta() - daughter.eta(); - auto dphiAvg = AveragePhiStar(part1, *daughter, i); - histdetadpi[i][0]->Fill(deta, dphiAvg); - if (pow(dphiAvg, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { - pass = true; - } else { - histdetadpi[i][1]->Fill(deta, dphiAvg); + bool sameCharge = false; + auto dphiAvg = AveragePhiStar(part1, *daughter, i, &sameCharge); + if (Q3 == 999) { + histdetadpi[i][0]->Fill(deta, dphiAvg); + } else if (Q3 < upperQ3LimitForPlotting) { + histdetadpi[i][0]->Fill(deta, dphiAvg); + } + if (sameCharge) { + if (pow(dphiAvg, 2) / pow(deltaPhiMax, 2) + pow(deta, 2) / pow(deltaEtaMax, 2) < 1.) { + pass = true; + } else { + if (Q3 == 999) { + histdetadpi[i][1]->Fill(deta, dphiAvg); + } else if (Q3 < upperQ3LimitForPlotting) { + histdetadpi[i][1]->Fill(deta, dphiAvg); + } + } } } return pass; @@ -153,6 +184,8 @@ class FemtoDreamDetaDphiStar float deltaEtaMax; float magfield; bool plotForEveryRadii = false; + bool isMixedEventLambda = false; + float upperQ3LimitForPlotting = 8.; // a possible bug was found, but this must be tested on hyperloop with larger statistics // possiboility to run old code is turned on so a proper comparison of both code versions can be done bool runOldVersion = true; @@ -163,12 +196,12 @@ class FemtoDreamDetaDphiStar /// Calculate phi at all required radii stored in tmpRadiiTPC /// Magnetic field to be provided in Tesla template - void PhiAtRadiiTPC(const T& part, std::vector& tmpVec) + int PhiAtRadiiTPC(const T& part, std::vector& tmpVec) { float phi0 = part.phi(); // Start: Get the charge from cutcontainer using masks - float charge = 0.; + int charge = 0.; if ((part.cut() & kSignMinusMask) == kValue0 && (part.cut() & kSignPlusMask) == kValue0) { charge = 0; } else if ((part.cut() & kSignPlusMask) == kSignPlusMask) { @@ -194,16 +227,20 @@ class FemtoDreamDetaDphiStar } } } + return charge; } /// Calculate average phi template - float AveragePhiStar(const T1& part1, const T2& part2, int iHist) + float AveragePhiStar(const T1& part1, const T2& part2, int iHist, bool* sameCharge) { std::vector tmpVec1; std::vector tmpVec2; - PhiAtRadiiTPC(part1, tmpVec1); - PhiAtRadiiTPC(part2, tmpVec2); + auto charge1 = PhiAtRadiiTPC(part1, tmpVec1); + auto charge2 = PhiAtRadiiTPC(part2, tmpVec2); + if (charge1 == charge2) { + *sameCharge = true; + } int num = tmpVec1.size(); int meaningfulEntries = num; float dPhiAvg = 0; diff --git a/PWGCF/FemtoDream/Core/femtoDreamEventHisto.h b/PWGCF/FemtoDream/Core/femtoDreamEventHisto.h index 108c6c1db4e..2b5aac77d31 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamEventHisto.h +++ b/PWGCF/FemtoDream/Core/femtoDreamEventHisto.h @@ -31,7 +31,7 @@ class FemtoDreamEventHisto virtual ~FemtoDreamEventHisto() = default; /// Initializes histograms for the task /// \param registry Histogram registry to be passed - void init(HistogramRegistry* registry) + void init(HistogramRegistry* registry, bool isMC) { mHistogramRegistry = registry; mHistogramRegistry->add("Event/hZvtx", "; vtx_{z} (cm); Entries", kTH1F, {{300, -12.5, 12.5}}); @@ -40,12 +40,16 @@ class FemtoDreamEventHisto mHistogramRegistry->add("Event/hMultNTrVsZvtx", "; Multiplicity (MultNtr); vtx_{z} (cm)", kTH2F, {{200, 0, 200}, {300, -12.5, 12.5}}); mHistogramRegistry->add("Event/hMultNTrVsMultPercentile", "; Multiplicity (MultNtr); Multiplicity Percentile (FT0M)", kTH2F, {{200, 0, 200}, {110, 0, 110}}); mHistogramRegistry->add("Event/hMultPercentileVsZvtx", "; Multiplicity Percentile (FT0M); vtx_{z} (cm)", kTH2F, {{110, 0, 110}, {300, -12.5, 12.5}}); + + if (isMC) { + mHistogramRegistry->add("Event_MC/hGenMult08VsMultPercentile", "; generated MC multiplicity (#eta<0.8); Multiplicity Percentile (FT0M)", kTH2F, {{200, 0, 200}, {110, 0, 110}}); + } } /// Some basic QA of the event /// \tparam T type of the collision /// \param col Collision - template + template void fillQA(T const& col) { if (mHistogramRegistry) { @@ -55,6 +59,12 @@ class FemtoDreamEventHisto mHistogramRegistry->fill(HIST("Event/hMultNTrVsZvtx"), col.multNtr(), col.posZ()); mHistogramRegistry->fill(HIST("Event/hMultNTrVsMultPercentile"), col.multNtr(), col.multV0M()); mHistogramRegistry->fill(HIST("Event/hMultPercentileVsZvtx"), col.multV0M(), col.posZ()); + + if constexpr (isMC) { + if (col.has_fdMCCollision()) { + mHistogramRegistry->fill(HIST("Event_MC/hGenMult08VsMultPercentile"), col.fdMCCollision().multMCgenPartEta08(), col.multV0M()); + } + } } } diff --git a/PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h b/PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h index 713cbb14c73..21440f35414 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamObjectSelection.h @@ -84,14 +84,14 @@ class FemtoDreamObjectSelection case (femtoDreamSelection::SelectionType::kUpperLimit): case (femtoDreamSelection::SelectionType::kAbsUpperLimit): std::sort(sels.begin(), sels.end(), [](FemtoDreamSelection a, FemtoDreamSelection b) { - return a.getSelectionValue() > b.getSelectionValue(); + return a.getSelectionValue() >= b.getSelectionValue(); }); break; case (femtoDreamSelection::SelectionType::kLowerLimit): case (femtoDreamSelection::SelectionType::kAbsLowerLimit): case (femtoDreamSelection::SelectionType::kEqual): std::sort(sels.begin(), sels.end(), [](FemtoDreamSelection a, FemtoDreamSelection b) { - return a.getSelectionValue() < b.getSelectionValue(); + return a.getSelectionValue() <= b.getSelectionValue(); }); break; } @@ -126,14 +126,14 @@ class FemtoDreamObjectSelection switch (sel.getSelectionType()) { case (femtoDreamSelection::SelectionType::kUpperLimit): case (femtoDreamSelection::SelectionType::kAbsUpperLimit): - if (minimalSel < sel.getSelectionValue()) { + if (minimalSel <= sel.getSelectionValue()) { minimalSel = sel.getSelectionValue(); } break; case (femtoDreamSelection::SelectionType::kLowerLimit): case (femtoDreamSelection::SelectionType::kAbsLowerLimit): case (femtoDreamSelection::SelectionType::kEqual): - if (minimalSel > sel.getSelectionValue()) { + if (minimalSel >= sel.getSelectionValue()) { minimalSel = sel.getSelectionValue(); } break; diff --git a/PWGCF/FemtoDream/Core/femtoDreamSelection.h b/PWGCF/FemtoDream/Core/femtoDreamSelection.h index b9490db549f..73d29ff7d51 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamSelection.h +++ b/PWGCF/FemtoDream/Core/femtoDreamSelection.h @@ -82,14 +82,14 @@ class FemtoDreamSelection { switch (mSelType) { case (femtoDreamSelection::SelectionType::kUpperLimit): - return (observable < mSelVal); + return (observable <= mSelVal); case (femtoDreamSelection::SelectionType::kAbsUpperLimit): - return (std::abs(observable) < mSelVal); + return (std::abs(observable) <= mSelVal); break; case (femtoDreamSelection::SelectionType::kLowerLimit): - return (observable > mSelVal); + return (observable >= mSelVal); case (femtoDreamSelection::SelectionType::kAbsLowerLimit): - return (std::abs(observable) > mSelVal); + return (std::abs(observable) >= mSelVal); break; case (femtoDreamSelection::SelectionType::kEqual): /// \todo can the comparison be done a bit nicer? diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx index 39a22cea578..8bcd862a2c4 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx @@ -45,10 +45,11 @@ using namespace o2::analysis::femtoDream; namespace o2::aod { -using FemtoFullCollision = - soa::Join::iterator; +using FemtoFullCollision = soa::Join::iterator; using FemtoFullCollisionMC = soa::Join::iterator; using FemtoFullCollision_noCent_MC = soa::Join::iterator; +using FemtoFullMCgenCollisions = soa::Join; +using FemtoFullMCgenCollision = FemtoFullMCgenCollisions::iterator; using FemtoFullTracks = soa::Join outputCollision; + Produces outputMCCollision; + Produces outputCollsMCLabels; Produces outputParts; Produces outputPartsMC; Produces outputDebugParts; @@ -355,6 +358,17 @@ struct femtoDreamProducerTask { } } + template + void fillMCCollision(CollisionType const& col) + { + if (col.has_mcCollision()) { + auto genMCcol = col.template mcCollision_as(); + outputMCCollision(genMCcol.multMCNParticlesEta08()); + outputCollsMCLabels(outputMCCollision.lastIndex()); + } else { + outputCollsMCLabels(-1); + } + } template void fillCollisionsAndTracksAndV0(CollisionType const& col, TrackType const& tracks, V0Type const& fullV0s) { @@ -392,6 +406,9 @@ struct femtoDreamProducerTask { } outputCollision(vtxZ, mult, multNtr, spher, mMagField); + if constexpr (isMC) { + fillMCCollision(col); + } std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children std::vector tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index @@ -530,7 +547,7 @@ struct femtoDreamProducerTask { void processMC(aod::FemtoFullCollisionMC const& col, aod::BCsWithTimestamps const&, soa::Join const& tracks, - aod::McCollisions const&, + aod::FemtoFullMCgenCollisions const&, aod::McParticles const&, soa::Join const& fullV0s) /// \todo with FilteredFullV0s { @@ -544,7 +561,7 @@ struct femtoDreamProducerTask { void processMC_noCentrality(aod::FemtoFullCollision_noCent_MC const& col, aod::BCsWithTimestamps const&, soa::Join const& tracks, - aod::McCollisions const&, + aod::FemtoFullMCgenCollisions const&, aod::McParticles const&, soa::Join const& fullV0s) /// \todo with FilteredFullV0s { diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamCollisionMasker.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamCollisionMasker.cxx index c57a56818c5..62f2f4c3967 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamCollisionMasker.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamCollisionMasker.cxx @@ -254,6 +254,10 @@ struct femoDreamCollisionMasker { FilterPtMax.at(CollisionMasks::kPartOne).push_back(option.defaultValue.get()); } else if (option.name.compare(std::string("ConfMinpT")) == 0) { FilterPtMin.at(CollisionMasks::kPartOne).push_back(option.defaultValue.get()); + } else if (option.name.compare(std::string("ConfMaxDCAxy")) == 0) { + FilterTempFitVarMax.at(CollisionMasks::kPartOne).push_back(option.defaultValue.get()); + } else if (option.name.compare(std::string("ConfMinDCAxy")) == 0) { + FilterTempFitVarMin.at(CollisionMasks::kPartOne).push_back(option.defaultValue.get()); } } } else if (device.name.find("femto-dream-triplet-task-track-track-v0") != std::string::npos) { @@ -272,6 +276,10 @@ struct femoDreamCollisionMasker { FilterPtMax.at(CollisionMasks::kPartOne).push_back(option.defaultValue.get()); } else if (option.name.compare(std::string("ConfMinpT")) == 0) { FilterPtMin.at(CollisionMasks::kPartOne).push_back(option.defaultValue.get()); + } else if (option.name.compare(std::string("ConfMaxDCAxy")) == 0) { + FilterTempFitVarMax.at(CollisionMasks::kPartOne).push_back(option.defaultValue.get()); + } else if (option.name.compare(std::string("ConfMinDCAxy")) == 0) { + FilterTempFitVarMin.at(CollisionMasks::kPartOne).push_back(option.defaultValue.get()); } else if (option.name.compare(std::string("ConfCutV0")) == 0) { V0CutBits.at(CollisionMasks::kPartThree).push_back(option.defaultValue.get()); } else if (option.name.compare(std::string("Conf_ChildPos_CutV0")) == 0) { @@ -362,7 +370,8 @@ struct femoDreamCollisionMasker { continue; } // check filter cuts - if (track.pt() < FilterPtMin.at(P).at(index) || track.pt() > FilterPtMax.at(P).at(index)) { + if (track.pt() < FilterPtMin.at(P).at(index) || track.pt() > FilterPtMax.at(P).at(index) || + track.tempFitVar() > FilterTempFitVarMax.at(P).at(index) || track.tempFitVar() < FilterTempFitVarMin.at(P).at(index)) { // if they are not passed, skip the particle continue; } diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx index efff8c552c8..27f6792b584 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamDebugTrack.cxx @@ -62,6 +62,9 @@ struct femtoDreamDebugTrack { Configurable ConfTempFitVarMomentum{"ConfTempFitVarMomentum", 0, "Momentum used for binning: 0 -> pt; 1 -> preco; 2 -> ptpc"}; ConfigurableAxis ConfDummy{"ConfDummy", {1, 0, 1}, "Dummy axis for inv mass"}; + using FemtoMCCollisions = Join; + using FemtoMCCollision = FemtoMCCollisions::iterator; + using FemtoFullParticles = soa::Join; Partition partsOne = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && @@ -90,15 +93,15 @@ struct femtoDreamDebugTrack { void init(InitContext&) { - eventHisto.init(&qaRegistry); + eventHisto.init(&qaRegistry, ConfIsMC); trackHisto.init(&qaRegistry, ConfBinmult, ConfBinmultPercentile, ConfBinpT, ConfBineta, ConfBinphi, ConfTempFitVarBins, ConfNsigmaTPCBins, ConfNsigmaTOFBins, ConfNsigmaTPCTOFBins, ConfTPCclustersBins, ConfDummy, ConfIsMC, ConfTrk1_PDGCode.value, true, ConfOptCorrelatedPlots); } /// Porduce QA plots for sigle track selection in FemtoDream framework - template - void FillDebugHistos(o2::aod::FDCollision& col, PartitionType& groupPartsOne) + template + void FillDebugHistos(CollisionType& col, PartitionType& groupPartsOne) { - eventHisto.fillQA(col); + eventHisto.fillQA(col); for (auto& part : groupPartsOne) { trackHisto.fillQA(part, static_cast(ConfTempFitVarMomentum.value), col.multNtr(), col.multV0M(), ConfOptCorrelatedPlots); } @@ -119,7 +122,7 @@ struct femtoDreamDebugTrack { /// \param col subscribe to FemtoDreamCollision table /// \param parts subscribe to the joined table of FemtoDreamParticles and FemtoDreamMCLabels table /// \param FemtoDramMCParticles subscribe to the table containing the Monte Carlo Truth information - void processMC(o2::aod::FDCollision& col, FemtoFullParticlesMC&, aod::FDMCParticles&, aod::FDExtMCParticles&) + void processMC(FemtoMCCollision& col, o2::aod::FDMCCollisions&, FemtoFullParticlesMC& parts, aod::FDMCParticles&, aod::FDExtMCParticles&) { auto groupPartsOne = partsOneMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); FillDebugHistos(col, groupPartsOne); diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamDebugV0.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamDebugV0.cxx index df0c5c190c9..9f422751008 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamDebugV0.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamDebugV0.cxx @@ -79,7 +79,7 @@ struct femtoDreamDebugV0 { void init(InitContext&) { - eventHisto.init(&EventRegistry); + eventHisto.init(&EventRegistry, false); posChildHistos.init(&V0Registry, ConfBinmult, ConfDummy, ConfV0ChildTempFitVarMomentumBins, ConfDummy, ConfDummy, ConfChildTempFitVarBins, ConfV0ChildNsigmaTPCBins, ConfV0ChildNsigmaTOFBins, ConfV0ChildNsigmaTPCTOFBins, ConfDummy, ConfV0InvMassBins, false, ConfV01_ChildPos_PDGCode.value, true); negChildHistos.init(&V0Registry, ConfBinmult, ConfDummy, ConfV0ChildTempFitVarMomentumBins, ConfDummy, ConfDummy, ConfChildTempFitVarBins, ConfV0ChildNsigmaTPCBins, ConfV0ChildNsigmaTOFBins, ConfV0ChildNsigmaTPCTOFBins, ConfDummy, ConfV0InvMassBins, false, ConfV01_ChildNeg_PDGCode, true); V0Histos.init(&V0Registry, ConfBinmult, ConfDummy, ConfV0TempFitVarMomentumBins, ConfDummy, ConfDummy, ConfV0TempFitVarBins, ConfV0ChildNsigmaTPCBins, ConfV0ChildNsigmaTOFBins, ConfV0ChildNsigmaTPCTOFBins, ConfDummy, ConfV0InvMassBins, false, ConfV01_PDGCode.value, true); @@ -89,7 +89,7 @@ struct femtoDreamDebugV0 { void process(o2::aod::FDCollision const& col, FemtoFullParticles const& parts) { auto groupPartsOne = partsOne->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); - eventHisto.fillQA(col); + eventHisto.fillQA(col); for (auto& part : groupPartsOne) { if (!part.has_children()) { continue; diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx index 894bdda6d80..e2b7c4e6069 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackTrack.cxx @@ -79,8 +79,14 @@ struct femtoDreamPairTaskTrackTrack { using FilteredCollisions = soa::Filtered; using FilteredCollision = FilteredCollisions::iterator; + using FilteredMCCollisions = soa::Filtered>; + using FilteredMCCollision = FilteredMCCollisions::iterator; + using FilteredMaskedCollisions = soa::Filtered>; using FilteredMaskedCollision = FilteredMaskedCollisions::iterator; + using FilteredMaskedMCCollisions = soa::Filtered>; + using FilteredMaskedMCCollision = FilteredMaskedMCCollisions::iterator; + femtodreamcollision::BitMaskType BitMask = -1; /// Track 1 @@ -216,7 +222,7 @@ struct femtoDreamPairTaskTrackTrack { if (Option.RandomizePair.value) { random = new TRandom3(0); } - eventHisto.init(&qaRegistry); + eventHisto.init(&qaRegistry, Option.IsMC); trackHistoPartOne.init(&qaRegistry, Binning.multTempFit, Option.Dummy, Binning.TrackpT, Option.Dummy, Option.Dummy, Binning.TempFitVar, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Option.IsMC, Track1.PDGCode); if (!Option.SameSpecies) { trackHistoPartTwo.init(&qaRegistry, Binning.multTempFit, Option.Dummy, Binning.TrackpT, Option.Dummy, Option.Dummy, Binning.TempFitVar, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Option.Dummy, Option.IsMC, Track2.PDGCode); @@ -286,10 +292,10 @@ struct femtoDreamPairTaskTrackTrack { } }; - template + template void fillCollision(CollisionType col) { - eventHisto.fillQA(col); + eventHisto.fillQA(col); } /// This function processes the same event and takes care of all the histogramming @@ -358,7 +364,7 @@ struct femtoDreamPairTaskTrackTrack { /// \param parts subscribe to the femtoDreamParticleTable void processSameEvent(FilteredCollision& col, o2::aod::FDParticles& parts) { - fillCollision(col); + fillCollision(col); auto SliceTrk1 = PartitionTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto SliceTrk2 = PartitionTrk2->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); if (SliceTrk1.size() == 0 && SliceTrk2.size() == 0) { @@ -379,7 +385,7 @@ struct femtoDreamPairTaskTrackTrack { return; } } - fillCollision(col); + fillCollision(col); auto SliceTrk1 = PartitionTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto SliceTrk2 = PartitionTrk2->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); doSameEvent(SliceTrk1, SliceTrk2, parts, col); @@ -390,10 +396,12 @@ struct femtoDreamPairTaskTrackTrack { /// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed) /// \param parts subscribe to joined table FemtoDreamParticles and FemtoDreamMCLables to access Monte Carlo truth /// \param FemtoDreamMCParticles subscribe to the Monte Carlo truth table - void processSameEventMC(FilteredCollision& col, soa::Join& parts, + void processSameEventMC(FilteredMCCollision& col, + o2::aod::FDMCCollisions&, + soa::Join& parts, o2::aod::FDMCParticles&) { - fillCollision(col); + fillCollision(col); auto SliceMCTrk1 = PartitionMCTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto SliceMCTrk2 = PartitionMCTrk2->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); if (SliceMCTrk1.size() == 0 && SliceMCTrk2.size() == 0) { @@ -403,7 +411,7 @@ struct femtoDreamPairTaskTrackTrack { } PROCESS_SWITCH(femtoDreamPairTaskTrackTrack, processSameEventMC, "Enable processing same event for Monte Carlo", false); - void processSameEventMCMasked(FilteredMaskedCollision& col, soa::Join& parts, + void processSameEventMCMasked(FilteredMaskedMCCollision& col, o2::aod::FDMCCollisions&, soa::Join& parts, o2::aod::FDMCParticles&) { if (Option.SameSpecies.value) { @@ -415,7 +423,7 @@ struct femtoDreamPairTaskTrackTrack { return; } } - fillCollision(col); + fillCollision(col); auto SliceMCTrk1 = PartitionMCTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto SliceMCTrk2 = PartitionMCTrk2->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); doSameEvent(SliceMCTrk1, SliceMCTrk2, parts, col); @@ -539,7 +547,7 @@ struct femtoDreamPairTaskTrackTrack { /// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed) /// @param parts subscribe to joined table FemtoDreamParticles and FemtoDreamMCLables to access Monte Carlo truth /// @param FemtoDreamMCParticles subscribe to the Monte Carlo truth table - void processMixedEventMC(FilteredCollisions& cols, soa::Join& parts, o2::aod::FDMCParticles&) + void processMixedEventMC(FilteredMCCollisions& cols, o2::aod::FDMCCollisions&, soa::Join& parts, o2::aod::FDMCParticles&) { switch (Mixing.Policy.value) { case femtodreamcollision::kMult: @@ -557,7 +565,7 @@ struct femtoDreamPairTaskTrackTrack { } PROCESS_SWITCH(femtoDreamPairTaskTrackTrack, processMixedEventMC, "Enable processing mixed events MC", false); - void processMixedEventMCMasked(FilteredMaskedCollisions& cols, soa::Join& parts, o2::aod::FDMCParticles&) + void processMixedEventMCMasked(FilteredMaskedMCCollisions& cols, o2::aod::FDMCCollisions&, soa::Join& parts, o2::aod::FDMCParticles&) { switch (Mixing.Policy.value) { case femtodreamcollision::kMult: diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackV0.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackV0.cxx index a397e738abf..103e8a22b82 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackV0.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamPairTaskTrackV0.cxx @@ -69,10 +69,11 @@ struct femtoDreamPairTaskTrackV0 { Filter EventMultiplicity = aod::femtodreamcollision::multNtr >= EventSel.MultMin && aod::femtodreamcollision::multNtr <= EventSel.MultMax; Filter EventMultiplicityPercentile = aod::femtodreamcollision::multV0M >= EventSel.MultPercentileMin && aod::femtodreamcollision::multV0M <= EventSel.MultPercentileMax; - using FilteredCollisions = soa::Filtered; - using FilteredCollision = FilteredCollisions::iterator; using FilteredMaskedCollisions = soa::Filtered>; using FilteredMaskedCollision = FilteredMaskedCollisions::iterator; + using FilteredMaskedMCCollisions = soa::Filtered>; + using FilteredMaskedMCCollision = FilteredMaskedMCCollisions::iterator; + femtodreamcollision::BitMaskType BitMask = -1; /// Particle 1 (track) @@ -205,7 +206,7 @@ struct femtoDreamPairTaskTrackV0 { void init(InitContext& context) { - eventHisto.init(&qaRegistry); + eventHisto.init(&qaRegistry, Option.IsMC); // void init(HistogramRegistry* registry, // T& MomentumBins, T& tempFitVarBins, T& NsigmaTPCBins, T& NsigmaTOFBins, T& NsigmaTPCTOFBins, T& InvMassBins, // bool isMC, int pdgCode, bool isDebug = false) @@ -233,7 +234,7 @@ struct femtoDreamPairTaskTrackV0 { pairCleaner.init(&qaRegistry); if (Option.CPROn.value) { pairCloseRejectionSE.init(&resultRegistry, &qaRegistry, Option.CPRdeltaPhiMax.value, Option.CPRdeltaEtaMax.value, Option.CPRPlotPerRadii.value, 1, Option.CPROld.value); - pairCloseRejectionME.init(&resultRegistry, &qaRegistry, Option.CPRdeltaPhiMax.value, Option.CPRdeltaEtaMax.value, Option.CPRPlotPerRadii.value, 2, Option.CPROld.value); + pairCloseRejectionME.init(&resultRegistry, &qaRegistry, Option.CPRdeltaPhiMax.value, Option.CPRdeltaEtaMax.value, Option.CPRPlotPerRadii.value, 2, Option.CPROld.value, 8, true); } // get bit for the collision mask @@ -332,19 +333,19 @@ struct femtoDreamPairTaskTrackV0 { if ((col.bitmaskTrackOne() & BitMask) != BitMask && (col.bitmaskTrackTwo() & BitMask) != BitMask) { return; } - eventHisto.fillQA(col); + eventHisto.fillQA(col); auto SliceTrk1 = PartitionTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto SliceV02 = PartitionV02->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); doSameEvent(SliceTrk1, SliceV02, parts, col); } PROCESS_SWITCH(femtoDreamPairTaskTrackV0, processSameEventMasked, "Enable processing same event with masks", true); - void processSameEventMCMasked(FilteredMaskedCollision const& col, FilteredFDMCParts const& parts, o2::aod::FDMCParticles const&) + void processSameEventMCMasked(FilteredMaskedMCCollision const& col, o2::aod::FDMCCollisions&, FilteredFDMCParts const& parts, o2::aod::FDMCParticles const&) { if ((col.bitmaskTrackOne() & BitMask) != BitMask && (col.bitmaskTrackTwo() & BitMask) != BitMask) { return; } - eventHisto.fillQA(col); + eventHisto.fillQA(col); auto SliceMCTrk1 = PartitionMCTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto SliceMCV02 = PartitionMCV02->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); doSameEvent(SliceMCTrk1, SliceMCV02, parts, col); @@ -410,7 +411,7 @@ struct femtoDreamPairTaskTrackV0 { } PROCESS_SWITCH(femtoDreamPairTaskTrackV0, processMixedEventMasked, "Enable processing mixed events with masks", true); - void processMixedEventMCMasked(FilteredMaskedCollisions const& cols, FilteredFDMCParts const& parts, o2::aod::FDMCParticles const&) + void processMixedEventMCMasked(FilteredMaskedMCCollisions const& cols, o2::aod::FDMCCollisions&, FilteredFDMCParts const& parts, o2::aod::FDMCParticles const&) { switch (Mixing.Policy.value) { case femtodreamcollision::kMult: diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackTrack.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackTrack.cxx index 93bf384bc26..f7a3902f73b 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackTrack.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackTrack.cxx @@ -11,9 +11,6 @@ /// \file femtoDreamTripletTaskTrackTrackTrack.cxx /// \brief Tasks that reads the track tables and creates track triplets; only three identical particles can be used -/// \author Andi Mathis, TU MĂĽnchen, andreas.mathis@ph.tum.de -/// \author Georgios Mantzaridis, TU MĂĽnchen, georgios.mantzaridis@tum.de -/// \author Anton Riedel, TU MĂĽnchen, anton.riedel@tum.de /// \author Laura Serksnyte, TU MĂĽnchen, laura.serksnyte@tum.de #include @@ -58,6 +55,8 @@ struct femtoDreamTripletTaskTrackTrackTrack { Configurable ConfTracksInMixedEvent{"ConfTracksInMixedEvent", 1, "Number of tracks of interest, contained in the mixed event sample: 1 - only events with at least one track of interest are used in mixing; ...; 3 - only events with at least three track of interest are used in mixing. Max value is 3"}; Configurable ConfMaxpT{"ConfMaxpT", 4.05f, "Maximum transverse momentum of the particles"}; Configurable ConfMinpT{"ConfMinpT", 0.3f, "Minimum transverse momentum of the particles"}; + Configurable ConfMaxDCAxy{"ConfMaxDCAxy", -0.1f, "Maximum DCAxy of the particles"}; + Configurable ConfMinDCAxy{"ConfMinDCAxy", 0.1f, "Minimum DCAxy of the particles"}; Configurable ConfPIDthrMom{"ConfPIDthrMom", 1.f, "Momentum threshold from which TPC and TOF are required for PID"}; Configurable ConfTPCPIDBit{"ConfTPCPIDBit", 16, "PID TPC bit from cutCulator "}; Configurable ConfTPCTOFPIDBit{"ConfTPCTOFPIDBit", 8, "PID TPCTOF bit from cutCulator"}; @@ -73,12 +72,16 @@ struct femtoDreamTripletTaskTrackTrackTrack { ifnode(aod::femtodreamparticle::pt * (nexp(aod::femtodreamparticle::eta) + nexp(-1.f * aod::femtodreamparticle::eta)) / 2.f <= ConfPIDthrMom, ncheckbit(aod::femtodreamparticle::pidcut, ConfTPCPIDBit), ncheckbit(aod::femtodreamparticle::pidcut, ConfTPCTOFPIDBit)) && (ncheckbit(aod::femtodreamparticle::cut, ConfCutPart)) && (aod::femtodreamparticle::pt < ConfMaxpT) && - (aod::femtodreamparticle::pt > ConfMinpT); + (aod::femtodreamparticle::pt > ConfMinpT) && + (aod::femtodreamparticle::tempFitVar < ConfMaxDCAxy) && + (aod::femtodreamparticle::tempFitVar > ConfMinDCAxy); Partition> SelectedPartsMC = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ifnode(aod::femtodreamparticle::pt * (nexp(aod::femtodreamparticle::eta) + nexp(-1.f * aod::femtodreamparticle::eta)) / 2.f <= ConfPIDthrMom, ncheckbit(aod::femtodreamparticle::pidcut, ConfTPCPIDBit), ncheckbit(aod::femtodreamparticle::pidcut, ConfTPCTOFPIDBit)) && (ncheckbit(aod::femtodreamparticle::cut, ConfCutPart)) && (aod::femtodreamparticle::pt < ConfMaxpT) && - (aod::femtodreamparticle::pt > ConfMinpT); + (aod::femtodreamparticle::pt > ConfMinpT) && + (aod::femtodreamparticle::tempFitVar < ConfMaxDCAxy) && + (aod::femtodreamparticle::tempFitVar > ConfMinDCAxy); /// Histogramming of Selected Particles FemtoDreamParticleHisto trackHistoSelectedParts; @@ -105,6 +108,7 @@ struct femtoDreamTripletTaskTrackTrackTrack { Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; Configurable ConfCPRdeltaPhiMax{"ConfCPRdeltaPhiMax", 0.01, "Max. Delta Phi for Close Pair Rejection"}; Configurable ConfCPRdeltaEtaMax{"ConfCPRdeltaEtaMax", 0.01, "Max. Delta Eta for Close Pair Rejection"}; + Configurable ConfMaxQ3IncludedInCPRPlots{"ConfMaxQ3IncludedInCPRPlots", 8., "Maximum Q3, for which the pair CPR is included in plots"}; ConfigurableAxis ConfDummy{"ConfDummy", {1, 0, 1}, "Dummy axis"}; FemtoDreamContainerThreeBody sameEventCont; @@ -120,7 +124,7 @@ struct femtoDreamTripletTaskTrackTrackTrack { void init(InitContext& context) { - eventHisto.init(&qaRegistry); + eventHisto.init(&qaRegistry, false); trackHistoSelectedParts.init(&qaRegistry, ConfBinmultTempFit, ConfDummy, ConfTempFitVarpTBins, ConfDummy, ConfDummy, ConfTempFitVarBins, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfIsMC, ConfPDGCodePart); trackHistoALLSelectedParts.init(&qaRegistry, ConfBinmultTempFit, ConfDummy, ConfTempFitVarpTBins, ConfDummy, ConfDummy, ConfTempFitVarBins, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfIsMC, ConfPDGCodePart); @@ -138,8 +142,8 @@ struct femtoDreamTripletTaskTrackTrackTrack { mixedEventCont.setPDGCodes(ConfPDGCodePart, ConfPDGCodePart, ConfPDGCodePart); pairCleaner.init(&qaRegistry); // SERKSNYTE : later check if init should be updated to have 3 separate histos if (ConfIsCPR.value) { - pairCloseRejectionSE.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 1, ConfUseOLD_possiblyWrong_CPR); - pairCloseRejectionME.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 2, ConfUseOLD_possiblyWrong_CPR); + pairCloseRejectionSE.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 1, ConfUseOLD_possiblyWrong_CPR, ConfMaxQ3IncludedInCPRPlots); + pairCloseRejectionME.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 2, ConfUseOLD_possiblyWrong_CPR, ConfMaxQ3IncludedInCPRPlots); } // get masses @@ -158,7 +162,9 @@ struct femtoDreamTripletTaskTrackTrackTrack { containsNameValuePair(device.options, "ConfTPCTOFPIDBit", ConfTPCTOFPIDBit.value) && containsNameValuePair(device.options, "ConfPIDthrMom", ConfPIDthrMom.value) && containsNameValuePair(device.options, "ConfMaxpT", ConfMaxpT.value) && - containsNameValuePair(device.options, "ConfMinpT", ConfMinpT.value)) { + containsNameValuePair(device.options, "ConfMinpT", ConfMinpT.value) && + containsNameValuePair(device.options, "ConfMaxDCAxy", ConfMaxDCAxy.value) && + containsNameValuePair(device.options, "ConfMinDCAxy", ConfMinDCAxy.value)) { mask.set(index); MaskBit = static_cast(mask.to_ulong()); LOG(info) << "Device name matched: " << device.name; @@ -178,11 +184,11 @@ struct femtoDreamTripletTaskTrackTrackTrack { } } - template + template void fillCollision(CollisionType col) { ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multNtr()})); - eventHisto.fillQA(col); + eventHisto.fillQA(col); } /// This function processes the same event and takes care of all the histogramming @@ -203,14 +209,16 @@ struct femtoDreamTripletTaskTrackTrackTrack { /// Now build the combinations for (auto& [p1, p2, p3] : combinations(CombinationsStrictlyUpperIndexPolicy(groupSelectedParts, groupSelectedParts, groupSelectedParts))) { + auto Q3 = FemtoDreamMath::getQ3(p1, mMassOne, p2, mMassTwo, p3, mMassThree); + if (ConfIsCPR.value) { - if (pairCloseRejectionSE.isClosePair(p1, p2, parts, magFieldTesla)) { + if (pairCloseRejectionSE.isClosePair(p1, p2, parts, magFieldTesla, Q3)) { continue; } - if (pairCloseRejectionSE.isClosePair(p2, p3, parts, magFieldTesla)) { + if (pairCloseRejectionSE.isClosePair(p2, p3, parts, magFieldTesla, Q3)) { continue; } - if (pairCloseRejectionSE.isClosePair(p1, p3, parts, magFieldTesla)) { + if (pairCloseRejectionSE.isClosePair(p1, p3, parts, magFieldTesla, Q3)) { continue; } } @@ -226,7 +234,6 @@ struct femtoDreamTripletTaskTrackTrackTrack { continue; } // fill pT of all three particles as a function of Q3 for lambda calculations - auto Q3 = FemtoDreamMath::getQ3(p1, mMassOne, p2, mMassTwo, p3, mMassThree); ThreeBodyQARegistry.fill(HIST("TripletTaskQA/particle_pT_in_Triplet_SE"), p1.pt(), p2.pt(), p3.pt(), Q3); sameEventCont.setTriplet(p1, p2, p3, multCol, Q3); } @@ -238,7 +245,7 @@ struct femtoDreamTripletTaskTrackTrackTrack { void processSameEvent(o2::aod::FDCollision& col, o2::aod::FDParticles& parts) { - fillCollision(col); + fillCollision(col); auto thegroupSelectedParts = SelectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); for (auto& part : thegroupSelectedParts) { trackHistoALLSelectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); @@ -256,7 +263,7 @@ struct femtoDreamTripletTaskTrackTrackTrack { /// \param parts subscribe to the femtoDreamParticleTable void processSameEventMasked(MaskedCollision& col, o2::aod::FDParticles& parts) { - fillCollision(col); + fillCollision(col); auto thegroupSelectedParts = SelectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); for (auto& part : thegroupSelectedParts) { trackHistoALLSelectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); @@ -276,7 +283,7 @@ struct femtoDreamTripletTaskTrackTrackTrack { soa::Join& parts, o2::aod::FDMCParticles&) { - fillCollision(col); + fillCollision(col); auto thegroupSelectedParts = SelectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); for (auto& part : thegroupSelectedParts) { trackHistoALLSelectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); @@ -296,7 +303,7 @@ struct femtoDreamTripletTaskTrackTrackTrack { soa::Join& parts, o2::aod::FDMCParticles&) { - fillCollision(col); + fillCollision(col); auto thegroupSelectedParts = SelectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); for (auto& part : thegroupSelectedParts) { trackHistoALLSelectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); @@ -322,20 +329,20 @@ struct femtoDreamTripletTaskTrackTrackTrack { void doMixedEvent(PartitionType groupPartsOne, PartitionType groupPartsTwo, PartitionType groupPartsThree, PartType parts, float magFieldTesla, int multCol) { for (auto& [p1, p2, p3] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo, groupPartsThree))) { + auto Q3 = FemtoDreamMath::getQ3(p1, mMassOne, p2, mMassTwo, p3, mMassThree); if (ConfIsCPR.value) { - if (pairCloseRejectionME.isClosePair(p1, p2, parts, magFieldTesla)) { + if (pairCloseRejectionME.isClosePair(p1, p2, parts, magFieldTesla, Q3)) { continue; } - if (pairCloseRejectionME.isClosePair(p2, p3, parts, magFieldTesla)) { + if (pairCloseRejectionME.isClosePair(p2, p3, parts, magFieldTesla, Q3)) { continue; } - if (pairCloseRejectionME.isClosePair(p1, p3, parts, magFieldTesla)) { + if (pairCloseRejectionME.isClosePair(p1, p3, parts, magFieldTesla, Q3)) { continue; } } // fill pT of all three particles as a function of Q3 for lambda calculations - auto Q3 = FemtoDreamMath::getQ3(p1, mMassOne, p2, mMassTwo, p3, mMassThree); ThreeBodyQARegistry.fill(HIST("TripletTaskQA/particle_pT_in_Triplet_ME"), p1.pt(), p2.pt(), p3.pt(), Q3); mixedEventCont.setTriplet(p1, p2, p3, multCol, Q3); } diff --git a/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0.cxx b/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0.cxx index 3f5036fdb1e..5e6472108c1 100644 --- a/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0.cxx +++ b/PWGCF/FemtoDream/Tasks/femtoDreamTripletTaskTrackTrackV0.cxx @@ -61,6 +61,8 @@ struct femtoDreamTripletTaskTrackTrackV0 { Configurable ConfTPCTOFPIDBit{"ConfTPCTOFPIDBit", 8, "PID TPCTOF bit from cutCulator"}; Configurable ConfMaxpT{"ConfMaxpT", 4.05f, "Maximum transverse momentum of the particles"}; Configurable ConfMinpT{"ConfMinpT", 0.3f, "Minimum transverse momentum of the particles"}; + Configurable ConfMaxDCAxy{"ConfMaxDCAxy", -0.1f, "Maximum DCAxy of the particles"}; + Configurable ConfMinDCAxy{"ConfMinDCAxy", 0.1f, "Minimum DCAxy of the particles"}; Configurable ConfPIDthrMom{"ConfPIDthrMom", 1.f, "Momentum threshold from which TPC and TOF are required for PID"}; Configurable ConfIsMC{"ConfIsMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"}; Configurable ConfUse3D{"ConfUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"}; @@ -70,12 +72,16 @@ struct femtoDreamTripletTaskTrackTrackV0 { ifnode(aod::femtodreamparticle::pt * (nexp(aod::femtodreamparticle::eta) + nexp(-1.f * aod::femtodreamparticle::eta)) / 2.f <= ConfPIDthrMom, ncheckbit(aod::femtodreamparticle::pidcut, ConfTPCPIDBit), ncheckbit(aod::femtodreamparticle::pidcut, ConfTPCTOFPIDBit)) && (ncheckbit(aod::femtodreamparticle::cut, ConfCutPart)) && (aod::femtodreamparticle::pt < ConfMaxpT) && - (aod::femtodreamparticle::pt > ConfMinpT); + (aod::femtodreamparticle::pt > ConfMinpT) && + (aod::femtodreamparticle::tempFitVar < ConfMaxDCAxy) && + (aod::femtodreamparticle::tempFitVar > ConfMinDCAxy); Partition> SelectedPartsMC = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ifnode(aod::femtodreamparticle::pt * (nexp(aod::femtodreamparticle::eta) + nexp(-1.f * aod::femtodreamparticle::eta)) / 2.f <= ConfPIDthrMom, ncheckbit(aod::femtodreamparticle::pidcut, ConfTPCPIDBit), ncheckbit(aod::femtodreamparticle::pidcut, ConfTPCTOFPIDBit)) && (ncheckbit(aod::femtodreamparticle::cut, ConfCutPart)) && (aod::femtodreamparticle::pt < ConfMaxpT) && - (aod::femtodreamparticle::pt > ConfMinpT); + (aod::femtodreamparticle::pt > ConfMinpT) && + (aod::femtodreamparticle::tempFitVar < ConfMaxDCAxy) && + (aod::femtodreamparticle::tempFitVar > ConfMinDCAxy); /// Histogramming of selected tracks FemtoDreamParticleHisto trackHistoSelectedParts; @@ -148,6 +154,7 @@ struct femtoDreamTripletTaskTrackTrackV0 { Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; Configurable ConfCPRdeltaPhiMax{"ConfCPRdeltaPhiMax", 0.01, "Max. Delta Phi for Close Pair Rejection"}; Configurable ConfCPRdeltaEtaMax{"ConfCPRdeltaEtaMax", 0.01, "Max. Delta Eta for Close Pair Rejection"}; + Configurable ConfMaxQ3IncludedInCPRPlots{"ConfMaxQ3IncludedInCPRPlots", 8., "Maximum Q3, for which the pair CPR is included in plots"}; ConfigurableAxis ConfDummy{"ConfDummy", {1, 0, 1}, "Dummy axis"}; FemtoDreamContainerThreeBody sameEventCont; @@ -166,7 +173,7 @@ struct femtoDreamTripletTaskTrackTrackV0 { void init(InitContext& context) { - eventHisto.init(&qaRegistry); + eventHisto.init(&qaRegistry, false); trackHistoSelectedParts.init(&qaRegistry, ConfDummy, ConfDummy, ConfTempFitVarpTBins, ConfDummy, ConfDummy, ConfTempFitVarBinsTrack, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfIsMC, ConfPDGCodePart); trackHistoALLSelectedParts.init(&qaRegistry, ConfDummy, ConfDummy, ConfTempFitVarpTBins, ConfDummy, ConfDummy, ConfTempFitVarBinsTrack, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfIsMC, ConfPDGCodePart); particleHistoSelectedV0s.init(&qaRegistry, ConfDummy, ConfDummy, ConfTempFitVarpTV0Bins, ConfDummy, ConfDummy, ConfTempFitVarBinsV0, ConfDummy, ConfDummy, ConfDummy, ConfDummy, ConfInvMassBins, ConfIsMC, ConfPDGCodeV0); @@ -178,8 +185,10 @@ struct femtoDreamTripletTaskTrackTrackV0 { ThreeBodyQARegistry.add("TripletTaskQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); ThreeBodyQARegistry.add("TripletTaskQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); - ThreeBodyQARegistry.add("TripletTaskQA/hMinvSE", ";Q_{3};M_{inv}", kTH2F, {ConfQ3Bins, ConfInvMassBins}); - ThreeBodyQARegistry.add("TripletTaskQA/hMinvME", ";Q_{3};M_{inv}", kTH2F, {ConfQ3Bins, ConfInvMassBins}); + ThreeBodyQARegistry.add("TripletTaskQA/hMinvSE_Lambda", ";Q_{3};M_{inv}", kTH2F, {ConfQ3Bins, ConfInvMassBins}); + ThreeBodyQARegistry.add("TripletTaskQA/hMinvME_Lambda", ";Q_{3};M_{inv}", kTH2F, {ConfQ3Bins, ConfInvMassBins}); + ThreeBodyQARegistry.add("TripletTaskQA/hMinvSE_AntiLambda", ";Q_{3};M_{inv}", kTH2F, {ConfQ3Bins, ConfInvMassBins}); + ThreeBodyQARegistry.add("TripletTaskQA/hMinvME_AntiLambda", ";Q_{3};M_{inv}", kTH2F, {ConfQ3Bins, ConfInvMassBins}); ThreeBodyQARegistry.add("TripletTaskQA/particle_pT_in_Triplet_SE", "; p_{T1} ; p_{T2} ; p_{T3} ; Q_{3}", kTHnSparseF, {ConfTempFitVarpTBins, ConfTempFitVarpTBins, ConfTempFitVarpTV0Bins, ConfQ3BinsFor4D}); ThreeBodyQARegistry.add("TripletTaskQA/particle_pT_in_Triplet_ME", "; p_{T1} ; p_{T2} ; p_{T3} ; Q_{3}", kTHnSparseF, {ConfTempFitVarpTBins, ConfTempFitVarpTBins, ConfTempFitVarpTV0Bins, ConfQ3BinsFor4D}); std::vector tmpVecMult = ConfMultBins; @@ -194,10 +203,10 @@ struct femtoDreamTripletTaskTrackTrackV0 { pairCleanerTrackTrack.init(&qaRegistry); pairCleanerTrackV0.init(&qaRegistry); if (ConfIsCPR.value) { - pairCloseRejectionTrackTrackSE.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 1, ConfUseOLD_possiblyWrong_CPR); - pairCloseRejectionTrackV0SE.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 1, ConfUseOLD_possiblyWrong_CPR); - pairCloseRejectionTrackTrackME.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 2, ConfUseOLD_possiblyWrong_CPR); - pairCloseRejectionTrackV0ME.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 2, ConfUseOLD_possiblyWrong_CPR); + pairCloseRejectionTrackTrackSE.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 1, ConfUseOLD_possiblyWrong_CPR, ConfMaxQ3IncludedInCPRPlots); + pairCloseRejectionTrackV0SE.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 1, ConfUseOLD_possiblyWrong_CPR, ConfMaxQ3IncludedInCPRPlots); + pairCloseRejectionTrackTrackME.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 2, ConfUseOLD_possiblyWrong_CPR, ConfMaxQ3IncludedInCPRPlots); + pairCloseRejectionTrackV0ME.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiMax.value, ConfCPRdeltaEtaMax.value, ConfCPRPlotPerRadii.value, 2, ConfUseOLD_possiblyWrong_CPR, ConfMaxQ3IncludedInCPRPlots, true); } // get masses @@ -253,11 +262,11 @@ struct femtoDreamTripletTaskTrackTrackV0 { } } - template + template void fillCollision(CollisionType col) { ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hSECollisionBins"), colBinning.getBin({col.posZ(), col.multNtr()})); - eventHisto.fillQA(col); + eventHisto.fillQA(col); } /// This function processes the same event and takes care of all the histogramming @@ -302,16 +311,16 @@ struct femtoDreamTripletTaskTrackTrackV0 { } for (auto& [T1, T2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupSelectedTracks, groupSelectedTracks))) { - + auto Q3 = FemtoDreamMath::getQ3(T1, mMassOne, T2, mMassTwo, V0, mMassThree); // Close pair rejection if (ConfIsCPR.value) { - if (pairCloseRejectionTrackTrackSE.isClosePair(T1, T2, parts, magFieldTesla)) { + if (pairCloseRejectionTrackTrackSE.isClosePair(T1, T2, parts, magFieldTesla, Q3)) { continue; } - if (pairCloseRejectionTrackV0SE.isClosePair(T1, V0, parts, magFieldTesla)) { + if (pairCloseRejectionTrackV0SE.isClosePair(T1, V0, parts, magFieldTesla, Q3)) { continue; } - if (pairCloseRejectionTrackV0SE.isClosePair(T2, V0, parts, magFieldTesla)) { + if (pairCloseRejectionTrackV0SE.isClosePair(T2, V0, parts, magFieldTesla, Q3)) { continue; } } @@ -327,8 +336,8 @@ struct femtoDreamTripletTaskTrackTrackV0 { continue; } // fill inv Mass as a function of Q3 for purity fits - auto Q3 = FemtoDreamMath::getQ3(T1, mMassOne, T2, mMassTwo, V0, mMassThree); - ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hMinvSE"), Q3, V0.mLambda()); + ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hMinvSE_Lambda"), Q3, V0.mLambda()); + ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hMinvSE_AntiLambda"), Q3, V0.mAntiLambda()); ThreeBodyQARegistry.fill(HIST("TripletTaskQA/particle_pT_in_Triplet_SE"), T1.pt(), T2.pt(), V0.pt(), Q3); sameEventCont.setTriplet(T1, T2, V0, multCol, Q3); } @@ -341,7 +350,7 @@ struct femtoDreamTripletTaskTrackTrackV0 { void processSameEvent(o2::aod::FDCollision& col, o2::aod::FDParticles& parts) { - fillCollision(col); + fillCollision(col); auto thegroupSelectedTracks = SelectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); for (auto& part : thegroupSelectedTracks) { trackHistoALLSelectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); @@ -372,7 +381,7 @@ struct femtoDreamTripletTaskTrackTrackV0 { /// \param parts subscribe to the femtoDreamParticleTable void processSameEventMasked(MaskedCollision& col, o2::aod::FDParticles& parts) { - fillCollision(col); + fillCollision(col); auto thegroupSelectedTracks = SelectedParts->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); for (auto& part : thegroupSelectedTracks) { trackHistoALLSelectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); @@ -406,7 +415,7 @@ struct femtoDreamTripletTaskTrackTrackV0 { soa::Join& parts, o2::aod::FDMCParticles&) { - fillCollision(col); + fillCollision(col); auto thegroupSelectedTracks = SelectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); for (auto& part : thegroupSelectedTracks) { trackHistoALLSelectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); @@ -440,7 +449,7 @@ struct femtoDreamTripletTaskTrackTrackV0 { soa::Join& parts, o2::aod::FDMCParticles&) { - fillCollision(col); + fillCollision(col); auto thegroupSelectedTracks = SelectedPartsMC->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); for (auto& part : thegroupSelectedTracks) { trackHistoALLSelectedParts.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); @@ -490,21 +499,23 @@ struct femtoDreamTripletTaskTrackTrackV0 { continue; } + auto Q3 = FemtoDreamMath::getQ3(T1, mMassOne, T2, mMassTwo, V0, mMassThree); // Close pair rejection if (ConfIsCPR.value) { - if (pairCloseRejectionTrackTrackME.isClosePair(T1, T2, parts, magFieldTesla)) { + if (pairCloseRejectionTrackTrackME.isClosePair(T1, T2, parts, magFieldTesla, Q3)) { continue; } - if (pairCloseRejectionTrackV0ME.isClosePair(T1, V0, parts, magFieldTesla)) { + if (pairCloseRejectionTrackV0ME.isClosePair(T1, V0, parts, magFieldTesla, Q3)) { continue; } - if (pairCloseRejectionTrackV0ME.isClosePair(T2, V0, parts, magFieldTesla)) { + if (pairCloseRejectionTrackV0ME.isClosePair(T2, V0, parts, magFieldTesla, Q3)) { continue; } } + // fill inv Mass as a function of Q3 for purity fits - auto Q3 = FemtoDreamMath::getQ3(T1, mMassOne, T2, mMassTwo, V0, mMassThree); - ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hMinvME"), Q3, V0.mLambda()); + ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hMinvME_Lambda"), Q3, V0.mLambda()); + ThreeBodyQARegistry.fill(HIST("TripletTaskQA/hMinvME_AntiLambda"), Q3, V0.mAntiLambda()); ThreeBodyQARegistry.fill(HIST("TripletTaskQA/particle_pT_in_Triplet_ME"), T1.pt(), T2.pt(), V0.pt(), Q3); mixedEventCont.setTriplet(T1, T2, V0, multCol, Q3); } diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h index d6fd614804a..03c313c689c 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h @@ -50,11 +50,13 @@ class FemtoUniverseDetaDphiStar /// Destructor virtual ~FemtoUniverseDetaDphiStar() = default; /// Initialization of the histograms and setting required values - void init(HistogramRegistry* registry, HistogramRegistry* registryQA, float ldeltaphistarcut, float ldeltaetacut, float lchosenradii, bool lplotForEveryRadii) + void init(HistogramRegistry* registry, HistogramRegistry* registryQA, float ldeltaphistarcutmin, float ldeltaphistarcutmax, float ldeltaetacutmin, float ldeltaetacutmax, float lchosenradii, bool lplotForEveryRadii) { ChosenRadii = lchosenradii; - CutDeltaPhiStar = ldeltaphistarcut; - CutDeltaEta = ldeltaetacut; + CutDeltaPhiStarMax = ldeltaphistarcutmax; + CutDeltaPhiStarMin = ldeltaphistarcutmin; + CutDeltaEtaMax = ldeltaetacutmax; + CutDeltaEtaMin = ldeltaetacutmin; plotForEveryRadii = lplotForEveryRadii; mHistogramRegistry = registry; mHistogramRegistryQA = registryQA; @@ -156,7 +158,7 @@ class FemtoUniverseDetaDphiStar LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - if (pow(dphiAvg, 2) / pow(CutDeltaPhiStar, 2) + pow(deta, 2) / pow(CutDeltaEta, 2) < 1.) { + if (pow(dphiAvg, 2) / pow(CutDeltaPhiStarMax, 2) + pow(deta, 2) / pow(CutDeltaEtaMax, 2) < 1.) { return true; } else { if (ChosenEventType == femtoUniverseContainer::EventType::same) { @@ -191,7 +193,7 @@ class FemtoUniverseDetaDphiStar LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - if (pow(dphiAvg, 2) / pow(CutDeltaPhiStar, 2) + pow(deta, 2) / pow(CutDeltaEta, 2) < 1.) { + if (pow(dphiAvg, 2) / pow(CutDeltaPhiStarMax, 2) + pow(deta, 2) / pow(CutDeltaEtaMax, 2) < 1.) { pass = true; } else { if (ChosenEventType == femtoUniverseContainer::EventType::same) { @@ -229,7 +231,7 @@ class FemtoUniverseDetaDphiStar LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - if (pow(dphiAvg, 2) / pow(CutDeltaPhiStar, 2) + pow(deta, 2) / pow(CutDeltaEta, 2) < 1.) { + if (pow(dphiAvg, 2) / pow(CutDeltaPhiStarMax, 2) + pow(deta, 2) / pow(CutDeltaEtaMax, 2) < 1.) { pass = true; } else { if (ChosenEventType == femtoUniverseContainer::EventType::same) { @@ -266,7 +268,7 @@ class FemtoUniverseDetaDphiStar LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - if ((fabs(dphiAvg) < CutDeltaPhiStar) && (fabs(deta) < CutDeltaEta)) { + if ((fabs(dphiAvg) < CutDeltaPhiStarMax) && (fabs(deta) < CutDeltaEtaMax)) { pass = true; // pair is close } else { if (ChosenEventType == femtoUniverseContainer::EventType::same) { @@ -289,7 +291,13 @@ class FemtoUniverseDetaDphiStar bool pass = false; for (int i = 0; i < 2; i++) { - auto indexOfDaughter = part2.index() - 2 + i; + auto indexOfDaughter = 0; + if (ChosenEventType == femtoUniverseContainer::EventType::mixed) { + indexOfDaughter = part2.globalIndex() - 2 + i; + } else if (ChosenEventType == femtoUniverseContainer::EventType::same) { + indexOfDaughter = part2.index() - 2 + i; + } + auto daughter = particles.begin() + indexOfDaughter; auto deta = part1.eta() - daughter.eta(); auto dphiAvg = AveragePhiStar(part1, *daughter, i); // CalculateDphiStar(part1, *daughter); @@ -302,7 +310,7 @@ class FemtoUniverseDetaDphiStar LOG(fatal) << "FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed."; } - if ((fabs(dphiAvg) < CutDeltaPhiStar) && (fabs(deta) < CutDeltaEta)) { + if ((dphiAvg > CutDeltaPhiStarMin) && (dphiAvg < CutDeltaPhiStarMax) && (deta > CutDeltaEtaMin) && (deta < CutDeltaEtaMax)) { pass = true; // pair is close } else { if (ChosenEventType == femtoUniverseContainer::EventType::same) { @@ -348,8 +356,10 @@ class FemtoUniverseDetaDphiStar static constexpr uint32_t kValue0 = 0; float ChosenRadii; - float CutDeltaPhiStar; - float CutDeltaEta; + float CutDeltaPhiStarMax; + float CutDeltaPhiStarMin; + float CutDeltaEtaMax; + float CutDeltaEtaMin; float magfield; bool plotForEveryRadii = false; diff --git a/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt b/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt index 93c2ad9cd59..bc459fcb16e 100644 --- a/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt +++ b/PWGCF/FemtoUniverse/Tasks/CMakeLists.txt @@ -69,6 +69,11 @@ o2physics_add_dpl_workflow(femtouniverse-pair-track-track-m-c PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(femtouniverse-efficiency-task + SOURCES femtoUniverseEfficiencyTask.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_executable(femtouniverse-cutculator SOURCES femtoUniverseCutCulator.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyTask.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyTask.cxx new file mode 100644 index 00000000000..497bbdb503f --- /dev/null +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyTask.cxx @@ -0,0 +1,556 @@ +// 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 femtoUniverseEfficiencyTask.cxx +/// \author Lukasz Graczykowski, WUT Warsaw, lgraczyk@cern.ch +/// \author Malgorzata Janik, WUT Warsaw, majanik@cern.ch +/// \author Alicja Plachta, WUT Warsaw, alicja.plachta@cern.ch +/// \author Barbara Chytla, WUT Warsaw, barbara.chytla@cern.ch +/// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch + +// O2 includes +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" +#include "PWGLF/DataModel/LFResonanceTables.h" +#include "PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h" +#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" +#include "Framework/O2DatabasePDGPlugin.h" + +#include "TPDGCode.h" + +using namespace o2; +using namespace o2::analysis::femtoUniverse; +using namespace o2::track; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// using TracksPID = aod::FullTracks; // This is okay. +using TracksPID = soa::Join; // for helper task with "full" +// using TracksPID = soa::Join; // This is okay for "no full" + +using CollisionsEvSel = soa::Join; + +// Femto World Efficiency task +struct femtoUniverseEficiencyTask { + + Service pdgDB; + + // histogram registries produced + HistogramRegistry registryQAevent{"QAHistosEvent", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry registryQAtrack{"QAHistosTrack", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry registryPID{"PIDHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry registryPDG{"PDGHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry registryPri{"PriHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry registryPriCuts{"PriHistosCuts", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; // for tracking efficiency = cuts only + HistogramRegistry registryGlobal{"GlobalTrackHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + + HistogramRegistry registryMCtruth{"MCtruthHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + + // configurables + Configurable pidnSigmaCut{"pidnSigmaCut", 3.0f, "TPC and TOF PID cut "}; + Configurable tofPtCut{"tofPtCut", 0.5f, "From what pT TOF is used"}; + Configurable ConfIsRun3{"ConfIsRun3", false, "Running on Run 3 data"}; // Choose if running on converted data or run 3 data + // track cuts + Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; + Configurable cfgPtLow{"cfgPtLow", 0.2, "Lower limit for Pt"}; + Configurable cfgPtHigh{"cfgPtHigh", 4., "Higher limit for Pt"}; + Configurable cfgDcaXY{"cfgDcaXY", 2.4, "Value of max. DCA_XY"}; + Configurable cfgDcaZ{"cfgDcaZ", 3.2, "Value of max. DCA_Z"}; + /// Event cuts + o2::analysis::femtoUniverse::FemtoUniverseCollisionSelection colCuts; + Configurable ConfEvtZvtx{"ConfEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; + 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 ConfPIDnoTOF{"ConfPIDnoTOF", false, "Use only TPC in PID, no TOF"}; + + Configurable ConfCentFT0Min{"ConfCentFT0Min", 0.f, "Min CentFT0 value for centrality selection"}; + Configurable ConfCentFT0Max{"ConfCentFT0Max", 200.f, "Max CentFT0 value for centrality selection"}; + + void init(InitContext&) + { + colCuts.setCuts(ConfEvtZvtx, ConfEvtTriggerCheck, ConfEvtTriggerSel, ConfEvtOfflineCheck, ConfIsRun3, ConfCentFT0Min, ConfCentFT0Max); + colCuts.init(®istryQAevent); + + // event cuts - already done in FemtoUniverseCollisionSelection.h + // registryQAevent.add("before/reco/zvtx", "vtx_{#it{z}}", kTH1F, {{300, -15.0, 15.0, "vtx_{#it{z}} (cm)"}}); + // registryQAevent.add("before/reco/multiplicity", "V0M multiplicity class", kTH1F, {{100, 0.0, 100.0, "V0M multiplicity (%)"}}); + + // track cuts + registryQAtrack.add("after/all/plus/pt", "Charged particles #it{p}_{T}", kTH1F, {{150, 0.0, 15.0, "#it{p}_{T} (GeV/#it{c})"}}); + registryQAtrack.add("after/all/plus/eta", "Charged particles #eta", kTH1F, {{400, -1.0, 1.0, "#eta"}}); + registryQAtrack.add("after/all/plus/phi", "Charged particles #varphi", kTH1F, {{360, 0.0, constants::math::TwoPI, "#varphi"}}); + registryQAtrack.add("after/all/plus/etaphi", "#eta - #varphi;#eta;#varphi", {HistType::kTH2F, {{200, -1, 1}, {200, 0, 2 * TMath::Pi()}}}); + registryQAtrack.add("after/all/plus/DCAxy", "DCAyx; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", kTH2F, {{1000, 0, 10}, {1000, -5, 5}}); + registryQAtrack.add("after/all/plus/DCAz", "DCAz; #it{p}_{T} (GeV/#it{c}); DCA_{z} (cm)", kTH2F, {{1000, 0, 10}, {1000, -5, 5}}); + registryQAtrack.addClone("after/all/plus/", "after/all/minus/"); + registryQAtrack.addClone("after/all/", "after/pion/"); + registryQAtrack.addClone("after/all/", "after/kaon/"); + registryQAtrack.addClone("after/all/", "after/proton/"); + + // global track histos + registryGlobal.add("crossedRows", "Number of crossed rows TPC", kTH1F, {{159, 0, 158, "N crossed rows"}}); + registryGlobal.add("RowsOverClustersTPC", "Ratio of crossed rows over findable TPC clusters", kTH1F, {{100, 0.5, 2., "N crossed rows"}}); + registryGlobal.add("chi2TPC", "Chi2 per TPC cluster", kTH1F, {{500, 0, 5, "Chi2 per TPC cluster"}}); + registryGlobal.add("chi2ITS", "Chi2 per ITS cluster", kTH1F, {{500, 0, 40, "Chi2 per ITS cluster"}}); + registryGlobal.add("dcaZ", "DCA to z vertex", kTH1F, {{500, 0, 4., "DCA to z vertex"}}); + registryGlobal.add("dcaXY", "DCA to xy vertex", kTH1F, {{500, 0, 4., "DCA to xy vertex"}}); + registryGlobal.add("clustersITS", "Number of ITS clusters", kTH1F, {{8, 0, 7, "N crossed rows"}}); // perhaps change to itsClusterMap + registryGlobal.add("pt", "#it{p}_{T}", kTH1F, {{150, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}}); + registryGlobal.add("eta", "#eta", kTH1F, {{400, -1.0, 1.0, "#eta"}}); + + // nsigmas + registryPID.add("pid/plus/TOF_TPC_Map", "TOF + TPC Combined PID for all;#sigma_{TOF}^{all};#sigma_{TPC}^{all}", {HistType::kTH2F, {{100, -5, 5}, {100, -5, 5}}}); + registryPID.addClone("pid/plus/", "pid/minus/"); + + registryPID.add("pid/kaon/plus/TOF_TPC_Map", "TOF + TPC Combined PID;#sigma_{TOF};#sigma_{TPC}", {HistType::kTH2F, {{100, -5, 5}, {100, -5, 5}}}); + registryPID.add("pid/kaon/plus/TOF_Nsigma", "TOF NSigma;#it{p}_{T} (GeV/#it{c});#sigma_{TOF};", {HistType::kTH2F, {{100, 0, 10}, {100, -5, 5}}}); + registryPID.add("pid/kaon/plus/TPC_Nsigma", "TPC NSigma;#it{p}_{T} (GeV/#it{c});#sigma_{TPC};", {HistType::kTH2F, {{100, 0, 10}, {100, -5, 5}}}); + registryPID.add("pid/kaon/plus/TPC_dEdx", "TPC dE/dx;#it{p}_{T} (GeV/#it{c});#it{dE/dx};", {HistType::kTH2F, {{100, 0, 10}, {100, -50, 200}}}); + registryPID.add("pid/kaon/plus/TOF_Beta", "TOF Signal;#it{p}_{T} (GeV/#it{c});#TOF Beta;", {HistType::kTH2F, {{100, 0, 10}, {100, 0, 5}}}); + registryPID.addClone("pid/kaon/plus/", "pid/kaon/minus/"); + + registryPID.addClone("pid/kaon/", "pid/pion/"); + registryPID.addClone("pid/kaon/", "pid/proton/"); + + // PDG + registryPDG.add("plus/PDGPi", "PDGPi;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {8001, -4000.5, 4000.5}}}); + registryPDG.add("plus/PDGKa", "PDGKa;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {8001, -4000.5, 4000.5}}}); + registryPDG.add("plus/PDGPr", "PDGPr;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {8001, -4000.5, 4000.5}}}); + + registryPDG.add("minus/PDGPi", "PDGPi;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {8001, -4000.5, 4000.5}}}); + registryPDG.add("minus/PDGKa", "PDGKa;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {8001, -4000.5, 4000.5}}}); + registryPDG.add("minus/PDGPr", "PDGPr;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {8001, -4000.5, 4000.5}}}); + + // Pri + registryPri.add("plus/PiPri", "PiPri;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryPri.add("plus/KaPri", "KaPri;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryPri.add("plus/PrPri", "PrPri;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryPri.add("plus/AllPri", "AllPri;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + + registryPri.add("minus/PiPri", "PiPri;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryPri.add("minus/KaPri", "KaPri;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryPri.add("minus/PrPri", "PrPri;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryPri.add("minus/AllPri", "AllPri;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + + registryPri.add("plus/PiPriPt", "PiPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPri.add("plus/KaPriPt", "KaPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPri.add("plus/PrPriPt", "PrPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPri.add("plus/AllPriPt", "AllPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + + registryPri.add("minus/PiPriPt", "PiPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPri.add("minus/KaPriPt", "KaPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPri.add("minus/PrPriPt", "PrPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPri.add("minus/AllPriPt", "AllPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + + registryPri.add("plus/TOFmatchingAll", ";#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPri.add("minus/TOFmatchingAll", ";#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + + registryPri.add("plus/TOFmatchingPi", ";#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPri.add("minus/TOFmatchingPi", ";#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + + registryPri.add("plus/TOFmatchingKa", ";#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPri.add("minus/TOFmatchingKa", ";#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + + registryPri.add("plus/TOFmatchingPr", ";#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPri.add("minus/TOFmatchingPr", ";#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + + // Pri our tracking cuts only + registryPriCuts.add("plus/PiPriPt", "PiPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPriCuts.add("plus/KaPriPt", "KaPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPriCuts.add("plus/PrPriPt", "PrPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + + registryPriCuts.add("minus/PiPriPt", "PiPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPriCuts.add("minus/KaPriPt", "KaPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryPriCuts.add("minus/PrPriPt", "PrPri;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + + // MC truth + registryMCtruth.add("plus/MCtruthPi", "MC truth pions;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCtruth.add("plus/MCtruthKa", "MC truth kaons;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCtruth.add("plus/MCtruthPr", "MC truth protons;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + + registryMCtruth.add("minus/MCtruthPi", "MC truth pions;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCtruth.add("minus/MCtruthKa", "MC truth kaons;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + registryMCtruth.add("minus/MCtruthPr", "MC truth protons;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); + + registryMCtruth.add("plus/MCtruthPiPt", "MC truth pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("plus/MCtruthKaPt", "MC truth kaons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("plus/MCtruthPrPt", "MC truth protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("plus/MCtruthAllPt", "MC truth all;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + + registryMCtruth.add("minus/MCtruthPiPt", "MC truth pions;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("minus/MCtruthKaPt", "MC truth kaons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("minus/MCtruthPrPt", "MC truth protons;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + registryMCtruth.add("minus/MCtruthAllPt", "MC truth all;#it{p}_{T} (GeV/c)", {HistType::kTH1F, {{500, 0, 5}}}); + } + + bool IsNSigmaAccept(float nsigmaTPC, float nsigmaTOF, float mom) + { + if (ConfPIDnoTOF) { + if (TMath::Abs(nsigmaTPC) < pidnSigmaCut) { + return true; + } else { + return false; + } + } else { + if (mom > tofPtCut) { + if (TMath::Hypot(nsigmaTOF, nsigmaTPC) < pidnSigmaCut) + return true; + } else { + if (TMath::Abs(nsigmaTPC) < pidnSigmaCut) + return true; + } + return false; + } + } + + Filter trackFilter = nabs(aod::track::eta) < cfgCutEta && requireGlobalTrackInFilter() && aod::track::pt > cfgPtLow&& aod::track::pt < cfgPtHigh; + + void processReco(const CollisionsEvSel::iterator& collision, + soa::Filtered> const& tracks /*, aod::BCsWithTimestamps const&*/) + { + if (ConfIsRun3) { + if (!collision.sel8()) + return; + } else { + if (!collision.sel7()) + return; + } + + // auto bc = collision.bc_as(); /// adding timestamp to access magnetic field later + // Default event selection + // colCuts.printCuts(); + if (!colCuts.isSelected(collision)) + return; + colCuts.fillQA(collision); + + // Loop over tracks + for (auto& track : tracks) { + // Tracks are already filtered by the pre-filters + + // track.hasTOF() - to check if TOF info available + + // cuts on tracks: + if (!ConfPIDnoTOF) { + if (track.pt() > tofPtCut && !track.hasTOF()) + continue; // if no TOF information above tofPtCut reject such track + } + + registryGlobal.fill(HIST("crossedRows"), track.tpcNClsCrossedRows()); + registryGlobal.fill(HIST("RowsOverClustersTPC"), track.tpcCrossedRowsOverFindableCls()); + registryGlobal.fill(HIST("chi2TPC"), track.tpcChi2NCl()); + registryGlobal.fill(HIST("chi2ITS"), track.itsChi2NCl()); + registryGlobal.fill(HIST("dcaZ"), track.dcaZ()); + registryGlobal.fill(HIST("dcaXY"), track.dcaXY()); + registryGlobal.fill(HIST("clustersITS"), track.itsNCls()); + registryGlobal.fill(HIST("pt"), track.pt()); + registryGlobal.fill(HIST("eta"), track.eta()); + + // no PID histograms + if (track.sign() > 0) { + registryQAtrack.fill(HIST("after/all/plus/etaphi"), track.eta(), track.phi()); + registryQAtrack.fill(HIST("after/all/plus/pt"), track.pt()); + registryQAtrack.fill(HIST("after/all/plus/eta"), track.eta()); + registryQAtrack.fill(HIST("after/all/plus/phi"), track.phi()); + registryQAtrack.fill(HIST("after/all/plus/DCAxy"), track.pt(), track.dcaXY()); + registryQAtrack.fill(HIST("after/all/plus/DCAz"), track.pt(), track.dcaZ()); + } + if (track.sign() < 0) { + registryQAtrack.fill(HIST("after/all/minus/etaphi"), track.eta(), track.phi()); + registryQAtrack.fill(HIST("after/all/minus/pt"), track.pt()); + registryQAtrack.fill(HIST("after/all/minus/eta"), track.eta()); + registryQAtrack.fill(HIST("after/all/minus/phi"), track.phi()); + registryQAtrack.fill(HIST("after/all/minus/DCAxy"), track.pt(), track.dcaXY()); + registryQAtrack.fill(HIST("after/all/minus/DCAz"), track.pt(), track.dcaZ()); + } + + // Add PID selection criteria here + if (IsNSigmaAccept(std::abs(track.tpcNSigmaPi()), std::abs(track.tofNSigmaPi()), track.pt())) { + if (track.sign() > 0) { + registryPID.fill(HIST("pid/pion/plus/TOF_TPC_Map"), track.tofNSigmaPi(), track.tpcNSigmaPi()); + registryPID.fill(HIST("pid/pion/plus/TOF_Nsigma"), track.pt(), track.tofNSigmaPi()); + registryPID.fill(HIST("pid/pion/plus/TPC_Nsigma"), track.pt(), track.tpcNSigmaPi()); + registryPID.fill(HIST("pid/pion/plus/TPC_dEdx"), track.pt(), track.tpcSignal()); + registryPID.fill(HIST("pid/pion/plus/TOF_Beta"), track.pt(), track.beta()); + + registryQAtrack.fill(HIST("after/pion/plus/etaphi"), track.eta(), track.phi()); + registryQAtrack.fill(HIST("after/pion/plus/pt"), track.pt()); + registryQAtrack.fill(HIST("after/pion/plus/eta"), track.eta()); + registryQAtrack.fill(HIST("after/pion/plus/phi"), track.phi()); + registryQAtrack.fill(HIST("after/pion/plus/DCAxy"), track.pt(), track.dcaXY()); + registryQAtrack.fill(HIST("after/pion/plus/DCAz"), track.pt(), track.dcaZ()); + } + if (track.sign() < 0) { + registryPID.fill(HIST("pid/pion/minus/TOF_TPC_Map"), track.tofNSigmaPi(), track.tpcNSigmaPi()); + registryPID.fill(HIST("pid/pion/minus/TOF_Nsigma"), track.pt(), track.tofNSigmaPi()); + registryPID.fill(HIST("pid/pion/minus/TPC_Nsigma"), track.pt(), track.tpcNSigmaPi()); + registryPID.fill(HIST("pid/pion/minus/TPC_dEdx"), track.pt(), track.tpcSignal()); + registryPID.fill(HIST("pid/pion/minus/TOF_Beta"), track.pt(), track.beta()); + + registryQAtrack.fill(HIST("after/pion/minus/etaphi"), track.eta(), track.phi()); + registryQAtrack.fill(HIST("after/pion/minus/pt"), track.pt()); + registryQAtrack.fill(HIST("after/pion/minus/eta"), track.eta()); + registryQAtrack.fill(HIST("after/pion/minus/phi"), track.phi()); + registryQAtrack.fill(HIST("after/pion/minus/DCAxy"), track.pt(), track.dcaXY()); + registryQAtrack.fill(HIST("after/pion/minus/DCAz"), track.pt(), track.dcaZ()); + } + } + if (IsNSigmaAccept(std::abs(track.tpcNSigmaKa()), std::abs(track.tofNSigmaKa()), track.pt())) { + if (track.sign() > 0) { + registryPID.fill(HIST("pid/kaon/plus/TOF_TPC_Map"), track.tofNSigmaKa(), track.tpcNSigmaKa()); + registryPID.fill(HIST("pid/kaon/plus/TOF_Nsigma"), track.pt(), track.tofNSigmaKa()); + registryPID.fill(HIST("pid/kaon/plus/TPC_Nsigma"), track.pt(), track.tpcNSigmaKa()); + registryPID.fill(HIST("pid/kaon/plus/TPC_dEdx"), track.pt(), track.tpcSignal()); + registryPID.fill(HIST("pid/kaon/plus/TOF_Beta"), track.pt(), track.beta()); + + registryQAtrack.fill(HIST("after/kaon/plus/etaphi"), track.eta(), track.phi()); + registryQAtrack.fill(HIST("after/kaon/plus/pt"), track.pt()); + registryQAtrack.fill(HIST("after/kaon/plus/eta"), track.eta()); + registryQAtrack.fill(HIST("after/kaon/plus/phi"), track.phi()); + registryQAtrack.fill(HIST("after/kaon/plus/DCAxy"), track.pt(), track.dcaXY()); + registryQAtrack.fill(HIST("after/kaon/plus/DCAz"), track.pt(), track.dcaZ()); + } + if (track.sign() < 0) { + registryPID.fill(HIST("pid/kaon/minus/TOF_TPC_Map"), track.tofNSigmaKa(), track.tpcNSigmaKa()); + registryPID.fill(HIST("pid/kaon/minus/TOF_Nsigma"), track.pt(), track.tofNSigmaKa()); + registryPID.fill(HIST("pid/kaon/minus/TPC_Nsigma"), track.pt(), track.tpcNSigmaKa()); + registryPID.fill(HIST("pid/kaon/minus/TPC_dEdx"), track.pt(), track.tpcSignal()); + registryPID.fill(HIST("pid/kaon/minus/TOF_Beta"), track.pt(), track.beta()); + + registryQAtrack.fill(HIST("after/kaon/minus/etaphi"), track.eta(), track.phi()); + registryQAtrack.fill(HIST("after/kaon/minus/pt"), track.pt()); + registryQAtrack.fill(HIST("after/kaon/minus/eta"), track.eta()); + registryQAtrack.fill(HIST("after/kaon/minus/phi"), track.phi()); + registryQAtrack.fill(HIST("after/kaon/minus/DCAxy"), track.pt(), track.dcaXY()); + registryQAtrack.fill(HIST("after/kaon/minus/DCAz"), track.pt(), track.dcaZ()); + } + } + if (IsNSigmaAccept(std::abs(track.tpcNSigmaPr()), std::abs(track.tofNSigmaPr()), track.pt())) { + if (track.sign() > 0) { + registryPID.fill(HIST("pid/proton/plus/TOF_TPC_Map"), track.tofNSigmaPr(), track.tpcNSigmaPr()); + registryPID.fill(HIST("pid/proton/plus/TOF_Nsigma"), track.pt(), track.tofNSigmaPr()); + registryPID.fill(HIST("pid/proton/plus/TPC_Nsigma"), track.pt(), track.tpcNSigmaPr()); + registryPID.fill(HIST("pid/proton/plus/TPC_dEdx"), track.pt(), track.tpcSignal()); + registryPID.fill(HIST("pid/proton/plus/TOF_Beta"), track.pt(), track.beta()); + + registryQAtrack.fill(HIST("after/proton/plus/etaphi"), track.eta(), track.phi()); + registryQAtrack.fill(HIST("after/proton/plus/pt"), track.pt()); + registryQAtrack.fill(HIST("after/proton/plus/eta"), track.eta()); + registryQAtrack.fill(HIST("after/proton/plus/phi"), track.phi()); + registryQAtrack.fill(HIST("after/proton/plus/DCAxy"), track.pt(), track.dcaXY()); + registryQAtrack.fill(HIST("after/proton/plus/DCAz"), track.pt(), track.dcaZ()); + } + if (track.sign() < 0) { + registryPID.fill(HIST("pid/proton/minus/TOF_TPC_Map"), track.tofNSigmaPr(), track.tpcNSigmaPr()); + registryPID.fill(HIST("pid/proton/minus/TOF_Nsigma"), track.pt(), track.tofNSigmaPr()); + registryPID.fill(HIST("pid/proton/minus/TPC_Nsigma"), track.pt(), track.tpcNSigmaPr()); + registryPID.fill(HIST("pid/proton/minus/TPC_dEdx"), track.pt(), track.tpcSignal()); + registryPID.fill(HIST("pid/proton/minus/TOF_Beta"), track.pt(), track.beta()); + + registryQAtrack.fill(HIST("after/proton/minus/etaphi"), track.eta(), track.phi()); + registryQAtrack.fill(HIST("after/proton/minus/pt"), track.pt()); + registryQAtrack.fill(HIST("after/proton/minus/eta"), track.eta()); + registryQAtrack.fill(HIST("after/proton/minus/phi"), track.phi()); + registryQAtrack.fill(HIST("after/proton/minus/DCAxy"), track.pt(), track.dcaXY()); + registryQAtrack.fill(HIST("after/proton/minus/DCAz"), track.pt(), track.dcaZ()); + } + } + } + } + PROCESS_SWITCH(femtoUniverseEficiencyTask, processReco, "Process reconstructed data", true); + + using BigTracksMC = soa::Join; + Preslice perCollisionID = aod::track::collisionId; + void processMCTruth(aod::McCollision const& collision, soa::SmallGroups> const& collisions, aod::McParticles const& mcparticles, soa::Filtered const& tracks) + { + // Loop over reconstructed collisions corresponding to MC collision + for (auto& collision : collisions) { + + // Group tracks belonging to collision + auto groupedTracks = tracks.sliceBy(perCollisionID, collision.globalIndex()); + + // Loop over tracks + for (auto& track : groupedTracks) { + if (!track.has_mcParticle()) { + continue; + } + const auto mcParticle = track.mcParticle(); + + if (track.sign() > 0) { + if (IsNSigmaAccept(std::abs(track.tpcNSigmaPi()), std::abs(track.tofNSigmaPi()), track.pt())) { + registryPDG.fill(HIST("plus/PDGPi"), track.pt(), mcParticle.pdgCode()); + } + if (IsNSigmaAccept(std::abs(track.tpcNSigmaKa()), std::abs(track.tofNSigmaKa()), track.pt())) { + registryPDG.fill(HIST("plus/PDGKa"), track.pt(), mcParticle.pdgCode()); + } + if (IsNSigmaAccept(std::abs(track.tpcNSigmaPr()), std::abs(track.tofNSigmaPr()), track.pt())) { + registryPDG.fill(HIST("plus/PDGPr"), track.pt(), mcParticle.pdgCode()); + } + } + if (track.sign() < 0) { + if (IsNSigmaAccept(std::abs(track.tpcNSigmaPi()), std::abs(track.tofNSigmaPi()), track.pt())) { + registryPDG.fill(HIST("minus/PDGPi"), track.pt(), mcParticle.pdgCode()); + } + if (IsNSigmaAccept(std::abs(track.tpcNSigmaKa()), std::abs(track.tofNSigmaKa()), track.pt())) { + registryPDG.fill(HIST("minus/PDGKa"), track.pt(), mcParticle.pdgCode()); + } + if (IsNSigmaAccept(std::abs(track.tpcNSigmaPr()), std::abs(track.tofNSigmaPr()), track.pt())) { + registryPDG.fill(HIST("minus/PDGPr"), track.pt(), mcParticle.pdgCode()); + } + } + + if (mcParticle.isPhysicalPrimary()) { + if (track.sign() > 0) { + // PID only + registryPri.fill(HIST("plus/AllPri"), track.pt(), track.eta()); + registryPri.fill(HIST("plus/AllPriPt"), mcParticle.pt()); + // histogram pt TOF matching + if (track.hasTOF()) { + registryPri.fill(HIST("plus/TOFmatchingAll"), mcParticle.pt()); + if (mcParticle.pdgCode() == 211) { + registryPri.fill(HIST("plus/TOFmatchingPi"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == 321) { + registryPri.fill(HIST("plus/TOFmatchingKa"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == 2212) { + registryPri.fill(HIST("plus/TOFmatchingPr"), mcParticle.pt()); + } + } + + if (IsNSigmaAccept(std::abs(track.tpcNSigmaPi()), std::abs(track.tofNSigmaPi()), track.pt()) && mcParticle.pdgCode() == 211) { + registryPri.fill(HIST("plus/PiPri"), track.pt(), track.eta()); + registryPri.fill(HIST("plus/PiPriPt"), mcParticle.pt()); + } + if (IsNSigmaAccept(std::abs(track.tpcNSigmaKa()), std::abs(track.tofNSigmaKa()), track.pt()) && mcParticle.pdgCode() == 321) { + registryPri.fill(HIST("plus/KaPri"), track.pt(), track.eta()); + registryPri.fill(HIST("plus/KaPriPt"), mcParticle.pt()); + } + if (IsNSigmaAccept(std::abs(track.tpcNSigmaPr()), std::abs(track.tofNSigmaPr()), track.pt()) && mcParticle.pdgCode() == 2212) { + registryPri.fill(HIST("plus/PrPri"), track.pt(), track.eta()); + registryPri.fill(HIST("plus/PrPriPt"), mcParticle.pt()); + } + // tracking efficiency only + if (mcParticle.pdgCode() == 211) { + registryPriCuts.fill(HIST("plus/PiPriPt"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == 321) { + registryPriCuts.fill(HIST("plus/KaPriPt"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == 2212) { + registryPriCuts.fill(HIST("plus/PrPriPt"), mcParticle.pt()); + } + } + if (track.sign() < 0) { + // PID only + registryPri.fill(HIST("minus/AllPri"), track.pt(), track.eta()); + registryPri.fill(HIST("minus/AllPriPt"), mcParticle.pt()); + // histogram pt TOF matching + if (track.hasTOF()) { + registryPri.fill(HIST("minus/TOFmatchingAll"), mcParticle.pt()); + if (mcParticle.pdgCode() == -211) { + registryPri.fill(HIST("minus/TOFmatchingPi"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == -321) { + registryPri.fill(HIST("minus/TOFmatchingKa"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == -2212) { + registryPri.fill(HIST("minus/TOFmatchingPr"), mcParticle.pt()); + } + } + + if (IsNSigmaAccept(std::abs(track.tpcNSigmaPi()), std::abs(track.tofNSigmaPi()), track.pt()) && mcParticle.pdgCode() == -211) { + registryPri.fill(HIST("minus/PiPri"), track.pt(), track.eta()); + registryPri.fill(HIST("minus/PiPriPt"), mcParticle.pt()); + } + if (IsNSigmaAccept(std::abs(track.tpcNSigmaKa()), std::abs(track.tofNSigmaKa()), track.pt()) && mcParticle.pdgCode() == -321) { + registryPri.fill(HIST("minus/KaPri"), track.pt(), track.eta()); + registryPri.fill(HIST("minus/KaPriPt"), mcParticle.pt()); + } + if (IsNSigmaAccept(std::abs(track.tpcNSigmaPr()), std::abs(track.tofNSigmaPr()), track.pt()) && mcParticle.pdgCode() == -2212) { + registryPri.fill(HIST("minus/PrPri"), track.pt(), track.eta()); + registryPri.fill(HIST("minus/PrPriPt"), mcParticle.pt()); + } + // tracking efficiency only + if (mcParticle.pdgCode() == -211) { + registryPriCuts.fill(HIST("minus/PiPriPt"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == -321) { + registryPriCuts.fill(HIST("minus/KaPriPt"), mcParticle.pt()); + } + if (mcParticle.pdgCode() == -2212) { + registryPriCuts.fill(HIST("minus/PrPriPt"), mcParticle.pt()); + } + } + } + } + } + // loop over MC particles + for (auto& mcparticle : mcparticles) { + if (!mcparticle.isPhysicalPrimary() || TMath::Abs(mcparticle.eta()) > cfgCutEta || mcparticle.pt() < cfgPtLow || mcparticle.pt() > cfgPtHigh) + continue; + + const auto& pdgParticle = pdgDB->GetParticle(mcparticle.pdgCode()); + if (!pdgParticle) { + continue; + } + + if (pdgParticle->Charge() > 0) { + registryMCtruth.fill(HIST("plus/MCtruthAllPt"), mcparticle.pt()); + } + if (mcparticle.pdgCode() == 211) { + registryMCtruth.fill(HIST("plus/MCtruthPi"), mcparticle.pt(), mcparticle.eta()); + registryMCtruth.fill(HIST("plus/MCtruthPiPt"), mcparticle.pt()); + } + if (mcparticle.pdgCode() == 321) { + registryMCtruth.fill(HIST("plus/MCtruthKa"), mcparticle.pt(), mcparticle.eta()); + registryMCtruth.fill(HIST("plus/MCtruthKaPt"), mcparticle.pt()); + } + if (mcparticle.pdgCode() == 2212) { + registryMCtruth.fill(HIST("plus/MCtruthPr"), mcparticle.pt(), mcparticle.eta()); + registryMCtruth.fill(HIST("plus/MCtruthPrPt"), mcparticle.pt()); + } + + if (pdgParticle->Charge() < 0) { + registryMCtruth.fill(HIST("minus/MCtruthAllPt"), mcparticle.pt()); + } + if (mcparticle.pdgCode() == -211) { + registryMCtruth.fill(HIST("minus/MCtruthPi"), mcparticle.pt(), mcparticle.eta()); + registryMCtruth.fill(HIST("minus/MCtruthPiPt"), mcparticle.pt()); + } + if (mcparticle.pdgCode() == -321) { + registryMCtruth.fill(HIST("minus/MCtruthKa"), mcparticle.pt(), mcparticle.eta()); + registryMCtruth.fill(HIST("minus/MCtruthKaPt"), mcparticle.pt()); + } + if (mcparticle.pdgCode() == -2212) { + registryMCtruth.fill(HIST("minus/MCtruthPr"), mcparticle.pt(), mcparticle.eta()); + registryMCtruth.fill(HIST("minus/MCtruthPrPt"), mcparticle.pt()); + } + } + } + PROCESS_SWITCH(femtoUniverseEficiencyTask, processMCTruth, "Process MC truth data", true); + +}; // end of spectra task +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"femtoUniverseEficiencyTask"}), + }; +} diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx index 5b477a30937..e35187cf286 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx @@ -167,8 +167,10 @@ struct femtoUniversePairTaskTrackD0 { Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable ConfCPRdeltaPhiCut{"ConfCPRdeltaPhiCut", 0.0, "Delta Phi cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCut{"ConfCPRdeltaEtaCut", 0.0, "Delta Eta cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; FemtoUniverseFemtoContainer sameEventFemtoCont; @@ -342,7 +344,7 @@ struct femtoUniversePairTaskTrackD0 { pairCleaner.init(&qaRegistry); if (ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCut.value, ConfCPRdeltaEtaCut.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); } vPIDTrack = ConfTrack.ConfPIDTrack.value; diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx index c9e4b4e9f7c..d5e1f9bf25f 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx @@ -63,8 +63,10 @@ struct femtoUniversePairTaskTrackPhi { Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable ConfCPRdeltaPhiCut{"ConfCPRdeltaPhiCut", 0.01, "Delta Phi cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCut{"ConfCPRdeltaEtaCut", 0.004, "Delta Eta cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; /// Table for both particles @@ -288,7 +290,7 @@ struct femtoUniversePairTaskTrackPhi { pairCleaner.init(&qaRegistry); if (ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCut.value, ConfCPRdeltaEtaCut.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); } vPIDPhiCandidate = ConfPhi.ConfPIDPhi.value; diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack.cxx index 3aaebb87374..72157d49253 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack.cxx @@ -120,8 +120,10 @@ struct femtoUniversePairTaskTrackTrack { Configurable ConfNEventsMix{"ConfNEventsMix", 5, "Number of events for mixing"}; Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable ConfCPRdeltaPhiCut{"ConfCPRdeltaPhiCut", 0.0, "Delta Phi cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCut{"ConfCPRdeltaEtaCut", 0.0, "Delta Eta cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; Configurable ConfPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"}; Configurable ConfEtaBins{"ConfEtaBins", 29, "Number of eta bins in deta dphi"}; @@ -162,7 +164,7 @@ struct femtoUniversePairTaskTrackTrack { pairCleaner.init(&qaRegistry); if (ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCut.value, ConfCPRdeltaEtaCut.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); } vPIDPartOne = ConfPIDPartOne.value; diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx index 72dee173ee2..2e8827a8594 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx @@ -159,8 +159,10 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { Configurable ConfNEventsMix{"ConfNEventsMix", 5, "Number of events for mixing"}; Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable ConfCPRdeltaPhiCut{"ConfCPRdeltaPhiCut", 0.0, "Delta Phi cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCut{"ConfCPRdeltaEtaCut", 0.0, "Delta Eta cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; Configurable cfgProcessPM{"cfgProcessPM", false, "Process particles of the opposite charge"}; Configurable cfgProcessPP{"cfgProcessPP", true, "Process particles of the same, positice charge"}; @@ -388,7 +390,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { pairCleaner.init(&qaRegistry); if (ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCut.value, ConfCPRdeltaEtaCut.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); } vPIDPartOne = trackonefilter.ConfPIDPartOne.value; diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackExtended.cxx index 44b6d94b0d4..985c7466ce3 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackExtended.cxx @@ -147,8 +147,10 @@ struct femtoUniversePairTaskTrackTrackExtended { Configurable ConfNEventsMix{"ConfNEventsMix", 5, "Number of events for mixing"}; Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable ConfCPRdeltaPhiCut{"ConfCPRdeltaPhiCut", 0.0, "Delta Phi cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCut{"ConfCPRdeltaEtaCut", 0.0, "Delta Eta cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; Configurable ConfPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"}; Configurable ConfEtaBins{"ConfEtaBins", 29, "Number of eta bins in deta dphi"}; @@ -313,7 +315,7 @@ struct femtoUniversePairTaskTrackTrackExtended { mixedEventCont.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo); pairCleaner.init(&qaRegistry); if (ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCut.value, ConfCPRdeltaEtaCut.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); } vPIDPartOne = trackonefilter.ConfPIDPartOne.value; diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMC.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMC.cxx index 2a4620ad226..2a9a1bb8153 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMC.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMC.cxx @@ -153,8 +153,10 @@ struct femtoUniversePairTaskTrackTrackMC { Configurable ConfNEventsMix{"ConfNEventsMix", 5, "Number of events for mixing"}; Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable ConfCPRdeltaPhiCut{"ConfCPRdeltaPhiCut", 0.0, "Delta Phi cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCut{"ConfCPRdeltaEtaCut", 0.0, "Delta Eta cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; Configurable ConfPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"}; Configurable ConfEtaBins{"ConfEtaBins", 29, "Number of eta bins in deta dphi"}; @@ -385,7 +387,7 @@ struct femtoUniversePairTaskTrackTrackMC { pairCleaner.init(&qaRegistry); if (ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCut.value, ConfCPRdeltaEtaCut.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); } vPIDPartOne = trackonefilter.ConfPIDPartOne.value; diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx index 475776924bb..ff1761f8fb4 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMultKtExtended.cxx @@ -163,8 +163,10 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { Configurable ConfNEventsMix{"ConfNEventsMix", 5, "Number of events for mixing"}; Configurable ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"}; Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; - Configurable ConfCPRdeltaPhiCut{"ConfCPRdeltaPhiCut", 0.0, "Delta Phi cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCut{"ConfCPRdeltaEtaCut", 0.0, "Delta Eta cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; Configurable cfgProcessPM{"cfgProcessPM", false, "Process particles of the opposite charge"}; @@ -398,7 +400,7 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { pairCleaner.init(&qaRegistry); if (ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCut.value, ConfCPRdeltaEtaCut.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); } vPIDPartOne = trackonefilter.ConfPIDPartOne.value; diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx index 4dcafbf7d4c..ed272428a08 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx @@ -103,8 +103,10 @@ struct femtoUniversePairTaskTrackV0Extended { Configurable ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"}; Configurable ConfCPRdeltaPhiMax{"ConfCPRdeltaPhiMax", 0.01, "Max. Delta Phi for Close Pair Rejection"}; Configurable ConfCPRdeltaEtaMax{"ConfCPRdeltaEtaMax", 0.01, "Max. Delta Eta for Close Pair Rejection"}; - Configurable ConfCPRdeltaPhiCut{"ConfCPRdeltaPhiCut", 0.0, "Delta Phi cut for Close Pair Rejection"}; - Configurable ConfCPRdeltaEtaCut{"ConfCPRdeltaEtaCut", 0.0, "Delta Eta cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"}; + Configurable ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"}; Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; Configurable ConfPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"}; Configurable ConfEtaBins{"ConfEtaBins", 29, "Number of eta bins in deta dphi"}; @@ -195,8 +197,8 @@ struct femtoUniversePairTaskTrackV0Extended { pairCleaner.init(&qaRegistry); pairCleanerV0.init(&qaRegistry); if (ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCut.value, ConfCPRdeltaEtaCut.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); - pairCloseRejectionV0.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCut.value, ConfCPRdeltaEtaCut.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); + pairCloseRejectionV0.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value); } } /// This function processes the same event for track - V0 diff --git a/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h b/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h index 13b79930b6e..fcce28e31ca 100644 --- a/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h +++ b/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h @@ -638,9 +638,9 @@ void InsanityChecks() } // *) Seed for random number generator must be non-negative integer: - if (tc.fRandomSeed < 0) { - LOGF(fatal, "in function \033[1;31m%s at line %d\033[0m", __PRETTY_FUNCTION__, __LINE__); - } + // if (tc.fRandomSeed < 0) { + // LOGF(fatal, "in function \033[1;31m%s at line %d\033[0m", __PRETTY_FUNCTION__, __LINE__); + // } // *) Insanity checks on event cuts: if (tc.fProcessRec_Run2 || tc.fProcessRec_Run1) { // From documentation: Bypass this check if you analyse MC or continuous Run3 data. diff --git a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx index ee89277de13..b6528975ee7 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx +++ b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx @@ -87,6 +87,9 @@ TH1F* fhEtaA = nullptr; TH1F* fhPhiB = nullptr; TH1F* fhPhiA = nullptr; +TH2F* fhdEdxB = nullptr; +TH2F* fhdEdxA[kIdBfNoOfSpecies] = {nullptr}; + TH1F* fhDCAxyB = nullptr; TH1F* fhDCAxyA = nullptr; TH1F* fhFineDCAxyA = nullptr; @@ -613,6 +616,7 @@ struct IdentifiedBfFilterTracks { fhEtaB = new TH1F("fHistEtaB", "#eta distribution for reconstructed before;#eta;counts", 40, -2.0, 2.0); fhEtaA = new TH1F("fHistEtaA", "#eta distribution for reconstructed;#eta;counts", etabins, etalow, etaup); fhPhiB = new TH1F("fHistPhiB", "#phi distribution for reconstructed before;#phi;counts", 360, 0.0, constants::math::TwoPI); + fhdEdxB = new TH2F("fHistdEdxB", "dE/dx vs P before; dE/dx (a.u.); P (GeV/c)", 1000, 0.0, 1000.0, 100, 0.0, 15.0); fhPhiA = new TH1F("fHistPhiA", "#phi distribution for reconstructed;#phi;counts", 360, 0.0, constants::math::TwoPI); fhDCAxyB = new TH1F("DCAxyB", "DCA_{xy} distribution for reconstructed before;DCA_{xy} (cm);counts", 1000, -4.0, 4.0); fhDCAxyA = new TH1F("DCAxyA", "DCA_{xy} distribution for reconstructed;DCA_{xy} (cm);counts", 1000, -4., 4.0); @@ -648,6 +652,9 @@ struct IdentifiedBfFilterTracks { fhDeltaNA[sp] = new TH1F(TString::Format("fhDeltaNA_%s", speciesName[sp]).Data(), TString::Format("N(%s^{#plus}) #minus N(%s^{#minus}) distribution for reconstructed;N(%s^{#plus}) #minus N(%s^{#minus})", speciesTitle[sp], speciesTitle[sp], speciesTitle[sp], speciesTitle[sp]).Data(), 79, -39.5, 39.5); + fhdEdxA[sp] = new TH2F(TString::Format("fhdEdxA_%s", speciesName[sp]).Data(), + TString::Format("dE/dx vs P reconstructed %s; dE/dx (a.u.); P (GeV/c)", speciesTitle[sp]).Data(), + 1000, 0.0, 1000.0, ptbins, ptlow, ptup); } /* add the hstograms to the output list */ @@ -659,6 +666,7 @@ struct IdentifiedBfFilterTracks { fOutputList->Add(fhEtaA); fOutputList->Add(fhPhiB); fOutputList->Add(fhPhiA); + fOutputList->Add(fhdEdxB); fOutputList->Add(fhDCAxyB); fOutputList->Add(fhDCAxyA); fOutputList->Add(fhFineDCAxyA); @@ -679,6 +687,7 @@ struct IdentifiedBfFilterTracks { fOutputList->Add(fhPtNegA[sp]); fOutputList->Add(fhNPosNegA[sp]); fOutputList->Add(fhDeltaNA[sp]); + fOutputList->Add(fhdEdxA[sp]); } } @@ -1212,6 +1221,7 @@ void IdentifiedBfFilterTracks::fillTrackHistosBeforeSelection(TrackObject const& fhPtB->Fill(track.pt()); fhEtaB->Fill(track.eta()); fhPhiB->Fill(track.phi()); + fhdEdxB->Fill(track.tpcSignal(), track.p()); if (track.sign() > 0) { fhPtPosB->Fill(track.pt()); } else { @@ -1230,6 +1240,7 @@ void IdentifiedBfFilterTracks::fillTrackHistosAfterSelection(TrackObject const& fhPhiA->Fill(track.phi()); fhDCAxyA->Fill(track.dcaXY()); fhDCAzA->Fill(track.dcaZ()); + if (track.dcaXY() < 1.0) { fhFineDCAxyA->Fill(track.dcaXY()); } @@ -1239,6 +1250,7 @@ void IdentifiedBfFilterTracks::fillTrackHistosAfterSelection(TrackObject const& } fhPA[sp]->Fill(track.p()); fhPtA[sp]->Fill(track.pt()); + fhdEdxA[sp]->Fill(track.tpcSignal(), track.p()); if (track.sign() > 0) { fhPtPosA[sp]->Fill(track.pt()); } else { diff --git a/PWGDQ/Core/CutsLibrary.cxx b/PWGDQ/Core/CutsLibrary.cxx index 7a806b8fd68..700c2943a50 100644 --- a/PWGDQ/Core/CutsLibrary.cxx +++ b/PWGDQ/Core/CutsLibrary.cxx @@ -1020,7 +1020,7 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) vecTypetrack.emplace_back("_TPCstrongncls"); // default TightGlobalTrackRun3 but with 130 TPC clusters // loop to define PID cuts with and without post calibration - for (int icase = 0; icase < vecTypetrack.size(); icase++) { + for (size_t icase = 0; icase < vecTypetrack.size(); icase++) { // 4 cuts to separate pos & neg tracks in pos & neg eta range if (!nameStr.compare(Form("lmee_posTrack_posEta_selection%s", vecTypetrack.at(icase).Data()))) { cut->AddCut(GetAnalysisCut("posTrack")); @@ -1128,7 +1128,7 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) vecPIDcase.emplace_back("_CorrWithKaon"); // case of using post calibrated PID spectra with also the kaons // loop to define PID cuts with and without post calibration - for (int icase = 0; icase < vecPIDcase.size(); icase++) { + for (size_t icase = 0; icase < vecPIDcase.size(); icase++) { if (!nameStr.compare(Form("ITSTPC_TPCPIDalone%s_PbPb", vecPIDcase.at(icase).Data()))) { cut->AddCut(GetAnalysisCut("lmeeStandardKine")); cut->AddCut(GetAnalysisCut("TightGlobalTrackRun3")); @@ -3049,7 +3049,7 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) vecTypetrack.emplace_back("_TPCstrongncls"); // default TightGlobalTrackRun3 but with 130 TPC clusters // loop to define PID cuts with and without post calibration - for (int icase = 1; icase < vecTypetrack.size(); icase++) { + for (size_t icase = 1; icase < vecTypetrack.size(); icase++) { if (!nameStr.compare(Form("lmeeQCTrackCuts%s", vecTypetrack.at(icase).Data()))) { if (icase == 1) { cut->AddCut(VarManager::kIsSPDfirst, 0.5, 1.5); @@ -3483,7 +3483,7 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) vecPIDcase.emplace_back("_CorrWithKaon"); // case of using post calibrated PID spectra with also the kaons // loop to define TPC PID cuts with and without post calibration - for (int icase = 0; icase < vecPIDcase.size(); icase++) { + for (size_t icase = 0; icase < vecPIDcase.size(); icase++) { if (!nameStr.compare(Form("electronPIDOnly%s", vecPIDcase.at(icase).Data()))) { if (icase == 0) { cut->AddCut(VarManager::kTPCnSigmaEl, -3.0, 3.0); @@ -3495,17 +3495,17 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) if (!nameStr.compare(Form("electronPID_TPCnsigma%s_loose", vecPIDcase.at(icase).Data()))) { if (icase == 0) { - cut->AddCut(VarManager::kTPCnSigmaEl, -3., 2., false, VarManager::kPin, 0.0, 1e+10, false); + cut->AddCut(VarManager::kTPCnSigmaEl, -3., 3., false, VarManager::kPin, 0.0, 1e+10, false); cut->AddCut(VarManager::kTPCnSigmaPi, -3., 3.5, true, VarManager::kPin, 0.0, 1e+10, false); cut->AddCut(VarManager::kTPCnSigmaKa, -3., 3., true, VarManager::kPin, 0.0, 1e+10, false); cut->AddCut(VarManager::kTPCnSigmaPr, -3., 3., true, VarManager::kPin, 0.0, 1e+10, false); } else if (icase == 1) { - cut->AddCut(VarManager::kTPCnSigmaEl_Corr, -3., 2., false, VarManager::kPin, 0.0, 1e+10, false); + cut->AddCut(VarManager::kTPCnSigmaEl_Corr, -3., 3., false, VarManager::kPin, 0.0, 1e+10, false); cut->AddCut(VarManager::kTPCnSigmaPi_Corr, -3., 3.5, true, VarManager::kPin, 0.0, 1e+10, false); cut->AddCut(VarManager::kTPCnSigmaKa, -3., 3., true, VarManager::kPin, 0.0, 1e+10, false); cut->AddCut(VarManager::kTPCnSigmaPr_Corr, -3., 3., true, VarManager::kPin, 0.0, 1e+10, false); } else if (icase == 2) { - cut->AddCut(VarManager::kTPCnSigmaEl_Corr, -3., 2., false, VarManager::kPin, 0.0, 1e+10, false); + cut->AddCut(VarManager::kTPCnSigmaEl_Corr, -3., 3., false, VarManager::kPin, 0.0, 1e+10, false); cut->AddCut(VarManager::kTPCnSigmaPi_Corr, -3., 3.5, true, VarManager::kPin, 0.0, 1e+10, false); cut->AddCut(VarManager::kTPCnSigmaKa_Corr, -3., 3., true, VarManager::kPin, 0.0, 1e+10, false); cut->AddCut(VarManager::kTPCnSigmaPr_Corr, -3., 3., true, VarManager::kPin, 0.0, 1e+10, false); @@ -3947,7 +3947,7 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) } // loop to define TOF PID cuts with and without post calibration - for (int icase = 0; icase < vecPIDcase.size(); icase++) { + for (size_t icase = 0; icase < vecPIDcase.size(); icase++) { if (!nameStr.compare(Form("electronPID_TOFnsigma%s_loose", vecPIDcase.at(icase).Data()))) { if (icase == 0) { cut->AddCut(VarManager::kTPCnSigmaEl, -3., 3., false, VarManager::kPin, 0.0, 1e+10, false); diff --git a/PWGDQ/Core/HistogramManager.cxx b/PWGDQ/Core/HistogramManager.cxx index ece01cc78a0..a3834f981a3 100644 --- a/PWGDQ/Core/HistogramManager.cxx +++ b/PWGDQ/Core/HistogramManager.cxx @@ -67,6 +67,9 @@ HistogramManager::HistogramManager(const char* name, const char* title, const in fMainList->SetOwner(kTRUE); fMainList->SetName(name); fUsedVars = new bool[maxNVars]; + for (int i = 0; i < maxNVars; ++i) { + fUsedVars[i] = false; + } fVariableNames = new TString[maxNVars]; fVariableUnits = new TString[maxNVars]; } diff --git a/PWGDQ/Core/HistogramsLibrary.cxx b/PWGDQ/Core/HistogramsLibrary.cxx index 93b24476bd6..45860efca9a 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -600,6 +600,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Eta_vs_EtaMC", "#eta vs MC #eta", false, 50, -1.0, 1.0, VarManager::kEta, 50, -1.0, 1.0, VarManager::kMCEta); hm->AddHistogram(histClass, "Phi_vs_PhiMC", "#varphi vs MC #varphi", false, 50, 0.0, 2. * TMath::Pi(), VarManager::kPhi, 50, 0.0, 2. * TMath::Pi(), VarManager::kMCPhi); hm->AddHistogram(histClass, "TrackPDGcode", "PDG code of track", false, 10001, -5000, 5000, VarManager::kMCPdgCode); + } + if (subGroupStr.Contains("mcMother")) { hm->AddHistogram(histClass, "MotherPDGcode", "PDG code of mother", false, 10001, -5000, 5000, VarManager::kMCMotherPdgCode); } if (subGroupStr.Contains("dmeson")) { diff --git a/PWGDQ/Core/VarManager.cxx b/PWGDQ/Core/VarManager.cxx index 31704c12515..8231ec6858b 100644 --- a/PWGDQ/Core/VarManager.cxx +++ b/PWGDQ/Core/VarManager.cxx @@ -635,10 +635,14 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kS11A] = ""; fgVariableNames[kS12A] = "S_{12}^{A} "; fgVariableUnits[kS12A] = ""; + fgVariableNames[kS21A] = "S_{21}^{A} "; + fgVariableUnits[kS21A] = ""; fgVariableNames[kS13A] = "S_{13}^{A} "; fgVariableUnits[kS13A] = ""; fgVariableNames[kS31A] = "S_{31}^{A} "; fgVariableUnits[kS31A] = ""; + fgVariableNames[kS22A] = "S_{22}^{A} "; + fgVariableUnits[kS22A] = ""; fgVariableNames[kM11REF] = "M_{11}^{REF} "; fgVariableUnits[kM11REF] = ""; fgVariableNames[kM01POI] = "M_{01}^{POI} "; diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index e4e3d895de7..287046f465f 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -518,8 +518,12 @@ class VarManager : public TObject kQ23YA, kS11A, kS12A, + kS21A, kS13A, kS31A, + kS22A, + kS41A, + kS14A, kM11REF, kM01POI, kM1111REF, @@ -2056,12 +2060,14 @@ void VarManager::FillTrackMC(const U& mcStack, T const& track, float* values) values[kMCPt] = track.pt(); values[kMCPhi] = track.phi(); values[kMCEta] = track.eta(); - values[kMCY] = track.y(); + values[kMCY] = -track.y(); values[kMCParticleGeneratorId] = track.producedByGenerator(); - if (track.has_mothers()) { - auto motherId = track.mothersIds()[0]; - auto mother = mcStack.rawIteratorAt(motherId); - values[kMCMotherPdgCode] = mother.pdgCode(); + if (fgUsedVars[kMCMotherPdgCode]) { + if (track.has_mothers()) { + auto motherId = track.mothersIds()[0]; + auto mother = mcStack.rawIteratorAt(motherId); + values[kMCMotherPdgCode] = mother.pdgCode(); + } } FillTrackDerived(values); @@ -3115,8 +3121,12 @@ void VarManager::FillQVectorFromGFW(C const& /*collision*/, A const& compA11, A values[kQ23YA] = compA23.imag(); // Only being used by cumulants, no need for normalization values[kS11A] = S11A; values[kS12A] = S12A; + values[kS21A] = S21A; values[kS13A] = S13A; values[kS31A] = S31A; + values[kS22A] = S22A; + values[kS14A] = S14A; + values[kS41A] = S41A; // Fill event multiplicities values[kMultA] = S10A; @@ -3301,6 +3311,10 @@ void VarManager::FillPairVn(T1 const& t1, T2 const& t2, float* values) values[kM0111POI] = values[kMultDimuons] * (values[kS31A] - 3. * values[kS11A] * values[kS12A] + 2. * values[kS13A]); values[kCORR2POI] = (P2 * conj(Q21)).real() / values[kM01POI]; values[kCORR4POI] = (P2 * Q21 * conj(Q21) * conj(Q21) - P2 * Q21 * conj(Q42) - 2. * values[kS12A] * P2 * conj(Q21) + 2. * P2 * conj(Q23)).real() / values[kM0111POI]; + values[kM11REF] = values[kS21A] - values[kS12A]; + values[kM1111REF] = values[kS41A] - 6. * values[kS12A] * values[kS21A] + 8. * values[kS13A] * values[kS11A] + 3. * values[kS22A] - 6. * values[kS14A]; + values[kCORR2REF] = (norm(Q21) - values[kS12A]) / values[kM11REF]; + values[kCORR4REF] = (pow(norm(Q21), 2) + norm(Q42) - 2. * (Q42 * conj(Q21) * conj(Q21)).real() + 8. * (Q23 * conj(Q21)).real() - 4. * values[kS12A] * norm(Q21) - 6. * values[kS14A] - 2. * values[kS22A]) / values[kM1111REF]; } } diff --git a/PWGDQ/DataModel/ReducedInfoTables.h b/PWGDQ/DataModel/ReducedInfoTables.h index 1ef7a3de9e5..d3e235b206d 100644 --- a/PWGDQ/DataModel/ReducedInfoTables.h +++ b/PWGDQ/DataModel/ReducedInfoTables.h @@ -76,6 +76,10 @@ DECLARE_SOA_COLUMN(S11A, s11a, float); //! Weighted multiplicity (p = 1, DECLARE_SOA_COLUMN(S12A, s12a, float); //! Weighted multiplicity (p = 1, k = 2) DECLARE_SOA_COLUMN(S13A, s13a, float); //! Weighted multiplicity (p = 1, k = 3) DECLARE_SOA_COLUMN(S31A, s31a, float); //! Weighted multiplicity (p = 3, k = 1) +DECLARE_SOA_COLUMN(S21A, s21a, float); //! Weighted multiplicity (p = 2, k = 1) +DECLARE_SOA_COLUMN(S22A, s22a, float); //! Weighted multiplicity (p = 2, k = 2) +DECLARE_SOA_COLUMN(S41A, s41a, float); //! Weighted multiplicity (p = 4, k = 1) +DECLARE_SOA_COLUMN(S14A, s14a, float); //! Weighted multiplicity (p = 1, k = 4) DECLARE_SOA_COLUMN(CORR2REF, corr2ref, float); //! Ref Flow correlator <2> DECLARE_SOA_COLUMN(CORR4REF, corr4ref, float); //! Ref Flow correlator <4> DECLARE_SOA_COLUMN(M11REF, m11ref, float); //! Weighted multiplicity of <<2>> for reference flow @@ -530,6 +534,11 @@ DECLARE_SOA_COLUMN(R2SP, r2sp, float); //! Eve DECLARE_SOA_COLUMN(R2EP, r2ep, float); //! Event plane resolution for EP method DECLARE_SOA_COLUMN(CORR2POI, corr2poi, float); //! POI FLOW CORRELATOR <2'> DECLARE_SOA_COLUMN(CORR4POI, corr4poi, float); //! POI FLOW CORRELATOR <4'> +DECLARE_SOA_COLUMN(CORR2REF, corr2ref, float); //! POI FLOW CORRELATOR <2> (by dimuons) +DECLARE_SOA_COLUMN(CORR4REF, corr4ref, float); //! POI FLOW CORRELATOR <4> (by dimuons) +DECLARE_SOA_COLUMN(M11REF, m11ref, float); //! Weighted multiplicity of <<2>> for reference flow (by dimuons) +DECLARE_SOA_COLUMN(M1111REF, m1111ref, float); //! Weighted multiplicity of <<4>> for reference flow (by dimuons) +DECLARE_SOA_COLUMN(MultA, multa, float); //! Multiplicity A of reference flow (by dimuons) DECLARE_SOA_COLUMN(M01POI, m01poi, float); //! POI event weight for <2'> DECLARE_SOA_COLUMN(M0111POI, m0111poi, float); //! POI event weight for <4'> DECLARE_SOA_COLUMN(MultDimuons, multdimuons, int); //! Dimuon multiplicity @@ -586,6 +595,14 @@ DECLARE_SOA_TABLE(DileptonsFlow, "AOD", "RTDILEPTONFLOW", //! reducedpair::Cos2DeltaPhi, reducedpair::Cos3DeltaPhi); +DECLARE_SOA_TABLE(RefFlowDimuons, "AOD", "RTREFFLOWDIMUON", //! + reducedpair::CORR2REF, + reducedpair::CORR4REF, + reducedpair::M11REF, + reducedpair::M1111REF, + reducedpair::CentFT0C, + reducedpair::MultA); + // Dilepton collision information (joined with DileptonsExtra) allowing to connect different tables (cross PWGs) DECLARE_SOA_TABLE(DileptonsInfo, "AOD", "RTDILEPTONINFO", reducedpair::CollisionId, collision::PosX, collision::PosY, collision::PosZ); @@ -631,6 +648,7 @@ using Dimuon = Dimuons::iterator; using DielectronExtra = DielectronsExtra::iterator; using DimuonExtra = DimuonsExtra::iterator; using DileptonFlow = DileptonsFlow::iterator; +using RefFlowDimuon = RefFlowDimuons::iterator; using DileptonInfo = DileptonsInfo::iterator; using DimuonAll = DimuonsAll::iterator; diff --git a/PWGDQ/TableProducer/tableMaker.cxx b/PWGDQ/TableProducer/tableMaker.cxx index 4d17aff5c8e..10f555f5a02 100644 --- a/PWGDQ/TableProducer/tableMaker.cxx +++ b/PWGDQ/TableProducer/tableMaker.cxx @@ -1555,6 +1555,15 @@ struct TableMaker { } } + void processAssociatedMuonOnlyWithCovAndCent(MyEventsWithCent const& collisions, aod::BCsWithTimestamps const& bcs, + soa::Filtered const& tracksMuon, aod::AmbiguousTracksFwd const&, aod::FwdTrackAssoc const& fwdtrackIndices) + { + for (auto& collision : collisions) { + auto muonIdsThisCollision = fwdtrackIndices.sliceBy(fwdtrackIndicesPerCollision, collision.globalIndex()); + fullSkimmingIndices(collision, bcs, nullptr, tracksMuon, nullptr, muonIdsThisCollision); + } + } + // Produce muon tables only for ambiguous tracks studies -------------------------------------------------------------------------------------- void processAmbiguousMuonOnly(MyEvents const& collisions, aod::BCsWithTimestamps const& bcs, soa::Filtered const& tracksMuon, aod::AmbiguousTracksFwd const& ambiTracksFwd) @@ -1672,6 +1681,7 @@ struct TableMaker { PROCESS_SWITCH(TableMaker, processAmbiguousBarrelOnly, "Build barrel-only DQ skimmed data model with QA plots for ambiguous tracks", false); PROCESS_SWITCH(TableMaker, processAssociatedMuonOnly, "Build muon-only DQ skimmed data model using track-collision association tables", false); PROCESS_SWITCH(TableMaker, processAssociatedMuonOnlyWithCov, "Build muon-only with cov DQ skimmed data model using track-collision association tables", false); + PROCESS_SWITCH(TableMaker, processAssociatedMuonOnlyWithCovAndCent, "Build muon-only with cov DQ skimmed data model using track-collision association tables and centrality", false); PROCESS_SWITCH(TableMaker, processMuonsAndMFT, "Build MFT and muons DQ skimmed data model", false); PROCESS_SWITCH(TableMaker, processMuonsAndMFTWithFilter, "Build MFT and muons DQ skimmed data model, w/ event filter", false); }; diff --git a/PWGDQ/Tasks/dqEfficiency.cxx b/PWGDQ/Tasks/dqEfficiency.cxx index eca1a96e73a..e661f4f7563 100644 --- a/PWGDQ/Tasks/dqEfficiency.cxx +++ b/PWGDQ/Tasks/dqEfficiency.cxx @@ -1272,7 +1272,7 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses) if (classStr.Contains("Track") && !classStr.Contains("Pairs")) { if (classStr.Contains("Barrel")) { - dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", "its,tpcpid,dca,tofpid,mc"); + dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", "its,tpcpid,dca,tofpid,mc,mcMother"); } if (classStr.Contains("Muon")) { dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", "muon"); @@ -1290,15 +1290,17 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses) if (classStr.Contains("MCTruthGenPair")) { dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "mctruth_pair"); - histMan->AddHistogram(objArray->At(iclass)->GetName(), "Pt", "MC generator p_{T} distribution", false, 200, 0.0, 20.0, VarManager::kMCPt); - histMan->AddHistogram(objArray->At(iclass)->GetName(), "Eta", "MC generator #eta distribution", false, 500, -5.0, 5.0, VarManager::kMCEta); - histMan->AddHistogram(objArray->At(iclass)->GetName(), "Phi", "MC generator #varphi distribution", false, 500, -6.3, 6.3, VarManager::kMCPhi); + histMan->AddHistogram(objArray->At(iclass)->GetName(), "Pt", "MC generator p_{T} distribution", false, 120, 0.0, 30.0, VarManager::kMCPt); + histMan->AddHistogram(objArray->At(iclass)->GetName(), "Eta", "MC generator #eta distribution", false, 200, 2.5, 4.0, VarManager::kMCEta); + histMan->AddHistogram(objArray->At(iclass)->GetName(), "Rapidity", "MC generator y distribution", false, 150, 2.5, 4.0, VarManager::kMCY); + histMan->AddHistogram(objArray->At(iclass)->GetName(), "Phi", "MC generator #varphi distribution", false, 50, 0.0, 2. * TMath::Pi(), VarManager::kMCPhi); } if (classStr.Contains("MCTruthGen")) { dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "mctruth"); - histMan->AddHistogram(objArray->At(iclass)->GetName(), "Pt", "MC generator p_{T} distribution", false, 200, 0.0, 20.0, VarManager::kMCPt); - histMan->AddHistogram(objArray->At(iclass)->GetName(), "Eta", "MC generator #eta distribution", false, 500, -5.0, 5.0, VarManager::kMCEta); - histMan->AddHistogram(objArray->At(iclass)->GetName(), "Phi", "MC generator #varphi distribution", false, 500, -6.3, 6.3, VarManager::kMCPhi); + histMan->AddHistogram(objArray->At(iclass)->GetName(), "Pt", "MC generator p_{T} distribution", false, 120, 0.0, 30.0, VarManager::kMCPt); + histMan->AddHistogram(objArray->At(iclass)->GetName(), "Eta", "MC generator #eta distribution", false, 200, 2.5, 4.0, VarManager::kMCEta); + histMan->AddHistogram(objArray->At(iclass)->GetName(), "Rapidity", "MC generator y distribution", false, 150, 2.5, 4.0, VarManager::kMCY); + histMan->AddHistogram(objArray->At(iclass)->GetName(), "Phi", "MC generator #varphi distribution", false, 50, 0.0, 2. * TMath::Pi(), VarManager::kMCPhi); } if (classStr.Contains("DileptonsSelected")) { dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "pair", "barrel,dimuon"); diff --git a/PWGDQ/Tasks/tableReader.cxx b/PWGDQ/Tasks/tableReader.cxx index 3838f40380c..054f7233a03 100644 --- a/PWGDQ/Tasks/tableReader.cxx +++ b/PWGDQ/Tasks/tableReader.cxx @@ -756,6 +756,7 @@ struct AnalysisSameEventPairing { Produces dimuonExtraList; Produces dimuonAllList; Produces dileptonFlowList; + Produces refFlowDimuonList; Produces dileptonInfoList; float mMagField = 0.0; o2::parameters::GRPMagField* grpmag = nullptr; @@ -771,6 +772,7 @@ struct AnalysisSameEventPairing { Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; Configurable fConfigAddSEPHistogram{"cfgAddSEPHistogram", "", "Comma separated list of histograms"}; Configurable fConfigFlatTables{"cfgFlatTables", false, "Produce a single flat tables with all relevant information of the pairs and single tracks"}; + Configurable fConfigAmbiguousHist{"cfgAmbiHist", false, "Enable Ambiguous histograms for time association studies"}; Configurable fConfigMultDimuons{"cfgMultDimuons", false, "Multiplicity for Unlike Dimuons"}; Configurable fConfigUseKFVertexing{"cfgUseKFVertexing", false, "Use KF Particle for secondary vertex reconstruction (DCAFitter is used by default)"}; Configurable fUseRemoteField{"cfgUseRemoteField", false, "Chose whether to fetch the magnetic field from ccdb or set it manually"}; @@ -863,7 +865,11 @@ struct AnalysisSameEventPairing { Form("PairsBarrelSEPM_%s_%s", objArray->At(icut)->GetName(), objArrayPair->At(iPairCut)->GetName()), Form("PairsBarrelSEPP_%s_%s", objArray->At(icut)->GetName(), objArrayPair->At(iPairCut)->GetName()), Form("PairsBarrelSEMM_%s_%s", objArray->At(icut)->GetName(), objArrayPair->At(iPairCut)->GetName())}; - histNames += Form("%s;%s;%s;%s_unambiguous;%s_unambiguous;%s_unambiguous;", names[0].Data(), names[1].Data(), names[2].Data(), names[0].Data(), names[1].Data(), names[2].Data()); + if (fConfigAmbiguousHist) { + histNames += Form("%s;%s;%s;%s_unambiguous;%s_unambiguous;%s_unambiguous;", names[0].Data(), names[1].Data(), names[2].Data(), names[0].Data(), names[1].Data(), names[2].Data()); + } else { + histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); + } fTrackHistNames.push_back(names); } // end loop (pair cuts) } // end if (pair cuts) @@ -882,7 +888,11 @@ struct AnalysisSameEventPairing { Form("PairsMuonSEPM_%s", objArray->At(icut)->GetName()), Form("PairsMuonSEPP_%s", objArray->At(icut)->GetName()), Form("PairsMuonSEMM_%s", objArray->At(icut)->GetName())}; - histNames += Form("%s;%s;%s;%s_unambiguous;%s_unambiguous;%s_unambiguous;", names[0].Data(), names[1].Data(), names[2].Data(), names[0].Data(), names[1].Data(), names[2].Data()); + if (fConfigAmbiguousHist) { + histNames += Form("%s;%s;%s;%s_unambiguous;%s_unambiguous;%s_unambiguous;", names[0].Data(), names[1].Data(), names[2].Data(), names[0].Data(), names[1].Data(), names[2].Data()); + } else { + histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); + } fMuonHistNames.push_back(names); TString cutNamesStr = fConfigPairCuts.value; @@ -1108,6 +1118,7 @@ struct AnalysisSameEventPairing { if constexpr (eventHasQvector) { dileptonFlowList(VarManager::fgValues[VarManager::kU2Q2], VarManager::fgValues[VarManager::kU3Q3], VarManager::fgValues[VarManager::kCos2DeltaPhi], VarManager::fgValues[VarManager::kCos3DeltaPhi]); + refFlowDimuonList(VarManager::fgValues[VarManager::kCORR2REF], VarManager::fgValues[VarManager::kCORR4REF], VarManager::fgValues[VarManager::kM11REF], VarManager::fgValues[VarManager::kM1111REF], VarManager::fgValues[VarManager::kCentFT0C], VarManager::fgValues[VarManager::kMultA]); } int iCut = 0; @@ -1115,18 +1126,18 @@ struct AnalysisSameEventPairing { if (twoTrackFilter & (uint32_t(1) << icut)) { if (t1.sign() * t2.sign() < 0) { fHistMan->FillHistClass(histNames[iCut][0].Data(), VarManager::fgValues); - if (!(t1.isAmbiguous() || t2.isAmbiguous())) { + if (fConfigAmbiguousHist && !(t1.isAmbiguous() || t2.isAmbiguous())) { fHistMan->FillHistClass(Form("%s_unambiguous", histNames[iCut][0].Data()), VarManager::fgValues); } } else { if (t1.sign() > 0) { fHistMan->FillHistClass(histNames[iCut][1].Data(), VarManager::fgValues); - if (!(t1.isAmbiguous() || t2.isAmbiguous())) { + if (fConfigAmbiguousHist && !(t1.isAmbiguous() || t2.isAmbiguous())) { fHistMan->FillHistClass(Form("%s_unambiguous", histNames[iCut][1].Data()), VarManager::fgValues); } } else { fHistMan->FillHistClass(histNames[iCut][2].Data(), VarManager::fgValues); - if (!(t1.isAmbiguous() || t2.isAmbiguous())) { + if (fConfigAmbiguousHist && !(t1.isAmbiguous() || t2.isAmbiguous())) { fHistMan->FillHistClass(Form("%s_unambiguous", histNames[iCut][2].Data()), VarManager::fgValues); } } @@ -1138,18 +1149,18 @@ struct AnalysisSameEventPairing { continue; if (t1.sign() * t2.sign() < 0) { fHistMan->FillHistClass(histNames[iCut][0].Data(), VarManager::fgValues); - if (!(t1.isAmbiguous() || t2.isAmbiguous())) { + if (fConfigAmbiguousHist && !(t1.isAmbiguous() || t2.isAmbiguous())) { fHistMan->FillHistClass(Form("%s_unambiguous", histNames[iCut][0].Data()), VarManager::fgValues); } } else { if (t1.sign() > 0) { fHistMan->FillHistClass(histNames[iCut][1].Data(), VarManager::fgValues); - if (!(t1.isAmbiguous() || t2.isAmbiguous())) { + if (fConfigAmbiguousHist && !(t1.isAmbiguous() || t2.isAmbiguous())) { fHistMan->FillHistClass(Form("%s_unambiguous", histNames[iCut][1].Data()), VarManager::fgValues); } } else { fHistMan->FillHistClass(histNames[iCut][2].Data(), VarManager::fgValues); - if (!(t1.isAmbiguous() || t2.isAmbiguous())) { + if (fConfigAmbiguousHist && !(t1.isAmbiguous() || t2.isAmbiguous())) { fHistMan->FillHistClass(Form("%s_unambiguous", histNames[iCut][2].Data()), VarManager::fgValues); } } @@ -1253,14 +1264,14 @@ struct AnalysisSameEventPairing { VarManager::FillEvent(event, VarManager::fgValues); runSameEventPairing(event, tracks, tracks); } - void processVnDecayToMuMuSkimmed(soa::Filtered::iterator const& event, soa::Filtered const& muons) + void processVnDecayToMuMuSkimmed(soa::Filtered::iterator const& event, soa::Filtered const& muons) { // Reset the fValues array VarManager::ResetValues(0, VarManager::kNVars); - VarManager::FillEvent(event, VarManager::fgValues); - runSameEventPairing(event, muons, muons); + VarManager::FillEvent(event, VarManager::fgValues); + runSameEventPairing(event, muons, muons); } - void processVnDecayToMuMuSkimmedWithWeights(soa::Filtered::iterator const& event, soa::Filtered const& muons) + void processVnDecayToMuMuSkimmedWithWeights(soa::Filtered::iterator const& event, soa::Filtered const& muons) { // Reset the fValues array VarManager::ResetValues(0, VarManager::kNVars); diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index f34b3d73a51..ae4905b2636 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -790,6 +790,7 @@ struct AnalysisSameEventPairing { Produces dimuonsExtraList; Produces dimuonAllList; Produces dileptonFlowList; + Produces refFlowDimuonList; Produces dileptonInfoList; o2::base::MatLayerCylSet* fLUT = nullptr; @@ -1250,6 +1251,7 @@ struct AnalysisSameEventPairing { if constexpr (eventHasQvector) { dileptonFlowList(VarManager::fgValues[VarManager::kU2Q2], VarManager::fgValues[VarManager::kU3Q3], VarManager::fgValues[VarManager::kCos2DeltaPhi], VarManager::fgValues[VarManager::kCos3DeltaPhi]); + refFlowDimuonList(VarManager::fgValues[VarManager::kCORR2REF], VarManager::fgValues[VarManager::kCORR4REF], VarManager::fgValues[VarManager::kM11REF], VarManager::fgValues[VarManager::kM1111REF], VarManager::fgValues[VarManager::kCentFT0C], VarManager::fgValues[VarManager::kMultA]); } // Fill histograms diff --git a/PWGEM/Dilepton/Tasks/MCtemplates.cxx b/PWGEM/Dilepton/Tasks/MCtemplates.cxx index e66af88d751..893f7c84f6e 100644 --- a/PWGEM/Dilepton/Tasks/MCtemplates.cxx +++ b/PWGEM/Dilepton/Tasks/MCtemplates.cxx @@ -182,6 +182,8 @@ struct AnalysisEventSelection { struct AnalysisTrackSelection { Produces trackSel; + Filter filterEventSelected = aod::emanalysisflags::isEventSelected == 1; + Filter filterMCEventSelected = aod::emanalysisflags::isMCEventSelected == 1; OutputObj fOutputList{"output"}; Configurable fConfigCuts{"cfgTrackCuts", "jpsiPID1", "Comma separated list of barrel track cuts"}; Configurable fConfigMCSignals{"cfgTrackMCSignals", "", "Comma separated list of MC signals"}; @@ -249,7 +251,7 @@ struct AnalysisTrackSelection { } template - void runTrackSelection(TTracks const& tracks, TTracksMC const&) + void runTrackSelection(TTracks const& tracks, TTracksMC const&, bool passEvFilter, bool writeTable) { uint32_t filterMap = 0; trackSel.reserve(tracks.size()); @@ -265,7 +267,7 @@ struct AnalysisTrackSelection { VarManager::FillTrack(track.mcParticle()); } - if (fConfigQA) { + if (fConfigQA && passEvFilter) { fHistMan->FillHistClass("TrackBarrel_BeforeCuts", VarManager::fgValues); } @@ -274,13 +276,14 @@ struct AnalysisTrackSelection { for (auto cut = fTrackCuts.begin(); cut != fTrackCuts.end(); cut++, i++) { if ((*cut).IsSelected(VarManager::fgValues)) { filterMap |= (uint32_t(1) << i); - if (fConfigQA) { + if (fConfigQA && passEvFilter) { fHistMan->FillHistClass(fHistNamesReco[i].Data(), VarManager::fgValues); } } } - trackSel(static_cast(filterMap)); - if (!filterMap) { + if (writeTable) + trackSel(static_cast(filterMap)); + if (!filterMap || !passEvFilter) { continue; } @@ -318,13 +321,27 @@ struct AnalysisTrackSelection { } // end loop over tracks } - void processSkimmed(MyBarrelTracks const& tracks, ReducedMCTracks const& tracksMC) + template + void runDataFill(TEvent const& event, TTracks const& tracks, TTracksMC const& tracksMC, bool writeTable) + { + VarManager::ResetValues(0, VarManager::kNEventWiseVariables); + VarManager::ResetValues(0, VarManager::kNMCParticleVariables); + VarManager::FillEvent(event); + + runTrackSelection(tracks, tracksMC, true, writeTable); + } + + void processSkimmed(soa::Filtered::iterator const& event, MyBarrelTracks const& tracks, ReducedMCTracks const& tracksMC) { - runTrackSelection(tracks, tracksMC); + runDataFill(event, tracks, tracksMC, true); } void processAOD(MyBarrelTracksAOD const& tracks, aod::McParticles const& tracksMC) { - runTrackSelection(tracks, tracksMC); + runTrackSelection(tracks, tracksMC, false, true); + } + void processAODFillHist(soa::Filtered::iterator const& event, MyBarrelTracksAOD const& tracks, aod::McParticles const& tracksMC) + { + runDataFill(event, tracks, tracksMC, false); } void processDummy(MyEvents&) @@ -338,6 +355,7 @@ struct AnalysisTrackSelection { PROCESS_SWITCH(AnalysisTrackSelection, processSkimmed, "Run barrel track selection on DQ skimmed tracks", false); PROCESS_SWITCH(AnalysisTrackSelection, processAOD, "Run barrel track selection without skimming", false); + PROCESS_SWITCH(AnalysisTrackSelection, processAODFillHist, "Run barrel track selection without skimming to fill track histograms", false); PROCESS_SWITCH(AnalysisTrackSelection, processDummy, "Dummy process function", false); PROCESS_SWITCH(AnalysisTrackSelection, processDummyAOD, "Dummy process function", false); }; @@ -561,7 +579,6 @@ struct AnalysisSameEventPairing { if constexpr (soa::is_soa_filtered_v) { auto t1_raw = groupedMCTracks.rawIteratorAt(t1.globalIndex()); auto t2_raw = groupedMCTracks.rawIteratorAt(t2.globalIndex()); - // cout << __LINE__ << " COUT LINE: t1_raw = " << t1_raw << ", t2_raw = " << t2_raw << endl; checked = sig.CheckSignal(true, t1_raw, t2_raw); } else { checked = sig.CheckSignal(true, t1, t2); diff --git a/PWGEM/Dilepton/Utils/MCUtilities.h b/PWGEM/Dilepton/Utils/MCUtilities.h index d1b54e7b068..a4cdb572dce 100644 --- a/PWGEM/Dilepton/Utils/MCUtilities.h +++ b/PWGEM/Dilepton/Utils/MCUtilities.h @@ -30,6 +30,61 @@ enum class EM_HFeeType : int { kBCe_Be_SameB = 3, // ULS kBCe_Be_DiffB = 4, // LS }; + +template +int IsFromBeauty(TMCParticle const& p, TMCParticles const& mcparticles) +{ + if (!p.has_mothers()) { + return -999; + } + + int motherid = p.mothersIds()[0]; // first mother index + while (motherid > -1) { + if (motherid < mcparticles.size()) { // protect against bad mother indices. why is this needed? + auto mp = mcparticles.iteratorAt(motherid); + if (abs(mp.pdgCode()) < 1e+9 && (std::to_string(abs(mp.pdgCode()))[std::to_string(abs(mp.pdgCode())).length() - 3] == '5' || std::to_string(abs(mp.pdgCode()))[std::to_string(abs(mp.pdgCode())).length() - 4] == '5')) { + return motherid; + } + if (mp.has_mothers()) { + motherid = mp.mothersIds()[0]; + } else { + return -999; + } + } else { + LOGF(info, "Mother label(%d) exceeds the McParticles size(%d)", motherid, mcparticles.size()); + } + } + + return -999; +} + +template +int IsFromCharm(TMCParticle const& p, TMCParticles const& mcparticles) +{ + if (!p.has_mothers()) { + return -999; + } + + int motherid = p.mothersIds()[0]; // first mother index + while (motherid > -1) { + if (motherid < mcparticles.size()) { // protect against bad mother indices. why is this needed? + auto mp = mcparticles.iteratorAt(motherid); + if (abs(mp.pdgCode()) < 1e+9 && (std::to_string(abs(mp.pdgCode()))[std::to_string(abs(mp.pdgCode())).length() - 3] == '4' || std::to_string(abs(mp.pdgCode()))[std::to_string(abs(mp.pdgCode())).length() - 4] == '4')) { + return motherid; + } + if (mp.has_mothers()) { + motherid = mp.mothersIds()[0]; + } else { + return -999; + } + } else { + LOGF(info, "Mother label(%d) exceeds the McParticles size(%d)", motherid, mcparticles.size()); + } + } + + return -999; +} + template int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcparticles) { @@ -37,7 +92,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp return static_cast(EM_HFeeType::kUndef); } - if (p1.mothersIds()[0] == p2.mothersIds()[0]) { // same mother + if (p1.mothersIds()[0] == p2.mothersIds()[0]) { // reject same mother. e.g. jspi 443 return static_cast(EM_HFeeType::kUndef); // this never happens in correlated HF->ee decays } @@ -81,44 +136,91 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp } } - if (std::to_string(mothers_pdg1[0]).find("5") != std::string::npos && std::to_string(mothers_pdg2[0]).find("5") != std::string::npos) { - return static_cast(EM_HFeeType::kBe_Be); // bb->ee, decay type = 2 - // this is easy. first mother is b hadron for both leg. - } - - if (std::to_string(mothers_pdg1[0]).find("4") != std::string::npos && std::to_string(mothers_pdg2[0]).find("4") != std::string::npos) { - // mother is c hadron. next, check c is prompt or non-prompt. + bool is_direct_from_b1 = abs(mothers_pdg1[0]) < 1e+9 && (std::to_string(mothers_pdg1[0])[std::to_string(mothers_pdg1[0]).length() - 3] == '5' || std::to_string(mothers_pdg1[0])[std::to_string(mothers_pdg1[0]).length() - 4] == '5'); + bool is_direct_from_b2 = abs(mothers_pdg2[0]) < 1e+9 && (std::to_string(mothers_pdg2[0])[std::to_string(mothers_pdg2[0]).length() - 3] == '5' || std::to_string(mothers_pdg2[0])[std::to_string(mothers_pdg2[0]).length() - 4] == '5'); + bool is_prompt_c1 = abs(mothers_pdg1[0]) < 1e+9 && (std::to_string(mothers_pdg1[0])[std::to_string(mothers_pdg1[0]).length() - 3] == '4' || std::to_string(mothers_pdg1[0])[std::to_string(mothers_pdg1[0]).length() - 4] == '4') && IsFromBeauty(p1, mcparticles) < 0; + bool is_prompt_c2 = abs(mothers_pdg2[0]) < 1e+9 && (std::to_string(mothers_pdg2[0])[std::to_string(mothers_pdg2[0]).length() - 3] == '4' || std::to_string(mothers_pdg2[0])[std::to_string(mothers_pdg2[0]).length() - 4] == '4') && IsFromBeauty(p2, mcparticles) < 0; + bool is_c_from_b1 = abs(mothers_pdg1[0]) < 1e+9 && (std::to_string(mothers_pdg1[0])[std::to_string(mothers_pdg1[0]).length() - 3] == '4' || std::to_string(mothers_pdg1[0])[std::to_string(mothers_pdg1[0]).length() - 4] == '4') && IsFromBeauty(p1, mcparticles) > 0; + bool is_c_from_b2 = abs(mothers_pdg2[0]) < 1e+9 && (std::to_string(mothers_pdg2[0])[std::to_string(mothers_pdg2[0]).length() - 3] == '4' || std::to_string(mothers_pdg2[0])[std::to_string(mothers_pdg2[0]).length() - 4] == '4') && IsFromBeauty(p2, mcparticles) > 0; - bool is_c_from_b1 = false; - for (unsigned int i1 = 1; i1 < mothers_pdg1.size(); i1++) { - if (std::to_string(mothers_pdg1[i1]).find("5") != std::string::npos) { - is_c_from_b1 = true; - break; - } - } - bool is_c_from_b2 = false; - for (unsigned int i2 = 1; i2 < mothers_pdg2.size(); i2++) { - if (std::to_string(mothers_pdg2[i2]).find("5") != std::string::npos) { - is_c_from_b2 = true; - break; - } - } - - if (!is_c_from_b1 && !is_c_from_b2) { - return static_cast(EM_HFeeType::kCe_Ce); // prompt cc->ee, decay type = 0 - } else if (is_c_from_b1 && is_c_from_b2) { - return static_cast(EM_HFeeType::kBCe_BCe); // b->c->e and b->c->e, decay type = 1 - } else { + if (is_prompt_c1 && is_prompt_c2 && p1.pdgCode() * p2.pdgCode() < 0) { + mothers_id1.clear(); + mothers_pdg1.clear(); + mothers_id2.clear(); + mothers_pdg2.clear(); + mothers_id1.shrink_to_fit(); + mothers_pdg1.shrink_to_fit(); + mothers_id2.shrink_to_fit(); + mothers_pdg2.shrink_to_fit(); + return static_cast(EM_HFeeType::kCe_Ce); // cc->ee, decay type = 0 + } else if (is_direct_from_b1 && is_direct_from_b2 && p1.pdgCode() * p2.pdgCode() < 0) { + mothers_id1.clear(); + mothers_pdg1.clear(); + mothers_id2.clear(); + mothers_pdg2.clear(); + mothers_id1.shrink_to_fit(); + mothers_pdg1.shrink_to_fit(); + mothers_id2.shrink_to_fit(); + mothers_pdg2.shrink_to_fit(); + return static_cast(EM_HFeeType::kBe_Be); // bb->ee, decay type = 2 + } else if (is_c_from_b1 && is_c_from_b2 && p1.pdgCode() * p2.pdgCode() < 0) { + mothers_id1.clear(); + mothers_pdg1.clear(); + mothers_id2.clear(); + mothers_pdg2.clear(); + mothers_id1.shrink_to_fit(); + mothers_pdg1.shrink_to_fit(); + mothers_id2.shrink_to_fit(); + mothers_pdg2.shrink_to_fit(); + return static_cast(EM_HFeeType::kBCe_BCe); // b->c->e and b->c->e, decay type = 1 + } else if ((is_direct_from_b1 && is_c_from_b2) || (is_direct_from_b2 && is_c_from_b1)) { + if (p1.pdgCode() * p2.pdgCode() < 0) { // ULS + for (auto& mid1 : mothers_id1) { + for (auto& mid2 : mothers_id2) { + if (mid1 == mid2) { + auto common_mp = mcparticles.iteratorAt(mid1); + int mp_pdg = common_mp.pdgCode(); + if (abs(mp_pdg) < 1e+9 && (std::to_string(abs(mp_pdg))[std::to_string(abs(mp_pdg)).length() - 3] == '5' || std::to_string(abs(mp_pdg))[std::to_string(abs(mp_pdg)).length() - 4] == '5')) { + mothers_id1.clear(); + mothers_pdg1.clear(); + mothers_id2.clear(); + mothers_pdg2.clear(); + mothers_id1.shrink_to_fit(); + mothers_pdg1.shrink_to_fit(); + mothers_id2.shrink_to_fit(); + mothers_pdg2.shrink_to_fit(); + return static_cast(EM_HFeeType::kBCe_Be_SameB); // b->c->e and b->e, decay type = 3. this should happen only in ULS. + } + } + } // end of motherid2 + } // end of motherid1 + } else { // LS + bool is_same_mother_found = false; for (auto& mid1 : mothers_id1) { for (auto& mid2 : mothers_id2) { if (mid1 == mid2) { - return static_cast(EM_HFeeType::kBCe_Be_SameB); // b->c->e and c->e, decay type = 3. this should happen only in ULS. + auto common_mp = mcparticles.iteratorAt(mid1); + int mp_pdg = common_mp.pdgCode(); + if (abs(mp_pdg) < 1e+9 && (std::to_string(abs(mp_pdg))[std::to_string(abs(mp_pdg)).length() - 3] == '5' || std::to_string(abs(mp_pdg))[std::to_string(abs(mp_pdg)).length() - 4] == '5')) { + is_same_mother_found = true; + } } - } // end of mother id 2 - } // end of mother id 1 - return static_cast(EM_HFeeType::kBCe_Be_DiffB); // b->c->e and c->e, decay type = 4. this should happen only in LS. But, this may happen, when ele/pos is reconstructed as pos/ele wrongly. and create LS pair + } // end of motherid2 + } // end of motherid1 + if (!is_same_mother_found) { + mothers_id1.clear(); + mothers_pdg1.clear(); + mothers_id2.clear(); + mothers_pdg2.clear(); + mothers_id1.shrink_to_fit(); + mothers_pdg1.shrink_to_fit(); + mothers_id2.shrink_to_fit(); + mothers_pdg2.shrink_to_fit(); + return static_cast(EM_HFeeType::kBCe_Be_DiffB); // b->c->e and b->e, decay type = 4. this should happen only in LS. But, this may happen, when ele/pos is reconstructed as pos/ele wrongly. and create LS pair + } } } + mothers_id1.clear(); mothers_pdg1.clear(); mothers_id2.clear(); diff --git a/PWGEM/PhotonMeson/Core/CutsLibrary.cxx b/PWGEM/PhotonMeson/Core/CutsLibrary.cxx index 6583fe589ba..be3a6297fd4 100644 --- a/PWGEM/PhotonMeson/Core/CutsLibrary.cxx +++ b/PWGEM/PhotonMeson/Core/CutsLibrary.cxx @@ -41,35 +41,56 @@ EMEventCut* o2::aod::pwgem::photon::eventcuts::GetCut(const char* cutName) EMEventCut* cut = new EMEventCut(cutName, cutName); std::string nameStr = cutName; - if (!nameStr.compare("minbias")) { - cut->SetRequireFT0AND(true); - cut->SetZvtxRange(-10.f, +10.f); - cut->SetRequireNoTFB(false); - cut->SetRequireNoITSROFB(false); - return cut; - } - if (!nameStr.compare("nocut")) { + cut->SetRequireSel8(false); cut->SetRequireFT0AND(false); cut->SetZvtxRange(-1e+10, +1e+10); cut->SetRequireNoTFB(false); cut->SetRequireNoITSROFB(false); + cut->SetRequireNoSameBunchPileup(false); + cut->SetRequireVertexITSTPC(false); + cut->SetRequireIsGoodZvtxFT0vsPV(false); return cut; } - if (!nameStr.compare("minbias_notfb")) { + if (!nameStr.compare("ft0and")) { + cut->SetRequireSel8(false); cut->SetRequireFT0AND(true); cut->SetZvtxRange(-10.f, +10.f); - cut->SetRequireNoTFB(true); + cut->SetRequireNoTFB(false); cut->SetRequireNoITSROFB(false); + cut->SetRequireNoSameBunchPileup(false); + cut->SetRequireVertexITSTPC(false); + cut->SetRequireIsGoodZvtxFT0vsPV(false); return cut; } - if (!nameStr.compare("minbias_notfb_noitsrofb")) { + if (!nameStr.compare("minbias")) { + cut->SetRequireSel8(true); cut->SetRequireFT0AND(true); cut->SetZvtxRange(-10.f, +10.f); - cut->SetRequireNoTFB(true); - cut->SetRequireNoITSROFB(true); + cut->SetRequireNoTFB(false); // included in sel8 + cut->SetRequireNoITSROFB(false); // included in sel8 + cut->SetRequireNoSameBunchPileup(false); + cut->SetRequireVertexITSTPC(false); + cut->SetRequireIsGoodZvtxFT0vsPV(false); + + if (nameStr.find("notfb") != std::string::npos) { + cut->SetRequireNoTFB(true); + } + if (nameStr.find("noitsrofb") != std::string::npos) { + cut->SetRequireNoITSROFB(true); + } + if (nameStr.find("nosbp") != std::string::npos) { + cut->SetRequireNoSameBunchPileup(true); + } + if (nameStr.find("vtxitstpc") != std::string::npos) { + cut->SetRequireVertexITSTPC(true); + } + if (nameStr.find("goodvtx") != std::string::npos) { + cut->SetRequireIsGoodZvtxFT0vsPV(true); + } + return cut; } @@ -424,7 +445,7 @@ DalitzEECut* o2::aod::pwgem::photon::dalitzeecuts::GetCut(const char* cutName) if (!nameStr.compare("nocut")) { // apply kinetic cuts - cut->SetTrackPtRange(0.05, 1e+10f); + cut->SetTrackPtRange(0.1, 1e+10f); cut->SetTrackEtaRange(-0.9, +0.9); // for pair @@ -434,11 +455,11 @@ DalitzEECut* o2::aod::pwgem::photon::dalitzeecuts::GetCut(const char* cutName) cut->ApplyPrefilter(false); // for track cuts - cut->SetMinNCrossedRowsTPC(100); + cut->SetMinNCrossedRowsTPC(40); cut->SetMinNCrossedRowsOverFindableClustersTPC(0.8); cut->SetChi2PerClusterTPC(0.0, 4.0); cut->SetChi2PerClusterITS(0.0, 5.0); - cut->SetNClustersITS(5, 7); + cut->SetNClustersITS(4, 7); cut->SetMaxDcaXY(1.0); cut->SetMaxDcaZ(1.0); return cut; diff --git a/PWGEM/PhotonMeson/Core/EMEventCut.cxx b/PWGEM/PhotonMeson/Core/EMEventCut.cxx index b605d2c7e8b..244dc762dc5 100644 --- a/PWGEM/PhotonMeson/Core/EMEventCut.cxx +++ b/PWGEM/PhotonMeson/Core/EMEventCut.cxx @@ -18,7 +18,13 @@ ClassImp(EMEventCut); -const char* EMEventCut::mCutNames[static_cast(EMEventCut::EMEventCuts::kNCuts)] = {"RequireFT0AND", "Zvtx", "RequireNoTFB", "RequireNoITSROFB"}; +const char* EMEventCut::mCutNames[static_cast(EMEventCut::EMEventCuts::kNCuts)] = {"Sel8", "FT0AND", "Zvtx", "eNoTFB", "RequireNoITSROFB", "NoSameBunchPileup", "GoodVertexITSTPC", "GoodZvtxFT0vsPV"}; + +void EMEventCut::SetRequireSel8(bool flag) +{ + mRequireSel8 = flag; + LOG(info) << "EM Event Cut, require sel8: " << mRequireSel8; +} void EMEventCut::SetRequireFT0AND(bool flag) { @@ -45,6 +51,24 @@ void EMEventCut::SetRequireNoITSROFB(bool flag) LOG(info) << "EM Event Cut, require No ITS ROF border: " << mRequireNoITSROFB; } +void EMEventCut::SetRequireNoSameBunchPileup(bool flag) +{ + mRequireNoSameBunchPileup = flag; + LOG(info) << "EM Event Cut, require No same bunch pileup: " << mRequireNoSameBunchPileup; +} + +void EMEventCut::SetRequireVertexITSTPC(bool flag) +{ + mRequireVertexITSTPC = flag; + LOG(info) << "EM Event Cut, require vertex reconstructed by ITS-TPC matched track: " << mRequireVertexITSTPC; +} + +void EMEventCut::SetRequireIsGoodZvtxFT0vsPV(bool flag) +{ + mRequireGoodZvtxFT0vsPV = flag; + LOG(info) << "EM Event Cut, require good Zvtx between FT0 vs. PV: " << mRequireGoodZvtxFT0vsPV; +} + void EMEventCut::print() const { LOG(info) << "EM Event Cut:"; diff --git a/PWGEM/PhotonMeson/Core/EMEventCut.h b/PWGEM/PhotonMeson/Core/EMEventCut.h index 8fc86e0bb93..cb225ad1c24 100644 --- a/PWGEM/PhotonMeson/Core/EMEventCut.h +++ b/PWGEM/PhotonMeson/Core/EMEventCut.h @@ -29,10 +29,14 @@ class EMEventCut : public TNamed EMEventCut(const char* name, const char* title) : TNamed(name, title) {} enum class EMEventCuts : int { - kFT0AND = 0, // i.e. sel8 + kSel8 = 0, + kFT0AND, kZvtx, kNoTFB, // no time frame border kNoITSROFB, // no ITS read out frame border + kNoSameBunchPileup, + kIsVertexITSTPC, + kIsGoodZvtxFT0vsPV, kNCuts }; @@ -41,6 +45,9 @@ class EMEventCut : public TNamed template bool IsSelected(T const& collision) const { + if (mRequireSel8 && !IsSelected(collision, EMEventCuts::kSel8)) { + return false; + } if (mRequireFT0AND && !IsSelected(collision, EMEventCuts::kFT0AND)) { return false; } @@ -53,6 +60,15 @@ class EMEventCut : public TNamed if (mRequireNoITSROFB && !IsSelected(collision, EMEventCuts::kNoITSROFB)) { return false; } + if (mRequireNoSameBunchPileup && !IsSelected(collision, EMEventCuts::kNoSameBunchPileup)) { + return false; + } + if (mRequireVertexITSTPC && !IsSelected(collision, EMEventCuts::kIsVertexITSTPC)) { + return false; + } + if (mRequireGoodZvtxFT0vsPV && !IsSelected(collision, EMEventCuts::kIsGoodZvtxFT0vsPV)) { + return false; + } return true; } @@ -60,9 +76,11 @@ class EMEventCut : public TNamed bool IsSelected(T const& collision, const EMEventCuts& cut) const { switch (cut) { - case EMEventCuts::kFT0AND: + case EMEventCuts::kSel8: return collision.sel8(); - // return collision.selection_bit(o2::aod::evsel::kIsTriggerTVX); // alternative way. + + case EMEventCuts::kFT0AND: + return collision.selection_bit(o2::aod::evsel::kIsTriggerTVX); case EMEventCuts::kZvtx: return mMinZvtx < collision.posZ() && collision.posZ() < mMaxZvtx; @@ -73,25 +91,42 @@ class EMEventCut : public TNamed case EMEventCuts::kNoITSROFB: return collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder); + case EMEventCuts::kNoSameBunchPileup: + return collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup); + + case EMEventCuts::kIsVertexITSTPC: + return collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC); + + case EMEventCuts::kIsGoodZvtxFT0vsPV: + return collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV); + default: return false; } } // Setters + void SetRequireSel8(bool flag); void SetRequireFT0AND(bool flag); void SetZvtxRange(float min, float max); void SetRequireNoTFB(bool flag); void SetRequireNoITSROFB(bool flag); + void SetRequireNoSameBunchPileup(bool flag); + void SetRequireVertexITSTPC(bool flag); + void SetRequireIsGoodZvtxFT0vsPV(bool flag); /// @brief Print the track selection void print() const; private: + bool mRequireSel8{true}; bool mRequireFT0AND{true}; float mMinZvtx{-10.f}, mMaxZvtx{+10.f}; bool mRequireNoTFB{true}; bool mRequireNoITSROFB{true}; + bool mRequireNoSameBunchPileup{false}; + bool mRequireVertexITSTPC{false}; + bool mRequireGoodZvtxFT0vsPV{false}; ClassDef(EMEventCut, 1); }; diff --git a/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx b/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx index e413a235f3d..50174ab9e08 100644 --- a/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx +++ b/PWGEM/PhotonMeson/Core/HistogramsLibrary.cxx @@ -204,19 +204,19 @@ void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const } if (TString(histClass).Contains("EE")) { - const int nm = 167; + const int nm = 145; double mee[nm] = {0.f}; for (int i = 0; i < 110; i++) { mee[i] = 0.01 * (i - 0) + 0.0; // every 0.01 GeV/c2 up to 1.1 GeV/c2 } - for (int i = 110; i < 128; i++) { - mee[i] = 0.1 * (i - 110) + 1.1; // every 0.1 GeV/c2 from 1.1 to 2.9 GeV/c2 + for (int i = 110; i < 126; i++) { + mee[i] = 0.1 * (i - 110) + 1.1; // every 0.1 GeV/c2 from 1.1 to 2.7 GeV/c2 } - for (int i = 128; i < 158; i++) { - mee[i] = 0.01 * (i - 128) + 2.9; // every 0.01 GeV/c2 from 2.9 to 3.2 GeV/c2 + for (int i = 126; i < 136; i++) { + mee[i] = 0.05 * (i - 126) + 2.7; // every 0.05 GeV/c2 from 2.7 to 3.2 GeV/c2 } - for (int i = 158; i < nm; i++) { - mee[i] = 0.1 * (i - 158) + 3.2; // every 0.01 GeV/c2 from 3.2 to 3.5 GeV/c2 + for (int i = 136; i < nm; i++) { + mee[i] = 0.1 * (i - 136) + 3.2; // every 0.1 GeV/c2 from 3.2 to 4.0 GeV/c2 } const int npt = 61; @@ -228,39 +228,45 @@ void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const pt[i] = 0.5 * (i - 50) + 5.0; } - const int ndim = 4; // m, pt, dca, phiv - const int nbins[ndim] = {nm - 1, npt - 1, ndca - 1, 18}; - const double xmin[ndim] = {0.0, 0.0, 0.0, 0.0}; - const double xmax[ndim] = {4.0, 10.0, 5.0, M_PI}; + const int ndim = 3; // m, pt, dca + const int nbins[ndim] = {nm - 1, npt - 1, ndca - 1}; + const double xmin[ndim] = {0.0, 0.0, 0.0}; + const double xmax[ndim] = {4.0, 10.0, 5.0}; - hs_dilepton_uls_same = new THnSparseF("hs_dilepton_uls_same", "hs_dilepton_uls;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c);DCA_{ee}^{3D} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); + hs_dilepton_uls_same = new THnSparseF("hs_dilepton_uls_same", "hs_dilepton_uls;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c);DCA_{ee}^{3D} (#sigma);", ndim, nbins, xmin, xmax); hs_dilepton_uls_same->SetBinEdges(0, mee); hs_dilepton_uls_same->SetBinEdges(1, pt); hs_dilepton_uls_same->SetBinEdges(2, dca); hs_dilepton_uls_same->Sumw2(); list->Add(hs_dilepton_uls_same); - hs_dilepton_lspp_same = new THnSparseF("hs_dilepton_lspp_same", "hs_dilepton_lspp;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c);DCA_{ee}^{3D} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); + hs_dilepton_lspp_same = new THnSparseF("hs_dilepton_lspp_same", "hs_dilepton_lspp;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c);DCA_{ee}^{3D} (#sigma);", ndim, nbins, xmin, xmax); hs_dilepton_lspp_same->SetBinEdges(0, mee); hs_dilepton_lspp_same->SetBinEdges(1, pt); hs_dilepton_lspp_same->SetBinEdges(2, dca); hs_dilepton_lspp_same->Sumw2(); list->Add(hs_dilepton_lspp_same); - hs_dilepton_lsmm_same = new THnSparseF("hs_dilepton_lsmm_same", "hs_dilepton_lsmm;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c);DCA_{ee}^{3D} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); + hs_dilepton_lsmm_same = new THnSparseF("hs_dilepton_lsmm_same", "hs_dilepton_lsmm;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c);DCA_{ee}^{3D} (#sigma);", ndim, nbins, xmin, xmax); hs_dilepton_lsmm_same->SetBinEdges(0, mee); hs_dilepton_lsmm_same->SetBinEdges(1, pt); hs_dilepton_lsmm_same->SetBinEdges(2, dca); hs_dilepton_lsmm_same->Sumw2(); list->Add(hs_dilepton_lsmm_same); + TH2F* hMvsPhiV_uls_same = new TH2F("hMvsPhiV_uls_same", "m_{ee} vs. #varphi_{V};#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", 72, 0, M_PI, 100, 0.0f, 0.1f); + hMvsPhiV_uls_same->Sumw2(); + list->Add(hMvsPhiV_uls_same); + list->Add(reinterpret_cast(hMvsPhiV_uls_same->Clone("hMvsPhiV_lspp_same"))); + list->Add(reinterpret_cast(hMvsPhiV_uls_same->Clone("hMvsPhiV_lsmm_same"))); + 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); + list->Add(reinterpret_cast(hs_dilepton_uls_same->Clone("hs_dilepton_uls_mix"))); + list->Add(reinterpret_cast(hs_dilepton_lspp_same->Clone("hs_dilepton_lspp_mix"))); + list->Add(reinterpret_cast(hs_dilepton_lsmm_same->Clone("hs_dilepton_lsmm_mix"))); + list->Add(reinterpret_cast(hMvsPhiV_uls_same->Clone("hMvsPhiV_uls_mix"))); + list->Add(reinterpret_cast(hMvsPhiV_uls_same->Clone("hMvsPhiV_lspp_mix"))); + list->Add(reinterpret_cast(hMvsPhiV_uls_same->Clone("hMvsPhiV_lsmm_mix"))); } if (TString(subGroup).Contains("dca")) { @@ -299,35 +305,43 @@ void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const list->Add(new TH2F("hMvsOPA_Pi0", "m_{ee} vs. opening angle;opening angle (rad.);m_{ee} (GeV/c^{2})", 500, 0, 0.5, 100, 0.0f, 0.1f)); // ee from pi0 dalitz decay list->Add(new TH2F("hMvsOPA_Eta", "m_{ee} vs. opening angle;opening angle (rad.);m_{ee} (GeV/c^{2})", 500, 0, 0.5, 100, 0.0f, 0.1f)); // ee from eta dalitz decay list->Add(new TH2F("hMvsOPA_Photon", "m_{ee} vs. opening angle;opening angle (rad.);m_{ee} (GeV/c^{2})", 500, 0, 0.5, 100, 0.0f, 0.1f)); // ee from photon conversion - } // end of mc + + static constexpr std::string_view parnames_LMEE[] = {"Pi0", "Eta", "EtaPrime", "Rho", "Omega", "Phi", "PromptJpsi", "NonPromptJpsi", "Ce_Ce", "Be_Be", "BCe_BCe", "BCe_Be_SameB", "BCe_Be_DiffB"}; + const int npar_lmee = sizeof(parnames_LMEE) / sizeof(parnames_LMEE[0]); + for (int i = 0; i < npar_lmee; i++) { + THnSparseF* hs_dilepton_mc_rec = new THnSparseF(Form("hs_dilepton_mc_rec_%s", parnames_LMEE[i].data()), Form("hs_dilepton_mc_rec from %s;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c);DCA_{ee}^{3D} (#sigma);#varphi_{V} (rad.);", parnames_LMEE[i].data()), ndim, nbins, xmin, xmax); + hs_dilepton_mc_rec->SetBinEdges(0, mee); + hs_dilepton_mc_rec->SetBinEdges(1, pt); + hs_dilepton_mc_rec->SetBinEdges(2, dca); + hs_dilepton_mc_rec->Sumw2(); + list->Add(hs_dilepton_mc_rec); + } + } // end of mc } else if (TString(histClass).Contains("MuMu")) { - const int ndim = 4; // m, pt, dca, phiv - const int nbins[ndim] = {90, 20, ndca - 1, 1}; - const double xmin[ndim] = {0.2, 0.0, 0.0, 0.0}; - const double xmax[ndim] = {1.1, 2.0, 5.0, 3.2}; + const int ndim = 3; // m, pt, dca + const int nbins[ndim] = {90, 20, ndca - 1}; + const double xmin[ndim] = {0.2, 0.0, 0.0}; + const double xmax[ndim] = {1.1, 2.0, 5.0}; - hs_dilepton_uls_same = new THnSparseF("hs_dilepton_uls_same", "hs_dilepton_uls;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{#mu#mu}^{3D} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); + hs_dilepton_uls_same = new THnSparseF("hs_dilepton_uls_same", "hs_dilepton_uls;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{#mu#mu}^{3D} (#sigma);", ndim, nbins, xmin, xmax); hs_dilepton_uls_same->Sumw2(); hs_dilepton_uls_same->SetBinEdges(2, dca); list->Add(hs_dilepton_uls_same); - hs_dilepton_lspp_same = new THnSparseF("hs_dilepton_lspp_same", "hs_dilepton_lspp;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{#mu#mu}^{3D} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); + hs_dilepton_lspp_same = new THnSparseF("hs_dilepton_lspp_same", "hs_dilepton_lspp;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{#mu#mu}^{3D} (#sigma);", ndim, nbins, xmin, xmax); hs_dilepton_lspp_same->Sumw2(); hs_dilepton_lspp_same->SetBinEdges(2, dca); list->Add(hs_dilepton_lspp_same); - hs_dilepton_lsmm_same = new THnSparseF("hs_dilepton_lsmm_same", "hs_dilepton_lsmm;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{#mu#mu}^{3D} (#sigma);#varphi_{V} (rad.);", ndim, nbins, xmin, xmax); + hs_dilepton_lsmm_same = new THnSparseF("hs_dilepton_lsmm_same", "hs_dilepton_lsmm;m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c);DCA_{#mu#mu}^{3D} (#sigma);", ndim, nbins, xmin, xmax); hs_dilepton_lsmm_same->Sumw2(); hs_dilepton_lsmm_same->SetBinEdges(2, dca); list->Add(hs_dilepton_lsmm_same); 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); + list->Add(reinterpret_cast(hs_dilepton_uls_same->Clone("hs_dilepton_uls_mix"))); + list->Add(reinterpret_cast(hs_dilepton_lspp_same->Clone("hs_dilepton_lspp_mix"))); + list->Add(reinterpret_cast(hs_dilepton_lsmm_same->Clone("hs_dilepton_lsmm_mix"))); } } else { LOGF(info, "EE or MuMu are supported."); @@ -429,10 +443,10 @@ void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const if (TString(histClass) == "singlephoton") { if (TString(subGroup).Contains("qvector")) { - list->Add(new TH2F("hPt_SPQ2FT0M", "p_{T,#gamma} vs. SP;p_{T,#gamma} (GeV/c);u_{2}^{#gamma} #upoint Q_{2}^{FT0M}", 400, 0.0f, 20, 200, -10, +10)); - list->Add(new TH2F("hPt_SPQ2FT0A", "p_{T,#gamma} vs. SP;p_{T,#gamma} (GeV/c);u_{2}^{#gamma} #upoint Q_{2}^{FT0A}", 400, 0.0f, 20, 200, -10, +10)); - list->Add(new TH2F("hPt_SPQ2FT0C", "p_{T,#gamma} vs. SP;p_{T,#gamma} (GeV/c);u_{2}^{#gamma} #upoint Q_{2}^{FT0C}", 400, 0.0f, 20, 200, -10, +10)); - list->Add(new TH2F("hPt_SPQ2FV0A", "p_{T,#gamma} vs. SP;p_{T,#gamma} (GeV/c);u_{2}^{#gamma} #upoint Q_{2}^{FV0A}", 400, 0.0f, 20, 200, -10, +10)); + list->Add(new TH2F("hPt_SPQ2FT0M", "p_{T,#gamma} vs. SP;p_{T,#gamma} (GeV/c);u_{2}^{#gamma} #upoint Q_{2}^{FT0M}", 400, 0.0f, 20, 40, -10, +10)); + list->Add(new TH2F("hPt_SPQ2FT0A", "p_{T,#gamma} vs. SP;p_{T,#gamma} (GeV/c);u_{2}^{#gamma} #upoint Q_{2}^{FT0A}", 400, 0.0f, 20, 40, -10, +10)); + list->Add(new TH2F("hPt_SPQ2FT0C", "p_{T,#gamma} vs. SP;p_{T,#gamma} (GeV/c);u_{2}^{#gamma} #upoint Q_{2}^{FT0C}", 400, 0.0f, 20, 40, -10, +10)); + list->Add(new TH2F("hPt_SPQ2FV0A", "p_{T,#gamma} vs. SP;p_{T,#gamma} (GeV/c);u_{2}^{#gamma} #upoint Q_{2}^{FV0A}", 400, 0.0f, 20, 40, -10, +10)); reinterpret_cast(list->FindObject("hPt_SPQ2FT0M"))->Sumw2(); reinterpret_cast(list->FindObject("hPt_SPQ2FT0A"))->Sumw2(); reinterpret_cast(list->FindObject("hPt_SPQ2FT0C"))->Sumw2(); @@ -479,11 +493,11 @@ void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const if (TString(subGroup).Contains("qvector")) { const int ndim_sp = 3; - const int nbins_sp[ndim_sp] = {nmgg - 1, npTgg - 1, 200}; + const int nbins_sp[ndim_sp] = {nmgg - 1, npTgg - 1, 40}; const double xmin_sp[ndim_sp] = {0.0, 0.0, -10.f}; const double xmax_sp[ndim_sp] = {0.8, 20.0, +10.f}; - THnSparseF* hs_same_tmp = new THnSparseF("hs_same_tmp", "hs_same_tmp;m_{#gamma#gamma} (GeV/c^{2});p_{T,#gamma#gamma} (GeV/c);u_{2}^{#gamma#gamma}#upointQ_{2}^{FT0M};", ndim_sp, nbins_sp, xmin_sp, xmax_sp); + THnSparseF* hs_same_tmp = new THnSparseF("hs_same_tmp", "hs_same_tmp;m_{#gamma#gamma} (GeV/c^{2});p_{T,#gamma#gamma} (GeV/c);u_{2}^{#gamma#gamma} #upoint Q_{2}^{FT0M};", ndim_sp, nbins_sp, xmin_sp, xmax_sp); hs_same_tmp->SetBinEdges(0, mgg); hs_same_tmp->SetBinEdges(1, pTgg); hs_same_tmp->Sumw2(); @@ -491,7 +505,7 @@ void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const for (int i = 0; i < 4; i++) { THnSparseF* hs = reinterpret_cast(hs_same_tmp->Clone(Form("hs_Same_SPQ2%s", sp_names[i].data()))); hs->SetTitle(Form("diphoton info %s", sp_names[i].data())); - hs->GetAxis(2)->SetTitle(Form("u_{2}^{#gamma#gamma}#upointQ_{2}^{%s}", sp_names[i].data())); + hs->GetAxis(2)->SetTitle(Form("u_{2}^{#gamma#gamma} #upoint Q_{2}^{%s}", sp_names[i].data())); list->Add(hs); } } else { @@ -597,6 +611,15 @@ void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const TH2F* hMvsPt = new TH2F("hMvsPt", "m_{ee} vs. p_{T,ee};m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", 400, 0, 4.0f, 1000, 0, 10.f); hMvsPt->Sumw2(); list->Add(hMvsPt); + + static constexpr std::string_view parnames_LMEE[] = {"Pi0", "Eta", "EtaPrime", "Rho", "Omega", "Phi", "PromptJpsi", "NonPromptJpsi", "Ce_Ce", "Be_Be", "BCe_BCe", "BCe_Be_SameB", "BCe_Be_DiffB"}; + const int npar_lmee = sizeof(parnames_LMEE) / sizeof(parnames_LMEE[0]); + for (int i = 0; i < npar_lmee; i++) { + TH2F* hMvsPt = new TH2F(Form("hMvsPt_%s", parnames_LMEE[i].data()), Form("m_{ee} vs. p_{T,ee} from MC %s;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", parnames_LMEE[i].data()), 400, 0, 4.0f, 1000, 0, 10.f); + hMvsPt->Sumw2(); + list->Add(hMvsPt); + } + } else if (TString(subGroup) == "dimuon") { TH2F* hMvsPt = new TH2F("hMvsPt", "m_{#mu#mu} vs. p_{T,#mu#mu};m_{#mu#mu} (GeV/c^{2});p_{T,#mu#mu} (GeV/c)", 90, 0.2, 1.1f, 200, 0, 2.f); hMvsPt->Sumw2(); @@ -655,32 +678,46 @@ void o2::aod::pwgem::photon::histogram::DefineHistograms(THashList* list, const 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.5}; + + const int ndca_hbt = 27; + double dca_hbt[ndca_hbt] = {0.f}; + for (int i = 0; i < 20; i++) { + dca_hbt[i] = 0.1 * i; + } + for (int i = 20; i < ndca_hbt; i++) { + dca_hbt[i] = 0.5 * (i - 20) + 2.0; + } + 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.5, 2.5, 1.0, 0.4}; + const int ndim_1d = 6; // m1, m2, dca1, dca2, kt, qinv + const int nbins_1d[ndim_1d] = {nm_hbt - 1, nm_hbt - 1, ndca_hbt - 1, ndca_hbt - 1, 10, 40}; + const double xmin_1d[ndim_1d] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; + const double xmax_1d[ndim_1d] = {2.5, 2.5, 5.0, 5.0, 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 = new THnSparseF("hs_q_same", "hs_q_same;m_{1} (GeV/c^{2});m_{2} (GeV/c^{2});DCA_{1}^{3D} (#sigma);DCA_{2}^{3D} (#sigma);k_{T} (GeV/c);q_{inv} (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_same->SetBinEdges(2, dca_hbt); + hs_q_same->SetBinEdges(3, dca_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.5, 2.5, 1.0, 0.4, +0.4, +0.4, +0.4, +0.4}; + const int ndim_3d = 10; // m1, m2, dca1, dca2, kt, qinv, qlong_cms, qout_cms, qside_cms, qlong_lcms + const int nbins_3d[ndim_3d] = {nm_hbt - 1, nm_hbt - 1, ndca_hbt - 1, ndca_hbt - 1, 10, 40, 80, 80, 80, 80}; + const double xmin_3d[ndim_3d] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.4, -0.4, -0.4, -0.4}; + const double xmax_3d[ndim_3d] = {2.5, 2.5, 2.0, 2.0, 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 = new THnSparseF("hs_q_same", "hs_q_same;m_{1} (GeV/c^{2});m_{2} (GeV/c^{2});DCA_{1}^{3D} (#sigma);DCA_{2}^{3D} (#sigma);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_same->SetBinEdges(2, dca_hbt); + hs_q_same->SetBinEdges(3, dca_hbt); hs_q_mix = reinterpret_cast(hs_q_same->Clone("hs_q_mix")); list->Add(hs_q_same); list->Add(hs_q_mix); diff --git a/PWGEM/PhotonMeson/TableProducer/associateMCinfo.cxx b/PWGEM/PhotonMeson/TableProducer/associateMCinfo.cxx index 707b29b16ec..78321d4dbf5 100644 --- a/PWGEM/PhotonMeson/TableProducer/associateMCinfo.cxx +++ b/PWGEM/PhotonMeson/TableProducer/associateMCinfo.cxx @@ -216,6 +216,54 @@ struct AssociateMCInfo { fEventIdx[mctrack.globalIndex()] = fEventLabels.find(mcCollision.globalIndex())->second; fCounters[0]++; } + + bool is_used_for_gen = false; + if ((mctrack.isPhysicalPrimary() || mctrack.producedByGenerator()) && (abs(pdg) == 11 || abs(pdg) == 13) && mctrack.has_mothers()) { + auto mp = mctrack.template mothers_first_as(); // mother particle of electron + int pdg_mother = abs(mp.pdgCode()); + + bool is_from_sm = pdg_mother == 111 || pdg_mother == 221 || pdg_mother == 331 || pdg_mother == 113 || pdg_mother == 223 || pdg_mother == 333 || pdg_mother == 443 || pdg_mother == 100443 || pdg_mother == 553 || pdg_mother == 100553 || pdg_mother == 200553; + bool is_from_c_hadron = std::to_string(pdg_mother)[std::to_string(pdg_mother).length() - 3] == '4' || std::to_string(pdg_mother)[std::to_string(pdg_mother).length() - 4] == '4'; + bool is_from_b_hadron = std::to_string(pdg_mother)[std::to_string(pdg_mother).length() - 3] == '5' || std::to_string(pdg_mother)[std::to_string(pdg_mother).length() - 4] == '5'; + + if ((is_from_sm || is_from_c_hadron || is_from_b_hadron)) { + is_used_for_gen = true; + } + } + + if (is_used_for_gen) { + // Next, store mother-chain for only HF->l, because HF->ll analysis requires correlation between HF hadrons or quarks. PLEASE DON'T do this for other partices. + int motherid = -999; // first mother index + if (mctrack.has_mothers()) { + motherid = mctrack.mothersIds()[0]; // first mother index + } + while (motherid > -1) { + if (motherid < mcTracks.size()) { // protect against bad mother indices. why is this needed? + auto mp = mcTracks.iteratorAt(motherid); + + if (abs(mp.pdgCode()) < 100) { // don't store quark/gluon informaiton, because data size explodes. + break; + } + + // if the MC truth particle corresponding to this reconstructed track which is not already written, add it to the skimmed MC stack + if (!(fNewLabels.find(mp.globalIndex()) != fNewLabels.end())) { + fNewLabels[mp.globalIndex()] = fCounters[0]; + fNewLabelsReversed[fCounters[0]] = mp.globalIndex(); + // fMCFlags[mp.globalIndex()] = mcflags; + fEventIdx[mp.globalIndex()] = fEventLabels.find(mcCollision.globalIndex())->second; + fCounters[0]++; + } + + if (mp.has_mothers()) { + motherid = mp.mothersIds()[0]; // first mother index + } else { + motherid = -999; + } + } else { + motherid = -999; + } + } // end of mother chain loop + } } // end of mc track loop if constexpr (static_cast(system & kPCM)) { @@ -485,6 +533,11 @@ struct AssociateMCInfo { const uint8_t sysflag = kPCM | kDalitzEE; skimmingMC(collisions, bcs, mccollisions, mcTracks, o2tracks, v0photons, v0legs, nullptr, nullptr, emprimaryelectrons, nullptr); } + void processMC_DalitzEE(MyCollisionsMC const& collisions, aod::BCs const& bcs, aod::McCollisions const& mccollisions, aod::McParticles const& mcTracks, TracksMC const& o2tracks, aod::EMPrimaryElectrons const& emprimaryelectrons) + { + const uint8_t sysflag = kDalitzEE; + skimmingMC(collisions, bcs, mccollisions, mcTracks, o2tracks, nullptr, nullptr, nullptr, nullptr, emprimaryelectrons, nullptr); + } void processMC_PCM_DalitzEE_DalitzMuMu(MyCollisionsMC const& collisions, aod::BCs const& bcs, aod::McCollisions const& mccollisions, aod::McParticles const& mcTracks, TracksMC const& o2tracks, aod::V0PhotonsKF const& v0photons, aod::V0Legs const& v0legs, aod::EMPrimaryElectrons const& emprimaryelectrons, aod::EMPrimaryMuons const& emprimarymuons) { const uint8_t sysflag = kPCM | kDalitzEE | kDalitzMuMu; @@ -539,6 +592,7 @@ struct AssociateMCInfo { PROCESS_SWITCH(AssociateMCInfo, processMC_PCM, "create em mc event table for PCM", false); PROCESS_SWITCH(AssociateMCInfo, processMC_PCM_DalitzEE, "create em mc event table for PCM, DalitzEE", false); + PROCESS_SWITCH(AssociateMCInfo, processMC_DalitzEE, "create em mc event table for DalitzEE", false); PROCESS_SWITCH(AssociateMCInfo, processMC_PCM_DalitzEE_DalitzMuMu, "create em mc event table for PCM, DalitzEE, DalitzMuMu", false); PROCESS_SWITCH(AssociateMCInfo, processMC_PHOS, "create em mc event table for PHOS", false); PROCESS_SWITCH(AssociateMCInfo, processMC_EMC, "create em mc event table for EMCal", false); diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx index e3548da7210..65746d4f46f 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerDalitzEE.cxx @@ -60,6 +60,7 @@ struct skimmerDalitzEE { Configurable maxeta{"maxeta", 0.9, "eta acceptance for loose track sample"}; Configurable minTPCNsigmaEl{"minTPCNsigmaEl", -2.5, "min. TPC n sigma for electron inclusion"}; Configurable maxTPCNsigmaEl{"maxTPCNsigmaEl", 3.5, "max. TPC n sigma for electron inclusion"}; + Configurable maxTOFNsigmaEl{"maxTOFNsigmaEl", 4.0, "max. TOF n sigma for electron inclusion"}; Configurable min_ncluster_tpc{"min_ncluster_tpc", 10, "min ncluster tpc"}; Configurable mincrossedrows{"mincrossedrows", 40, "min. crossed rows"}; Configurable min_tpc_cr_findable_ratio{"min_tpc_cr_findable_ratio", 0.8, "min. TPC Ncr/Nf ratio"}; @@ -71,6 +72,14 @@ struct skimmerDalitzEE { Configurable dca_3d_sigma_max{"dca_3d_sigma_max", 1e+10, "max DCA 3D in sigma"}; Configurable max_mean_itsob_cluster_size{"max_mean_itsob_cluster_size", 16.f, "max. x cos(lambda)"}; // this is to suppress random combination. default 4 + 1 for skimming. + Configurable applyTPChadrejORTOFreq{"applyTPChadrejORTOFreq", false, "flag to apply TPChadrej-or-TOFreq at the skimming level"}; + Configurable applyPiRej_TPC{"applyPiRej_TPC", false, "flag to apply Pion rejection in TPC at the skimming level"}; + Configurable applyKaRej_TPC{"applyKaRej_TPC", false, "flag to apply Kaon rejection in TPC at the skimming level"}; + Configurable applyPrRej_TPC{"applyPrRej_TPC", false, "flag to apply Proton rejection in TPC at the skimming level"}; + Configurable maxTPCNsigmaPi{"maxTPCNsigmaPi", 2.0, "max. TPC n sigma for pion exclusion"}; + Configurable maxTPCNsigmaKa{"maxTPCNsigmaKa", 2.0, "max. TPC n sigma for kaon exclusion"}; + Configurable maxTPCNsigmaPr{"maxTPCNsigmaPr", 2.0, "max. TPC n sigma for proton exclusion"}; + HistogramRegistry fRegistry{ "fRegistry", { @@ -136,9 +145,52 @@ struct skimmerDalitzEE { return false; } + if (!isElectron(track)) { + return false; + } + + return true; + } + + template + bool isElectron(TTrack const& track) + { + if (applyTPChadrejORTOFreq) { + return isElectron_TPChadrej(track) || isElectron_TOFrequire(track); + } else { + return true; + } return true; } + template + bool isElectron_TPChadrej(TTrack const& track) + { + if (track.tpcNSigmaEl() < minTPCNsigmaEl || maxTPCNsigmaEl < track.tpcNSigmaEl()) { + return false; + } + if (applyPiRej_TPC && abs(track.tpcNSigmaPi()) < maxTPCNsigmaPi) { + return false; + } + if (applyKaRej_TPC && abs(track.tpcNSigmaKa()) < maxTPCNsigmaKa) { + return false; + } + if (applyPrRej_TPC && abs(track.tpcNSigmaPr()) < maxTPCNsigmaPr) { + return false; + } + + return true; + } + + template + bool isElectron_TOFrequire(TTrack const& track) + { + if (applyPiRej_TPC && abs(track.tpcNSigmaPi()) < maxTPCNsigmaPi) { + return false; + } + return minTPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < maxTPCNsigmaEl && abs(track.tofNSigmaEl()) < maxTOFNsigmaEl; + } + template int fillPairTable(TCollision const& collision, TTracks1 const& tracks1, TTracks2 const& tracks2) { diff --git a/PWGEM/PhotonMeson/Tasks/PhotonHBT.cxx b/PWGEM/PhotonMeson/Tasks/PhotonHBT.cxx index efc973237c4..8713ab7ba48 100644 --- a/PWGEM/PhotonMeson/Tasks/PhotonHBT.cxx +++ b/PWGEM/PhotonMeson/Tasks/PhotonHBT.cxx @@ -290,8 +290,11 @@ struct PhotonHBT { 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_1d[4] = {0.f}; - double values_3d[8] = {0.f}; + float dca_pos1_3d = 999.f, dca_ele1_3d = 999.f, dca_ee1_3d = 999.f; + float dca_pos2_3d = 999.f, dca_ele2_3d = 999.f, dca_ee2_3d = 999.f; + + double values_1d[6] = {0.f}; + double values_3d[10] = {0.f}; if constexpr (pairtype == PairType::kPCMPCM || pairtype == PairType::kPHOSPHOS || pairtype == PairType::kEMCEMC || pairtype == PairType::kDalitzEEDalitzEE) { for (auto& cut : cuts1) { for (auto& paircut : paircuts) { @@ -300,8 +303,8 @@ struct PhotonHBT { continue; } - values_1d[0] = 0.0, values_1d[1] = 0.0; - values_3d[0] = 0.0, values_3d[1] = 0.0; + values_1d[0] = 0.0, values_1d[1] = 0.0, values_1d[2] = 0.0, values_1d[3] = 0.0; + values_3d[0] = 0.0, values_3d[1] = 0.0, values_3d[2] = 0.0, values_3d[3] = 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.); @@ -319,6 +322,18 @@ struct PhotonHBT { values_1d[1] = g2.mass(); values_3d[0] = g1.mass(); values_3d[1] = g2.mass(); + + dca_pos1_3d = pos1.dca3DinSigma(); + dca_ele1_3d = ele1.dca3DinSigma(); + dca_ee1_3d = std::sqrt((dca_pos1_3d * dca_pos1_3d + dca_ele1_3d * dca_ele1_3d) / 2.); + values_1d[2] = dca_ee1_3d; + values_3d[2] = dca_ee1_3d; + + dca_pos2_3d = pos2.dca3DinSigma(); + dca_ele2_3d = ele2.dca3DinSigma(); + dca_ee2_3d = std::sqrt((dca_pos2_3d * dca_pos2_3d + dca_ele2_3d * dca_ele2_3d) / 2.); + values_1d[3] = dca_ee2_3d; + values_3d[3] = dca_ee2_3d; } ROOT::Math::PtEtaPhiMVector q12 = v1 - v2; @@ -326,8 +341,8 @@ struct PhotonHBT { float qinv = -q12.M(); float kt = k12.Pt(); - values_1d[2] = kt; - values_1d[3] = qinv; + values_1d[4] = kt; + values_1d[5] = qinv; if (fConfigDo3D) { // float qt = q12.Pt(); @@ -356,12 +371,12 @@ struct PhotonHBT { // 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; + values_3d[4] = kt; + values_3d[5] = qinv; + values_3d[6] = qlong_cms; + values_3d[7] = qout_cms; + values_3d[8] = qside_cms; + values_3d[9] = 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); @@ -388,23 +403,30 @@ struct PhotonHBT { } } - values_1d[0] = 0.0, values_1d[1] = 0.0; - values_3d[0] = 0.0, values_3d[1] = 0.0; + values_1d[0] = 0.0, values_1d[1] = 0.0, values_1d[2] = 0.0, values_1d[3] = 0.0; + values_3d[0] = 0.0, values_3d[1] = 0.0, values_3d[2] = 0.0, values_3d[3] = 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) { + auto pos2 = g2.template posTrack_as(); + auto ele2 = g2.template negTrack_as(); v2.SetM(g2.mass()); values_1d[1] = g2.mass(); values_3d[1] = g2.mass(); + dca_pos2_3d = pos2.dca3DinSigma(); + dca_ele2_3d = ele2.dca3DinSigma(); + dca_ee2_3d = std::sqrt((dca_pos2_3d * dca_pos2_3d + dca_ele2_3d * dca_ele2_3d) / 2.); + values_1d[3] = dca_ee2_3d; + values_3d[3] = dca_ee2_3d; } ROOT::Math::PtEtaPhiMVector q12 = v1 - v2; ROOT::Math::PtEtaPhiMVector k12 = 0.5 * (v1 + v2); float qinv = -q12.M(); float kt = k12.Pt(); - values_1d[2] = kt; - values_1d[3] = qinv; + values_1d[4] = kt; + values_1d[5] = qinv; if (fConfigDo3D) { // float qt = q12.Pt(); @@ -425,12 +447,12 @@ struct PhotonHBT { 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; + values_3d[4] = kt; + values_3d[5] = qinv; + values_3d[6] = qlong_cms; + values_3d[7] = qout_cms; + values_3d[8] = qside_cms; + values_3d[9] = 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); @@ -478,8 +500,10 @@ struct PhotonHBT { auto photons_coll2 = photons2.sliceBy(perCollision2, collision2.globalIndex()); // 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_1d[4] = {0.f}; - double values_3d[8] = {0.f}; + float dca_pos1_3d = 999.f, dca_ele1_3d = 999.f, dca_ee1_3d = 999.f; + float dca_pos2_3d = 999.f, dca_ele2_3d = 999.f, dca_ee2_3d = 999.f; + double values_1d[6] = {0.f}; + double values_3d[10] = {0.f}; for (auto& cut1 : cuts1) { for (auto& cut2 : cuts2) { for (auto& paircut : paircuts) { @@ -497,28 +521,51 @@ struct PhotonHBT { } // center-of-mass system (CMS) - values_1d[0] = 0.0, values_1d[1] = 0.0; - values_3d[0] = 0.0, values_3d[1] = 0.0; + values_1d[0] = 0.0, values_1d[1] = 0.0, values_1d[2] = 0.0, values_1d[3] = 0.0; + values_3d[0] = 0.0, values_3d[1] = 0.0, values_3d[2] = 0.0, values_3d[3] = 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) { + auto pos2 = g2.template posTrack_as(); + auto ele2 = g2.template negTrack_as(); v2.SetM(g2.mass()); values_1d[1] = g2.mass(); values_3d[1] = g2.mass(); + dca_pos2_3d = pos2.dca3DinSigma(); + dca_ele2_3d = ele2.dca3DinSigma(); + dca_ee2_3d = std::sqrt((dca_pos2_3d * dca_pos2_3d + dca_ele2_3d * dca_ele2_3d) / 2.); + values_1d[3] = dca_ee2_3d; + values_3d[3] = dca_ee2_3d; } else 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(); 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(); + + dca_pos1_3d = pos1.dca3DinSigma(); + dca_ele1_3d = ele1.dca3DinSigma(); + dca_ee1_3d = std::sqrt((dca_pos1_3d * dca_pos1_3d + dca_ele1_3d * dca_ele1_3d) / 2.); + values_1d[2] = dca_ee1_3d; + values_3d[2] = dca_ee1_3d; + + dca_pos2_3d = pos2.dca3DinSigma(); + dca_ele2_3d = ele2.dca3DinSigma(); + dca_ee2_3d = std::sqrt((dca_pos2_3d * dca_pos2_3d + dca_ele2_3d * dca_ele2_3d) / 2.); + values_1d[3] = dca_ee2_3d; + values_3d[3] = dca_ee2_3d; } ROOT::Math::PtEtaPhiMVector q12 = v1 - v2; ROOT::Math::PtEtaPhiMVector k12 = 0.5 * (v1 + v2); float qinv = -q12.M(); float kt = k12.Pt(); - values_1d[2] = kt; - values_1d[3] = qinv; + values_1d[4] = kt; + values_1d[5] = qinv; if (fConfigDo3D) { // float qt = q12.Pt(); @@ -540,12 +587,12 @@ struct PhotonHBT { 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; + values_3d[4] = kt; + values_3d[5] = qinv; + values_3d[6] = qlong_cms; + values_3d[7] = qout_cms; + values_3d[8] = qside_cms; + values_3d[9] = 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); diff --git a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGamma.cxx b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGamma.cxx index 62a41b87fb2..16a7aa1ddf3 100644 --- a/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGamma.cxx +++ b/PWGEM/PhotonMeson/Tasks/Pi0EtaToGammaGamma.cxx @@ -453,14 +453,14 @@ struct Pi0EtaToGammaGamma { if (cfgDoFlow) { values[0] = v12.M(), values[1] = v12.Pt(); - std::array u_gg = {static_cast(v12.Px() / v12.Pt()), static_cast(v12.Py() / v12.Pt())}; - values[2] = RecoDecay::dotProd(u_gg, q2ft0m); + std::array u2_gg = {static_cast(std::cos(2 * v12.Phi())), static_cast(std::sin(2 * v12.Phi()))}; + values[2] = RecoDecay::dotProd(u2_gg, q2ft0m); reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut.GetName(), cut.GetName()))->FindObject(paircut.GetName())->FindObject("hs_Same_SPQ2FT0M"))->Fill(values); - values[2] = RecoDecay::dotProd(u_gg, q2ft0a); + values[2] = RecoDecay::dotProd(u2_gg, q2ft0a); reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut.GetName(), cut.GetName()))->FindObject(paircut.GetName())->FindObject("hs_Same_SPQ2FT0A"))->Fill(values); - values[2] = RecoDecay::dotProd(u_gg, q2ft0c); + values[2] = RecoDecay::dotProd(u2_gg, q2ft0c); reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut.GetName(), cut.GetName()))->FindObject(paircut.GetName())->FindObject("hs_Same_SPQ2FT0C"))->Fill(values); - values[2] = RecoDecay::dotProd(u_gg, q2fv0a); + values[2] = RecoDecay::dotProd(u2_gg, q2fv0a); reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut.GetName(), cut.GetName()))->FindObject(paircut.GetName())->FindObject("hs_Same_SPQ2FV0A"))->Fill(values); } else { reinterpret_cast(list_pair_ss->FindObject(Form("%s_%s", cut.GetName(), cut.GetName()))->FindObject(paircut.GetName())->FindObject("hMggPt_Same"))->Fill(v12.M(), v12.Pt()); diff --git a/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx b/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx index 20fc7af46af..6f8d87a1fd3 100644 --- a/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx +++ b/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx @@ -319,11 +319,11 @@ struct SinglePhoton { continue; } if (cfgDoFlow) { - std::array u_photon = {photon.px() / photon.pt(), photon.py() / photon.pt()}; - reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0M"))->Fill(photon.pt(), RecoDecay::dotProd(u_photon, q2ft0m)); - reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0A"))->Fill(photon.pt(), RecoDecay::dotProd(u_photon, q2ft0a)); - reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0C"))->Fill(photon.pt(), RecoDecay::dotProd(u_photon, q2ft0c)); - reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FV0A"))->Fill(photon.pt(), RecoDecay::dotProd(u_photon, q2fv0a)); + std::array u2_photon = {std::cos(2 * photon.phi()), std::sin(2 * photon.phi())}; + reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0M"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2ft0m)); + reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0A"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2ft0a)); + reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FT0C"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2ft0c)); + reinterpret_cast(list_photon_det_cut->FindObject("hPt_SPQ2FV0A"))->Fill(photon.pt(), RecoDecay::dotProd(u2_photon, q2fv0a)); } else { reinterpret_cast(list_photon_det_cut->FindObject("hPt"))->Fill(photon.pt()); } diff --git a/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx index cf3118ccfc1..c7f03892676 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzEEQC.cxx @@ -140,15 +140,13 @@ struct DalitzEEQC { Preslice perCollision_track = aod::emprimaryelectron::emeventId; Partition grouped_collisions = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); // this goes to same event. - std::vector used_trackIds; - void processQC(MyCollisions const&, MyDalitzEEs const&, MyTracks const&) { THashList* list_ev_before = static_cast(fMainList->FindObject("Event")->FindObject(event_types[0].data())); THashList* list_ev_after = static_cast(fMainList->FindObject("Event")->FindObject(event_types[1].data())); THashList* list_dalitzee = static_cast(fMainList->FindObject("DalitzEE")); THashList* list_track = static_cast(fMainList->FindObject("Track")); - double values[4] = {0, 0, 0, 0}; + double values[3] = {0, 0, 0}; double values_single[4] = {0, 0, 0, 0}; float dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; @@ -173,6 +171,8 @@ struct DalitzEEQC { for (const auto& cut : fDalitzEECuts) { THashList* list_dalitzee_cut = static_cast(list_dalitzee->FindObject(cut.GetName())); THashList* list_track_cut = static_cast(list_track->FindObject(cut.GetName())); + + std::vector used_trackIds; used_trackIds.reserve(uls_pairs_per_coll.size() * 2); int nuls = 0, nlspp = 0, nlsmm = 0; @@ -195,8 +195,8 @@ struct DalitzEEQC { values[0] = uls_pair.mass(); values[1] = uls_pair.pt(); values[2] = dca_ee_3d; - values[3] = uls_pair.phiv(); reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_uls_same"))->Fill(values); + reinterpret_cast(list_dalitzee_cut->FindObject("hMvsPhiV_uls_same"))->Fill(uls_pair.phiv(), uls_pair.mass()); nuls++; for (auto& track : {pos, ele}) { if (std::find(used_trackIds.begin(), used_trackIds.end(), track.globalIndex()) == used_trackIds.end()) { @@ -226,8 +226,8 @@ struct DalitzEEQC { values[0] = lspp_pair.mass(); values[1] = lspp_pair.pt(); values[2] = dca_ee_3d; - values[3] = lspp_pair.phiv(); reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_lspp_same"))->Fill(values); + reinterpret_cast(list_dalitzee_cut->FindObject("hMvsPhiV_lspp_same"))->Fill(lspp_pair.phiv(), lspp_pair.mass()); nlspp++; } } // end of lspp pair loop @@ -252,8 +252,8 @@ struct DalitzEEQC { values[0] = lsmm_pair.mass(); values[1] = lsmm_pair.pt(); values[2] = dca_ee_3d; - values[3] = lsmm_pair.phiv(); reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_lsmm_same"))->Fill(values); + reinterpret_cast(list_dalitzee_cut->FindObject("hMvsPhiV_lsmm_same"))->Fill(lsmm_pair.phiv(), lsmm_pair.mass()); nlsmm++; } } // end of lsmm pair loop @@ -286,7 +286,7 @@ struct DalitzEEQC { void MixedEventPairing(TEvents const& collisions, TTracks const& tracks, TMixedBinning const& colBinning) { THashList* list_dalitzee = static_cast(fMainList->FindObject("DalitzEE")); - double values[4] = {0, 0, 0, 0}; + double values[3] = {0, 0, 0}; ROOT::Math::PtEtaPhiMVector v1, v2, v12; float phiv = 0; double values_single[4] = {0, 0, 0, 0}; @@ -317,6 +317,13 @@ struct DalitzEEQC { v2 = ROOT::Math::PtEtaPhiMVector(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassElectron); v12 = v1 + v2; phiv = getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), collision1.bz()); + // if (!std::isfinite(phiv)) { + // LOGF(info, "t1.px() = %f, t1.py() = %f, t1.pz() = %f, t2.px() = %f, t2.py() = %f, t2.pz() = %f, phiv = %f", t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), phiv); + // } + + if (t1.trackId() == t2.trackId()) { // this is protection against pairing identical 2 tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. + continue; + } dca_pos_3d = t1.dca3DinSigma(); dca_ele_3d = t2.dca3DinSigma(); @@ -330,15 +337,17 @@ struct DalitzEEQC { values[0] = v12.M(); values[1] = v12.Pt(); values[2] = dca_ee_3d; - values[3] = phiv; if (cut.IsSelectedTrack(t1) && cut.IsSelectedTrack(t2) && cut.IsSelectedPair(v12.M(), dca_ee_3d, phiv)) { if (t1.sign() * t2.sign() < 0) { reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_uls_mix"))->Fill(values); + reinterpret_cast(list_dalitzee_cut->FindObject("hMvsPhiV_uls_mix"))->Fill(phiv, v12.M()); } else if (t1.sign() > 0 && t2.sign() > 0) { reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_lspp_mix"))->Fill(values); + reinterpret_cast(list_dalitzee_cut->FindObject("hMvsPhiV_lspp_mix"))->Fill(phiv, v12.M()); } else if (t1.sign() < 0 && t2.sign() < 0) { reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_lsmm_mix"))->Fill(values); + reinterpret_cast(list_dalitzee_cut->FindObject("hMvsPhiV_lsmm_mix"))->Fill(phiv, v12.M()); } else { LOGF(info, "This should not happen."); } diff --git a/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx index 043b21f9843..529fe4031fe 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzEEQCMC.cxx @@ -29,6 +29,7 @@ #include "PWGEM/PhotonMeson/Core/CutsLibrary.h" #include "PWGEM/PhotonMeson/Core/HistogramsLibrary.h" #include "PWGEM/PhotonMeson/Utils/MCUtilities.h" +#include "PWGEM/Dilepton/Utils/MCUtilities.h" using namespace o2; using namespace o2::aod; @@ -37,6 +38,7 @@ using namespace o2::framework::expressions; using namespace o2::soa; using namespace o2::aod::pwgem::mcutil; using namespace o2::aod::pwgem::photon; +using namespace o2::aod::pwgem::dilepton::mcutil; using std::array; using MyCollisions = soa::Join; @@ -148,27 +150,27 @@ struct DalitzEEQCMC { int FindLF(TTrack const& posmc, TTrack const& elemc, TMCTracks const& mcparticles) { int arr[] = { - FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 111, mcparticles), FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 221, mcparticles), FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 331, mcparticles), FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 113, mcparticles), FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 223, mcparticles), FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 333, mcparticles)}; + FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 111, mcparticles), FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 221, mcparticles), FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 331, mcparticles), FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 113, mcparticles), FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 223, mcparticles), FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 333, mcparticles), FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 443, mcparticles)}; int size = sizeof(arr) / sizeof(*arr); int max = *std::max_element(arr, arr + size); return max; } Partition uls_pairs = o2::aod::dalitzee::sign == 0; + Partition lspp_pairs = o2::aod::dalitzee::sign == +1; + Partition lsmm_pairs = o2::aod::dalitzee::sign == -1; SliceCache cache; Preslice perCollision = aod::dalitzee::emeventId; Partition grouped_collisions = (cfgCentMin < o2::aod::cent::centFT0M && o2::aod::cent::centFT0M < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0A && o2::aod::cent::centFT0A < cfgCentMax) || (cfgCentMin < o2::aod::cent::centFT0C && o2::aod::cent::centFT0C < cfgCentMax); // this goes to same event. - std::vector used_trackIds; - void processQCMC(MyCollisions const&, MyDalitzEEs const&, MyMCTracks const&, aod::EMMCParticles const& mcparticles, aod::EMMCEvents const&) { THashList* list_ev_before = static_cast(fMainList->FindObject("Event")->FindObject(event_types[0].data())); THashList* list_ev_after = static_cast(fMainList->FindObject("Event")->FindObject(event_types[1].data())); THashList* list_dalitzee = static_cast(fMainList->FindObject("DalitzEE")); THashList* list_track = static_cast(fMainList->FindObject("Track")); - double values[4] = {0, 0, 0, 0}; + double values[3] = {0, 0, 0}; double values_single[4] = {0, 0, 0, 0}; float dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; @@ -187,10 +189,13 @@ struct DalitzEEQCMC { reinterpret_cast(list_ev_after->FindObject("hCollisionCounter"))->Fill("accepted", 1.f); auto uls_pairs_per_coll = uls_pairs->sliceByCached(o2::aod::dalitzee::emeventId, collision.globalIndex(), cache); + auto lspp_pairs_per_coll = lspp_pairs->sliceByCached(o2::aod::dalitzee::emeventId, collision.globalIndex(), cache); + auto lsmm_pairs_per_coll = lsmm_pairs->sliceByCached(o2::aod::dalitzee::emeventId, collision.globalIndex(), cache); for (const auto& cut : fDalitzEECuts) { THashList* list_dalitzee_cut = static_cast(list_dalitzee->FindObject(cut.GetName())); THashList* list_track_cut = static_cast(list_track->FindObject(cut.GetName())); + std::vector used_trackIds; used_trackIds.reserve(uls_pairs_per_coll.size() * 2); int nuls = 0; @@ -204,17 +209,28 @@ struct DalitzEEQCMC { auto posmc = pos.template emmcparticle_as(); auto elemc = ele.template emmcparticle_as(); + + if (posmc.pdgCode() != -11 || elemc.pdgCode() != 11) { + continue; + } + int mother_id = FindLF(posmc, elemc, mcparticles); + int hfee_type = IsHF(posmc, elemc, mcparticles); int photonid = FindCommonMotherFrom2Prongs(posmc, elemc, -11, 11, 22, mcparticles); - if (mother_id < 0 && photonid < 0) { + if (mother_id < 0 && hfee_type < 0 && photonid < 0) { continue; } - if (mother_id > 0) { + + dca_pos_3d = pos.dca3DinSigma(); + dca_ele_3d = ele.dca3DinSigma(); + 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] = dca_ee_3d; + + if (mother_id > -1) { auto mcmother = mcparticles.iteratorAt(mother_id); if (mcmother.isPhysicalPrimary() || mcmother.producedByGenerator()) { - dca_pos_3d = pos.dca3DinSigma(); - dca_ele_3d = ele.dca3DinSigma(); - dca_ee_3d = std::sqrt((dca_pos_3d * dca_pos_3d + dca_ele_3d * dca_ele_3d) / 2.); if (cfgDoDCAstudy) { values_single[0] = uls_pair.mass(); @@ -224,10 +240,6 @@ struct DalitzEEQCMC { reinterpret_cast(list_dalitzee_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_cut->FindObject("hs_dilepton_uls_same"))->Fill(values); if (mcmother.pdgCode() == 111) { @@ -238,6 +250,37 @@ struct DalitzEEQCMC { reinterpret_cast(list_dalitzee_cut->FindObject("hMvsOPA_Eta"))->Fill(uls_pair.opangle(), uls_pair.mass()); } + switch (abs(mcmother.pdgCode())) { + case 111: + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_Pi0"))->Fill(values); + break; + case 221: + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_Eta"))->Fill(values); + break; + case 331: + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_EtaPrime"))->Fill(values); + break; + case 113: + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_Rho"))->Fill(values); + break; + case 223: + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_Omega"))->Fill(values); + break; + case 333: + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_Phi"))->Fill(values); + break; + case 443: { + if (IsFromBeauty(mcmother, mcparticles) > 0) { + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_NonPromptJpsi"))->Fill(values); + } else { + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_PromptJpsi"))->Fill(values); + } + break; + } + default: + break; + } + nuls++; for (auto& track : {pos, ele}) { if (std::find(used_trackIds.begin(), used_trackIds.end(), track.globalIndex()) == used_trackIds.end()) { @@ -250,7 +293,30 @@ struct DalitzEEQCMC { } } } // end of LF - } else if (photonid > 0) { + } else if (hfee_type > -1) { + if ((posmc.isPhysicalPrimary() || posmc.producedByGenerator()) && (elemc.isPhysicalPrimary() || elemc.producedByGenerator())) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_Ce_Ce"))->Fill(values); + break; + case static_cast(EM_HFeeType::kBe_Be): + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_Be_Be"))->Fill(values); + break; + case static_cast(EM_HFeeType::kBCe_BCe): + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_BCe_BCe"))->Fill(values); + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_BCe_Be_SameB"))->Fill(values); + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + LOGF(info, "You should not see kBCe_Be_DiffB in ULS. Good luck."); + break; + default: + break; + } + nuls++; + } + } else if (photonid > -1) { auto mcphoton = mcparticles.iteratorAt(photonid); if ((mcphoton.isPhysicalPrimary() || mcphoton.producedByGenerator()) && IsEleFromPC(elemc, mcparticles) && IsEleFromPC(posmc, mcparticles)) { reinterpret_cast(list_dalitzee_cut->FindObject("hMvsPhiV_Photon"))->Fill(uls_pair.phiv(), uls_pair.mass()); @@ -260,6 +326,132 @@ struct DalitzEEQCMC { } // end of uls pair loop reinterpret_cast(list_dalitzee_cut->FindObject("hNpair_uls"))->Fill(nuls); + int nlspp = 0; + for (auto& lspp_pair : lspp_pairs_per_coll) { + auto pos = lspp_pair.template posTrack_as(); + auto ele = lspp_pair.template negTrack_as(); + + if (!cut.IsSelected(lspp_pair)) { + continue; + } + + auto posmc = pos.template emmcparticle_as(); + auto elemc = ele.template emmcparticle_as(); + + if (posmc.pdgCode() != -11 || elemc.pdgCode() != -11) { + continue; + } + + int hfee_type = IsHF(posmc, elemc, mcparticles); + if (hfee_type < 0) { + continue; + } + + dca_pos_3d = pos.dca3DinSigma(); + dca_ele_3d = ele.dca3DinSigma(); + dca_ee_3d = std::sqrt((dca_pos_3d * dca_pos_3d + dca_ele_3d * dca_ele_3d) / 2.); + values[0] = lspp_pair.mass(); + values[1] = lspp_pair.pt(); + values[2] = dca_ee_3d; + + if ((posmc.isPhysicalPrimary() || posmc.producedByGenerator()) && (elemc.isPhysicalPrimary() || elemc.producedByGenerator())) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + LOGF(info, "You should not see kCe_Ce in LS++. Good luck."); + break; + case static_cast(EM_HFeeType::kBe_Be): + LOGF(info, "You should not see kBe_Be in LS++. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_BCe): + LOGF(info, "You should not see kBCe_BCe in LS++. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS + LOGF(info, "You should not see kBCe_Be_SameB in LS++. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_BCe_Be_DiffB"))->Fill(values); + break; + default: + break; + } + } + nlspp++; + for (auto& track : {pos, ele}) { + if (std::find(used_trackIds.begin(), used_trackIds.end(), track.globalIndex()) == used_trackIds.end()) { + o2::aod::pwgem::photon::histogram::FillHistClass(list_track_cut, "", track); + used_trackIds.emplace_back(track.globalIndex()); + auto mctrack = track.template emmcparticle_as(); + reinterpret_cast(fMainList->FindObject("Track")->FindObject(cut.GetName())->FindObject("hPtGen_DeltaPtOverPtGen"))->Fill(mctrack.pt(), (track.pt() - mctrack.pt()) / mctrack.pt()); + reinterpret_cast(fMainList->FindObject("Track")->FindObject(cut.GetName())->FindObject("hPtGen_DeltaEta"))->Fill(mctrack.pt(), track.eta() - mctrack.eta()); + reinterpret_cast(fMainList->FindObject("Track")->FindObject(cut.GetName())->FindObject("hPtGen_DeltaPhi"))->Fill(mctrack.pt(), track.phi() - mctrack.phi()); + } + } + } // end of lspp pair loop + reinterpret_cast(list_dalitzee_cut->FindObject("hNpair_lspp"))->Fill(nlspp); + + int nlsmm = 0; + for (auto& lsmm_pair : lsmm_pairs_per_coll) { + auto pos = lsmm_pair.template posTrack_as(); + auto ele = lsmm_pair.template negTrack_as(); + + if (!cut.IsSelected(lsmm_pair)) { + continue; + } + + auto posmc = pos.template emmcparticle_as(); + auto elemc = ele.template emmcparticle_as(); + + if (posmc.pdgCode() != 11 || elemc.pdgCode() != 11) { + continue; + } + + int hfee_type = IsHF(posmc, elemc, mcparticles); + if (hfee_type < 0) { + continue; + } + + dca_pos_3d = pos.dca3DinSigma(); + dca_ele_3d = ele.dca3DinSigma(); + dca_ee_3d = std::sqrt((dca_pos_3d * dca_pos_3d + dca_ele_3d * dca_ele_3d) / 2.); + values[0] = lsmm_pair.mass(); + values[1] = lsmm_pair.pt(); + values[2] = dca_ee_3d; + + if ((posmc.isPhysicalPrimary() || posmc.producedByGenerator()) && (elemc.isPhysicalPrimary() || elemc.producedByGenerator())) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + LOGF(info, "You should not see kCe_Ce in LS--. Good luck."); + break; + case static_cast(EM_HFeeType::kBe_Be): + LOGF(info, "You should not see kBe_Be in LS--. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_BCe): + LOGF(info, "You should not see kBCe_BCe in LS--. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS + LOGF(info, "You should not see kBCe_Be_SameB in LS--. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + reinterpret_cast(list_dalitzee_cut->FindObject("hs_dilepton_mc_rec_BCe_Be_DiffB"))->Fill(values); + break; + default: + break; + } + } + nlsmm++; + for (auto& track : {pos, ele}) { + if (std::find(used_trackIds.begin(), used_trackIds.end(), track.globalIndex()) == used_trackIds.end()) { + o2::aod::pwgem::photon::histogram::FillHistClass(list_track_cut, "", track); + used_trackIds.emplace_back(track.globalIndex()); + auto mctrack = track.template emmcparticle_as(); + reinterpret_cast(fMainList->FindObject("Track")->FindObject(cut.GetName())->FindObject("hPtGen_DeltaPtOverPtGen"))->Fill(mctrack.pt(), (track.pt() - mctrack.pt()) / mctrack.pt()); + reinterpret_cast(fMainList->FindObject("Track")->FindObject(cut.GetName())->FindObject("hPtGen_DeltaEta"))->Fill(mctrack.pt(), track.eta() - mctrack.eta()); + reinterpret_cast(fMainList->FindObject("Track")->FindObject(cut.GetName())->FindObject("hPtGen_DeltaPhi"))->Fill(mctrack.pt(), track.phi() - mctrack.phi()); + } + } + } // end of lsmm pair loop + reinterpret_cast(list_dalitzee_cut->FindObject("hNpair_lsmm"))->Fill(nlsmm); + used_trackIds.clear(); used_trackIds.shrink_to_fit(); } // end of cut loop @@ -288,19 +480,6 @@ struct DalitzEEQCMC { reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(1.0); reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hZvtx_before"))->Fill(mccollision.posZ()); - if (!collision.sel8()) { - continue; - } - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(2.0); - - if (collision.numContrib() < 0.5) { - continue; - } - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hCollisionCounter"))->Fill(3.0); - - if (abs(collision.posZ()) > 10.0) { - continue; - } if (!fEMEventCut.IsSelected(collision)) { continue; @@ -320,19 +499,176 @@ struct DalitzEEQCMC { continue; } + if (!t1.isPhysicalPrimary() && !t1.producedByGenerator()) { + continue; + } + if (!t2.isPhysicalPrimary() && !t2.producedByGenerator()) { + continue; + } + int mother_id = FindLF(t1, t2, mcparticles); - if (mother_id < 0) { + int hfee_type = IsHF(t1, t2, mcparticles); + if (mother_id < 0 && hfee_type < 0) { continue; } - auto mcmother = mcparticles.iteratorAt(mother_id); - if (mcmother.isPhysicalPrimary() || mcmother.producedByGenerator()) { - 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; - reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt"))->Fill(v12.M(), v12.Pt()); - } // end of LF - } // end of true ULS pair loop - } // end of collision loop + 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; + + if (mother_id > -1) { + auto mcmother = mcparticles.iteratorAt(mother_id); + if (mcmother.isPhysicalPrimary() || mcmother.producedByGenerator()) { + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt"))->Fill(v12.M(), v12.Pt()); + + switch (abs(mcmother.pdgCode())) { + case 111: + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_Pi0"))->Fill(v12.M(), v12.Pt()); + break; + case 221: + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_Eta"))->Fill(v12.M(), v12.Pt()); + break; + case 331: + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_EtaPrime"))->Fill(v12.M(), v12.Pt()); + break; + case 113: + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_Rho"))->Fill(v12.M(), v12.Pt()); + break; + case 223: + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_Omega"))->Fill(v12.M(), v12.Pt()); + break; + case 333: + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_Phi"))->Fill(v12.M(), v12.Pt()); + break; + case 443: { + if (IsFromBeauty(mcmother, mcparticles) > 0) { + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_NonPromptJpsi"))->Fill(v12.M(), v12.Pt()); + } else { + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_PromptJpsi"))->Fill(v12.M(), v12.Pt()); + } + break; + } + default: + break; + } + } + } else if (hfee_type > -1) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_Ce_Ce"))->Fill(v12.M(), v12.Pt()); + break; + case static_cast(EM_HFeeType::kBe_Be): + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_Be_Be"))->Fill(v12.M(), v12.Pt()); + break; + case static_cast(EM_HFeeType::kBCe_BCe): + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_BCe_BCe"))->Fill(v12.M(), v12.Pt()); + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_BCe_Be_SameB"))->Fill(v12.M(), v12.Pt()); + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + LOGF(info, "You should not see kBCe_Be_DiffB in ULS. Good luck."); + break; + default: + break; + } + } + } // end of true ULS pair loop + + for (auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { + // LOGF(info, "pdg1 = %d, pdg2 = %d", t1.pdgCode(), t2.pdgCode()); + + if (t1.pt() < min_mcPt || max_mcPt < t1.pt() || abs(t1.eta()) > max_mcEta) { + continue; + } + if (t2.pt() < min_mcPt || max_mcPt < t2.pt() || abs(t2.eta()) > max_mcEta) { + continue; + } + + if (!t1.isPhysicalPrimary() && !t1.producedByGenerator()) { + continue; + } + if (!t2.isPhysicalPrimary() && !t2.producedByGenerator()) { + continue; + } + + int hfee_type = IsHF(t1, t2, mcparticles); + if (hfee_type < 0) { + 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; + if (hfee_type > -1) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + LOGF(info, "You should not see kCe_Ce in LS++. Good luck."); + break; + case static_cast(EM_HFeeType::kBe_Be): + LOGF(info, "You should not see kBe_Be in LS++. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_BCe): + LOGF(info, "You should not see kBCe_BCe in LS++. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS + LOGF(info, "You should not see kBCe_Be_SameB in LS++. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_BCe_Be_DiffB"))->Fill(v12.M(), v12.Pt()); + break; + default: + break; + } + } + } // end of true LS++ pair loop + + for (auto& [t1, t2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { + // LOGF(info, "pdg1 = %d, pdg2 = %d", t1.pdgCode(), t2.pdgCode()); + + if (t1.pt() < min_mcPt || max_mcPt < t1.pt() || abs(t1.eta()) > max_mcEta) { + continue; + } + if (t2.pt() < min_mcPt || max_mcPt < t2.pt() || abs(t2.eta()) > max_mcEta) { + continue; + } + + if (!t1.isPhysicalPrimary() && !t1.producedByGenerator()) { + continue; + } + if (!t2.isPhysicalPrimary() && !t2.producedByGenerator()) { + continue; + } + + int hfee_type = IsHF(t1, t2, mcparticles); + if (hfee_type < 0) { + 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; + if (hfee_type > -1) { + switch (hfee_type) { + case static_cast(EM_HFeeType::kCe_Ce): + LOGF(info, "You should not see kCe_Ce in LS--. Good luck."); + break; + case static_cast(EM_HFeeType::kBe_Be): + LOGF(info, "You should not see kBe_Be in LS--. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_BCe): + LOGF(info, "You should not see kBCe_BCe in LS--. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_SameB): // ULS + LOGF(info, "You should not see kBCe_Be_SameB in LS--. Good luck."); + break; + case static_cast(EM_HFeeType::kBCe_Be_DiffB): // LS + reinterpret_cast(fMainList->FindObject("Generated")->FindObject("hMvsPt_BCe_Be_DiffB"))->Fill(v12.M(), v12.Pt()); + break; + default: + break; + } + } + } // end of true LS++ pair loop + + } // end of collision loop } PROCESS_SWITCH(DalitzEEQCMC, processGen, "run genrated info", true); diff --git a/PWGEM/PhotonMeson/Tasks/dalitzMuMuQC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzMuMuQC.cxx index b41b89d319f..00d4cffbff4 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzMuMuQC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzMuMuQC.cxx @@ -156,7 +156,7 @@ struct DalitzMuMuQC { THashList* list_ev_after = static_cast(fMainList->FindObject("Event")->FindObject(event_types[1].data())); THashList* list_dalitzmumu = static_cast(fMainList->FindObject("DalitzMuMu")); THashList* list_track = static_cast(fMainList->FindObject("Track")); - double values[4] = {0, 0, 0, 0}; + double values[3] = {0, 0, 0}; float dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; for (auto& collision : grouped_collisions) { @@ -195,7 +195,6 @@ struct DalitzMuMuQC { values[0] = uls_pair.mass(); values[1] = uls_pair.pt(); values[2] = dca_ee_3d; - values[3] = uls_pair.phiv(); reinterpret_cast(list_dalitzmumu_cut->FindObject("hs_dilepton_uls_same"))->Fill(values); nuls++; for (auto& track : {pos, ele}) { @@ -219,7 +218,6 @@ struct DalitzMuMuQC { values[0] = lspp_pair.mass(); values[1] = lspp_pair.pt(); values[2] = dca_ee_3d; - values[3] = lspp_pair.phiv(); reinterpret_cast(list_dalitzmumu_cut->FindObject("hs_dilepton_lspp_same"))->Fill(values); nlspp++; } @@ -237,7 +235,6 @@ struct DalitzMuMuQC { values[0] = lsmm_pair.mass(); values[1] = lsmm_pair.pt(); values[2] = dca_ee_3d; - values[3] = lsmm_pair.phiv(); reinterpret_cast(list_dalitzmumu_cut->FindObject("hs_dilepton_lsmm_same"))->Fill(values); nlsmm++; } @@ -271,7 +268,7 @@ struct DalitzMuMuQC { void MixedEventPairing(TEvents const& collisions, TTracks const& tracks, TMixedBinning const& colBinning) { THashList* list_dalitzmumu = static_cast(fMainList->FindObject("DalitzMuMu")); - double values[4] = {0, 0, 0, 0}; + double values[3] = {0, 0, 0}; ROOT::Math::PtEtaPhiMVector v1, v2, v12; float phiv = 0; float dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; @@ -297,6 +294,10 @@ struct DalitzMuMuQC { for (auto& cut : fDalitzMuMuCuts) { THashList* list_dalitzmumu_cut = static_cast(list_dalitzmumu->FindObject(cut.GetName())); for (auto& [t1, t2] : combinations(soa::CombinationsFullIndexPolicy(tracks_coll1, tracks_coll2))) { + if (t1.trackId() == t2.trackId()) { // this is protection against pairing identical 2 tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions. + continue; + } + v1 = ROOT::Math::PtEtaPhiMVector(t1.pt(), t1.eta(), t1.phi(), o2::constants::physics::MassMuon); v2 = ROOT::Math::PtEtaPhiMVector(t2.pt(), t2.eta(), t2.phi(), o2::constants::physics::MassMuon); v12 = v1 + v2; @@ -308,7 +309,6 @@ struct DalitzMuMuQC { values[0] = v12.M(); values[1] = v12.Pt(); values[2] = dca_ee_3d; - values[3] = phiv; if (cut.IsSelectedTrack(t1) && cut.IsSelectedTrack(t2) && cut.IsSelectedPair(v12.M(), dca_ee_3d, phiv)) { if (t1.sign() * t2.sign() < 0) { diff --git a/PWGEM/PhotonMeson/Tasks/dalitzMuMuQCMC.cxx b/PWGEM/PhotonMeson/Tasks/dalitzMuMuQCMC.cxx index ae44a4fc2da..b45dbb6e6f2 100644 --- a/PWGEM/PhotonMeson/Tasks/dalitzMuMuQCMC.cxx +++ b/PWGEM/PhotonMeson/Tasks/dalitzMuMuQCMC.cxx @@ -161,7 +161,7 @@ struct DalitzMuMuQCMC { THashList* list_ev_after = static_cast(fMainList->FindObject("Event")->FindObject(event_types[1].data())); THashList* list_dalitzmumu = static_cast(fMainList->FindObject("DalitzMuMu")); THashList* list_track = static_cast(fMainList->FindObject("Track")); - double values[4] = {0, 0, 0, 0}; + double values[3] = {0, 0, 0}; float dca_pos_3d = 999.f, dca_ele_3d = 999.f, dca_ee_3d = 999.f; for (auto& collision : grouped_collisions) { @@ -211,7 +211,6 @@ struct DalitzMuMuQCMC { values[0] = uls_pair.mass(); values[1] = uls_pair.pt(); values[2] = dca_ee_3d; - values[3] = uls_pair.phiv(); reinterpret_cast(list_dalitzmumu_cut->FindObject("hs_dilepton_uls_same"))->Fill(values); nuls++; diff --git a/PWGEM/PhotonMeson/Utils/PCMUtilities.h b/PWGEM/PhotonMeson/Utils/PCMUtilities.h index 389eb79ed0f..ecf23c85a6b 100644 --- a/PWGEM/PhotonMeson/Utils/PCMUtilities.h +++ b/PWGEM/PhotonMeson/Utils/PCMUtilities.h @@ -165,8 +165,8 @@ float getPhivPair(float pxpos, float pypos, float pzpos, float pxneg, float pyne float uy = (pypos + pyneg) / RecoDecay::sqrtSumOfSquares(pxpos + pxneg, pypos + pyneg, pzpos + pzneg); float uz = (pzpos + pzneg) / RecoDecay::sqrtSumOfSquares(pxpos + pxneg, pypos + pyneg, pzpos + pzneg); - float ax = uy / TMath::Sqrt(ux * ux + uy * uy); - float ay = -ux / TMath::Sqrt(ux * ux + uy * uy); + float ax = uy / std::sqrt(ux * ux + uy * uy); + float ay = -ux / std::sqrt(ux * ux + uy * uy); // The third axis defined by vector product (ux,uy,uz)X(vx,vy,vz) float wx = uy * vz - uz * vy; @@ -175,13 +175,16 @@ float getPhivPair(float pxpos, float pypos, float pzpos, float pxneg, float pyne // The angle between them should be small if the pair is conversion. This function then returns values close to pi! 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))){ + // if (!std::isfinite(std::acos(wx * ax + wy * ay))) { + // LOGF(info, "pxpos = %f, pypos = %f, pzpos = %f", pxpos, pypos, pzpos); + // LOGF(info, "pxneg = %f, pyneg = %f, pzneg = %f", pxneg, pyneg, pzneg); // 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))); + // LOGF(info, "std::acos(wx * ax + wy * ay) = %f", std::acos(wx * ax + wy * ay)); + // LOGF(info, "std::acos(clipToPM1(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; diff --git a/PWGEM/Tasks/phosElId.cxx b/PWGEM/Tasks/phosElId.cxx index f5a5abd33b7..9ae4a00f846 100644 --- a/PWGEM/Tasks/phosElId.cxx +++ b/PWGEM/Tasks/phosElId.cxx @@ -112,7 +112,7 @@ struct phosElId { void process(soa::Join::iterator const& collision, aod::CaloClusters& clusters, tracks& tracks, - aod::BCsWithTimestamps const& bcs) + aod::BCsWithTimestamps const&) { mHistManager.fill(HIST("eventCounter"), 0.5); auto bc = collision.bc_as(); @@ -176,7 +176,7 @@ struct phosElId { } /////////////////////////////////////////////////////////////////////// - bool impactOnPHOS(o2::track::TrackParametrization& trackPar, float trackEta, float trackPhi, float zvtx, int16_t& module, float& trackX, float& trackZ) + bool impactOnPHOS(o2::track::TrackParametrization& trackPar, float trackEta, float trackPhi, float /*zvtx*/, int16_t& module, float& trackX, float& trackZ) { // eta,phi was calculated at EMCAL radius. // Extrapolate to PHOS assuming zeroB and current vertex diff --git a/PWGHF/ALICE3/TableProducer/candidateCreatorChic.cxx b/PWGHF/ALICE3/TableProducer/candidateCreatorChic.cxx index 6bf7701b50b..af643fe92e9 100644 --- a/PWGHF/ALICE3/TableProducer/candidateCreatorChic.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateCreatorChic.cxx @@ -119,7 +119,7 @@ struct HfCandidateCreatorChic { hCPAJpsi->Fill(jpsiCand.cpa()); // create Jpsi track to pass to DCA fitter; use cand table + rebuild vertex const std::array vertexJpsi = {jpsiCand.xSecondaryVertex(), jpsiCand.ySecondaryVertex(), jpsiCand.zSecondaryVertex()}; - std::array pvecJpsi = {jpsiCand.px(), jpsiCand.py(), jpsiCand.pz()}; + std::array pvecJpsi = jpsiCand.pVector(); auto prong0 = jpsiCand.prong0_as(); auto prong1 = jpsiCand.prong1_as(); auto prong0TrackParCov = getTrackParCov(prong0); @@ -253,7 +253,7 @@ struct HfCandidateCreatorChicMc { if (indexMother > -1 && indexMotherGamma == indexMother && candidate.prong1().mcparticle().pdgCode() == kGamma) { auto particleMother = mcParticles.rawIteratorAt(indexMother); hEphotonMatched->Fill(candidate.prong1().e()); - hMassEMatched->Fill(sqrt(candidate.prong1().px() * candidate.prong1().px() + candidate.prong1().py() * candidate.prong1().py() + candidate.prong1().pz() * candidate.prong1().pz())); + hMassEMatched->Fill(RecoDecay::p(candidate.pVectorProng1())); if (particleMother.has_daughters()) { std::vector arrAllDaughtersIndex; RecoDecay::getDaughters(particleMother, &arrAllDaughtersIndex, std::array{static_cast(kGamma), static_cast(Pdg::kJPsi)}, 1); diff --git a/PWGHF/ALICE3/TableProducer/candidateCreatorX.cxx b/PWGHF/ALICE3/TableProducer/candidateCreatorX.cxx index af4c23312ee..9f58eb93a75 100644 --- a/PWGHF/ALICE3/TableProducer/candidateCreatorX.cxx +++ b/PWGHF/ALICE3/TableProducer/candidateCreatorX.cxx @@ -136,7 +136,7 @@ struct HfCandidateCreatorX { hCPAJpsi->Fill(jpsiCand.cpa()); // create Jpsi track to pass to DCA fitter; use cand table + rebuild vertex const std::array vertexJpsi = {jpsiCand.xSecondaryVertex(), jpsiCand.ySecondaryVertex(), jpsiCand.zSecondaryVertex()}; - std::array pvecJpsi = {jpsiCand.px(), jpsiCand.py(), jpsiCand.pz()}; + std::array pvecJpsi = jpsiCand.pVector(); auto prong0 = jpsiCand.prong0_as(); auto prong1 = jpsiCand.prong1_as(); auto prong0TrackParCov = getTrackParCov(prong0); diff --git a/PWGHF/ALICE3/TableProducer/treeCreatorChicToJpsiGamma.cxx b/PWGHF/ALICE3/TableProducer/treeCreatorChicToJpsiGamma.cxx index 1378814900b..1b164a0fc0e 100644 --- a/PWGHF/ALICE3/TableProducer/treeCreatorChicToJpsiGamma.cxx +++ b/PWGHF/ALICE3/TableProducer/treeCreatorChicToJpsiGamma.cxx @@ -153,9 +153,9 @@ struct HfTreeCreatorChicToJpsiGamma { // int indexCand = 0; rowCandidateFull.reserve(candidates.size()); for (const auto& candidate : candidates) { - std::array pvecChic = {candidate.px(), candidate.py(), candidate.pz()}; - std::array pvecJpsi = {candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()}; - std::array pvecGamma = {candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}; + std::array pvecChic = candidate.pVector(); + std::array pvecJpsi = candidate.pVectorProng0(); + std::array pvecGamma = candidate.pVectorProng1(); auto pchic = RecoDecay::p(pvecChic); auto pjpsi = RecoDecay::p(pvecJpsi); auto pl1 = std::abs(RecoDecay::dotProd(pvecChic, pvecJpsi)) / pchic; @@ -217,7 +217,7 @@ struct HfTreeCreatorChicToJpsiGamma { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, massChic), + RecoDecay::y(particle.pVector(), massChic), 0., // put here the jpsi mass particle.flagMcMatchGen(), particle.originMcGen()); diff --git a/PWGHF/ALICE3/TableProducer/treeCreatorXToJpsiPiPi.cxx b/PWGHF/ALICE3/TableProducer/treeCreatorXToJpsiPiPi.cxx index ebc33c7fa79..7a981b35798 100644 --- a/PWGHF/ALICE3/TableProducer/treeCreatorXToJpsiPiPi.cxx +++ b/PWGHF/ALICE3/TableProducer/treeCreatorXToJpsiPiPi.cxx @@ -249,7 +249,7 @@ struct HfTreeCreatorXToJpsiPiPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, massX), + RecoDecay::y(particle.pVector(), massX), particle.flagMcMatchGen(), particle.originMcGen()); } diff --git a/PWGHF/ALICE3/Tasks/taskChic.cxx b/PWGHF/ALICE3/Tasks/taskChic.cxx index e5891414510..026f781f6f4 100644 --- a/PWGHF/ALICE3/Tasks/taskChic.cxx +++ b/PWGHF/ALICE3/Tasks/taskChic.cxx @@ -204,7 +204,7 @@ struct HfTaskChicMc { for (const auto& particle : mcParticles) { if (particle.flagMcMatchGen() == 1 << decayMode) { auto mchic = o2::constants::physics::MassChiC1; // chi_c1(1p) - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, mchic)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle.pVector(), mchic)) > yCandMax) { continue; } diff --git a/PWGHF/ALICE3/Tasks/taskD0Alice3Barrel.cxx b/PWGHF/ALICE3/Tasks/taskD0Alice3Barrel.cxx index a103ab6d897..da86e77a06b 100644 --- a/PWGHF/ALICE3/Tasks/taskD0Alice3Barrel.cxx +++ b/PWGHF/ALICE3/Tasks/taskD0Alice3Barrel.cxx @@ -142,11 +142,11 @@ struct HfTaskD0Alice3Barrel { for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { - if (std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassD0)) > 4.0) { + if (std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0)) > 4.0) { continue; } auto ptGen = particle.pt(); - auto yGen = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassD0); + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0); registry.fill(HIST("hMassGen"), ptGen, std::abs(yGen)); } } diff --git a/PWGHF/ALICE3/Tasks/taskD0Alice3Forward.cxx b/PWGHF/ALICE3/Tasks/taskD0Alice3Forward.cxx index 5ec222fcbd1..dea53a20d70 100644 --- a/PWGHF/ALICE3/Tasks/taskD0Alice3Forward.cxx +++ b/PWGHF/ALICE3/Tasks/taskD0Alice3Forward.cxx @@ -70,11 +70,11 @@ struct HfTaskD0Alice3Forward { for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { - if (std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassD0)) > 4.0) { + if (std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0)) > 4.0) { continue; } auto ptGen = particle.pt(); - auto yGen = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassD0); + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0); registry.fill(HIST("hMassGen"), ptGen, std::abs(yGen)); } } diff --git a/PWGHF/ALICE3/Tasks/taskD0ParametrizedPid.cxx b/PWGHF/ALICE3/Tasks/taskD0ParametrizedPid.cxx index ac5bda86537..3fe2487b2f3 100644 --- a/PWGHF/ALICE3/Tasks/taskD0ParametrizedPid.cxx +++ b/PWGHF/ALICE3/Tasks/taskD0ParametrizedPid.cxx @@ -118,11 +118,11 @@ struct HfTaskD0ParametrizedPid { float maxFiducialY = 0.8; float minFiducialY = -0.8; if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { - if (std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassD0)) > 4.0) { + if (std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0)) > 4.0) { continue; } auto ptGen = particle.pt(); - auto yGen = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassD0); + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0); registry.fill(HIST("hGenPtVsY"), ptGen, std::abs(yGen)); if (ptGen < 5.0) { maxFiducialY = -0.2 / 15 * ptGen * ptGen + 1.9 / 15 * ptGen + 0.5; diff --git a/PWGHF/ALICE3/Tasks/taskJpsi.cxx b/PWGHF/ALICE3/Tasks/taskJpsi.cxx index 2647df75f60..f3bcbd8dcb2 100644 --- a/PWGHF/ALICE3/Tasks/taskJpsi.cxx +++ b/PWGHF/ALICE3/Tasks/taskJpsi.cxx @@ -256,7 +256,7 @@ struct HfTaskJpsiMc { registry.fill(HIST("hChi2PCASig"), candidate.chi2PCA(), candidate.pt()); registry.fill(HIST("hCtSig"), hfHelper.ctJpsi(candidate), candidate.pt()); registry.fill(HIST("hYSig"), hfHelper.yJpsi(candidate), candidate.pt()); - registry.fill(HIST("hYGenSig"), RecoDecay::y(std::array{particleMother.px(), particleMother.py(), particleMother.pz()}, o2::constants::physics::MassJPsi), particleMother.pt()); + registry.fill(HIST("hYGenSig"), RecoDecay::y(particleMother.pVector(), o2::constants::physics::MassJPsi), particleMother.pt()); } else { registry.fill(HIST("hPtRecBg"), candidate.pt()); @@ -280,12 +280,12 @@ struct HfTaskJpsiMc { // MC gen. for (const auto& particle : mcParticles) { if (particle.flagMcMatchGen() == 1 << decayMode) { - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassJPsi)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassJPsi)) > yCandMax) { continue; } registry.fill(HIST("hPtGen"), particle.pt()); registry.fill(HIST("hEtaGen"), particle.eta()); - registry.fill(HIST("hYGen"), RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassJPsi), particle.pt()); + registry.fill(HIST("hYGen"), RecoDecay::y(particle.pVector(), o2::constants::physics::MassJPsi), particle.pt()); // registry.fill(HIST("hPtGenProng0"), particle.daughter0_as().pt(), particle.pt()); // registry.fill(HIST("hPtGenProng1"), particle.daughter1_as().pt(), particle.pt()); } diff --git a/PWGHF/ALICE3/Tasks/taskLcAlice3.cxx b/PWGHF/ALICE3/Tasks/taskLcAlice3.cxx index edfe001795a..9bbfdaf91e5 100644 --- a/PWGHF/ALICE3/Tasks/taskLcAlice3.cxx +++ b/PWGHF/ALICE3/Tasks/taskLcAlice3.cxx @@ -138,11 +138,11 @@ struct HfTaskLcAlice3 { for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { - if (std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassLambdaCPlus)) > 4.0) { + if (std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaCPlus)) > 4.0) { continue; } auto ptGen = particle.pt(); - auto yGen = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassLambdaCPlus); + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaCPlus); registry.fill(HIST("hMassGen"), ptGen, std::abs(yGen)); } } diff --git a/PWGHF/ALICE3/Tasks/taskLcParametrizedPid.cxx b/PWGHF/ALICE3/Tasks/taskLcParametrizedPid.cxx index 4a44456c645..8936c56e2c1 100644 --- a/PWGHF/ALICE3/Tasks/taskLcParametrizedPid.cxx +++ b/PWGHF/ALICE3/Tasks/taskLcParametrizedPid.cxx @@ -118,11 +118,11 @@ struct HfTaskLcParametrizedPid { for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { - if (std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassLambdaCPlus)) > 4.0) { + if (std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaCPlus)) > 4.0) { continue; } auto ptGen = particle.pt(); - auto yGen = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassLambdaCPlus); + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaCPlus); registry.fill(HIST("hMassGen"), ptGen, std::abs(yGen)); } } diff --git a/PWGHF/ALICE3/Tasks/taskX.cxx b/PWGHF/ALICE3/Tasks/taskX.cxx index 5c3bdad9589..610f9f94a33 100644 --- a/PWGHF/ALICE3/Tasks/taskX.cxx +++ b/PWGHF/ALICE3/Tasks/taskX.cxx @@ -210,7 +210,7 @@ struct HfTaskXMc { // MC gen. for (const auto& particle : mcParticles) { if (particle.flagMcMatchGen() == 1 << decayMode) { - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassX3872)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassX3872)) > yCandMax) { continue; } registry.fill(HIST("hPtGen"), particle.pt()); diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 6e3f2da1da7..f268e2e90ed 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -129,7 +129,8 @@ DECLARE_SOA_TABLE(HfRedTrackBases, "AOD", "HFREDTRACKBASE", //! Table with track HFTRACKPAR_COLUMNS, aod::track::Px, aod::track::Py, - aod::track::Pz); + aod::track::Pz, + aod::track::PVector); DECLARE_SOA_TABLE(HfRedTracksCov, "AOD", "HFREDTRACKCOV", //! Table with track covariance information for reduced workflow soa::Index<>, @@ -172,7 +173,8 @@ DECLARE_SOA_TABLE(HfRed2Prongs, "AOD", "HFRED2PRONG", //! Table with 2prong cand hf_charm_cand_reduced::InvMassD0, hf_charm_cand_reduced::InvMassD0Bar, aod::track::Px, aod::track::Py, - aod::track::Pz); + aod::track::Pz, + aod::track::PVector); DECLARE_SOA_TABLE(HfRed2ProngsCov, "AOD", "HFRED2PRONGSCOV", //! Table with 2prong candidate covariance for reduced workflow o2::soa::Index<>, @@ -198,7 +200,8 @@ DECLARE_SOA_TABLE(HfRed3Prongs, "AOD", "HFRED3PRONG", //! Table with 3prong cand hf_charm_cand_reduced::InvMass, aod::track::Px, aod::track::Py, - aod::track::Pz); + aod::track::Pz, + aod::track::PVector); DECLARE_SOA_TABLE(HfRed3ProngsCov, "AOD", "HFRED3PRONGSCOV", //! Table with 3prong candidate covariance for reduced workflow o2::soa::Index<>, @@ -399,7 +402,9 @@ DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Pt of D daughter in DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Pt of V0 daughter in GeV/c DECLARE_SOA_COLUMN(InvMassProng0, invMassProng0, float); //! Invariant Mass of D daughter in GeV/c DECLARE_SOA_COLUMN(InvMassProng1, invMassProng1, float); //! Invariant Mass of V0 daughter in GeV/c - +DECLARE_SOA_COLUMN(MlScoreBkgProng0, mlScoreBkgProng0, float); //! Bkg ML score of the D daughter +DECLARE_SOA_COLUMN(MlScorePromptProng0, mlScorePromptProng0, float); //! Prompt ML score of the D daughter +DECLARE_SOA_COLUMN(MlScoreNonpromptProng0, mlScoreNonpromptProng0, float); //! Nonprompt ML score of the D daughter } // namespace hf_reso_cand_reduced DECLARE_SOA_TABLE(HfRedVzeros, "AOD", "HFREDVZERO", //! Table with V0 candidate information for resonances reduced workflow @@ -414,7 +419,8 @@ DECLARE_SOA_TABLE(HfRedVzeros, "AOD", "HFREDVZERO", //! Table with V0 candidate hf_reso_cand_reduced::Cpa, hf_reso_cand_reduced::Dca, hf_reso_cand_reduced::Radius, - hf_reso_cand_reduced::V0Type); + hf_reso_cand_reduced::V0Type, + mcparticle::PVector); DECLARE_SOA_TABLE(HfRed3PrNoTrks, "AOD", "HFRED3PRNOTRK", //! Table with 3 prong candidate information for resonances reduced workflow o2::soa::Index<>, @@ -425,7 +431,8 @@ DECLARE_SOA_TABLE(HfRed3PrNoTrks, "AOD", "HFRED3PRNOTRK", //! Table with 3 prong hf_reso_cand_reduced::Px, hf_reso_cand_reduced::Py, hf_reso_cand_reduced::Pz, - hf_reso_cand_reduced::DType); + hf_reso_cand_reduced::DType, + mcparticle::PVector); DECLARE_SOA_TABLE(HfCandCharmReso, "AOD", "HFCANDCHARMRESO", //! Table with Resonance candidate information for resonances reduced workflow o2::soa::Index<>, @@ -439,6 +446,12 @@ DECLARE_SOA_TABLE(HfCandCharmReso, "AOD", "HFCANDCHARMRESO", //! Table with Reso hf_reso_cand_reduced::Cpa, hf_reso_cand_reduced::Dca, hf_reso_cand_reduced::Radius); + +DECLARE_SOA_TABLE(HfCharmResoMLs, "AOD", "HFCHARMRESOML", //! Table with ML scores for the D daughter + hf_reso_cand_reduced::MlScoreBkgProng0, + hf_reso_cand_reduced::MlScorePromptProng0, + hf_reso_cand_reduced::MlScoreNonpromptProng0, + o2::soa::Marker<1>); } // namespace aod namespace soa diff --git a/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx index 0747f767544..c12bd8da3b7 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx @@ -124,7 +124,7 @@ struct HfCandidateCreatorB0Reduced { for (const auto& candD : candsDThisColl) { auto trackParCovD = getTrackParCov(candD); - std::array pVecD = {candD.px(), candD.py(), candD.pz()}; + std::array pVecD = candD.pVector(); for (const auto& trackPion : tracksPionThisCollision) { // this track is among daughters @@ -133,7 +133,7 @@ struct HfCandidateCreatorB0Reduced { } auto trackParCovPi = getTrackParCov(trackPion); - std::array pVecPion = {trackPion.px(), trackPion.py(), trackPion.pz()}; + std::array pVecPion = trackPion.pVector(); // compute invariant mass square and apply selection auto invMass2DPi = RecoDecay::m2(std::array{pVecD, pVecPion}, std::array{massD, massPi}); diff --git a/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx index 0d4c8f8418e..8bdb7ed36d5 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx @@ -131,12 +131,12 @@ struct HfCandidateCreatorBplusReduced { auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); for (const auto& candD0 : candsDThisColl) { auto trackParCovD = getTrackParCov(candD0); - std::array pVecD0 = {candD0.px(), candD0.py(), candD0.pz()}; + std::array pVecD0 = candD0.pVector(); auto tracksPionThisCollision = tracksPion.sliceBy(tracksPionPerCollision, thisCollId); for (const auto& trackPion : tracksPionThisCollision) { auto trackParCovPi = getTrackParCov(trackPion); - std::array pVecPion = {trackPion.px(), trackPion.py(), trackPion.pz()}; + std::array pVecPion = trackPion.pVector(); // compute invariant mass square and apply selection auto invMass2D0Pi = RecoDecay::m2(std::array{pVecD0, pVecPion}, std::array{massD0, massPi}); diff --git a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx index 83dcb620172..699d0bbbc31 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx @@ -39,7 +39,8 @@ enum Selections : uint8_t { enum DecayChannel : uint8_t { Ds1ToDstarK0s = 0, Ds2StarToDplusK0s, - XcToDplusLambda + XcToDplusLambda, + LambdaDminus }; enum V0Type : uint8_t { K0s = 0, @@ -61,6 +62,8 @@ auto vecBins = std::vector{binsPt, binsPt + nBins + 1}; struct HfCandidateCreatorCharmResoReduced { // Produces: Tables with resonance info Produces rowCandidateReso; + // Optional D daughter ML scores table + Produces mlScores; // Configurables Configurable invMassWindowD{"invMassWindowD", 0.5, "invariant-mass window for D candidates (GeV/c2)"}; @@ -70,6 +73,8 @@ struct HfCandidateCreatorCharmResoReduced { // Hist Axis Configurable> binsPt{"binsPt", std::vector{vecBins}, "pT bin limits"}; + using reducedDWithMl = soa::Join; + // Partition of V0 candidates based on v0Type Partition candidatesK0s = aod::hf_reso_cand_reduced::v0Type == (uint8_t)1 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)3 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)5; Partition candidatesLambda = aod::hf_reso_cand_reduced::v0Type == (uint8_t)2 || aod::hf_reso_cand_reduced::v0Type == (uint8_t)4; @@ -85,14 +90,17 @@ struct HfCandidateCreatorCharmResoReduced { void init(InitContext const&) { - for (const auto& value : vecBins) { - LOGF(info, "bin limit %f", value); + // check that only one process function is enabled + std::array doprocess{doprocessDs2StarToDplusK0s, doprocessDs2StarToDplusK0sWithMl, doprocessDs1ToDstarK0s, doprocessDs1ToDstarK0sWithMl, doprocessXcToDplusLambda, doprocessXcToDplusLambdaWithMl, doprocessLambdaDminus, doprocessLambdaDminusWithMl}; + if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { + LOGP(fatal, "Only one process function should be enabled! Please check your configuration!"); } - const AxisSpec axisPt{(std::vector)vecBins, "#it{p}_{T} (GeV/#it{c})"}; // histograms - registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassDs2Star", "Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassXcRes", "XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + const AxisSpec axisPt{(std::vector)vecBins, "#it{p}_{T} (GeV/#it{c})"}; + registry.add("hMassDs1", "Ds1 candidates;m_{Ds1} (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassDs2Star", "Ds^{*}2 candidates; m_Ds^{*}2 (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassXcRes", "XcRes candidates; m_XcRes (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassLambdaDminus", "LambdaDminus candidates; m_LambdaDminus (GeV/#it{c}^{2}) ;entries", {HistType::kTH2F, {{100, 2.9, 3.3}, {(std::vector)binsPt, "#it{p}_{T} (GeV/#it{c})"}}}); if (activateQA) { constexpr int kNBinsSelections = Selections::NSelSteps; std::string labels[kNBinsSelections]; @@ -105,19 +113,21 @@ struct HfCandidateCreatorCharmResoReduced { registry.get(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } } - + // mass constants massK0 = o2::constants::physics::MassK0Short; massLambda = o2::constants::physics::MassLambda; massDplus = o2::constants::physics::MassDPlus; massDstar = o2::constants::physics::MassDStar; } - + /// Basic selection of D candidates + /// \param candD is the reduced D meson candidate + /// \return true if selections are passed template bool isDSelected(DRedTable const& candD) { float massD{0.}; // slection on D candidate mass - if (channel == DecayChannel::Ds2StarToDplusK0s || channel == DecayChannel::XcToDplusLambda) { + if (channel == DecayChannel::Ds2StarToDplusK0s || channel == DecayChannel::XcToDplusLambda || channel == DecayChannel::LambdaDminus) { massD = massDplus; } else if (channel == DecayChannel::Ds1ToDstarK0s) { massD = massDstar; @@ -128,19 +138,27 @@ struct HfCandidateCreatorCharmResoReduced { return true; } + /// Basic selection of V0 candidates + /// \param candV0 is the reduced V0 candidate + /// \param candD is the reduced D meson candidate + /// \return true if selections are passed template bool isV0Selected(V0RedTable const& candV0, DRedTable const& candD) { float massV0{0.}; float invMassV0{0.}; + // slection on V0 candidate mass if (channel == DecayChannel::Ds2StarToDplusK0s || channel == DecayChannel::Ds1ToDstarK0s) { massV0 = massK0; invMassV0 = candV0.invMassK0s(); - } else if (channel == DecayChannel::XcToDplusLambda) { + } else if (channel == DecayChannel::XcToDplusLambda || channel == DecayChannel::LambdaDminus) { massV0 = massLambda; + int wsFact{1}; + if (channel == DecayChannel::LambdaDminus) + wsFact = -1; uint8_t targetV0Type{0}; - if (candD.dType() > 0) { + if (wsFact * candD.dType() > 0) { invMassV0 = candV0.invMassLambda(); targetV0Type = V0Type::Lambda; } else { @@ -157,7 +175,7 @@ struct HfCandidateCreatorCharmResoReduced { return true; } - template + template void runCandidateCreation(Coll const& collisions, DRedTable const& candsD, V0RedTable const& candsV0) @@ -175,7 +193,7 @@ struct HfCandidateCreatorCharmResoReduced { registry.fill(HIST("hSelections"), 1 + Selections::DSel); } float invMassD = candD.invMass(); - std::array pVecD = {candD.px(), candD.py(), candD.pz()}; + std::array pVecD = candD.pVector(); float ptD = RecoDecay::pt(pVecD); ; // loop on V0 candidates @@ -190,7 +208,7 @@ struct HfCandidateCreatorCharmResoReduced { } float invMassReso{0.}; float invMassV0{0.}; - std::array pVecV0 = {candV0.px(), candV0.py(), candV0.pz()}; + std::array pVecV0 = candV0.pVector(); float ptV0 = RecoDecay::pt(pVecV0); float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0, pVecD)); switch (channel) { @@ -213,6 +231,15 @@ struct HfCandidateCreatorCharmResoReduced { invMassReso = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); registry.fill(HIST("hMassXcRes"), invMassReso, ptReso); break; + case DecayChannel::LambdaDminus: + if (candD.dType() < 0) { + invMassV0 = candV0.invMassLambda(); + } else { + invMassV0 = candV0.invMassAntiLambda(); + } + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); + registry.fill(HIST("hMassLambdaDminus"), invMassReso, ptReso); + break; default: break; } @@ -227,6 +254,9 @@ struct HfCandidateCreatorCharmResoReduced { candV0.cpa(), candV0.dca(), candV0.radius()); + if constexpr (fillMl) { + mlScores(candD.mlScoreBkgMassHypo0(), candD.mlScorePromptMassHypo0(), candD.mlScoreNonpromptMassHypo0()); + } } } } // main function @@ -235,25 +265,66 @@ struct HfCandidateCreatorCharmResoReduced { aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const&) { - runCandidateCreation(collision, candsD, candidatesK0s); + runCandidateCreation(collision, candsD, candidatesK0s); } - PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs2StarToDplusK0s, "Process Ds2* candidates without MC info and without ML info", true); + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs2StarToDplusK0s, "Process Ds2* candidates without ML info", true); + + void processDs2StarToDplusK0sWithMl(aod::HfRedCollisions::iterator const& collision, + soa::Join const& candsD, + aod::HfRedVzeros const&) + { + runCandidateCreation(collision, candsD, candidatesK0s); + } + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs2StarToDplusK0sWithMl, "Process Ds2* candidates with Ml info", false); void processDs1ToDstarK0s(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const&) { - runCandidateCreation(collision, candsD, candidatesK0s); + runCandidateCreation(collision, candsD, candidatesK0s); + } + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs1ToDstarK0s, "Process Ds1 candidates without Ml info", false); + + void processDs1ToDstarK0sWithMl(aod::HfRedCollisions::iterator const& collision, + soa::Join const& candsD, + aod::HfRedVzeros const&) + { + runCandidateCreation(collision, candsD, candidatesK0s); } - PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs1ToDstarK0s, "Process Ds1 candidates without MC info and without ML info", false); + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDs1ToDstarK0sWithMl, "Process Ds1 candidates with Ml info", false); void processXcToDplusLambda(aod::HfRedCollisions::iterator const& collision, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const&) { - runCandidateCreation(collision, candsD, candidatesLambda); + runCandidateCreation(collision, candsD, candidatesLambda); + } + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processXcToDplusLambda, "Process Xc candidates without Ml info", false); + + void processXcToDplusLambdaWithMl(aod::HfRedCollisions::iterator const& collision, + soa::Join const& candsD, + aod::HfRedVzeros const&) + { + runCandidateCreation(collision, candsD, candidatesLambda); } - PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processXcToDplusLambda, "Process Xc candidates without MC info and without ML info", false); + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processXcToDplusLambdaWithMl, "Process Xc candidates with Ml info", false); + + void processLambdaDminus(aod::HfRedCollisions::iterator const& collision, + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedVzeros const&) + { + runCandidateCreation(collision, candsD, candidatesLambda); + } + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processLambdaDminus, "Process LambdaDminus candidates without Ml info", false); + + void processLambdaDminusWithMl(aod::HfRedCollisions::iterator const& collision, + soa::Join const& candsD, + aod::HfRedVzeros const&) + { + runCandidateCreation(collision, candsD, candidatesLambda); + } + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processLambdaDminusWithMl, "Process LambdaDminus candidates with Ml info", false); + }; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 84dca3429fe..b4b9f12eb23 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -494,8 +494,8 @@ struct HfDataCreatorCharmHadPiReduced { o2::track::TrackParCov trackParCov1 = getTrackParCov(charmHadDauTracks[1]); o2::track::TrackParCov trackParCov2{}; - std::array pVec0 = {charmHadDauTracks[0].px(), charmHadDauTracks[0].py(), charmHadDauTracks[0].pz()}; - std::array pVec1 = {charmHadDauTracks[1].px(), charmHadDauTracks[1].py(), charmHadDauTracks[1].pz()}; + std::array pVec0 = charmHadDauTracks[0].pVector(); + std::array pVec1 = charmHadDauTracks[1].pVector(); std::array pVec2{}; auto dca0 = o2::dataformats::DCA(charmHadDauTracks[0].dcaXY(), charmHadDauTracks[0].dcaZ(), charmHadDauTracks[0].cYY(), charmHadDauTracks[0].cZY(), charmHadDauTracks[0].cZZ()); @@ -514,7 +514,7 @@ struct HfDataCreatorCharmHadPiReduced { if constexpr (decChannel == DecayChannel::B0ToDminusPi) { charmHadDauTracks.push_back(candC.template prong2_as()); trackParCov2 = getTrackParCov(charmHadDauTracks[2]); - pVec2 = std::array{charmHadDauTracks[2].px(), charmHadDauTracks[2].py(), charmHadDauTracks[2].pz()}; + pVec2 = charmHadDauTracks[2].pVector(); auto dca2 = o2::dataformats::DCA(charmHadDauTracks[2].dcaXY(), charmHadDauTracks[2].dcaZ(), charmHadDauTracks[2].cYY(), charmHadDauTracks[2].cZY(), charmHadDauTracks[2].cZZ()); if (charmHadDauTracks[2].collisionId() != thisCollId) { @@ -580,7 +580,7 @@ struct HfDataCreatorCharmHadPiReduced { // apply selections on pion tracks auto trackParCovPion = getTrackParCov(trackPion); o2::gpu::gpustd::array dcaPion{trackPion.dcaXY(), trackPion.dcaZ()}; - std::array pVecPion = {trackPion.px(), trackPion.py(), trackPion.pz()}; + std::array pVecPion = trackPion.pVector(); if (trackPion.collisionId() != thisCollId) { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovPion, 2.f, noMatCorr, &dcaPion); getPxPyPz(trackParCovPion, pVecPion); @@ -723,7 +723,7 @@ struct HfDataCreatorCharmHadPiReduced { } auto ptParticle = particle.pt(); - auto yParticle = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, massB); + auto yParticle = RecoDecay::y(particle.pVector(), massB); auto etaParticle = particle.eta(); std::array ptProngs; @@ -733,7 +733,7 @@ struct HfDataCreatorCharmHadPiReduced { for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); etaProngs[counter] = daught.eta(); - yProngs[counter] = RecoDecay::y(std::array{daught.px(), daught.py(), daught.pz()}, pdg->Mass(daught.pdgCode())); + yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } rowHfB0McGenReduced(flag, ptParticle, yParticle, etaParticle, @@ -756,7 +756,7 @@ struct HfDataCreatorCharmHadPiReduced { } auto ptParticle = particle.pt(); - auto yParticle = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, massB); + auto yParticle = RecoDecay::y(particle.pVector(), massB); auto etaParticle = particle.eta(); std::array ptProngs; @@ -766,7 +766,7 @@ struct HfDataCreatorCharmHadPiReduced { for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); etaProngs[counter] = daught.eta(); - yProngs[counter] = RecoDecay::y(std::array{daught.px(), daught.py(), daught.pz()}, pdg->Mass(daught.pdgCode())); + yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } rowHfBpMcGenReduced(flag, ptParticle, yParticle, etaParticle, diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index a06e69b824c..1acec493668 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -69,12 +69,15 @@ enum DType : uint8_t { /// Creation of D-V0 pairs struct HfDataCreatorCharmResoReduced { + // Produces AOD tables to store track information Produces hfReducedCollision; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h Produces hfCollisionCounter; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h - + // V0 and D candidates reduced tables Produces hfCandV0; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h Produces hfCandD; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h + // ML optional Tables + Produces hfCandDMl; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h // CCDB configuration o2::ccdb::CcdbApi ccdbApi; @@ -106,14 +109,18 @@ struct HfDataCreatorCharmResoReduced { bool isHfCandResoConfigFilled = false; using CandsDplusFiltered = soa::Filtered>; + using CandsDplusFilteredWithMl = soa::Filtered>; using CandDstarFiltered = soa::Filtered>; + using CandDstarFilteredWithMl = soa::Filtered>; using BigTracksPID = soa::Join; Filter filterSelectDplus = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus); Filter filterSelectedCandDstar = (aod::hf_sel_candidate_dstar::isSelDstarToD0Pi == selectionFlagDstarToD0Pi); Preslice candsDplusPerCollision = aod::track_association::collisionId; + Preslice candsDplusPerCollisionWithMl = aod::track_association::collisionId; Preslice candsDstarPerCollision = aod::track_association::collisionId; + Preslice candsDstarPerCollisionWithMl = aod::track_association::collisionId; Preslice trackIndicesPerCollision = aod::track_association::collisionId; Preslice candsV0PerCollision = aod::track_association::collisionId; @@ -206,7 +213,7 @@ struct HfDataCreatorCharmResoReduced { return selMap; } - template + template void runDataCreation(aod::Collision const& collision, CCands const& candsD, aod::V0Datas const& V0s, @@ -233,7 +240,8 @@ struct HfDataCreatorCharmResoReduced { std::array prongIdsD; uint8_t v0type; int8_t dtype; - if constexpr (std::is_same::value) { + std::array bdtScores; + if constexpr (DecayChannel == DecayChannel::DstarV0) { if (candD.signSoftPi() > 0) invMassD = candD.invMassDstar(); else @@ -247,7 +255,10 @@ struct HfDataCreatorCharmResoReduced { prongIdsD[1] = candD.prong1Id(); prongIdsD[2] = candD.prongPiId(); dtype = candD.signSoftPi() * DType::Dstar; - } else if constexpr (std::is_same::value) { + if constexpr (withMl) { + std::copy(candD.mlProbDstarToD0Pi().begin(), candD.mlProbDstarToD0Pi().end(), bdtScores.begin()); + } + } else if constexpr (DecayChannel == DecayChannel::DplusV0) { auto prong0 = candD.template prong0_as(); invMassD = hfHelper.invMassDplusToPiKPi(candD); massD = MassDPlus; @@ -259,6 +270,9 @@ struct HfDataCreatorCharmResoReduced { prongIdsD[1] = candD.prong1Id(); prongIdsD[2] = candD.prong2Id(); dtype = static_cast(prong0.sign() * DType::Dplus); + if constexpr (withMl) { + std::copy(candD.mlProbDplusToPiKPi().begin(), candD.mlProbDplusToPiKPi().end(), bdtScores.begin()); + } } // else if // Loop on V0 candidates @@ -340,6 +354,9 @@ struct HfDataCreatorCharmResoReduced { invMassD, pVecD[0], pVecD[1], pVecD[2], dtype); + if constexpr (withMl) { + hfCandDMl(bdtScores[0], bdtScores[1], bdtScores[2]); + } fillHfReducedCollision = true; switch (DecayChannel) { case DecayChannel::DstarV0: @@ -380,11 +397,30 @@ struct HfDataCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); - runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); } } PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0, "Process Dplus candidates without MC info and without ML info", true); + void processDplusV0WithMl(aod::Collisions const& collisions, + CandsDplusFilteredWithMl const& candsDplus, + aod::TrackAssoc const& trackIndices, + aod::V0Datas const& V0s, + BigTracksPID const& tracks, + aod::BCsWithTimestamps const& bcs) + { + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize()); + + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); + auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); + } + } + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0WithMl, "Process Dplus candidates with ML info", false); + void processDstarV0(aod::Collisions const& collisions, CandDstarFiltered const& candsDstar, aod::TrackAssoc const&, @@ -399,10 +435,29 @@ struct HfDataCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); - runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); } } PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0, "Process DStar candidates without MC info and without ML info", false); + + void processDstarV0WithMl(aod::Collisions const& collisions, + CandDstarFilteredWithMl const& candsDstar, + aod::TrackAssoc const& trackIndices, + aod::V0Datas const& V0s, + BigTracksPID const& tracks, + aod::BCsWithTimestamps const& bcs) + { + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize()); + + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); + auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); + } + } + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0WithMl, "Process DStar candidates with ML info", false); }; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/D2H/Tasks/taskB0.cxx b/PWGHF/D2H/Tasks/taskB0.cxx index 7525b5143ee..29d59ed912e 100644 --- a/PWGHF/D2H/Tasks/taskB0.cxx +++ b/PWGHF/D2H/Tasks/taskB0.cxx @@ -271,7 +271,7 @@ struct HfTaskB0 { if (TESTBIT(std::abs(particle.flagMcMatchGen()), hf_cand_b0::DecayType::B0ToDPi)) { auto ptParticle = particle.pt(); - auto yParticle = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassB0); + auto yParticle = RecoDecay::y(particle.pVector(), o2::constants::physics::MassB0); if (yCandGenMax >= 0. && std::abs(yParticle) > yCandGenMax) { continue; } @@ -283,7 +283,7 @@ struct HfTaskB0 { for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); etaProngs[counter] = daught.eta(); - yProngs[counter] = RecoDecay::y(std::array{daught.px(), daught.py(), daught.pz()}, pdg->Mass(daught.pdgCode())); + yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } diff --git a/PWGHF/D2H/Tasks/taskB0Reduced.cxx b/PWGHF/D2H/Tasks/taskB0Reduced.cxx index a767f32f6c1..9b5a9c2d40a 100644 --- a/PWGHF/D2H/Tasks/taskB0Reduced.cxx +++ b/PWGHF/D2H/Tasks/taskB0Reduced.cxx @@ -339,7 +339,7 @@ struct HfTaskB0Reduced { auto invMassD = candD.invMass(); std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; std::array posSvD{candD.xSecondaryVertex(), candD.ySecondaryVertex(), candD.zSecondaryVertex()}; - std::array momD{candD.px(), candD.py(), candD.pz()}; + std::array momD{candD.pVector()}; auto cospD = RecoDecay::cpa(posPv, posSvD, momD); auto cospXyD = RecoDecay::cpaXY(posPv, posSvD, momD); auto decLenD = RecoDecay::distance(posPv, posSvD); diff --git a/PWGHF/D2H/Tasks/taskBplus.cxx b/PWGHF/D2H/Tasks/taskBplus.cxx index 5bbc9538978..6920054084c 100644 --- a/PWGHF/D2H/Tasks/taskBplus.cxx +++ b/PWGHF/D2H/Tasks/taskBplus.cxx @@ -262,7 +262,7 @@ struct HfTaskBplus { if (TESTBIT(std::abs(particle.flagMcMatchGen()), hf_cand_bplus::DecayType::BplusToD0Pi)) { auto ptParticle = particle.pt(); - auto yParticle = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassBPlus); + auto yParticle = RecoDecay::y(particle.pVector(), o2::constants::physics::MassBPlus); if (yCandGenMax >= 0. && std::abs(yParticle) > yCandGenMax) { continue; } @@ -272,7 +272,7 @@ struct HfTaskBplus { for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); etaProngs[counter] = daught.eta(); - yProngs[counter] = RecoDecay::y(std::array{daught.px(), daught.py(), daught.pz()}, pdg->Mass(daught.pdgCode())); + yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } diff --git a/PWGHF/D2H/Tasks/taskBplusReduced.cxx b/PWGHF/D2H/Tasks/taskBplusReduced.cxx index 0224cec2f31..6f1b775c240 100644 --- a/PWGHF/D2H/Tasks/taskBplusReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBplusReduced.cxx @@ -216,7 +216,7 @@ struct HfTaskBplusReduced { auto candD0 = candidate.prong0_as(); std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; std::array posSvD{candD0.xSecondaryVertex(), candD0.ySecondaryVertex(), candD0.zSecondaryVertex()}; - std::array momD{candD0.px(), candD0.py(), candD0.pz()}; + std::array momD{candD0.pVector()}; auto cospD0 = RecoDecay::cpa(posPv, posSvD, momD); auto decLenD0 = RecoDecay::distance(posPv, posSvD); diff --git a/PWGHF/D2H/Tasks/taskBs.cxx b/PWGHF/D2H/Tasks/taskBs.cxx index 619dadc188c..29c424f869b 100644 --- a/PWGHF/D2H/Tasks/taskBs.cxx +++ b/PWGHF/D2H/Tasks/taskBs.cxx @@ -268,7 +268,7 @@ struct HfTaskBs { if (TESTBIT(std::abs(particle.flagMcMatchGen()), hf_cand_bs::DecayTypeMc::BsToDsPiToKKPiPi)) { auto ptParticle = particle.pt(); - auto yParticle = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassBS); + auto yParticle = RecoDecay::y(particle.pVector(), o2::constants::physics::MassBS); if (yCandGenMax >= 0. && std::abs(yParticle) > yCandGenMax) { continue; } @@ -280,7 +280,7 @@ struct HfTaskBs { for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); etaProngs[counter] = daught.eta(); - yProngs[counter] = RecoDecay::y(std::array{daught.px(), daught.py(), daught.pz()}, pdg->Mass(daught.pdgCode())); + yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } diff --git a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx index 3ff9529b43f..2f45e221317 100644 --- a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx +++ b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx @@ -354,29 +354,29 @@ struct TaskPolarisationCharmHadrons { registry.fill(HIST("hHelicity"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, isRotatedCandidate); } } - } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt + } else { // MC --> no distinction among channels, since rotational bkg not supported + if constexpr (withMl) { // with ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); } - } else { // non-prompt + } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); } } - } else { // without ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt + } else { // without ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptHelicity"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar); } - } else { // non-prompt + } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ registry.fill(HIST("hRecoNonPromptHelicity"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ @@ -400,15 +400,29 @@ struct TaskPolarisationCharmHadrons { registry.fill(HIST("hProduction"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, isRotatedCandidate); } } - } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt + } else { // MC --> no distinction among channels, since rotational bkg not supported + if constexpr (withMl) { // with ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } + } else { // non-prompt + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } + } + } else { // without ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptProduction"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar); } - } else { // non-prompt + } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ registry.fill(HIST("hRecoNonPromptProduction"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ @@ -432,15 +446,29 @@ struct TaskPolarisationCharmHadrons { registry.fill(HIST("hBeam"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, isRotatedCandidate); } } - } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt + } else { // MC --> no distinction among channels, since rotational bkg not supported + if constexpr (withMl) { // with ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } + } else { // non-prompt + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } + } + } else { // without ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptBeam"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar); } - } else { // non-prompt + } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ registry.fill(HIST("hRecoNonPromptBeam"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ @@ -464,15 +492,29 @@ struct TaskPolarisationCharmHadrons { registry.fill(HIST("hRandom"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, isRotatedCandidate); } } - } else { // MC --> no distinction among channels, since rotational bkg not supported - if constexpr (withMl) { // with ML - if (origin == RecoDecay::OriginType::Prompt) { // prompt + } else { // MC --> no distinction among channels, since rotational bkg not supported + if constexpr (withMl) { // with ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } + } else { // non-prompt + if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ + registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ + registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar, outputMl[0], /*outputMl[1],*/ outputMl[2]); + } + } + } else { // without ML + if (origin == RecoDecay::OriginType::Prompt) { // prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ registry.fill(HIST("hRecoPromptRandom"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, cosThetaStar); } - } else { // non-prompt + } else { // non-prompt if constexpr (channel == charm_polarisation::DecayChannel::DstarToDzeroPi) { // D*+ registry.fill(HIST("hRecoNonPromptRandom"), invMassCharmHad, ptCharmHad, pzCharmHad, rapCharmHad, invMassD0, cosThetaStar); } else if constexpr (channel == charm_polarisation::DecayChannel::LcToPKPi) { // Lc+ @@ -562,9 +604,9 @@ struct TaskPolarisationCharmHadrons { massDau = massPi; // (*) const float bkgRotAngle = bkgRotationAngleStep * bkgRotationId; - std::array threeVecSoftPi{candidate.pxSoftPi() * std::cos(bkgRotAngle) - candidate.pxSoftPi() * std::sin(bkgRotAngle), candidate.pxSoftPi() * std::cos(bkgRotAngle) + candidate.pxSoftPi() * std::sin(bkgRotAngle), candidate.pzSoftPi()}; // we rotate the soft pion - std::array threeVecD0Prong0{candidate.pxProng0(), candidate.pxProng0(), candidate.pzProng0()}; - std::array threeVecD0Prong1{candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}; + std::array threeVecSoftPi{candidate.pxSoftPi() * std::cos(bkgRotAngle) - candidate.pySoftPi() * std::sin(bkgRotAngle), candidate.pxSoftPi() * std::sin(bkgRotAngle) + candidate.pySoftPi() * std::cos(bkgRotAngle), candidate.pzSoftPi()}; // we rotate the soft pion + std::array threeVecD0Prong0{candidate.pVectorProng0()}; + std::array threeVecD0Prong1{candidate.pVectorProng1()}; if (bkgRotationId > 0) { isRotatedCandidate = 1; pxDau = threeVecSoftPi[0]; @@ -618,9 +660,9 @@ struct TaskPolarisationCharmHadrons { /// mass-hypothesis-independent variables /// daughters momenta const float bkgRotAngle = bkgRotationAngleStep * bkgRotationId; - std::array threeVecLcProng0{candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()}; + std::array threeVecLcProng0{candidate.pVectorProng0()}; std::array threeVecLcRotatedProng1{candidate.pxProng1() * std::cos(bkgRotAngle) - candidate.pyProng1() * std::sin(bkgRotAngle), candidate.pxProng1() * std::sin(bkgRotAngle) + candidate.pyProng1() * std::cos(bkgRotAngle), candidate.pzProng1()}; - std::array threeVecLcProng2{candidate.pxProng2(), candidate.pyProng2(), candidate.pzProng2()}; + std::array threeVecLcProng2{candidate.pVectorProng2()}; if (bkgRotationId > 0) { /// rotational background - pt of the kaon track rotated /// update candidate momentum @@ -636,7 +678,7 @@ struct TaskPolarisationCharmHadrons { pzCharmHad = candidate.pz(); } massDau = massProton; // (*) - rapidity = RecoDecay::y(std::array{pxCharmHad, pyCharmHad, pzCharmHad}, massLc); + rapidity = RecoDecay::y(candidate.pVector(), massLc); /// mass-hypothesis-dependent variables if (iMass == charm_polarisation::MassHyposLcToPKPi::PKPi && candidate.isSelLcToPKPi() >= selectionFlagLcToPKPi) { diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index 56e591a3e14..84edf213c89 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -52,6 +52,15 @@ struct HfTaskD0 { // ML inference Configurable applyMl{"applyMl", false, "Flag to apply ML selections"}; + // ThnSparse for ML outputScores and Vars + ConfigurableAxis thnConfigAxisBkgScore{"thnConfigAxisBkgScore", {50, 0, 1}, "Bkg score bins"}; + ConfigurableAxis thnConfigAxisNonPromptScore{"thnConfigAxisNonPromptScore", {50, 0, 1}, "Non-prompt score bins"}; + ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {120, 1.5848, 2.1848}, "Cand. inv-mass bins"}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {120, 0, 24}, "Cand. pT bins"}; + ConfigurableAxis thnConfigAxisY{"thnConfigAxisY", {20, -1, 1}, "Cand. rapidity bins"}; + ConfigurableAxis thnConfigAxisOrigin{"thnConfigAxisOrigin", {3, -0.5, 2.5}, "Cand. origin type"}; + ConfigurableAxis thnConfigAxisCandType{"thnConfigAxisCandType", {4, -0.5, 3.5}, "D0 type"}; + HfHelper hfHelper; using D0Candidates = soa::Join; @@ -74,8 +83,6 @@ struct HfTaskD0 { 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.}}}}, @@ -202,7 +209,15 @@ struct HfTaskD0 { 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); + const AxisSpec thnAxisBkgScore{thnConfigAxisBkgScore, "BDT score bkg."}; + const AxisSpec thnAxisNonPromptScore{thnConfigAxisNonPromptScore, "BDT score non-prompt."}; + const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (#pi K) (GeV/#it{c}^{2})"}; + const AxisSpec thnAxisPt{thnConfigAxisPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec thnAxisY{thnConfigAxisY, "y"}; + const AxisSpec thnAxisOrigin{thnConfigAxisOrigin, "Origin"}; + const AxisSpec thnAxisCandType{thnConfigAxisCandType, "D0 type"}; + + registry.add("hBdtScoreVsMassVsPtVsYVsOriginVsD0Type", "Thn for D0 candidates with BDT scores", HistType::kTHnSparseD, {thnAxisBkgScore, thnAxisNonPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisOrigin, thnAxisCandType}); registry.get(HIST("hBdtScoreVsMassVsPtVsYVsOriginVsD0Type"))->Sumw2(); } } @@ -327,7 +342,7 @@ struct HfTaskD0 { 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 + auto yGen = RecoDecay::y(particleMother.pVector(), o2::constants::physics::MassD0); // gen. level y registry.fill(HIST("hPtGenSig"), ptGen); // gen. level pT auto ptRec = candidate.pt(); auto yRec = hfHelper.yD0(candidate); @@ -485,11 +500,11 @@ struct HfTaskD0 { // MC gen. for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_2prong::DecayType::D0ToPiK) { - if (yCandGenMax >= 0. && std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassD0)) > yCandGenMax) { + if (yCandGenMax >= 0. && std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0)) > yCandGenMax) { continue; } auto ptGen = particle.pt(); - auto yGen = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassD0); + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0); registry.fill(HIST("hPtGen"), ptGen); registry.fill(HIST("hPtVsYGen"), ptGen, yGen); if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index 3911bfa53da..ca28eacd505 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -245,7 +245,7 @@ struct HfTaskDplus { void fillHistoMCGen(const T2& particle) { auto ptGen = particle.pt(); - auto yGen = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassDPlus); + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus); registry.fill(HIST("hPtGen"), ptGen); registry.fill(HIST("hPtVsYGen"), ptGen, yGen); if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { @@ -322,7 +322,7 @@ struct HfTaskDplus { } // MC gen. for (const auto& particle : mcParticles) { - auto yGen = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassDPlus); + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus); if ((yCandGenMax >= 0. && std::abs(yGen) > yCandGenMax) || (std::abs(particle.flagMcMatchGen()) != 1 << aod::hf_cand_3prong::DecayType::DplusToPiKPi)) { continue; } diff --git a/PWGHF/D2H/Tasks/taskDs.cxx b/PWGHF/D2H/Tasks/taskDs.cxx index 8d823a405bf..fc9f0aaa0b0 100644 --- a/PWGHF/D2H/Tasks/taskDs.cxx +++ b/PWGHF/D2H/Tasks/taskDs.cxx @@ -545,7 +545,7 @@ struct HfTaskDs { auto y = 0; if (particle.flagMcDecayChanGen() == decayChannel) { - y = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassDS); + y = RecoDecay::y(particle.pVector(), o2::constants::physics::MassDS); if (yCandGenMax >= 0. && std::abs(y) > yCandGenMax) { continue; } @@ -560,7 +560,7 @@ struct HfTaskDs { std::get(histosPtr[DataType::McDsNonPrompt]["hEtaGen"])->Fill(particle.eta()); // gen. level pT } } else if (fillDplusMc) { - y = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassDPlus); + y = RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus); if (yCandGenMax >= 0. && std::abs(y) > yCandGenMax) { continue; } diff --git a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx index ea11c0c8a98..c3428717c61 100644 --- a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx +++ b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx @@ -255,7 +255,7 @@ struct HfTaskDstarToD0Pi { if (TESTBIT(std::abs(mcParticle.flagMcMatchGen()), aod::hf_cand_dstar::DecayType::DstarToD0Pi)) { // MC Matching is successful at Generator Level auto ptGen = mcParticle.pt(); // auto yGen = mcParticle.y(); // Can we use this definition? - auto yGen = RecoDecay::y(std::array{mcParticle.px(), mcParticle.py(), mcParticle.pz()}, o2::constants::physics::MassDStar); + auto yGen = RecoDecay::y(mcParticle.pVector(), o2::constants::physics::MassDStar); if (yCandDstarGenMax >= 0. && std::abs(yGen) > yCandDstarGenMax) { continue; } diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 5fc2fbda332..499b0d70946 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -36,7 +36,9 @@ enum DecayChannel { DplusToPiKPi = 0, DsToKKPi, DsToPiKK, D0ToPiK, - D0ToKPi }; + D0ToKPi, + LcToPKPi, + LcToPiKP }; enum QvecEstimator { FV0A = 0, FT0M, @@ -68,6 +70,8 @@ struct HfTaskFlowCharmHadrons { using CandDsData = soa::Filtered>; using CandDplusDataWMl = soa::Filtered>; using CandDplusData = soa::Filtered>; + using CandLcData = soa::Filtered>; + using CandLcDataWMl = soa::Filtered>; using CandD0DataWMl = soa::Filtered>; using CandD0Data = soa::Filtered>; using CollsWithQvecs = soa::Join; @@ -75,6 +79,7 @@ struct HfTaskFlowCharmHadrons { Filter filterSelectDsCandidates = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlag; Filter filterSelectD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; + Filter filterSelectLcCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlag || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlag; Partition selectedDsToKKPi = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag; Partition selectedDsToPiKK = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; @@ -84,6 +89,10 @@ struct HfTaskFlowCharmHadrons { Partition selectedD0ToKPi = aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; Partition selectedD0ToPiKWMl = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag; Partition selectedD0ToKPiWMl = aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; + Partition selectedLcToPKPi = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlag; + Partition selectedLcToPiKP = aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlag; + Partition selectedLcToPKPiWMl = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlag; + Partition selectedLcToPiKPWMl = aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlag; SliceCache cache; HfHelper hfHelper; @@ -262,6 +271,7 @@ struct HfTaskFlowCharmHadrons { case QvecEstimator::FT0C: xQVec = collision.qvecFT0CRe(); yQVec = collision.qvecFT0CIm(); + break; case QvecEstimator::TPCPos: xQVec = collision.qvecBPosRe(); yQVec = collision.qvecBPosIm(); @@ -345,6 +355,25 @@ struct HfTaskFlowCharmHadrons { default: break; } + } else if constexpr (std::is_same_v || std::is_same_v) { + switch (channel) { + case DecayChannel::LcToPKPi: + massCand = hfHelper.invMassLcToPKPi(candidate); + if constexpr (std::is_same_v) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + outputMl[iclass] = candidate.mlProbLcToPKPi()[classMl->at(iclass)]; + } + break; + case DecayChannel::LcToPiKP: + massCand = hfHelper.invMassLcToPiKP(candidate); + if constexpr (std::is_same_v) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + outputMl[iclass] = candidate.mlProbLcToPiKP()[classMl->at(iclass)]; + } + break; + default: + break; + } } float ptCand = candidate.pt(); @@ -432,6 +461,28 @@ struct HfTaskFlowCharmHadrons { } PROCESS_SWITCH(HfTaskFlowCharmHadrons, processD0, "Process D0 candidates", false); + // Lc with ML + void processLcMl(CollsWithQvecs::iterator const& collision, + CandLcDataWMl const&) + { + auto candsLcToPKPiWMl = selectedLcToPKPiWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + auto candsLcToPiKPWMl = selectedLcToPiKPWMl->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + runFlowAnalysis(collision, candsLcToPKPiWMl); + runFlowAnalysis(collision, candsLcToPiKPWMl); + } + PROCESS_SWITCH(HfTaskFlowCharmHadrons, processLcMl, "Process Lc candidates with ML", false); + + // Lc with rectangular cuts + void processLc(CollsWithQvecs::iterator const& collision, + CandLcData const&) + { + auto candsLcToPKPi = selectedLcToPKPi->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + auto candsLcToPiKP = selectedLcToPiKP->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache); + runFlowAnalysis(collision, candsLcToPKPi); + runFlowAnalysis(collision, candsLcToPiKP); + } + PROCESS_SWITCH(HfTaskFlowCharmHadrons, processLc, "Process Lc candidates", false); + // Resolution void processResolution(CollsWithQvecs::iterator const& collision) { diff --git a/PWGHF/D2H/Tasks/taskLb.cxx b/PWGHF/D2H/Tasks/taskLb.cxx index 2db336a9ab1..788e9717be4 100644 --- a/PWGHF/D2H/Tasks/taskLb.cxx +++ b/PWGHF/D2H/Tasks/taskLb.cxx @@ -247,7 +247,7 @@ struct HfTaskLbMc { for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << hf_cand_lb::DecayType::LbToLcPi) { - auto yParticle = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassLambdaB0); + auto yParticle = RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaB0); if (yCandGenMax >= 0. && std::abs(yParticle) > yCandGenMax) { continue; } @@ -257,7 +257,7 @@ struct HfTaskLbMc { for (const auto& daught : particle.daughters_as()) { ptProngs[counter] = daught.pt(); etaProngs[counter] = daught.eta(); - yProngs[counter] = RecoDecay::y(std::array{daught.px(), daught.py(), daught.pz()}, pdg->Mass(daught.pdgCode())); + yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index ae66c2a2e65..842c4b18e11 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -617,7 +617,7 @@ struct HfTaskLc { // MC gen. for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { - auto yGen = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassLambdaCPlus); + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaCPlus); if (yCandGenMax >= 0. && std::abs(yGen) > yCandGenMax) { continue; } diff --git a/PWGHF/D2H/Tasks/taskSigmac.cxx b/PWGHF/D2H/Tasks/taskSigmac.cxx index 6701c87880c..72cdb981776 100644 --- a/PWGHF/D2H/Tasks/taskSigmac.cxx +++ b/PWGHF/D2H/Tasks/taskSigmac.cxx @@ -542,7 +542,7 @@ struct HfTaskSigmac { OR consider the new parametrization of the fiducial acceptance (to be seen for reco signal in MC) */ - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassSigmaC0)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassSigmaC0)) > yCandMax) { continue; } diff --git a/PWGHF/D2H/Tasks/taskXic.cxx b/PWGHF/D2H/Tasks/taskXic.cxx index a2b553fc164..fa337ff6265 100644 --- a/PWGHF/D2H/Tasks/taskXic.cxx +++ b/PWGHF/D2H/Tasks/taskXic.cxx @@ -497,7 +497,7 @@ struct HfTaskXic { // MC gen. for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::XicToPKPi) { - auto yParticle = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassXiCPlus); + auto yParticle = RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus); if (yCandGenMax >= 0. && std::abs(yParticle) > yCandGenMax) { continue; } @@ -509,7 +509,7 @@ struct HfTaskXic { for (const auto& daught : particle.daughters_as>()) { ptProngs[counter] = daught.pt(); etaProngs[counter] = daught.eta(); - yProngs[counter] = RecoDecay::y(std::array{daught.px(), daught.py(), daught.pz()}, pdg->Mass(daught.pdgCode())); + yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } diff --git a/PWGHF/D2H/Tasks/taskXicc.cxx b/PWGHF/D2H/Tasks/taskXicc.cxx index 710aa107ffc..0e3f116081a 100644 --- a/PWGHF/D2H/Tasks/taskXicc.cxx +++ b/PWGHF/D2H/Tasks/taskXicc.cxx @@ -264,13 +264,13 @@ struct HfTaskXiccMc { // MC gen. for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_xicc::DecayType::XiccToXicPi) { - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassXiCCPlusPlus)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCCPlusPlus)) > yCandMax) { continue; } registry.fill(HIST("hPtGen"), particle.pt()); registry.fill(HIST("hEtaGen"), particle.eta()); - registry.fill(HIST("hYGen"), RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassXiCCPlusPlus)); - registry.fill(HIST("hPtvsEtavsYGen"), particle.pt(), particle.eta(), RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassXiCCPlusPlus)); + registry.fill(HIST("hYGen"), RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCCPlusPlus)); + registry.fill(HIST("hPtvsEtavsYGen"), particle.pt(), particle.eta(), RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCCPlusPlus)); } } // end of loop of MC particles } // end of process function diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 63ba9e3d09e..272fe779193 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -1700,13 +1700,7 @@ DECLARE_SOA_TABLE(HfD0FromDstarBase, "AOD", "HFD0FRMDSTR", hf_cand_dstar::DecayLengthNormalisedD0, hf_cand_dstar::DecayLengthXYNormalisedD0, /* prong 0 */ hf_cand::ImpactParameterNormalised0, - hf_cand::PtProng0, - hf_cand::Pt2Prong0, - hf_cand::PVectorProng0, /* prong 1 */ hf_cand::ImpactParameterNormalised1, - hf_cand::PtProng1, - hf_cand::Pt2Prong1, - hf_cand::PVectorProng1, // HFCAND_COLUMNS, // 2-prong specific columns @@ -1717,13 +1711,7 @@ DECLARE_SOA_TABLE(HfD0FromDstarBase, "AOD", "HFD0FRMDSTR", hf_track_index::Prong0Id, hf_track_index::Prong1Id, hf_track_index::HFflag, /* dynamic columns */ - hf_cand_dstar::InvMassD0, - hf_cand_dstar::InvMassD0Bar, - hf_cand_dstar::InvMass2D0, - hf_cand_dstar::InvMass2D0Bar, hf_cand_dstar::ImpactParameterProductD0, - hf_cand_dstar::CosThetaStarD0, - hf_cand_dstar::CosThetaStarD0Bar, hf_cand_dstar::ImpactParameterProngSqSumD0, /* dynamic columns that use candidate momentum components */ hf_cand_dstar::PtD0, @@ -1774,10 +1762,20 @@ DECLARE_SOA_TABLE(HfCandDstarBase, "AOD", "HFCANDDSTRBASE", hf_cand::Phi, hf_cand::Y, hf_cand::E, + hf_cand::PtProng0, + hf_cand::Pt2Prong0, + hf_cand::PVectorProng0, + hf_cand::PtProng1, + hf_cand::Pt2Prong1, + hf_cand::PVectorProng1, hf_cand_dstar::InvMassDstar, hf_cand_dstar::InvMassAntiDstar, hf_cand_dstar::InvMassD0, - hf_cand_dstar::InvMassD0Bar); + hf_cand_dstar::InvMassD0Bar, + hf_cand_dstar::InvMass2D0, + hf_cand_dstar::InvMass2D0Bar, + hf_cand_dstar::CosThetaStarD0, + hf_cand_dstar::CosThetaStarD0Bar); // extended table with expression columns that can be used as arguments of dynamic columns DECLARE_SOA_EXTENDED_TABLE_USER(HfCandDstarExt, HfCandDstarBase, "HFCANDDSTREXT", diff --git a/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx b/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx index d16afed3165..d51ded0baa4 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0D0bar.cxx @@ -401,7 +401,7 @@ struct HfCorrelatorD0D0bar { if (std::abs(particle1.pdgCode()) != Pdg::kD0) { continue; } - double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassD0); + double yD = RecoDecay::y(particle1.pVector(), MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -424,7 +424,7 @@ struct HfCorrelatorD0D0bar { if (particle2.pdgCode() != Pdg::kD0Bar) { // check that inner particle is D0bar continue; } - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle2.px(), particle2.py(), particle2.pz()}, MassD0Bar)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle2.pVector(), MassD0Bar)) > yCandMax) { continue; } if (ptCandMin >= 0. && particle2.pt() < ptCandMin) { @@ -499,7 +499,7 @@ struct HfCorrelatorD0D0bar { continue; } counterCCbarBeforeEtasel++; // count c or cbar (before kinematic selection) - double yC = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassCharm); + double yC = RecoDecay::y(particle1.pVector(), MassCharm); if (yCandMax >= 0. && std::abs(yC) > yCandMax) { continue; } @@ -523,7 +523,7 @@ struct HfCorrelatorD0D0bar { if (particle2.pdgCode() != PDG_t::kCharmBar) { // check that inner particle is a cbar continue; } - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle2.px(), particle2.py(), particle2.pz()}, MassCharmBar)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle2.pVector(), MassCharmBar)) > yCandMax) { continue; } if (ptCandMin >= 0. && particle2.pt() < ptCandMin) { diff --git a/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx b/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx index ebfa494537d..26522739841 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0D0barBarrelFullPid.cxx @@ -402,7 +402,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { if (std::abs(particle1.pdgCode()) != Pdg::kD0) { continue; } - double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassD0); + double yD = RecoDecay::y(particle1.pVector(), MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -425,7 +425,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { if (particle2.pdgCode() != Pdg::kD0Bar) { // check that inner particle is D0bar continue; } - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle2.px(), particle2.py(), particle2.pz()}, MassD0Bar)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle2.pVector(), MassD0Bar)) > yCandMax) { continue; } if (ptCandMin >= 0. && particle2.pt() < ptCandMin) { @@ -500,7 +500,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { continue; } counterCCbarBeforeEtasel++; // count c or cbar (before kinematic selection) - double yC = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassCharm); + double yC = RecoDecay::y(particle1.pVector(), MassCharm); if (yCandMax >= 0. && std::abs(yC) > yCandMax) { continue; } @@ -524,7 +524,7 @@ struct HfCorrelatorD0D0barBarrelFullPid { if (particle2.pdgCode() != PDG_t::kCharmBar) { // check that inner particle is a cbar continue; } - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle2.px(), particle2.py(), particle2.pz()}, MassCharmBar)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle2.pVector(), MassCharmBar)) > yCandMax) { continue; } if (ptCandMin >= 0. && particle2.pt() < ptCandMin) { diff --git a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index b15f3ed32fe..6df44ae66c6 100644 --- a/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx @@ -150,7 +150,7 @@ struct HfCorrelatorD0HadronsSelection { if (std::abs(particle1.pdgCode()) != Pdg::kD0) { continue; } - double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassD0); + double yD = RecoDecay::y(particle1.pVector(), MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -355,7 +355,7 @@ struct HfCorrelatorD0Hadrons { // ========== soft pion removal =================================================== double invMassDstar1 = 0., invMassDstar2 = 0.; bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(candidate1.px() + track.px(), candidate1.py() + track.py(), candidate1.pz() + track.pz()); + auto pSum2 = RecoDecay::p2(candidate1.pVector(), track.pVector()); auto ePion = track.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); @@ -508,7 +508,7 @@ struct HfCorrelatorD0Hadrons { // ===== soft pion removal =================================================== double invMassDstar1 = 0, invMassDstar2 = 0; bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(candidate1.px() + track.px(), candidate1.py() + track.py(), candidate1.pz() + track.pz()); + auto pSum2 = RecoDecay::p2(candidate1.pVector(), track.pVector()); auto ePion = track.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); @@ -576,7 +576,7 @@ struct HfCorrelatorD0Hadrons { if (std::abs(particle1.pdgCode()) != Pdg::kD0) { continue; } - double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassD0); + double yD = RecoDecay::y(particle1.pVector(), MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -666,7 +666,7 @@ struct HfCorrelatorD0Hadrons { auto eKPi = RecoDecay::e(t1.pVectorProng0(), massK) + RecoDecay::e(t1.pVectorProng1(), massPi); double invMassDstar1 = 0., invMassDstar2 = 0.; bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(t1.px() + t2.px(), t1.py() + t2.py(), t1.pz() + t2.pz()); + auto pSum2 = RecoDecay::p2(t1.pVector(), t2.pVector()); auto ePion = t2.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); @@ -730,7 +730,7 @@ struct HfCorrelatorD0Hadrons { auto eKPi = RecoDecay::e(t1.pVectorProng0(), massK) + RecoDecay::e(t1.pVectorProng1(), massPi); double invMassDstar1 = 0., invMassDstar2 = 0.; bool isSoftPiD0 = false, isSoftPiD0bar = false; - auto pSum2 = RecoDecay::p2(t1.px() + t2.px(), t1.py() + t2.py(), t1.pz() + t2.pz()); + auto pSum2 = RecoDecay::p2(t1.pVector(), t2.pVector()); auto ePion = t2.energy(massPi); invMassDstar1 = std::sqrt((ePiK + ePion) * (ePiK + ePion) - pSum2); invMassDstar2 = std::sqrt((eKPi + ePion) * (eKPi + ePion) - pSum2); @@ -838,7 +838,7 @@ struct HfCorrelatorD0Hadrons { continue; } - double yD = RecoDecay::y(std::array{t1.px(), t1.py(), t1.pz()}, MassD0); + double yD = RecoDecay::y(t1.pVector(), MassD0); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } diff --git a/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx b/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx index 3654d435da7..cb70b35e9ad 100644 --- a/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDplusDminus.cxx @@ -384,7 +384,7 @@ struct HfCorrelatorDplusDminus { if (std::abs(particle1.pdgCode()) != Pdg::kDPlus) { continue; } - double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassDPlus); + double yD = RecoDecay::y(particle1.pVector(), MassDPlus); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -407,7 +407,7 @@ struct HfCorrelatorDplusDminus { if (particle2.pdgCode() != -Pdg::kDPlus) { // check that inner particle is a Dminus continue; } - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle2.px(), particle2.py(), particle2.pz()}, MassDPlus)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle2.pVector(), MassDPlus)) > yCandMax) { continue; } if (ptCandMin >= 0. && particle2.pt() < ptCandMin) { @@ -481,7 +481,7 @@ struct HfCorrelatorDplusDminus { continue; } counterCCbarBeforeEtasel++; // count c or cbar (before kinematic selection) - double yC = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassCharm); + double yC = RecoDecay::y(particle1.pVector(), MassCharm); if (yCandMax >= 0. && std::abs(yC) > yCandMax) { continue; } @@ -505,7 +505,7 @@ struct HfCorrelatorDplusDminus { if (particle2.pdgCode() != PDG_t::kCharmBar) { continue; } - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle2.px(), particle2.py(), particle2.pz()}, MassCharmBar)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle2.pVector(), MassCharmBar)) > yCandMax) { continue; } if (ptCandMin >= 0. && particle2.pt() < ptCandMin) { diff --git a/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx index 581f9b61657..506ad6db4d8 100644 --- a/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDplusHadrons.cxx @@ -77,7 +77,7 @@ struct HfCorrelatorDplusHadronsDplusSelection { Partition> selectedDplusCandidatesMc = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus; void processDplusSelectionData(aod::Collision const& collision, - soa::Join const& candidates) + soa::Join const&) { bool isDplusFound = 0; if (selectedDplusCandidates.size() > 0) { @@ -99,7 +99,7 @@ struct HfCorrelatorDplusHadronsDplusSelection { PROCESS_SWITCH(HfCorrelatorDplusHadronsDplusSelection, processDplusSelectionData, "Process Dplus Selection Data", false); void processDplusSelectionMcRec(aod::Collision const& collision, - soa::Join const& candidates) + soa::Join const&) { bool isDplusFound = 0; if (selectedDplusCandidatesMc.size() > 0) { @@ -123,7 +123,7 @@ struct HfCorrelatorDplusHadronsDplusSelection { } PROCESS_SWITCH(HfCorrelatorDplusHadronsDplusSelection, processDplusSelectionMcRec, "Process Dplus Selection MCRec", false); - void processDplusSelectionMcGen(aod::McCollision const& mcCollision, + void processDplusSelectionMcGen(aod::McCollision const&, aod::McParticles const& mcParticles) { bool isDplusFound = 0; @@ -131,7 +131,7 @@ struct HfCorrelatorDplusHadronsDplusSelection { if (std::abs(particle1.pdgCode()) != Pdg::kDPlus) { continue; } - double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassDPlus); + double yD = RecoDecay::y(particle1.pVector(), MassDPlus); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -241,7 +241,7 @@ struct HfCorrelatorDplusHadrons { /// Dplus-hadron correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) void processData(SelCollisionsWithDplus::iterator const& collision, TracksWithDca const& tracks, - CandidatesDplusData const& candidates, aod::BCsWithTimestamps const&) + CandidatesDplusData const&, aod::BCsWithTimestamps const&) { auto bc = collision.bc_as(); int gCollisionId = collision.globalIndex(); @@ -339,7 +339,7 @@ struct HfCorrelatorDplusHadrons { /// Dplus-Hadron correlation pair builder - for MC reco-level analysis (candidates matched to true signal only, but also the various bkg sources are studied) void processMcRec(SelCollisionsWithDplus::iterator const& collision, TracksWithDca const& tracks, - CandidatesDplusMcRec const& candidates) + CandidatesDplusMcRec const&) { if (selectedDplusCandidatesMc.size() > 0) { int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); @@ -444,7 +444,7 @@ struct HfCorrelatorDplusHadrons { int counterDplusHadron = 0; registry.fill(HIST("hMCEvtCount"), 0); - auto getTracksSize = [&mcParticles](aod::McCollision const& collision) { + auto getTracksSize = [&mcParticles](aod::McCollision const&) { int nTracks = 0; for (const auto& track : mcParticles) { if (track.isPhysicalPrimary() && std::abs(track.eta()) < 1.0) { @@ -462,7 +462,7 @@ struct HfCorrelatorDplusHadrons { if (std::abs(particle1.pdgCode()) != Pdg::kDPlus) { continue; } - double yD = RecoDecay::y(std::array{particle1.px(), particle1.py(), particle1.pz()}, MassDPlus); + double yD = RecoDecay::y(particle1.pVector(), MassDPlus); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } @@ -595,7 +595,7 @@ struct HfCorrelatorDplusHadrons { continue; } - double yD = RecoDecay::y(std::array{trigDplus.px(), trigDplus.py(), trigDplus.pz()}, MassDPlus); + double yD = RecoDecay::y(trigDplus.pVector(), MassDPlus); if (yCandMax >= 0. && std::abs(yD) > yCandMax) { continue; } diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index b8024bbee5a..d0b724031ed 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx @@ -126,7 +126,7 @@ struct HfCorrelatorDsHadronsSelCollision { if (std::abs(particle.pdgCode()) != Pdg::kDS) { continue; } - double yD = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, MassDS); + double yD = RecoDecay::y(particle.pVector(), MassDS); if (std::abs(yD) > yCandMax || particle.pt() < ptCandMin) { continue; } @@ -598,7 +598,7 @@ struct HfCorrelatorDsHadrons { hCandidates->Fill(kCandidateStepMcGenAll, mcParticle.pt(), multiplicity, mcParticle.originMcGen()); if (std::abs(mcParticle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::DsToKKPi) { hCandidates->Fill(kCandidateStepMcGenDsToKKPi, mcParticle.pt(), multiplicity, mcParticle.originMcGen()); - auto yDs = RecoDecay::y(std::array{mcParticle.px(), mcParticle.py(), mcParticle.pz()}, o2::constants::physics::MassDS); + auto yDs = RecoDecay::y(mcParticle.pVector(), o2::constants::physics::MassDS); if (std::abs(yDs) <= yCandGenMax) { hCandidates->Fill(kCandidateStepMcCandInAcceptance, mcParticle.pt(), multiplicity, mcParticle.originMcGen()); } @@ -719,7 +719,7 @@ struct HfCorrelatorDsHadrons { continue; } if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::DsToKKPi) { - double yD = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, MassDS); // TODO + double yD = RecoDecay::y(particle.pVector(), MassDS); // TODO if (yCandGenMax >= 0. && std::abs(yD) > yCandGenMax) { continue; } diff --git a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx index 8705463b0ab..e528e6fb0e9 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx @@ -65,11 +65,7 @@ const double ptLcAxisMin = 0.; const double ptLcAxisMax = 36.; // definition of ME variables -std::vector zBins{VARIABLE_WIDTH, -10.0, -2.5, 2.5, 10.0}; -std::vector multBins{VARIABLE_WIDTH, 0., 200., 500., 5000.}; -std::vector multBinsMcGen{VARIABLE_WIDTH, 0., 20., 50., 500.}; // In McGen multiplicity is defined by counting primaries using BinningType = ColumnBinningPolicy>; -BinningType corrBinning{{zBins, multBins}, true}; using SelectedCollisions = soa::Filtered>; using SelectedTracks = soa::Filtered; @@ -154,7 +150,7 @@ struct HfCorrelatorLcHadronsSelection { if (std::abs(particle.pdgCode()) != Pdg::kLambdaCPlus) { continue; } - double yL = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, MassLambdaCPlus); + double yL = RecoDecay::y(particle.pVector(), MassLambdaCPlus); if (yCandMax >= 0. && std::abs(yL) > yCandMax) { continue; } @@ -187,9 +183,13 @@ struct HfCorrelatorLcHadrons { Configurable multMax{"multMax", 10000., "maximum multiplicity accepted"}; Configurable> binsPt{"binsPt", std::vector{o2::analysis::hf_cuts_lc_to_p_k_pi::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; Configurable> efficiencyLc{"efficiencyLc", std::vector{vecEfficiencyLc}, "Efficiency values for Lc"}; + ConfigurableAxis binsMultiplicity{"binsMultiplicity", {VARIABLE_WIDTH, 0.0f, 2000.0f, 6000.0f, 100000.0f}, "Mixing bins - multiplicity"}; + ConfigurableAxis binsZVtx{"binsZVtx", {VARIABLE_WIDTH, -10.0f, -2.5f, 2.5f, 10.0f}, "Mixing bins - z-vertex"}; + ConfigurableAxis binsMultiplicityMc{"binsMultiplicityMc", {VARIABLE_WIDTH, 0.0f, 20.0f, 50.0f, 500.0f}, "Mixing bins - MC multiplicity"}; // In MCGen multiplicity is defined by counting tracks HfHelper hfHelper; SliceCache cache; + BinningType corrBinning{{binsZVtx, binsMultiplicity}, true}; // Filters for ME Filter collisionFilter = aod::hf_selection_lc_collision::lcSel == true; @@ -248,6 +248,7 @@ struct HfCorrelatorLcHadrons { // mass histogram for Lc background candidates only registry.add("hMassLcMcRecBkg", "Lc background candidates - Mc reco;inv. mass (p k #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{massAxisBins, massAxisMin, massAxisMax}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hCountLctriggersMcGen", "Lc trigger particles - Mc gen;;N of trigger Lc", {HistType::kTH2F, {{1, -0.5, 0.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + corrBinning = {{binsZVtx, binsMultiplicity}, true}; } /// Lc-h correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via Mc truth) @@ -512,7 +513,7 @@ struct HfCorrelatorLcHadrons { return nTracks; }; using BinningTypeMcGen = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getTracksSize)>; - BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {zBins, multBinsMcGen}, true}; + BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {binsZVtx, binsMultiplicityMc}, true}; // Mc gen level for (const auto& particle : mcParticles) { @@ -520,7 +521,7 @@ struct HfCorrelatorLcHadrons { continue; } if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { - double yL = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, MassLambdaCPlus); + double yL = RecoDecay::y(particle.pVector(), MassLambdaCPlus); if (yCandMax >= 0. && std::abs(yL) > yCandMax) { continue; } @@ -661,7 +662,7 @@ struct HfCorrelatorLcHadrons { }; using BinningTypeMcGen = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getTracksSize)>; - BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {zBins, multBins}, true}; + BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {binsZVtx, binsMultiplicityMc}, true}; auto tracksTuple = std::make_tuple(mcParticles, mcParticles); Pair pairMcGen{corrBinningMcGen, 5, -1, collisions, tracksTuple, &cache}; @@ -673,7 +674,7 @@ struct HfCorrelatorLcHadrons { continue; } - double yL = RecoDecay::y(std::array{t1.px(), t1.py(), t1.pz()}, MassLambdaCPlus); + double yL = RecoDecay::y(t1.pVector(), MassLambdaCPlus); if (yCandMax >= 0. && std::abs(yL) > yCandMax) { continue; } diff --git a/PWGHF/TableProducer/candidateCreatorB0.cxx b/PWGHF/TableProducer/candidateCreatorB0.cxx index 409b1051faf..7fea6b97b20 100644 --- a/PWGHF/TableProducer/candidateCreatorB0.cxx +++ b/PWGHF/TableProducer/candidateCreatorB0.cxx @@ -212,9 +212,9 @@ struct HfCandidateCreatorB0 { auto trackParCov1 = getTrackParCov(track1); auto trackParCov2 = getTrackParCov(track2); - std::array pVec0 = {track0.px(), track0.py(), track0.pz()}; - std::array pVec1 = {track1.px(), track1.py(), track1.pz()}; - std::array pVec2 = {track2.px(), track2.py(), track2.pz()}; + std::array pVec0 = track0.pVector(); + std::array pVec1 = track1.pVector(); + std::array pVec2 = track2.pVector(); auto dca0 = o2::dataformats::DCA(track0.dcaXY(), track0.dcaZ(), track0.cYY(), track0.cZY(), track0.cZZ()); auto dca1 = o2::dataformats::DCA(track1.dcaXY(), track1.dcaZ(), track1.cYY(), track1.cZY(), track1.cZZ()); @@ -292,7 +292,7 @@ struct HfCandidateCreatorB0 { } hPtPion->Fill(trackPion.pt()); - std::array pVecPion = {trackPion.px(), trackPion.py(), trackPion.pz()}; + std::array pVecPion = trackPion.pVector(); auto trackParCovPi = getTrackParCov(trackPion); // --------------------------------- diff --git a/PWGHF/TableProducer/candidateCreatorBs.cxx b/PWGHF/TableProducer/candidateCreatorBs.cxx index 3047135b9be..7d8ad642fc2 100644 --- a/PWGHF/TableProducer/candidateCreatorBs.cxx +++ b/PWGHF/TableProducer/candidateCreatorBs.cxx @@ -192,9 +192,9 @@ struct HfCandidateCreatorBs { auto trackParCov1 = getTrackParCov(track1); auto trackParCov2 = getTrackParCov(track2); - std::array pVec0 = {track0.px(), track0.py(), track0.pz()}; - std::array pVec1 = {track1.px(), track1.py(), track1.pz()}; - std::array pVec2 = {track2.px(), track2.py(), track2.pz()}; + std::array pVec0 = track0.pVector(); + std::array pVec1 = track1.pVector(); + std::array pVec2 = track2.pVector(); auto dca0 = o2::dataformats::DCA(track0.dcaXY(), track0.dcaZ(), track0.cYY(), track0.cZY(), track0.cZZ()); auto dca1 = o2::dataformats::DCA(track1.dcaXY(), track1.dcaZ(), track1.cYY(), track1.cZY(), track1.cZZ()); @@ -273,7 +273,7 @@ struct HfCandidateCreatorBs { continue; } - std::array pVecPion = {trackPion.px(), trackPion.py(), trackPion.pz()}; + std::array pVecPion = trackPion.pVector(); auto trackParCovPi = getTrackParCov(trackPion); // --------------------------------- diff --git a/PWGHF/TableProducer/candidateCreatorLb.cxx b/PWGHF/TableProducer/candidateCreatorLb.cxx index 9f630e1fcc5..cfdb723cac3 100644 --- a/PWGHF/TableProducer/candidateCreatorLb.cxx +++ b/PWGHF/TableProducer/candidateCreatorLb.cxx @@ -159,8 +159,8 @@ struct HfCandidateCreatorLb { trackParVar1.propagateTo(secondaryVertex[0], bz); trackParVar2.propagateTo(secondaryVertex[0], bz); - std::array pvecpK = {track0.px() + track1.px(), track0.py() + track1.py(), track0.pz() + track1.pz()}; - std::array pvecLc = {pvecpK[0] + track2.px(), pvecpK[1] + track2.py(), pvecpK[2] + track2.pz()}; + std::array pvecpK = RecoDecay::pVec(track0.pVector(), track1.pVector()); + std::array pvecLc = RecoDecay::pVec(pvecpK, track2.pVector()); auto trackpK = o2::dataformats::V0(df3.getPCACandidatePos(), pvecpK, df3.calcPCACovMatrixFlat(), trackParVar0, trackParVar1); auto trackLc = o2::dataformats::V0(df3.getPCACandidatePos(), pvecLc, df3.calcPCACovMatrixFlat(), trackpK, trackParVar2); diff --git a/PWGHF/TableProducer/candidateCreatorXicc.cxx b/PWGHF/TableProducer/candidateCreatorXicc.cxx index 369ba2dba68..214c2cea891 100644 --- a/PWGHF/TableProducer/candidateCreatorXicc.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicc.cxx @@ -131,8 +131,8 @@ struct HfCandidateCreatorXicc { trackParVar1.propagateTo(secondaryVertex[0], bz); trackParVar2.propagateTo(secondaryVertex[0], bz); - std::array pvecpK = {track0.px() + track1.px(), track0.py() + track1.py(), track0.pz() + track1.pz()}; - std::array pvecxic = {pvecpK[0] + track2.px(), pvecpK[1] + track2.py(), pvecpK[2] + track2.pz()}; + std::array pvecpK = RecoDecay::pVec(track0.pVector(), track1.pVector()); + std::array pvecxic = RecoDecay::pVec(pvecpK, track2.pVector()); auto trackpK = o2::dataformats::V0(df3.getPCACandidatePos(), pvecpK, df3.calcPCACovMatrixFlat(), trackParVar0, trackParVar1); auto trackxic = o2::dataformats::V0(df3.getPCACandidatePos(), pvecxic, df3.calcPCACovMatrixFlat(), trackpK, trackParVar2); diff --git a/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx b/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx index c8b2c06cdef..bc0a03ecff3 100644 --- a/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx +++ b/PWGHF/TableProducer/candidateSelectorLcPidMl.cxx @@ -250,9 +250,9 @@ struct HfCandidateSelectorLcPidMl { continue; } - std::array pVecPos1 = {trackPos1.px(), trackPos1.py(), trackPos1.pz()}; - std::array pVecNeg = {trackNeg.px(), trackNeg.py(), trackNeg.pz()}; - std::array pVecPos2 = {trackPos2.px(), trackPos2.py(), trackPos2.pz()}; + std::array pVecPos1 = trackPos1.pVector(); + std::array pVecNeg = trackNeg.pVector(); + std::array pVecPos2 = trackPos2.pVector(); const float massPi = o2::constants::physics::MassPiPlus; const float massK = o2::constants::physics::MassKPlus; const float massProton = o2::constants::physics::MassProton; diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 8f1a7722c83..eeb9ee80fa3 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -2116,7 +2116,7 @@ struct HfTrackIndexSkimCreator { bool sel3ProngStatusPos1 = TESTBIT(isSelProngPos1, CandidateType::Cand3Prong); auto trackParVarPos1 = getTrackParCov(trackPos1); - std::array pVecTrackPos1{trackPos1.px(), trackPos1.py(), trackPos1.pz()}; + std::array pVecTrackPos1{trackPos1.pVector()}; o2::gpu::gpustd::array dcaInfoPos1{trackPos1.dcaXY(), trackPos1.dcaZ()}; if (thisCollId != trackPos1.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()}, trackParVarPos1, 2.f, noMatCorr, &dcaInfoPos1); @@ -2134,7 +2134,7 @@ struct HfTrackIndexSkimCreator { bool sel3ProngStatusNeg1 = TESTBIT(isSelProngNeg1, CandidateType::Cand3Prong); auto trackParVarNeg1 = getTrackParCov(trackNeg1); - std::array pVecTrackNeg1{trackNeg1.px(), trackNeg1.py(), trackNeg1.pz()}; + std::array pVecTrackNeg1{trackNeg1.pVector()}; o2::gpu::gpustd::array dcaInfoNeg1{trackNeg1.dcaXY(), trackNeg1.dcaZ()}; if (thisCollId != trackNeg1.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()}, trackParVarNeg1, 2.f, noMatCorr, &dcaInfoNeg1); @@ -2369,11 +2369,11 @@ struct HfTrackIndexSkimCreator { 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()}; // preselection of 3-prong candidates if (isSelected3ProngCand) { + std::array pVecTrackPos2{trackPos2.pVector()}; 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); @@ -2613,11 +2613,11 @@ struct HfTrackIndexSkimCreator { 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()}; // preselection of 3-prong candidates if (isSelected3ProngCand) { + std::array pVecTrackNeg2{trackNeg2.pVector()}; 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); @@ -2846,10 +2846,10 @@ struct HfTrackIndexSkimCreator { 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()}; + std::array pVecTrackPos2{trackPos2.pVector()}; if (thisCollId != trackPos2.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it + auto trackParVarPos2 = getTrackParCov(trackPos2); + o2::gpu::gpustd::array dcaInfoPos2{trackPos2.dcaXY(), trackPos2.dcaZ()}; o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarPos2, 2.f, noMatCorr, &dcaInfoPos2); getPxPyPz(trackParVarPos2, pVecTrackPos2); } @@ -2883,10 +2883,10 @@ struct HfTrackIndexSkimCreator { 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()}; + std::array pVecTrackNeg2{trackNeg2.pVector()}; if (thisCollId != trackNeg2.collisionId()) { // this is not the "default" collision for this track, we have to re-propagate it + auto trackParVarNeg2 = getTrackParCov(trackNeg2); + o2::gpu::gpustd::array dcaInfoNeg2{trackNeg2.dcaXY(), trackNeg2.dcaZ()}; o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParVarNeg2, 2.f, noMatCorr, &dcaInfoNeg2); getPxPyPz(trackParVarNeg2, pVecTrackNeg2); } @@ -3170,7 +3170,7 @@ struct HfTrackIndexSkimCreatorCascades { // invariant-mass cut: we do it here, before updating the momenta of bach and V0 during the fitting to save CPU // TODO: but one should better check that the value here and after the fitter do not change significantly!!! - double mass2K0sP = RecoDecay::m(std::array{std::array{bach.px(), bach.py(), bach.pz()}, momentumV0}, std::array{massP, massK0s}); + double mass2K0sP = RecoDecay::m(std::array{bach.pVector(), momentumV0}, std::array{massP, massK0s}); if ((cutInvMassCascLc >= 0.) && (std::abs(mass2K0sP - massLc) > cutInvMassCascLc)) { continue; } diff --git a/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx b/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx index b169d4e2866..f6c717e6e08 100644 --- a/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx +++ b/PWGHF/TableProducer/treeCreatorB0ToDPi.cxx @@ -367,7 +367,7 @@ struct HfTreeCreatorB0ToDPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassB0), + RecoDecay::y(particle.pVector(), o2::constants::physics::MassB0), particle.flagMcMatchGen(), particle.originMcGen()); } diff --git a/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx b/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx index 1808a10b5ec..64c7a8990c8 100644 --- a/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx +++ b/PWGHF/TableProducer/treeCreatorBplusToD0Pi.cxx @@ -325,7 +325,7 @@ struct HfTreeCreatorBplusToD0Pi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassBPlus), + RecoDecay::y(particle.pVector(), o2::constants::physics::MassBPlus), particle.flagMcMatchGen(), particle.globalIndex()); } diff --git a/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx b/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx index 4e43a388516..aac534e265e 100644 --- a/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx +++ b/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx @@ -357,7 +357,7 @@ struct HfTreeCreatorBsToDsPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassBS), + RecoDecay::y(particle.pVector(), o2::constants::physics::MassBS), particle.flagMcMatchGen()); } } diff --git a/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx b/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx index 0e76a9876fb..3487f1615dd 100644 --- a/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx @@ -493,7 +493,7 @@ struct HfTreeCreatorD0ToKPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassD0), + RecoDecay::y(particle.pVector(), o2::constants::physics::MassD0), particle.flagMcMatchGen(), particle.originMcGen(), particle.globalIndex()); diff --git a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx index b5c72dfaa1c..b7e66144251 100644 --- a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx @@ -93,6 +93,9 @@ DECLARE_SOA_TABLE(HfCandDpLites, "AOD", "HFCANDDPLITE", hf_cand::ImpactParameter0, hf_cand::ImpactParameter1, hf_cand::ImpactParameter2, + hf_cand::ImpactParameterZ0, + hf_cand::ImpactParameterZ1, + hf_cand::ImpactParameterZ2, full::NSigTpcPi0, full::NSigTpcKa0, full::NSigTofPi0, @@ -164,6 +167,12 @@ DECLARE_SOA_TABLE(HfCandDpFulls, "AOD", "HFCANDDPFULL", hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, hf_cand::ErrorImpactParameter2, + hf_cand::ImpactParameterZ0, + hf_cand::ImpactParameterZ1, + hf_cand::ImpactParameterZ2, + hf_cand::ErrorImpactParameterZ0, + hf_cand::ErrorImpactParameterZ1, + hf_cand::ErrorImpactParameterZ2, full::NSigTpcPi0, full::NSigTpcKa0, full::NSigTofPi0, @@ -287,6 +296,9 @@ struct HfTreeCreatorDplusToPiKPi { candidate.impactParameter0(), candidate.impactParameter1(), candidate.impactParameter2(), + candidate.impactParameterZ0(), + candidate.impactParameterZ1(), + candidate.impactParameterZ2(), prong0.tpcNSigmaPi(), prong0.tpcNSigmaKa(), prong0.tofNSigmaPi(), @@ -358,6 +370,12 @@ struct HfTreeCreatorDplusToPiKPi { candidate.errorImpactParameter0(), candidate.errorImpactParameter1(), candidate.errorImpactParameter2(), + candidate.impactParameterZ0(), + candidate.impactParameterZ1(), + candidate.impactParameterZ2(), + candidate.errorImpactParameterZ0(), + candidate.errorImpactParameterZ1(), + candidate.errorImpactParameterZ2(), prong0.tpcNSigmaPi(), prong0.tpcNSigmaKa(), prong0.tofNSigmaPi(), @@ -478,7 +496,7 @@ struct HfTreeCreatorDplusToPiKPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassDPlus), + RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus), particle.flagMcMatchGen(), particle.originMcGen()); } diff --git a/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx b/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx index b1c6a756d53..4e7e3fb7471 100644 --- a/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx @@ -565,7 +565,7 @@ struct HfTreeCreatorDsToKKPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassDS), + RecoDecay::y(particle.pVector(), o2::constants::physics::MassDS), particle.flagMcMatchGen(), particle.originMcGen()); } diff --git a/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx b/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx index 19ba358527e..06d77fa4e04 100644 --- a/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/treeCreatorDstarToD0Pi.cxx @@ -518,7 +518,7 @@ struct HfTreeCreatorDstarToD0Pi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassDStar), + RecoDecay::y(particle.pVector(), o2::constants::physics::MassDStar), particle.flagMcMatchGen(), particle.originMcGen()); } diff --git a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx index dcf133232ec..4dfde61847f 100644 --- a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx @@ -388,7 +388,7 @@ struct HfTreeCreatorLcToK0sP { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, + RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaCPlus), particle.flagMcMatchGen(), particle.originMcGen()); diff --git a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx index 9e126f83645..13bf5a0bb52 100644 --- a/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToPKPi.cxx @@ -471,7 +471,7 @@ struct HfTreeCreatorLcToPKPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassLambdaCPlus), + RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaCPlus), particle.flagMcMatchGen(), particle.originMcGen(), particle.globalIndex()); diff --git a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx index fb566346bf3..d8985b6314a 100644 --- a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx +++ b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx @@ -683,8 +683,8 @@ struct HfTreeCreatorOmegacSt { } // MC-based mass - momenta[0] = {mother.px(), mother.py(), mother.pz()}; - momenta[1] = {mcpart.px(), mcpart.py(), mcpart.pz()}; + momenta[0] = mother.pVector(); + momenta[1] = mcpart.pVector(); registry.fill(HIST("hMassOmegacGen"), RecoDecay::m(momenta, masses)); } } diff --git a/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx b/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx index c1f5cd1ea5e..ba07e2def45 100644 --- a/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXicToPKPi.cxx @@ -511,7 +511,7 @@ struct HfTreeCreatorXicToPKPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassXiCPlus), + RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus), particle.flagMcMatchGen(), particle.originMcGen()); } diff --git a/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx b/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx index 1a57f6a4265..2ceeb567de2 100644 --- a/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXiccToPKPiPi.cxx @@ -270,7 +270,7 @@ struct HfTreeCreatorXiccToPKPiPi { particle.pt(), particle.eta(), particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassXiCCPlusPlus), + RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCCPlusPlus), particle.flagMcMatchGen(), particle.originMcGen()); } diff --git a/PWGHF/Tasks/taskLcCentrality.cxx b/PWGHF/Tasks/taskLcCentrality.cxx index 2f2f0432b12..aafdb93b8fe 100644 --- a/PWGHF/Tasks/taskLcCentrality.cxx +++ b/PWGHF/Tasks/taskLcCentrality.cxx @@ -183,7 +183,7 @@ struct HfTaskLcCentralityMc { // MC gen. for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { - if (yCandMax >= 0. && std::abs(RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassLambdaCPlus)) > yCandMax) { + if (yCandMax >= 0. && std::abs(RecoDecay::y(particle.pVector(), o2::constants::physics::MassLambdaCPlus)) > yCandMax) { continue; } auto ptGen = particle.pt(); diff --git a/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx b/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx index 4c7e0222b59..6c8d90e9be9 100644 --- a/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx +++ b/PWGHF/Tasks/taskMcEfficiencyToXiPi.cxx @@ -14,6 +14,8 @@ /// /// \author Federica Zanone, Heidelberg University +#include "TMCProcess.h" // for VMC Particle Production Process + #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" @@ -220,25 +222,21 @@ struct HfTaskMcEfficiencyToXiPi { } // exclude cases with undesired decays - if (mcParticle.daughtersIds().size() != 2) { - LOGP(fatal, "Invalid numbers of daughters for charm baryon {}: {}", mcParticle.globalIndex(), mcParticle.daughtersIds().size()); + int cascId = -999; + int pionId = -999; + for (auto& dauCharm : mcParticle.template daughters_as()) { + if (std::abs(dauCharm.pdgCode()) == kXiMinus && (dauCharm.getProcess() == TMCProcess::kPDecay || dauCharm.getProcess() == TMCProcess::kPPrimary)) { + cascId = dauCharm.globalIndex(); + } else if (std::abs(dauCharm.pdgCode()) == kPiPlus && (dauCharm.getProcess() == TMCProcess::kPDecay || dauCharm.getProcess() == TMCProcess::kPPrimary)) { + pionId = dauCharm.globalIndex(); + } } - auto cascId = mcParticle.daughtersIds()[0]; - auto pionId = mcParticle.daughtersIds()[1]; if (cascId < 0 || pionId < 0) { + LOGP(debug, "Invalid charm baryon daughters PDG codes/production processes"); continue; } - auto cascade = genParticles.rawIteratorAt(mcParticle.daughtersIds().front()); - auto pion = genParticles.rawIteratorAt(mcParticle.daughtersIds().back()); - if (std::abs(cascade.pdgCode()) == kPiPlus) { // check if std::abs(cascade.pdgCode()) is different wrt kXiMinus and equal to kPiPlus (daughters ID assignment swapped) - std::swap(cascade, pion); - std::swap(cascId, pionId); - } else if (std::abs(cascade.pdgCode()) == kXiMinus && std::abs(pion.pdgCode()) == kPiPlus) { - LOGP(debug, "Correct assignment of charm baryon daughters IDs - gen level"); - } else { - LOGP(fatal, "Invalid charm baryon daughters PDG codes"); - } - + auto cascade = genParticles.rawIteratorAt(cascId); + auto pion = genParticles.rawIteratorAt(pionId); // check pion <-- charm baryon pt and eta bool inAcceptance = true; if (std::abs(pion.eta()) > acceptanceEtaPionFromCharm || pion.pt() < acceptancePtPionFromCharm) { @@ -247,43 +245,37 @@ struct HfTaskMcEfficiencyToXiPi { // check LF daughters pt (pion<--cascade) and eta // first create cascade daughters objects - if (cascade.daughtersIds().size() != 2) { - LOGP(fatal, "Invalid numbers of daughters for cascade {}: {}", cascade.globalIndex(), cascade.daughtersIds().size()); + int lambdaId = -999; + int pionFromCascadeId = -999; + for (auto& dauCasc : cascade.template daughters_as()) { + if (std::abs(dauCasc.pdgCode()) == kLambda0 && dauCasc.getProcess() == TMCProcess::kPDecay) { + lambdaId = dauCasc.globalIndex(); + } else if (std::abs(dauCasc.pdgCode()) == kPiPlus && dauCasc.getProcess() == TMCProcess::kPDecay) { + pionFromCascadeId = dauCasc.globalIndex(); + } } - auto lambdaId = cascade.daughtersIds()[0]; - auto pionFromCascadeId = cascade.daughtersIds()[1]; if (lambdaId < 0 || pionFromCascadeId < 0) { + LOGP(debug, "Invalid cascade daughters PDG codes/production processes"); continue; } - auto lambda = genParticles.rawIteratorAt(cascade.daughtersIds().front()); - auto pionFromCascade = genParticles.rawIteratorAt(cascade.daughtersIds().back()); - if (std::abs(lambda.pdgCode()) == kPiPlus) { // check if std::abs(lambda.pdgCode()) is different wrt kLambda0 and equal to kPiPlus (daughters ID assignment swapped) - std::swap(lambda, pionFromCascade); - std::swap(lambdaId, pionFromCascadeId); - } else if (std::abs(lambda.pdgCode()) == kLambda0 && std::abs(pionFromCascade.pdgCode()) == kPiPlus) { - LOGP(debug, "Correct assignment of cascade daughters IDs - gen level"); - } else { - LOGP(fatal, "Invalid cascade daughters PDG codes"); - } + auto lambda = genParticles.rawIteratorAt(lambdaId); + auto pionFromCascade = genParticles.rawIteratorAt(pionFromCascadeId); // then create lambda daughters objects - if (lambda.daughtersIds().size() != 2) { - LOGP(fatal, "Invalid numbers of daughters for lambda {}: {}", lambda.globalIndex(), lambda.daughtersIds().size()); + int protonId = -999; + int pionFromLambdaId = -999; + for (auto& dauV0 : lambda.template daughters_as()) { + if (std::abs(dauV0.pdgCode()) == kProton && dauV0.getProcess() == TMCProcess::kPDecay) { + protonId = dauV0.globalIndex(); + } else if (std::abs(dauV0.pdgCode()) == kPiPlus && dauV0.getProcess() == TMCProcess::kPDecay) { + pionFromLambdaId = dauV0.globalIndex(); + } } - auto protonId = lambda.daughtersIds()[0]; - auto pionFromLambdaId = lambda.daughtersIds()[1]; if (protonId < 0 || pionFromLambdaId < 0) { + LOGP(debug, "Invalid lambda daughters PDG codes/production processes"); continue; } - auto proton = genParticles.rawIteratorAt(lambda.daughtersIds().front()); - auto pionFromLambda = genParticles.rawIteratorAt(lambda.daughtersIds().back()); - if (std::abs(proton.pdgCode()) == kPiPlus) { // check if std::abs(proton.pdgCode()) is different wrt kProton and equal to kPiPlus (daughters ID assignment swapped) - std::swap(proton, pionFromLambda); - std::swap(protonId, pionFromLambdaId); - } else if (std::abs(proton.pdgCode()) == kProton && std::abs(pionFromLambda.pdgCode()) == kPiPlus) { - LOGP(debug, "Correct assignment of lambda daughters IDs - gen level"); - } else { - LOGP(fatal, "Invalid lambda daughters PDG codes"); - } + auto proton = genParticles.rawIteratorAt(protonId); + auto pionFromLambda = genParticles.rawIteratorAt(pionFromLambdaId); // check on pt and eta if (std::abs(pionFromCascade.eta()) > acceptanceEtaLf || std::abs(pionFromLambda.eta()) > acceptanceEtaLf || std::abs(proton.eta()) > acceptanceEtaLf) { inAcceptance = false; diff --git a/PWGJE/TableProducer/jetderiveddatawriter.cxx b/PWGJE/TableProducer/jetderiveddatawriter.cxx index 9ffc8f76b2e..8f3b9174b65 100644 --- a/PWGJE/TableProducer/jetderiveddatawriter.cxx +++ b/PWGJE/TableProducer/jetderiveddatawriter.cxx @@ -185,127 +185,16 @@ struct JetDerivedDataWriter { } PROCESS_SWITCH(JetDerivedDataWriter, processDummyTable, "write out dummy output table", true); - void processData(soa::Join const& collisions, aod::CollisionCounts const& collisionCounts, soa::Join const&, soa::Join const& tracks, soa::Join const& clusters, aod::HfD0CollBases const&, CandidatesD0Data const& D0s, aod::Hf3PCollBases const&, CandidatesLcData const& Lcs) + void processCollisionCounting(aod::JCollisions const& collisions, aod::CollisionCounts const& collisionCounts) { int readCollisionCounter = 0; int writtenCollisionCounter = 0; for (const auto& collision : collisions) { readCollisionCounter++; - - std::map bcMapping; - std::map trackMapping; - if (collisionFlag[collision.globalIndex()]) { writtenCollisionCounter++; - if (saveBCsTable) { - auto bc = collision.bc_as>(); - if (std::find(bcIndicies.begin(), bcIndicies.end(), bc.globalIndex()) == bcIndicies.end()) { - storedJBCsTable(bc.runNumber(), bc.globalBC(), bc.timestamp()); - storedJBCParentIndexTable(bc.bcId()); - bcIndicies.push_back(bc.globalIndex()); - bcMapping.insert(std::make_pair(bc.globalIndex(), storedJBCsTable.lastIndex())); - } - } - - storedJCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), collision.multiplicity(), collision.centrality(), collision.eventSel(), collision.alias_raw()); - storedJCollisionsParentIndexTable(collision.collisionId()); - if (saveBCsTable) { - int32_t storedBCID = -1; - auto JBCIndex = bcMapping.find(collision.bcId()); - if (JBCIndex != bcMapping.end()) { - storedBCID = JBCIndex->second; - } - storedJCollisionsBunchCrossingIndexTable(storedBCID); - } - storedJChargedTriggerSelsTable(collision.chargedTriggerSel()); - storedJFullTriggerSelsTable(collision.fullTriggerSel()); - storedJChargedHFTriggerSelsTable(collision.chargedHFTriggerSel()); - - for (const auto& track : tracks) { - if (performTrackSelection && !(track.trackSel() & ~(1 << jetderiveddatautilities::JTrackSel::trackSign))) { // skips tracks that pass no selections. This might cause a problem with tracks matched with clusters. We should generate a track selection purely for cluster matched tracks so that they are kept - continue; - } - storedJTracksTable(storedJCollisionsTable.lastIndex(), o2::math_utils::detail::truncateFloatFraction(track.pt(), precisionMomentumMask), o2::math_utils::detail::truncateFloatFraction(track.eta(), precisionPositionMask), o2::math_utils::detail::truncateFloatFraction(track.phi(), precisionPositionMask), track.trackSel()); - storedJTracksParentIndexTable(track.trackId()); - trackMapping.insert(std::make_pair(track.globalIndex(), storedJTracksTable.lastIndex())); - } - if (saveClustersTable) { - for (const auto& cluster : clusters) { - storedJClustersTable(storedJCollisionsTable.lastIndex(), cluster.id(), cluster.energy(), cluster.coreEnergy(), cluster.rawEnergy(), - cluster.eta(), cluster.phi(), cluster.m02(), cluster.m20(), cluster.nCells(), cluster.time(), cluster.isExotic(), cluster.distanceToBadChannel(), - cluster.nlm(), cluster.definition(), cluster.leadingCellEnergy(), cluster.subleadingCellEnergy(), cluster.leadingCellNumber(), cluster.subleadingCellNumber()); - storedJClustersParentIndexTable(cluster.clusterId()); - - std::vector clusterStoredJTrackIDs; - for (const auto& clusterTrack : cluster.matchedTracks_as>()) { - auto JtrackIndex = trackMapping.find(clusterTrack.globalIndex()); - if (JtrackIndex != trackMapping.end()) { - clusterStoredJTrackIDs.push_back(JtrackIndex->second); - } - } - storedJClustersMatchedTracksTable(clusterStoredJTrackIDs); - } - } - - if (saveD0Table) { - int nD0InCollision = 0; - int32_t collisionD0Index = -1; - for (const auto& D0 : D0s) { - if (nD0InCollision == 0) { - jethfutilities::fillD0CollisionTable(D0.hfD0CollBase_as(), storedD0CollisionsTable, collisionD0Index); - } - nD0InCollision++; - - int32_t D0Index = -1; - jethfutilities::fillD0CandidateTable(D0, collisionD0Index, storedD0sTable, storedD0ParsTable, storedD0ParExtrasTable, storedD0SelsTable, storedD0MlsTable, storedD0McsTable, D0Index); - - int32_t prong0Id = -1; - int32_t prong1Id = -1; - auto JtrackIndex = trackMapping.find(D0.prong0Id()); - if (JtrackIndex != trackMapping.end()) { - prong0Id = JtrackIndex->second; - } - JtrackIndex = trackMapping.find(D0.prong1Id()); - if (JtrackIndex != trackMapping.end()) { - prong1Id = JtrackIndex->second; - } - storedD0IdsTable(storedJCollisionsTable.lastIndex(), prong0Id, prong1Id); - } - } - - if (saveLcTable) { - int nLcInCollision = 0; - int32_t collisionLcIndex = -1; - for (const auto& Lc : Lcs) { - if (nLcInCollision == 0) { - jethfutilities::fillLcCollisionTable(Lc.hf3PCollBase_as(), storedLcCollisionsTable, collisionLcIndex); - } - nLcInCollision++; - - int32_t LcIndex = -1; - jethfutilities::fillLcCandidateTable(Lc, collisionLcIndex, storedLcsTable, storedLcParsTable, storedLcParExtrasTable, storedLcSelsTable, storedLcMlsTable, storedLcMcsTable, LcIndex); - - int32_t prong0Id = -1; - int32_t prong1Id = -1; - int32_t prong2Id = -1; - auto JtrackIndex = trackMapping.find(Lc.prong0Id()); - if (JtrackIndex != trackMapping.end()) { - prong0Id = JtrackIndex->second; - } - JtrackIndex = trackMapping.find(Lc.prong1Id()); - if (JtrackIndex != trackMapping.end()) { - prong1Id = JtrackIndex->second; - } - JtrackIndex = trackMapping.find(Lc.prong2Id()); - if (JtrackIndex != trackMapping.end()) { - prong2Id = JtrackIndex->second; - } - storedLcIdsTable(storedJCollisionsTable.lastIndex(), prong0Id, prong1Id, prong2Id); - } - } } } - std::vector previousReadCounts = {0}; std::vector previousWrittenCounts = {0}; int iPreviousDataFrame = 0; @@ -327,6 +216,122 @@ struct JetDerivedDataWriter { previousWrittenCounts.push_back(writtenCollisionCounter); storedCollisionCountsTable(previousReadCounts, previousWrittenCounts); } + PROCESS_SWITCH(JetDerivedDataWriter, processCollisionCounting, "write out collision counting output table", false); + + void processData(soa::Join::iterator const& collision, soa::Join const&, soa::Join const& tracks, soa::Join const& clusters, aod::HfD0CollBases const&, CandidatesD0Data const& D0s, aod::Hf3PCollBases const&, CandidatesLcData const& Lcs) + { + std::map bcMapping; + std::map trackMapping; + + if (collisionFlag[collision.globalIndex()]) { + if (saveBCsTable) { + auto bc = collision.bc_as>(); + if (std::find(bcIndicies.begin(), bcIndicies.end(), bc.globalIndex()) == bcIndicies.end()) { + storedJBCsTable(bc.runNumber(), bc.globalBC(), bc.timestamp()); + storedJBCParentIndexTable(bc.bcId()); + bcIndicies.push_back(bc.globalIndex()); + bcMapping.insert(std::make_pair(bc.globalIndex(), storedJBCsTable.lastIndex())); + } + } + + storedJCollisionsTable(collision.posX(), collision.posY(), collision.posZ(), collision.multiplicity(), collision.centrality(), collision.eventSel(), collision.alias_raw()); + storedJCollisionsParentIndexTable(collision.collisionId()); + if (saveBCsTable) { + int32_t storedBCID = -1; + auto JBCIndex = bcMapping.find(collision.bcId()); + if (JBCIndex != bcMapping.end()) { + storedBCID = JBCIndex->second; + } + storedJCollisionsBunchCrossingIndexTable(storedBCID); + } + storedJChargedTriggerSelsTable(collision.chargedTriggerSel()); + storedJFullTriggerSelsTable(collision.fullTriggerSel()); + storedJChargedHFTriggerSelsTable(collision.chargedHFTriggerSel()); + + for (const auto& track : tracks) { + if (performTrackSelection && !(track.trackSel() & ~(1 << jetderiveddatautilities::JTrackSel::trackSign))) { // skips tracks that pass no selections. This might cause a problem with tracks matched with clusters. We should generate a track selection purely for cluster matched tracks so that they are kept + continue; + } + storedJTracksTable(storedJCollisionsTable.lastIndex(), o2::math_utils::detail::truncateFloatFraction(track.pt(), precisionMomentumMask), o2::math_utils::detail::truncateFloatFraction(track.eta(), precisionPositionMask), o2::math_utils::detail::truncateFloatFraction(track.phi(), precisionPositionMask), track.trackSel()); + storedJTracksParentIndexTable(track.trackId()); + trackMapping.insert(std::make_pair(track.globalIndex(), storedJTracksTable.lastIndex())); + } + if (saveClustersTable) { + for (const auto& cluster : clusters) { + storedJClustersTable(storedJCollisionsTable.lastIndex(), cluster.id(), cluster.energy(), cluster.coreEnergy(), cluster.rawEnergy(), + cluster.eta(), cluster.phi(), cluster.m02(), cluster.m20(), cluster.nCells(), cluster.time(), cluster.isExotic(), cluster.distanceToBadChannel(), + cluster.nlm(), cluster.definition(), cluster.leadingCellEnergy(), cluster.subleadingCellEnergy(), cluster.leadingCellNumber(), cluster.subleadingCellNumber()); + storedJClustersParentIndexTable(cluster.clusterId()); + + std::vector clusterStoredJTrackIDs; + for (const auto& clusterTrack : cluster.matchedTracks_as>()) { + auto JtrackIndex = trackMapping.find(clusterTrack.globalIndex()); + if (JtrackIndex != trackMapping.end()) { + clusterStoredJTrackIDs.push_back(JtrackIndex->second); + } + } + storedJClustersMatchedTracksTable(clusterStoredJTrackIDs); + } + } + + if (saveD0Table) { + int nD0InCollision = 0; + int32_t collisionD0Index = -1; + for (const auto& D0 : D0s) { + if (nD0InCollision == 0) { + jethfutilities::fillD0CollisionTable(D0.hfD0CollBase_as(), storedD0CollisionsTable, collisionD0Index); + } + nD0InCollision++; + + int32_t D0Index = -1; + jethfutilities::fillD0CandidateTable(D0, collisionD0Index, storedD0sTable, storedD0ParsTable, storedD0ParExtrasTable, storedD0SelsTable, storedD0MlsTable, storedD0McsTable, D0Index); + + int32_t prong0Id = -1; + int32_t prong1Id = -1; + auto JtrackIndex = trackMapping.find(D0.prong0Id()); + if (JtrackIndex != trackMapping.end()) { + prong0Id = JtrackIndex->second; + } + JtrackIndex = trackMapping.find(D0.prong1Id()); + if (JtrackIndex != trackMapping.end()) { + prong1Id = JtrackIndex->second; + } + storedD0IdsTable(storedJCollisionsTable.lastIndex(), prong0Id, prong1Id); + } + } + + if (saveLcTable) { + int nLcInCollision = 0; + int32_t collisionLcIndex = -1; + for (const auto& Lc : Lcs) { + if (nLcInCollision == 0) { + jethfutilities::fillLcCollisionTable(Lc.hf3PCollBase_as(), storedLcCollisionsTable, collisionLcIndex); + } + nLcInCollision++; + + int32_t LcIndex = -1; + jethfutilities::fillLcCandidateTable(Lc, collisionLcIndex, storedLcsTable, storedLcParsTable, storedLcParExtrasTable, storedLcSelsTable, storedLcMlsTable, storedLcMcsTable, LcIndex); + + int32_t prong0Id = -1; + int32_t prong1Id = -1; + int32_t prong2Id = -1; + auto JtrackIndex = trackMapping.find(Lc.prong0Id()); + if (JtrackIndex != trackMapping.end()) { + prong0Id = JtrackIndex->second; + } + JtrackIndex = trackMapping.find(Lc.prong1Id()); + if (JtrackIndex != trackMapping.end()) { + prong1Id = JtrackIndex->second; + } + JtrackIndex = trackMapping.find(Lc.prong2Id()); + if (JtrackIndex != trackMapping.end()) { + prong2Id = JtrackIndex->second; + } + storedLcIdsTable(storedJCollisionsTable.lastIndex(), prong0Id, prong1Id, prong2Id); + } + } + } + } // process switch for output writing must be last // to run after all jet selections PROCESS_SWITCH(JetDerivedDataWriter, processData, "write out data output tables", false); diff --git a/PWGJE/Tasks/jetChCorr.cxx b/PWGJE/Tasks/jetChCorr.cxx index cf10086d013..8d3cffd5346 100644 --- a/PWGJE/Tasks/jetChCorr.cxx +++ b/PWGJE/Tasks/jetChCorr.cxx @@ -71,6 +71,7 @@ struct JetChCorr { Configurable zCut{"zCut", 0.05, "soft drop z cut"}; Configurable beta{"beta", 0.1, "soft drop beta"}; + Configurable jetPtTh{"jetPtTh", 15.0, "jet transverse momentum cut"}; Service pdg; std::vector jetConstituents; @@ -335,60 +336,62 @@ struct JetChCorr { template void analyseCharged(T const& jet, U const& /*tracks*/) { - jetConstituents.clear(); - - int nn = 0; - int iord[50]; - float ptc[50]; - for (auto& jetConstituent : jet.template tracks_as()) { - fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); - ptc[nn] = jetConstituent.pt(); - nn++; - } - TMath::Sort(nn, ptc, iord); - - nn = 0; - ch_mult = jet.tracksIds().size(); - for (auto& jetConstituent : jet.template tracks_as()) { - if (iord[nn] > 1) - continue; - - if (iord[nn] == 0) { - trackL = jetConstituent.globalIndex(); - ch_l = jetConstituent.sign(); - v1.SetXYZ(jetConstituent.pt(), jetConstituent.py(), jetConstituent.pz()); + if (jet.pt() > jetPtTh) { + jetConstituents.clear(); + + int nn = 0; + int iord[50]; + float ptc[50]; + for (auto& jetConstituent : jet.template tracks_as()) { + fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); + ptc[nn] = jetConstituent.pt(); + nn++; } - - if (iord[nn] == 1) { - n_trackL = jetConstituent.globalIndex(); - ch_nl = jetConstituent.sign(); - v2.SetXYZ(jetConstituent.px(), jetConstituent.py(), jetConstituent.pz()); - - vR = v1 + v2; - float z = v2.Perp(vR.Orthogonal()) / (v1.Perp(vR.Orthogonal()) + v2.Perp(vR.Orthogonal())); - float fT = ((2. * z * (1 - z) * vR.Mag()) / v1.Perp2(vR)) / 6.; - float kt_p = v1.Perp(vR); - - if (ch_l == ch_nl) { - registry.fill(HIST("h_ch_s_pt"), jet.pt()); - registry.fill(HIST("h_ch_s_kt"), kt_p); - registry.fill(HIST("h_ch_s_z"), z); - registry.fill(HIST("h_ch_s_ft"), log10(fT)); - registry.fill(HIST("h_ch_s_mult"), ch_mult); + TMath::Sort(nn, ptc, iord); + + nn = 0; + ch_mult = jet.tracksIds().size(); + for (auto& jetConstituent : jet.template tracks_as()) { + if (iord[nn] > 1) + continue; + + if (iord[nn] == 0) { + trackL = jetConstituent.globalIndex(); + ch_l = jetConstituent.sign(); + v1.SetXYZ(jetConstituent.pt(), jetConstituent.py(), jetConstituent.pz()); } - if (ch_l != ch_nl) { - registry.fill(HIST("h_ch_d_pt"), jet.pt()); - registry.fill(HIST("h_ch_d_kt"), kt_p); - registry.fill(HIST("h_ch_d_z"), z); - registry.fill(HIST("h_ch_d_ft"), log10(fT)); - registry.fill(HIST("h_ch_d_mult"), ch_mult); + + if (iord[nn] == 1) { + n_trackL = jetConstituent.globalIndex(); + ch_nl = jetConstituent.sign(); + v2.SetXYZ(jetConstituent.px(), jetConstituent.py(), jetConstituent.pz()); + + vR = v1 + v2; + float z = v2.Perp(vR.Orthogonal()) / (v1.Perp(vR.Orthogonal()) + v2.Perp(vR.Orthogonal())); + float fT = ((2. * z * (1 - z) * vR.Mag()) / v1.Perp2(vR)) / 6.; + float kt_p = v1.Perp(vR); + + if (ch_l == ch_nl) { + registry.fill(HIST("h_ch_s_pt"), jet.pt()); + registry.fill(HIST("h_ch_s_kt"), kt_p); + registry.fill(HIST("h_ch_s_z"), z); + registry.fill(HIST("h_ch_s_ft"), log10(fT)); + registry.fill(HIST("h_ch_s_mult"), ch_mult); + } + if (ch_l != ch_nl) { + registry.fill(HIST("h_ch_d_pt"), jet.pt()); + registry.fill(HIST("h_ch_d_kt"), kt_p); + registry.fill(HIST("h_ch_d_z"), z); + registry.fill(HIST("h_ch_d_ft"), log10(fT)); + registry.fill(HIST("h_ch_d_mult"), ch_mult); + } } - } - nn++; + nn++; + } + if (nn > 1) + jetReclustering(jet); } - if (nn > 1) - jetReclustering(jet); } void processDummy(JetTracks const&) diff --git a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx index f597aefcadc..1a98c543d69 100644 --- a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx @@ -418,6 +418,7 @@ struct lnnRecoTask { } // Monte Carlo information + void fillMCinfo(aod::McTrackLabels const& trackLabels, aod::McParticles const&) { diff --git a/PWGLF/TableProducer/converters/CMakeLists.txt b/PWGLF/TableProducer/converters/CMakeLists.txt index 2621d216230..764ec4c26e9 100644 --- a/PWGLF/TableProducer/converters/CMakeLists.txt +++ b/PWGLF/TableProducer/converters/CMakeLists.txt @@ -9,7 +9,12 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -o2physics_add_dpl_workflow(strangederivedconverter - SOURCES strangederivedconverter.cxx +o2physics_add_dpl_workflow(stradautracksconverter + SOURCES stradautracksconverter.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(strarawcentsconverter + SOURCES strarawcentsconverter.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGLF/TableProducer/converters/strangederivedconverter.cxx b/PWGLF/TableProducer/converters/stradautracksconverter.cxx similarity index 58% rename from PWGLF/TableProducer/converters/strangederivedconverter.cxx rename to PWGLF/TableProducer/converters/stradautracksconverter.cxx index b5445b80908..5fe25abb572 100644 --- a/PWGLF/TableProducer/converters/strangederivedconverter.cxx +++ b/PWGLF/TableProducer/converters/stradautracksconverter.cxx @@ -18,38 +18,10 @@ using namespace o2; using namespace o2::framework; // Converts V0 version 001 to 002 -struct strangeDerivedConverter { - Produces straRawCents_001; - Produces straRawCents_003; +struct stradautracksconverter { Produces dautracktofpids; - void processStraRawCents000to001(aod::StraRawCents_000 const& straRawCents_000) - { - for (auto& values : straRawCents_000) { - straRawCents_001(values.multFT0A(), values.multFT0C(), values.multFV0A(), values.multNTracksPVeta1(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); - } - } - void processStraRawCents002to003(aod::StraRawCents_002 const& straRawCents_002) - { - for (auto& values : straRawCents_002) { - straRawCents_003(values.multFT0A(), - values.multFT0C(), - values.multFT0A(), - values.multNTracksPVeta1(), - 0, 0, - values.multNTracksITSTPC(), - values.multAllTracksTPCOnly(), - values.multAllTracksITSTPC(), - values.multZNA(), - values.multZNC(), - values.multZEM1(), - values.multZEM2(), - values.multZPA(), - values.multZPC()); - } - } - - void processGenerateDauTracksTOFPIDs(soa::Join const& v0s, soa::Join const& cascs, aod::DauTrackExtras const& dauTracks) + void process(soa::Join const& v0s, soa::Join const& cascs, aod::DauTrackExtras const& dauTracks) { // prepare arrays with the relevant information std::vector lLengths, lTOFSignals, lTOFEvTimes; @@ -84,14 +56,10 @@ struct strangeDerivedConverter { dautracktofpids(lTOFSignals[ii], lTOFEvTimes[ii], lLengths[ii]); } } - - PROCESS_SWITCH(strangeDerivedConverter, processStraRawCents000to001, "from StraRawCents 000 to 001", false); - PROCESS_SWITCH(strangeDerivedConverter, processStraRawCents002to003, "from StraRawCents 002 to 003", false); - PROCESS_SWITCH(strangeDerivedConverter, processGenerateDauTracksTOFPIDs, "from DauTrackTOFPIDs to V0TOFs/CascTOFs", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/TableProducer/converters/strarawcentsconverter.cxx b/PWGLF/TableProducer/converters/strarawcentsconverter.cxx new file mode 100644 index 00000000000..1527ee9ed81 --- /dev/null +++ b/PWGLF/TableProducer/converters/strarawcentsconverter.cxx @@ -0,0 +1,57 @@ +// 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 "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +using namespace o2; +using namespace o2::framework; + +struct strarawcentsconverter { + Produces straRawCents_001; + Produces straRawCents_003; + + void processStraRawCents000to001(aod::StraRawCents_000 const& straRawCents_000) + { + for (auto& values : straRawCents_000) { + straRawCents_001(values.multFT0A(), values.multFT0C(), values.multFV0A(), values.multNTracksPVeta1(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + } + } + void processStraRawCents002to003(aod::StraRawCents_002 const& straRawCents_002) + { + for (auto& values : straRawCents_002) { + straRawCents_003(values.multFT0A(), + values.multFT0C(), + values.multFT0A(), + values.multNTracksPVeta1(), + 0, 0, + values.multNTracksITSTPC(), + values.multAllTracksTPCOnly(), + values.multAllTracksITSTPC(), + values.multZNA(), + values.multZNC(), + values.multZEM1(), + values.multZEM2(), + values.multZPA(), + values.multZPC()); + } + } + + PROCESS_SWITCH(strarawcentsconverter, processStraRawCents000to001, "from StraRawCents 000 to 001", false); + PROCESS_SWITCH(strarawcentsconverter, processStraRawCents002to003, "from StraRawCents 002 to 003", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/Nuspex/AntimatterAbsorptionHMPID.cxx b/PWGLF/Tasks/Nuspex/AntimatterAbsorptionHMPID.cxx index 221ac0553b6..18d200510e2 100644 --- a/PWGLF/Tasks/Nuspex/AntimatterAbsorptionHMPID.cxx +++ b/PWGLF/Tasks/Nuspex/AntimatterAbsorptionHMPID.cxx @@ -12,12 +12,19 @@ /// \author Alberto Caliva (alberto.caliva@cern.ch) /// \since June 27, 2023 +#include +#include +#include +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoA.h" #include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" +#include "Framework/RunningWorkflowInfo.h" +#include "Framework/DataTypes.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" @@ -29,7 +36,6 @@ #include "ReconstructionDataFormats/PID.h" #include "ReconstructionDataFormats/TrackParametrization.h" #include "ReconstructionDataFormats/DCA.h" -#include "PWGLF/DataModel/LFParticleIdentification.h" using namespace o2; using namespace o2::framework; @@ -60,6 +66,7 @@ struct AntimatterAbsorptionHMPID { Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; Configurable maxDCAxy{"maxDCAxy", 0.5f, "maxDCAxy"}; Configurable maxDCAz{"maxDCAz", 0.5f, "maxDCAz"}; + Configurable use_hmpid_mom{"use_hmpid_mom", true, "use hmpid momentum"}; void init(o2::framework::InitContext&) { @@ -69,6 +76,8 @@ struct AntimatterAbsorptionHMPID { // HMPID Maps registryDA.add("hmpidXYpos", "hmpidXYpos", HistType::kTH2F, {{300, 0.0, 300.0, "x_{MIP}"}, {300, 0.0, 300.0, "y_{MIP}"}}); registryDA.add("hmpidXYneg", "hmpidXYneg", HistType::kTH2F, {{300, 0.0, 300.0, "x_{MIP}"}, {300, 0.0, 300.0, "y_{MIP}"}}); + registryDA.add("mom_corr_pos", "mom_corr_pos", HistType::kTH2F, {{150, 0.0, 3.0, "p_{vtx}"}, {150, 0.0, 3.0, "p_{hmpid}"}}); + registryDA.add("mom_corr_neg", "mom_corr_neg", HistType::kTH2F, {{150, 0.0, 3.0, "p_{vtx}"}, {150, 0.0, 3.0, "p_{hmpid}"}}); registryDA.add("hmpidEtaPhiMomPos", "hmpidEtaPhiMomPos", HistType::kTH3F, {{29, 0.1, 3.0, "p (GeV/c)"}, {180, -0.9, 0.9, "#eta"}, {200, 0.0, TMath::Pi(), "#phi"}}); registryDA.add("hmpidEtaPhiMomNeg", "hmpidEtaPhiMomNeg", HistType::kTH3F, {{29, 0.1, 3.0, "p (GeV/c)"}, {180, -0.9, 0.9, "#eta"}, {200, 0.0, TMath::Pi(), "#phi"}}); @@ -267,26 +276,11 @@ struct AntimatterAbsorptionHMPID { return true; } - // Info for TPC PID - using PidInfoTPC = soa::Join; - - // Info for TOF PID - using PidInfoTOF = soa::Join; - // Full Tracks - using FullTracks = soa::Join; + using FullTracks = soa::Join; // Process Data - void processData(o2::soa::Join::iterator const& event, - FullTracks const& /*tracks*/, - o2::aod::HMPIDs const& hmpids) + void processData(o2::soa::Join::iterator const& event, o2::aod::HMPIDs const& hmpids) { // Event Selection registryQC.fill(HIST("number_of_events_data"), 0.5); @@ -297,11 +291,22 @@ struct AntimatterAbsorptionHMPID { // Event Counter registryQC.fill(HIST("number_of_events_data"), 1.5); + if (abs(event.posZ()) > 10.0) + return; + + // Event Counter + registryQC.fill(HIST("number_of_events_data"), 2.5); + for (const auto& hmpid : hmpids) { // Get Track const auto& track = hmpid.track_as(); + // Track Momentum + float momentum = track.p(); + if (use_hmpid_mom) + momentum = hmpid.hmpidMom(); + // Track Selection if (!passedTrackSelection(track)) continue; @@ -309,10 +314,12 @@ struct AntimatterAbsorptionHMPID { if (track.sign() > 0) { registryDA.fill(HIST("hmpidXYpos"), hmpid.hmpidXMip(), hmpid.hmpidYMip()); registryDA.fill(HIST("hmpidEtaPhiMomPos"), track.p(), track.eta(), track.phi()); + registryDA.fill(HIST("mom_corr_pos"), track.p(), hmpid.hmpidMom()); } if (track.sign() < 0) { registryDA.fill(HIST("hmpidXYneg"), hmpid.hmpidXMip(), hmpid.hmpidYMip()); registryDA.fill(HIST("hmpidEtaPhiMomNeg"), track.p(), track.eta(), track.phi()); + registryDA.fill(HIST("mom_corr_neg"), track.p(), hmpid.hmpidMom()); } // Absorber @@ -328,16 +335,16 @@ struct AntimatterAbsorptionHMPID { if (passedPionSelection(track) && track.sign() > 0) { if (hmpidAbs8cm) { - registryDA.fill(HIST("incomingPi_Pos_8cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingPi_Pos_8cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Pi_Pos_Q_8cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Pi_Pos_ClsSize_8cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingPi_Pos_8cm"), momentum); + registryDA.fill(HIST("survivingPi_Pos_8cm"), momentum, dr); + registryDA.fill(HIST("Pi_Pos_Q_8cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Pi_Pos_ClsSize_8cm"), momentum, hmpid.hmpidClusSize()); } if (hmpidAbs4cm) { - registryDA.fill(HIST("incomingPi_Pos_4cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingPi_Pos_4cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Pi_Pos_Q_4cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Pi_Pos_ClsSize_4cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingPi_Pos_4cm"), momentum); + registryDA.fill(HIST("survivingPi_Pos_4cm"), momentum, dr); + registryDA.fill(HIST("Pi_Pos_Q_4cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Pi_Pos_ClsSize_4cm"), momentum, hmpid.hmpidClusSize()); } } @@ -345,16 +352,16 @@ struct AntimatterAbsorptionHMPID { if (passedPionSelection(track) && track.sign() < 0) { if (hmpidAbs8cm) { - registryDA.fill(HIST("incomingPi_Neg_8cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingPi_Neg_8cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Pi_Neg_Q_8cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Pi_Neg_ClsSize_8cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingPi_Neg_8cm"), momentum); + registryDA.fill(HIST("survivingPi_Neg_8cm"), momentum, dr); + registryDA.fill(HIST("Pi_Neg_Q_8cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Pi_Neg_ClsSize_8cm"), momentum, hmpid.hmpidClusSize()); } if (hmpidAbs4cm) { - registryDA.fill(HIST("incomingPi_Neg_4cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingPi_Neg_4cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Pi_Neg_Q_4cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Pi_Neg_ClsSize_4cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingPi_Neg_4cm"), momentum); + registryDA.fill(HIST("survivingPi_Neg_4cm"), momentum, dr); + registryDA.fill(HIST("Pi_Neg_Q_4cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Pi_Neg_ClsSize_4cm"), momentum, hmpid.hmpidClusSize()); } } @@ -362,16 +369,16 @@ struct AntimatterAbsorptionHMPID { if (passedKaonSelection(track) && track.sign() > 0) { if (hmpidAbs8cm) { - registryDA.fill(HIST("incomingKa_Pos_8cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingKa_Pos_8cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Ka_Pos_Q_8cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Ka_Pos_ClsSize_8cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingKa_Pos_8cm"), momentum); + registryDA.fill(HIST("survivingKa_Pos_8cm"), momentum, dr); + registryDA.fill(HIST("Ka_Pos_Q_8cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Ka_Pos_ClsSize_8cm"), momentum, hmpid.hmpidClusSize()); } if (hmpidAbs4cm) { - registryDA.fill(HIST("incomingKa_Pos_4cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingKa_Pos_4cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Ka_Pos_Q_4cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Ka_Pos_ClsSize_4cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingKa_Pos_4cm"), momentum); + registryDA.fill(HIST("survivingKa_Pos_4cm"), momentum, dr); + registryDA.fill(HIST("Ka_Pos_Q_4cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Ka_Pos_ClsSize_4cm"), momentum, hmpid.hmpidClusSize()); } } @@ -379,16 +386,16 @@ struct AntimatterAbsorptionHMPID { if (passedKaonSelection(track) && track.sign() < 0) { if (hmpidAbs8cm) { - registryDA.fill(HIST("incomingKa_Neg_8cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingKa_Neg_8cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Ka_Neg_Q_8cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Ka_Neg_ClsSize_8cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingKa_Neg_8cm"), momentum); + registryDA.fill(HIST("survivingKa_Neg_8cm"), momentum, dr); + registryDA.fill(HIST("Ka_Neg_Q_8cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Ka_Neg_ClsSize_8cm"), momentum, hmpid.hmpidClusSize()); } if (hmpidAbs4cm) { - registryDA.fill(HIST("incomingKa_Neg_4cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingKa_Neg_4cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Ka_Neg_Q_4cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Ka_Neg_ClsSize_4cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingKa_Neg_4cm"), momentum); + registryDA.fill(HIST("survivingKa_Neg_4cm"), momentum, dr); + registryDA.fill(HIST("Ka_Neg_Q_4cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Ka_Neg_ClsSize_4cm"), momentum, hmpid.hmpidClusSize()); } } @@ -396,16 +403,16 @@ struct AntimatterAbsorptionHMPID { if (passedProtonSelection(track) && track.sign() > 0) { if (hmpidAbs8cm) { - registryDA.fill(HIST("incomingPr_Pos_8cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingPr_Pos_8cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Pr_Pos_Q_8cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Pr_Pos_ClsSize_8cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingPr_Pos_8cm"), momentum); + registryDA.fill(HIST("survivingPr_Pos_8cm"), momentum, dr); + registryDA.fill(HIST("Pr_Pos_Q_8cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Pr_Pos_ClsSize_8cm"), momentum, hmpid.hmpidClusSize()); } if (hmpidAbs4cm) { - registryDA.fill(HIST("incomingPr_Pos_4cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingPr_Pos_4cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Pr_Pos_Q_4cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Pr_Pos_ClsSize_4cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingPr_Pos_4cm"), momentum); + registryDA.fill(HIST("survivingPr_Pos_4cm"), momentum, dr); + registryDA.fill(HIST("Pr_Pos_Q_4cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Pr_Pos_ClsSize_4cm"), momentum, hmpid.hmpidClusSize()); } } @@ -413,16 +420,16 @@ struct AntimatterAbsorptionHMPID { if (passedProtonSelection(track) && track.sign() < 0) { if (hmpidAbs8cm) { - registryDA.fill(HIST("incomingPr_Neg_8cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingPr_Neg_8cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Pr_Neg_Q_8cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Pr_Neg_ClsSize_8cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingPr_Neg_8cm"), momentum); + registryDA.fill(HIST("survivingPr_Neg_8cm"), momentum, dr); + registryDA.fill(HIST("Pr_Neg_Q_8cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Pr_Neg_ClsSize_8cm"), momentum, hmpid.hmpidClusSize()); } if (hmpidAbs4cm) { - registryDA.fill(HIST("incomingPr_Neg_4cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingPr_Neg_4cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("Pr_Neg_Q_4cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("Pr_Neg_ClsSize_4cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingPr_Neg_4cm"), momentum); + registryDA.fill(HIST("survivingPr_Neg_4cm"), momentum, dr); + registryDA.fill(HIST("Pr_Neg_Q_4cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("Pr_Neg_ClsSize_4cm"), momentum, hmpid.hmpidClusSize()); } } @@ -430,16 +437,16 @@ struct AntimatterAbsorptionHMPID { if (passedDeuteronSelection(track) && track.sign() > 0) { if (hmpidAbs8cm) { - registryDA.fill(HIST("incomingDe_Pos_8cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingDe_Pos_8cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("De_Pos_Q_8cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("De_Pos_ClsSize_8cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingDe_Pos_8cm"), momentum); + registryDA.fill(HIST("survivingDe_Pos_8cm"), momentum, dr); + registryDA.fill(HIST("De_Pos_Q_8cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("De_Pos_ClsSize_8cm"), momentum, hmpid.hmpidClusSize()); } if (hmpidAbs4cm) { - registryDA.fill(HIST("incomingDe_Pos_4cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingDe_Pos_4cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("De_Pos_Q_4cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("De_Pos_ClsSize_4cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingDe_Pos_4cm"), momentum); + registryDA.fill(HIST("survivingDe_Pos_4cm"), momentum, dr); + registryDA.fill(HIST("De_Pos_Q_4cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("De_Pos_ClsSize_4cm"), momentum, hmpid.hmpidClusSize()); } } @@ -447,16 +454,16 @@ struct AntimatterAbsorptionHMPID { if (passedDeuteronSelection(track) && track.sign() < 0) { if (hmpidAbs8cm) { - registryDA.fill(HIST("incomingDe_Neg_8cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingDe_Neg_8cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("De_Neg_Q_8cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("De_Neg_ClsSize_8cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingDe_Neg_8cm"), momentum); + registryDA.fill(HIST("survivingDe_Neg_8cm"), momentum, dr); + registryDA.fill(HIST("De_Neg_Q_8cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("De_Neg_ClsSize_8cm"), momentum, hmpid.hmpidClusSize()); } if (hmpidAbs4cm) { - registryDA.fill(HIST("incomingDe_Neg_4cm"), hmpid.hmpidMom()); - registryDA.fill(HIST("survivingDe_Neg_4cm"), hmpid.hmpidMom(), dr); - registryDA.fill(HIST("De_Neg_Q_4cm"), hmpid.hmpidMom(), hmpid.hmpidQMip()); - registryDA.fill(HIST("De_Neg_ClsSize_4cm"), hmpid.hmpidMom(), hmpid.hmpidClusSize()); + registryDA.fill(HIST("incomingDe_Neg_4cm"), momentum); + registryDA.fill(HIST("survivingDe_Neg_4cm"), momentum, dr); + registryDA.fill(HIST("De_Neg_Q_4cm"), momentum, hmpid.hmpidQMip()); + registryDA.fill(HIST("De_Neg_ClsSize_4cm"), momentum, hmpid.hmpidClusSize()); } } } diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index 73400affd00..b282dafe81f 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -118,3 +118,8 @@ o2physics_add_dpl_workflow(deut-rt-task SOURCES deutRtTask.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(hadronnucleicorrelation + SOURCES hadronnucleicorrelation.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx index 9a3576e90d9..5fb227f938d 100644 --- a/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx +++ b/PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx @@ -4438,9 +4438,9 @@ struct LFNucleiBATask { SliceCache cache; // Process function that runs on the original AO2D (for the MC) with the LfPIDcalibration void processMCRecoLfPidEv(EventCandidatesMC const& collisions, - soa::Join const& tracks, + soa::Join const&, aod::McParticles const& mcParticles, - aod::McCollisions const& mcCollisions) + aod::McCollisions const&) { /* for (const auto& track : tracks) { diff --git a/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx b/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx index 3aacc65a9d9..86fb967c341 100644 --- a/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx +++ b/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx @@ -834,7 +834,7 @@ struct antidLambdaEbye { auto mcTrack = mcLab.template mcParticle_as(); if (std::abs(mcTrack.pdgCode()) != partPdg[iP]) continue; - if ((mcTrack.flags() & 0x8) || (mcTrack.flags() & 0x2) || (mcTrack.flags() & 0x1)) + if (((mcTrack.flags() & 0x8) && doprocessMcRun2) || (mcTrack.flags() & 0x2) || (mcTrack.flags() & 0x1)) continue; if (!mcTrack.isPhysicalPrimary()) continue; @@ -866,7 +866,7 @@ struct antidLambdaEbye { continue; if (!posMother.isPhysicalPrimary() && !posMother.has_mothers()) continue; - if ((posMother.flags() & 0x8) || (posMother.flags() & 0x2) || (posMother.flags() & 0x1)) + if (((posMother.flags() & 0x8) && doprocessMcRun2) || (posMother.flags() & 0x2) || (posMother.flags() & 0x1)) continue; if (posMother.pdgCode() > 0) { histos.fill(HIST("recL"), centrality, candidateV0.pt, std::abs(candidateV0.eta)); @@ -927,7 +927,7 @@ struct antidLambdaEbye { if (std::abs(genEta) > etaMax) { continue; } - if ((mcPart.flags() & 0x8) || (mcPart.flags() & 0x2) || (mcPart.flags() & 0x1)) + if (((mcPart.flags() & 0x8) && doprocessMcRun2) || (mcPart.flags() & 0x2) || (mcPart.flags() & 0x1)) continue; auto pdgCode = mcPart.pdgCode(); if (std::abs(pdgCode) == 3122) { @@ -1042,7 +1042,7 @@ struct antidLambdaEbye { continue; auto centrality = collision.centRun2V0M(); - if (!collision.alias_bit(kINT7) && (!kINT7Intervals || (kINT7Intervals && ((centrality >= 10 && centrality < 30) || centrality > 50)))) + if (!(collision.sel7() && collision.alias_bit(kINT7)) && (!kINT7Intervals || (kINT7Intervals && ((centrality >= 10 && centrality < 30) || centrality > 50)))) continue; auto centralityCl0 = collision.centRun2CL0(); diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx new file mode 100644 index 00000000000..dd27ab6e5f2 --- /dev/null +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -0,0 +1,461 @@ +// 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 Hadron-nuclei correlation analysis task +/// \author Francesca Ercolessi +/// \since 21 April 2024 + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include +#include +#include +#include +#include + +#include "Framework/ASoA.h" +#include "MathUtils/Utils.h" +#include "Framework/DataTypes.h" +#include "Common/DataModel/Multiplicity.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/Expressions.h" + +#include "Framework/StaticFor.h" +#include "PWGCF/Femto3D/DataModel/singletrackselector.h" +#include "PWGCF/Femto3D/Core/femto3dPairTask.h" + +using namespace o2; +using namespace o2::soa; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct hadronnucleicorrelation { + + Configurable doQA{"doQA", true, "save QA histograms"}; + Configurable disable_pantip{"disable_pantip", false, "disable_pantip"}; + + // Event selection + Configurable cutzvertex{"cutzvertex", 10.0, "|vertexZ| value limit"}; + + // Track selection + Configurable min_TPC_nClusters{"min_TPC_nClusters", 80, "minimum number of found TPC clusters"}; + Configurable min_TPC_nCrossedRowsOverFindableCls{"min_TPC_nCrossedRowsOverFindableCls", 0.8, "n TPC Crossed Rows Over Findable Cls"}; + Configurable max_chi2_TPC{"max_chi2_TPC", 4.0f, "maximum TPC chi^2/Ncls"}; + Configurable max_chi2_ITS{"max_chi2_ITS", 36.0f, "maximum ITS chi^2/Ncls"}; + Configurable etacut{"etacut", 0.8f, "eta cut"}; + Configurable max_dcaxy{"max_dcaxy", 0.14f, "Maximum DCAxy"}; + Configurable max_dcaz{"max_dcaz", 0.1f, "Maximum DCAz"}; + Configurable nsigmaTPC{"nsigmaTPC", 3.0f, "cut nsigma TPC"}; + Configurable nsigmaTOF{"nsigmaTOF", 3.5f, "cut nsigma TOF"}; + + // Mixing parameters + Configurable _vertexNbinsToMix{"vertexNbinsToMix", 10, "Number of vertexZ bins for the mixing"}; + Configurable _multNsubBins{"multSubBins", 10, "number of sub-bins to perform the mixing within"}; + + // pT/A bins + Configurable> pTA{"pTA", {0.4f, 0.6f, 0.8f}, "p_{T}/A bins"}; + ConfigurableAxis AxisNSigma{"AxisNSigma", {50, -10.f, 10.f}, "n#sigma"}; + + using FilteredCollisions = aod::SingleCollSels; + using FilteredTracks = aod::SingleTrackSels; + using FilteredTracksMC = soa::Join; + + HistogramRegistry registry{"registry"}; + HistogramRegistry QA{"QA"}; + + typedef std::shared_ptr::iterator> trkType; + typedef std::shared_ptr::iterator> colType; + + // key: int64_t - value: vector of trkType objects + std::map> selectedtracks_p; + std::map> selectedtracks_antid; + std::map> selectedtracks_antip; + + // key: pair of an integer and a float - value: vector of colType objects + // for each key I have a vector of collisions + std::map, std::vector> mixbins_antidantip; + std::map, std::vector> mixbins_pantip; + + std::vector> hEtaPhi_PrAntiPr_SE; + std::vector> hEtaPhi_PrAntiPr_ME; + std::vector> hEtaPhi_AntiDeAntiPr_SE; + std::vector> hEtaPhi_AntiDeAntiPr_ME; + + int nBins; + + void init(o2::framework::InitContext&) + { + AxisSpec ptAxis = {pTA, "#it{p}_{T}/A of #bar{p} (GeV/c)"}; + AxisSpec etaAxis = {100, -1.5, 1.5, "#Delta#eta"}; + AxisSpec phiAxis = {157, -TMath::Pi() / 2, 1.5 * TMath::Pi(), "#Delta#phi"}; + + registry.add("hNEvents", "hNEvents", {HistType::kTH1I, {{3, 0.f, 3.f}}}); + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(1, "Selected"); + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(2, "#bar{d}-#bar{p}"); + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(3, "p-#bar{p}"); + + registry.add("hDebug", "hDebug", {HistType::kTH1I, {{4, 0.f, 4.f}}}); + registry.get(HIST("hDebug"))->GetXaxis()->SetBinLabel(1, "all"); + registry.get(HIST("hDebug"))->GetXaxis()->SetBinLabel(2, "ev. with #bar{d}"); + registry.get(HIST("hDebug"))->GetXaxis()->SetBinLabel(3, "ev. with #bar{p}"); + registry.get(HIST("hDebug"))->GetXaxis()->SetBinLabel(4, "ev. with p"); + + registry.add("hDebugdp", "hDebugdp", {HistType::kTH1I, {{6, 0.f, 6.f}}}); + registry.get(HIST("hDebugdp"))->GetXaxis()->SetBinLabel(1, "N coll with #bar{d}"); + registry.get(HIST("hDebugdp"))->GetXaxis()->SetBinLabel(2, "N mixing bins"); + registry.get(HIST("hDebugdp"))->GetXaxis()->SetBinLabel(3, "N coll with #bar{d}"); + registry.get(HIST("hDebugdp"))->GetXaxis()->SetBinLabel(4, "#bar{d}-#bar{p} pairs SE"); + registry.get(HIST("hDebugdp"))->GetXaxis()->SetBinLabel(5, "#bar{d}-#bar{p} pairs ME"); + + nBins = pTA.value.size() - 1; + for (int i = 0; i < nBins; i++) { + if (!disable_pantip) { + auto htempSE_PrAntiPr = registry.add(Form("hEtaPhi_PrAntiPr_SE_ptA%02.0f%02.0f", pTA.value.at(i) * 10, pTA.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_PrAntiPr_ME_ptA%02.0f%02.0f", pTA.value.at(i) * 10, pTA.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_AntiDeAntiPr_SE_ptA%02.0f%02.0f", pTA.value.at(i) * 10, pTA.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_AntiDeAntiPr_ME_ptA%02.0f%02.0f", pTA.value.at(i) * 10, pTA.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f= min_TPC_nClusters && + o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedTpcChi2NCl) <= max_chi2_TPC && + o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedTpcCrossedRowsOverFindableCls) >= min_TPC_nCrossedRowsOverFindableCls && + o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedItsChi2NCl) <= max_chi2_ITS && + nabs(o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedDcaXY)) <= max_dcaxy && + nabs(o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedDcaZ)) <= max_dcaz && + nabs(o2::aod::singletrackselector::eta) <= etacut; + + template + void mixTracks(Type const& tracks1, Type const& tracks2, bool isDe) + { // last value: 0 -- SE; 1 -- ME + for (auto it1 : tracks1) { + for (auto it2 : tracks2) { + + // Variables + float deltaEta = it2->eta() - it1->eta(); + float deltaPhi = it2->phi() - it1->phi(); + + while (deltaPhi < -TMath::Pi() / 2) { + deltaPhi += 2 * TMath::Pi(); + } + + while (deltaPhi >= 3 * TMath::Pi() / 2) { + deltaPhi -= 2 * TMath::Pi(); + } + + for (int k = 0; k < nBins; k++) { + if (!isDe && !disable_pantip) { + if (it1->pt() > pTA.value.at(k) && it1->pt() <= pTA.value.at(k + 1)) { + if (ME) { + hEtaPhi_PrAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); + } else { + hEtaPhi_PrAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); + } + } + } else { + if (it1->pt() > pTA.value.at(k) * 2 && it1->pt() <= pTA.value.at(k + 1) * 2) { + if (ME) { + hEtaPhi_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); + } else { + hEtaPhi_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); + } + } + } + } + } + } + } + + void processData(soa::Filtered const& collisions, soa::Filtered const& tracks) + { + for (auto track : tracks) { + if (abs(track.template singleCollSel_as>().posZ()) > cutzvertex) + continue; + + if (doQA) { + QA.fill(HIST("QA/hTPCnClusters"), track.tpcNClsFound()); + QA.fill(HIST("QA/hTPCchi2"), track.tpcChi2NCl()); + QA.fill(HIST("QA/hTPCcrossedRowsOverFindableCls"), track.tpcCrossedRowsOverFindableCls()); + QA.fill(HIST("QA/hITSchi2"), track.itsChi2NCl()); + QA.fill(HIST("QA/hDCAxy"), track.dcaXY()); + QA.fill(HIST("QA/hDCAz"), track.dcaZ()); + QA.fill(HIST("QA/hVtxZ_trk"), track.template singleCollSel_as>().posZ()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr"), track.pt() * track.sign(), track.tpcNSigmaPr()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_De"), track.pt() * track.sign(), track.tpcNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr"), track.pt() * track.sign(), track.tofNSigmaPr()); + QA.fill(HIST("QA/hnSigmaTOFVsPt_De"), track.pt() * track.sign(), track.tofNSigmaDe()); + } + + bool isPr = false; + bool isAntiPr = false; + bool isDeTPCTOF = false; + bool isAntiDeTPCTOF = false; + + if (TMath::Abs(track.tpcNSigmaPr()) < nsigmaTPC && track.sign() > 0) + isPr = true; + if (TMath::Abs(track.tpcNSigmaPr()) < nsigmaTPC && track.sign() < 0) + isAntiPr = true; + if (TMath::Abs(track.tpcNSigmaDe()) < nsigmaTPC && TMath::Abs(track.tofNSigmaDe()) < nsigmaTOF && track.sign() > 0) + isDeTPCTOF = true; + if (TMath::Abs(track.tpcNSigmaDe()) < nsigmaTPC && TMath::Abs(track.tofNSigmaDe()) < nsigmaTOF && track.sign() < 0) + isAntiDeTPCTOF = true; + + // Deuterons + if (isAntiDeTPCTOF) { + selectedtracks_antid[track.singleCollSelId()].push_back(std::make_shared(track)); + + if (doQA) { + QA.fill(HIST("QA/hEtaAntiDe"), track.eta()); + QA.fill(HIST("QA/hPhiAntiDe"), track.phi()); + QA.fill(HIST("QA/hnSigmaTPCVsPhi_AntiDe"), track.phi(), track.tpcNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTPCVsEta_AntiDe"), track.eta(), track.tpcNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTOFVsPhi_AntiDe"), track.phi(), track.tofNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTOFVsEta_AntiDe"), track.eta(), track.tofNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTOFVsPt_De_AfterSel"), track.pt() * track.sign(), track.tofNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_De_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaDe()); + } + } + if (isDeTPCTOF) { + if (doQA) { + QA.fill(HIST("QA/hEtaDe"), track.eta()); + QA.fill(HIST("QA/hPhiDe"), track.phi()); + QA.fill(HIST("QA/hnSigmaTPCVsPhi_De"), track.phi(), track.tpcNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTPCVsEta_De"), track.eta(), track.tpcNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTOFVsPhi_De"), track.phi(), track.tofNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTOFVsEta_De"), track.eta(), track.tofNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTOFVsPt_De_AfterSel"), track.pt() * track.sign(), track.tofNSigmaDe()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_De_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaDe()); + } + } + + // Protons + if (isPr) { + selectedtracks_p[track.singleCollSelId()].push_back(std::make_shared(track)); + + if (doQA) { + QA.fill(HIST("QA/hEtaPr"), track.eta()); + QA.fill(HIST("QA/hPhiPr"), track.phi()); + QA.fill(HIST("QA/hnSigmaTPCVsPhi_Pr"), track.phi(), track.tpcNSigmaPr()); + QA.fill(HIST("QA/hnSigmaTPCVsEta_Pr"), track.eta(), track.tpcNSigmaPr()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaPr()); + } + } else if (isAntiPr) { + selectedtracks_antip[track.singleCollSelId()].push_back(std::make_shared(track)); + + if (doQA) { + QA.fill(HIST("QA/hEtaAntiPr"), track.eta()); + QA.fill(HIST("QA/hPhiAntiPr"), track.phi()); + QA.fill(HIST("QA/hnSigmaTPCVsPhi_AntiPr"), track.phi(), track.tpcNSigmaPr()); + QA.fill(HIST("QA/hnSigmaTPCVsEta_AntiPr"), track.eta(), track.tpcNSigmaPr()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaPr()); + } + } + } + + for (auto collision : collisions) { + + if (TMath::Abs(collision.posZ()) > cutzvertex) + continue; + + registry.fill(HIST("hNEvents"), 0.5); + registry.fill(HIST("hDebug"), 0.5); + + if (selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end() && + selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) { + registry.fill(HIST("hNEvents"), 2.5); + } + + if (selectedtracks_antid.find(collision.globalIndex()) != selectedtracks_antid.end() && + selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) { + registry.fill(HIST("hNEvents"), 1.5); + } + + int vertexBinToMix = std::floor((collision.posZ() + cutzvertex) / (2 * cutzvertex / _vertexNbinsToMix)); + int centBinToMix = std::floor(collision.multPerc() / (100.0 / _multNsubBins)); + + if (selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end()) { + registry.fill(HIST("hDebug"), 3.5); + mixbins_pantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + } + + if (selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) { + registry.fill(HIST("hDebug"), 2.5); + } + + if (selectedtracks_antid.find(collision.globalIndex()) != selectedtracks_antid.end()) { + registry.fill(HIST("hDebug"), 1.5); + registry.fill(HIST("hDebugdp"), 0.5); // numero tot di collisioni nella mappa mixbins_antidantip + mixbins_antidantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + } + } + + registry.get(HIST("hDebugdp"))->SetBinContent(6, mixbins_antidantip.size()); + + if (!disable_pantip) { + if (!mixbins_pantip.empty()) { + for (auto i = mixbins_pantip.begin(); i != mixbins_pantip.end(); i++) { // iterating over all vertex&mult bins + + int EvPerBin = (i->second).size(); // number of collisions 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]; + + if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) { + mixTracks<0>(selectedtracks_p[col1->index()], selectedtracks_antip[col1->index()], 0); // mixing SE + } + + int indx3 = EvPerBin; + if (indx1 < (EvPerBin - 11)) { + indx3 = indx1 + 11; + } + + for (int indx2 = indx1 + 1; indx2 < indx3; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + + auto col2 = (i->second)[indx2]; + + if (col1 == col2) { + continue; + } + + if (selectedtracks_antip.find(col2->index()) != selectedtracks_antip.end()) { + mixTracks<1>(selectedtracks_p[col1->index()], selectedtracks_antip[col2->index()], 0); // mixing ME + } + } + } + } + } + } + + if (!mixbins_antidantip.empty()) { + + for (auto i = mixbins_antidantip.begin(); i != mixbins_antidantip.end(); i++) { // iterating over all vertex&mult bins + + registry.fill(HIST("hDebugdp"), 1.5); // numero di keys (vertex&mult bins) nella mappa mixbins_antidantip + + std::vector value = i->second; + int EvPerBin = value.size(); // number of collisions in each vertex&mult bin + + for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin + + registry.fill(HIST("hDebugdp"), 2.5); + + auto col1 = value[indx1]; + + if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) { + registry.fill(HIST("hDebugdp"), 3.5); + mixTracks<0>(selectedtracks_antid[col1->index()], selectedtracks_antip[col1->index()], 1); // mixing SE + } + + int indx3 = EvPerBin; + if (indx1 < (EvPerBin - 11)) { + indx3 = indx1 + 11; + } + + for (int indx2 = 0; indx2 < indx3; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin + + auto col2 = value[indx2]; + + if (col1 == col2) { + continue; + } + + if (selectedtracks_antip.find(col2->index()) != selectedtracks_antip.end()) { + registry.fill(HIST("hDebugdp"), 4.5); + mixTracks<1>(selectedtracks_antid[col1->index()], selectedtracks_antip[col2->index()], 1); // mixing ME + } + } + } + } + } + + // clearing up + for (auto i = selectedtracks_antid.begin(); i != selectedtracks_antid.end(); i++) + (i->second).clear(); + selectedtracks_antid.clear(); + + for (auto i = selectedtracks_antip.begin(); i != selectedtracks_antip.end(); i++) + (i->second).clear(); + selectedtracks_antip.clear(); + + for (auto i = selectedtracks_p.begin(); i != selectedtracks_p.end(); i++) + (i->second).clear(); + selectedtracks_p.clear(); + + for (auto i = mixbins_antidantip.begin(); i != mixbins_antidantip.end(); i++) + (i->second).clear(); + mixbins_antidantip.clear(); + + for (auto i = mixbins_pantip.begin(); i != mixbins_pantip.end(); i++) + (i->second).clear(); + mixbins_pantip.clear(); + } + PROCESS_SWITCH(hadronnucleicorrelation, processData, "processData", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} \ No newline at end of file diff --git a/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx b/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx index 262f445126f..983c71469a3 100644 --- a/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx +++ b/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx @@ -93,8 +93,8 @@ struct nuclei_in_jets { Configurable min_pt{"min_pt", 0.2f, "minimum pt of the tracks"}; Configurable min_eta{"min_eta", -0.8f, "minimum eta"}; Configurable max_eta{"max_eta", +0.8f, "maximum eta"}; - Configurable min_y{"min_y", -5.0f, "minimum y"}; - Configurable max_y{"max_y", +5.0f, "maximum y"}; + Configurable min_y{"min_y", -0.5f, "minimum y"}; + Configurable max_y{"max_y", +0.5f, "maximum y"}; Configurable max_dcaxy{"max_dcaxy", 0.1f, "Maximum DCAxy"}; Configurable max_dcaz{"max_dcaz", 0.1f, "Maximum DCAz"}; Configurable min_nsigmaTPC{"min_nsigmaTPC", -3.0f, "Minimum nsigma TPC"}; @@ -194,6 +194,10 @@ struct nuclei_in_jets { registryMC.add("antiproton_dca_prim", "antiproton_dca_prim", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {200, -0.5, 0.5, "DCA_{xy} (cm)"}}); registryMC.add("antiproton_dca_sec", "antiproton_dca_sec", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {200, -0.5, 0.5, "DCA_{xy} (cm)"}}); + // Fraction of Primary Antiprotons from MC + registryMC.add("antiproton_prim", "antiproton_prim", HistType::kTH1F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}}); + registryMC.add("antiproton_all", "antiproton_all", HistType::kTH1F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}}); + // Histograms for reweighting registryMC.add("antiproton_eta_pt_pythia", "antiproton_eta_pt_pythia", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {80, -0.8, 0.8, "#eta"}}); registryMC.add("antideuteron_eta_pt", "antideuteron_eta_pt", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {80, -0.8, 0.8, "#eta"}}); @@ -895,7 +899,7 @@ struct nuclei_in_jets { } } - void processRec(SimCollisions const& collisions, MCTracks const& mcTracks, aod::McCollisions const& /*mcCollisions*/, const aod::McParticles& /*mcParticles*/) + void processRec(SimCollisions const& collisions, MCTracks const& mcTracks, aod::McCollisions const&, const aod::McParticles&) { for (const auto& collision : collisions) { @@ -960,15 +964,23 @@ struct nuclei_in_jets { if (particle.pdgCode() == -2212 && (!particle.isPhysicalPrimary()) && TMath::Abs(track.dcaZ()) < max_dcaz) registryMC.fill(HIST("antiproton_dca_sec"), pt, track.dcaXY()); - if (!particle.isPhysicalPrimary()) - continue; - // DCA Cuts if (TMath::Abs(track.dcaXY()) > max_dcaxy) continue; if (TMath::Abs(track.dcaZ()) > max_dcaz) continue; + // Fraction of Primary Antiprotons + if (particle.pdgCode() == -2212) { + registryMC.fill(HIST("antiproton_all"), pt); + if (particle.isPhysicalPrimary()) { + registryMC.fill(HIST("antiproton_prim"), pt); + } + } + + if (!particle.isPhysicalPrimary()) + continue; + // Antiproton if (particle.pdgCode() == -2212) { if (pt < 1.0 && nsigmaTPCPr > min_nsigmaTPC && nsigmaTPCPr < max_nsigmaTPC) { diff --git a/PWGLF/Tasks/Nuspex/spectraTOF.cxx b/PWGLF/Tasks/Nuspex/spectraTOF.cxx index 5431684cada..9dff04fa83e 100644 --- a/PWGLF/Tasks/Nuspex/spectraTOF.cxx +++ b/PWGLF/Tasks/Nuspex/spectraTOF.cxx @@ -499,8 +499,6 @@ struct tofSpectra { histos.add(hpt_den_prm_recoev[i].data(), pTCharge[i], kTH3D, {ptAxis, multAxis, etaAxis}); histos.add(hpt_den_prm_evsel[i].data(), pTCharge[i], kTH3D, {ptAxis, multAxis, etaAxis}); histos.add(hpt_den_prm_goodev[i].data(), pTCharge[i], kTH3D, {ptAxis, multAxis, etaAxis}); - histos.add(hpt_den_prm_mcgoodev[i].data(), pTCharge[i], kTH3D, {ptAxis, multAxis, etaAxis}); - histos.add(hpt_den_prm_mcbadev[i].data(), pTCharge[i], kTH3D, {ptAxis, multAxis, etaAxis}); //*************************************************************************************** } else { histos.add(hpt_num_prm[i].data(), pTCharge[i], kTH1D, {ptAxis}); @@ -518,9 +516,9 @@ struct tofSpectra { histos.add(hpt_den_prm_recoev[i].data(), pTCharge[i], kTH1D, {ptAxis}); histos.add(hpt_den_prm_evsel[i].data(), pTCharge[i], kTH1D, {ptAxis}); histos.add(hpt_den_prm_goodev[i].data(), pTCharge[i], kTH1D, {ptAxis}); - histos.add(hpt_den_prm_mcgoodev[i].data(), pTCharge[i], kTH1D, {ptAxis}); - histos.add(hpt_den_prm_mcbadev[i].data(), pTCharge[i], kTH1D, {ptAxis}); } + histos.add(hpt_den_prm_mcgoodev[i].data(), pTCharge[i], kTH1D, {ptAxis}); + histos.add(hpt_den_prm_mcbadev[i].data(), pTCharge[i], kTH1D, {ptAxis}); if (enableDCAxyzHistograms) { histos.add(hdcaxyprm[i].data(), pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis}); histos.add(hdcaxystr[i].data(), pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis}); @@ -1740,7 +1738,7 @@ struct tofSpectra { histos.fill(HIST("MC/no_collision/neg"), track.pt()); } continue; - }; + } if (!isEventSelected(track.collision_as())) { continue; } diff --git a/PWGLF/Tasks/Resonances/KshortKshort.cxx b/PWGLF/Tasks/Resonances/KshortKshort.cxx index 7d8ea6f7d21..18e0f657447 100644 --- a/PWGLF/Tasks/Resonances/KshortKshort.cxx +++ b/PWGLF/Tasks/Resonances/KshortKshort.cxx @@ -21,6 +21,7 @@ #include #include #include +#include "TF1.h" #include #include @@ -60,20 +61,26 @@ struct strangeness_tutorial { Configurable QAv0{"QAv0", false, "QAv0"}; Configurable QAPID{"QAPID", false, "QAPID"}; + Configurable QAv0_daughters{"QAv0_daughters", false, "QA of v0 daughters"}; Configurable inv_mass1D{"inv_mass1D", false, "1D invariant mass histograms"}; Configurable DCAv0topv{"DCAv0topv", false, "DCA V0 to PV"}; Configurable armcut{"armcut", true, "arm cut"}; - Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; // Configurable for event selection Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable cfgETAcut{"cfgETAcut", 0.8f, "Track ETA cut"}; + Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; + Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; + Configurable goodzvertex{"goodzvertex", false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference."}; + Configurable itstpctracks{"itstpctracks", false, "selects collisions with at least one ITS-TPC track,"}; + Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; // Configurable parameters for V0 selection Configurable ConfV0DCADaughMax{"ConfV0DCADaughMax", 1.0f, "DCA b/w V0 daughters"}; Configurable v0setting_dcapostopv{"v0setting_dcapostopv", 0.06, "DCA Pos To PV"}; Configurable v0setting_dcanegtopv{"v0setting_dcanegtopv", 0.06, "DCA Neg To PV"}; Configurable cMaxV0DCA{"cMaxV0DCA", 1, "DCA V0 to PV"}; + // Configurable isStandarv0{"isStandarv0", false, "Standard V0"}; // Configurable ConfDaughDCAMin{"ConfDaughDCAMin", 0.06f, "V0 Daugh sel: Max. DCA Daugh to PV (cm)"}; // same as DCA pos to pv and neg to pv Configurable ConfV0PtMin{"ConfV0PtMin", 0.f, "Minimum transverse momentum of V0"}; @@ -81,16 +88,20 @@ struct strangeness_tutorial { Configurable ConfV0TranRadV0Min{"ConfV0TranRadV0Min", 0.5f, "Minimum transverse radius"}; Configurable ConfV0TranRadV0Max{"ConfV0TranRadV0Max", 200.f, "Maximum transverse radius"}; Configurable cMaxV0LifeTime{"cMaxV0LifeTime", 15, "Maximum V0 life time"}; - Configurable cSigmaMassKs0{"cSigmaMassKs0", 4, "n Sigma cut on KS0 mass"}; + Configurable cSigmaMassKs0{"cSigmaMassKs0", 4, "n Sigma cut on Ks0 mass (Mass (Ks) - cSigmaMassKs0*cWidthKs0)"}; Configurable cWidthKs0{"cWidthKs0", 0.005, "Width of KS0"}; Configurable ConfDaughEta{"ConfDaughEta", 0.8f, "V0 Daugh sel: max eta"}; Configurable ConfDaughTPCnclsMin{"ConfDaughTPCnclsMin", 70.f, "V0 Daugh sel: Min. nCls TPC"}; Configurable ConfDaughPIDCuts{"ConfDaughPIDCuts", 5, "PID selections for KS0 daughters"}; + Configurable Confarmcut{"Confarmcut", 0.2f, "Armenteros cut"}; + Configurable ConfKsrapidity{"ConfKsrapidity", 0.5f, "Rapidity cut on K0s"}; + // Configurable lowmasscutks0{"lowmasscutks0", 0.497 - 4 * 0.005, "Low mass cut on K0s"}; + // Configurable highmasscutks0{"highmasscutks0", 0.497 + 4 * 0.005, "High mass cut on K0s"}; // Configurable for track selection and multiplicity Configurable cfgPTcut{"cfgPTcut", 0.2f, "Track PT cut"}; Configurable cfgNmixedEvents{"cfgNmixedEvents", 5, "Number of mixed events"}; - Configurable cfgMultFOTM{"cfgMultFOTM", true, "Use FOTM multiplicity if pp else use 0 here for PbPb"}; + Configurable cfgMultFOTM{"cfgMultFOTM", true, "Use FOTM multiplicity if pp else use 0 here for PbPb (FT0C)"}; ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 5., 10., 30., 50., 70., 100., 110., 150.}, "Binning of the centrality axis"}; // Other cuts on Ks and glueball @@ -100,9 +111,6 @@ struct strangeness_tutorial { Configurable competingcascrejlambdaanti{"competingcascrejlambdaanti", 4.3, "rejecting competing cascade anti-lambda"}; Configurable tpcCrossedrows{"tpcCrossedrows", 70, "TPC crossed rows"}; Configurable tpcCrossedrowsOverfcls{"tpcCrossedrowsOverfcls", 0.8, "TPC crossed rows over findable clusters"}; - Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; - Configurable goodzvertex{"goodzvertex", false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference."}; - Configurable itstpctracks{"itstpctracks", false, "selects collisions with at least one ITS-TPC track,"}; // Mass and pT axis as configurables Configurable cPtMin{"cPtMin", 0.0f, "Minimum pT"}; @@ -115,6 +123,13 @@ struct strangeness_tutorial { Configurable ksMassMax{"ksMassMax", 0.55f, "Maximum mass of K0s"}; Configurable ksMassBins{"ksMassBins", 200, "Number of mass bins for K0s"}; + // Event selection cuts - Alex (Temporary, need to fix!) + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + TF1* fMultCutLow = nullptr; + TF1* fMultCutHigh = nullptr; + TF1* fMultMultPVCut = nullptr; + void init(InitContext const&) { // Axes @@ -136,16 +151,35 @@ struct strangeness_tutorial { } hglue.add("h3glueInvMassDS", "h3glueInvMassDS", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis}, true); hglue.add("h3glueInvMassME", "h3glueInvMassME", kTHnSparseF, {multiplicityAxis, ptAxis, glueballMassAxis}, true); + hglue.add("heventscheck", "heventscheck", kTH1F, {{9, 0, 9}}); // K0s topological/PID cuts if (QAv0) { // Invariant Mass - rKzeroShort.add("hMassK0Shortbefore", "hMassK0Shortbefore", kTH2F, {K0ShortMassAxis, ptAxis}); - rKzeroShort.add("hMassK0ShortSelected", "hMassK0ShortSelected", kTH2F, {K0ShortMassAxis, ptAxis}); - // Topological cuts - rKzeroShort.add("hDCAV0Daughters", "hDCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.2f}}}); - rKzeroShort.add("hV0CosPA", "hV0CosPA", {HistType::kTH1F, {{100, 0.95f, 1.f}}}); + rKzeroShort.add("hMassK0Shortbefore", "hMassK0Shortbefore", kTHnSparseF, {K0ShortMassAxis, ptAxis}); + rKzeroShort.add("hMassK0ShortSelected", "hMassK0ShortSelected", kTHnSparseF, {K0ShortMassAxis, ptAxis}); + // Topological histograms (after the selection) + rKzeroShort.add("hDCAV0Daughters", "DCA between v0 daughters", {HistType::kTH1F, {{60, -3.0f, 3.0f}}}); + rKzeroShort.add("hV0CosPA", "hV0CosPA", {HistType::kTH1F, {{100, 0.96f, 1.1f}}}); rKzeroShort.add("hLT", "hLT", {HistType::kTH1F, {{100, 0.0f, 50.0f}}}); + rKzeroShort.add("Mass_lambda", "Mass under lambda hypothesis", kTH1F, {glueballMassAxis}); + rKzeroShort.add("mass_AntiLambda", "Mass under anti-lambda hypothesis", kTH1F, {glueballMassAxis}); + rKzeroShort.add("mass_Gamma", "Mass under Gamma hypothesis", kTH1F, {glueballMassAxis}); + // rKzeroShort.add("mass_Hypertriton", "Mass under hypertriton hypothesis", kTH1F, {glueballMassAxis}); + // rKzeroShort.add("mass_AnitHypertriton", "Mass under anti-hypertriton hypothesis", kTH1F, {glueballMassAxis}); + rKzeroShort.add("rapidity", "Rapidity distribution", kTH1F, {{100, -1.0f, 1.0f}}); + rKzeroShort.add("hv0radius", "hv0radius", kTH1F, {{100, 0.0f, 200.0f}}); + rKzeroShort.add("hDCApostopv", "DCA positive daughter to PV", kTH1F, {{1000, -10.0f, 10.0f}}); + rKzeroShort.add("hDCAnegtopv", "DCA negative daughter to PV", kTH1F, {{1000, -10.0f, 10.0f}}); + rKzeroShort.add("hDCAv0topv", "DCA V0 to PV", kTH1F, {{60, -3.0f, 3.0f}}); + rKzeroShort.add("halpha", "Armenteros alpha", kTH1F, {{100, -5.0f, 5.0f}}); + rKzeroShort.add("hqtarm", "qtarm", kTH1F, {{100, 0.0f, 1.0f}}); + rKzeroShort.add("hpsipair", "psi pair angle", kTH1F, {{100, -5.0f, 5.0f}}); + + // // Topological histograms (before the selection) + // rKzeroShort.add("hDCAV0Daughters_before", "DCA between v0 daughters before the selection", {HistType::kTH1F, {{60, -3.0f, 3.0f}}}); + // rKzeroShort.add("hV0CosPA_before", "hV0CosPA_before", {HistType::kTH1F, {{200, 0.91f, 1.1f}}}); + // rKzeroShort.add("hLT_before", "hLT_before", {HistType::kTH1F, {{100, 0.0f, 50.0f}}}); } if (QAPID) { rKzeroShort.add("hNSigmaPosPionK0s_before", "hNSigmaPosPionK0s_before", {HistType::kTH2F, {{ptAxis}, {100, -5.f, 5.f}}}); @@ -153,28 +187,70 @@ struct strangeness_tutorial { rKzeroShort.add("hNSigmaNegPionK0s_before", "hNSigmaNegPionK0s_before", {HistType::kTH2F, {{ptAxis}, {100, -5.f, 5.f}}}); rKzeroShort.add("hNSigmaNegPionK0s_after", "hNSigmaNegPionK0s_after", {HistType::kTH2F, {{ptAxis}, {100, -5.f, 5.f}}}); } + if (QAv0_daughters) { + rKzeroShort.add("negative_pt", "Negative daughter pT", kTH1F, {ptAxis}); + rKzeroShort.add("positive_pt", "Positive daughter pT", kTH1F, {ptAxis}); + rKzeroShort.add("negative_eta", "Negative daughter eta", kTH1F, {{100, -1.0f, 1.0f}}); + rKzeroShort.add("positive_eta", "Positive daughter eta", kTH1F, {{100, -1.0f, 1.0f}}); + rKzeroShort.add("negative_phi", "Negative daughter phi", kTH1F, {{70, 0.0f, 7.0f}}); + rKzeroShort.add("positive_phi", "Positive daughter phi", kTH1F, {{70, 0.0f, 7.0f}}); + } + if (additionalEvsel) { + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutLow->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutHigh->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x)", 0, 100); + fMultCutLow->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); + fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x)", 0, 100); + fMultCutHigh->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); + fMultMultPVCut = new TF1("fMultMultPVCut", "[0]+[1]*x+[2]*x*x", 0, 5000); + fMultMultPVCut->SetParameters(-0.1, 0.785, -4.7e-05); + } } - template - bool SelectionV0(Collision const& collision, V0 const& candidate, - float /*multiplicity*/) + template + bool eventselection(Collision const& collision, const float& multiplicity) { - if (QAv0) { - rKzeroShort.fill(HIST("hMassK0Shortbefore"), candidate.mK0Short(), candidate.pt()); + if (!collision.sel8()) { + return false; } - - if (!DCAv0topv && fabs(candidate.dcav0topv()) > cMaxV0DCA) { + if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { return false; } - - if (rapidityks && TMath::Abs(candidate.yK0Short()) >= 0.5) { + if (piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { return false; } - - if (masslambda && TMath::Abs(candidate.mLambda() - candidate.mK0Short()) >= competingcascrejlambda && TMath::Abs(candidate.mAntiLambda() - candidate.mK0Short()) >= competingcascrejlambdaanti) { + if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if (itstpctracks && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { return false; } + // if (collision.alias_bit(kTVXinTRD)) { + // // TRD triggered + // // return 0; + // } + auto multNTracksPV = collision.multNTracksPV(); + if (additionalEvsel && multNTracksPV < fMultPVCutLow->Eval(multiplicity)) { + return false; + } + if (additionalEvsel && multNTracksPV > fMultPVCutHigh->Eval(multiplicity)) { + return false; + } + // if (multTrk < fMultCutLow->Eval(multiplicity)) + // return 0; + // if (multTrk > fMultCutHigh->Eval(multiplicity)) + // return 0; + // if (multTrk > fMultMultPVCut->Eval(multNTracksPV)) + // return 0; + return true; + } + template + bool SelectionV0(Collision const& collision, V0 const& candidate, + float /*multiplicity*/) + { const float qtarm = candidate.qtarm(); const float alph = candidate.alpha(); float arm = qtarm / alph; @@ -188,6 +264,42 @@ struct strangeness_tutorial { float highmasscutks0 = 0.497 + cWidthKs0 * cSigmaMassKs0; // float decayLength = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * RecoDecay::sqrtSumOfSquares(candidate.px(), candidate.py(), candidate.pz()); + if (QAv0) { + rKzeroShort.fill(HIST("hMassK0Shortbefore"), candidate.mK0Short(), candidate.pt()); + rKzeroShort.fill(HIST("hLT"), CtauK0s); + rKzeroShort.fill(HIST("hDCAV0Daughters"), candidate.dcaV0daughters()); + rKzeroShort.fill(HIST("hV0CosPA"), candidate.v0cosPA()); + rKzeroShort.fill(HIST("Mass_lambda"), candidate.mLambda()); + rKzeroShort.fill(HIST("mass_AntiLambda"), candidate.mAntiLambda()); + rKzeroShort.fill(HIST("mass_Gamma"), candidate.mGamma()); + // rKzeroShort.fill(HIST("mass_Hypertriton"), candidate.mHypertriton()); + // rKzeroShort.fill(HIST("mass_AnitHypertriton"), candidate.mAntiHypertriton()); + rKzeroShort.fill(HIST("rapidity"), candidate.yK0Short()); + rKzeroShort.fill(HIST("hv0radius"), candidate.v0radius()); + rKzeroShort.fill(HIST("hDCApostopv"), candidate.dcapostopv()); + rKzeroShort.fill(HIST("hDCAnegtopv"), candidate.dcanegtopv()); + rKzeroShort.fill(HIST("hDCAv0topv"), candidate.dcav0topv()); + rKzeroShort.fill(HIST("halpha"), candidate.alpha()); + rKzeroShort.fill(HIST("hqtarm"), candidate.qtarm()); + rKzeroShort.fill(HIST("hpsipair"), candidate.psipair()); + } + + if (!DCAv0topv && fabs(candidate.dcav0topv()) > cMaxV0DCA) { + return false; + } + + if (rapidityks && TMath::Abs(candidate.yK0Short()) >= ConfKsrapidity) { + return false; + } + + if (masslambda && TMath::Abs(candidate.mLambda() - candidate.mK0Short()) >= competingcascrejlambda && TMath::Abs(candidate.mAntiLambda() - candidate.mK0Short()) >= competingcascrejlambdaanti) { + return false; + } + + // if (isStandarv0 && candidate.isStandardV0 == 0) { + // return false; + // } + if (pT < ConfV0PtMin) { return false; } @@ -206,15 +318,12 @@ struct strangeness_tutorial { if (fabs(CtauK0s) > cMaxV0LifeTime || candidate.mK0Short() < lowmasscutks0 || candidate.mK0Short() > highmasscutks0) { return false; } - if (!armcut && arm < 0.2) { + if (!armcut && arm < Confarmcut) { return false; } if (QAv0) { rKzeroShort.fill(HIST("hMassK0ShortSelected"), candidate.mK0Short(), candidate.pt()); - rKzeroShort.fill(HIST("hLT"), CtauK0s); - rKzeroShort.fill(HIST("hDCAV0Daughters"), candidate.dcaV0daughters()); - rKzeroShort.fill(HIST("hV0CosPA"), candidate.v0cosPA()); } return true; } @@ -268,6 +377,12 @@ struct strangeness_tutorial { // } } + if (QAv0_daughters) { + (charge == 1) ? rKzeroShort.fill(HIST("positive_pt"), track.pt()) : rKzeroShort.fill(HIST("negative_pt"), track.pt()); + (charge == 1) ? rKzeroShort.fill(HIST("positive_eta"), track.eta()) : rKzeroShort.fill(HIST("negative_eta"), track.eta()); + (charge == 1) ? rKzeroShort.fill(HIST("positive_phi"), track.phi()) : rKzeroShort.fill(HIST("negative_phi"), track.phi()); + } + return true; } @@ -282,7 +397,7 @@ struct strangeness_tutorial { // Defining the type of the daughter tracks using DaughterTracks = soa::Join; - using EventCandidates = soa::Filtered>; + using EventCandidates = soa::Filtered>; using TrackCandidates = soa::Filtered>; using V0TrackCandidate = aod::V0Datas; @@ -292,34 +407,27 @@ struct strangeness_tutorial { void processSE(EventCandidates::iterator const& collision, TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s) { + hglue.fill(HIST("heventscheck"), 0.5); const double massK0s = TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass(); - if (!collision.sel8()) { - return; - } - if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - return; - } - if (piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return; - } - if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - return; - } - if (itstpctracks && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - return; - } - float multiplicity = 0.0f; if (cfgMultFOTM) { multiplicity = collision.centFT0M(); } else { multiplicity = collision.centFT0C(); } + if (!eventselection(collision, multiplicity)) { + return; + } + + hglue.fill(HIST("heventscheck"), 1.5); rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); rEventSelection.fill(HIST("hmultiplicity"), multiplicity); for (auto& [v1, v2] : combinations(CombinationsStrictlyUpperIndexPolicy(V0s, V0s))) { + + hglue.fill(HIST("heventscheck"), 2.5); + if (v1.size() == 0 || v2.size() == 0) { continue; } @@ -360,6 +468,8 @@ struct strangeness_tutorial { continue; } + hglue.fill(HIST("heventscheck"), 3.5); + TLorentzVector lv1, lv2, lv3; lv1.SetPtEtaPhiM(v1.pt(), v1.eta(), v1.phi(), massK0s); lv2.SetPtEtaPhiM(v2.pt(), v2.eta(), v2.phi(), massK0s); @@ -382,48 +492,36 @@ struct strangeness_tutorial { using BinningTypeCentralityM = ColumnBinningPolicy; using BinningTypeVertexContributor = ColumnBinningPolicy; ConfigurableAxis mevz = {"mevz", {10, -10., 10.}, "mixed event vertex z binning"}; - ConfigurableAxis memult = {"memult", {2, 0., 110.}, "mixed event multiplicity binning"}; - BinningTypeVertexContributor binningOnPositions1{{mevz, memult}, true}; - BinningTypeCentralityM binningOnPositions2{{mevz, memult}, true}; - - SameKindPair pair1{binningOnPositions1, cfgNmixedEvents, -1, &cache}; // for PbPb - SameKindPair pair2{binningOnPositions2, cfgNmixedEvents, -1, &cache}; // for pp + ConfigurableAxis memult = {"memult", {2000, 0, 10000}, "mixed event multiplicity binning"}; - void processME(EventCandidates const& /*collisions*/, TrackCandidates const& /*tracks*/, V0TrackCandidate const& /*v0s*/) + void processME(EventCandidates const& collisions, TrackCandidates const& /*tracks*/, V0TrackCandidate const& v0s) { + hglue.fill(HIST("heventscheck"), 4.5); + const double massK0s = TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass(); + auto tracksTuple = std::make_tuple(v0s); + BinningTypeVertexContributor binningOnPositions1{{mevz, memult}, true}; + BinningTypeCentralityM binningOnPositions2{{mevz, memult}, true}; + + SameKindPair pair1{binningOnPositions1, cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; // for PbPb + SameKindPair pair2{binningOnPositions2, cfgNmixedEvents, -1, collisions, tracksTuple, &cache}; // for pp + if (cfgMultFOTM) { for (auto& [c1, tracks1, c2, tracks2] : pair2) // two different centrality c1 and c2 and tracks corresponding to them { + hglue.fill(HIST("heventscheck"), 5.5); - if (!c1.sel8()) { - continue; - } - if (!c2.sel8()) { - continue; - } - - if (timFrameEvsel && (!c1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !c2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !c1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !c2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - continue; - } + float multiplicity = 0.0f; + multiplicity = c1.centFT0M(); - if (piluprejection && !c1.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - continue; - } - if (piluprejection && !c2.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - continue; - } - if (goodzvertex && (!c1.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV) || !c2.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV))) { - continue; - } - if (itstpctracks && (!c1.selection_bit(o2::aod::evsel::kIsVertexITSTPC) || !c2.selection_bit(o2::aod::evsel::kIsVertexITSTPC))) { + if (!eventselection(c1, multiplicity) || !eventselection(c2, multiplicity)) { continue; } + hglue.fill(HIST("heventscheck"), 6.5); - float multiplicity = 0.0f; - multiplicity = c1.centFT0M(); + for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { + hglue.fill(HIST("heventscheck"), 7.5); - for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(tracks1, tracks2))) { if (t1.size() == 0 || t2.size() == 0) { continue; } @@ -461,6 +559,8 @@ struct strangeness_tutorial { continue; } + hglue.fill(HIST("heventscheck"), 8.5); + TLorentzVector lv1, lv2, lv3; lv1.SetPtEtaPhiM(t1.pt(), t1.eta(), t1.phi(), massK0s); lv2.SetPtEtaPhiM(t2.pt(), t2.eta(), t2.phi(), massK0s); @@ -476,35 +576,14 @@ struct strangeness_tutorial { } else { for (auto& [c1, tracks1, c2, tracks2] : pair1) // two different centrality c1 and c2 and tracks corresponding to them { + float multiplicity = 0.0f; + multiplicity = c1.centFT0C(); - if (!c1.sel8()) { - continue; - } - if (!c2.sel8()) { - continue; - } - - if (timFrameEvsel && (!c1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !c2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !c1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !c2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - continue; - } - - if (piluprejection && !c1.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - continue; - } - if (piluprejection && !c2.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - continue; - } - if (goodzvertex && (!c1.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV) || !c2.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV))) { - continue; - } - if (itstpctracks && (!c1.selection_bit(o2::aod::evsel::kIsVertexITSTPC) || !c2.selection_bit(o2::aod::evsel::kIsVertexITSTPC))) { + if (!eventselection(c1, multiplicity) || !eventselection(c2, multiplicity)) { continue; } - float multiplicity = 0.0f; - multiplicity = c1.centFT0C(); - - for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(tracks1, tracks2))) { + for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { if (t1.size() == 0 || t2.size() == 0) { continue; } diff --git a/PWGLF/Tasks/Resonances/highmasslambda.cxx b/PWGLF/Tasks/Resonances/highmasslambda.cxx index 9ebb6ae12f7..72f5c325fef 100644 --- a/PWGLF/Tasks/Resonances/highmasslambda.cxx +++ b/PWGLF/Tasks/Resonances/highmasslambda.cxx @@ -114,6 +114,9 @@ struct highmasslambda { // Mixed event Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 1, "Number of mixed events per event"}; + /// activate rotational background + Configurable nBkgRotations{"nBkgRotations", 9, "Number of rotated copies (background) per each original candidate"}; + // THnsparse bining ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {60, 2.15, 2.45}, "#it{M} (GeV/#it{c}^{2})"}; ConfigurableAxis configThnAxisPt{"configThnAxisPt", {30, 1.0, 31.}, "#it{p}_{T} (GeV/#it{c})"}; @@ -177,6 +180,10 @@ struct highmasslambda { histos.add("hSparseV2SASameEvent_V2", "hSparseV2SASameEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, dcaAxis, dcatoPVAxis, thnAxisCentrality}); histos.add("hSparseV2SAMixedEvent_V2", "hSparseV2SAMixedEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, dcaAxis, dcatoPVAxis, thnAxisCentrality}); + histos.add("hSparseV2SASameEventRotational_V2", "hSparseV2SASameEventRotational_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, dcaAxis, dcatoPVAxis, thnAxisCentrality}); + histos.add("hSparseV2SASameEvent_V2_new", "hSparseV2SASameEvent_V2_new", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, dcaAxis, thnAxisCentrality}); + histos.add("hSparseV2SASameEventRotational_V2_new", "hSparseV2SASameEventRotational_V2_new", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, dcaAxis, thnAxisCentrality}); + histos.add("hSparseV2SAMixedEvent_V2_new", "hSparseV2SAMixedEvent_V2_new", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, dcaAxis, thnAxisCentrality}); if (fillPolarization) { histos.add("hSparseV2SASameEventplus_SA", "hSparseV2SASameEventplus_SA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisSA, thnAxisPhiminusPsi, thnAxisCentrality}); @@ -221,7 +228,7 @@ struct highmasslambda { if (candidate.p() > 0.5 && candidate.p() <= 0.8 && TMath::Abs(candidate.tpcNSigmaPr()) < 3.0) { return true; } - if (candidate.p() > 0.8 && candidate.hasTOF() && TMath::Sqrt(candidate.tofNSigmaPr() * candidate.tofNSigmaPr() + candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr()) < 2.0 * nsigmaCutTOF * nsigmaCutTOF) { + if (candidate.p() > 0.8 && candidate.hasTOF() && TMath::Sqrt(candidate.tofNSigmaPr() * candidate.tofNSigmaPr() + candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr()) < nsigmaCutTOF) { return true; } return false; @@ -239,7 +246,7 @@ struct highmasslambda { if (candidate.p() > 0.8 && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPr()) < nsigmaCutTPC) { return true; } - if (candidate.p() > 0.8 && candidate.hasTOF() && TMath::Sqrt(candidate.tofNSigmaPr() * candidate.tofNSigmaPr() + candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr()) < 2.0 * nsigmaCutTOF * nsigmaCutTOF) { + if (candidate.p() > 0.8 && candidate.hasTOF() && TMath::Sqrt(candidate.tofNSigmaPr() * candidate.tofNSigmaPr() + candidate.tpcNSigmaPr() * candidate.tpcNSigmaPr()) < nsigmaCutTOF) { return true; } return false; @@ -254,7 +261,7 @@ struct highmasslambda { const float pT = candidate.pt(); const std::vector decVtx = {candidate.x(), candidate.y(), candidate.z()}; const float tranRad = candidate.v0radius(); - const double dcaDaughv0 = candidate.dcaV0daughters(); + const double dcaDaughv0 = TMath::Abs(candidate.dcaV0daughters()); const double cpav0 = candidate.v0cosPA(); float CtauK0s = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass(); // FIXME: Get from the common header @@ -331,7 +338,7 @@ struct highmasslambda { ConfigurableAxis axisEPAngle{"axisEPAngle", {1, -TMath::Pi() / 2, TMath::Pi() / 2}, "event plane angle"}; using BinningTypeVertexContributor = ColumnBinningPolicy; - ROOT::Math::PxPyPzMVector Lambdac, Proton, Kshort, fourVecDauCM; + ROOT::Math::PxPyPzMVector Lambdac, Proton, Kshort, LambdacRot, ProtonRot, fourVecDauCM; ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY, eventplaneVec, eventplaneVecNorm, beamvector; double massPi = TDatabasePDG::Instance()->GetParticle(kPiPlus)->Mass(); // FIXME: Get from the common header double massPr = TDatabasePDG::Instance()->GetParticle(kProton)->Mass(); // FIXME: Get from the common header @@ -418,8 +425,23 @@ struct highmasslambda { } auto phiminuspsi = GetPhiInRange(Lambdac.Phi() - psiFT0C); auto v2 = TMath::Cos(2.0 * phiminuspsi); + auto diffangle = Proton.Phi() - Lambdac.Phi(); + auto decaylength = std::abs(track1.dcaXY() / TMath::Sin(diffangle)); histos.fill(HIST("hSparseV2SASameEvent_V2"), Lambdac.M(), Lambdac.Pt(), v2, std::abs(track1.dcaXY()), std::abs(v0.dcav0topv()), centrality); - + histos.fill(HIST("hSparseV2SASameEvent_V2_new"), Lambdac.M(), Lambdac.Pt(), v2, decaylength, centrality); + for (int nrotbkg = 1; nrotbkg < nBkgRotations; nrotbkg++) { + auto anglestep = nrotbkg * (2.0 * TMath::Pi() / nBkgRotations); + auto rotProtonPx = track1.px() * std::cos(anglestep) - track1.py() * std::sin(anglestep); + auto rotProtonPy = track1.px() * std::sin(anglestep) + track1.py() * std::cos(anglestep); + ProtonRot = ROOT::Math::PxPyPzMVector(rotProtonPx, rotProtonPy, track1.pz(), massPr); + LambdacRot = ProtonRot + Kshort; + auto phiminuspsiRot = GetPhiInRange(LambdacRot.Phi() - psiFT0C); + auto v2Rot = TMath::Cos(2.0 * phiminuspsiRot); + auto diffangleRot = ProtonRot.Phi() - LambdacRot.Phi(); + auto decaylengthRot = std::abs(track1.dcaXY() / TMath::Sin(diffangleRot)); + histos.fill(HIST("hSparseV2SASameEventRotational_V2"), LambdacRot.M(), LambdacRot.Pt(), v2Rot, std::abs(track1.dcaXY()), std::abs(v0.dcav0topv()), centrality); + histos.fill(HIST("hSparseV2SASameEventRotational_V2_new"), LambdacRot.M(), LambdacRot.Pt(), v2Rot, decaylengthRot, centrality); + } ROOT::Math::Boost boost{Lambdac.BoostToCM()}; fourVecDauCM = boost(Kshort); threeVecDauCM = fourVecDauCM.Vect(); @@ -490,6 +512,9 @@ struct highmasslambda { auto phiminuspsi = GetPhiInRange(Lambdac.Phi() - psiFT0C); auto v2 = TMath::Cos(2.0 * phiminuspsi); histos.fill(HIST("hSparseV2SAMixedEvent_V2"), Lambdac.M(), Lambdac.Pt(), v2, std::abs(track1.dcaXY()), std::abs(v0.dcav0topv()), centrality); + auto diffangle = Proton.Phi() - Lambdac.Phi(); + auto decaylength = std::abs(track1.dcaXY() / TMath::Sin(diffangle)); + histos.fill(HIST("hSparseV2SAMixedEvent_V2_new"), Lambdac.M(), Lambdac.Pt(), v2, decaylength, centrality); ROOT::Math::Boost boost{Lambdac.BoostToCM()}; fourVecDauCM = boost(Kshort); diff --git a/PWGLF/Tasks/Resonances/k892analysis.cxx b/PWGLF/Tasks/Resonances/k892analysis.cxx index d865af01814..deac62b4cba 100644 --- a/PWGLF/Tasks/Resonances/k892analysis.cxx +++ b/PWGLF/Tasks/Resonances/k892analysis.cxx @@ -44,8 +44,8 @@ struct k892analysis { /// Histograms ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9.0, 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8, 9.9, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13.0, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6, 13.7, 13.8, 13.9, 14.0, 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.0}, "Binning of the pT axis"}; ConfigurableAxis binsPtQA{"binsPtQA", {VARIABLE_WIDTH, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 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.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0}, "Binning of the pT axis"}; - // ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 1., 5., 10., 30., 50., 70., 100., 110.}, "Binning of the centrality axis"}; - ConfigurableAxis binsCent{"binsCent", {200, 0.0f, 200.0f}, "Binning of the centrality axis"}; + ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + // ConfigurableAxis binsCent{"binsCent", {200, 0.0f, 200.0f}, "Binning of the centrality axis"}; Configurable cInvMassStart{"cInvMassStart", 0.6, "Invariant mass start"}; Configurable cInvMassEnd{"cInvMassEnd", 1.5, "Invariant mass end"}; Configurable cInvMassBins{"cInvMassBins", 900, "Invariant mass binning"}; @@ -55,8 +55,7 @@ struct k892analysis { /// Event Mixing Configurable nEvtMixing{"nEvtMixing", 5, "Number of events to mix"}; ConfigurableAxis CfgVtxBins{"CfgVtxBins", {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 CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0., 1., 5., 10., 30., 50., 70., 100., 110.}, "Mixing bins - multiplicity"}; - ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Mixing bins - z-vertex"}; + ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f, 100.0f, 110.0f}, "Mixing bins - z-vertex"}; /// Pre-selection cuts Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minium pt cut"}; @@ -177,6 +176,10 @@ struct k892analysis { histos.add("QAMCTrue/trkDCAxy_ka", "DCAxy distribution of kaon track candidates", HistType::kTH1F, {dcaxyAxis}); histos.add("QAMCTrue/trkDCAz_pi", "DCAz distribution of pion track candidates", HistType::kTH1F, {dcazAxis}); histos.add("QAMCTrue/trkDCAz_ka", "DCAz distribution of kaon track candidates", HistType::kTH1F, {dcazAxis}); + histos.add("QAMCTrue/TOF_Nsigma_pi_all", "TOF NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Pion};", {HistType::kTH2D, {ptAxisQA, pidQAAxis}}); + histos.add("QAMCTrue/TPC_Nsigma_pi_all", "TPC NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH2D, {ptAxisQA, pidQAAxis}}); + histos.add("QAMCTrue/TOF_Nsigma_ka_all", "TOF NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {ptAxisQA, pidQAAxis}}); + histos.add("QAMCTrue/TPC_Nsigmaka_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {ptAxisQA, pidQAAxis}}); histos.add("h3Reck892invmass", "Invariant mass of Reconstructed MC K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis}); histos.add("h3Reck892invmassAnti", "Invariant mass of Reconstructed MC Anti-K(892)0", kTH3F, {centAxis, ptAxis, invMassAxis}); histos.add("k892Gen", "pT distribution of True MC K(892)0", kTH2D, {ptAxis, centAxis}); @@ -461,6 +464,14 @@ struct k892analysis { histos.fill(HIST("QAMCTrue/trkDCAxy_ka"), trk2.dcaXY()); histos.fill(HIST("QAMCTrue/trkDCAz_pi"), trk1.dcaZ()); histos.fill(HIST("QAMCTrue/trkDCAz_ka"), trk2.dcaZ()); + histos.fill(HIST("QAMCTrue/TPC_Nsigma_pi_all"), trk1ptPi, trk1NSigmaPiTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QAMCTrue/TOF_Nsigma_pi_all"), trk1ptPi, trk1NSigmaPiTOF); + } + histos.fill(HIST("QAMCTrue/TPC_Nsigmaka_all"), trk2ptKa, trk2NSigmaKaTPC); + if (isTrk2hasTOF) { + histos.fill(HIST("QAMCTrue/TOF_Nsigma_ka_all"), trk2ptKa, trk2NSigmaKaTOF); + } // MC histograms if (trk1.motherPDG() < 0) { diff --git a/PWGLF/Tasks/Resonances/k892pmanalysis.cxx b/PWGLF/Tasks/Resonances/k892pmanalysis.cxx index 578ebd707dd..1cdcf49f2fb 100644 --- a/PWGLF/Tasks/Resonances/k892pmanalysis.cxx +++ b/PWGLF/Tasks/Resonances/k892pmanalysis.cxx @@ -53,6 +53,8 @@ struct k892pmanalysis { Configurable cDCABins{"cDCABins", 150, "DCA binning"}; /// Pre-selection cuts Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minimum pt cut"}; + Configurable cMaxEtacut{"cMaxEtacut", 0.8, "Track maximum eta cut"}; + Configurable cMaxV0Etacut{"cMaxV0Etacut", 0.8, "V0 maximum eta cut"}; /// DCA Selections // DCAr to PV Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; @@ -142,6 +144,8 @@ struct k892pmanalysis { // basic track cuts if (std::abs(track.pt()) < cMinPtcut) return false; + if (std::abs(track.eta()) > cMaxEtacut) + return false; if (std::abs(track.dcaXY()) > cMaxDCArToPVcut) return false; if (std::abs(track.dcaZ()) > cMaxDCAzToPVcut) @@ -160,7 +164,7 @@ struct k892pmanalysis { bool V0Cut(const V0Type v0) { // V0 track cuts - if (std::abs(v0.eta()) > 0.8) + if (std::abs(v0.eta()) > cMaxV0Etacut) return false; if (v0.v0CosPA() < cV0MinCosPA) return false; diff --git a/PWGLF/Tasks/Resonances/kaonkaonanalysis.cxx b/PWGLF/Tasks/Resonances/kaonkaonanalysis.cxx index b746d981b30..538332e9fb4 100644 --- a/PWGLF/Tasks/Resonances/kaonkaonanalysis.cxx +++ b/PWGLF/Tasks/Resonances/kaonkaonanalysis.cxx @@ -33,6 +33,7 @@ #include #include #include +#include "TF1.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -57,8 +58,22 @@ using std::array; struct phianalysisrun3 { SliceCache cache; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + // events Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; + Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; + Configurable goodzvertex{"goodzvertex", false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference."}; + Configurable itstpctracks{"itstpctracks", false, "selects collisions with at least one ITS-TPC track,"}; + Configurable timFrameEvsel{"timFrameEvsel", true, "TPC Time frame boundary cut"}; + Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; + + // Event selection cuts - Alex (Temporary, need to fix!) + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + TF1* fMultCutLow = nullptr; + TF1* fMultCutHigh = nullptr; + TF1* fMultMultPVCut = nullptr; + // track Configurable cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; @@ -77,7 +92,6 @@ struct phianalysisrun3 { Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; Configurable isDeepAngle{"isDeepAngle", false, "Deep Angle cut"}; Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; - Configurable timFrameEvsel{"timFrameEvsel", true, "TPC Time frame boundary cut"}; Configurable cmultLow{"cmultLow", -0.5f, "Low centrality percentile"}; Configurable cmultHigh{"cmultHigh", 200.5f, "High centrality percentile"}; Configurable cmultBins{"cmultBins", 201, "Number of centrality bins"}; @@ -123,6 +137,18 @@ struct phianalysisrun3 { histos.add("h1PhiRecsplit", "Phi meson Rec split", kTH1F, {axisPt}); histos.add("h3PhiRec", "Phi meson Rec", kTHnSparseF, {axisPt, axisPt, {200, -0.1, 0.1}}, true); } + if (additionalEvsel) { + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutLow->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); + fMultPVCutHigh->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); + fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x)", 0, 100); + fMultCutLow->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); + fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x)", 0, 100); + fMultCutHigh->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); + fMultMultPVCut = new TF1("fMultMultPVCut", "[0]+[1]*x+[2]*x*x", 0, 5000); + fMultMultPVCut->SetParameters(-0.1, 0.785, -4.7e-05); + } } double massKa = o2::constants::physics::MassKPlus; @@ -134,6 +160,45 @@ struct phianalysisrun3 { array pvec0; array pvec1; array pvec1rotation; + + template + bool eventselection(Collision const& collision, const float& multiplicity) + { + if (!collision.sel8()) { + return false; + } + if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + return false; + } + if (piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + if (itstpctracks && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return false; + } + // if (collision.alias_bit(kTVXinTRD)) { + // // TRD triggered + // // return 0; + // } + auto multNTracksPV = collision.multNTracksPV(); + if (additionalEvsel && multNTracksPV < fMultPVCutLow->Eval(multiplicity)) { + return false; + } + if (additionalEvsel && multNTracksPV > fMultPVCutHigh->Eval(multiplicity)) { + return false; + } + // if (multTrk < fMultCutLow->Eval(multiplicity)) + // return 0; + // if (multTrk > fMultCutHigh->Eval(multiplicity)) + // return 0; + // if (multTrk > fMultMultPVCut->Eval(multNTracksPV)) + // return 0; + return true; + } + template bool selectionTrack(const T& candidate) { @@ -240,7 +305,7 @@ struct phianalysisrun3 { Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); - using EventCandidates = soa::Filtered>; + using EventCandidates = soa::Filtered>; using TrackCandidates = soa::Filtered>; @@ -266,17 +331,14 @@ struct phianalysisrun3 { void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&) { - if (!collision.sel8()) { - return; - } - if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (!eventselection(collision, collision.centFT0M())) { return; } float multiplicity; - if (cfgMultFT0) - multiplicity = collision.centFT0C(); - if (!cfgMultFT0) - multiplicity = collision.numContrib(); + // if (cfgMultFT0) + multiplicity = collision.centFT0M(); + // if (!cfgMultFT0) + // multiplicity = collision.numContrib(); histos.fill(HIST("hCentrality"), multiplicity); histos.fill(HIST("hNcontributor"), collision.numContrib()); histos.fill(HIST("hVtxZ"), collision.posZ()); @@ -323,20 +385,17 @@ struct phianalysisrun3 { BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicity}, true}; SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; for (auto& [c1, tracks1, c2, tracks2] : pair) { - if (!c1.sel8()) { - continue; - } - if (!c2.sel8()) { + if (!eventselection(c1, c1.centFT0M())) { continue; } - if (timFrameEvsel && (!c1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !c2.selection_bit(aod::evsel::kNoTimeFrameBorder) || !c1.selection_bit(aod::evsel::kNoITSROFrameBorder) || !c2.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + if (!eventselection(c2, c2.centFT0M())) { continue; } float multiplicity; - if (cfgMultFT0) - multiplicity = c1.centFT0C(); - if (!cfgMultFT0) - multiplicity = c1.numContrib(); + // if (cfgMultFT0) + multiplicity = c1.centFT0M(); + // if (!cfgMultFT0) + // multiplicity = c1.numContrib(); for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { bool unlike = false; diff --git a/PWGLF/Tasks/Resonances/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index c757c5febd0..da9f836bfcf 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -529,7 +529,7 @@ struct kstarqa { PROCESS_SWITCH(kstarqa, processSE, "Process Same event", true); - void processME(EventCandidates const& collisions, TrackCandidates const& tracks) + void processME(EventCandidates const&, TrackCandidates const&) { diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx index 911df84490d..61a7029b81a 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx @@ -31,7 +31,6 @@ #include #include #include -#include "TF1.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -69,33 +68,13 @@ struct phianalysisrun3_PbPb { Configurable isEtaAssym{"isEtaAssym", false, "isEtaAssym"}; Configurable cfgMultFT0{"cfgMultFT0", true, "cfgMultFT0"}; Configurable iscustomDCAcut{"iscustomDCAcut", false, "iscustomDCAcut"}; - Configurable isNoTOF{"isNoTOF", false, "isNoTOF"}; Configurable ismanualDCAcut{"ismanualDCAcut", true, "ismanualDCAcut"}; Configurable isITSOnlycut{"isITSOnlycut", true, "isITSOnlycut"}; Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; - Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; Configurable isDeepAngle{"isDeepAngle", false, "Deep Angle cut"}; Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; - Configurable confRapidity{"confRapidity", 0.5, "Rapidity cut"}; - Configurable additionalQAplots{"additionalQAplots", true, "Additional QA plots"}; - Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; - Configurable ispTdepPID{"ispTdepPID", true, "pT dependent PID"}; - Configurable genacceptancecut{"genacceptancecut", true, "use acceptance cut for generated"}; - // Event selection configurables - Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; - Configurable piluprejection{"piluprejection", false, "Pileup rejection"}; - Configurable goodzvertex{"goodzvertex", false, "removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference."}; - Configurable itstpctracks{"itstpctracks", false, "selects collisions with at least one ITS-TPC track,"}; // MC Configurable isMC{"isMC", false, "Run MC"}; - Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; - - // Event selection cuts - Alex - TF1* fMultPVCutLow = nullptr; - TF1* fMultPVCutHigh = nullptr; - TF1* fMultCutLow = nullptr; - TF1* fMultCutHigh = nullptr; - TF1* fMultMultPVCut = nullptr; void init(o2::framework::InitContext&) { histos.add("hCentrality", "Centrality distribution", kTH1F, {{200, 0.0, 200.0}}); @@ -117,59 +96,13 @@ struct phianalysisrun3_PbPb { histos.add("h3PhiInvMassMixedCside", "Invariant mass of Phi meson Mixed C side", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}}); } } else if (isMC) { - histos.add("hMC", "MC Event statistics", kTH1F, {{6, 0.0f, 6.0f}}); - histos.add("hMC1", "MC Event statistics", kTH1F, {{1, 0.0f, 2.0f}}); - histos.add("hMC2", "MC Event statistics", kTH1F, {{1, 0.0f, 2.0f}}); - histos.add("hMC3", "MC Event statistics", kTH1F, {{1, 0.0f, 2.0f}}); - histos.add("hMC4", "MC Event statistics", kTH1F, {{1, 0.0f, 2.0f}}); + histos.add("hMC", "MC Event statistics", kTH1F, {{5, 0.0f, 4.0f}}); histos.add("h1PhiGen1", "Phi meson Gen", kTH1F, {{200, 0.0f, 20.0f}}); histos.add("h2PhiRec1", "Phi meson Rec", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); histos.add("h2PhiGen1", "Phi meson gen", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); histos.add("h1PhiRec1", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h1PhiRecsplit", "Phi meson Rec split", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h2PhiRecsplit", "Phi meson Rec split", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); histos.add("Centrec", "MC Centrality", kTH1F, {{200, 0.0, 200.0}}); histos.add("Centgen", "MC Centrality", kTH1F, {{200, 0.0, 200.0}}); - histos.add("h1PhiGen2", "Phi meson Gen", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h2PhiRec2", "Phi meson Rec", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); - histos.add("h2PhiGen2", "Phi meson gen", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); - histos.add("h1PhiRec2", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h2PhiRec3", "Phi meson Rec", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); - histos.add("h2PhiGen3", "Phi meson gen", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); - histos.add("h1PhiRec3", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h1PhiGen3", "Phi meson Gen", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("h1Phimassgen", "Phi meson gen", kTH1F, {{200, 0.9, 1.1}}); - histos.add("h1Phimassrec", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}}); - histos.add("h1Phipt", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("CentPercentileMCRecHist", "MC Centrality", kTH1F, {{100, 0.0f, 100.0f}}); - } - if (additionalQAplots) { - // DCA QA - histos.add("QAbefore/trkDCAxy", "DCAxy distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); - histos.add("QAbefore/trkDCAz", "DCAz distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); - histos.add("QAafter/trkDCAxy", "DCAxy distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); - histos.add("QAafter/trkDCAz", "DCAz distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); - // PID QA before cuts - histos.add("QAbefore/TOF_TPC_Mapka_all", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAbefore/TOF_Nsigma_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - histos.add("QAbefore/TPC_Nsigma_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - // PID QA after cuts - histos.add("QAafter/TOF_TPC_Mapka_all", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAafter/TOF_Nsigma_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - histos.add("QAafter/TPC_Nsigma_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - } - // Event selection cut additional - Alex - if (additionalEvsel) { - fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultPVCutLow->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); - fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); - fMultPVCutHigh->SetParameters(2834.66, -87.0127, 0.915126, -0.00330136, 332.513, -12.3476, 0.251663, -0.00272819, 1.12242e-05); - fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x)", 0, 100); - fMultCutLow->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); - fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x + 3.*([4]+[5]*x)", 0, 100); - fMultCutHigh->SetParameters(1893.94, -53.86, 0.502913, -0.0015122, 109.625, -1.19253); - fMultMultPVCut = new TF1("fMultMultPVCut", "[0]+[1]*x+[2]*x*x", 0, 5000); - fMultMultPVCut->SetParameters(-0.1, 0.785, -4.7e-05); } } @@ -182,63 +115,28 @@ struct phianalysisrun3_PbPb { array pvec0; array pvec1; array pvec1rotation; - template - bool eventSelected(TCollision collision, const float& multiplicity) - { - if (collision.alias_bit(kTVXinTRD)) { - // TRD triggered - // return 0; - } - auto multNTracksPV = collision.multNTracksPV(); - if (multNTracksPV < fMultPVCutLow->Eval(multiplicity)) - return 0; - if (multNTracksPV > fMultPVCutHigh->Eval(multiplicity)) - return 0; - // if (multTrk < fMultCutLow->Eval(centrality)) - // return 0; - // if (multTrk > fMultCutHigh->Eval(centrality)) - // return 0; - // if (multTrk > fMultMultPVCut->Eval(multNTracksPV)) - // return 0; - - return 1; - } - template bool selectionTrack(const T& candidate) { - if (iscustomDCAcut && !(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster)) { + if (iscustomDCAcut && !(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster)) { return false; } - if (ismanualDCAcut && !(candidate.isGlobalTrackWoDCA() && candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster)) { + if (ismanualDCAcut && !(candidate.isGlobalTrackWoDCA() && candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster)) { return false; } - if (isITSOnlycut && !(candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster)) { + if (isITSOnlycut && !(candidate.isPVContributor() && std::abs(candidate.dcaXY()) < cfgCutDCAxy && std::abs(candidate.dcaZ()) < cfgCutDCAz && candidate.itsNCls() > cfgITScluster)) { return false; } return true; } + template bool selectionPID(const T& candidate) { - if (!isNoTOF && candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (candidate.hasTOF() && (candidate.tofNSigmaKa() * candidate.tofNSigmaKa() + candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa()) < (nsigmaCutCombined * nsigmaCutCombined)) { return true; } - if (!isNoTOF && !candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { - return true; - } - if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { - return true; - } - return false; - } - template - bool selectionPIDpTdependent(const T& candidate) - { - if (candidate.p() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { - return true; - } - if (candidate.p() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } return false; @@ -317,12 +215,11 @@ struct phianalysisrun3_PbPb { } } - ROOT::Math::PxPyPzMVector PhiMesonMother, KaonPlus, KaonMinus; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz); - using EventCandidates = soa::Filtered>; - // using EventCandidates = soa::Filtered>; + + using EventCandidates = soa::Filtered>; using TrackCandidates = soa::Filtered>; @@ -331,12 +228,6 @@ struct phianalysisrun3_PbPb { using TrackCandidatesMC = soa::Filtered>; - using CollisionMCTrueTable = aod::McCollisions; - using TrackMCTrueTable = aod::McParticles; - using CollisionMCRecTableCentFT0C = soa::SmallGroups>; - using TrackMCRecTable = soa::Join; - using FilTrackMCRecTable = soa::Filtered; - Preslice perCollision = aod::track::collisionId; ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for bin"}; ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {20, 0, 100}, "multiplicity percentile for bin"}; @@ -357,25 +248,11 @@ struct phianalysisrun3_PbPb { if (!collision.sel8()) { return; } - if (timFrameEvsel && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - return; - } - - if (piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return; - } - if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - return; - } - if (itstpctracks && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - return; - } - auto multiplicity = collision.centFT0C(); - auto multTPC = collision.multNTracksPV(); - if (additionalEvsel && !eventSelected(collision, multiplicity)) { - return; - } - histos.fill(HIST("hFTOCvsTPC"), multiplicity, multTPC); + float multiplicity; + if (cfgMultFT0) + multiplicity = collision.centFT0C(); + if (!cfgMultFT0) + multiplicity = collision.numContrib(); histos.fill(HIST("hCentrality"), multiplicity); histos.fill(HIST("hNcontributor"), collision.numContrib()); histos.fill(HIST("hVtxZ"), collision.posZ()); @@ -383,19 +260,17 @@ struct phianalysisrun3_PbPb { if (!selectionTrack(track1)) { continue; } - - histos.fill(HIST("QAbefore/TPC_Nsigma_all"), track1.pt(), track1.tpcNSigmaKa()); - histos.fill(HIST("QAbefore/TOF_Nsigma_all"), track1.pt(), track1.tofNSigmaKa()); - histos.fill(HIST("QAbefore/trkDCAxy"), track1.dcaXY()); - histos.fill(HIST("QAbefore/trkDCAz"), track1.dcaZ()); - histos.fill(HIST("QAbefore/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); - - auto track1ID = track1.index(); + histos.fill(HIST("hEta"), track1.eta()); + histos.fill(HIST("hDcaxy"), track1.dcaXY()); + histos.fill(HIST("hDcaz"), track1.dcaZ()); + histos.fill(HIST("hNsigmaKaonTPC"), track1.tpcNSigmaKa()); + histos.fill(HIST("hNsigmaKaonTOF"), track1.tofNSigmaKa()); + auto track1ID = track1.globalIndex(); for (auto track2 : tracks) { if (!selectionTrack(track2)) { continue; } - auto track2ID = track2.index(); + auto track2ID = track2.globalIndex(); if (track2ID <= track1ID) { continue; } @@ -409,20 +284,7 @@ struct phianalysisrun3_PbPb { if (isITSOnlycut) { FillinvMass(track1, track2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); } - if (!isITSOnlycut && !ispTdepPID && selectionPID(track1) && selectionPID(track2)) { - histos.fill(HIST("QAafter/TPC_Nsigma_all"), track1.pt(), track1.tpcNSigmaKa()); - histos.fill(HIST("QAafter/TOF_Nsigma_all"), track1.pt(), track1.tofNSigmaKa()); - histos.fill(HIST("QAafter/trkDCAxy"), track1.dcaXY()); - histos.fill(HIST("QAafter/trkDCAz"), track1.dcaZ()); - histos.fill(HIST("QAafter/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); - FillinvMass(track1, track2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); - } - if (!isITSOnlycut && ispTdepPID && selectionPIDpTdependent(track1) && selectionPIDpTdependent(track2)) { - histos.fill(HIST("QAafter/TPC_Nsigma_all"), track1.pt(), track1.tpcNSigmaKa()); - histos.fill(HIST("QAafter/TOF_Nsigma_all"), track1.pt(), track1.tofNSigmaKa()); - histos.fill(HIST("QAafter/trkDCAxy"), track1.dcaXY()); - histos.fill(HIST("QAafter/trkDCAz"), track1.dcaZ()); - histos.fill(HIST("QAafter/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); + if (!isITSOnlycut && selectionPID(track1) && selectionPID(track2)) { FillinvMass(track1, track2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); } } @@ -443,29 +305,12 @@ struct phianalysisrun3_PbPb { if (!c2.sel8()) { continue; } - if (timFrameEvsel && (!c1.selection_bit(aod::evsel::kNoTimeFrameBorder) || !c2.selection_bit(aod::evsel::kNoTimeFrameBorder))) { - continue; - } - if (piluprejection && (!c1.selection_bit(o2::aod::evsel::kNoSameBunchPileup) || !c2.selection_bit(o2::aod::evsel::kNoSameBunchPileup))) { - return; - } - if (goodzvertex && (!c1.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV) || c2.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV))) { - return; - } - if (itstpctracks && (!c1.selection_bit(o2::aod::evsel::kIsVertexITSTPC) || c2.selection_bit(o2::aod::evsel::kIsVertexITSTPC))) { - return; - } - auto multiplicity = c1.centFT0C(); - auto multiplicity2 = c2.centFT0C(); - if (additionalEvsel && !eventSelected(c1, multiplicity)) { - // printf("Mix = %d\n", 4); - continue; - } - if (additionalEvsel && !eventSelected(c2, multiplicity2)) { - // printf("Mix = %d\n", 5); - continue; - } + float multiplicity; + if (cfgMultFT0) + multiplicity = c1.centFT0C(); + if (!cfgMultFT0) + multiplicity = c1.numContrib(); for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { bool unlike = false; @@ -484,18 +329,16 @@ struct phianalysisrun3_PbPb { if (isITSOnlycut) { FillinvMass(t1, t2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); } - if (!isITSOnlycut && !ispTdepPID && selectionPID(t1) && selectionPID(t2)) { - FillinvMass(t1, t2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); - } - if (!isITSOnlycut && ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { + if (!isITSOnlycut && selectionPID(t1) && selectionPID(t2)) { FillinvMass(t1, t2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); } } } } + + PROCESS_SWITCH(phianalysisrun3_PbPb, processMixedEvent, "Process Mixed event", false); void processGen(aod::McCollision const& mcCollision, aod::McParticles& mcParticles, const soa::SmallGroups& collisions) { - histos.fill(HIST("hMC1"), 1); histos.fill(HIST("hMC"), 0.5); if (std::abs(mcCollision.posZ()) < cfgCutVertex) { histos.fill(HIST("hMC"), 1.5); @@ -518,22 +361,19 @@ struct phianalysisrun3_PbPb { if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > cfgCutVertex) { continue; } - if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - continue; - } multiplicity = collision.centFT0C(); histos.fill(HIST("Centgen"), multiplicity); SelectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); } SelectedEvents.resize(nevts); const auto evtReconstructedAndSelected = std::find(SelectedEvents.begin(), SelectedEvents.end(), mcCollision.globalIndex()) != SelectedEvents.end(); - histos.fill(HIST("hMC"), 3.5); + if (!evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection return; } - histos.fill(HIST("hMC"), 4.5); + histos.fill(HIST("hMC"), 3.5); for (auto& mcParticle : mcParticles) { - if (std::abs(mcParticle.y()) > confRapidity) { + if (std::abs(mcParticle.y()) > 0.5) { continue; } if (mcParticle.pdgCode() != 333) { @@ -550,21 +390,9 @@ struct phianalysisrun3_PbPb { continue; } if (kCurrentDaughter.pdgCode() == +321) { - - if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { - daughtp = true; - } - if (!genacceptancecut) { - daughtp = true; - } + daughtp = true; } else if (kCurrentDaughter.pdgCode() == -321) { - - if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { - daughtm = true; - } - if (!genacceptancecut) { - daughtm = true; - } + daughtm = true; } } if (daughtp && daughtm) { @@ -575,22 +403,17 @@ struct phianalysisrun3_PbPb { } PROCESS_SWITCH(phianalysisrun3_PbPb, processGen, "Process Generated", false); - void processRec(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const& /*mcParticles*/, aod::McCollisions const& /*mcCollisions*/) + void processRec(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, aod::McCollisions const&) { - histos.fill(HIST("hMC2"), 1); if (!collision.has_mcCollision()) { return; } if (std::abs(collision.mcCollision().posZ()) > cfgCutVertex || !collision.sel8()) { return; } - if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - return; - } auto multiplicity = collision.centFT0C(); histos.fill(HIST("Centrec"), multiplicity); - histos.fill(HIST("hMC"), 5.5); - auto oldindex = -999; + histos.fill(HIST("hMC"), 4.5); for (auto track1 : tracks) { if (!selectionTrack(track1)) { continue; @@ -598,7 +421,7 @@ struct phianalysisrun3_PbPb { if (!track1.has_mcParticle()) { continue; } - auto track1ID = track1.index(); + auto track1ID = track1.globalIndex(); for (auto track2 : tracks) { if (!track2.has_mcParticle()) { continue; @@ -606,7 +429,7 @@ struct phianalysisrun3_PbPb { if (!selectionTrack(track2)) { continue; } - auto track2ID = track2.index(); + auto track2ID = track2.globalIndex(); if (track2ID <= track1ID) { continue; } @@ -634,43 +457,31 @@ struct phianalysisrun3_PbPb { if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { continue; } - if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { - continue; - } - if (!mothertrack1.producedByGenerator()) { + if (mothertrack1 != mothertrack2) { continue; } - if (std::abs(mothertrack1.y()) >= confRapidity) { + if (std::abs(mothertrack1.y()) > 0.5) { continue; } if (std::abs(mothertrack1.pdgCode()) != 333) { continue; } - if (!isITSOnlycut && !ispTdepPID && !(selectionPID(track1) && selectionPID(track2))) { - continue; - } - if (!isITSOnlycut && ispTdepPID && !(selectionPIDpTdependent(track1) && selectionPIDpTdependent(track2))) { - continue; - } - if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { - histos.fill(HIST("h1PhiRecsplit"), mothertrack1.pt()); - histos.fill(HIST("h2PhiRecsplit"), mothertrack1.pt(), multiplicity); - continue; + if (!isITSOnlycut) { + if (!selectionPID(track1) || !selectionPID(track2)) { + continue; + } } - oldindex = mothertrack1.globalIndex(); pvec0 = array{track1.px(), track1.py(), track1.pz()}; pvec1 = array{track2.px(), track2.py(), track2.pz()}; auto arrMomrec = array{pvec0, pvec1}; + auto motherP = mothertrack1.p(); auto motherE = mothertrack1.e(); genMass = std::sqrt(motherE * motherE - motherP * motherP); + recMass = RecoDecay::m(arrMomrec, array{massKa, massKa}); - auto recpt = TMath::Sqrt((track1.px() + track2.px()) * (track1.px() + track2.px()) + (track1.py() + track2.py()) * (track1.py() + track2.py())); histos.fill(HIST("h1PhiRec1"), mothertrack1.pt()); histos.fill(HIST("h2PhiRec1"), mothertrack1.pt(), multiplicity); - histos.fill(HIST("h1Phimassgen"), genMass); - histos.fill(HIST("h1Phimassrec"), recMass); - histos.fill(HIST("h1Phipt"), recpt); } } } @@ -678,348 +489,6 @@ struct phianalysisrun3_PbPb { } PROCESS_SWITCH(phianalysisrun3_PbPb, processRec, "Process Reconstructed", false); - PROCESS_SWITCH(phianalysisrun3_PbPb, processMixedEvent, "Process Mixed event", false); - void processGen1(aod::McCollision const& mcCollision, aod::McParticles& mcParticles, const soa::SmallGroups& collisions) - { - histos.fill(HIST("hMC3"), 1); - auto multiplicity = 0; - for (const auto& collision : collisions) { - if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > cfgCutVertex) { - continue; - } - if (timFrameEvsel && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - continue; - } - - if (piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - continue; - } - if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - continue; - } - if (itstpctracks && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - continue; - } - multiplicity = collision.centFT0C(); - histos.fill(HIST("Centgen"), multiplicity); - } - for (auto& mcParticle : mcParticles) { - if (std::abs(mcParticle.y()) > confRapidity) { - continue; - } - if (mcParticle.pdgCode() != 333) { - continue; - } - auto kDaughters = mcParticle.daughters_as(); - if (kDaughters.size() != 2) { - continue; - } - auto daughtp = false; - auto daughtm = false; - for (auto kCurrentDaughter : kDaughters) { - if (!kCurrentDaughter.isPhysicalPrimary()) { - continue; - } - if (kCurrentDaughter.pdgCode() == +321) { - - if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { - daughtp = true; - } - if (!genacceptancecut) { - daughtp = true; - } - } else if (kCurrentDaughter.pdgCode() == -321) { - - if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { - daughtm = true; - } - if (!genacceptancecut) { - daughtm = true; - } - } - } - if (daughtp && daughtm) { - histos.fill(HIST("h1PhiGen2"), mcParticle.pt()); - histos.fill(HIST("h2PhiGen2"), mcParticle.pt(), multiplicity); - } - } - } - - PROCESS_SWITCH(phianalysisrun3_PbPb, processGen1, "Process Generated", false); - void processRec1(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const& mcParticles, aod::McCollisions const& mcCollisions) - { - histos.fill(HIST("hMC4"), 1); - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; - if (!collision.has_mcCollision()) { - return; - } - if (std::abs(collision.mcCollision().posZ()) > cfgCutVertex || !collision.sel8()) { - return; - } - if (timFrameEvsel && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - return; - } - - if (piluprejection && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return; - } - if (goodzvertex && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - return; - } - if (itstpctracks && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - return; - } - auto multiplicity = collision.centFT0C(); - histos.fill(HIST("Centrec"), multiplicity); - for (auto track1 : tracks) { - if (!selectionTrack(track1)) { - continue; - } - if (!track1.has_mcParticle()) { - continue; - } - auto track1ID = track1.index(); - for (auto track2 : tracks) { - if (!track2.has_mcParticle()) { - continue; - } - if (!selectionTrack(track2)) { - continue; - } - auto track2ID = track2.index(); - if (track2ID <= track1ID) { - continue; - } - if (!selectionPair(track1, track2)) { - continue; - } - if (track1.sign() * track2.sign() > 0) { - continue; - } - const auto mctrack1 = track1.mcParticle(); - const auto mctrack2 = track2.mcParticle(); - int track1PDG = std::abs(mctrack1.pdgCode()); - int track2PDG = std::abs(mctrack2.pdgCode()); - if (!mctrack1.isPhysicalPrimary()) { - continue; - } - if (!mctrack2.isPhysicalPrimary()) { - continue; - } - if (!(track1PDG == 321 && track2PDG == 321)) { - continue; - } - if (!isITSOnlycut && !ispTdepPID && !(selectionPID(track1) && selectionPID(track2))) { - continue; - } - if (!isITSOnlycut && ispTdepPID && !(selectionPIDpTdependent(track1) && selectionPIDpTdependent(track2))) { - continue; - } - for (auto& mothertrack1 : mctrack1.mothers_as()) { - for (auto& mothertrack2 : mctrack2.mothers_as()) { - if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { - continue; - } - if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) { - continue; - } - if (!mothertrack1.producedByGenerator()) { - continue; - } - if (std::abs(mothertrack1.y()) >= confRapidity) { - continue; - } - if (std::abs(mothertrack1.pdgCode()) != 333) { - continue; - } - - pvec0 = array{track1.px(), track1.py(), track1.pz()}; - pvec1 = array{track2.px(), track2.py(), track2.pz()}; - auto arrMomrec = array{pvec0, pvec1}; - auto motherP = mothertrack1.p(); - auto motherE = mothertrack1.e(); - genMass = std::sqrt(motherE * motherE - motherP * motherP); - recMass = RecoDecay::m(arrMomrec, array{massKa, massKa}); - lDecayDaughter1.SetXYZM(track1.px(), track1.py(), track1.pz(), massKa); - lDecayDaughter2.SetXYZM(track2.px(), track2.py(), track2.pz(), massKa); - lResonance = lDecayDaughter1 + lDecayDaughter2; - histos.fill(HIST("h1PhiRec2"), lResonance.Pt()); - histos.fill(HIST("h2PhiRec2"), lResonance.Pt(), multiplicity); - } - } - } - } - } - - PROCESS_SWITCH(phianalysisrun3_PbPb, processRec1, "Process Reconstructed", false); - void processMC(CollisionMCTrueTable::iterator const& TrueCollision, CollisionMCRecTableCentFT0C const& RecCollisions, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) - { - histos.fill(HIST("hMC"), 0); - if (RecCollisions.size() == 0) { - histos.fill(HIST("hMC"), 1); - return; - } - if (RecCollisions.size() > 1) { - histos.fill(HIST("hMC"), 2); - return; - } - for (auto& RecCollision : RecCollisions) { - - histos.fill(HIST("hMC"), 3); - if (!RecCollision.sel8()) { - histos.fill(HIST("hMC"), 4); - continue; - } - if (timFrameEvsel && (!RecCollision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { - histos.fill(HIST("hMC"), 5); - continue; - } - if (std::abs(RecCollision.posZ()) > cfgCutVertex) { - histos.fill(HIST("hMC"), 6); - continue; - } - histos.fill(HIST("hMC"), 7); - auto centrality = RecCollision.centFT0C(); - histos.fill(HIST("CentPercentileMCRecHist"), centrality); - auto oldindex = -999; - auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); - // loop over reconstructed particle - for (auto track1 : Rectrackspart) { - if (!selectionTrack(track1)) { - continue; - } - if (ispTdepPID && !selectionPIDpTdependent(track1)) { - continue; - } - if (!ispTdepPID && !selectionPID(track1)) { - continue; - } - if (!track1.has_mcParticle()) { - continue; - } - auto track1ID = track1.index(); - for (auto track2 : Rectrackspart) { - auto track2ID = track2.index(); - if (track2ID <= track1ID) { - continue; - } - if (!selectionTrack(track2)) { - continue; - } - if (ispTdepPID && !selectionPIDpTdependent(track2)) { - continue; - } - if (!ispTdepPID && !selectionPID(track2)) { - continue; - } - if (!track2.has_mcParticle()) { - continue; - } - if (!selectionPair(track1, track2)) { - continue; - } - if (track1.sign() * track2.sign() > 0) { - continue; - } - const auto mctrack1 = track1.mcParticle(); - const auto mctrack2 = track2.mcParticle(); - int track1PDG = std::abs(mctrack1.pdgCode()); - int track2PDG = std::abs(mctrack2.pdgCode()); - if (!mctrack1.isPhysicalPrimary()) { - continue; - } - if (!mctrack2.isPhysicalPrimary()) { - continue; - } - if (!(track1PDG == 321 && track2PDG == 321)) { - continue; - } - for (auto& mothertrack1 : mctrack1.mothers_as()) { - for (auto& mothertrack2 : mctrack2.mothers_as()) { - if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) { - continue; - } - if (mothertrack1 != mothertrack2) { - continue; - } - if (std::abs(mothertrack1.y()) > confRapidity) { - continue; - } - if (std::abs(mothertrack1.pdgCode()) != 333) { - continue; - } - if (!selectionPID(track1) || !selectionPID(track2)) { - continue; - } - if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { - histos.fill(HIST("h1PhiRecsplit"), mothertrack1.pt()); - continue; - } - oldindex = mothertrack1.globalIndex(); - if (track1.sign() > 0 && track2.sign() < 0) { - KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); - KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); - } - if (track1.sign() < 0 && track2.sign() > 0) { - KaonMinus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); - KaonPlus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); - } - PhiMesonMother = KaonPlus + KaonMinus; - - if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) { - continue; - } - histos.fill(HIST("h1PhiRec3"), PhiMesonMother.Pt()); - histos.fill(HIST("h2PhiRec3"), PhiMesonMother.Pt(), centrality); - } - } - } - } - // loop over generated particle - for (auto& mcParticle : GenParticles) { - if (std::abs(mcParticle.y()) > confRapidity) { - continue; - } - if (mcParticle.pdgCode() != 333) { - continue; - } - auto kDaughters = mcParticle.daughters_as(); - if (kDaughters.size() != 2) { - continue; - } - auto daughtp = false; - auto daughtm = false; - for (auto kCurrentDaughter : kDaughters) { - if (!kCurrentDaughter.isPhysicalPrimary()) { - continue; - } - if (kCurrentDaughter.pdgCode() == +321) { - if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { - daughtp = true; - } - if (!genacceptancecut) { - daughtp = true; - } - KaonPlus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); - } else if (kCurrentDaughter.pdgCode() == -321) { - if (genacceptancecut && kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) { - daughtm = true; - } - if (!genacceptancecut) { - daughtm = true; - } - KaonMinus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa); - } - } - if (daughtp && daughtm) { - PhiMesonMother = KaonPlus + KaonMinus; - histos.fill(HIST("h1PhiGen3"), PhiMesonMother.pt()); - histos.fill(HIST("h2PhiGen3"), PhiMesonMother.pt(), centrality); - } - } - } // rec collision loop - } // process MC - PROCESS_SWITCH(phianalysisrun3_PbPb, processMC, "Process MC", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGLF/Tasks/Strangeness/vzero_cascade_absorption.cxx b/PWGLF/Tasks/Strangeness/vzero_cascade_absorption.cxx index f7efe3231ec..8080130f637 100644 --- a/PWGLF/Tasks/Strangeness/vzero_cascade_absorption.cxx +++ b/PWGLF/Tasks/Strangeness/vzero_cascade_absorption.cxx @@ -39,6 +39,7 @@ using namespace o2::framework::expressions; using std::array; using SelectedCollisions = soa::Join; +using SimCollisions = soa::Join; using FullTracks = soa::Join; @@ -112,7 +113,8 @@ struct vzero_cascade_absorption { void init(InitContext const&) { // Histograms - registryQC.add("event_counter", "event counter", HistType::kTH1F, {{4, 0, 4, "number of events in data (first 2 bins) and mc (last 2 bins)"}}); + registryQC.add("event_counter_data", "event counter data", HistType::kTH1F, {{5, 0, 5, "number of events"}}); + registryQC.add("event_counter_mc", "event counter mc", HistType::kTH1F, {{5, 0, 5, "number of events"}}); // K0 short registryData.add("K0_before_target_data", "K0 before target data", HistType::kTH2F, {{200, 0.0, 10.0, "p (GeV/c)"}, {240, 0.44, 0.56, "m (GeV/c^{2})"}}); @@ -157,7 +159,6 @@ struct vzero_cascade_absorption { bool hasHitOnITSlayer(uint8_t itsClsmap, int layer) { - unsigned char test_bit = 1 << layer; return (itsClsmap & test_bit); } @@ -337,16 +338,22 @@ struct vzero_cascade_absorption { // Process Data void processData(SelectedCollisions::iterator const& collision, aod::V0Datas const& fullV0s, FullTracks const&) { - // Event Counter (before event sel) - registryQC.fill(HIST("event_counter"), 0.5); + registryQC.fill(HIST("event_counter_data"), 0.5); // Event Selection if (!collision.sel8()) return; // Event Counter (after event sel) - registryQC.fill(HIST("event_counter"), 1.5); + registryQC.fill(HIST("event_counter_data"), 1.5); + + // Cut on Zvertex + if (abs(collision.posZ()) > 10.0) + return; + + // Event Counter (after cut on z_vtx) + registryQC.fill(HIST("event_counter_data"), 2.5); auto hit_ITS_before_target = static_cast>(hit_requirement_before_target); auto hit_ITS_after_target = static_cast>(hit_requirement_after_target); @@ -417,172 +424,193 @@ struct vzero_cascade_absorption { if (v0.v0radius() > Rmin_afterAbs && v0.v0radius() < Rmax_afterAbs) registryData.fill(HIST("AntiLambda_after_target_data"), v0.p(), v0.mAntiLambda()); } - } // end loop on V0s } // end processData PROCESS_SWITCH(vzero_cascade_absorption, processData, "Process data", true); - // Process MC - void processMC(soa::Join::iterator const& collision, aod::V0Datas const& fullV0s, MCTracks const&, aod::McParticles&, aod::McCollisions const&) + Preslice perCollision = o2::aod::v0data::collisionId; + Preslice perMCCollision = o2::aod::mcparticle::mcCollisionId; + + // Process MC Rec + void processMCrec(SimCollisions const& collisions, MCTracks const&, aod::V0Datas const& fullV0s, aod::McCollisions const&, const aod::McParticles&) { - // Event Counter (before event sel) - registryQC.fill(HIST("event_counter"), 2.5); + for (const auto& collision : collisions) { - // Event Selection - if (!collision.sel8()) - return; - - // Event Counter (after event sel) - registryQC.fill(HIST("event_counter"), 3.5); + // Event Counter (before event sel) + registryQC.fill(HIST("event_counter_mc"), 0.5); - // Loop over Reconstructed V0s - for (auto& v0 : fullV0s) { + // Event Selection + if (!collision.sel8()) + continue; - // Positive and Negative Tracks - const auto& posTrack = v0.posTrack_as(); - const auto& negTrack = v0.negTrack_as(); + // Event Counter (after event sel) + registryQC.fill(HIST("event_counter_mc"), 1.5); - // Require TPC Refit - if (!posTrack.passedTPCRefit()) + // Cut on Zvertex + if (abs(collision.posZ()) > 10.0) continue; - if (!negTrack.passedTPCRefit()) - continue; - - auto hit_ITS_before_target = static_cast>(hit_requirement_before_target); - auto hit_ITS_after_target = static_cast>(hit_requirement_after_target); - // ITS Requirement - bool satisfyITSreq = true; - if (requirehitsITS) { - for (int i = 0; i < 7; i++) { - if (hit_ITS_before_target[i] > 0 && !hasHitOnITSlayer(posTrack.itsClusterMap(), i)) { - satisfyITSreq = false; - break; - } - if (hit_ITS_after_target[i] > 0 && !hasHitOnITSlayer(negTrack.itsClusterMap(), i)) { - satisfyITSreq = false; - break; + // Event Counter (after cut on z_vtx) + registryQC.fill(HIST("event_counter_mc"), 2.5); + + auto v0s_per_coll = fullV0s.sliceBy(perCollision, collision.globalIndex()); + + // Loop over Reconstructed V0s + for (auto& v0 : v0s_per_coll) { + + // Positive and Negative Tracks + const auto& posTrack = v0.posTrack_as(); + const auto& negTrack = v0.negTrack_as(); + + // Require TPC Refit + if (!posTrack.passedTPCRefit()) + continue; + if (!negTrack.passedTPCRefit()) + continue; + + auto hit_ITS_before_target = static_cast>(hit_requirement_before_target); + auto hit_ITS_after_target = static_cast>(hit_requirement_after_target); + + // ITS Requirement + bool satisfyITSreq = true; + if (requirehitsITS) { + for (int i = 0; i < 7; i++) { + if (hit_ITS_before_target[i] > 0 && !hasHitOnITSlayer(posTrack.itsClusterMap(), i)) { + satisfyITSreq = false; + break; + } + if (hit_ITS_after_target[i] > 0 && !hasHitOnITSlayer(negTrack.itsClusterMap(), i)) { + satisfyITSreq = false; + break; + } } } - } - if (requirehitsITS && (!satisfyITSreq)) - continue; + if (requirehitsITS && (!satisfyITSreq)) + continue; - // MC Particles - if (!posTrack.has_mcParticle()) - continue; - if (!negTrack.has_mcParticle()) - continue; + // MC Particles + if (!posTrack.has_mcParticle()) + continue; + if (!negTrack.has_mcParticle()) + continue; - auto posParticle = posTrack.mcParticle_as(); - auto negParticle = negTrack.mcParticle_as(); - if (!posParticle.has_mothers() || !negParticle.has_mothers()) { - continue; - } + auto posParticle = posTrack.mcParticle_as(); + auto negParticle = negTrack.mcParticle_as(); + if (!posParticle.has_mothers() || !negParticle.has_mothers()) { + continue; + } - bool isK0s = false; - bool isLambda = false; - bool isAntiLambda = false; + bool isK0s = false; + bool isLambda = false; + bool isAntiLambda = false; - for (auto& particleMotherOfNeg : negParticle.mothers_as()) { - for (auto& particleMotherOfPos : posParticle.mothers_as()) { - if (particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == 310) - isK0s = true; + for (auto& particleMotherOfNeg : negParticle.mothers_as()) { + for (auto& particleMotherOfPos : posParticle.mothers_as()) { + if (particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == 310) + isK0s = true; - if (particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == +3122) - isLambda = true; - if (particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == -3122) - isAntiLambda = true; + if (particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == +3122) + isLambda = true; + if (particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == -3122) + isAntiLambda = true; + } } - } - // Resolution in radial position - float Rgen = TMath::Sqrt(posParticle.vx() * posParticle.vx() + posParticle.vy() * posParticle.vy()); - float Rrec = v0.v0radius(); - float deltaR = Rgen - Rrec; + // Resolution in radial position + float Rgen = TMath::Sqrt(posParticle.vx() * posParticle.vx() + posParticle.vy() * posParticle.vy()); + float Rrec = v0.v0radius(); + float deltaR = Rgen - Rrec; - // K0 Short - if (passedK0Selection(v0, negTrack, posTrack, collision) && isK0s) { + // K0 Short + if (passedK0Selection(v0, negTrack, posTrack, collision) && isK0s) { - // Before Target - if (v0.v0radius() > Rmin_beforeAbs && v0.v0radius() < Rmax_beforeAbs) { - registryMC.fill(HIST("K0_before_target_mc"), v0.p(), v0.mK0Short()); - registryMC.fill(HIST("K0_Rresolution_before_target"), v0.p(), deltaR); - } + // Before Target + if (v0.v0radius() > Rmin_beforeAbs && v0.v0radius() < Rmax_beforeAbs) { + registryMC.fill(HIST("K0_before_target_mc"), v0.p(), v0.mK0Short()); + registryMC.fill(HIST("K0_Rresolution_before_target"), v0.p(), deltaR); + } - // After Target - if (v0.v0radius() > Rmin_afterAbs && v0.v0radius() < Rmax_afterAbs) { - registryMC.fill(HIST("K0_after_target_mc"), v0.p(), v0.mK0Short()); - registryMC.fill(HIST("K0_Rresolution_after_target"), v0.p(), deltaR); + // After Target + if (v0.v0radius() > Rmin_afterAbs && v0.v0radius() < Rmax_afterAbs) { + registryMC.fill(HIST("K0_after_target_mc"), v0.p(), v0.mK0Short()); + registryMC.fill(HIST("K0_Rresolution_after_target"), v0.p(), deltaR); + } } - } - // Lambda - if (passedLambdaSelection(v0, negTrack, posTrack, collision) && isLambda) { + // Lambda + if (passedLambdaSelection(v0, negTrack, posTrack, collision) && isLambda) { - // Before Target - if (v0.v0radius() > Rmin_beforeAbs && v0.v0radius() < Rmax_beforeAbs) { - registryMC.fill(HIST("Lambda_before_target_mc"), v0.p(), v0.mLambda()); - registryMC.fill(HIST("Lambda_Rresolution_before_target"), v0.p(), deltaR); - } + // Before Target + if (v0.v0radius() > Rmin_beforeAbs && v0.v0radius() < Rmax_beforeAbs) { + registryMC.fill(HIST("Lambda_before_target_mc"), v0.p(), v0.mLambda()); + registryMC.fill(HIST("Lambda_Rresolution_before_target"), v0.p(), deltaR); + } - // After Target - if (v0.v0radius() > Rmin_afterAbs && v0.v0radius() < Rmax_afterAbs) { - registryMC.fill(HIST("Lambda_after_target_mc"), v0.p(), v0.mLambda()); - registryMC.fill(HIST("Lambda_Rresolution_after_target"), v0.p(), deltaR); + // After Target + if (v0.v0radius() > Rmin_afterAbs && v0.v0radius() < Rmax_afterAbs) { + registryMC.fill(HIST("Lambda_after_target_mc"), v0.p(), v0.mLambda()); + registryMC.fill(HIST("Lambda_Rresolution_after_target"), v0.p(), deltaR); + } } - } - // AntiLambda - if (passedAntiLambdaSelection(v0, negTrack, posTrack, collision) && isAntiLambda) { + // AntiLambda + if (passedAntiLambdaSelection(v0, negTrack, posTrack, collision) && isAntiLambda) { - // Before Target - if (v0.v0radius() > Rmin_beforeAbs && v0.v0radius() < Rmax_beforeAbs) { - registryMC.fill(HIST("AntiLambda_before_target_mc"), v0.p(), v0.mAntiLambda()); - registryMC.fill(HIST("AntiLambda_Rresolution_before_target"), v0.p(), deltaR); - } + // Before Target + if (v0.v0radius() > Rmin_beforeAbs && v0.v0radius() < Rmax_beforeAbs) { + registryMC.fill(HIST("AntiLambda_before_target_mc"), v0.p(), v0.mAntiLambda()); + registryMC.fill(HIST("AntiLambda_Rresolution_before_target"), v0.p(), deltaR); + } - // After Target - if (v0.v0radius() > Rmin_afterAbs && v0.v0radius() < Rmax_afterAbs) { - registryMC.fill(HIST("AntiLambda_after_target_mc"), v0.p(), v0.mAntiLambda()); - registryMC.fill(HIST("AntiLambda_Rresolution_after_target"), v0.p(), deltaR); + // After Target + if (v0.v0radius() > Rmin_afterAbs && v0.v0radius() < Rmax_afterAbs) { + registryMC.fill(HIST("AntiLambda_after_target_mc"), v0.p(), v0.mAntiLambda()); + registryMC.fill(HIST("AntiLambda_Rresolution_after_target"), v0.p(), deltaR); + } } - } - } // end loop on V0s - } // end processMC - PROCESS_SWITCH(vzero_cascade_absorption, processMC, "Process mc", false); + } // end loop on V0s + } + } // end processMC - void processMCgen(aod::McCollision const&, aod::McParticles& mcParticles) + void processMCgen(o2::aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - for (auto& mcParticle : mcParticles) { - if (mcParticle.eta() < etaMin || mcParticle.eta() > etaMax) - continue; + for (const auto& mccollision : mcCollisions) { - float R = TMath::Sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy()); - float p = mcParticle.p(); + auto mcParticles_per_coll = mcParticles.sliceBy(perMCCollision, mccollision.globalIndex()); - // Lambda - if (mcParticle.pdgCode() == +3122) { - if (R > Rmin_beforeAbs && R < Rmax_beforeAbs) - registryMC.fill(HIST("Lambda_before_target_mc_gen"), p); - if (R > Rmin_afterAbs && R < Rmax_afterAbs) - registryMC.fill(HIST("Lambda_after_target_mc_gen"), p); - } + for (auto& mcParticle : mcParticles_per_coll) { - // AntiLambda - if (mcParticle.pdgCode() == -3122) { - if (R > Rmin_beforeAbs && R < Rmax_beforeAbs) - registryMC.fill(HIST("AntiLambda_before_target_mc_gen"), p); - if (R > Rmin_afterAbs && R < Rmax_afterAbs) - registryMC.fill(HIST("AntiLambda_after_target_mc_gen"), p); + if (mcParticle.eta() < etaMin || mcParticle.eta() > etaMax) + continue; + + float R = TMath::Sqrt(mcParticle.vx() * mcParticle.vx() + mcParticle.vy() * mcParticle.vy()); + float p = mcParticle.p(); + + // Lambda + if (mcParticle.pdgCode() == +3122) { + if (R > Rmin_beforeAbs && R < Rmax_beforeAbs) + registryMC.fill(HIST("Lambda_before_target_mc_gen"), p); + if (R > Rmin_afterAbs && R < Rmax_afterAbs) + registryMC.fill(HIST("Lambda_after_target_mc_gen"), p); + } + + // AntiLambda + if (mcParticle.pdgCode() == -3122) { + if (R > Rmin_beforeAbs && R < Rmax_beforeAbs) + registryMC.fill(HIST("AntiLambda_before_target_mc_gen"), p); + if (R > Rmin_afterAbs && R < Rmax_afterAbs) + registryMC.fill(HIST("AntiLambda_after_target_mc_gen"), p); + } } } } - PROCESS_SWITCH(vzero_cascade_absorption, processMCgen, "Process generated MC", false); + + PROCESS_SWITCH(vzero_cascade_absorption, processMCrec, "Process MC rec", false); + PROCESS_SWITCH(vzero_cascade_absorption, processMCgen, "Process MC gen", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGMM/Mult/TableProducer/reducer.cxx b/PWGMM/Mult/TableProducer/reducer.cxx index d6d371ceb64..5eda9070ca8 100644 --- a/PWGMM/Mult/TableProducer/reducer.cxx +++ b/PWGMM/Mult/TableProducer/reducer.cxx @@ -231,15 +231,16 @@ struct Reducer { }; struct ReducerTest { - HistogramRegistry r{ - "Common", - { - {"ReconstructedMultiplicity", " ; N_{trk}", {HistType::kTH1F, {{301, -0.5, 300.5}}}}, // - {"GeneratedMultiplicity", " ; N_{particles}", {HistType::kTH1F, {{301, -0.5, 300.5}}}}, // - {"ReconstructedMultiplicityUnweighted", " ; N_{trk}", {HistType::kTH1F, {{301, -0.5, 300.5}}}}, // - {"GeneratedMultiplicityUnweighted", " ; N_{particles}", {HistType::kTH1F, {{301, -0.5, 300.5}}}} // - } // - }; + Configurable maxMult{"maxMult", 300, "Max multiplicity bin"}; + HistogramRegistry r{"Common", {}}; + + void init(InitContext const&) + { + r.add({"ReconstructedMultiplicity", " ; N_{trk}", {HistType::kTH1F, {{maxMult + 1, -0.5, maxMult + 0.5}}}}); + r.add({"GeneratedMultiplicity", " ; N_{particles}", {HistType::kTH1F, {{maxMult + 1, -0.5, maxMult + 0.5}}}}); + r.add({"ReconstructedMultiplicityUnweighted", " ; N_{trk}", {HistType::kTH1F, {{maxMult + 1, -0.5, maxMult + 0.5}}}}); + r.add({"GeneratedMultiplicityUnweighted", " ; N_{particles}", {HistType::kTH1F, {{maxMult + 1, -0.5, maxMult + 0.5}}}}); + } void process(aod::StoredRMCCollisions const& mccollisions, soa::Join const& collisions) { diff --git a/PWGMM/Mult/TableProducer/trackPropagation.cxx b/PWGMM/Mult/TableProducer/trackPropagation.cxx index 678759a211f..314bc59a2b2 100644 --- a/PWGMM/Mult/TableProducer/trackPropagation.cxx +++ b/PWGMM/Mult/TableProducer/trackPropagation.cxx @@ -129,10 +129,13 @@ struct AmbiguousTrackPropagation { using ExTracksSel = soa::Join; void processCentral(ExTracksSel const& tracks, - aod::Collisions const& collisions, - ExtBCs const&) + aod::Collisions const&, + ExtBCs const& bcs) { - auto bc = collisions.begin().bc_as(); + if (bcs.size() == 0) { + return; + } + auto bc = bcs.begin(); initCCDB(bc); gpu::gpustd::array dcaInfo; diff --git a/PWGUD/Core/SGSelector.h b/PWGUD/Core/SGSelector.h index 8eb8cf01b5b..3b1d9c0d182 100644 --- a/PWGUD/Core/SGSelector.h +++ b/PWGUD/Core/SGSelector.h @@ -32,7 +32,7 @@ class SGSelector SGSelector() : fPDG(TDatabasePDG::Instance()) {} template - int Print(SGCutParHolder /*diffCuts*/, CC& collision, BCs& /*bcRange*/, TCs& /*tracks*/, FWs& /*fwdtracks*/) + int Print(SGCutParHolder diffCuts, CC& collision, BCs& bcRange, TCs& tracks, FWs& fwdtracks) { LOGF(info, "Size of array %i", collision.size()); return 1; @@ -50,10 +50,13 @@ class SGSelector return result; } auto newbc = oldbc; - auto newznabc = oldbc; - auto newzncbc = oldbc; + auto newdgabc = oldbc; + auto newdgcbc = oldbc; + float tempampa = 0; + float tempampc = 0; + float ampc = 0; + float ampa = 0; bool gA = true, gC = true; - bool gzA = true, gzC = true; for (auto const& bc : bcRange) { if (!udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) { if (gA) @@ -74,77 +77,28 @@ class SGSelector result.value = 3; return result; } - for (auto const& bc : bcRange) { - if (bc.has_zdc()) { - auto zdc = bc.zdc(); - if (std::abs(static_cast(zdc.timeZNA())) < 2 && zdc.energyCommonZNA() > 0) { - if (gzA) { - newznabc = bc; - } - if (!gzA && std::abs(static_cast(bc.globalBC() - oldbc.globalBC())) < std::abs(static_cast(newznabc.globalBC() - oldbc.globalBC()))) { - newznabc = bc; - } - gzA = false; - } - if (std::abs(static_cast(zdc.timeZNC())) < 2 && zdc.energyCommonZNC() > 0) { - if (gzC) { - newzncbc = bc; + if (gA && gC) { // loop once again for so-called DG events to get the most active FT0 BC + for (auto const& bc : bcRange) { + if (bc.has_foundFT0()) { + tempampa = udhelpers::FT0AmplitudeA(bc.foundFT0()); + tempampc = udhelpers::FT0AmplitudeC(bc.foundFT0()); + if (tempampa > ampa) { + ampa = tempampa; + newdgabc = bc; } - if (!gzC && std::abs(static_cast(bc.globalBC() - oldbc.globalBC())) < std::abs(static_cast(newzncbc.globalBC() - oldbc.globalBC()))) { - newzncbc = bc; + if (tempampc > ampc) { + ampc = tempampc; + newdgcbc = bc; } - gzC = false; - } - } - } - if (gA && gC) { - if (!gzA && !gzC) { - if (std::abs(static_cast(newznabc.globalBC() - oldbc.globalBC())) < std::abs(static_cast(newzncbc.globalBC() - oldbc.globalBC()))) { - newzncbc = newznabc; - newbc = newznabc; - } else { - newznabc = newzncbc; - newbc = newzncbc; - } - } else if (!gzA) { - newzncbc = newznabc; - newbc = newznabc; - } else if (!gzC) { - newznabc = newzncbc; - newbc = newzncbc; - } - } else if (!gA) { - if (!gzA) { - if (newbc.globalBC() == newznabc.globalBC()) { - newzncbc = newznabc; - } else if (std::abs(static_cast(newznabc.globalBC() - oldbc.globalBC())) < std::abs(static_cast(newbc.globalBC() - oldbc.globalBC()))) { - newzncbc = newznabc; - newbc = newznabc; - } else { - newzncbc = newbc; - newznabc = newbc; } - } else { - newzncbc = newbc; - newznabc = newbc; } - } else if (!gC) { - if (!gzC) { - if (newbc.globalBC() == newzncbc.globalBC()) { - newznabc = newzncbc; - } else if (std::abs(static_cast(newzncbc.globalBC() - oldbc.globalBC())) < std::abs(static_cast(newbc.globalBC() - oldbc.globalBC()))) { - newznabc = newzncbc; - newbc = newzncbc; - } else { - newzncbc = newbc; - newznabc = newbc; - } - - } else { - newzncbc = newbc; - newznabc = newbc; + if (newdgabc != newdgcbc) { + if (ampc / diffCuts.FITAmpLimits()[2] > ampa / diffCuts.FITAmpLimits()[2]) + newdgabc = newdgcbc; } + newbc = newdgabc; } + result.bc = &newbc; // LOGF(info, "Old BC: %i, New BC: %i",oldbc.globalBC(), newbc.globalBC()); result.bc = &newbc; result.value = gA && gC ? 2 : (gA ? 0 : 1); @@ -160,22 +114,23 @@ class SGSelector } template - int trueGap(CC& collision, float fv0_cut, float zdc_cut) + int trueGap(CC& collision, float fv0, float ft0a, float ft0c, float zdc_cut) { + float fit_cut[3] = {fv0, ft0a, ft0c}; int gap = collision.gapSide(); int true_gap = gap; if (gap == 0) { - if (collision.totalFV0AmplitudeA() > fv0_cut || collision.energyCommonZNA() > zdc_cut) + if (collision.totalFV0AmplitudeA() > fit_cut[0] || collision.totalFT0AmplitudeA() > fit_cut[1] || collision.energyCommonZNA() > zdc_cut) true_gap = -1; } else if (gap == 1) { - if (collision.energyCommonZNC() > zdc_cut) + if (collision.totalFT0AmplitudeC() > fit_cut[2] || collision.energyCommonZNC() > zdc_cut) true_gap = -1; } else if (gap == 2) { - if ((collision.totalFV0AmplitudeA() > fv0_cut || collision.energyCommonZNA() > zdc_cut) && (collision.energyCommonZNC() > zdc_cut)) + if ((collision.totalFV0AmplitudeA() > fit_cut[0] || collision.totalFT0AmplitudeA() > fit_cut[1] || collision.energyCommonZNA() > zdc_cut) && (collision.totalFT0AmplitudeC() > fit_cut[2] || collision.energyCommonZNC() > zdc_cut)) true_gap = -1; - else if (collision.totalFV0AmplitudeA() > fv0_cut || collision.energyCommonZNA() > zdc_cut) + else if (collision.totalFV0AmplitudeA() > fit_cut[0] || collision.totalFT0AmplitudeA() > fit_cut[1] || collision.energyCommonZNA() > zdc_cut) true_gap = 1; - else if (collision.energyCommonZNC() > zdc_cut) + else if (collision.totalFT0AmplitudeC() > fit_cut[2] || collision.energyCommonZNC() > zdc_cut) true_gap = 0; } return true_gap; diff --git a/PWGUD/DataModel/UDTables.h b/PWGUD/DataModel/UDTables.h index 4b9746ef220..8a21797d91c 100644 --- a/PWGUD/DataModel/UDTables.h +++ b/PWGUD/DataModel/UDTables.h @@ -394,6 +394,24 @@ DECLARE_SOA_TABLE(UDFwdTracksCovProp, "AOD", "UDFWDTRKCOVPROP", using UDFwdTrackProp = UDFwdTracksProp::iterator; using UDFwdTrackCovProp = UDFwdTracksCovProp::iterator; +namespace udfwdtrkcl +{ +DECLARE_SOA_INDEX_COLUMN(UDFwdTrack, udFwdTrack); //! +} + +DECLARE_SOA_TABLE(UDFwdTracksCls, "AOD", "UDFWDTRKCL", //! Forward Track Cluster information + o2::soa::Index<>, + udfwdtrkcl::UDFwdTrackId, + fwdtrkcl::X, + fwdtrkcl::Y, + fwdtrkcl::Z, + fwdtrkcl::ClInfo, + fwdtrkcl::DEId, + fwdtrkcl::IsGoodX, + fwdtrkcl::IsGoodY); + +using UDFwdTrackCls = UDFwdTracksCls::iterator; + namespace udmcfwdtracklabel { DECLARE_SOA_INDEX_COLUMN(UDMcParticle, udMcParticle); diff --git a/PWGUD/TableProducer/DGCandProducer.cxx b/PWGUD/TableProducer/DGCandProducer.cxx index de2cb03f21f..744505c3704 100644 --- a/PWGUD/TableProducer/DGCandProducer.cxx +++ b/PWGUD/TableProducer/DGCandProducer.cxx @@ -190,10 +190,14 @@ struct DGCandProducer { void init(InitContext&) { + LOGF(debug, " beginning of init reached"); + diffCuts = (DGCutparHolder)DGCuts; + const int nXbinsInStatH = 25; + // add histograms for the different process functions - registry.add("reco/Stat", "Cut statistics; Selection criterion; Collisions", {HistType::kTH1F, {{15, -0.5, 14.5}}}); + registry.add("reco/Stat", "Cut statistics;; Collisions", {HistType::kTH1F, {{nXbinsInStatH, -0.5, static_cast(nXbinsInStatH - 0.5)}}}); registry.add("reco/pt1Vspt2", "2 prong events, p_{T} versus p_{T}", {HistType::kTH2F, {{100, -3., 3.}, {100, -3., 3.0}}}); 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}}}); @@ -212,6 +216,17 @@ struct DGCandProducer { registry.add("reco/ft0C", "FT0C amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {13, -0.5, 12.5}}}); registry.add("reco/fddA", "FDDA amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {13, -0.5, 12.5}}}); registry.add("reco/fddC", "FDDC amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {13, -0.5, 12.5}}}); + + std::string labels[nXbinsInStatH] = {"all", "hasBC", "selected", "FITveto", "MID trk", "global PV trk", "not global PB trk", + "ITS-only PV trk", "TOF PV trk fraction", "n PV trks", "PID", "pt", "eta", "net charge", + "inv mass", "TF border", "no pile-up", "ITSROF", "z-vtx", "ITSTPC vtx", "", "", "", "", ""}; + + registry.get(HIST("reco/Stat"))->SetNdivisions(nXbinsInStatH, "X"); + for (int iXbin(1); iXbin < nXbinsInStatH + 1; iXbin++) { + registry.get(HIST("reco/Stat"))->GetXaxis()->ChangeLabel(iXbin, 45, 0.03, 33, -1, -1, labels[iXbin - 1]); + } + + LOGF(debug, " end of init reached"); } // process function for real data diff --git a/PWGUD/TableProducer/SGCandProducer.cxx b/PWGUD/TableProducer/SGCandProducer.cxx index 2cf1131b706..ae90f2f8892 100644 --- a/PWGUD/TableProducer/SGCandProducer.cxx +++ b/PWGUD/TableProducer/SGCandProducer.cxx @@ -10,6 +10,7 @@ // or submit itself to any jurisdiction. #include +#include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Common/CCDB/EventSelectionParams.h" #include "Common/DataModel/EventSelection.h" @@ -32,7 +33,11 @@ struct SGCandProducer { Configurable SGCuts{"SGCuts", {}, "SG event cuts"}; Configurable saveAllTracks{"saveAllTracks", true, "save only PV contributors or all tracks associated to a collision"}; Configurable savenonPVCITSOnlyTracks{"savenonPVCITSOnlyTracks", false, "save non PV contributors with ITS only information"}; - // Configurable rejectAtTFBoundary{"rejectAtTFBoundary", true, "reject collisions at a TF boundary"}; + Configurable rejectAtTFBoundary{"rejectAtTFBoundary", true, "reject collisions at a TF boundary"}; + Configurable noITSROFrameBorder{"noITSROFrameBorder", true, "reject ITS RO Frame Border"}; + Configurable noSameBunchPileUp{"noSameBunchPileUp", true, "reject SameBunchPileUp"}; + Configurable IsGoodVertex{"IsGoodVertex", false, "Select FT0 PV vertex matching"}; + Configurable ITSTPCVertex{"ITSTPCVertex", true, "reject ITS-only vertex"}; // if one wants to look at Single Gap pp events // SG selector SGSelector sgSelector; @@ -115,7 +120,7 @@ struct SGCandProducer { track.tofNSigmaKa(), track.tofNSigmaPr()); outputTracksExtra(track.tpcInnerParam(), - track.itsClusterMap(), + track.itsClusterSizes(), track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), @@ -144,14 +149,34 @@ struct SGCandProducer { // process function for real data void process(CC const& collision, BCs const& bcs, TCs& tracks, FWs& fwdtracks, - aod::Zdcs& /*zdcs*/, aod::FT0s& ft0s, aod::FV0As& fv0as, aod::FDDs& fdds) + aod::Zdcs& zdcs, aod::FT0s& ft0s, aod::FV0As& fv0as, aod::FDDs& fdds) { LOGF(debug, " collision %d", collision.globalIndex()); registry.get(HIST("reco/Stat"))->Fill(0., 1.); // reject collisions at TF boundaries - // if (rejectAtTFBoundary && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { - // return; - //} + if (rejectAtTFBoundary && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) { + return; + } + // reject collisions at ITS RO TF boundaries + if (noITSROFrameBorder && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + return; + } + // registry.get(HIST("reco/Stat"))->Fill(1., 1.); + // reject Same Bunch PileUp + if (noSameBunchPileUp && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) { + return; + } + // registry.get(HIST("reco/Stat"))->Fill(1., 1.); + // check vertex matching to FT0 + if (IsGoodVertex && !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) { + return; + } + // registry.get(HIST("reco/Stat"))->Fill(1., 1.); + // reject ITS Only vertices + if (ITSTPCVertex && !collision.selection_bit(aod::evsel::kIsVertexITSTPC)) { + return; + } + // registry.get(HIST("reco/Stat"))->Fill(1., 1.); // registry.get(HIST("reco/Stat"))->Fill(1., 1.); // nominal BC if (!collision.has_foundBC()) { @@ -203,10 +228,14 @@ struct SGCandProducer { } // update SGTracks tables for (auto& track : tracks) { - if (track.isPVContributor() || saveAllTracks) { - if (track.itsClusterSizes() && track.itsChi2NCl() > 0 && ((track.tpcNClsFindable() == 0 && savenonPVCITSOnlyTracks) || track.tpcNClsFindable() > 50) && track.pt() > sameCuts.minPt() && track.eta() > sameCuts.minEta() && track.eta() < sameCuts.maxEta()) + if (track.pt() > sameCuts.minPt() && track.eta() > sameCuts.minEta() && track.eta() < sameCuts.maxEta()) { + if (track.isPVContributor()) { updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC()); - // if (track.isPVContributor()) updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC()); + } else if (saveAllTracks) { + if (track.itsClusterSizes() && track.itsChi2NCl() > 0 && ((track.tpcNClsFindable() == 0 && savenonPVCITSOnlyTracks) || track.tpcNClsFindable() > 50)) + updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC()); + // if (track.isPVContributor()) updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC()); + } } } // update SGFwdTracks tables diff --git a/PWGUD/TableProducer/UPCCandidateProducer.cxx b/PWGUD/TableProducer/UPCCandidateProducer.cxx index 13795d40eba..b65d44f9d2f 100644 --- a/PWGUD/TableProducer/UPCCandidateProducer.cxx +++ b/PWGUD/TableProducer/UPCCandidateProducer.cxx @@ -34,6 +34,7 @@ struct UpcCandProducer { Produces udFwdTracks; Produces udFwdTracksExtra; + Produces udFwdTrkClusters; Produces udFwdTrackLabels; Produces udTracks; @@ -379,6 +380,22 @@ struct UpcCandProducer { } } + void fillFwdClusters(const std::vector& trackIds, + o2::aod::FwdTrkCls const& fwdTrkCls) + { + std::map> clustersPerTrack; + for (const auto& cls : fwdTrkCls) { + clustersPerTrack[cls.fwdtrackId()].push_back(cls.globalIndex()); + } + for (auto trackId : trackIds) { + const auto& clusters = clustersPerTrack.at(trackId); + for (auto clsId : clusters) { + const auto& clsInfo = fwdTrkCls.iteratorAt(clsId); + udFwdTrkClusters(trackId, clsInfo.x(), clsInfo.y(), clsInfo.z(), clsInfo.clInfo()); + } + } + } + void fillBarrelTracks(BarrelTracks const& tracks, std::vector const& trackIDs, int32_t candID, @@ -978,6 +995,7 @@ struct UpcCandProducer { void createCandidatesSemiFwd(BarrelTracks const& barrelTracks, o2::aod::AmbiguousTracks const& ambBarrelTracks, ForwardTracks const& fwdTracks, + o2::aod::FwdTrkCls const& fwdTrkClusters, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, BCsWithBcSels const& bcs, o2::aod::Collisions const& collisions, @@ -1180,6 +1198,7 @@ struct UpcCandProducer { } void createCandidatesFwd(ForwardTracks const& fwdTracks, + o2::aod::FwdTrkCls const& fwdTrkClusters, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, o2::aod::BCs const& bcs, o2::aod::Collisions const& collisions, @@ -1260,6 +1279,8 @@ struct UpcCandProducer { int32_t runNumber = bcs.iteratorAt(0).runNumber(); + std::vector selTrackIds{}; + // storing n-prong matches int32_t candID = 0; for (auto& pair : bcsMatchedTrIdsMID) { @@ -1343,6 +1364,7 @@ struct UpcCandProducer { for (auto id : trkCandIDs) { auto tr = fwdTracks.iteratorAt(id); netCharge += tr.sign(); + selTrackIds.push_back(id); } // store used tracks fillFwdTracks(fwdTracks, trkCandIDs, candID, globalBC, closestBcMCH, mcFwdTrackLabels); @@ -1363,6 +1385,9 @@ struct UpcCandProducer { trkCandIDs.clear(); } + fillFwdClusters(selTrackIds, fwdTrkClusters); + + selTrackIds.clear(); ambFwdTrBCs.clear(); bcsMatchedTrIdsMID.clear(); bcsMatchedTrIdsMCH.clear(); @@ -1377,6 +1402,7 @@ struct UpcCandProducer { // forward: n fwd tracks + 0 barrel tracks // semiforward: n fwd tracks + m barrel tracks void processSemiFwd(ForwardTracks const& fwdTracks, + o2::aod::FwdTrkCls const& fwdTrkClusters, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, BarrelTracks const& barrelTracks, o2::aod::AmbiguousTracks const& ambTracks, @@ -1388,7 +1414,7 @@ struct UpcCandProducer { { fDoMC = false; createCandidatesSemiFwd(barrelTracks, ambTracks, - fwdTracks, ambFwdTracks, + fwdTracks, fwdTrkClusters, ambFwdTracks, bcs, collisions, ft0s, fdds, fv0as, (o2::aod::McTrackLabels*)nullptr, (o2::aod::McFwdTrackLabels*)nullptr); @@ -1418,6 +1444,7 @@ struct UpcCandProducer { // forward: n fwd tracks + 0 barrel tracks // semiforward: n fwd tracks + m barrel tracks void processSemiFwdMC(ForwardTracks const& fwdTracks, + o2::aod::FwdTrkCls const& fwdTrkClusters, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, BarrelTracks const& barrelTracks, o2::aod::AmbiguousTracks const& ambTracks, @@ -1432,7 +1459,7 @@ struct UpcCandProducer { fDoMC = true; skimMCInfo(mcCollisions, mcParticles, bcs); createCandidatesSemiFwd(barrelTracks, ambTracks, - fwdTracks, ambFwdTracks, + fwdTracks, fwdTrkClusters, ambFwdTracks, bcs, collisions, ft0s, fdds, fv0as, &mcBarrelTrackLabels, &mcFwdTrackLabels); @@ -1463,6 +1490,7 @@ struct UpcCandProducer { // create candidates for forward region // forward: n fwd tracks void processForward(ForwardTracks const& fwdTracks, + o2::aod::FwdTrkCls const& fwdTrkClusters, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, o2::aod::BCs const& bcs, o2::aod::Collisions const& collisions, @@ -1472,13 +1500,14 @@ struct UpcCandProducer { o2::aod::Zdcs const& zdcs) { fDoMC = false; - createCandidatesFwd(fwdTracks, ambFwdTracks, + createCandidatesFwd(fwdTracks, fwdTrkClusters, ambFwdTracks, bcs, collisions, ft0s, fdds, fv0as, zdcs, (o2::aod::McFwdTrackLabels*)nullptr); } void processForwardMC(ForwardTracks const& fwdTracks, + o2::aod::FwdTrkCls const& fwdTrkClusters, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, o2::aod::BCs const& bcs, o2::aod::Collisions const& collisions, @@ -1491,7 +1520,7 @@ struct UpcCandProducer { { fDoMC = true; skimMCInfo(mcCollisions, mcParticles, bcs); - createCandidatesFwd(fwdTracks, ambFwdTracks, + createCandidatesFwd(fwdTracks, fwdTrkClusters, ambFwdTracks, bcs, collisions, ft0s, fdds, fv0as, zdcs, &mcFwdTrackLabels); diff --git a/PWGUD/Tasks/CMakeLists.txt b/PWGUD/Tasks/CMakeLists.txt index 214a9e5f725..2280bf4741a 100644 --- a/PWGUD/Tasks/CMakeLists.txt +++ b/PWGUD/Tasks/CMakeLists.txt @@ -19,6 +19,11 @@ o2physics_add_dpl_workflow(sg-spectra PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(sg-fourpi + SOURCES SG_FourPi_Analyzer.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(sg-d0 SOURCES SG_D0_Analyzer.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase @@ -69,7 +74,6 @@ o2physics_add_dpl_workflow(upc-mft PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsBase O2::DetectorsCommonDataFormats COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(upc-veto SOURCES upcVetoAnalysis.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase @@ -88,16 +92,3 @@ o2physics_add_dpl_workflow(polarisation-rho SOURCES PolarisationRho.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector COMPONENT_NAME Analysis) - - -o2physics_add_dpl_workflow(upc-jpsi-corr - SOURCES upcJpsiCentralBarrelCorr.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector - COMPONENT_NAME Analysis) - - -o2physics_add_dpl_workflow(exclusive-phi - SOURCES ExclusivePhi.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::DGPIDSelector - COMPONENT_NAME Analysis) - diff --git a/PWGUD/Tasks/SGSpectraAnalyzer.cxx b/PWGUD/Tasks/SGSpectraAnalyzer.cxx index f804d8b2a44..fbe9847bb0c 100644 --- a/PWGUD/Tasks/SGSpectraAnalyzer.cxx +++ b/PWGUD/Tasks/SGSpectraAnalyzer.cxx @@ -19,6 +19,7 @@ #include "iostream" #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/SGSelector.h" +#include "PWGUD/Tasks/SGTrackSelector.h" //#include "Common/DataModel/PIDResponse.h" //#include "PWGUD/Core/RLhelper.h" #include @@ -34,13 +35,28 @@ using namespace o2::framework::expressions; struct SGSpectraAnalyzer { SGSelector sgSelector; Configurable FV0_cut{"FV0", 100., "FV0A threshold"}; + Configurable FT0A_cut{"FT0A", 100., "FT0A threshold"}; + Configurable FT0C_cut{"FT0C", 50., "FT0C threshold"}; + Configurable FDDA_cut{"FDDA", 10000., "FDDA threshold"}; + Configurable FDDC_cut{"FDDC", 10000., "FDDC threshold"}; Configurable ZDC_cut{"ZDC", 10., "ZDC threshold"}; Configurable eta_cut{"Eta", 0.9, "Eta cut"}; Configurable use_tof{"Use_TOF", true, "TOF PID"}; HistogramRegistry registry{ "registry", {// Pion histograms for each eta bin and gapSide + {"E_mult_SG", "Photon-Ion c.m.s. Energy vs Multiplicity", {HistType::kTH2F, {{50, -.5, 49.5}, {250, 10, 300}}}}, + {"E_mult_DG", "Photon-Ion c.m.s. Energy vs Multiplicity", {HistType::kTH2F, {{50, -.5, 49.5}, {250, 10, 300}}}}, + {"E_M_SG", "Photon-Ion c.m.s. Energy vs Mass", {HistType::kTH2F, {{1000, .05, 25.05}, {250, 10, 300}}}}, + {"E_M_DG", "Photon-Ion c.m.s. Energy vs Mass", {HistType::kTH2F, {{1000, .05, 25.05}, {250, 10, 300}}}}, + {"E_Y_SG", "Photon-Ion c.m.s. Energy vs Rapidity", {HistType::kTH2F, {{200, -1., 1.}, {250, 10, 300}}}}, + {"E_Y_DG", "Photon-Ion c.m.s. Energy vs Rapidity", {HistType::kTH2F, {{200, -1., 1.}, {250, 10, 300}}}}, + {"ITS_Cluster_nonPV", "ITS Cluster Size", {HistType::kTH1F, {{140, -.5, 139.5}}}}, + {"all_tracks_SG", "All Tracks SG", {HistType::kTH1F, {{50, -.5, 49.5}}}}, + {"all_tracks_DG", "All Tracks DG", {HistType::kTH1F, {{50, -.5, 49.5}}}}, + {"good_tracks_SG", "Good Tracks SG", {HistType::kTH1F, {{50, -.5, 49.5}}}}, + {"good_tracks_DG", "Good Tracks DG", {HistType::kTH1F, {{50, -.5, 49.5}}}}, {"ITS_Cluster_PV", "ITS Cluster Size", {HistType::kTH1F, {{140, -.5, 139.5}}}}, {"ITS_Chi2_PV", "ITS Chi2", {HistType::kTH1F, {{10000, -999.5, 999.5}}}}, {"ITS_Chi2_nonPV", "ITS Chi2", {HistType::kTH1F, {{10000, -999.5, 999.5}}}}, @@ -128,51 +144,6 @@ struct SGSpectraAnalyzer { // using UDCollisionsFull = soa::Join; using UDCollisionFull = UDCollisionsFull::iterator; - template - int trackselector(const T& track, bool /*use_tof*/) - { - TLorentzVector a; - a.SetXYZM(track.px(), track.py(), track.pz(), mpion); - if (std::abs(track.dcaZ()) > 2.) - return 0; - if (std::abs(track.dcaXY()) > .0105 + .035 / pow(a.Pt(), 1.1)) - return 0; - if (track.tpcChi2NCl() > 4) - return 0; - if (track.tpcNClsFindable() < 70) - return 0; - if (track.itsChi2NCl() > 36) - return 0; - return 1; - } - template - int trackpid(const T& track, bool use_tof) - { - int pid = 0; - float pi, ka, pr; - float tpi, tka, tpr; - pi = std::abs(track.tpcNSigmaPi()); - ka = std::abs(track.tpcNSigmaKa()); - pr = std::abs(track.tpcNSigmaPr()); - if (pi < 1. && pi < ka && pi < pr) - pid = 1; - else if (ka < 1. && ka < pi && ka < pr) - pid = 2; - else if (pr < 1. && pr < pi && pr < ka) - pid = 3; - if (use_tof && track.tofChi2() > -1) { - tpi = std::abs(track.tofNSigmaPi()); - tka = std::abs(track.tofNSigmaKa()); - tpr = std::abs(track.tofNSigmaPr()); - if (std::sqrt(pi * pi + tpi * tpi) < 2 && std::sqrt(pi * pi + tpi * tpi) < std::sqrt(ka * ka + tka * tka) && std::sqrt(pi * pi + tpi * tpi) < std::sqrt(pr * pr + tpr * tpr)) - pid = 1; - else if (std::sqrt(ka * ka + tka * tka) < 2 && std::sqrt(pi * pi + tpi * tpi) > std::sqrt(ka * ka + tka * tka) && std::sqrt(ka * ka + tka * tka) < std::sqrt(pr * pr + tpr * tpr)) - pid = 2; - else if (std::sqrt(pr * pr + tpr * tpr) < 2 && std::sqrt(pr * pr + tpr * tpr) < std::sqrt(ka * ka + tka * tka) && std::sqrt(pi * pi + tpi * tpi) > std::sqrt(pr * pr + tpr * tpr)) - pid = 3; - } - return pid; - } /* template bool ispion(const T& track, bool use_tof){ @@ -214,12 +185,17 @@ struct SGSpectraAnalyzer { void process(UDCollisionFull const& collision, udtracksfull const& tracks) { TLorentzVector a; + TLorentzVector am; + TLorentzVector sum; + int goodtracks = 0; + int alltracks = 0; + sum.SetXYZM(0, 0, 0, 0); int gapSide = collision.gapSide(); - int truegapSide = sgSelector.trueGap(collision, FV0_cut, ZDC_cut); + float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; + int truegapSide = sgSelector.trueGap(collision, FIT_cut[0], FIT_cut[1], FIT_cut[3], ZDC_cut); gapSide = truegapSide; if (gapSide < 0 || gapSide > 2) return; - for (auto& track : tracks) { if (!track.isPVContributor()) { registry.get(HIST("ITS_Cluster_nonPV"))->Fill(track.itsClusterSizes()); @@ -245,28 +221,69 @@ struct SGSpectraAnalyzer { registry.get(HIST("TPC_IP_PV"))->Fill(track.tpcInnerParam()); registry.get(HIST("DcaZ_PV"))->Fill(track.dcaZ()); registry.get(HIST("DcaXY_PV"))->Fill(track.dcaXY()); - if (trackselector(track, use_tof)) { + alltracks++; + if (trackselector(track)) { + int track_pid = trackpid(track, use_tof); // if (ispion(track, use_tof)) { - if (trackpid(track, use_tof) == 1) { + if (track_pid <= 1) { a.SetXYZM(track.px(), track.py(), track.pz(), mpion); - if (std::abs(a.Eta()) < eta_cut) + am.SetXYZM(track.px(), track.py(), -track.pz(), mpion); + if (std::abs(a.Eta()) < eta_cut) { + goodtracks++; fillHistograms("Pion", a.Pt(), a.Eta(), gapSide); + if (gapSide == 0) + sum = sum + a; + else + sum = sum + am; + } } // if (iskaon(track, use_tof)) { - if (trackpid(track, use_tof) == 2) { + if (track_pid == 2) { a.SetXYZM(track.px(), track.py(), track.pz(), mkaon); - if (std::abs(a.Eta()) < eta_cut) + am.SetXYZM(track.px(), track.py(), -track.pz(), mkaon); + if (std::abs(a.Eta()) < eta_cut) { + goodtracks++; fillHistograms("Kaon", a.Pt(), a.Eta(), gapSide); + if (gapSide == 0) + sum = sum + a; + else + sum = sum + am; + } } // if (isproton(track, use_tof)) { - if (trackpid(track, use_tof) == 3) { + if (track_pid == 3) { a.SetXYZM(track.px(), track.py(), track.pz(), mproton); - if (std::abs(a.Eta()) < eta_cut) + am.SetXYZM(track.px(), track.py(), -track.pz(), mproton); + if (std::abs(a.Eta()) < eta_cut) { + goodtracks++; fillHistograms("Proton", a.Pt(), a.Eta(), gapSide); + if (gapSide == 0) + sum = sum + a; + else + sum = sum + am; + } } } } } + if (goodtracks > 1) { + float W_gPb = TMath::Sqrt(2 * 2680 * sum.M() * TMath::Exp(sum.Rapidity())); + if (sum.M() < .2) + std::cout << goodtracks << "\t" << sum.M() << "\t" << sum.Pt() << std::endl; + if (gapSide < 2) { + registry.get(HIST("E_mult_SG"))->Fill(goodtracks, W_gPb); + registry.get(HIST("E_M_SG"))->Fill(sum.M(), W_gPb); + registry.get(HIST("E_Y_SG"))->Fill(sum.Rapidity(), W_gPb); + registry.get(HIST("all_tracks_SG"))->Fill(alltracks); + registry.get(HIST("good_tracks_SG"))->Fill(goodtracks); + } else { + registry.get(HIST("E_mult_DG"))->Fill(goodtracks, W_gPb); + registry.get(HIST("E_M_DG"))->Fill(sum.M(), W_gPb); + registry.get(HIST("E_Y_DG"))->Fill(sum.Rapidity(), W_gPb); + registry.get(HIST("all_tracks_DG"))->Fill(alltracks); + registry.get(HIST("good_tracks_DG"))->Fill(goodtracks); + } + } } void fillHistograms(const std::string& particleType, float pt, float eta, int gapSide) diff --git a/PWGUD/Tasks/SGTrackSelector.h b/PWGUD/Tasks/SGTrackSelector.h new file mode 100644 index 00000000000..d0c2cb551b8 --- /dev/null +++ b/PWGUD/Tasks/SGTrackSelector.h @@ -0,0 +1,83 @@ +// 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. +// +// \Single Gap Event Analyzer +// \author Sasha Bylinkin, alexander.bylinkin@gmail.com +// \since April 2023 + +#ifndef PWGUD_TASKS_SGTRACKSELECTOR_H_ +#define PWGUD_TASKS_SGTRACKSELECTOR_H_ + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "iostream" +#include "PWGUD/DataModel/UDTables.h" +#include "PWGUD/Core/SGSelector.h" +//#include "Common/DataModel/PIDResponse.h" +//#include "PWGUD/Core/RLhelper.h" +#include +#include "TLorentzVector.h" +using namespace std; +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +#define mpion 0.1396 +#define mkaon 0.4937 +#define mproton 0.9383 +template +int trackselector(const T& track) +{ + TLorentzVector a; + a.SetXYZM(track.px(), track.py(), track.pz(), mpion); + if (std::abs(track.dcaZ()) > 2.) + return 0; + if (std::abs(track.dcaXY()) > .0105 + .035 / pow(a.Pt(), 1.1)) + return 0; + if (track.tpcChi2NCl() > 4) + return 0; + if (track.tpcNClsFindable() < 70) + return 0; + if (track.itsChi2NCl() > 36) + return 0; + return 1; +} +template +int trackpid(const T& track, bool use_tof) +{ + int pid = 0; + float pi, ka, pr; + float tpi, tka, tpr; + pi = std::abs(track.tpcNSigmaPi()); + ka = std::abs(track.tpcNSigmaKa()); + pr = std::abs(track.tpcNSigmaPr()); + if (pi < 1. && pi < ka && pi < pr) + pid = 1; + else if (ka < 1. && ka < pi && ka < pr) + pid = 2; + else if (pr < 1. && pr < pi && pr < ka) + pid = 3; + if (use_tof && track.tofChi2() > -1) { + tpi = std::abs(track.tofNSigmaPi()); + tka = std::abs(track.tofNSigmaKa()); + tpr = std::abs(track.tofNSigmaPr()); + if (std::sqrt(pi * pi + tpi * tpi) < 2 && std::sqrt(pi * pi + tpi * tpi) < std::sqrt(ka * ka + tka * tka) && std::sqrt(pi * pi + tpi * tpi) < std::sqrt(pr * pr + tpr * tpr)) + pid = 1; + else if (std::sqrt(ka * ka + tka * tka) < 2 && std::sqrt(pi * pi + tpi * tpi) > std::sqrt(ka * ka + tka * tka) && std::sqrt(ka * ka + tka * tka) < std::sqrt(pr * pr + tpr * tpr)) + pid = 2; + else if (std::sqrt(pr * pr + tpr * tpr) < 2 && std::sqrt(pr * pr + tpr * tpr) < std::sqrt(ka * ka + tka * tka) && std::sqrt(pi * pi + tpi * tpi) > std::sqrt(pr * pr + tpr * tpr)) + pid = 3; + } + return pid; +} + +#endif // PWGUD_TASKS_SGTRACKSELECTOR_H_ diff --git a/PWGUD/Tasks/SG_D0_Analyzer.cxx b/PWGUD/Tasks/SG_D0_Analyzer.cxx index d636dc30e06..339efde5912 100644 --- a/PWGUD/Tasks/SG_D0_Analyzer.cxx +++ b/PWGUD/Tasks/SG_D0_Analyzer.cxx @@ -33,6 +33,10 @@ using namespace o2::framework::expressions; struct SG_D0_Analyzer { SGSelector sgSelector; Configurable FV0_cut{"FV0", 100., "FV0A threshold"}; + Configurable FT0A_cut{"FT0A", 100., "FT0A threshold"}; + Configurable FT0C_cut{"FT0C", 50., "FT0C threshold"}; + Configurable FDDA_cut{"FDDA", 10000., "FDDA threshold"}; + Configurable FDDC_cut{"FDDC", 10000., "FDDC threshold"}; Configurable ZDC_cut{"ZDC", 10., "ZDC threshold"}; HistogramRegistry registry{ "registry", @@ -81,7 +85,10 @@ struct SG_D0_Analyzer { TLorentzVector v1; TLorentzVector v01; // int truegapSide = sgSelector.trueGap(collision); - int truegapSide = sgSelector.trueGap(collision, FV0_cut, ZDC_cut); + // int truegapSide = sgSelector.trueGap(collision, FV0_cut, ZDC_cut); + float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; + // int truegapSide = sgSelector.trueGap(collision, *FIT_cut, ZDC_cut); + int truegapSide = sgSelector.trueGap(collision, FIT_cut[0], FIT_cut[1], FIT_cut[3], ZDC_cut); registry.fill(HIST("GapSide"), gapSide); registry.fill(HIST("TrueGapSide"), truegapSide); gapSide = truegapSide; diff --git a/PWGUD/Tasks/SG_FIT_Analyzer.cxx b/PWGUD/Tasks/SG_FIT_Analyzer.cxx index 748a80aa106..63d90a2fa58 100644 --- a/PWGUD/Tasks/SG_FIT_Analyzer.cxx +++ b/PWGUD/Tasks/SG_FIT_Analyzer.cxx @@ -40,7 +40,10 @@ struct SG_FIT_Analyzer { // UDTutorial01 ConfigurableAxis ZDCAxis{"ZDCAxis", {1000, -2.5, 199.5}, ""}; Configurable FV0_cut{"FV0", 100., "FV0A threshold"}; Configurable ZDC_cut{"ZDC", 10., "ZDC threshold"}; - + Configurable FT0A_cut{"FT0A", 100., "FT0A threshold"}; + Configurable FT0C_cut{"FT0C", 50., "FT0C threshold"}; + Configurable FDDA_cut{"FDDA", 10000., "FDDA threshold"}; + Configurable FDDC_cut{"FDDC", 10000., "FDDC threshold"}; // initialize histogram registry HistogramRegistry registry{ "registry", @@ -108,9 +111,11 @@ struct SG_FIT_Analyzer { // UDTutorial01 registry.add("ZDC/AZNA", "Amplitude ZNA, A Gap", {HistType::kTH1F, {{axiszdc}}}); registry.add("ZDC/CZNA", "Amplitude ZNA, C Gap", {HistType::kTH1F, {{axiszdc}}}); registry.add("ZDC/ACZNA", "Amplitude ZNA, AC Gap", {HistType::kTH1F, {{axiszdc}}}); + registry.add("ZDC/ACZNA_CR", "Amplitude ZNA, AC Gap", {HistType::kTH1F, {{axiszdc}}}); registry.add("ZDC/AZNC", "Amplitude ZNC, A Gap", {HistType::kTH1F, {{axiszdc}}}); registry.add("ZDC/CZNC", "Amplitude ZNC, C Gap", {HistType::kTH1F, {{axiszdc}}}); registry.add("ZDC/ACZNC", "Amplitude ZNC, AC Gap", {HistType::kTH1F, {{axiszdc}}}); + registry.add("ZDC/ACZNC_CR", "Amplitude ZNC, AC Gap", {HistType::kTH1F, {{axiszdc}}}); registry.add("ZDC/tAZNA", "Time ZNA", {HistType::kTH1F, {{100, -19.5, 19.5}}}); registry.add("ZDC/tAZNC", "Time ZNC", {HistType::kTH1F, {{100, -19.5, 19.5}}}); registry.add("ZDC/tCZNA", "Time ZNA", {HistType::kTH1F, {{100, -19.5, 19.5}}}); @@ -171,6 +176,11 @@ struct SG_FIT_Analyzer { // UDTutorial01 registry.add("FIT/CFDDA3", "Amplitude FDDA 3n", {HistType::kTH1F, {{axisfit}}}); registry.add("FIT/CFDDA4", "Amplitude FDDA 4n", {HistType::kTH1F, {{axisfit}}}); registry.add("FIT/CFDDC", "Amplitude FDDC", {HistType::kTH1F, {{axisfit}}}); + registry.add("FIT/ACFV0A_CR", "Amplitude FV0A", {HistType::kTH1F, {{axisfit}}}); + registry.add("FIT/ACFT0A_CR", "Amplitude FT0A", {HistType::kTH1F, {{axisfit}}}); + registry.add("FIT/ACFT0C_CR", "Amplitude FT0C", {HistType::kTH1F, {{axisfit}}}); + registry.add("FIT/ACFDDA_CR", "Amplitude FDDA", {HistType::kTH1F, {{axisfit}}}); + registry.add("FIT/ACFDDC_CR", "Amplitude FDDC", {HistType::kTH1F, {{axisfit}}}); registry.add("FIT/ACFV0A", "Amplitude FV0A", {HistType::kTH1F, {{axisfit}}}); registry.add("FIT/ACFT0A", "Amplitude FT0A", {HistType::kTH1F, {{axisfit}}}); registry.add("FIT/ACFT0C", "Amplitude FT0C", {HistType::kTH1F, {{axisfit}}}); @@ -279,7 +289,10 @@ struct SG_FIT_Analyzer { // UDTutorial01 // fill collision histograms registry.get(HIST("collisions/GapSide"))->Fill(dgcand.gapSide(), 1.); - int truegapSide = sgSelector.trueGap(dgcand, FV0_cut, ZDC_cut); + // int truegapSide = sgSelector.trueGap(dgcand, FV0_cut, ZDC_cut); + float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; + // int truegapSide = sgSelector.trueGap(collision, *FIT_cut, ZDC_cut); + int truegapSide = sgSelector.trueGap(dgcand, FIT_cut[0], FIT_cut[1], FIT_cut[3], ZDC_cut); registry.get(HIST("collisions/TrueGapSide"))->Fill(truegapSide, 1.); // select PV contributors Partition PVContributors = aod::udtrack::isPVContributor == true; @@ -297,6 +310,19 @@ struct SG_FIT_Analyzer { // UDTutorial01 LOGF(info, " Number of tracks %d", dgtracks.size()); LOGF(info, " Number of PV contributors %d", PVContributors.size()); } + // check rho0 signals + bool coh_rho0 = false; + TLorentzVector p1, p2, rho; + if (PVContributors.size() == 2) { + for (auto& [t0, t1] : combinations(dgtracks, dgtracks)) { + // Apply pion hypothesis and create pairs + p1.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassPionCharged); + p2.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); + rho = p1 + p2; + } + if (TMath::Abs(rho.Rapidity()) < .9 && rho.M() > .5 && rho.M() < 1.2 && rho.Pt() < 0.15) + coh_rho0 = true; + } int pva = 0; int pvc = 0; int pvac = 0; @@ -529,6 +555,15 @@ struct SG_FIT_Analyzer { // UDTutorial01 registry.get(HIST("FIT/ACFT0"))->Fill(totalA, totalC); registry.get(HIST("FIT/ACFITA"))->Fill(totalA, 1.); registry.get(HIST("FIT/ACFITC"))->Fill(totalC, 1.); + if (coh_rho0) { + registry.get(HIST("ZDC/ACZNA_CR"))->Fill(zna, 1.); + registry.get(HIST("ZDC/ACZNC_CR"))->Fill(znc, 1.); + registry.get(HIST("FIT/ACFT0A_CR"))->Fill(dgcand.totalFT0AmplitudeA(), 1.); + registry.get(HIST("FIT/ACFT0C_CR"))->Fill(dgcand.totalFT0AmplitudeC(), 1.); + registry.get(HIST("FIT/ACFV0A_CR"))->Fill(dgcand.totalFV0AmplitudeA(), 1.); + registry.get(HIST("FIT/ACFDDA_CR"))->Fill(dgcand.totalFDDAmplitudeA(), 1.); + registry.get(HIST("FIT/ACFDDC_CR"))->Fill(dgcand.totalFDDAmplitudeC(), 1.); + } registry.get(HIST("FIT/ACFT0A"))->Fill(dgcand.totalFT0AmplitudeA(), 1.); registry.get(HIST("FIT/ACFT0C"))->Fill(dgcand.totalFT0AmplitudeC(), 1.); registry.get(HIST("FIT/ACFV0A"))->Fill(dgcand.totalFV0AmplitudeA(), 1.); diff --git a/PWGUD/Tasks/SG_FourPi_Analyzer.cxx b/PWGUD/Tasks/SG_FourPi_Analyzer.cxx new file mode 100644 index 00000000000..63b9d3718b3 --- /dev/null +++ b/PWGUD/Tasks/SG_FourPi_Analyzer.cxx @@ -0,0 +1,179 @@ +// 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. +// +// \Single Gap Event Analyzer +// \author Sasha Bylinkin, alexander.bylinkin@gmail.com +// \since April 2023 + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "iostream" +#include "PWGUD/DataModel/UDTables.h" +#include "PWGUD/Core/SGSelector.h" +#include "PWGUD/Tasks/SGTrackSelector.h" +#include "Common/DataModel/PIDResponse.h" +#include "Framework/ASoA.h" +#include "Framework/DataTypes.h" +#include "MathUtils/Utils.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include "TLorentzVector.h" +using namespace std; +using namespace o2; +using namespace o2::aod; +// using namespace o2::aod::track::v001; +using namespace o2::framework; +using namespace o2::framework::expressions; +#define mpion 0.1396 +#define mkaon 0.4937 +#define mproton 0.9383 +struct SG_FourPi_Analyzer { + SGSelector sgSelector; + Configurable FV0_cut{"FV0", 50., "FV0A threshold"}; + Configurable FT0A_cut{"FT0A", 150., "FT0A threshold"}; + Configurable FT0C_cut{"FT0C", 50., "FT0C threshold"}; + Configurable FDDA_cut{"FDDA", 10000., "FDDA threshold"}; + Configurable FDDC_cut{"FDDC", 10000., "FDDC threshold"}; + Configurable ZDC_cut{"ZDC", 10., "ZDC threshold"}; + HistogramRegistry registry{ + "registry", + { + + {"GapSide", "Gap Side; Entries", {HistType::kTH1F, {{4, -1.5, 2.5}}}}, + {"TrueGapSide", "Gap Side; Entries", {HistType::kTH1F, {{4, -1.5, 2.5}}}}, + {"ITSNCls", "ITS Clusters", {HistType::kTH1F, {{10, -.5, 9.5}}}}, + {"os_4Pi_pT", "#K#Pi pT (GeV/c); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"os_4Pi_eTa", "#K#Pi eTa (GeV/c); Entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + {"os_4Pi_invm", "#K#Pi Mass (GeV/c^2); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"ss_4Pi_pT", "#K#Pi pT (GeV/c); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"ss_4Pi_eTa", "#K#Pi eTa (GeV/c); Entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + {"ss_4Pi_invm", "#K#Pi Mass (GeV/c^2); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"os_4Pi_pT_1", "#K#Pi pT (GeV/c); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"os_4Pi_eTa_1", "#K#Pi eTa (GeV/c); Entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + {"os_4Pi_invm_1", "#K#Pi Mass (GeV/c^2); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"ss_4Pi_pT_1", "#K#Pi pT (GeV/c); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"ss_4Pi_eTa_1", "#K#Pi eTa (GeV/c); Entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + {"ss_4Pi_invm_1", "#K#Pi Mass (GeV/c^2); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"os_4Pi_pT_0", "#K#Pi pT (GeV/c); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"os_4Pi_eTa_0", "#K#Pi eTa (GeV/c); Entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + {"os_4Pi_invm_0", "#K#Pi Mass (GeV/c^2); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"ss_4Pi_pT_0", "#K#Pi pT (GeV/c); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"ss_4Pi_eTa_0", "#K#Pi eTa (GeV/c); Entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + {"ss_4Pi_invm_0", "#K#Pi Mass (GeV/c^2); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"os_4Pi_pT_2", "#K#Pi pT (GeV/c); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"os_4Pi_eTa_2", "#K#Pi eTa (GeV/c); Entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + {"os_4Pi_invm_2", "#K#Pi Mass (GeV/c^2); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"ss_4Pi_pT_2", "#K#Pi pT (GeV/c); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + {"ss_4Pi_eTa_2", "#K#Pi eTa (GeV/c); Entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + {"ss_4Pi_invm_2", "#K#Pi Mass (GeV/c^2); Entries", {HistType::kTH1F, {{1000, 0, 10}}}}, + }}; + using udtracks = soa::Join; + using udtracksfull = soa::Join; + using UDCollisionsFull = soa::Join; // + using UDCollisionFull = UDCollisionsFull::iterator; + + void process(UDCollisionFull const& collision, udtracksfull const& tracks) + { + TLorentzVector a; + int gapSide = collision.gapSide(); + if (gapSide < 0 || gapSide > 2) + return; + // Single gap either side + TLorentzVector v01; + // int truegapSide = sgSelector.trueGap(collision); + // int truegapSide = sgSelector.trueGap(collision, FV0_cut, ZDC_cut); + float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; + // int truegapSide = sgSelector.trueGap(collision, *FIT_cut, ZDC_cut); + int truegapSide = sgSelector.trueGap(collision, FIT_cut[0], FIT_cut[1], FIT_cut[3], ZDC_cut); + registry.fill(HIST("GapSide"), gapSide); + registry.fill(HIST("TrueGapSide"), truegapSide); + gapSide = truegapSide; + std::vector goodTracks; + // Look for D0 and D0bar + float sign = 0; + for (auto t : tracks) { + int itsNCls = t.itsNCls(); + // if (itsNCls) { + registry.fill(HIST("ITSNCls"), itsNCls); + //} + TLorentzVector a; + a.SetXYZM(t.px(), t.py(), t.pz(), mpion); + if (trackselector(t)) { + sign += t.sign(); + goodTracks.push_back(a); + } + } + // std::cout << goodTracks.size()<(cfgc)}; +} diff --git a/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx b/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx index f95fbf4d286..022b9dd6e25 100644 --- a/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx +++ b/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx @@ -414,7 +414,7 @@ struct upcJpsiCentralBarrel { return true; } - void process(UDCollisionFull const& collision, UDTracksFull const& tracks) + void process(UDCollisionFull const&, UDTracksFull const& tracks) { Statistics.get(HIST("Statistics/hNumberOfCollisions"))->Fill(0); // number of collisions without any cuts @@ -513,13 +513,13 @@ struct upcJpsiCentralBarrel { float massPr = o2::constants::physics::MassProton; if (countGT == 2) { - TLorentzVector mom, daughter[2]; - auto trkDaughter1 = tracks.iteratorAt(trkIdx[0]); - auto trkDaughter2 = tracks.iteratorAt(trkIdx[1]); - if ((trkDaughter1.sign() * trkDaughter2.sign()) > 0) { - return; - } if (countGTel == 2) { + TLorentzVector mom, daughter[2]; + auto trkDaughter1 = tracks.iteratorAt(trkIdx[0]); + auto trkDaughter2 = tracks.iteratorAt(trkIdx[1]); + if ((trkDaughter1.sign() * trkDaughter2.sign()) > 0) { + return; + } if (!(RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaMu(), trkDaughter2.tpcNSigmaMu()) < RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaEl(), trkDaughter2.tpcNSigmaEl()))) { return; } @@ -659,6 +659,9 @@ struct upcJpsiCentralBarrel { TLorentzVector mom, daughter[2]; auto trkDaughter1 = tracks.iteratorAt(trkIdx[0]); auto trkDaughter2 = tracks.iteratorAt(trkIdx[1]); + if ((trkDaughter1.sign() * trkDaughter2.sign()) > 0) { + return; + } if (!(RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaEl(), trkDaughter2.tpcNSigmaEl() < RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaMu(), trkDaughter2.tpcNSigmaMu())))) { return; } @@ -674,7 +677,7 @@ struct upcJpsiCentralBarrel { std::array mother = {trkDaughter1.px() + trkDaughter2.px(), trkDaughter1.py() + trkDaughter2.py(), trkDaughter1.pz() + trkDaughter2.pz()}; auto arrMom = std::array{daughter1, daughter2}; - float massJpsi = RecoDecay::m(arrMom, std::array{massEl, massEl}); + float massJpsi = RecoDecay::m(arrMom, std::array{massMu, massMu}); float rapJpsi = RecoDecay::y(mother, massJpsi); TGmu.get(HIST("TGmu/hTrackPt"))->Fill(trkDaughter1.pt()); @@ -777,6 +780,9 @@ struct upcJpsiCentralBarrel { TLorentzVector mom, daughter[2]; auto trkDaughter1 = tracks.iteratorAt(trkIdx[0]); auto trkDaughter2 = tracks.iteratorAt(trkIdx[1]); + if ((trkDaughter1.sign() * trkDaughter2.sign()) > 0) { + return; + } auto ene1 = RecoDecay::e(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), massPr); auto ene2 = RecoDecay::e(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), massPr); @@ -790,7 +796,7 @@ struct upcJpsiCentralBarrel { std::array mother = {trkDaughter1.px() + trkDaughter2.px(), trkDaughter1.py() + trkDaughter2.py(), trkDaughter1.pz() + trkDaughter2.pz()}; auto arrMom = std::array{daughter1, daughter2}; - float massJpsi = RecoDecay::m(arrMom, std::array{massEl, massEl}); + float massJpsi = RecoDecay::m(arrMom, std::array{massPr, massPr}); float rapJpsi = RecoDecay::y(mother, massJpsi); TGp.get(HIST("TGp/hTrackPt"))->Fill(trkDaughter1.pt());