diff --git a/PWGCF/TableProducer/dptdptfilter.cxx b/PWGCF/TableProducer/dptdptfilter.cxx index c96ad0356e8..6c2482fffda 100644 --- a/PWGCF/TableProducer/dptdptfilter.cxx +++ b/PWGCF/TableProducer/dptdptfilter.cxx @@ -368,7 +368,14 @@ struct DptDptFilter { Configurable cfgTriggSel{"triggsel", "MB", "Trigger selection: MB,VTXTOFMATCHED,VTXTRDMATCHED,VTXTRDTOFMATCHED,None. Default MB"}; Configurable cfgCentSpec{"centralities", "00-10,10-20,20-30,30-40,40-50,50-60,60-70,70-80", "Centrality/multiplicity ranges in min-max separated by commas"}; Configurable cfgOverallMinP{"overallminp", 0.0f, "The overall minimum momentum for the analysis. Default: 0.0"}; - Configurable cfgTpcExclusionMethod{"cfgTpcExclusionMethod", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"}; + struct : ConfigurableGroup { + std::string prefix = "cfgTpcExclusion"; + Configurable method{"method", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"}; + Configurable positiveLowCut{"positiveLowCut", "0.0787/x - 0.0236", "The lower cut function for positive tracks"}; + Configurable positiveUpCut{"positiveUpCut", "0.0892/x + 0.0251", "The upper cut function for positive tracks"}; + Configurable negativeLowCut{"negativeLowCut", "pi/9.0 - (0.0892/x + 0.0251)", "The lower cut function for negative tracks"}; + Configurable negativeUpCut{"negativeUpCut", "pi/9 - (0.0787/x - 0.0236)", "The upper cut function for negative tracks"}; + } cfgTpcExclusion; Configurable cfgBinning{"binning", {28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5}, "triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"}; @@ -807,9 +814,17 @@ struct DptDptFilterTracks { getTaskOptionValue(initContext, "dpt-dpt-filter", "binning.mPhibinshift", phibinshift, false); TpcExclusionMethod tpcExclude = kNOEXCLUSION; ///< exclude tracks within the TPC according to this method + std::string pLowCut; + std::string pUpCut; + std::string nLowCut; + std::string nUpCut; { int tmpTpcExclude = 0; - getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusionMethod", tmpTpcExclude, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.method", tmpTpcExclude, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.positiveLowCut", pLowCut, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.positiveUpCut", pUpCut, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.negativeLowCut", nLowCut, false); + getTaskOptionValue(initContext, "dpt-dpt-filter", "cfgTpcExclusion.negativeUpCut", nUpCut, false); tpcExclude = static_cast(tmpTpcExclude); } /* self configure the CCDB access to the input file */ @@ -828,6 +843,7 @@ struct DptDptFilterTracks { /* the TPC excluder object instance */ tpcExcluder = TpcExcludeTrack(tpcExclude); + tpcExcluder.setCuts(pLowCut, pUpCut, nLowCut, nUpCut); /* self configure system type and data type */ /* if the system type is not known at this time, we have to put the initialization somewhere else */ diff --git a/PWGCF/TableProducer/dptdptfilter.h b/PWGCF/TableProducer/dptdptfilter.h index 0a824103934..16904455a9e 100644 --- a/PWGCF/TableProducer/dptdptfilter.h +++ b/PWGCF/TableProducer/dptdptfilter.h @@ -17,6 +17,7 @@ #define PWGCF_TABLEPRODUCER_DPTDPTFILTER_H_ #include +#include #include #include #include @@ -1017,7 +1018,6 @@ struct TpcExcludeTrack { } break; case kDYNAMIC: - LOGF(fatal, "Dynamic TPC exclusion method still not implemented"); method = m; break; default: @@ -1040,6 +1040,9 @@ struct TpcExcludeTrack { template bool exclude(TrackObject const& track) { + constexpr int kNoOfTpcSectors = 18; + constexpr float kTpcPhiSectorWidth = (constants::math::TwoPI) / kNoOfTpcSectors; + switch (method) { case kNOEXCLUSION: { return false; @@ -1054,15 +1057,33 @@ struct TpcExcludeTrack { } } break; case kDYNAMIC: { - return false; + float phiInTpcSector = std::fmod(track.phi(), kTpcPhiSectorWidth); + if (track.sign() > 0) { + return (phiInTpcSector < positiveUpCut->Eval(track.pt())) && (positiveLowCut->Eval(track.pt()) < phiInTpcSector); + } else { + return (phiInTpcSector < negativeUpCut->Eval(track.pt())) && (negativeLowCut->Eval(track.pt()) < phiInTpcSector); + } } break; default: return false; } } + void setCuts(std::string pLowCut, std::string pUpCut, std::string nLowCut, std::string nUpCut) + { + LOGF(info, "Setting the TPC exclusion cuts: pLow=%s, pUp=%s, nLow=%s, nUp=%s", pLowCut, pUpCut, nLowCut, nUpCut); + positiveLowCut = new TF1("posLowCut", pLowCut.c_str(), ptlow, ptup); + positiveUpCut = new TF1("posUpCut", pUpCut.c_str(), ptlow, ptup); + negativeLowCut = new TF1("negLowCut", nLowCut.c_str(), ptlow, ptup); + negativeUpCut = new TF1("negUpCut", nUpCut.c_str(), ptlow, ptup); + } + TpcExclusionMethod method = kNOEXCLUSION; float phibinwidth = 0.0; + TF1* positiveLowCut = nullptr; + TF1* positiveUpCut = nullptr; + TF1* negativeLowCut = nullptr; + TF1* negativeUpCut = nullptr; }; template diff --git a/PWGCF/Tasks/match-reco-gen.cxx b/PWGCF/Tasks/match-reco-gen.cxx index 43adb1b63b0..0162083350a 100644 --- a/PWGCF/Tasks/match-reco-gen.cxx +++ b/PWGCF/Tasks/match-reco-gen.cxx @@ -67,7 +67,10 @@ struct CheckGeneratorLevelVsDetectorLevel { Configurable cfgBinning{"binning", {28, -7.0, 7.0, 18, 0.2, 2.0, 16, -0.8, 0.8, 72, 0.5}, "triplets - nbins, min, max - for z_vtx, pT, eta and phi, binning plus bin fraction of phi origin shift"}; - Configurable cfgTpcExclusionMethod{"cfgTpcExclusionMethod", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"}; + struct : ConfigurableGroup { + std::string prefix = "cfgTpcExclusion"; + Configurable method{"method", 0, "The method for excluding tracks within the TPC. 0: no exclusion; 1: static; 2: dynamic. Default: 0"}; + } cfgTpcExclusion; Configurable cfgTraceDCAOutliers{"trackdcaoutliers", {false, 0.0, 0.0}, "Track the generator level DCAxy outliers: false/true, low dcaxy, up dcaxy. Default {false,0.0,0.0}"}; Configurable cfgTraceOutOfSpeciesParticles{"trackoutparticles", false, "Track the particles which are not e,mu,pi,K,p: false/true. Default false"}; Configurable cfgRecoIdMethod{"recoidmethod", 0, "Method for identifying reconstructed tracks: 0 PID, 1 mcparticle. Default 0"}; @@ -107,7 +110,7 @@ struct CheckGeneratorLevelVsDetectorLevel { /* the TPC excluder object instance */ TpcExclusionMethod tpcExclude = kNOEXCLUSION; ///< exclude tracks within the TPC according to this method - tpcExclude = static_cast(cfgTpcExclusionMethod.value); + tpcExclude = static_cast(cfgTpcExclusion.method.value); tpcExcluder = TpcExcludeTrack(tpcExclude); /* the track types and combinations */ diff --git a/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx b/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx index 927464b65ca..fe70e5dcfb5 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/dptDptEfficiencyAndQc.cxx @@ -555,7 +555,7 @@ struct PidDataCollectingEngine { } template - void fillAllSpeciesPID(uint ix, TrackObject const& track, float mom) + void fillAllSpeciesPID(uint ix, TrackObject const& track, float tpcmom, float tofmom) { if (track.sign() < 0) { ix = 2 * ix + 1; @@ -563,8 +563,8 @@ struct PidDataCollectingEngine { ix = 2 * ix; } for (uint when = 0; when < 2; ++when) { - fhTPCnSigmasVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma(track)); - fhTOFnSigmasVsP[when][ix]->Fill(mom, o2::aod::pidutils::tofNSigma(track)); + fhTPCnSigmasVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcNSigma(track)); + fhTOFnSigmasVsP[when][ix]->Fill(tofmom, o2::aod::pidutils::tofNSigma(track)); if (track.trackacceptedid() < 0) { /* track not accepted */ return; @@ -573,7 +573,7 @@ struct PidDataCollectingEngine { } template - void fillSpeciesPID(uint ix, TrackObject const& track, float mom) + void fillSpeciesPID(uint ix, TrackObject const& track, float tpcmom, float tofmom) { if (track.sign() < 0) { ix = 2 * ix + 1; @@ -581,9 +581,9 @@ struct PidDataCollectingEngine { ix = 2 * ix; } for (uint when = 0; when < 2; ++when) { - fhTPCdEdxSignalDiffVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcExpSignalDiff(track)); - fhTOFSignalDiffVsP[when][ix]->Fill(mom, o2::aod::pidutils::tofExpSignalDiff(track)); - fhTPCTOFSigmaVsP[when][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma(track), o2::aod::pidutils::tofNSigma(track)); + fhTPCdEdxSignalDiffVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcExpSignalDiff(track)); + fhTOFSignalDiffVsP[when][ix]->Fill(tofmom, o2::aod::pidutils::tofExpSignalDiff(track)); + fhTPCTOFSigmaVsP[when][ix]->Fill(tpcmom, o2::aod::pidutils::tpcNSigma(track), o2::aod::pidutils::tofNSigma(track)); if (track.trackacceptedid() < 0) { /* track not accepted */ return; @@ -592,12 +592,16 @@ struct PidDataCollectingEngine { } template - void fillPID(TrackObject const& track, float mom) + void fillPID(TrackObject const& track, float tpcmom, float tofmom) { for (uint when = 0; when < 2; ++when) { - fhTPCdEdxSignalVsP[when]->Fill(mom, track.tpcSignal()); - fhTOFSignalVsP[when]->Fill(mom, track.beta()); - fhPvsTOFSqMass[when]->Fill(track.mass() * track.mass(), mom); + if constexpr (framework::has_type_v) { + fhTPCdEdxSignalVsP[when]->Fill(tpcmom, track.mcTunedTPCSignal()); + } else { + fhTPCdEdxSignalVsP[when]->Fill(tpcmom, track.tpcSignal()); + } + fhTOFSignalVsP[when]->Fill(tofmom, track.beta()); + fhPvsTOFSqMass[when]->Fill(track.mass() * track.mass(), tofmom); if (track.trackacceptedid() < 0) { /* track not accepted */ return; @@ -606,20 +610,20 @@ struct PidDataCollectingEngine { } template - void processTrack(TrackObject const& track, float mom) + void processTrack(TrackObject const& track, float tpcmom, float tofmom) { using namespace efficiencyandqatask; if constexpr (kindOfData == kReco) { - fillPID(track, mom); - fillSpeciesPID(0, track, mom); - fillSpeciesPID(1, track, mom); - fillSpeciesPID(2, track, mom); - fillAllSpeciesPID(0, track, mom); - fillAllSpeciesPID(1, track, mom); - fillAllSpeciesPID(2, track, mom); - fillAllSpeciesPID(3, track, mom); - fillAllSpeciesPID(4, track, mom); + fillPID(track, tpcmom, tofmom); + fillSpeciesPID(0, track, tpcmom, tofmom); + fillSpeciesPID(1, track, tpcmom, tofmom); + fillSpeciesPID(2, track, tpcmom, tofmom); + fillAllSpeciesPID(0, track, tpcmom, tofmom); + fillAllSpeciesPID(1, track, tpcmom, tofmom); + fillAllSpeciesPID(2, track, tpcmom, tofmom); + fillAllSpeciesPID(3, track, tpcmom, tofmom); + fillAllSpeciesPID(4, track, tpcmom, tofmom); } } }; @@ -688,7 +692,7 @@ struct PidExtraDataCollectingEngine { } template - void fillAllSpeciesPID(uint ix, TrackObject const& track, float mom) + void fillAllSpeciesPID(uint ix, TrackObject const& track, float tpcmom, float tofmom) { if (track.trackacceptedid() < 0) { /* track not accepted */ @@ -699,46 +703,54 @@ struct PidExtraDataCollectingEngine { } else { ix = 2 * ix; } - fhIdTPCnSigmasVsP[track.trackacceptedid()][ix]->Fill(mom, o2::aod::pidutils::tpcNSigma(track)); - fhIdTOFnSigmasVsP[track.trackacceptedid()][ix]->Fill(mom, o2::aod::pidutils::tofNSigma(track)); + fhIdTPCnSigmasVsP[track.trackacceptedid()][ix]->Fill(tpcmom, o2::aod::pidutils::tpcNSigma(track)); + fhIdTOFnSigmasVsP[track.trackacceptedid()][ix]->Fill(tofmom, o2::aod::pidutils::tofNSigma(track)); if (efficiencyandqatask::pidselector.isGlobalSpecies(track.trackacceptedid() / 2, id)) { /* only if the species of the selected track matches the target of the number of sigmas */ - fpIdTPCdEdxSignalVsPSigmas[track.trackacceptedid()]->Fill(mom, track.tpcSignal(), o2::aod::pidutils::tpcNSigma(track)); - fpIdTOFSignalVsPSigmas[track.trackacceptedid()]->Fill(mom, track.beta(), o2::aod::pidutils::tofNSigma(track)); + if constexpr (framework::has_type_v) { + fpIdTPCdEdxSignalVsPSigmas[track.trackacceptedid()]->Fill(tpcmom, track.mcTunedTPCSignal(), o2::aod::pidutils::tpcNSigma(track)); + } else { + fpIdTPCdEdxSignalVsPSigmas[track.trackacceptedid()]->Fill(tpcmom, track.tpcSignal(), o2::aod::pidutils::tpcNSigma(track)); + } + fpIdTOFSignalVsPSigmas[track.trackacceptedid()]->Fill(tofmom, track.beta(), o2::aod::pidutils::tofNSigma(track)); } } template - void fillSpeciesPID(uint, TrackObject const&, float) + void fillSpeciesPID(uint, TrackObject const&, float, float) { } template - void fillPID(TrackObject const& track, float mom) + void fillPID(TrackObject const& track, float tpcmom, float tofmom) { if (track.trackacceptedid() < 0) { /* track not accepted */ return; } - fhIdTPCdEdxSignalVsP[track.trackacceptedid()]->Fill(mom, track.tpcSignal()); - fhIdTOFSignalVsP[track.trackacceptedid()]->Fill(mom, track.beta()); + if constexpr (framework::has_type_v) { + fhIdTPCdEdxSignalVsP[track.trackacceptedid()]->Fill(tpcmom, track.mcTunedTPCSignal()); + } else { + fhIdTPCdEdxSignalVsP[track.trackacceptedid()]->Fill(tpcmom, track.tpcSignal()); + } + fhIdTOFSignalVsP[track.trackacceptedid()]->Fill(tofmom, track.beta()); } template - void processTrack(TrackObject const& track, float mom) + void processTrack(TrackObject const& track, float tpcmom, float tofmom) { using namespace efficiencyandqatask; if constexpr (kindOfData == kReco) { - fillPID(track, mom); - fillSpeciesPID(0, track, mom); - fillSpeciesPID(1, track, mom); - fillSpeciesPID(2, track, mom); - fillAllSpeciesPID(0, track, mom); - fillAllSpeciesPID(1, track, mom); - fillAllSpeciesPID(2, track, mom); - fillAllSpeciesPID(3, track, mom); - fillAllSpeciesPID(4, track, mom); + fillPID(track, tpcmom, tofmom); + fillSpeciesPID(0, track, tpcmom, tofmom); + fillSpeciesPID(1, track, tpcmom, tofmom); + fillSpeciesPID(2, track, tpcmom, tofmom); + fillAllSpeciesPID(0, track, tpcmom, tofmom); + fillAllSpeciesPID(1, track, tpcmom, tofmom); + fillAllSpeciesPID(2, track, tpcmom, tofmom); + fillAllSpeciesPID(3, track, tpcmom, tofmom); + fillAllSpeciesPID(4, track, tpcmom, tofmom); } } }; @@ -973,20 +985,21 @@ struct DptDptEfficiencyAndQc { int ixDCE = getDCEindex(collision); if (!(ixDCE < 0)) { for (auto const& track : tracks) { - float mom = track.p(); + float tpcmom = track.p(); + float tofmom = track.p(); if (useTPCInnerWallMomentum.value) { if constexpr (!framework::has_type_v) { - mom = track.tpcInnerParam(); + tpcmom = track.tpcInnerParam(); } } if constexpr (kindOfProcess == kBASIC) { qaDataCE[ixDCE]->processTrack(collision.posZ(), track); } if constexpr (kindOfProcess == kPID) { - pidDataCE[ixDCE]->processTrack(track, mom); + pidDataCE[ixDCE]->processTrack(track, tpcmom, tofmom); } if constexpr (kindOfProcess == kPIDEXTRA) { - pidExtraDataCE[ixDCE]->processTrack(track, mom); + pidExtraDataCE[ixDCE]->processTrack(track, tpcmom, tofmom); } } }