diff --git a/Analysis/Tasks/PWGHF/CMakeLists.txt b/Analysis/Tasks/PWGHF/CMakeLists.txt index 37517c72640bf..7f3cd73c73cfb 100644 --- a/Analysis/Tasks/PWGHF/CMakeLists.txt +++ b/Analysis/Tasks/PWGHF/CMakeLists.txt @@ -70,7 +70,7 @@ o2_add_dpl_workflow(hf-lc-candidate-selector o2_add_dpl_workflow(hf-jpsi-toee-candidate-selector SOURCES HFJpsiToEECandidateSelector.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::ALICE3Analysis COMPONENT_NAME Analysis) o2_add_dpl_workflow(hf-xic-topkpi-candidate-selector diff --git a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx index 13afe1ffe232d..440913f408a3f 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx @@ -15,46 +15,75 @@ /// \author Nima Zardoshti , CERN /// \author Vít Kučera , CERN -#include "Framework/runDataProcessing.h" -#include "Framework/AnalysisTask.h" -#include "AnalysisDataModel/HFSecondaryVertex.h" -#include "AnalysisDataModel/HFCandidateSelectionTables.h" +#include "ALICE3Analysis/RICH.h" #include "AnalysisCore/TrackSelectorPID.h" +#include "AnalysisDataModel/HFCandidateSelectionTables.h" +#include "AnalysisDataModel/HFSecondaryVertex.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" using namespace o2; using namespace o2::framework; using namespace o2::aod::hf_cand_prong2; using namespace o2::analysis::hf_cuts_jpsi_toee; +namespace o2::aod { + +namespace indices { +DECLARE_SOA_INDEX_COLUMN(Track, track); +DECLARE_SOA_INDEX_COLUMN(RICH, rich); +} // namespace indices + +DECLARE_SOA_INDEX_TABLE_USER(RICHTracksIndex, Tracks, "RICHTRK", + indices::TrackId, indices::RICHId); +} // namespace o2::aod + +struct RICHindexbuilder { + Builds ind; + void init(o2::framework::InitContext &) {} +}; + /// Struct for applying J/ψ → e+ e− selection cuts struct HFJpsiToEECandidateSelector { Produces hfSelJpsiToEECandidate; - Configurable d_pTCandMin{"d_pTCandMin", 0., "Lower bound of candidate pT"}; - Configurable d_pTCandMax{"d_pTCandMax", 50., "Upper bound of candidate pT"}; + Configurable d_pTCandMin{"d_pTCandMin", 0., + "Lower bound of candidate pT"}; + Configurable d_pTCandMax{"d_pTCandMax", 50., + "Upper bound of candidate pT"}; // TPC - Configurable d_pidTPCMinpT{"d_pidTPCMinpT", 0.15, "Lower bound of track pT for TPC PID"}; - Configurable d_pidTPCMaxpT{"d_pidTPCMaxpT", 10., "Upper bound of track pT for TPC PID"}; + Configurable d_pidTPCMinpT{"d_pidTPCMinpT", 0.15, + "Lower bound of track pT for TPC PID"}; + Configurable d_pidTPCMaxpT{"d_pidTPCMaxpT", 10., + "Upper bound of track pT for TPC PID"}; Configurable d_nSigmaTPC{"d_nSigmaTPC", 3., "Nsigma cut on TPC only"}; - //Configurable d_TPCNClsFindablePIDCut{"d_TPCNClsFindablePIDCut", 70., "Lower bound of TPC findable clusters for good PID"}; + + Configurable d_pidTOFMinpT{"d_pidTOFMinpT", 0.15, + "Lower bound of track pT for TOF PID"}; + Configurable d_pidTOFMaxpT{"d_pidTOFMaxpT", 5., + "Upper bound of track pT for TOF PID"}; + Configurable d_nSigmaTOF{"d_nSigmaTOF", 3., "Nsigma cut on TOF only"}; + + Configurable d_pidRICHMinpT{"d_pidRICHMinpT", 0.15, + "Lower bound of track pT for RICH PID"}; + Configurable d_pidRICHMaxpT{"d_pidRICHMaxpT", 10., + "Upper bound of track pT for RICH PID"}; + Configurable d_nSigmaRICH{"d_nSigmaRICH", 3., + "Nsigma cut on RICH only"}; + Configurable d_nSigmaTOFCombined{ + "d_nSigmaTOFCombined", 5., "Nsigma cut on TOF combined with TPC"}; + // Configurable + // d_TPCNClsFindablePIDCut{"d_TPCNClsFindablePIDCut", 70., "Lower bound of TPC + // findable clusters for good PID"}; // topological cuts - Configurable> pTBins{"pTBins", std::vector{hf_cuts_jpsi_toee::pTBins_v}, "pT bin limits"}; - Configurable> cuts{"Jpsi_to_ee_cuts", {hf_cuts_jpsi_toee::cuts[0], npTBins, nCutVars, pTBinLabels, cutVarLabels}, "Jpsi candidate selection per pT bin"}; - - /* - /// Selection on goodness of daughter tracks - /// \note should be applied at candidate selection - /// \param track is daughter track - /// \return true if track is good - template - bool daughterSelection(const T& track) - { - if (track.tpcNClsFound() == 0) { - return false; //is it clusters findable or found - need to check - } - return true; - } - */ + Configurable> pTBins{ + "pTBins", std::vector{hf_cuts_jpsi_toee::pTBins_v}, + "pT bin limits"}; + Configurable> cuts{ + "Jpsi_to_ee_cuts", + {hf_cuts_jpsi_toee::cuts[0], npTBins, nCutVars, pTBinLabels, + cutVarLabels}, + "Jpsi candidate selection per pT bin"}; /// Conjugate-independent topological cuts /// \param candidate is candidate @@ -62,8 +91,8 @@ struct HFJpsiToEECandidateSelector { /// \param trackElectron is the track with the electron hypothesis /// \return true if candidate passes all cuts template - bool selectionTopol(const T1& candidate, const T2& trackPositron, const T2& trackElectron) - { + bool selectionTopol(const T1 &candidate, const T2 &trackPositron, + const T2 &trackElectron) { auto candpT = candidate.pt(); auto pTBin = findBin(pTBins, candpT); if (pTBin == -1) { @@ -76,55 +105,60 @@ struct HFJpsiToEECandidateSelector { } // cut on invariant mass - if (std::abs(InvMassJpsiToEE(candidate) - RecoDecay::getMassPDG(pdg::Code::kJpsi)) > cuts->get(pTBin, "m")) { + if (std::abs(InvMassJpsiToEE(candidate) - + RecoDecay::getMassPDG(pdg::Code::kJpsi)) > + cuts->get(pTBin, "m")) { return false; } // cut on daughter pT - if (trackElectron.pt() < cuts->get(pTBin, "pT El") || trackPositron.pt() < cuts->get(pTBin, "pT El")) { + if (trackElectron.pt() < cuts->get(pTBin, "pT El") || + trackPositron.pt() < cuts->get(pTBin, "pT El")) { return false; } // cut on daughter DCA - need to add secondary vertex constraint here - if (std::abs(trackElectron.dcaPrim0()) > cuts->get(pTBin, "DCA_xy") || std::abs(trackPositron.dcaPrim0()) > cuts->get(pTBin, "DCA_xy")) { + if (std::abs(trackElectron.dcaPrim0()) > cuts->get(pTBin, "DCA_xy") || + std::abs(trackPositron.dcaPrim0()) > cuts->get(pTBin, "DCA_xy")) { return false; } // cut on daughter DCA - need to add secondary vertex constraint here - if (std::abs(trackElectron.dcaPrim1()) > cuts->get(pTBin, "DCA_z") || std::abs(trackPositron.dcaPrim1()) > cuts->get(pTBin, "DCA_z")) { + if (std::abs(trackElectron.dcaPrim1()) > cuts->get(pTBin, "DCA_z") || + std::abs(trackPositron.dcaPrim1()) > cuts->get(pTBin, "DCA_z")) { return false; } return true; } + template bool validRICHPID(const T &track) { + if (track.pt() < d_pidRICHMinpT || track.pt() >= d_pidRICHMaxpT) { + return false; + } + return true; + } - void process(aod::HfCandProng2 const& candidates, aod::BigTracksPID const&) - { + using Trks = soa::Join; + void process(aod::HfCandProng2 const &candidates, const Trks &tracks, + aod::RICHs const &) { TrackSelectorPID selectorElectron(kElectron); - selectorElectron.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); - selectorElectron.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); - + selectorElectron.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); + selectorElectron.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); + selectorElectron.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, + d_nSigmaTOFCombined); // looping over 2-prong candidates - for (auto& candidate : candidates) { + for (auto &candidate : candidates) { - auto trackPos = candidate.index0_as(); // positive daughter - auto trackNeg = candidate.index1_as(); // negative daughter + auto trackPos = candidate.index0_as(); // positive daughter + auto trackNeg = candidate.index1_as(); // negative daughter if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE)) { hfSelJpsiToEECandidate(0); continue; } - /* - // daughter track validity selection - if (!daughterSelection(trackPos) || !daughterSelection(trackNeg)) { - hfSelJpsiToEECandidate(0); - continue; - } - */ - - // implement filter bit 4 cut - should be done before this task at the track selection level - // need to add special cuts (additional cuts on decay length and d0 norm) + // track selection level need to add special cuts (additional cuts on + // decay length and d0 norm) if (!selectionTopol(candidate, trackPos, trackNeg)) { hfSelJpsiToEECandidate(0); @@ -132,19 +166,44 @@ struct HFJpsiToEECandidateSelector { } // track-level PID selection - if (selectorElectron.getStatusTrackPIDTPC(trackPos) == TrackSelectorPID::Status::PIDRejected || - selectorElectron.getStatusTrackPIDTPC(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + if (selectorElectron.getStatusTrackPIDTOF(trackPos) == + TrackSelectorPID::Status::PIDRejected || + selectorElectron.getStatusTrackPIDTOF(trackNeg) == + TrackSelectorPID::Status::PIDRejected) { hfSelJpsiToEECandidate(0); continue; } + bool pidrichPos = validRICHPID(trackPos); + bool pidrichNeg = validRICHPID(trackNeg); + if (pidrichPos && pidrichNeg) { + // LOGF(info, "both good rich tracks"); + } + + // LOGF(info, "cut %f, val pos %f, val neg %f", d_nSigmaRICH, + // trackPos.rich().richNsigmaEl(), trackNeg.rich().richNsigmaEl()); + if (pidrichPos && pidrichNeg) { + bool selpidrichPos = abs(trackPos.rich().richNsigmaEl()) < d_nSigmaRICH; + bool selpidrichNeg = abs(trackNeg.rich().richNsigmaEl()) < d_nSigmaRICH; + // LOGF(info, "pos %d, neg %d", selpidrichPos, selpidrichNeg); + bool selpidrich = selpidrichPos && selpidrichNeg; + if (selpidrich) { + // LOGF(info, "both sel rich tracks"); + } + if (!selpidrich) { + hfSelJpsiToEECandidate(0); + // LOGF(info, "not selectedtracks"); + continue; + } + } + hfSelJpsiToEECandidate(1); } } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"hf-jpsi-toee-candidate-selector"})}; +WorkflowSpec defineDataProcessing(ConfigContext const &cfgc) { + return WorkflowSpec{adaptAnalysisTask(cfgc), + adaptAnalysisTask( + cfgc, TaskName{"hf-jpsi-toee-candidate-selector"})}; } diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index fe395c8dcf6a7..38510ecba43c9 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -38,9 +38,9 @@ void customize(std::vector& workflowOptions) struct TaskJpsi { HistogramRegistry registry{ "registry", - {{"hptcand", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"hptprong0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"hptprong1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}}}; + {{"hptcand", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 20.}}}}, + {"hptprong0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 20.}}}}, + {"hptprong1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 20.}}}}}}; Configurable d_selectionFlagJpsi{"d_selectionFlagJpsi", 1, "Selection Flag for Jpsi"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; @@ -96,10 +96,10 @@ struct TaskJpsi { struct TaskJpsiMC { HistogramRegistry registry{ "registry", - {{"hPtRecSig", "2-prong candidates (rec. matched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"hPtRecBg", "2-prong candidates (rec. unmatched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"hPtGen", "2-prong candidates (gen. matched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"hPtGenSig", "2-prong candidates (rec. matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {{"hPtRecSig", "2-prong candidates (rec. matched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 20.}}}}, + {"hPtRecBg", "2-prong candidates (rec. unmatched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 20.}}}}, + {"hPtGen", "2-prong candidates (gen. matched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 20.}}}}, + {"hPtGenSig", "2-prong candidates (rec. matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 20.}}}}, {"hCPARecSig", "2-prong candidates (rec. matched);cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, {"hCPARecBg", "2-prong candidates (rec. unmatched);cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, {"hEtaRecSig", "2-prong candidates (rec. matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}},