diff --git a/PWGJE/Tasks/recoilJets.cxx b/PWGJE/Tasks/recoilJets.cxx index 67f0c004f94..9fb20263665 100644 --- a/PWGJE/Tasks/recoilJets.cxx +++ b/PWGJE/Tasks/recoilJets.cxx @@ -23,6 +23,7 @@ #include "Common/Core/RecoDecay.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/TrackSelectionTables.h" #include #include @@ -82,6 +83,7 @@ using EvMultOutlierPartIt = soa::Filtered; +using OriginalTrackTbl = soa::Join; using TrackMCLbsTbl = soa::Filtered; using PartTbl = soa::Filtered; @@ -222,6 +224,17 @@ struct RecoilJets { Configurable mbPart{"mbPart", 0.0f, "Rho shift for MB part. level MC"}; } cfgRhoShift; + // ---------- ITS-TPC matching efficiency settings ---------- + struct ITSTPCMatchingEff : ConfigurableGroup { + std::string prefix = "ITSTPCMatchingEff"; + + Configurable dcaXYNBins{"dcaXYNBins", 150, "Number of DCAxy bins"}; + Configurable dcaZNBins{"dcaZNBins", 40, "Number of DCAz bins"}; + + ConfigurableAxis axisPtITSTPCMatching{"axisPtITSTPCMatching", {VARIABLE_WIDTH, 0.0, 0.15, 0.2, 0.3, 0.5, 1., 2., 3., 4., 6., 8., 10., 20.}, "pT bin edges for ITS-TPC matching"}; + + } cfgITSTPCMatchingEff; + // Auxiliary variables std::unique_ptr randGen = std::make_unique(0); @@ -328,6 +341,8 @@ struct RecoilJets { AxisSpec scaledFT0C{hist.multNBins, 0.0, 20., "FT0C / #LT FT0C #GT"}; AxisSpec scaledFT0M{hist.multNBins, 0.0, 20., "FT0M^{*}"}; AxisSpec zdcTiming{hist.zdcTimeNBins, -30., 30., ""}; + AxisSpec dcaXY{cfgITSTPCMatchingEff.dcaXYNBins, -3., 3., "DCA_{xy} (cm)"}; + AxisSpec dcaZ{cfgITSTPCMatchingEff.dcaZNBins, -10., 10., "DCA_{z} (cm)"}; // Fixed size histo AxisSpec unscaledFT0A{2000, 0.0, 40000., "FT0A"}; @@ -349,6 +364,11 @@ struct RecoilJets { AxisSpec jetArea{50, 0.0, 5., "Area_{jet}"}; AxisSpec rho{100, 0.0, 50., "#it{#rho}"}; + // AxisSpec pseudorapITSTPC{10, -1., 1., "#it{#eta}"}; + // AxisSpec phiAngleITSTPC{18, 0.0, constants::math::TwoPI, "#it{#varphi} (rad)"}; + AxisSpec matchingCategory{2, -0.5, 1.5, "TPC | ITS+TPC"}; + AxisSpec primaryFlag{2, -0.5, 1.5, "Primary selection: 0 = fail, 1 = pass"}; + std::string nameFT0Caxis = "FT0C / #LT FT0C #GT"; std::string nameFT0Maxis = "FT0M^{*}"; std::string nameCentralityAxis = "Centrality (%)"; @@ -1322,6 +1342,21 @@ struct RecoilJets { kTH2F, {{eaAxis.axis, eaAxis.axisName}, {hist.axisPtTrackEff, "#it{p}_{T}^{rec} (GeV/#it{c})"}}, hist.sumw2); } } + + // ITS-TPC matching efficiency + if (doprocessITSTPCMatching) { + spectra.add("hITSTPCMatchingData", + "ITS-TPC matching in data", + kTHnSparseF, {{hist.multFT0MThresh, nameFT0Maxis}, dcaXY, dcaZ, {cfgITSTPCMatchingEff.axisPtITSTPCMatching, "#it{p}_{T} (GeV/#it{c})"}, matchingCategory, primaryFlag}, hist.sumw2); + } + + if (doprocessITSTPCMatchingMC || doprocessITSTPCMatchingMCWeighted) { + AxisSpec origin{3, -0.5, 2.5, "Origin: 0 = primary, 1 = decay secondary, 2 = other secondary"}; + + spectra.add("hITSTPCMatchingMC", + "ITS-TPC matching in MC", + kTHnSparseF, {{hist.multFT0MThresh, nameFT0Maxis}, dcaXY, dcaZ, {cfgITSTPCMatchingEff.axisPtITSTPCMatching, "#it{p}_{T} (GeV/#it{c})"}, matchingCategory, primaryFlag, origin}, hist.sumw2); + } } //============================================================================= @@ -3202,6 +3237,77 @@ struct RecoilJets { } } + //============================================================================= + // ITS-TPC matching efficiency vs EA + //============================================================================= + template + void fillITSTPCMatchingData(Track const& track, float scaledFT0M) + { + const float kTPC = 0.f; + const float kITSTPC = 1.f; + + // Require TPC presence and passing TPC quality cuts + if (!track.hasTPC() || !track.isQualityTrackTPC()) { + return; + } + + const float trackPt = track.pt(); + // const float trackEta = track.eta(); + // const float trackPhi = track.phi(); + const float dcaXY = track.dcaXY(); + const float dcaZ = track.dcaZ(); + const float primaryFlag = track.isPrimaryTrack() ? 1.f : 0.f; + + spectra.fill(HIST("hITSTPCMatchingData"), scaledFT0M, dcaXY, dcaZ, trackPt /*, trackEta, trackPhi*/, kTPC, primaryFlag); + + // Require ITS presence and passing ITS quality cuts for the numerator + if (!track.hasITS() || !track.isQualityTrackITS()) { + return; + } + + spectra.fill(HIST("hITSTPCMatchingData"), scaledFT0M, dcaXY, dcaZ, trackPt /*, trackEta, trackPhi*/, kITSTPC, primaryFlag); + } + + //____________________ + template + void fillITSTPCMatchingMC(Track const& track, + Particle const& particle, + float scaledFT0M, + float weight = 1.) + { + const float kTPC = 0.f; + const float kITSTPC = 1.f; + const float kPrimary = 0.f; + const float kDecaySecondary = 1.f; + const float kOtherSecondary = 2.f; + + if (!track.hasTPC() || !track.isQualityTrackTPC()) { + return; + } + + float origin = kOtherSecondary; + if (particle.isPhysicalPrimary()) { + origin = kPrimary; + } else if (particle.getProcess() == 4) { // o2-linter: disable=magic-number (code for material particles) + origin = kDecaySecondary; + } + + const float trackPt = track.pt(); + // const float trackEta = track.eta(); + // const float trackPhi = track.phi(); + const float dcaXY = track.dcaXY(); + const float dcaZ = track.dcaZ(); + const float primaryFlag = track.isPrimaryTrack() ? 1.f : 0.f; + + spectra.fill(HIST("hITSTPCMatchingMC"), scaledFT0M, dcaXY, dcaZ, trackPt /*, trackEta, trackPhi*/, kTPC, primaryFlag, origin, weight); + + if (!track.hasITS() || !track.isQualityTrackITS()) { + return; + } + + spectra.fill(HIST("hITSTPCMatchingMC"), scaledFT0M, dcaXY, dcaZ, trackPt /*, trackEta, trackPhi*/, kITSTPC, primaryFlag, origin, weight); + } + //----------------------------------------------------------------------------- // Block of Process Functions @@ -3640,6 +3746,94 @@ struct RecoilJets { } PROCESS_SWITCH(RecoilJets, processTrackingEfficiencyWeighted, "process MC data (weighted JJ) to estimate track reco eff", false); + //============================================================================= + // Estimate of tracking uncertainty due to ITS-TPC matching efficiency + //============================================================================= + void processITSTPCMatching(CollDataIt const& collision, + soa::Filtered> const& tracksPerColl, + OriginalTrackTbl const&) + { + if (skipEvent(collision)) { + return; + } + + const auto ft0Metrics = getFT0Metrics(collision, ft0a.mean, ft0c.mean); + const auto scaledFT0M = ft0Metrics.scaledFT0M; + + for (const auto& track : tracksPerColl) { + const auto& originalTrack = track.track_as(); + fillITSTPCMatchingData(originalTrack, scaledFT0M); + } + } + PROCESS_SWITCH(RecoilJets, processITSTPCMatching, "process raw data to estimate ITS-TPC matching efficiency", false); + + //_________________________________ + void processITSTPCMatchingMC(CollDataIt const& collision, + soa::Filtered> const& tracksPerColl, + OriginalTrackTbl const&, + aod::JetParticles const&) + { + if (skipEvent(collision)) { + return; + } + + const auto ft0Metrics = getFT0Metrics(collision, ft0a.mean, ft0c.mean); + const auto scaledFT0M = ft0Metrics.scaledFT0M; + + for (const auto& track : tracksPerColl) { + if (!track.has_mcParticle()) { + continue; + } + + const auto particle = track.mcParticle(); + auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); + + // Exclude neutral particle + if (!pdgParticle || (static_cast(pdgParticle->Charge()) == 0)) { + continue; + } + + const auto& originalTrack = track.track_as(); + fillITSTPCMatchingMC(originalTrack, particle, scaledFT0M); + } + } + PROCESS_SWITCH(RecoilJets, processITSTPCMatchingMC, "process MC data (no weight; MB events) to estimate ITS-TPC matching efficiency", false); + + //_________________________________ + void processITSTPCMatchingMCWeighted(CollOutlierDetIt const& collision, + aod::JetMcCollisions const&, + soa::Filtered> const& tracksPerColl, + OriginalTrackTbl const&, + aod::JetParticles const&) + { + if (skipEvent(collision) || !collision.has_mcCollision() || collision.isOutlier()) { + return; + } + + const auto weight = collision.mcCollision().weight(); + const auto ft0Metrics = getFT0Metrics(collision, ft0a.mean, ft0c.mean); + const auto scaledFT0M = ft0Metrics.scaledFT0M; + + for (const auto& track : tracksPerColl) { + + // Require notBadMcTrack without applying global or quality track selection + if (!jetderiveddatautilities::selectTrack(track, -1) || !track.has_mcParticle()) { + continue; + } + + const auto particle = track.mcParticle(); + auto* pdgParticle = pdg->GetParticle(particle.pdgCode()); + + if (!pdgParticle || (static_cast(pdgParticle->Charge()) == 0)) { + continue; + } + + const auto& originalTrack = track.track_as(); + fillITSTPCMatchingMC(originalTrack, particle, scaledFT0M, weight); + } + } + PROCESS_SWITCH(RecoilJets, processITSTPCMatchingMCWeighted, "process MC data (weighted JJ) to estimate ITS-TPC matching efficiency", false); + //------------------------------------------------------------------------------ // Auxiliary functions template