diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h b/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h index c8d231a401fae..429acaf5e1879 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h @@ -25,9 +25,10 @@ namespace o2::aod { namespace hf_selcandidate_lc { -DECLARE_SOA_COLUMN(IsSelLc, isSelLc, int); +DECLARE_SOA_COLUMN(IsSelLcpKpi, isSelLcpKpi, int); +DECLARE_SOA_COLUMN(IsSelLcpiKp, isSelLcpiKp, int); } // namespace hf_selcandidate_lc -DECLARE_SOA_TABLE(HFSelLcCandidate, "AOD", "HFSELLCCAND", hf_selcandidate_lc::IsSelLc); +DECLARE_SOA_TABLE(HFSelLcCandidate, "AOD", "HFSELLCCAND", hf_selcandidate_lc::IsSelLcpKpi, hf_selcandidate_lc::IsSelLcpiKp); } // namespace o2::aod #endif // O2_ANALYSIS_HFCANDIDATESELECTIONTABLES_H_ diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h index 9c452f4c25c28..a45c184044966 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h @@ -234,6 +234,7 @@ DECLARE_SOA_TABLE(HfCandProng2Base, "AOD", "HFCANDP2BASE", hf_cand::ImpactParameter0, hf_cand::ImpactParameter1, hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, hf_track_index::Index0Id, hf_track_index::Index1Id, + hf_track_index::HFflag, /* dynamic columns */ hf_cand_prong2::M, hf_cand_prong2::M2, @@ -340,10 +341,16 @@ auto ELc(const T& candidate) } template -auto InvMassLc(const T& candidate) +auto InvMassLcpKpi(const T& candidate) { return candidate.m(array{RecoDecay::getMassPDG(kProton), RecoDecay::getMassPDG(kKPlus), RecoDecay::getMassPDG(kPiPlus)}); } + +template +auto InvMassLcpiKp(const T& candidate) +{ + return candidate.m(array{RecoDecay::getMassPDG(kPiPlus), RecoDecay::getMassPDG(kKPlus), RecoDecay::getMassPDG(kProton)}); +} } // namespace hf_cand_prong3 // 3-prong decay candidate table @@ -357,6 +364,7 @@ DECLARE_SOA_TABLE(HfCandProng3Base, "AOD", "HFCANDP3BASE", hf_cand::ImpactParameter0, hf_cand::ImpactParameter1, hf_cand::ImpactParameter2, hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, hf_cand::ErrorImpactParameter2, hf_track_index::Index0Id, hf_track_index::Index1Id, hf_track_index::Index2Id, + hf_track_index::HFflag, /* dynamic columns */ hf_cand_prong3::M, hf_cand_prong3::M2, diff --git a/Analysis/Tasks/PWGHF/HFCandidateCreator2Prong.cxx b/Analysis/Tasks/PWGHF/HFCandidateCreator2Prong.cxx index ee3a8a9c7d1ba..6f6863ac2e77e 100644 --- a/Analysis/Tasks/PWGHF/HFCandidateCreator2Prong.cxx +++ b/Analysis/Tasks/PWGHF/HFCandidateCreator2Prong.cxx @@ -115,7 +115,8 @@ struct HFCandidateCreator2Prong { pvec1[0], pvec1[1], pvec1[2], impactParameter0.getY(), impactParameter1.getY(), std::sqrt(impactParameter0.getSigmaY2()), std::sqrt(impactParameter1.getSigmaY2()), - rowTrackIndexProng2.index0Id(), rowTrackIndexProng2.index1Id()); + rowTrackIndexProng2.index0Id(), rowTrackIndexProng2.index1Id(), + rowTrackIndexProng2.hfflag()); // fill histograms if (b_dovalplots) { diff --git a/Analysis/Tasks/PWGHF/HFCandidateCreator3Prong.cxx b/Analysis/Tasks/PWGHF/HFCandidateCreator3Prong.cxx index a64ff6adfcc89..3053da869fb9f 100644 --- a/Analysis/Tasks/PWGHF/HFCandidateCreator3Prong.cxx +++ b/Analysis/Tasks/PWGHF/HFCandidateCreator3Prong.cxx @@ -121,7 +121,8 @@ struct HFCandidateCreator3Prong { pvec2[0], pvec2[1], pvec2[2], impactParameter0.getY(), impactParameter1.getY(), impactParameter2.getY(), std::sqrt(impactParameter0.getSigmaY2()), std::sqrt(impactParameter1.getSigmaY2()), std::sqrt(impactParameter2.getSigmaY2()), - rowTrackIndexProng3.index0Id(), rowTrackIndexProng3.index1Id(), rowTrackIndexProng3.index2Id()); + rowTrackIndexProng3.index0Id(), rowTrackIndexProng3.index1Id(), rowTrackIndexProng3.index2Id(), + rowTrackIndexProng3.hfflag()); // fill histograms if (b_dovalplots) { diff --git a/Analysis/Tasks/PWGHF/HFD0CandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFD0CandidateSelector.cxx index 77c61d0f68d09..59d11b4291eac 100644 --- a/Analysis/Tasks/PWGHF/HFD0CandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFD0CandidateSelector.cxx @@ -177,7 +177,7 @@ struct HFD0CandidateSelector { } } - if (TMath::Abs(trackPion.pt()) < TMath::Abs(cuts[pTBin][4]) || TMath::Abs(trackKaon.pt()) < TMath::Abs(cuts[pTBin][3])) { + if (trackPion.pt() < cuts[pTBin][4] || trackKaon.pt() < cuts[pTBin][3]) { return false; //cut on daughter pT } if (TMath::Abs(trackPion.dcaPrim0()) > cuts[pTBin][6] || TMath::Abs(trackKaon.dcaPrim0()) > cuts[pTBin][5]) { diff --git a/Analysis/Tasks/PWGHF/HFLcCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFLcCandidateSelector.cxx index f2d2b22ad880d..d4fe99f1cb21f 100644 --- a/Analysis/Tasks/PWGHF/HFLcCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFLcCandidateSelector.cxx @@ -11,7 +11,7 @@ /// \file HFD0CandidateSelector.cxx /// \brief Lc->pKpi selection task. /// -/// \author Luigi Dello Stritto , CERN +/// \author Luigi Dello Stritto , University and INFN SALERNO /// \author Nima Zardoshti , CERN #include "Framework/runDataProcessing.h" @@ -27,19 +27,18 @@ static const int npTBins = 10; static const int nCutVars = 8; //temporary until 2D array in configurable is solved - then move to json //m ptp ptk ptpi DCA sigmavtx dlenght cosp -constexpr double cuts[npTBins][nCutVars] = {{0.5, 0.2, 0.2, 0.2, 0.05, 0.09, 0.005, 0.}, /* pt<1 */ - {0.5, 0.2, 0.2, 0.2, 0.05, 0.09, 0.005, 0.}, /* 1 hfSelLcCandidate; @@ -107,15 +106,16 @@ struct HFLcCandidateSelector { if (candpT < d_pTCandMin || candpT >= d_pTCandMax) { return false; //check that the candidate pT is within the analysis range } + if (hfCandProng3.cpa() <= cuts[pTBin][7]) { return false; //cosine of pointing angle } - // if (hfCandProng3.dca() > cuts[pTBin][4]) return false; //candidate DCA - if (hfCandProng3.chi2PCA() > cuts[pTBin][5]) { //candidate DCA + + /* if (hfCandProng3.chi2PCA() > cuts[pTBin][5]) { //candidate DCA return false; - } + }*/ - if (hfCandProng3.decayLength() * hfCandProng3.decayLength() < cuts[pTBin][6] * cuts[pTBin][6]) { + if (hfCandProng3.decayLength() <= cuts[pTBin][6]) { return false; } return true; @@ -126,7 +126,6 @@ struct HFLcCandidateSelector { /// \param trackProton is the track with the proton hypothesis /// \param trackPion is the track with the pion hypothesis /// \param trackKaon is the track with the kaon hypothesis - /// \note trackPion = positive and trackKaon = negative for D0 selection and inverse for D0bar /// \return true if candidate passes all cuts for the given Conjugate template bool selectionTopolConjugate(const T1& hfCandProng3, const T2& trackProton, const T2& trackKaon, const T2& trackPion) @@ -138,18 +137,19 @@ struct HFLcCandidateSelector { return false; } - //invariant mass cut - if (TMath::Abs(InvMassLc(hfCandProng3) - RecoDecay::getMassPDG(4122)) > cuts[pTBin][0]) { - return false; - } - - if (TMath::Abs(trackProton.pt()) < TMath::Abs(cuts[pTBin][1]) || TMath::Abs(trackKaon.pt()) < TMath::Abs(cuts[pTBin][2]) || TMath::Abs(trackPion.pt()) < TMath::Abs(cuts[pTBin][3])) { + if (trackProton.pt() < cuts[pTBin][1] || trackKaon.pt() < cuts[pTBin][2] || trackPion.pt() < cuts[pTBin][3]) { return false; //cut on daughter pT } - /* if (TMath::Sqrt( trackProton.dcaPrim0()*trackProton.dcaPrim0() + trackKaon.dcaPrim0()*trackKaon.dcaPrim0() + trackPion.dcaPrim0()*trackPion.dcaPrim0() ) > cuts[pTBin][5]) { - return false; //cut on daughter dca - need to add secondary vertex constraint here - }*/ + if (trackProton.globalIndex() == hfCandProng3.index0Id()) { + if (TMath::Abs(InvMassLcpKpi(hfCandProng3) - RecoDecay::getMassPDG(4122)) > cuts[pTBin][0]) { + return false; + } + } else { + if (TMath::Abs(InvMassLcpiKp(hfCandProng3) - RecoDecay::getMassPDG(4122)) > cuts[pTBin][0]) { + return false; + } + } return true; } @@ -190,9 +190,9 @@ struct HFLcCandidateSelector { template bool selectionPIDTPC(const T& track, int nPDG, int nSigmaCut) { - double nSigma = 100.0; //arbitarily large value + double nSigma = 1.0; //arbitarily large value nPDG = TMath::Abs(nPDG); - if (nPDG == 2212) { + /* if (nPDG == 2212) { nSigma = track.tpcNSigmaPr(); } else if (nPDG == 321) { nSigma = track.tpcNSigmaKa(); @@ -200,7 +200,7 @@ struct HFLcCandidateSelector { nSigma = track.tpcNSigmaPi(); } else { return false; - } + }*/ return nSigma < nSigmaCut; } @@ -213,9 +213,9 @@ struct HFLcCandidateSelector { template bool selectionPIDTOF(const T& track, int nPDG, int nSigmaCut) { - double nSigma = 100.0; //arbitarily large value + double nSigma = 1.; //arbitarily large value nPDG = TMath::Abs(nPDG); - if (nPDG == 2212) { + /* if (nPDG == 2212) { nSigma = track.tofNSigmaPr(); } else if (nPDG == 321) { nSigma = track.tofNSigmaKa(); @@ -223,7 +223,7 @@ struct HFLcCandidateSelector { nSigma = track.tofNSigmaPi(); } else { return false; - } + }*/ return nSigma < nSigmaCut; } @@ -279,18 +279,27 @@ struct HFLcCandidateSelector { void process(aod::HfCandProng3 const& hfCandProng3s, aod::BigTracksPID const& tracks) { - int statusLc; // final selection flag : 0-rejected 1-accepted - bool topolLc; + int statusLcpKpi, statusLcpiKp; // final selection flag : 0-rejected 1-accepted + bool topolLcpKpi, topolLcpiKp; int pidLc, proton, kaonMinus, pionPlus; for (auto& hfCandProng3 : hfCandProng3s) { //looping over 3 prong candidates - auto trackPos1 = hfCandProng3.index0_as(); //positive daughter - auto trackNeg1 = hfCandProng3.index1_as(); //negative daughter - auto trackPos2 = hfCandProng3.index2_as(); //positive daughter + statusLcpKpi = 0; + statusLcpiKp = 0; + int LcFlag = hfCandProng3.hfflag(); - statusLc = 0; - topolLc = true; + if (!(LcFlag & 1 << 1)) { + hfSelLcCandidate(statusLcpKpi, statusLcpiKp); + continue; + } + + auto trackPos1 = hfCandProng3.index0_as(); //positive daughter (negative for the antiparticles) + auto trackNeg1 = hfCandProng3.index1_as(); //negative daughter (positive for the antiparticles) + auto trackPos2 = hfCandProng3.index2_as(); //positive daughter (negative for the antiparticles) + + topolLcpKpi = true; + topolLcpiKp = true; pidLc = -1; proton = -1; kaonMinus = -1; @@ -298,7 +307,7 @@ struct HFLcCandidateSelector { // daughter track validity selection if (!daughterSelection(trackPos1) || !daughterSelection(trackNeg1) || !daughterSelection(trackPos2)) { - hfSelLcCandidate(statusLc); + hfSelLcCandidate(statusLcpKpi, statusLcpiKp); continue; } @@ -306,15 +315,17 @@ struct HFLcCandidateSelector { //conjugate independent topological selection if (!selectionTopol(hfCandProng3)) { - hfSelLcCandidate(statusLc); + hfSelLcCandidate(statusLcpKpi, statusLcpiKp); continue; } //conjugate dependent toplogical selection for Lc - topolLc = selectionTopolConjugate(hfCandProng3, trackPos1, trackNeg1, trackPos2); - if (!topolLc) { - hfSelLcCandidate(statusLc); + topolLcpKpi = selectionTopolConjugate(hfCandProng3, trackPos1, trackNeg1, trackPos2); + topolLcpiKp = selectionTopolConjugate(hfCandProng3, trackPos2, trackNeg1, trackPos1); + + if (!topolLcpKpi && !topolLcpiKp) { + hfSelLcCandidate(statusLcpKpi, statusLcpiKp); continue; } @@ -330,15 +341,18 @@ struct HFLcCandidateSelector { } if (pidLc == 0) { - hfSelLcCandidate(statusLc); + hfSelLcCandidate(statusLcpKpi, statusLcpiKp); continue; } - if ((pidLc == -1 || pidLc == 1) && topolLc) { - statusLc = 1; //identified as Lc + if ((pidLc == -1 || pidLc == 1) && topolLcpKpi) { + statusLcpKpi = 1; //identified as Lc + } + if ((pidLc == -1 || pidLc == 1) && topolLcpiKp) { + statusLcpiKp = 1; //identified as Lc } - hfSelLcCandidate(statusLc); + hfSelLcCandidate(statusLcpKpi, statusLcpiKp); } } }; diff --git a/Analysis/Tasks/PWGHF/taskLc.cxx b/Analysis/Tasks/PWGHF/taskLc.cxx index 2fa3bd1d348e6..ebf91b37889d0 100644 --- a/Analysis/Tasks/PWGHF/taskLc.cxx +++ b/Analysis/Tasks/PWGHF/taskLc.cxx @@ -8,14 +8,15 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file taskDPlus.cxx -/// \brief D± analysis task +/// \file taskLc.cxx +/// \brief Lc± analysis task /// \note Extended from taskD0 /// +/// \author Luigi Dello Stritto , University and INFN SALERNO /// \author Vít Kučera , CERN -#include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" #include "AnalysisDataModel/HFSecondaryVertex.h" #include "AnalysisDataModel/HFCandidateSelectionTables.h" @@ -24,61 +25,139 @@ using namespace o2::framework; using namespace o2::aod::hf_cand_prong3; using namespace o2::framework::expressions; -/// Lc+ analysis task +void customize(std::vector& workflowOptions) +{ + ConfigParamSpec optionDoMC{"doMC", VariantType::Bool, false, {"Fill MC histograms."}}; + workflowOptions.push_back(optionDoMC); +} + +#include "Framework/runDataProcessing.h" + +/// Lc± analysis task struct TaskLc { - OutputObj hmass{TH1F("hmass", "3-prong candidates;inv. mass (#pi K #pi) (GeV/#it{c}^{2});entries", 500, 1.6, 3.1)}; - OutputObj hptcand{TH1F("hptcand", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", 100, 0., 10.)}; - OutputObj hptprong0{TH1F("hptprong0", "3-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", 100, 0., 10.)}; - OutputObj hptprong1{TH1F("hptprong1", "3-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", 100, 0., 10.)}; - OutputObj hptprong2{TH1F("hptprong2", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", 100, 0., 10.)}; - OutputObj hdeclength{TH1F("declength", "3-prong candidates;decay length (cm);entries", 200, 0., 2.)}; - OutputObj hd0Prong0{TH1F("hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", 100, -1., 1.)}; - OutputObj hd0Prong1{TH1F("hd0Prong1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", 100, -1., 1.)}; - OutputObj hd0Prong2{TH1F("hd0Prong2", "3-prong candidates;prong 2 DCAxy to prim. vertex (cm);entries", 100, -1., 1.)}; - OutputObj hCt{TH1F("hCt", "3-prong candidates;proper lifetime (D^{#pm}) * #it{c} (cm);entries", 120, -20., 100.)}; - OutputObj hCPA{TH1F("hCPA", "3-prong candidates;cosine of pointing angle;entries", 110, -1.1, 1.1)}; - OutputObj hEta{TH1F("hEta", "3-prong candidates;candidate #it{#eta};entries", 100, -2., 2.)}; - //OutputObj hselectionstatus{TH1F("selectionstatus", "3-prong candidates;selection status;entries", 5, -0.5, 4.5)}; - OutputObj hImpParErr{TH1F("hImpParErr", "3-prong candidates;impact parameter error (cm);entries", 100, -1., 1.)}; - OutputObj hDecLenErr{TH1F("hDecLenErr", "3-prong candidates;decay length error (cm);entries", 100, 0., 1.)}; - //OutputObj hdca{TH1F("hdca", "3-prong candidates;prongs DCA to prim. vertex (cm);entries", 100, -1., 1.)}; - OutputObj hdca2{TH1F("hdca2", "3-prong candidates;prongs DCA to sec. vertex (cm);entries", 100, 0., 1.)}; + HistogramRegistry registry{ + "registry", + {{"hmass", "3-prong candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}}, + {"hptcand", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {"hptprong0", "3-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {"hptprong1", "3-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {"hptprong2", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {"hdeclength", "3-prong candidates;decay length (cm);entries", {HistType::kTH1F, {{400, -2., 2.}}}}, + {"hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, + {"hd0Prong1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, + {"hd0Prong2", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, + {"hCt", "3-prong candidates;proper lifetime (#Lambda_{c}) * #it{c} (cm);entries", {HistType::kTH1F, {{120, -20., 100.}}}}, + {"hCPA", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, + {"hEta", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + {"hselectionstatus", "3-prong candidates;selection status;entries", {HistType::kTH1F, {{5, -0.5, 4.5}}}}, + {"hImpParErr", "3-prong candidates;impact parameter error (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, + {"hDecLenErr", "3-prong candidates;decay length error (cm);entries", {HistType::kTH1F, {{100, 0., 1.}}}}, + {"hdca2", "3-prong candidates;prong DCA to sec. vertex (cm);entries", {HistType::kTH1F, {{100, 0., 1.}}}}}}; Configurable d_selectionFlagLc{"d_selectionFlagLc", 1, "Selection Flag for Lc"}; + Configurable cutEtaCandMax{"cutEtaCandMax", -1., "max. cand. pseudorapidity"}; - Filter filterSelectCandidates = (aod::hf_selcandidate_lc::isSelLc >= d_selectionFlagLc); + Filter filterSelectCandidates = (aod::hf_selcandidate_lc::isSelLcpKpi >= d_selectionFlagLc || aod::hf_selcandidate_lc::isSelLcpiKp >= d_selectionFlagLc); //void process(aod::HfCandProng3 const& candidates) void process(soa::Filtered> const& candidates) { for (auto& candidate : candidates) { - if (candidate.isSelLc() >= d_selectionFlagLc) { - hmass->Fill(InvMassLc(candidate)); + /* if (candidate.pt()>5){ + continue;}*/ + if (cutEtaCandMax >= 0. && std::abs(candidate.eta()) > cutEtaCandMax) { + //Printf("Candidate: eta rejection: %g", candidate.eta()); + continue; + } + if (candidate.isSelLcpKpi() >= d_selectionFlagLc) { + registry.get("hmass")->Fill(InvMassLcpKpi(candidate)); + } + if (candidate.isSelLcpiKp() >= d_selectionFlagLc) { + registry.get("hmass")->Fill(InvMassLcpiKp(candidate)); + } + registry.get("hptcand")->Fill(candidate.pt()); + registry.get("hptprong0")->Fill(candidate.ptProng0()); + registry.get("hptprong1")->Fill(candidate.ptProng1()); + registry.get("hptprong2")->Fill(candidate.ptProng2()); + registry.get("hdeclength")->Fill(candidate.decayLength()); + registry.get("hd0Prong0")->Fill(candidate.impactParameter0()); + registry.get("hd0Prong1")->Fill(candidate.impactParameter1()); + registry.get("hd0Prong2")->Fill(candidate.impactParameter2()); + registry.get("hCt")->Fill(CtLc(candidate)); + registry.get("hCPA")->Fill(candidate.cpa()); + registry.get("hEta")->Fill(candidate.eta()); + registry.get("hselectionstatus")->Fill(candidate.isSelLcpKpi()); + registry.get("hselectionstatus")->Fill(candidate.isSelLcpiKp()); + registry.get("hImpParErr")->Fill(candidate.errorImpactParameter0()); + registry.get("hImpParErr")->Fill(candidate.errorImpactParameter1()); + registry.get("hImpParErr")->Fill(candidate.errorImpactParameter2()); + registry.get("hDecLenErr")->Fill(candidate.errorDecayLength()); + registry.get("hDecLenErr")->Fill(candidate.chi2PCA()); + } + } +}; + +/// Fills MC histograms. +struct TaskLcMC { + HistogramRegistry registry{ + "registry", + {{"hPtRecSig", "3-prong candidates (rec. matched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {"hPtRecBg", "3-prong candidates (rec. unmatched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {"hPtGen", "3-prong candidates (gen. matched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {"hCPARecSig", "3-prong candidates (rec. matched);cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, + {"hCPARecBg", "3-prong candidates (rec. unmatched);cosine of pointing angle;entries", {HistType::kTH1F, {{110, -1.1, 1.1}}}}, + {"hEtaRecSig", "3-prong candidates (rec. matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + {"hEtaRecBg", "3-prong candidates (rec. unmatched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, + {"hEtaGen", "3-prong candidates (gen. matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}}}; + + Configurable d_selectionFlagLc{"d_selectionFlagLc", 1, "Selection Flag for Lc"}; + Configurable d_selectionFlagLcbar{"d_selectionFlagLcbar", 1, "Selection Flag for Lcbar"}; + Configurable cutEtaCandMax{"cutEtaCandMax", -1., "max. cand. pseudorapidity"}; + + Filter filterSelectCandidates = (aod::hf_selcandidate_lc::isSelLcpKpi >= d_selectionFlagLc || aod::hf_selcandidate_lc::isSelLcpiKp >= d_selectionFlagLc); + + void process(soa::Filtered> const& candidates, + soa::Join const& particlesMC) + { + // MC rec. + //Printf("MC Candidates: %d", candidates.size()); + for (auto& candidate : candidates) { + if (cutEtaCandMax >= 0. && std::abs(candidate.eta()) > cutEtaCandMax) { + //Printf("MC Rec.: eta rejection: %g", candidate.eta()); + continue; + } + if (std::abs(candidate.flagMCMatchRec()) == LcToPKPi) { + registry.get("hPtRecSig")->Fill(candidate.pt()); + registry.get("hCPARecSig")->Fill(candidate.cpa()); + registry.get("hEtaRecSig")->Fill(candidate.eta()); + } else { + registry.get("hPtRecBg")->Fill(candidate.pt()); + registry.get("hCPARecBg")->Fill(candidate.cpa()); + registry.get("hEtaRecBg")->Fill(candidate.eta()); + } + } + // MC gen. + //Printf("MC Particles: %d", particlesMC.size()); + for (auto& particle : particlesMC) { + if (cutEtaCandMax >= 0. && std::abs(particle.eta()) > cutEtaCandMax) { + //Printf("MC Gen.: eta rejection: %g", particle.eta()); + continue; + } + if (std::abs(particle.flagMCMatchGen()) == LcToPKPi) { + registry.get("hPtGen")->Fill(particle.pt()); + registry.get("hEtaGen")->Fill(particle.eta()); } - hptcand->Fill(candidate.pt()); - hptprong0->Fill(candidate.ptProng0()); - hptprong1->Fill(candidate.ptProng1()); - hptprong2->Fill(candidate.ptProng2()); - hdeclength->Fill(candidate.decayLength()); - hd0Prong0->Fill(candidate.impactParameter0()); - hd0Prong1->Fill(candidate.impactParameter1()); - hd0Prong2->Fill(candidate.impactParameter2()); - hCt->Fill(CtLc(candidate)); - hCPA->Fill(candidate.cpa()); - hEta->Fill(candidate.eta()); - //hselectionstatus->Fill(candidate.isSelLc()); - hImpParErr->Fill(candidate.errorImpactParameter0()); - hImpParErr->Fill(candidate.errorImpactParameter1()); - hImpParErr->Fill(candidate.errorImpactParameter2()); - hDecLenErr->Fill(candidate.errorDecayLength()); - // hdca->Fill(candidate.dca()); - hdca2->Fill(candidate.chi2PCA()); } } }; -WorkflowSpec defineDataProcessing(ConfigContext const&) +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{ + WorkflowSpec workflow{ adaptAnalysisTask("hf-task-lc")}; + const bool doMC = cfgc.options().get("doMC"); + if (doMC) { + workflow.push_back(adaptAnalysisTask("hf-task-lc-mc")); + } + return workflow; }