From 47051a59a650499e39aa833e82ed7ff51eaab5e0 Mon Sep 17 00:00:00 2001 From: rspijkers Date: Thu, 1 Apr 2021 11:58:12 +0200 Subject: [PATCH 01/43] first version of X candidate creator add validation plots to X cand creator remove collision table from Xtask added a whole bunch of histo's to Xtask Add first working version of MC matching Add gen. MC matching for Jpsi -> ee --- .../AnalysisDataModel/HFSecondaryVertex.h | 166 ++++++++++ Analysis/Tasks/PWGHF/CMakeLists.txt | 5 + Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx | 300 ++++++++++++++++++ Analysis/Tasks/PWGHF/taskX.cxx | 194 ++++++++--- 4 files changed, 626 insertions(+), 39 deletions(-) create mode 100644 Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h index df8d4b8c48d71..b13a05cc8a5bd 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h @@ -316,6 +316,7 @@ auto InvMassJpsiToEE(const T& candidate) // 2-prong decay candidate table DECLARE_SOA_TABLE(HfCandProng2Base, "AOD", "HFCANDP2BASE", //! + o2::soa::Index<>, // general columns HFCAND_COLUMNS, // 2-prong specific columns @@ -586,6 +587,33 @@ auto InvMassXicToPiKP(const T& candidate) { return InvMassLcpiKp(candidate); } + +// X → Jpsi π+ π- +// TODO: add pdg code for X (9920443), temporarily hardcode mass here: +float massX = 3.872; // replace this with: "RecoDecay::getMassPDG(9920443)" when pdg is added +template +auto CtX(const T& candidate) +{ + return candidate.ct(massX); +} + +template +auto YX(const T& candidate) +{ + return candidate.y(massX); +} + +template +auto EX(const T& candidate) +{ + return candidate.e(massX); +} +template +auto InvMassXToJpsiPiPi(const T& candidate) +{ + return candidate.m(array{RecoDecay::getMassPDG(443), RecoDecay::getMassPDG(kPiPlus), RecoDecay::getMassPDG(kPiPlus)}); +} + } // namespace hf_cand_prong3 // 3-prong decay candidate table @@ -644,6 +672,144 @@ DECLARE_SOA_TABLE(HfCandProng3MCGen, "AOD", "HFCANDP3MCGEN", //! hf_cand_prong3::OriginMCGen, hf_cand_prong3::FlagMCDecayChanGen); +// specific X candidate properties +namespace hf_cand_x +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Index0, index0, int, HfCandProng2, "_0"); // Jpsi index +// MC matching result: +DECLARE_SOA_COLUMN(FlagMCMatchRec, flagMCMatchRec, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagMCMatchGen, flagMCMatchGen, int8_t); // generator level +DECLARE_SOA_COLUMN(OriginMCRec, originMCRec, int8_t); // particle origin, reconstruction level +DECLARE_SOA_COLUMN(OriginMCGen, originMCGen, int8_t); // particle origin, generator level +DECLARE_SOA_COLUMN(FlagMCDecayChanRec, flagMCDecayChanRec, int8_t); // resonant decay channel flag, reconstruction level +DECLARE_SOA_COLUMN(FlagMCDecayChanGen, flagMCDecayChanGen, int8_t); // resonant decay channel flag, generator level +// mapping of decay types +enum DecayType { XToJpsiPiPi = 0 }; // move this to a dedicated cascade namespace in the future? +} // namespace hf_cand_x + +// declare dedicated X candidate table +DECLARE_SOA_TABLE(HfCandXBase, "AOD", "HFCANDXBASE", + // general columns + HFCAND_COLUMNS, + // 3-prong specific columns + hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, + hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, + hf_cand::PxProng2, hf_cand::PyProng2, hf_cand::PzProng2, + hf_cand::ImpactParameter0, hf_cand::ImpactParameter1, hf_cand::ImpactParameter2, + hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, hf_cand::ErrorImpactParameter2, + hf_cand_x::Index0Id, hf_track_index::Index1Id, hf_track_index::Index2Id, // note the difference between Jpsi and pion indices + hf_track_index::HFflag, + /* dynamic columns */ + hf_cand_prong3::M, + hf_cand_prong3::M2, + /* prong 2 */ + hf_cand::PtProng2, + hf_cand::Pt2Prong2, + hf_cand::PVectorProng2, + /* dynamic columns that use candidate momentum components */ + hf_cand::Pt, + hf_cand::Pt2, + hf_cand::P, + hf_cand::P2, + hf_cand::PVector, + hf_cand::CPA, + hf_cand::CPAXY, + hf_cand::Ct, + hf_cand::ImpactParameterXY, + hf_cand_prong3::MaxNormalisedDeltaIP, + hf_cand::Eta, + hf_cand::Phi, + hf_cand::Y, + hf_cand::E, + hf_cand::E2); + +// extended table with expression columns that can be used as arguments of dynamic columns +DECLARE_SOA_EXTENDED_TABLE_USER(HfCandXExt, HfCandXBase, "HFCANDXEXT", + hf_cand_prong3::Px, hf_cand_prong3::Py, hf_cand_prong3::Pz); + +using HfCandX = HfCandXExt; + +// table with results of reconstruction level MC matching +DECLARE_SOA_TABLE(HfCandXMCRec, "AOD", "HFCANDXMCREC", //! + hf_cand_x::FlagMCMatchRec, + hf_cand_x::OriginMCRec, + hf_cand_x::FlagMCDecayChanRec); + +// table with results of generator level MC matching +DECLARE_SOA_TABLE(HfCandXMCGen, "AOD", "HFCANDXMCGEN", //! + hf_cand_x::FlagMCMatchGen, + hf_cand_x::OriginMCGen, + hf_cand_x::FlagMCDecayChanGen); + +// specific X candidate properties +namespace hf_cand_x +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Index0, index0, int, HfCandProng2, "_0"); // Jpsi index +// MC matching result: +DECLARE_SOA_COLUMN(FlagMCMatchRec, flagMCMatchRec, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagMCMatchGen, flagMCMatchGen, int8_t); // generator level +DECLARE_SOA_COLUMN(OriginMCRec, originMCRec, int8_t); // particle origin, reconstruction level +DECLARE_SOA_COLUMN(OriginMCGen, originMCGen, int8_t); // particle origin, generator level +DECLARE_SOA_COLUMN(FlagMCDecayChanRec, flagMCDecayChanRec, int8_t); // resonant decay channel flag, reconstruction level +DECLARE_SOA_COLUMN(FlagMCDecayChanGen, flagMCDecayChanGen, int8_t); // resonant decay channel flag, generator level +// mapping of decay types +enum DecayType { XToJpsiPiPi = 0 }; // move this to a dedicated cascade namespace in the future? +} // namespace hf_cand_x + +// declare dedicated X candidate table +DECLARE_SOA_TABLE(HfCandXBase, "AOD", "HFCANDXBASE", + // general columns + HFCAND_COLUMNS, + // 3-prong specific columns + hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, + hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, + hf_cand::PxProng2, hf_cand::PyProng2, hf_cand::PzProng2, + hf_cand::ImpactParameter0, hf_cand::ImpactParameter1, hf_cand::ImpactParameter2, + hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, hf_cand::ErrorImpactParameter2, + hf_cand_x::Index0Id, hf_track_index::Index1Id, hf_track_index::Index2Id, // note the difference between Jpsi and pion indices + hf_track_index::HFflag, + /* dynamic columns */ + hf_cand_prong3::M, + hf_cand_prong3::M2, + /* prong 2 */ + hf_cand::PtProng2, + hf_cand::Pt2Prong2, + hf_cand::PVectorProng2, + /* dynamic columns that use candidate momentum components */ + hf_cand::Pt, + hf_cand::Pt2, + hf_cand::P, + hf_cand::P2, + hf_cand::PVector, + hf_cand::CPA, + hf_cand::CPAXY, + hf_cand::Ct, + hf_cand::ImpactParameterXY, + hf_cand_prong3::MaxNormalisedDeltaIP, + hf_cand::Eta, + hf_cand::Phi, + hf_cand::Y, + hf_cand::E, + hf_cand::E2); + +// extended table with expression columns that can be used as arguments of dynamic columns +DECLARE_SOA_EXTENDED_TABLE_USER(HfCandXExt, HfCandXBase, "HFCANDXEXT", + hf_cand_prong3::Px, hf_cand_prong3::Py, hf_cand_prong3::Pz); + +using HfCandX = HfCandXExt; + +// table with results of reconstruction level MC matching +DECLARE_SOA_TABLE(HfCandXMCRec, "AOD", "HFCANDXMCREC", //! + hf_cand_x::FlagMCMatchRec, + hf_cand_x::OriginMCRec, + hf_cand_x::FlagMCDecayChanRec); + +// table with results of generator level MC matching +DECLARE_SOA_TABLE(HfCandXMCGen, "AOD", "HFCANDXMCGEN", //! + hf_cand_x::FlagMCMatchGen, + hf_cand_x::OriginMCGen, + hf_cand_x::FlagMCDecayChanGen); + } // namespace o2::aod #endif // O2_ANALYSIS_HFSECONDARYVERTEX_H_ diff --git a/Analysis/Tasks/PWGHF/CMakeLists.txt b/Analysis/Tasks/PWGHF/CMakeLists.txt index 05b2d4a433527..9615cf2663fa3 100644 --- a/Analysis/Tasks/PWGHF/CMakeLists.txt +++ b/Analysis/Tasks/PWGHF/CMakeLists.txt @@ -43,6 +43,11 @@ o2_add_dpl_workflow(hf-candidate-creator-3prong PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing ROOT::EG COMPONENT_NAME Analysis) +o2_add_dpl_workflow(hf-candidate-creator-x + SOURCES HFCandidateCreatorX.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing ROOT::EG + COMPONENT_NAME Analysis) + o2_add_dpl_workflow(hf-tree-creator-lc-topkpi SOURCES HFTreeCreatorLcToPKPi.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing ROOT::EG diff --git a/Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx b/Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx new file mode 100644 index 0000000000000..77f54977d0b92 --- /dev/null +++ b/Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx @@ -0,0 +1,300 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// 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 HFCandidateCreatorX.cxx +/// \brief Reconstruction of X(3872) candidates +/// \note Adapted from HFCandidateCreator3Prong +/// +/// \author Rik Spijkers , Utrecht University + +#include "Framework/AnalysisTask.h" +#include "DetectorsVertexing/DCAFitterN.h" +#include "AnalysisDataModel/HFSecondaryVertex.h" +#include "AnalysisCore/trackUtilities.h" +#include "ReconstructionDataFormats/DCA.h" +#include "ReconstructionDataFormats/V0.h" +#include "AnalysisDataModel/HFCandidateSelectionTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::aod::hf_cand; +using namespace o2::aod::hf_cand_prong2; +using namespace o2::aod::hf_cand_prong3; +using namespace o2::aod::hf_cand_x; +using namespace o2::framework::expressions; + +void customize(std::vector& workflowOptions) +{ + ConfigParamSpec optionDoMC{"doMC", VariantType::Bool, false, {"Perform MC matching."}}; + workflowOptions.push_back(optionDoMC); +} + +#include "Framework/runDataProcessing.h" + +/// Reconstruction of X candidates +struct HFCandidateCreatorX { + Produces rowCandidateBase; + + Configurable magneticField{"magneticField", 5., "magnetic field"}; + Configurable b_propdca{"b_propdca", true, "create tracks version propagated to PCA"}; + Configurable d_maxr{"d_maxr", 200., "reject PCA's above this radius"}; + Configurable d_maxdzini{"d_maxdzini", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"}; + Configurable d_minparamchange{"d_minparamchange", 1.e-3, "stop iterations if largest change of any X is smaller than this"}; + Configurable d_minrelchi2change{"d_minrelchi2change", 0.9, "stop iterations is chi2/chi2old > this"}; + Configurable b_dovalplots{"b_dovalplots", true, "do validation plots"}; + + OutputObj hMassJpsi{TH1F("hMassJpsi", "J/#psi candidates;inv. mass (#e+ e-) (GeV/#it{c}^{2});entries", 500, 0., 5.)}; + OutputObj hPtJpsi{TH1F("hPtJpsi", "J/#psi candidates;candidate #it{p}_{T} (GeV/#it{c});entries", 100, 0., 10.)}; + OutputObj hCPAJpsi{TH1F("hCPAJpsi", "J/#psi candidates;cosine of pointing angle;entries", 110, -1.1, 1.1)}; + OutputObj hMassX{TH1F("hMassX", "3-prong candidates;inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", 500, 0., 5.)}; + OutputObj hCovPVXX{TH1F("hCovPVXX", "3-prong candidates;XX element of cov. matrix of prim. vtx position (cm^{2});entries", 100, 0., 1.e-4)}; + OutputObj hCovSVXX{TH1F("hCovSVXX", "3-prong candidates;XX element of cov. matrix of sec. vtx position (cm^{2});entries", 100, 0., 0.2)}; + + double massPi = RecoDecay::getMassPDG(kPiPlus); + double massJpsi = RecoDecay::getMassPDG(443); + double massJpsiPiPi; + + Configurable d_selectionFlagJpsi{"d_selectionFlagJpsi", 1, "Selection Flag for Jpsi"}; + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi); + + void process(aod::Collision const& collision, + soa::Filtered> const& jpsiCands, + aod::BigTracks const& tracks) + { + // 2-prong vertex fitter (to rebuild Jpsi vertex) + o2::vertexing::DCAFitterN<2> df2; + df2.setBz(magneticField); + df2.setPropagateToPCA(b_propdca); + df2.setMaxR(d_maxr); + df2.setMaxDZIni(d_maxdzini); + df2.setMinParamChange(d_minparamchange); + df2.setMinRelChi2Change(d_minrelchi2change); + df2.setUseAbsDCA(true); + + // 3-prong vertex fitter + o2::vertexing::DCAFitterN<3> df3; + df3.setBz(magneticField); + df3.setPropagateToPCA(b_propdca); + df3.setMaxR(d_maxr); + df3.setMaxDZIni(d_maxdzini); + df3.setMinParamChange(d_minparamchange); + df3.setMinRelChi2Change(d_minrelchi2change); + df3.setUseAbsDCA(true); + + // loop over Jpsi candidates + for (auto& jpsiCand : jpsiCands) { + if (!(jpsiCand.hfflag() & 1 << JpsiToEE)) { + continue; + } + if (cutYCandMax >= 0. && std::abs(YJpsi(jpsiCand)) > cutYCandMax) { + continue; + } + hMassJpsi->Fill(InvMassJpsiToEE(jpsiCand)); + hPtJpsi->Fill(jpsiCand.pt()); + 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()}; + array pvecJpsi = {jpsiCand.px(), jpsiCand.py(), jpsiCand.pz()}; + auto prong0 = jpsiCand.index0_as(); + auto prong1 = jpsiCand.index1_as(); + auto prong0TrackParCov = getTrackParCov(prong0); + auto prong1TrackParCov = getTrackParCov(prong1); + + if (df2.process(prong0TrackParCov, prong1TrackParCov) == 0) { + continue; + } + + // propogate prong tracks to Jpsi vertex + prong0TrackParCov.propagateTo(jpsiCand.xSecondaryVertex(), magneticField); + prong1TrackParCov.propagateTo(jpsiCand.xSecondaryVertex(), magneticField); + const std::array covJpsi = df2.calcPCACovMatrixFlat(); + // define the Jpsi track + auto trackJpsi = o2::dataformats::V0(vertexJpsi, pvecJpsi, covJpsi, prong0TrackParCov, prong1TrackParCov, {0, 0}, {0, 0}); //FIXME: also needs covxyz??? + + // used to check that prongs used for Jpsi and X reco are not the same prongs + int index0Jpsi = jpsiCand.index0Id(); + int index1Jpsi = jpsiCand.index1Id(); + + // loop over pi+ candidates + for (auto& trackPos : tracks) { + if (trackPos.sign() < 0) { // select only positive tracks - use partitions? + continue; + } + if (trackPos.globalIndex() == index0Jpsi) { + continue; + } + + // loop over pi- candidates + for (auto& trackNeg : tracks) { + if (trackNeg.sign() > 0) { // select only negative tracks - use partitions? + continue; + } + if (trackNeg.globalIndex() == index1Jpsi) { + continue; + } + + auto trackParVarPos = getTrackParCov(trackPos); + auto trackParVarNeg = getTrackParCov(trackNeg); + array pvecPos; + array pvecNeg; + + // reconstruct the 3-prong X vertex + if (df3.process(trackJpsi, trackParVarPos, trackParVarNeg) == 0) { + continue; + } + + // calculate relevant properties + const auto& XsecondaryVertex = df3.getPCACandidate(); + auto chi2PCA = df3.getChi2AtPCACandidate(); + auto covMatrixPCA = df3.calcPCACovMatrix().Array(); + hCovSVXX->Fill(covMatrixPCA[0]); // FIXME: Calculation of errorDecayLength(XY) gives wrong values without this line. + + df3.propagateTracksToVertex(); // propagate the pions and Jpsi to the X vertex + df3.getTrack(0).getPxPyPzGlo(pvecJpsi); // update momentum of Jpsi at the X vertex + df3.getTrack(1).getPxPyPzGlo(pvecPos); // momentum of pi+ at the X vertex + df3.getTrack(2).getPxPyPzGlo(pvecNeg); // momentum of pi- at the X vertex + + // get track impact parameters + // This modifies track momenta! + auto primaryVertex = getPrimaryVertex(collision); + auto covMatrixPV = primaryVertex.getCov(); + hCovPVXX->Fill(covMatrixPV[0]); + o2::dataformats::DCA impactParameter0; + o2::dataformats::DCA impactParameter1; + o2::dataformats::DCA impactParameter2; + trackJpsi.propagateToDCA(primaryVertex, magneticField, &impactParameter0); + trackParVarPos.propagateToDCA(primaryVertex, magneticField, &impactParameter1); + trackParVarNeg.propagateToDCA(primaryVertex, magneticField, &impactParameter2); + + // get uncertainty of the decay length + double phi, theta; + getPointDirection(array{collision.posX(), collision.posY(), collision.posZ()}, XsecondaryVertex, phi, theta); + auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixPCA, phi, theta)); + auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.)); + + int hfFlag = 1 << XToJpsiPiPi; + + // fill the candidate table for the X here: + rowCandidateBase(collision.globalIndex(), + collision.posX(), collision.posY(), collision.posZ(), + XsecondaryVertex[0], XsecondaryVertex[1], XsecondaryVertex[2], + errorDecayLength, errorDecayLengthXY, + chi2PCA, + pvecJpsi[0], pvecJpsi[1], pvecJpsi[2], + pvecPos[0], pvecPos[1], pvecPos[2], + pvecNeg[0], pvecNeg[1], pvecNeg[2], + impactParameter0.getY(), impactParameter1.getY(), impactParameter2.getY(), + std::sqrt(impactParameter0.getSigmaY2()), std::sqrt(impactParameter1.getSigmaY2()), std::sqrt(impactParameter2.getSigmaY2()), + jpsiCand.globalIndex(), trackPos.globalIndex(), trackNeg.globalIndex(), + hfFlag); + + // calculate invariant mass + auto arrayMomenta = array{pvecJpsi, pvecPos, pvecNeg}; + massJpsiPiPi = RecoDecay::M(std::move(arrayMomenta), array{massJpsi, massPi, massPi}); + hMassX->Fill(massJpsiPiPi); + } // pi- loop + } // pi+ loop + } // Jpsi loop + } // process +}; // struct + +/// Extends the base table with expression columns. +struct HFCandidateCreatorXExpressions { + Spawns rowCandidateX; + void init(InitContext const&) {} +}; + +/// Performs MC matching. +struct HFCandidateCreatorXMC { + Produces rowMCMatchRec; + Produces rowMCMatchGen; + + void process(aod::HfCandX const& candidates, + aod::HfCandProng2, + aod::BigTracksMC const& tracks, + aod::McParticles const& particlesMC) + { + int indexRec = -1; + int8_t sign = 0; + int8_t flag = 0; + int8_t origin = 0; + int8_t channel = 0; + + // Match reconstructed candidates. + for (auto& candidate : candidates) { + //Printf("New rec. candidate"); + flag = 0; + origin = 0; + channel = 0; + auto jpsiTrack = candidate.index0(); + auto arrayDaughters = array{candidate.index1_as(), + candidate.index2_as(), + jpsiTrack.index0_as(), + jpsiTrack.index1_as()}; + + // X → J/ψ π+ π- + //Printf("Checking X → J/ψ π+ π-"); + indexRec = RecoDecay::getMatchedMCRec(particlesMC, arrayDaughters, 9920443, array{+kPiPlus, -kPiPlus, +kElectron, -kElectron}, true, &sign, 2); + if (indexRec > -1) { + flag = 1 << XToJpsiPiPi; + } + + // Check whether the particle is non-prompt (from a b quark). + if (flag != 0) { + auto particle = particlesMC.iteratorAt(indexRec); + origin = (RecoDecay::getMother(particlesMC, particle, 5, true) > -1 ? NonPrompt : Prompt); + } + + rowMCMatchRec(flag, origin, channel); + } + + // Match generated particles. + for (auto& particle : particlesMC) { + //Printf("New gen. candidate"); + flag = 0; + origin = 0; + channel = 0; + + // X → J/ψ π+ π- + //Printf("Checking X → J/ψ π+ π-"); + if (RecoDecay::isMatchedMCGen(particlesMC, particle, 9920443, array{443, +kPiPlus, -kPiPlus}, true)) { + // Match J/psi --> e+e- + std::vector arrDaughter; + RecoDecay::getDaughters(particlesMC, particle, &arrDaughter, array{443}, 1); + auto jpsiCandMC = particlesMC.iteratorAt(arrDaughter[0]); + if (RecoDecay::isMatchedMCGen(particlesMC, jpsiCandMC, 443, array{+kElectron, -kElectron}, true)) { + flag = 1 << XToJpsiPiPi; + } + } + + // Check whether the particle is non-prompt (from a b quark). + if (flag != 0) { + origin = (RecoDecay::getMother(particlesMC, particle, 5, true) > -1 ? NonPrompt : Prompt); + } + + rowMCMatchGen(flag, origin, channel); + } // candidate loop + } // process +}; // struct + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow{ + adaptAnalysisTask(cfgc, TaskName{"hf-cand-creator-x"}), + adaptAnalysisTask(cfgc, TaskName{"hf-cand-creator-x-expressions"})}; + const bool doMC = cfgc.options().get("doMC"); + if (doMC) { + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-cand-creator-x-mc"})); + } + return workflow; +} diff --git a/Analysis/Tasks/PWGHF/taskX.cxx b/Analysis/Tasks/PWGHF/taskX.cxx index 32a5cc095f748..556f2054da3ab 100644 --- a/Analysis/Tasks/PWGHF/taskX.cxx +++ b/Analysis/Tasks/PWGHF/taskX.cxx @@ -21,6 +21,8 @@ using namespace o2; using namespace o2::framework; +using namespace o2::aod::hf_cand_prong3; +using namespace o2::aod::hf_cand_x; using namespace o2::framework::expressions; using namespace o2::aod::hf_cand_prong2; @@ -36,60 +38,174 @@ void customize(std::vector& workflowOptions) struct TaskX { HistogramRegistry registry{ "registry", - {{"hMassJpsi", "2-prong candidates;inv. mass (e+ e-) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}}, - {"hPtCand", "X candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}}}; + {{"hMass", "3-prong candidates;inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 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 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {"hdeclength", "3-prong candidates;decay length (cm);entries", {HistType::kTH1F, {{200, 0., 2.}}}}, + {"hdeclengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH1F, {{200, 0., 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.}}}}, + {"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.}}}}, + {"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.}}}}, + {"hDecLenXYErr", "3-prong candidates;decay length xy error (cm);entries", {HistType::kTH1F, {{100, 0., 1.}}}}, + {"hPtCand", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}}}; - Configurable selectionFlagJpsi{"selectionFlagJpsi", 1, "Selection Flag for Jpsi"}; + // Configurable selectionFlagX{"selectionFlagX", 1, "Selection Flag for X"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; - Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= selectionFlagJpsi); + // Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiPiPi >= selectionFlagX); - /// aod::BigTracks is not soa::Filtered, should be added when filters are added - void process(aod::Collision const&, aod::BigTracks const& tracks, soa::Filtered> const& candidates) + // X candidates are not soa::Filtered, should be added when candidate selector is added + void process(aod::HfCandX const& candidates) { for (auto& candidate : candidates) { - if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE)) { + if (!(candidate.hfflag() & 1 << XToJpsiPiPi)) { continue; } - if (cutYCandMax >= 0. && std::abs(YJpsi(candidate)) > cutYCandMax) { + if (cutYCandMax >= 0. && std::abs(YX(candidate)) > cutYCandMax) { continue; } - registry.fill(HIST("hMassJpsi"), InvMassJpsiToEE(candidate)); - - int index0jpsi = candidate.index0Id(); - int index1jpsi = candidate.index1Id(); - for (auto& track1 : tracks) { - int signTrack1 = track1.sign(); - int indexTrack1 = track1.globalIndex(); - if (signTrack1 > 0) { - if (indexTrack1 == index0jpsi) { - continue; - } - } else if (indexTrack1 == index1jpsi) { - continue; + + registry.fill(HIST("hMass"), InvMassXToJpsiPiPi(candidate)); + registry.fill(HIST("hPtCand"), candidate.pt()); + registry.fill(HIST("hPtProng0"), candidate.ptProng0()); + registry.fill(HIST("hPtProng1"), candidate.ptProng1()); + registry.fill(HIST("hPtProng2"), candidate.ptProng2()); + registry.fill(HIST("hdeclength"), candidate.decayLength()); + registry.fill(HIST("hdeclengthxy"), candidate.decayLengthXY()); + registry.fill(HIST("hd0Prong0"), candidate.impactParameter0()); + registry.fill(HIST("hd0Prong1"), candidate.impactParameter1()); + registry.fill(HIST("hd0Prong2"), candidate.impactParameter2()); + registry.fill(HIST("hCPA"), candidate.cpa()); + registry.fill(HIST("hEta"), candidate.eta()); + registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter0()); + registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter1()); + registry.fill(HIST("hDecLenErr"), candidate.errorDecayLength()); + registry.fill(HIST("hDecLenXYErr"), candidate.errorDecayLengthXY()); + } // candidate loop + } // process +}; // struct + +struct TaskXMC { + 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.}}}}, + {"hPtGenSig", "3-prong candidates (rec. matched);#it{p}_{T}^{gen.} (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.}}}}, + + {"hPtGenProng0", "3-prong candidates (gen. matched);prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {"hPtGenProng1", "3-prong candidates (gen. matched);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {"hPtGenProng2", "3-prong candidates (gen. matched);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, + {"hMassRecSig", "3-prong candidates (rec. matched);inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 10.}}}}, + {"hMassRecBg", "3-prong candidates (rec. unmatched);inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 10.}}}}, + {"hd0Prong0RecSig", "3-prong candidates (rec. matched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, + {"hd0Prong1RecSig", "3-prong candidates (rec. matched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, + {"hd0Prong2RecSig", "3-prong candidates (rec. matched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, + {"hd0Prong0RecBg", "3-prong candidates (rec. unmatched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, + {"hd0Prong1RecBg", "3-prong candidates (rec. unmatched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, + {"hd0Prong2RecBg", "3-prong candidates (rec. unmatched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, + {"hDeclengthRecSig", "3-prong candidates (rec. matched);decay length (cm);entries", {HistType::kTH1F, {{200, 0., 2.}}}}, + {"hDeclengthRecBg", "3-prong candidates (rec. unmatched);decay length (cm);entries", {HistType::kTH1F, {{200, 0., 2.}}}}}}; + + // Configurable selectionFlagX{"selectionFlagX", 1, "Selection Flag for X"}; + Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + // Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiPiPi >= selectionFlagX); + + void process(soa::Join const& candidates, + soa::Join const& particlesMC, + aod::BigTracksMC) // aod::BigTracksMC is needed to get corresponding MC particle in MC rec. part + { + // MC rec. + //Printf("MC Candidates: %d", candidates.size()); + for (auto& candidate : candidates) { + if (!(candidate.hfflag() & 1 << XToJpsiPiPi)) { + continue; + } + if (cutYCandMax >= 0. && std::abs(YX(candidate)) > cutYCandMax) { + continue; + } + if (candidate.flagMCMatchRec() == 1 << XToJpsiPiPi) { + // Get the corresponding MC particle. // TODO: fix the next 3 lines, gives very strange error + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index1_as().mcParticle_as>(), 9920443, true); + auto particleMother = particlesMC.iteratorAt(indexMother); + registry.fill(HIST("hPtGenSig"), particleMother.pt()); + registry.fill(HIST("hPtRecSig"), candidate.pt()); + registry.fill(HIST("hCPARecSig"), candidate.cpa()); + registry.fill(HIST("hEtaRecSig"), candidate.eta()); + + registry.fill(HIST("hDeclengthRecSig"), candidate.decayLength()); + registry.fill(HIST("hMassRecSig"), InvMassXToJpsiPiPi(candidate)); + registry.fill(HIST("hd0Prong0RecSig"), candidate.impactParameter0()); + registry.fill(HIST("hd0Prong1RecSig"), candidate.impactParameter1()); + registry.fill(HIST("hd0Prong2RecSig"), candidate.impactParameter2()); + } else { + registry.fill(HIST("hPtRecBg"), candidate.pt()); + registry.fill(HIST("hCPARecBg"), candidate.cpa()); + registry.fill(HIST("hEtaRecBg"), candidate.eta()); + + registry.fill(HIST("hDeclengthRecBg"), candidate.decayLength()); + registry.fill(HIST("hMassRecBg"), InvMassXToJpsiPiPi(candidate)); + registry.fill(HIST("hd0Prong0RecBg"), candidate.impactParameter0()); + registry.fill(HIST("hd0Prong1RecBg"), candidate.impactParameter1()); + registry.fill(HIST("hd0Prong2RecBg"), candidate.impactParameter2()); + } + } // rec + // MC gen. + //Printf("MC Particles: %d", particlesMC.size()); + for (auto& particle : particlesMC) { + if (particle.flagMCMatchGen() == 1 << XToJpsiPiPi) { + // TODO: add X(3872) mass such that we can use the getMassPDG function + // if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode()))) > cutYCandMax) { + // Printf("MC Gen.: Y rejection: %g", RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode()))); + // continue; + // } + registry.fill(HIST("hPtGen"), particle.pt()); + registry.fill(HIST("hEtaGen"), particle.eta()); + + // properties of gen matched X(3872), to get a first look at some cuts + float ptProngs[3]; + int counter = 0; + for (int iD = particle.daughter0(); iD <= particle.daughter1(); ++iD) { + ptProngs[counter] = particlesMC.iteratorAt(iD).pt(); + counter++; } - for (auto track2 = track1 + 1; track2 != tracks.end(); ++track2) { - if (signTrack1 == track2.sign()) { - continue; - } - int indexTrack2 = track2.globalIndex(); - if (signTrack1 > 0) { - if (indexTrack2 == index1jpsi) { - continue; - } - } else if (indexTrack2 == index0jpsi) { - continue; - } - registry.fill(HIST("hPtCand"), candidate.pt() + track1.pt() + track2.pt()); - } // track2 loop (pion) - } // track1 loop (pion) - } // Jpsi loop - } // process -}; // struct + registry.fill(HIST("hPtGenProng0"), ptProngs[0]); + registry.fill(HIST("hPtGenProng1"), ptProngs[1]); + registry.fill(HIST("hPtGenProng2"), ptProngs[2]); + registry.fill(HIST("hEtaGen"), particle.eta()); + + // properties of gen matched X(3872), to get a first look at some cuts + float ptProngs[3]; + int counter = 0; + for (int iD = particle.daughter0(); iD <= particle.daughter1(); ++iD) { + ptProngs[counter] = particlesMC.iteratorAt(iD).pt(); + counter++; + } + registry.fill(HIST("hPtGenProng0"), ptProngs[0]); + registry.fill(HIST("hPtGenProng1"), ptProngs[1]); + registry.fill(HIST("hPtGenProng2"), ptProngs[2]); + } + } //gen + } // process +}; // struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ adaptAnalysisTask(cfgc, TaskName{"hf-task-x"})}; + const bool doMC = cfgc.options().get("doMC"); + if (doMC) { + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-task-x-mc"})); + } return workflow; } From ab0939591a33104859f78d98d6d166da27d65b35 Mon Sep 17 00:00:00 2001 From: rspijkers Date: Tue, 20 Apr 2021 12:01:53 +0200 Subject: [PATCH 02/43] Add first version of X selector Add various cuts to selector - TOF pid, CPA, daughter DCA, daughter pT - Change range of histograms in taskX.cxx change range and bins of histograms add pT dependent cuts via HFSelectorCuts.h --- .../include/AnalysisCore/HFSelectorCuts.h | 49 +++- .../HFCandidateSelectionTables.h | 7 + Analysis/Tasks/PWGHF/CMakeLists.txt | 5 + .../PWGHF/HFXToJpsiPiPiCandidateSelector.cxx | 232 ++++++++++++++++++ Analysis/Tasks/PWGHF/taskX.cxx | 196 ++++++++------- 5 files changed, 402 insertions(+), 87 deletions(-) create mode 100644 Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx diff --git a/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h b/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h index 3178b80853b4e..ecec536ceb7d2 100644 --- a/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h +++ b/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h @@ -28,7 +28,8 @@ enum Code { kDPlus = 411, kLambdaCPlus = 4122, kXiCPlus = 4232, - kJpsi = 443 + kJpsi = 443, + kX3872 = 9920443 }; } // namespace pdg @@ -377,6 +378,52 @@ static const std::vector pTBinLabels = { // column labels static const std::vector cutVarLabels = {"m", "DCA_xy", "DCA_z", "pT El"}; } // namespace hf_cuts_jpsi_toee + +namespace hf_cuts_x_tojpsipipi +{ +static constexpr int npTBins = 9; +static constexpr int nCutVars = 6; +// default values for the pT bin edges (can be used to configure histogram axis) +// offset by 1 from the bin numbers in cuts array +constexpr double pTBins[npTBins + 1] = { + 0, + 0.5, + 1.0, + 2.0, + 3.0, + 4.0, + 5.0, + 7.0, + 10.0, + 15.0, +}; +auto pTBins_v = std::vector{pTBins, pTBins + npTBins + 1}; + +// default values for the cuts +// m CPA d0Jpsi d0Pi pTJpsi pTPi +constexpr double cuts[npTBins][nCutVars] = {{0.5, 0.80, 0.001, 0.001, 3.0, 0.15}, /* 0 pTBinLabels = { + "pT bin 0", + "pT bin 1", + "pT bin 2", + "pT bin 3", + "pT bin 4", + "pT bin 5", + "pT bin 6", + "pT bin 7", + "pT bin 8"}; +// column labels +static const std::vector cutVarLabels = {"m", "CPA", "d0 Jpsi", "d0 Pi", "pT Jpsi", "pT Pi"}; +} // namespace hf_cuts_x_tojpsipipi } // namespace o2::analysis #endif // HF_SELECTOR_CUTS_H_ diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h b/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h index 50c5057e30ca8..cd45f99573411 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h @@ -42,6 +42,7 @@ DECLARE_SOA_COLUMN(IsSelJpsiToEE, isSelJpsiToEE, int); //! } // namespace hf_selcandidate_jpsi DECLARE_SOA_TABLE(HFSelJpsiToEECandidate, "AOD", "HFSELJPSICAND", //! hf_selcandidate_jpsi::IsSelJpsiToEE); + namespace hf_selcandidate_lc_k0sp { DECLARE_SOA_COLUMN(IsSelLcK0sP, isSelLcK0sP, int); @@ -49,6 +50,12 @@ DECLARE_SOA_COLUMN(IsSelLcK0sP, isSelLcK0sP, int); DECLARE_SOA_TABLE(HFSelLcK0sPCandidate, "AOD", "HFSELLCK0SPCAND", //! hf_selcandidate_lc_k0sp::IsSelLcK0sP); +namespace hf_selcandidate_x +{ +DECLARE_SOA_COLUMN(IsSelXToJpsiPiPi, isSelXToJpsiPiPi, int); //! +} // namespace hf_selcandidate_x +DECLARE_SOA_TABLE(HFSelXToJpsiPiPiCandidate, "AOD", "HFSELXCAND", //! + hf_selcandidate_x::IsSelXToJpsiPiPi); } // namespace o2::aod namespace o2::aod diff --git a/Analysis/Tasks/PWGHF/CMakeLists.txt b/Analysis/Tasks/PWGHF/CMakeLists.txt index 9615cf2663fa3..37c404a785cf2 100644 --- a/Analysis/Tasks/PWGHF/CMakeLists.txt +++ b/Analysis/Tasks/PWGHF/CMakeLists.txt @@ -83,6 +83,11 @@ o2_add_dpl_workflow(hf-lc-tok0sp-candidate-selector PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::AnalysisTasksUtils COMPONENT_NAME Analysis) +o2_add_dpl_workflow(hf-x-tojpsipipi-candidate-selector + SOURCES HFXToJpsiPiPiCandidateSelector.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing + COMPONENT_NAME Analysis) + o2_add_dpl_workflow(hf-task-d0 SOURCES taskD0.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing diff --git a/Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx new file mode 100644 index 0000000000000..39a5b9675cffd --- /dev/null +++ b/Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx @@ -0,0 +1,232 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// 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 HFXToJpsiPiPiCandidateSelector.cxx +/// \brief X(3872) selection task. +/// \note Adapted from HFJpsiToEECandidateSelector.cxx +/// \author Rik Spijkers , Utrecht University + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "AnalysisCore/HFSelectorCuts.h" +#include "AnalysisDataModel/HFSecondaryVertex.h" +#include "AnalysisDataModel/HFCandidateSelectionTables.h" +using namespace o2; +using namespace o2::framework; +using namespace o2::aod::hf_cand_x; +using namespace o2::analysis; +using namespace o2::analysis::hf_cuts_x_tojpsipipi; + +/// Struct for applying Jpsi selection cuts +struct HFXToJpsiPiPiCandidateSelector { + + Produces hfSelXToJpsiPiPiCandidate; + + Configurable d_pTCandMin{"d_pTCandMin", 0., "Lower bound of candidate pT"}; + Configurable d_pTCandMax{"d_pTCandMax", 50., "Upper bound of candidate pT"}; + + 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_pidTOFMinpT{"d_pidTOFMinpT", 0.15, "Lower bound of track pT for TOF PID"}; + Configurable d_pidTOFMaxpT{"d_pidTOFMaxpT", 10., "Upper bound of track pT for TOF PID"}; + + Configurable d_TPCNClsFindablePIDCut{"d_TPCNClsFindablePIDCut", 70., "Lower bound of TPC findable clusters for good PID"}; + Configurable d_nSigmaTPC{"d_nSigmaTPC", 3., "Nsigma cut on TPC only"}; + Configurable d_nSigmaTOF{"d_nSigmaTOF", 3., "Nsigma cut on TOF only"}; + + Configurable> pTBins{"pTBins", std::vector{hf_cuts_x_tojpsipipi::pTBins_v}, "pT bin limits"}; + Configurable> cuts{"X_to_jpsipipi_cuts", {hf_cuts_x_tojpsipipi::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) + { + return true; + } + + /// Conjugate independent toplogical cuts + /// \param hfCandX is candidate + /// \param trackNeutral is the track with the pi+ hypothesis + /// \param trackPos is the track with the pi+ hypothesis + /// \param trackNeg is the track with the pi- hypothesis + /// \return true if candidate passes all cuts + template + bool selectionTopol(const T1& hfCandX, const T2& hfCandJpsi, const T3& trackPos, const T3& trackNeg) + { + auto candpT = hfCandX.pt(); + int pTBin = findBin(pTBins, candpT); + if (pTBin == -1) { + // Printf("X topol selection failed at getpTBin"); + return false; + } + + if (candpT < d_pTCandMin || candpT >= d_pTCandMax) { + // Printf("X topol selection failed at cand pT check"); + return false; //check that the candidate pT is within the analysis range + } + + // TODO: replace hardcoded mass with "RecoDecay::getMassPDG(9920443)" + if (TMath::Abs(InvMassXToJpsiPiPi(hfCandX) - 3.87168) > cuts->get(pTBin, "m")) { + // Printf("X topol selection failed at mass diff check"); + return false; //check that mass difference is within bounds + } + + if ((hfCandJpsi.pt() < cuts->get(pTBin, "pT Jpsi")) || (trackNeg.pt() < cuts->get(pTBin, "pT Pi")) || (trackPos.pt() < cuts->get(pTBin, "pT Pi"))) { + // Printf("X topol selection failed at daughter pT check"); + return false; //cut on daughter pT + } + + if (hfCandX.cpa() < cuts->get(pTBin, "CPA")) { + return false; // CPA check + } + + if ((TMath::Abs(hfCandX.impactParameter0()) > cuts->get(pTBin, "d0 Jpsi")) || + (TMath::Abs(hfCandX.impactParameter1()) > cuts->get(pTBin, "d0 Pi")) || + (TMath::Abs(hfCandX.impactParameter2()) > cuts->get(pTBin, "d0 Pi"))) { + return false; // DCA check on daughters + } + + // add more cuts: d0 product? PCA? + + return true; + } + + /// Check if track is ok for TPC PID + /// \param track is the track + /// \note function to be expanded + /// \return true if track is ok for TPC PID + template + bool validTPCPID(const T& track) + { + if (TMath::Abs(track.pt()) < d_pidTPCMinpT || TMath::Abs(track.pt()) >= d_pidTPCMaxpT) { + return false; + } + //if (track.TPCNClsFindable() < d_TPCNClsFindablePIDCut) return false; + return true; + } + + /// Check if track is ok for TOF PID + /// \param track is the track + /// \note function to be expanded + /// \return true if track is ok for TOF PID + template + bool validTOFPID(const T& track) + { + if (TMath::Abs(track.pt()) < d_pidTOFMinpT || TMath::Abs(track.pt()) >= d_pidTOFMaxpT) { + return false; + } + return true; + } + + /// Check if track is compatible with given TPC Nsigma cut for the pion hypothesis + /// \param track is the track + /// \param nSigmaCut is the nsigma threshold to test against + /// \return true if track satisfies TPC pion hypothesis for given Nsigma cut + template + bool selectionPIDTPC(const T& track, int nSigmaCut) + { + if (nSigmaCut > 999.) { + return true; + } + return track.tpcNSigmaPi() < nSigmaCut; + } + + /// Check if track is compatible with given TOF NSigma cut for the pion hypothesis + /// \param track is the track + /// \param nSigmaCut is the nSigma threshold to test against + /// \return true if track satisfies TOF pion hypothesis for given NSigma cut + template + bool selectionPIDTOF(const T& track, double nSigmaCut) + { + if (nSigmaCut > 999.) { + return true; + } + return track.tofNSigmaPi() < nSigmaCut; + } + + /// PID selection on daughter track + /// \param track is the daughter track + /// \return 1 if successful PID match, 0 if successful PID rejection, -1 if no PID info + template + int selectionPID(const T& track) + { // use both TPC and TOF here; in run5 only TOF makes sense. add some flag for run3/run5 data later? + if (validTOFPID(track)) { + if (!selectionPIDTOF(track, d_nSigmaTOF)) { + return 0; //rejected by PID + } else { + return 1; //positive PID + } + } else { + return -1; //no PID info + } + + // no tpc in run5, so for now comment it out + // if (validTPCPID(track)) { + // if (!selectionPIDTPC(track, d_nSigmaTPC)) { + // return 0; //rejected by PID + // } else { + // return 1; //positive PID + // } + // } else { + // return -1; //no PID info + // } + } + + void process(aod::HfCandX const& hfCandXs, aod::HfCandProng2, aod::BigTracksPID const& tracks) + { + for (auto& hfCandX : hfCandXs) { //looping over X candidates + // note the difference between Jpsi (index0) and pions (index1,2) + auto candJpsi = hfCandX.index0(); + auto trackPos = hfCandX.index1_as(); //positive daughter + auto trackNeg = hfCandX.index2_as(); //negative daughter + + // check if flagged as X --> Jpsi Pi Pi + if (!(hfCandX.hfflag() & 1 << XToJpsiPiPi)) { + hfSelXToJpsiPiPiCandidate(0); + // Printf("X candidate selection failed at hfflag check"); + continue; + } + + // daughter track validity selection + if (!daughterSelection(trackPos) || !daughterSelection(trackNeg)) { + hfSelXToJpsiPiPiCandidate(0); + // Printf("X candidate selection failed at daughter selection"); + 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) + + if (!selectionTopol(hfCandX, candJpsi, trackPos, trackNeg)) { + hfSelXToJpsiPiPiCandidate(0); + // Printf("X candidate selection failed at selection topology"); + continue; + } + + if (selectionPID(trackPos) == 0 || selectionPID(trackNeg) == 0) { + hfSelXToJpsiPiPiCandidate(0); + // Printf("X candidate selection failed at selection PID"); + continue; + } + + hfSelXToJpsiPiPiCandidate(1); + // Printf("X candidate selection successful, candidate should be selected"); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"hf-x-tojpsipipi-candidate-selector"})}; +} diff --git a/Analysis/Tasks/PWGHF/taskX.cxx b/Analysis/Tasks/PWGHF/taskX.cxx index 556f2054da3ab..120fc488a1201 100644 --- a/Analysis/Tasks/PWGHF/taskX.cxx +++ b/Analysis/Tasks/PWGHF/taskX.cxx @@ -16,10 +16,13 @@ #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" +#include "AnalysisCore/HFSelectorCuts.h" #include "AnalysisDataModel/HFSecondaryVertex.h" #include "AnalysisDataModel/HFCandidateSelectionTables.h" using namespace o2; +using namespace o2::analysis; +using namespace o2::analysis::hf_cuts_x_tojpsipipi; using namespace o2::framework; using namespace o2::aod::hf_cand_prong3; using namespace o2::aod::hf_cand_x; @@ -38,29 +41,33 @@ void customize(std::vector& workflowOptions) struct TaskX { HistogramRegistry registry{ "registry", - {{"hMass", "3-prong candidates;inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 10.}}}}, - {"hPtProng0", "3-prong candidates;prong 0 #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 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"hdeclength", "3-prong candidates;decay length (cm);entries", {HistType::kTH1F, {{200, 0., 2.}}}}, - {"hdeclengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH1F, {{200, 0., 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.}}}}, - {"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.}}}}, - {"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.}}}}, - {"hDecLenXYErr", "3-prong candidates;decay length xy error (cm);entries", {HistType::kTH1F, {{100, 0., 1.}}}}, - {"hPtCand", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}}}; - - // Configurable selectionFlagX{"selectionFlagX", 1, "Selection Flag for X"}; + {"hPtCand", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{150, 0., 15.}}}}}}; + + Configurable d_selectionFlagX{"d_selectionFlagX", 1, "Selection Flag for X"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; + Configurable> bins{"pTBins", std::vector{hf_cuts_x_tojpsipipi::pTBins_v}, "pT bin limits"}; + + void init(o2::framework::InitContext&) + { + registry.add("hMass", "3-prong candidates;inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 3., 5.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclength", "3-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 0.4}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 0.4}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong2", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCPA", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hEta", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hImpParErr", "3-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDecLenErr", "3-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDecLenXYErr", "3-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } - // Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiPiPi >= selectionFlagX); + Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiPiPi >= d_selectionFlagX); - // X candidates are not soa::Filtered, should be added when candidate selector is added - void process(aod::HfCandX const& candidates) + void process(soa::Filtered> const& candidates) { for (auto& candidate : candidates) { if (!(candidate.hfflag() & 1 << XToJpsiPiPi)) { @@ -70,22 +77,22 @@ struct TaskX { continue; } - registry.fill(HIST("hMass"), InvMassXToJpsiPiPi(candidate)); + registry.fill(HIST("hMass"), InvMassXToJpsiPiPi(candidate), candidate.pt()); registry.fill(HIST("hPtCand"), candidate.pt()); registry.fill(HIST("hPtProng0"), candidate.ptProng0()); registry.fill(HIST("hPtProng1"), candidate.ptProng1()); registry.fill(HIST("hPtProng2"), candidate.ptProng2()); - registry.fill(HIST("hdeclength"), candidate.decayLength()); - registry.fill(HIST("hdeclengthxy"), candidate.decayLengthXY()); - registry.fill(HIST("hd0Prong0"), candidate.impactParameter0()); - registry.fill(HIST("hd0Prong1"), candidate.impactParameter1()); - registry.fill(HIST("hd0Prong2"), candidate.impactParameter2()); - registry.fill(HIST("hCPA"), candidate.cpa()); - registry.fill(HIST("hEta"), candidate.eta()); - registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter0()); - registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter1()); - registry.fill(HIST("hDecLenErr"), candidate.errorDecayLength()); - registry.fill(HIST("hDecLenXYErr"), candidate.errorDecayLengthXY()); + registry.fill(HIST("hdeclength"), candidate.decayLength(), candidate.pt()); + registry.fill(HIST("hdeclengthxy"), candidate.decayLengthXY(), candidate.pt()); + registry.fill(HIST("hd0Prong0"), candidate.impactParameter0(), candidate.pt()); + registry.fill(HIST("hd0Prong1"), candidate.impactParameter1(), candidate.pt()); + registry.fill(HIST("hd0Prong2"), candidate.impactParameter2(), candidate.pt()); + registry.fill(HIST("hCPA"), candidate.cpa(), candidate.pt()); + registry.fill(HIST("hEta"), candidate.eta(), candidate.pt()); + registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); + registry.fill(HIST("hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); + registry.fill(HIST("hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); + registry.fill(HIST("hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.pt()); } // candidate loop } // process }; // struct @@ -93,37 +100,49 @@ struct TaskX { struct TaskXMC { 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.}}}}, - {"hPtGenSig", "3-prong candidates (rec. matched);#it{p}_{T}^{gen.} (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.}}}}, - - {"hPtGenProng0", "3-prong candidates (gen. matched);prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"hPtGenProng1", "3-prong candidates (gen. matched);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"hPtGenProng2", "3-prong candidates (gen. matched);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"hMassRecSig", "3-prong candidates (rec. matched);inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 10.}}}}, - {"hMassRecBg", "3-prong candidates (rec. unmatched);inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 10.}}}}, - {"hd0Prong0RecSig", "3-prong candidates (rec. matched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, - {"hd0Prong1RecSig", "3-prong candidates (rec. matched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, - {"hd0Prong2RecSig", "3-prong candidates (rec. matched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, - {"hd0Prong0RecBg", "3-prong candidates (rec. unmatched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, - {"hd0Prong1RecBg", "3-prong candidates (rec. unmatched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, - {"hd0Prong2RecBg", "3-prong candidates (rec. unmatched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH1F, {{100, -1., 1.}}}}, - {"hDeclengthRecSig", "3-prong candidates (rec. matched);decay length (cm);entries", {HistType::kTH1F, {{200, 0., 2.}}}}, - {"hDeclengthRecBg", "3-prong candidates (rec. unmatched);decay length (cm);entries", {HistType::kTH1F, {{200, 0., 2.}}}}}}; - - // Configurable selectionFlagX{"selectionFlagX", 1, "Selection Flag for X"}; + {{"hPtRecSig", "3-prong candidates (rec. matched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{150, 0., 15.}}}}, + {"hPtRecBg", "3-prong candidates (rec. unmatched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{150, 0., 15.}}}}, + {"hPtGen", "3-prong candidates (gen. matched);#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{150, 0., 15.}}}}, + {"hPtGenSig", "3-prong candidates (rec. matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{150, 0., 15.}}}}}}; + + Configurable d_selectionFlagX{"d_selectionFlagX", 1, "Selection Flag for X"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; - // Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiPiPi >= selectionFlagX); + Configurable> bins{"pTBins", std::vector{hf_cuts_x_tojpsipipi::pTBins_v}, "pT bin limits"}; + + void init(o2::framework::InitContext&) + { + registry.add("hCPARecSig", "3-prong candidates (rec. matched);cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCPARecBg", "3-prong candidates (rec. unmatched);cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hEtaRecSig", "3-prong candidates (rec. matched);#it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hEtaRecBg", "3-prong candidates (rec. unmatched);#it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hEtaGen", "3-prong candidates (gen. matched);#it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + + registry.add("hPtProng0RecSig", "3-prong candidates (rec. matched);prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hPtProng1RecSig", "3-prong candidates (rec. matched);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hPtProng2RecSig", "3-prong candidates (rec. matched);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hPtProng0RecBg", "3-prong candidates (rec. unmatched);prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hPtProng1RecBg", "3-prong candidates (rec. unmatched);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hPtProng2RecBg", "3-prong candidates (rec. unmatched);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hPtGenProng0", "3-prong candidates (gen. matched);prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hPtGenProng1", "3-prong candidates (gen. matched);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hPtGenProng2", "3-prong candidates (gen. matched);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + + registry.add("hMassRecSig", "3-prong candidates (rec. matched);inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 3.7, 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassRecBg", "3-prong candidates (rec. unmatched);inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 3., 5.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong0RecSig", "3-prong candidates (rec. matched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong1RecSig", "3-prong candidates (rec. matched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong2RecSig", "3-prong candidates (rec. matched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong0RecBg", "3-prong candidates (rec. unmatched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong1RecBg", "3-prong candidates (rec. unmatched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong2RecBg", "3-prong candidates (rec. unmatched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDeclengthRecSig", "3-prong candidates (rec. matched);decay length (cm);entries", {HistType::kTH2F, {{200, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDeclengthRecBg", "3-prong candidates (rec. unmatched);decay length (cm);entries", {HistType::kTH2F, {{200, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + + Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiPiPi >= d_selectionFlagX); - void process(soa::Join const& candidates, - soa::Join const& particlesMC, - aod::BigTracksMC) // aod::BigTracksMC is needed to get corresponding MC particle in MC rec. part + void process(soa::Filtered> const& candidates, + soa::Join const& particlesMC, aod::BigTracksMC const& tracks) { // MC rec. //Printf("MC Candidates: %d", candidates.size()); @@ -135,42 +154,47 @@ struct TaskXMC { continue; } if (candidate.flagMCMatchRec() == 1 << XToJpsiPiPi) { - // Get the corresponding MC particle. // TODO: fix the next 3 lines, gives very strange error auto indexMother = RecoDecay::getMother(particlesMC, candidate.index1_as().mcParticle_as>(), 9920443, true); auto particleMother = particlesMC.iteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); registry.fill(HIST("hPtRecSig"), candidate.pt()); - registry.fill(HIST("hCPARecSig"), candidate.cpa()); - registry.fill(HIST("hEtaRecSig"), candidate.eta()); - - registry.fill(HIST("hDeclengthRecSig"), candidate.decayLength()); - registry.fill(HIST("hMassRecSig"), InvMassXToJpsiPiPi(candidate)); - registry.fill(HIST("hd0Prong0RecSig"), candidate.impactParameter0()); - registry.fill(HIST("hd0Prong1RecSig"), candidate.impactParameter1()); - registry.fill(HIST("hd0Prong2RecSig"), candidate.impactParameter2()); + registry.fill(HIST("hCPARecSig"), candidate.cpa(), candidate.pt()); + registry.fill(HIST("hEtaRecSig"), candidate.eta(), candidate.pt()); + + registry.fill(HIST("hDeclengthRecSig"), candidate.decayLength(), candidate.pt()); + registry.fill(HIST("hMassRecSig"), InvMassXToJpsiPiPi(candidate), candidate.pt()); + registry.fill(HIST("hd0Prong0RecSig"), candidate.impactParameter0(), candidate.pt()); + registry.fill(HIST("hd0Prong1RecSig"), candidate.impactParameter1(), candidate.pt()); + registry.fill(HIST("hd0Prong2RecSig"), candidate.impactParameter2(), candidate.pt()); + registry.fill(HIST("hPtProng0RecSig"), candidate.ptProng0(), candidate.pt()); + registry.fill(HIST("hPtProng1RecSig"), candidate.ptProng1(), candidate.pt()); + registry.fill(HIST("hPtProng2RecSig"), candidate.ptProng2(), candidate.pt()); } else { registry.fill(HIST("hPtRecBg"), candidate.pt()); - registry.fill(HIST("hCPARecBg"), candidate.cpa()); - registry.fill(HIST("hEtaRecBg"), candidate.eta()); - - registry.fill(HIST("hDeclengthRecBg"), candidate.decayLength()); - registry.fill(HIST("hMassRecBg"), InvMassXToJpsiPiPi(candidate)); - registry.fill(HIST("hd0Prong0RecBg"), candidate.impactParameter0()); - registry.fill(HIST("hd0Prong1RecBg"), candidate.impactParameter1()); - registry.fill(HIST("hd0Prong2RecBg"), candidate.impactParameter2()); + registry.fill(HIST("hCPARecBg"), candidate.cpa(), candidate.pt()); + registry.fill(HIST("hEtaRecBg"), candidate.eta(), candidate.pt()); + + registry.fill(HIST("hDeclengthRecBg"), candidate.decayLength(), candidate.pt()); + registry.fill(HIST("hMassRecBg"), InvMassXToJpsiPiPi(candidate), candidate.pt()); + registry.fill(HIST("hd0Prong0RecBg"), candidate.impactParameter0(), candidate.pt()); + registry.fill(HIST("hd0Prong1RecBg"), candidate.impactParameter1(), candidate.pt()); + registry.fill(HIST("hd0Prong2RecBg"), candidate.impactParameter2(), candidate.pt()); + registry.fill(HIST("hPtProng0RecBg"), candidate.ptProng0(), candidate.pt()); + registry.fill(HIST("hPtProng1RecBg"), candidate.ptProng1(), candidate.pt()); + registry.fill(HIST("hPtProng2RecBg"), candidate.ptProng2(), candidate.pt()); } } // rec // MC gen. //Printf("MC Particles: %d", particlesMC.size()); for (auto& particle : particlesMC) { if (particle.flagMCMatchGen() == 1 << XToJpsiPiPi) { - // TODO: add X(3872) mass such that we can use the getMassPDG function - // if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode()))) > cutYCandMax) { - // Printf("MC Gen.: Y rejection: %g", RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode()))); - // continue; - // } + // TODO: add X(3872) mass such that we can use the getMassPDG function instead of hardcoded mass + if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, 3.87168)) > cutYCandMax) { + // Printf("MC Gen.: Y rejection: %g", RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, 3.87168)); + continue; + } registry.fill(HIST("hPtGen"), particle.pt()); - registry.fill(HIST("hEtaGen"), particle.eta()); + registry.fill(HIST("hEtaGen"), particle.eta(), particle.pt()); // properties of gen matched X(3872), to get a first look at some cuts float ptProngs[3]; @@ -191,11 +215,11 @@ struct TaskXMC { ptProngs[counter] = particlesMC.iteratorAt(iD).pt(); counter++; } - registry.fill(HIST("hPtGenProng0"), ptProngs[0]); - registry.fill(HIST("hPtGenProng1"), ptProngs[1]); - registry.fill(HIST("hPtGenProng2"), ptProngs[2]); + registry.fill(HIST("hPtGenProng0"), ptProngs[0], particle.pt()); + registry.fill(HIST("hPtGenProng1"), ptProngs[1], particle.pt()); + registry.fill(HIST("hPtGenProng2"), ptProngs[2], particle.pt()); } - } //gen + } // gen } // process }; // struct From 95999d46e5936ed6ac30e8345d89518b21b8e7a4 Mon Sep 17 00:00:00 2001 From: rspijkers Date: Sat, 1 May 2021 21:03:55 +0200 Subject: [PATCH 03/43] delete duplicate code in HFSecondaryVertex --- .../AnalysisDataModel/HFSecondaryVertex.h | 69 ------------------- 1 file changed, 69 deletions(-) diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h index b13a05cc8a5bd..794040dda9ca3 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h @@ -729,75 +729,6 @@ DECLARE_SOA_EXTENDED_TABLE_USER(HfCandXExt, HfCandXBase, "HFCANDXEXT", using HfCandX = HfCandXExt; -// table with results of reconstruction level MC matching -DECLARE_SOA_TABLE(HfCandXMCRec, "AOD", "HFCANDXMCREC", //! - hf_cand_x::FlagMCMatchRec, - hf_cand_x::OriginMCRec, - hf_cand_x::FlagMCDecayChanRec); - -// table with results of generator level MC matching -DECLARE_SOA_TABLE(HfCandXMCGen, "AOD", "HFCANDXMCGEN", //! - hf_cand_x::FlagMCMatchGen, - hf_cand_x::OriginMCGen, - hf_cand_x::FlagMCDecayChanGen); - -// specific X candidate properties -namespace hf_cand_x -{ -DECLARE_SOA_INDEX_COLUMN_FULL(Index0, index0, int, HfCandProng2, "_0"); // Jpsi index -// MC matching result: -DECLARE_SOA_COLUMN(FlagMCMatchRec, flagMCMatchRec, int8_t); // reconstruction level -DECLARE_SOA_COLUMN(FlagMCMatchGen, flagMCMatchGen, int8_t); // generator level -DECLARE_SOA_COLUMN(OriginMCRec, originMCRec, int8_t); // particle origin, reconstruction level -DECLARE_SOA_COLUMN(OriginMCGen, originMCGen, int8_t); // particle origin, generator level -DECLARE_SOA_COLUMN(FlagMCDecayChanRec, flagMCDecayChanRec, int8_t); // resonant decay channel flag, reconstruction level -DECLARE_SOA_COLUMN(FlagMCDecayChanGen, flagMCDecayChanGen, int8_t); // resonant decay channel flag, generator level -// mapping of decay types -enum DecayType { XToJpsiPiPi = 0 }; // move this to a dedicated cascade namespace in the future? -} // namespace hf_cand_x - -// declare dedicated X candidate table -DECLARE_SOA_TABLE(HfCandXBase, "AOD", "HFCANDXBASE", - // general columns - HFCAND_COLUMNS, - // 3-prong specific columns - hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, - hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, - hf_cand::PxProng2, hf_cand::PyProng2, hf_cand::PzProng2, - hf_cand::ImpactParameter0, hf_cand::ImpactParameter1, hf_cand::ImpactParameter2, - hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, hf_cand::ErrorImpactParameter2, - hf_cand_x::Index0Id, hf_track_index::Index1Id, hf_track_index::Index2Id, // note the difference between Jpsi and pion indices - hf_track_index::HFflag, - /* dynamic columns */ - hf_cand_prong3::M, - hf_cand_prong3::M2, - /* prong 2 */ - hf_cand::PtProng2, - hf_cand::Pt2Prong2, - hf_cand::PVectorProng2, - /* dynamic columns that use candidate momentum components */ - hf_cand::Pt, - hf_cand::Pt2, - hf_cand::P, - hf_cand::P2, - hf_cand::PVector, - hf_cand::CPA, - hf_cand::CPAXY, - hf_cand::Ct, - hf_cand::ImpactParameterXY, - hf_cand_prong3::MaxNormalisedDeltaIP, - hf_cand::Eta, - hf_cand::Phi, - hf_cand::Y, - hf_cand::E, - hf_cand::E2); - -// extended table with expression columns that can be used as arguments of dynamic columns -DECLARE_SOA_EXTENDED_TABLE_USER(HfCandXExt, HfCandXBase, "HFCANDXEXT", - hf_cand_prong3::Px, hf_cand_prong3::Py, hf_cand_prong3::Pz); - -using HfCandX = HfCandXExt; - // table with results of reconstruction level MC matching DECLARE_SOA_TABLE(HfCandXMCRec, "AOD", "HFCANDXMCREC", //! hf_cand_x::FlagMCMatchRec, From 37929a24fae7a46faca2cb74d607287c4947dd51 Mon Sep 17 00:00:00 2001 From: rspijkers Date: Sat, 1 May 2021 21:14:18 +0200 Subject: [PATCH 04/43] deleted some more duplicated code... --- Analysis/Tasks/PWGHF/taskX.cxx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Analysis/Tasks/PWGHF/taskX.cxx b/Analysis/Tasks/PWGHF/taskX.cxx index 120fc488a1201..530db901459cb 100644 --- a/Analysis/Tasks/PWGHF/taskX.cxx +++ b/Analysis/Tasks/PWGHF/taskX.cxx @@ -196,18 +196,6 @@ struct TaskXMC { registry.fill(HIST("hPtGen"), particle.pt()); registry.fill(HIST("hEtaGen"), particle.eta(), particle.pt()); - // properties of gen matched X(3872), to get a first look at some cuts - float ptProngs[3]; - int counter = 0; - for (int iD = particle.daughter0(); iD <= particle.daughter1(); ++iD) { - ptProngs[counter] = particlesMC.iteratorAt(iD).pt(); - counter++; - } - registry.fill(HIST("hPtGenProng0"), ptProngs[0]); - registry.fill(HIST("hPtGenProng1"), ptProngs[1]); - registry.fill(HIST("hPtGenProng2"), ptProngs[2]); - registry.fill(HIST("hEtaGen"), particle.eta()); - // properties of gen matched X(3872), to get a first look at some cuts float ptProngs[3]; int counter = 0; From a46d600dcedacaa2f8d7f9d878f695613b3f8ccd Mon Sep 17 00:00:00 2001 From: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Date: Thu, 3 Jun 2021 17:43:23 +0200 Subject: [PATCH 05/43] add chi2PCA for X, (#6314) increase granularity for some histo's --- Analysis/Tasks/PWGHF/taskX.cxx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Analysis/Tasks/PWGHF/taskX.cxx b/Analysis/Tasks/PWGHF/taskX.cxx index 530db901459cb..36eb398ab9a35 100644 --- a/Analysis/Tasks/PWGHF/taskX.cxx +++ b/Analysis/Tasks/PWGHF/taskX.cxx @@ -53,12 +53,12 @@ struct TaskX { void init(o2::framework::InitContext&) { registry.add("hMass", "3-prong candidates;inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 3., 5.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hdeclength", "3-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 0.4}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hdeclengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 0.4}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclength", "3-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hd0Prong1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hd0Prong2", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPA", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCPA", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{220, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEta", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hImpParErr", "3-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hDecLenErr", "3-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -111,8 +111,8 @@ struct TaskXMC { void init(o2::framework::InitContext&) { - registry.add("hCPARecSig", "3-prong candidates (rec. matched);cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPARecBg", "3-prong candidates (rec. unmatched);cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCPARecSig", "3-prong candidates (rec. matched);cosine of pointing angle;entries", {HistType::kTH2F, {{220, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCPARecBg", "3-prong candidates (rec. unmatched);cosine of pointing angle;entries", {HistType::kTH2F, {{220, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEtaRecSig", "3-prong candidates (rec. matched);#it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEtaRecBg", "3-prong candidates (rec. unmatched);#it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEtaGen", "3-prong candidates (gen. matched);#it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -135,8 +135,10 @@ struct TaskXMC { registry.add("hd0Prong0RecBg", "3-prong candidates (rec. unmatched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hd0Prong1RecBg", "3-prong candidates (rec. unmatched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hd0Prong2RecBg", "3-prong candidates (rec. unmatched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDeclengthRecSig", "3-prong candidates (rec. matched);decay length (cm);entries", {HistType::kTH2F, {{200, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDeclengthRecBg", "3-prong candidates (rec. unmatched);decay length (cm);entries", {HistType::kTH2F, {{200, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDeclengthRecSig", "3-prong candidates (rec. matched);decay length (cm);entries", {HistType::kTH2F, {{400, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDeclengthRecBg", "3-prong candidates (rec. unmatched);decay length (cm);entries", {HistType::kTH2F, {{400, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hChi2PCASig", "3-prong candidates (rec. matched);chi2 PCA (cm);entries", {HistType::kTH2F, {{500, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hChi2PCABg", "3-prong candidates (rec. unmatched);chi2 PCA (cm);entries", {HistType::kTH2F, {{500, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiPiPi >= d_selectionFlagX); @@ -169,6 +171,7 @@ struct TaskXMC { registry.fill(HIST("hPtProng0RecSig"), candidate.ptProng0(), candidate.pt()); registry.fill(HIST("hPtProng1RecSig"), candidate.ptProng1(), candidate.pt()); registry.fill(HIST("hPtProng2RecSig"), candidate.ptProng2(), candidate.pt()); + registry.fill(HIST("hChi2PCASig"), candidate.chi2PCA(), candidate.pt()); } else { registry.fill(HIST("hPtRecBg"), candidate.pt()); registry.fill(HIST("hCPARecBg"), candidate.cpa(), candidate.pt()); @@ -182,6 +185,7 @@ struct TaskXMC { registry.fill(HIST("hPtProng0RecBg"), candidate.ptProng0(), candidate.pt()); registry.fill(HIST("hPtProng1RecBg"), candidate.ptProng1(), candidate.pt()); registry.fill(HIST("hPtProng2RecBg"), candidate.ptProng2(), candidate.pt()); + registry.fill(HIST("hChi2PCABg"), candidate.chi2PCA(), candidate.pt()); } } // rec // MC gen. From 9ec14ddd4f850ea234793f7c4f402c56bbd61889 Mon Sep 17 00:00:00 2001 From: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Date: Thu, 3 Jun 2021 18:23:55 +0200 Subject: [PATCH 06/43] add ct and Y histos for X (#6315) --- Analysis/Tasks/PWGHF/taskX.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Analysis/Tasks/PWGHF/taskX.cxx b/Analysis/Tasks/PWGHF/taskX.cxx index 36eb398ab9a35..75e55bdbfbd5e 100644 --- a/Analysis/Tasks/PWGHF/taskX.cxx +++ b/Analysis/Tasks/PWGHF/taskX.cxx @@ -137,8 +137,13 @@ struct TaskXMC { registry.add("hd0Prong2RecBg", "3-prong candidates (rec. unmatched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hDeclengthRecSig", "3-prong candidates (rec. matched);decay length (cm);entries", {HistType::kTH2F, {{400, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hDeclengthRecBg", "3-prong candidates (rec. unmatched);decay length (cm);entries", {HistType::kTH2F, {{400, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hChi2PCASig", "3-prong candidates (rec. matched);chi2 PCA (cm);entries", {HistType::kTH2F, {{500, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hChi2PCABg", "3-prong candidates (rec. unmatched);chi2 PCA (cm);entries", {HistType::kTH2F, {{500, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCtSig", "3-prong candidates (rec. matched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCtBg", "3-prong candidates (rec. unmatched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hYSig", "3-prong candidates (rec. matched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hYBg", "3-prong candidates (rec. unmatched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiPiPi >= d_selectionFlagX); @@ -172,6 +177,8 @@ struct TaskXMC { registry.fill(HIST("hPtProng1RecSig"), candidate.ptProng1(), candidate.pt()); registry.fill(HIST("hPtProng2RecSig"), candidate.ptProng2(), candidate.pt()); registry.fill(HIST("hChi2PCASig"), candidate.chi2PCA(), candidate.pt()); + registry.fill(HIST("hCtSig"), CtX(candidate), candidate.pt()); + registry.fill(HIST("hYSig"), YX(candidate), candidate.pt()); } else { registry.fill(HIST("hPtRecBg"), candidate.pt()); registry.fill(HIST("hCPARecBg"), candidate.cpa(), candidate.pt()); @@ -186,6 +193,8 @@ struct TaskXMC { registry.fill(HIST("hPtProng1RecBg"), candidate.ptProng1(), candidate.pt()); registry.fill(HIST("hPtProng2RecBg"), candidate.ptProng2(), candidate.pt()); registry.fill(HIST("hChi2PCABg"), candidate.chi2PCA(), candidate.pt()); + registry.fill(HIST("hCtBg"), CtX(candidate), candidate.pt()); + registry.fill(HIST("hYBg"), YX(candidate), candidate.pt()); } } // rec // MC gen. From 3dd5155693c9cf477707634e9fc138c6f859d4dc Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Thu, 3 Jun 2021 19:13:21 +0200 Subject: [PATCH 07/43] Add RICH information for Jpsi analysis (#6316) Co-authored-by: Biao Zhang --- Analysis/Tasks/PWGHF/CMakeLists.txt | 2 +- .../PWGHF/HFJpsiToEECandidateSelector.cxx | 171 ++++++++++++------ Analysis/Tasks/PWGHF/taskJpsi.cxx | 14 +- 3 files changed, 123 insertions(+), 64 deletions(-) diff --git a/Analysis/Tasks/PWGHF/CMakeLists.txt b/Analysis/Tasks/PWGHF/CMakeLists.txt index 37c404a785cf2..dced3cc182a51 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 524a4903842ef..5600c5600899d 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.}}}}, From 7778f4b759b0ae0c3f61f03570948b61dc6cda47 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Thu, 3 Jun 2021 19:15:53 +0200 Subject: [PATCH 08/43] Fix Clang --- .../PWGHF/HFJpsiToEECandidateSelector.cxx | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx index 440913f408a3f..6fda2592f5e0b 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx @@ -27,9 +27,11 @@ using namespace o2::framework; using namespace o2::aod::hf_cand_prong2; using namespace o2::analysis::hf_cuts_jpsi_toee; -namespace o2::aod { +namespace o2::aod +{ -namespace indices { +namespace indices +{ DECLARE_SOA_INDEX_COLUMN(Track, track); DECLARE_SOA_INDEX_COLUMN(RICH, rich); } // namespace indices @@ -40,7 +42,7 @@ DECLARE_SOA_INDEX_TABLE_USER(RICHTracksIndex, Tracks, "RICHTRK", struct RICHindexbuilder { Builds ind; - void init(o2::framework::InitContext &) {} + void init(o2::framework::InitContext&) {} }; /// Struct for applying J/ψ → e+ e− selection cuts @@ -71,19 +73,19 @@ struct HFJpsiToEECandidateSelector { Configurable d_nSigmaRICH{"d_nSigmaRICH", 3., "Nsigma cut on RICH only"}; Configurable d_nSigmaTOFCombined{ - "d_nSigmaTOFCombined", 5., "Nsigma cut on TOF combined with TPC"}; + "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"}; + "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"}; + "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 @@ -91,8 +93,9 @@ 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) { @@ -131,7 +134,9 @@ struct HFJpsiToEECandidateSelector { return true; } - template bool validRICHPID(const T &track) { + template + bool validRICHPID(const T& track) + { if (track.pt() < d_pidRICHMinpT || track.pt() >= d_pidRICHMaxpT) { return false; } @@ -139,15 +144,16 @@ struct HFJpsiToEECandidateSelector { } using Trks = soa::Join; - void process(aod::HfCandProng2 const &candidates, const Trks &tracks, - aod::RICHs const &) { + void process(aod::HfCandProng2 const& candidates, const Trks& tracks, + aod::RICHs const&) + { TrackSelectorPID selectorElectron(kElectron); 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 @@ -167,9 +173,9 @@ struct HFJpsiToEECandidateSelector { // track-level PID selection if (selectorElectron.getStatusTrackPIDTOF(trackPos) == - TrackSelectorPID::Status::PIDRejected || + TrackSelectorPID::Status::PIDRejected || selectorElectron.getStatusTrackPIDTOF(trackNeg) == - TrackSelectorPID::Status::PIDRejected) { + TrackSelectorPID::Status::PIDRejected) { hfSelJpsiToEECandidate(0); continue; } @@ -202,8 +208,9 @@ struct HFJpsiToEECandidateSelector { } }; -WorkflowSpec defineDataProcessing(ConfigContext const &cfgc) { +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ return WorkflowSpec{adaptAnalysisTask(cfgc), adaptAnalysisTask( - cfgc, TaskName{"hf-jpsi-toee-candidate-selector"})}; + cfgc, TaskName{"hf-jpsi-toee-candidate-selector"})}; } From b028c45246f9be641b594e8201a0941bc639ba5f Mon Sep 17 00:00:00 2001 From: Rik Spijkers <78484875+rspijkers@users.noreply.github.com> Date: Thu, 3 Jun 2021 22:50:45 +0200 Subject: [PATCH 09/43] add Ct, Y, and chi2PCA to jpsi task (#6317) * add Ct, Y, and chi2PCA to jpsi task * fix clang --- Analysis/Tasks/PWGHF/taskJpsi.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index 5600c5600899d..e50a9151fd77f 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -114,6 +114,12 @@ struct TaskJpsiMC { { registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hmassBkg", "2-prong candidates (rec unmatched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hChi2PCASig", "3-prong candidates (rec. matched);chi2 PCA (cm);entries", {HistType::kTH2F, {{500, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hChi2PCABg", "3-prong candidates (rec. unmatched);chi2 PCA (cm);entries", {HistType::kTH2F, {{500, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCtSig", "3-prong candidates (rec. matched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCtBg", "3-prong candidates (rec. unmatched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hYSig", "3-prong candidates (rec. matched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hYBg", "3-prong candidates (rec. unmatched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi); @@ -139,11 +145,17 @@ struct TaskJpsiMC { registry.fill(HIST("hCPARecSig"), candidate.cpa()); registry.fill(HIST("hEtaRecSig"), candidate.eta()); registry.fill(HIST("hmassSig"), InvMassJpsiToEE(candidate), candidate.pt()); + registry.fill(HIST("hChi2PCASig"), candidate.chi2PCA(), candidate.pt()); + registry.fill(HIST("hCtSig"), CtJpsi(candidate), candidate.pt()); + registry.fill(HIST("hYSig"), YJpsi(candidate), candidate.pt()); } else { registry.fill(HIST("hPtRecBg"), candidate.pt()); registry.fill(HIST("hCPARecBg"), candidate.cpa()); registry.fill(HIST("hEtaRecBg"), candidate.eta()); registry.fill(HIST("hmassBkg"), InvMassJpsiToEE(candidate), candidate.pt()); + registry.fill(HIST("hChi2PCABg"), candidate.chi2PCA(), candidate.pt()); + registry.fill(HIST("hCtBg"), CtJpsi(candidate), candidate.pt()); + registry.fill(HIST("hYBg"), YJpsi(candidate), candidate.pt()); } } // MC gen. From 96a292c4f62f2224585c757273fe4273a0807cd5 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Fri, 4 Jun 2021 05:04:47 +0200 Subject: [PATCH 10/43] Add chi2PCA selection --- .../include/AnalysisCore/HFSelectorCuts.h | 46 +++++++++---------- .../PWGHF/HFJpsiToEECandidateSelector.cxx | 4 ++ 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h b/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h index ecec536ceb7d2..57471cedf039d 100644 --- a/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h +++ b/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h @@ -335,7 +335,7 @@ static const std::vector cutVarLabels = {"m", "pT p", "pT K", "pT P namespace hf_cuts_jpsi_toee { static constexpr int npTBins = 9; -static constexpr int nCutVars = 4; +static constexpr int nCutVars = 5; // default values for the pT bin edges (can be used to configure histogram axis) // offset by 1 from the bin numbers in cuts array constexpr double pTBins[npTBins + 1] = { @@ -353,15 +353,15 @@ constexpr double pTBins[npTBins + 1] = { auto pTBins_v = std::vector{pTBins, pTBins + npTBins + 1}; // default values for the cuts -constexpr double cuts[npTBins][nCutVars] = {{0.5, 0.2, 0.4, 1}, /* 0 < pT < 0.5 */ - {0.5, 0.2, 0.4, 1}, /* 0.5 < pT < 1 */ - {0.5, 0.2, 0.4, 1}, /* 1 < pT < 2 */ - {0.5, 0.2, 0.4, 1}, /* 2 < pT < 3 */ - {0.5, 0.2, 0.4, 1}, /* 3 < pT < 4 */ - {0.5, 0.2, 0.4, 1}, /* 4 < pT < 5 */ - {0.5, 0.2, 0.4, 1}, /* 5 < pT < 7 */ - {0.5, 0.2, 0.4, 1}, /* 7 < pT < 10 */ - {0.5, 0.2, 0.4, 1}}; /* 10 < pT < 15 */ +constexpr double cuts[npTBins][nCutVars] = {{0.5, 0.2, 0.4, 1, 1.}, /* 0 < pT < 0.5 */ + {0.5, 0.2, 0.4, 1, 1.}, /* 0.5 < pT < 1 */ + {0.5, 0.2, 0.4, 1, 1.}, /* 1 < pT < 2 */ + {0.5, 0.2, 0.4, 1, 1.}, /* 2 < pT < 3 */ + {0.5, 0.2, 0.4, 1, 1.}, /* 3 < pT < 4 */ + {0.5, 0.2, 0.4, 1, 1.}, /* 4 < pT < 5 */ + {0.5, 0.2, 0.4, 1, 1.}, /* 5 < pT < 7 */ + {0.5, 0.2, 0.4, 1, 1.}, /* 7 < pT < 10 */ + {0.5, 0.2, 0.4, 1, 1.}}; /* 10 < pT < 15 */ // row labels static const std::vector pTBinLabels = { @@ -376,13 +376,13 @@ static const std::vector pTBinLabels = { "pT bin 8"}; // column labels -static const std::vector cutVarLabels = {"m", "DCA_xy", "DCA_z", "pT El"}; +static const std::vector cutVarLabels = {"m", "DCA_xy", "DCA_z", "pT El", "chi2PCA"}; } // namespace hf_cuts_jpsi_toee namespace hf_cuts_x_tojpsipipi { static constexpr int npTBins = 9; -static constexpr int nCutVars = 6; +static constexpr int nCutVars = 7; // default values for the pT bin edges (can be used to configure histogram axis) // offset by 1 from the bin numbers in cuts array constexpr double pTBins[npTBins + 1] = { @@ -400,16 +400,16 @@ constexpr double pTBins[npTBins + 1] = { auto pTBins_v = std::vector{pTBins, pTBins + npTBins + 1}; // default values for the cuts -// m CPA d0Jpsi d0Pi pTJpsi pTPi -constexpr double cuts[npTBins][nCutVars] = {{0.5, 0.80, 0.001, 0.001, 3.0, 0.15}, /* 0 pTBinLabels = { "pT bin 0", @@ -422,7 +422,7 @@ static const std::vector pTBinLabels = { "pT bin 7", "pT bin 8"}; // column labels -static const std::vector cutVarLabels = {"m", "CPA", "d0 Jpsi", "d0 Pi", "pT Jpsi", "pT Pi"}; +static const std::vector cutVarLabels = {"m", "CPA", "d0 Jpsi", "d0 Pi", "pT Jpsi", "pT Pi", "chi2PCA"}; } // namespace hf_cuts_x_tojpsipipi } // namespace o2::analysis diff --git a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx index 6fda2592f5e0b..932c824de1c30 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx @@ -132,6 +132,10 @@ struct HFJpsiToEECandidateSelector { return false; } + // cut on chi2 point of closest approach + if (std::abs(candidate.chi2PCA()) > cuts->get(pTBin, "chi2PCA")){ + return false; + } return true; } template From 6607ed437e84edf34b45800403c0b5c47e03e442 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Fri, 4 Jun 2021 05:05:54 +0200 Subject: [PATCH 11/43] adjust histogram ranges --- Analysis/Tasks/PWGHF/taskJpsi.cxx | 55 +++++++++++++++++++++---------- Analysis/Tasks/PWGHF/taskX.cxx | 54 +++++++++++++++--------------- 2 files changed, 65 insertions(+), 44 deletions(-) diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index e50a9151fd77f..7a62318fa4a8c 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -48,17 +48,17 @@ struct TaskJpsi { void init(o2::framework::InitContext&) { - registry.add("hmass", "2-prong candidates;inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hdeclength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hdeclengthxy", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong1", "2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0d0", "2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{500, -1., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPA", "2-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hmass", "2-prong candidates;inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclengthxy", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong1", "2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0d0", "2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCPA", "2-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{1000, 0.5, 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEta", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hImpParErr", "2-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLenErr", "2-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hImpParErr", "2-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDecLenErr", "2-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi); @@ -112,12 +112,22 @@ struct TaskJpsiMC { void init(o2::framework::InitContext&) { - registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hmassBkg", "2-prong candidates (rec unmatched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hChi2PCASig", "3-prong candidates (rec. matched);chi2 PCA (cm);entries", {HistType::kTH2F, {{500, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hChi2PCABg", "3-prong candidates (rec. unmatched);chi2 PCA (cm);entries", {HistType::kTH2F, {{500, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCtSig", "3-prong candidates (rec. matched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCtBg", "3-prong candidates (rec. unmatched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hmassBg", "2-prong candidates (rec unmatched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclengthSig", "2-prong candidates (rec matched);decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclengthBg", "2-prong candidates (rec unmatched);decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclengthxySig", "2-prong candidates (rec matched);decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclengthxyBg", "2-prong candidates (rec unmatched);decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong0Sig", "2-prong candidates (rec matched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong0Bg", "2-prong candidates (rec unmatched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong1Sig", "2-prong candidates (rec matched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong1Bg", "2-prong candidates (rec unmatched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0d0Sig", "2-prong candidates (rec matched);product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0d0Bg", "2-prong candidates (rec unmatched);product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hChi2PCASig", "3-prong candidates (rec. matched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hChi2PCABg", "3-prong candidates (rec. unmatched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCtSig", "3-prong candidates (rec. matched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCtBg", "3-prong candidates (rec. unmatched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hYSig", "3-prong candidates (rec. matched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hYBg", "3-prong candidates (rec. unmatched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } @@ -145,14 +155,25 @@ struct TaskJpsiMC { registry.fill(HIST("hCPARecSig"), candidate.cpa()); registry.fill(HIST("hEtaRecSig"), candidate.eta()); registry.fill(HIST("hmassSig"), InvMassJpsiToEE(candidate), candidate.pt()); + registry.fill(HIST("hdeclengthSig"), candidate.decayLength(), candidate.pt()); + registry.fill(HIST("hdeclengthxySig"), candidate.decayLengthXY(), candidate.pt()); + registry.fill(HIST("hd0Prong0Sig"), candidate.impactParameter0(), candidate.pt()); + registry.fill(HIST("hd0Prong1Sig"), candidate.impactParameter1(), candidate.pt()); + registry.fill(HIST("hd0d0Sig"), candidate.impactParameterProduct(), candidate.pt()); registry.fill(HIST("hChi2PCASig"), candidate.chi2PCA(), candidate.pt()); registry.fill(HIST("hCtSig"), CtJpsi(candidate), candidate.pt()); registry.fill(HIST("hYSig"), YJpsi(candidate), candidate.pt()); + } else { registry.fill(HIST("hPtRecBg"), candidate.pt()); registry.fill(HIST("hCPARecBg"), candidate.cpa()); registry.fill(HIST("hEtaRecBg"), candidate.eta()); - registry.fill(HIST("hmassBkg"), InvMassJpsiToEE(candidate), candidate.pt()); + registry.fill(HIST("hmassBg"), InvMassJpsiToEE(candidate), candidate.pt()); + registry.fill(HIST("hdeclengthBg"), candidate.decayLength(), candidate.pt()); + registry.fill(HIST("hdeclengthxyBg"), candidate.decayLengthXY(), candidate.pt()); + registry.fill(HIST("hd0Prong0Bg"), candidate.impactParameter0(), candidate.pt()); + registry.fill(HIST("hd0Prong1Bg"), candidate.impactParameter1(), candidate.pt()); + registry.fill(HIST("hd0d0Bg"), candidate.impactParameterProduct(), candidate.pt()); registry.fill(HIST("hChi2PCABg"), candidate.chi2PCA(), candidate.pt()); registry.fill(HIST("hCtBg"), CtJpsi(candidate), candidate.pt()); registry.fill(HIST("hYBg"), YJpsi(candidate), candidate.pt()); diff --git a/Analysis/Tasks/PWGHF/taskX.cxx b/Analysis/Tasks/PWGHF/taskX.cxx index 75e55bdbfbd5e..1ec2f9737f98b 100644 --- a/Analysis/Tasks/PWGHF/taskX.cxx +++ b/Analysis/Tasks/PWGHF/taskX.cxx @@ -52,17 +52,17 @@ struct TaskX { void init(o2::framework::InitContext&) { - registry.add("hMass", "3-prong candidates;inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 3., 5.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hdeclength", "3-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hdeclengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong2", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -0.05, 0.05}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPA", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{220, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMass", "3-prong candidates;inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 3., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclength", "3-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hdeclengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong1", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong2", "3-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCPA", "3-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{500, 0.9, 1.0}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEta", "3-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hImpParErr", "3-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLenErr", "3-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDecLenXYErr", "3-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hImpParErr", "3-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDecLenErr", "3-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDecLenXYErr", "3-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiPiPi >= d_selectionFlagX); @@ -111,8 +111,8 @@ struct TaskXMC { void init(o2::framework::InitContext&) { - registry.add("hCPARecSig", "3-prong candidates (rec. matched);cosine of pointing angle;entries", {HistType::kTH2F, {{220, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCPARecBg", "3-prong candidates (rec. unmatched);cosine of pointing angle;entries", {HistType::kTH2F, {{220, -1.1, 1.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCPARecSig", "3-prong candidates (rec. matched);cosine of pointing angle;entries", {HistType::kTH2F, {{500, 0.9, 1.0}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCPARecBg", "3-prong candidates (rec. unmatched);cosine of pointing angle;entries", {HistType::kTH2F, {{500, 0.9, 1.0}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEtaRecSig", "3-prong candidates (rec. matched);#it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEtaRecBg", "3-prong candidates (rec. unmatched);#it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hEtaGen", "3-prong candidates (gen. matched);#it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -127,21 +127,21 @@ struct TaskXMC { registry.add("hPtGenProng1", "3-prong candidates (gen. matched);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hPtGenProng2", "3-prong candidates (gen. matched);prong 2 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassRecSig", "3-prong candidates (rec. matched);inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 3.7, 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hMassRecBg", "3-prong candidates (rec. unmatched);inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{100, 3., 5.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong0RecSig", "3-prong candidates (rec. matched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong1RecSig", "3-prong candidates (rec. matched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong2RecSig", "3-prong candidates (rec. matched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong0RecBg", "3-prong candidates (rec. unmatched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong1RecBg", "3-prong candidates (rec. unmatched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hd0Prong2RecBg", "3-prong candidates (rec. unmatched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{200, -0.02, 0.02}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDeclengthRecSig", "3-prong candidates (rec. matched);decay length (cm);entries", {HistType::kTH2F, {{400, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hDeclengthRecBg", "3-prong candidates (rec. unmatched);decay length (cm);entries", {HistType::kTH2F, {{400, 0., 0.04}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - - registry.add("hChi2PCASig", "3-prong candidates (rec. matched);chi2 PCA (cm);entries", {HistType::kTH2F, {{500, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hChi2PCABg", "3-prong candidates (rec. unmatched);chi2 PCA (cm);entries", {HistType::kTH2F, {{500, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCtSig", "3-prong candidates (rec. matched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCtBg", "3-prong candidates (rec. unmatched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{100, 0., 0.1}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassRecSig", "3-prong candidates (rec. matched);inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 3., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassRecBg", "3-prong candidates (rec. unmatched);inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 3., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong0RecSig", "3-prong candidates (rec. matched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong1RecSig", "3-prong candidates (rec. matched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong2RecSig", "3-prong candidates (rec. matched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong0RecBg", "3-prong candidates (rec. unmatched);prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong1RecBg", "3-prong candidates (rec. unmatched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hd0Prong2RecBg", "3-prong candidates (rec. unmatched);prong 2 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDeclengthRecSig", "3-prong candidates (rec. matched);decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hDeclengthRecBg", "3-prong candidates (rec. unmatched);decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + + registry.add("hChi2PCASig", "3-prong candidates (rec. matched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hChi2PCABg", "3-prong candidates (rec. unmatched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCtSig", "3-prong candidates (rec. matched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCtBg", "3-prong candidates (rec. unmatched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hYSig", "3-prong candidates (rec. matched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hYBg", "3-prong candidates (rec. unmatched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } From 21d0728c54ffcbe52764e2aa6eb2e282c41fff7b Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Fri, 4 Jun 2021 05:07:33 +0200 Subject: [PATCH 12/43] Clang --- Analysis/Tasks/PWGHF/taskJpsi.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index 7a62318fa4a8c..c7cc6827e3183 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -155,7 +155,7 @@ struct TaskJpsiMC { registry.fill(HIST("hCPARecSig"), candidate.cpa()); registry.fill(HIST("hEtaRecSig"), candidate.eta()); registry.fill(HIST("hmassSig"), InvMassJpsiToEE(candidate), candidate.pt()); - registry.fill(HIST("hdeclengthSig"), candidate.decayLength(), candidate.pt()); + registry.fill(HIST("hdeclengthSig"), candidate.decayLength(), candidate.pt()); registry.fill(HIST("hdeclengthxySig"), candidate.decayLengthXY(), candidate.pt()); registry.fill(HIST("hd0Prong0Sig"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("hd0Prong1Sig"), candidate.impactParameter1(), candidate.pt()); @@ -163,13 +163,13 @@ struct TaskJpsiMC { registry.fill(HIST("hChi2PCASig"), candidate.chi2PCA(), candidate.pt()); registry.fill(HIST("hCtSig"), CtJpsi(candidate), candidate.pt()); registry.fill(HIST("hYSig"), YJpsi(candidate), candidate.pt()); - + } else { registry.fill(HIST("hPtRecBg"), candidate.pt()); registry.fill(HIST("hCPARecBg"), candidate.cpa()); registry.fill(HIST("hEtaRecBg"), candidate.eta()); registry.fill(HIST("hmassBg"), InvMassJpsiToEE(candidate), candidate.pt()); - registry.fill(HIST("hdeclengthBg"), candidate.decayLength(), candidate.pt()); + registry.fill(HIST("hdeclengthBg"), candidate.decayLength(), candidate.pt()); registry.fill(HIST("hdeclengthxyBg"), candidate.decayLengthXY(), candidate.pt()); registry.fill(HIST("hd0Prong0Bg"), candidate.impactParameter0(), candidate.pt()); registry.fill(HIST("hd0Prong1Bg"), candidate.impactParameter1(), candidate.pt()); From f4239ec9939cb1ee131ff2b4efa88fac8d5299b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Mon, 7 Jun 2021 17:16:03 +0200 Subject: [PATCH 13/43] Add MID and RICH in TrackSelectorPID (#6333) * Fix format and TPC in selector * Add MID table and functions in track selector * Add RICH in TrackSelectorPID * Add debugging messages * Define a single table for ALICE 3 PID track indices * Mute debugging messages * Accept only both accepted tracks for MID * Apply clang-format --- Analysis/ALICE3/include/ALICE3Analysis/MID.h | 43 ++++ .../include/AnalysisCore/TrackSelectorPID.h | 154 ++++++++++++- Analysis/Tasks/PWGHF/CMakeLists.txt | 1 - .../PWGHF/HFJpsiToEECandidateSelector.cxx | 210 ++++++++++-------- 4 files changed, 309 insertions(+), 99 deletions(-) create mode 100644 Analysis/ALICE3/include/ALICE3Analysis/MID.h diff --git a/Analysis/ALICE3/include/ALICE3Analysis/MID.h b/Analysis/ALICE3/include/ALICE3Analysis/MID.h new file mode 100644 index 0000000000000..b6964d056467c --- /dev/null +++ b/Analysis/ALICE3/include/ALICE3Analysis/MID.h @@ -0,0 +1,43 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// 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 MID.h +/// \author Vít Kučera +/// \note Based on RICH.h +/// \brief Set of tables for the ALICE3 MID information +/// + +#ifndef O2_ANALYSIS_ALICE3_MID_H_ +#define O2_ANALYSIS_ALICE3_MID_H_ + +// O2 includes +#include "Framework/AnalysisDataModel.h" + +namespace o2::aod +{ +namespace alice3mid +{ +DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! +DECLARE_SOA_INDEX_COLUMN(Track, track); //! +DECLARE_SOA_COLUMN(MIDIsMuon, midIsMuon, uint8_t); //! FIXME: To be changed to bool once bool columns are groupable. +} // namespace alice3mid + +DECLARE_SOA_TABLE(MIDs, "AOD", "MID", //! + o2::soa::Index<>, + alice3mid::CollisionId, + alice3mid::TrackId, + alice3mid::MIDIsMuon); + +using MID = MIDs::iterator; + +} // namespace o2::aod + +#endif // O2_ANALYSIS_ALICE3_MID_H_ diff --git a/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h b/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h index 1c9cf29269dcf..f2c958b5143fb 100644 --- a/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h +++ b/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h @@ -251,9 +251,151 @@ class TrackSelectorPID } } - /// Returns status of combined PID selection for a given track. + // RICH + + /// Set pT range where RICH PID is applicable. + void setRangePtRICH(float ptMin, float ptMax) + { + mPtRICHMin = ptMin; + mPtRICHMax = ptMax; + } + + /// Set RICH nσ range in which a track should be accepted. + void setRangeNSigmaRICH(float nsMin, float nsMax) + { + mNSigmaRICHMin = nsMin; + mNSigmaRICHMax = nsMax; + } + + /// Set RICH nσ range in which a track should be conditionally accepted if combined with TOF. + void setRangeNSigmaRICHCondTOF(float nsMin, float nsMax) + { + mNSigmaRICHMinCondTOF = nsMin; + mNSigmaRICHMaxCondTOF = nsMax; + } + + /// Checks if track is OK for RICH PID. + /// \param track track + /// \return true if track is OK for RICH PID + template + bool isValidTrackPIDRICH(const T& track) + { + auto pt = track.pt(); + return mPtRICHMin <= pt && pt <= mPtRICHMax; + } + + /// Checks if track is compatible with given particle species hypothesis within given RICH nσ range. /// \param track track - /// \return combined-selection status (see TrackSelectorPID::Status) + /// \param conditionalTOF variable to store the result of selection with looser cuts for conditional accepting of track if combined with TOF + /// \return true if track satisfies RICH PID hypothesis for given RICH nσ range + template + bool isSelectedTrackPIDRICH(const T& track, bool& conditionalTOF) + { + // Accept if selection is disabled via large values. + if (mNSigmaRICHMin < -999. && mNSigmaRICHMax > 999.) { + return true; + } + + // Get nσ for a given particle hypothesis. + double nSigma = 100.; + switch (mPdg) { + case kElectron: { + nSigma = track.rich().richNsigmaEl(); + break; + } + case kMuonMinus: { + nSigma = track.rich().richNsigmaMu(); + break; + } + case kPiPlus: { + nSigma = track.rich().richNsigmaPi(); + break; + } + case kKPlus: { + nSigma = track.rich().richNsigmaKa(); + break; + } + case kProton: { + nSigma = track.rich().richNsigmaPr(); + break; + } + default: { + LOGF(error, "ERROR: RICH PID not implemented for PDG %d", mPdg); + assert(false); + } + } + + if (mNSigmaRICHMinCondTOF < -999. && mNSigmaRICHMaxCondTOF > 999.) { + conditionalTOF = true; + } else { + conditionalTOF = mNSigmaRICHMinCondTOF <= nSigma && nSigma <= mNSigmaRICHMaxCondTOF; + } + return mNSigmaRICHMin <= nSigma && nSigma <= mNSigmaRICHMax; + } + + /// Returns status of RICH PID selection for a given track. + /// \param track track + /// \return RICH selection status (see TrackSelectorPID::Status) + template + int getStatusTrackPIDRICH(const T& track) + { + if (isValidTrackPIDRICH(track)) { + bool condTOF = false; + if (isSelectedTrackPIDRICH(track, condTOF)) { + return Status::PIDAccepted; // accepted + } else if (condTOF) { + return Status::PIDConditional; // potential to be accepted if combined with TOF + } else { + return Status::PIDRejected; // rejected + } + } else { + return Status::PIDNotApplicable; // PID not applicable + } + } + + // MID + + /// Checks if track is compatible with muon hypothesis in the MID detector. + /// \param track track + /// \return true if track has been identified as muon by the MID detector + template + bool isSelectedTrackPIDMID(const T& track) + { + if (mPdg != kMuonMinus) { + //LOGF(info, "isSelectedTrackPIDMID: Not a muon hypothesis"); + return false; + } + //LOGF(info, "isSelectedTrackPIDMID: Getting muon response"); + //LOGF(info, "isSelectedTrackPIDMID: Got: %d", track.mid().midIsMuon()); + //LOGF(info, "isSelectedTrackPIDMID: Return: %d", track.mid().midIsMuon() == 1); + return track.mid().midIsMuon() == 1; // FIXME: change to return track.midIsMuon() once the column is bool. + } + + /// Returns status of MID PID selection for a given track. + /// \param track track + /// \return MID selection status (see TrackSelectorPID::Status) + template + int getStatusTrackPIDMID(const T& track) + { + //LOGF(info, "getStatusTrackPIDMID: Start"); + if (mPdg != kMuonMinus) { + //LOGF(info, "getStatusTrackPIDMID: Not a muon hypothesis"); + return Status::PIDRejected; + } + if (isSelectedTrackPIDMID(track)) { + //LOGF(info, "getStatusTrackPIDMID: Accepted"); + return Status::PIDAccepted; // accepted + } else { + //LOGF(info, "getStatusTrackPIDMID: Rejected"); + return Status::PIDRejected; // rejected + } + } + + // Combined selection (TPC + TOF) + + /// Returns status of combined PID (TPC + TOF) selection for a given track. + /// \param track track + /// \return status of combined PID (TPC + TOF) (see TrackSelectorPID::Status) template int getStatusTrackPIDAll(const T& track) { @@ -290,6 +432,14 @@ class TrackSelectorPID float mNSigmaTOFMax = 3.; ///< maximum number of TOF σ float mNSigmaTOFMinCondTPC = -1000.; ///< minimum number of TOF σ if combined with TPC float mNSigmaTOFMaxCondTPC = 1000.; ///< maximum number of TOF σ if combined with TPC + + // RICH + float mPtRICHMin = 0.; ///< minimum pT for RICH PID [GeV/c] + float mPtRICHMax = 100.; ///< maximum pT for RICH PID [GeV/c] + float mNSigmaRICHMin = -3.; ///< minimum number of RICH σ + float mNSigmaRICHMax = 3.; ///< maximum number of RICH σ + float mNSigmaRICHMinCondTOF = -1000.; ///< minimum number of RICH σ if combined with TOF + float mNSigmaRICHMaxCondTOF = 1000.; ///< maximum number of RICH σ if combined with TOF }; #endif // O2_ANALYSIS_TRACKSELECTORPID_H_ diff --git a/Analysis/Tasks/PWGHF/CMakeLists.txt b/Analysis/Tasks/PWGHF/CMakeLists.txt index dced3cc182a51..6d97dbd3a1e5b 100644 --- a/Analysis/Tasks/PWGHF/CMakeLists.txt +++ b/Analysis/Tasks/PWGHF/CMakeLists.txt @@ -132,4 +132,3 @@ o2_add_dpl_workflow(hf-task-lc-tok0sp SOURCES taskLcK0sP.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::AnalysisTasksUtils COMPONENT_NAME Analysis) - diff --git a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx index 932c824de1c30..5d99fa6c1b9bc 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx @@ -15,29 +15,31 @@ /// \author Nima Zardoshti , CERN /// \author Vít Kučera , CERN -#include "ALICE3Analysis/RICH.h" -#include "AnalysisCore/TrackSelectorPID.h" -#include "AnalysisDataModel/HFCandidateSelectionTables.h" -#include "AnalysisDataModel/HFSecondaryVertex.h" -#include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "AnalysisDataModel/HFSecondaryVertex.h" +#include "AnalysisDataModel/HFCandidateSelectionTables.h" +#include "AnalysisCore/TrackSelectorPID.h" +#include "ALICE3Analysis/RICH.h" +#include "ALICE3Analysis/MID.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 +namespace indices_rich { DECLARE_SOA_INDEX_COLUMN(Track, track); DECLARE_SOA_INDEX_COLUMN(RICH, rich); -} // namespace indices +} // namespace indices_rich DECLARE_SOA_INDEX_TABLE_USER(RICHTracksIndex, Tracks, "RICHTRK", - indices::TrackId, indices::RICHId); + indices_rich::TrackId, indices_rich::RICHId); } // namespace o2::aod struct RICHindexbuilder { @@ -45,47 +47,70 @@ struct RICHindexbuilder { void init(o2::framework::InitContext&) {} }; +namespace o2::aod +{ + +namespace indices_mid +{ +DECLARE_SOA_INDEX_COLUMN(Track, track); +DECLARE_SOA_INDEX_COLUMN(MID, mid); +} // namespace indices_mid + +DECLARE_SOA_INDEX_TABLE_USER(MIDTracksIndex, Tracks, "MIDTRK", + indices_mid::TrackId, indices_mid::MIDId); +} // namespace o2::aod + +struct MidIndexBuilder { + Builds ind; + void init(o2::framework::InitContext&) {} +}; +*/ + +namespace o2::aod +{ + +namespace hf_track_index_alice3_pid +{ +DECLARE_SOA_INDEX_COLUMN(Track, track); //! +DECLARE_SOA_INDEX_COLUMN(RICH, rich); //! +DECLARE_SOA_INDEX_COLUMN(MID, mid); //! +} // namespace hf_track_index_alice3_pid + +DECLARE_SOA_INDEX_TABLE_USER(HfTrackIndexALICE3PID, Tracks, "HFTRKIDXA3PID", //! + hf_track_index_alice3_pid::TrackId, + hf_track_index_alice3_pid::RICHId, + hf_track_index_alice3_pid::MIDId); +} // namespace o2::aod + +struct Alice3PidIndexBuilder { + Builds index; + 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_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_TPCNClsFindablePIDCut{"d_TPCNClsFindablePIDCut", 70., "Lower bound of TPC findable clusters for good PID"}; + // TOF + 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_nSigmaTOFCombined{"d_nSigmaTOFCombined", 5., "Nsigma cut on TOF combined with TPC"}; + // RICH + 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_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"}; + 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 @@ -93,8 +118,7 @@ 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); @@ -108,104 +132,96 @@ 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; } // cut on chi2 point of closest approach - if (std::abs(candidate.chi2PCA()) > cuts->get(pTBin, "chi2PCA")){ - return false; - } - return true; - } - template - bool validRICHPID(const T& track) - { - if (track.pt() < d_pidRICHMinpT || track.pt() >= d_pidRICHMaxpT) { + if (std::abs(candidate.chi2PCA()) > cuts->get(pTBin, "chi2PCA")) { return false; } return true; } - using Trks = soa::Join; - void process(aod::HfCandProng2 const& candidates, const Trks& tracks, - aod::RICHs const&) + using TracksPID = soa::Join; + + void process(aod::HfCandProng2 const& candidates, TracksPID const&, aod::RICHs const&, aod::MIDs 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); + selectorElectron.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); + selectorElectron.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); + selectorElectron.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); + + TrackSelectorPID selectorMuon(kMuonMinus); + // looping over 2-prong 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; } - // 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); continue; } - // track-level PID selection - if (selectorElectron.getStatusTrackPIDTOF(trackPos) == - TrackSelectorPID::Status::PIDRejected || - selectorElectron.getStatusTrackPIDTOF(trackNeg) == - TrackSelectorPID::Status::PIDRejected) { + // track-level PID TPC selection + // FIXME: temporarily disabled for ALICE 3 development + //if (selectorElectron.getStatusTrackPIDTPC(trackPos) == TrackSelectorPID::Status::PIDRejected || + // selectorElectron.getStatusTrackPIDTPC(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + // hfSelJpsiToEECandidate(0); + // continue; + //} + + // track-level PID TOF selection + 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"); + // track-level PID RICH selection + if (selectorElectron.getStatusTrackPIDRICH(trackPos) != TrackSelectorPID::Status::PIDAccepted || + selectorElectron.getStatusTrackPIDRICH(trackNeg) != TrackSelectorPID::Status::PIDAccepted) { + hfSelJpsiToEECandidate(0); + continue; } - // 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; - } + // track-level muon PID MID selection + //LOGF(info, "Muon selection: Start"); + if (selectorMuon.getStatusTrackPIDMID(trackPos) != TrackSelectorPID::Status::PIDAccepted || + selectorMuon.getStatusTrackPIDMID(trackNeg) != TrackSelectorPID::Status::PIDAccepted) { + //LOGF(info, "Muon selection: Rejected"); + hfSelJpsiToEECandidate(0); + continue; } + //LOGF(info, "Muon selection: Selected"); hfSelJpsiToEECandidate(1); } @@ -214,7 +230,9 @@ struct HFJpsiToEECandidateSelector { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc), - adaptAnalysisTask( - cfgc, TaskName{"hf-jpsi-toee-candidate-selector"})}; + return WorkflowSpec{ + //adaptAnalysisTask(cfgc), + //adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc, TaskName{"hf-jpsi-toee-candidate-selector"})}; } From a37b9cb1b7ee47ab1e1de605eddac1a2821d5a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Mon, 7 Jun 2021 19:10:02 +0200 Subject: [PATCH 14/43] =?UTF-8?q?Add=20J/=CF=88=20=E2=86=92=20=CE=BC+=20?= =?UTF-8?q?=CE=BC=E2=88=92=20matching=20(#6341)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add J/ψ → μ+ μ− matching * Remove mysterious std::move --- .../AnalysisDataModel/HFSecondaryVertex.h | 1 + .../Tasks/PWGHF/HFCandidateCreator2Prong.cxx | 19 ++++++++++++++++++- .../Tasks/PWGHF/HFCandidateCreator3Prong.cxx | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h index 794040dda9ca3..154060b5fd3b2 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h @@ -218,6 +218,7 @@ DECLARE_SOA_COLUMN(OriginMCGen, originMCGen, int8_t); //! particle origin, // mapping of decay types enum DecayType { D0ToPiK = 0, JpsiToEE, + JpsiToMuMu, N2ProngDecays }; //always keep N2ProngDecays at the end // functions for specific particles diff --git a/Analysis/Tasks/PWGHF/HFCandidateCreator2Prong.cxx b/Analysis/Tasks/PWGHF/HFCandidateCreator2Prong.cxx index 6249f1a8148f9..8a42533df1762 100644 --- a/Analysis/Tasks/PWGHF/HFCandidateCreator2Prong.cxx +++ b/Analysis/Tasks/PWGHF/HFCandidateCreator2Prong.cxx @@ -172,12 +172,21 @@ struct HFCandidateCreator2ProngMC { // J/ψ → e+ e− if (flag == 0) { //Printf("Checking J/ψ → e+ e−"); - indexRec = RecoDecay::getMatchedMCRec(particlesMC, std::move(arrayDaughters), pdg::Code::kJpsi, array{+kElectron, -kElectron}, true); + indexRec = RecoDecay::getMatchedMCRec(particlesMC, arrayDaughters, pdg::Code::kJpsi, array{+kElectron, -kElectron}, true); if (indexRec > -1) { flag = 1 << DecayType::JpsiToEE; } } + // J/ψ → μ+ μ− + if (flag == 0) { + //Printf("Checking J/ψ → μ+ μ−"); + indexRec = RecoDecay::getMatchedMCRec(particlesMC, arrayDaughters, pdg::Code::kJpsi, array{+kMuonPlus, -kMuonPlus}, true); + if (indexRec > -1) { + flag = 1 << DecayType::JpsiToMuMu; + } + } + // Check whether the particle is non-prompt (from a b quark). if (flag != 0) { auto particle = particlesMC.iteratorAt(indexRec); @@ -207,6 +216,14 @@ struct HFCandidateCreator2ProngMC { } } + // J/ψ → μ+ μ− + if (flag == 0) { + //Printf("Checking J/ψ → μ+ μ−"); + if (RecoDecay::isMatchedMCGen(particlesMC, particle, pdg::Code::kJpsi, array{+kMuonPlus, -kMuonPlus}, true)) { + flag = 1 << DecayType::JpsiToMuMu; + } + } + // Check whether the particle is non-prompt (from a b quark). if (flag != 0) { origin = (RecoDecay::getMother(particlesMC, particle, kBottom, true) > -1 ? OriginType::NonPrompt : OriginType::Prompt); diff --git a/Analysis/Tasks/PWGHF/HFCandidateCreator3Prong.cxx b/Analysis/Tasks/PWGHF/HFCandidateCreator3Prong.cxx index 3a0b7f491b2ed..9290531df9036 100644 --- a/Analysis/Tasks/PWGHF/HFCandidateCreator3Prong.cxx +++ b/Analysis/Tasks/PWGHF/HFCandidateCreator3Prong.cxx @@ -210,7 +210,7 @@ struct HFCandidateCreator3ProngMC { // Ξc± → p± K∓ π± if (flag == 0) { //Printf("Checking Ξc± → p± K∓ π±"); - indexRec = RecoDecay::getMatchedMCRec(particlesMC, std::move(arrayDaughters), pdg::Code::kXiCPlus, array{+kProton, -kKPlus, +kPiPlus}, true, &sign); + indexRec = RecoDecay::getMatchedMCRec(particlesMC, arrayDaughters, pdg::Code::kXiCPlus, array{+kProton, -kKPlus, +kPiPlus}, true, &sign); if (indexRec > -1) { flag = sign * (1 << DecayType::XicToPKPi); } From 2eff73e4d648ba8c4594ca05155a2ae672e74e31 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Mon, 7 Jun 2021 19:18:44 +0200 Subject: [PATCH 15/43] Add muon channel in the skim (#6342) * Add Muon channel in the HF skim * Clang Fix * add space back Co-authored-by: Gian Michele Innocenti --- .../include/AnalysisCore/HFConfigurables.h | 6 ++++++ .../AnalysisDataModel/HFSecondaryVertex.h | 20 +++++++++++++++---- .../Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx | 15 +++++++++++++- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/Analysis/Core/include/AnalysisCore/HFConfigurables.h b/Analysis/Core/include/AnalysisCore/HFConfigurables.h index 88458bccd3ca3..ce6c62fba5ec1 100644 --- a/Analysis/Core/include/AnalysisCore/HFConfigurables.h +++ b/Analysis/Core/include/AnalysisCore/HFConfigurables.h @@ -38,6 +38,12 @@ class HFTrackIndexSkimsCreatorConfigs double mInvMassJpsiToEEMax = 4.1; double mCPAJpsiToEEMin = -2; double mImpParProductJpsiToEEMax = 1000.; + // JpsiToMuMu + double mPtJpsiToMuMuMin = 4.; //original value 0. + double mInvMassJpsiToMuMuMin = 2.5; + double mInvMassJpsiToMuMuMax = 4.1; + double mCPAJpsiToMuMuMin = -2; + double mImpParProductJpsiToMuMuMax = 1000.; // 3-prong cuts diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h index 154060b5fd3b2..c6814461b288a 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h @@ -56,8 +56,9 @@ DECLARE_SOA_INDEX_COLUMN_FULL(Index3, index3, int, Tracks, "_3"); //! DECLARE_SOA_INDEX_COLUMN_FULL(IndexV0, indexV0, int, aod::V0Datas, "_V0"); //! DECLARE_SOA_COLUMN(HFflag, hfflag, uint8_t); //! -DECLARE_SOA_COLUMN(D0ToKPiFlag, d0ToKPiFlag, uint8_t); //! -DECLARE_SOA_COLUMN(JpsiToEEFlag, jpsiToEEFlag, uint8_t); //! +DECLARE_SOA_COLUMN(D0ToKPiFlag, d0ToKPiFlag, uint8_t); //! +DECLARE_SOA_COLUMN(JpsiToEEFlag, jpsiToEEFlag, uint8_t); //! +DECLARE_SOA_COLUMN(JpsiToMuMuFlag, jpsiToMuMuFlag, uint8_t); //! DECLARE_SOA_COLUMN(DPlusPiKPiFlag, dPlusPiKPiFlag, uint8_t); //! DECLARE_SOA_COLUMN(LcPKPiFlag, lcPKPiFlag, uint8_t); //! @@ -77,7 +78,8 @@ DECLARE_SOA_TABLE(HfTrackIndexCasc, "AOD", "HFTRACKIDXCASC", //! DECLARE_SOA_TABLE(HfCutStatusProng2, "AOD", "HFCUTSTATUSP2", //! hf_track_index::D0ToKPiFlag, - hf_track_index::JpsiToEEFlag); + hf_track_index::JpsiToEEFlag, + hf_track_index::JpsiToMuMuFlag); DECLARE_SOA_TABLE(HfTrackIndexProng3, "AOD", "HFTRACKIDXP3", //! hf_track_index::Index0Id, @@ -267,7 +269,7 @@ auto CosThetaStarD0bar(const T& candidate) return candidate.cosThetaStar(array{RecoDecay::getMassPDG(kKPlus), RecoDecay::getMassPDG(kPiPlus)}, RecoDecay::getMassPDG(pdg::Code::kD0), 0); } -// J/ψ → e+ e− +// J/ψ template auto CtJpsi(const T& candidate) @@ -287,11 +289,21 @@ auto EJpsi(const T& candidate) return candidate.e(RecoDecay::getMassPDG(pdg::Code::kJpsi)); } +// J/ψ → e+ e− + template auto InvMassJpsiToEE(const T& candidate) { return candidate.m(array{RecoDecay::getMassPDG(kElectron), RecoDecay::getMassPDG(kElectron)}); } + +// J/ψ → µ+ µ− + +template +auto InvMassJpsiToMuMu(const T& candidate) +{ + return candidate.m(array{RecoDecay::getMassPDG(kMuonPlus), RecoDecay::getMassPDG(kMuonMinus)}); +} } // namespace hf_cand_prong2 // general columns diff --git a/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx b/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx index 764e2470c2fd3..18df502c6af31 100644 --- a/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx +++ b/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx @@ -297,6 +297,7 @@ struct HFTrackIndexSkimsCreator { {"hNCand2ProngVsNTracks", "2-prong candidates preselected;# of selected tracks;# of candidates;entries", {HistType::kTH2F, {{2500, 0., 25000.}, {2000, 0., 200000.}}}}, {"hmassD0ToPiK", "D^{0} candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}}, {"hmassJpsiToEE", "J/#psi candidates;inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}}, + {"hmassJpsiToMuMu", "J/#psi candidates;inv. mass (#mu^{#plus} #mu^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}}, // 3-prong histograms {"hvtx3_x", "3-prong candidates;#it{x}_{sec. vtx.} (cm);entries", {HistType::kTH1F, {{1000, -2., 2.}}}}, {"hvtx3_y", "3-prong candidates;#it{y}_{sec. vtx.} (cm);entries", {HistType::kTH1F, {{1000, -2., 2.}}}}, @@ -319,6 +320,7 @@ struct HFTrackIndexSkimsCreator { double massK = RecoDecay::getMassPDG(kKPlus); double massProton = RecoDecay::getMassPDG(kProton); double massElectron = RecoDecay::getMassPDG(kElectron); + double massMuon = RecoDecay::getMassPDG(kMuonMinus); // int nColls{0}; //can be added to run over limited collisions per file - for tesing purposes @@ -376,6 +378,12 @@ struct HFTrackIndexSkimsCreator { cut2ProngCPACandMin[hf_cand_prong2::DecayType::JpsiToEE] = configs->mCPAJpsiToEEMin; cut2ProngImpParProductCandMax[hf_cand_prong2::DecayType::JpsiToEE] = configs->mImpParProductJpsiToEEMax; + cut2ProngPtCandMin[hf_cand_prong2::DecayType::JpsiToMuMu] = configs->mPtJpsiToMuMuMin; + cut2ProngInvMassCandMin[hf_cand_prong2::DecayType::JpsiToMuMu] = configs->mInvMassJpsiToMuMuMin; + cut2ProngInvMassCandMax[hf_cand_prong2::DecayType::JpsiToMuMu] = configs->mInvMassJpsiToMuMuMax; + cut2ProngCPACandMin[hf_cand_prong2::DecayType::JpsiToMuMu] = configs->mCPAJpsiToMuMuMin; + cut2ProngImpParProductCandMax[hf_cand_prong2::DecayType::JpsiToMuMu] = configs->mImpParProductJpsiToMuMuMax; + const int nCuts3Prong = 4; // how many different selections are made on 3-prongs double cut3ProngPtCandMin[n3ProngDecays]; double cut3ProngInvMassCandMin[n3ProngDecays]; @@ -415,10 +423,12 @@ struct HFTrackIndexSkimsCreator { array, n2ProngDecays> arr2Mass1; arr2Mass1[hf_cand_prong2::DecayType::D0ToPiK] = array{massPi, massK}; arr2Mass1[hf_cand_prong2::DecayType::JpsiToEE] = array{massElectron, massElectron}; + arr2Mass1[hf_cand_prong2::DecayType::JpsiToMuMu] = array{massMuon, massMuon}; array, n2ProngDecays> arr2Mass2; arr2Mass2[hf_cand_prong2::DecayType::D0ToPiK] = array{massK, massPi}; arr2Mass2[hf_cand_prong2::DecayType::JpsiToEE] = array{massElectron, massElectron}; + arr2Mass2[hf_cand_prong2::DecayType::JpsiToMuMu] = array{massMuon, massMuon}; array, n3ProngDecays> arr3Mass1; arr3Mass1[hf_cand_prong3::DecayType::DPlusToPiKPi] = array{massPi, massK, massPi}; @@ -591,7 +601,7 @@ struct HFTrackIndexSkimsCreator { } } } - rowProng2CutStatus(Prong2CutStatus[0], Prong2CutStatus[1]); //FIXME when we can do this by looping over n2ProngDecays + rowProng2CutStatus(Prong2CutStatus[0], Prong2CutStatus[1], Prong2CutStatus[2]); //FIXME when we can do this by looping over n2ProngDecays } // fill histograms @@ -611,6 +621,9 @@ struct HFTrackIndexSkimsCreator { if (n2 == hf_cand_prong2::DecayType::JpsiToEE) { registry.get(HIST("hmassJpsiToEE"))->Fill(mass2ProngHypo1[n2]); } + if (n2 == hf_cand_prong2::DecayType::JpsiToMuMu) { + registry.get(HIST("hmassJpsiToMuMu"))->Fill(mass2ProngHypo1[n2]); + } } if ((cut2ProngInvMassCandMin[n2] < 0. && cut2ProngInvMassCandMax[n2] <= 0.) || (mass2ProngHypo2[n2] >= cut2ProngInvMassCandMin[n2] && mass2ProngHypo2[n2] < cut2ProngInvMassCandMax[n2])) { mass2ProngHypo2[n2] = RecoDecay::M(arrMom, arr2Mass2[n2]); From fc730bf7a3cf1105e339e6472d4ab12a4ed6d1a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Mon, 7 Jun 2021 19:48:20 +0200 Subject: [PATCH 16/43] Apply soft track selection (#6343) --- Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx index 5d99fa6c1b9bc..0f6eb8e393dbe 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx @@ -207,16 +207,16 @@ struct HFJpsiToEECandidateSelector { } // track-level PID RICH selection - if (selectorElectron.getStatusTrackPIDRICH(trackPos) != TrackSelectorPID::Status::PIDAccepted || - selectorElectron.getStatusTrackPIDRICH(trackNeg) != TrackSelectorPID::Status::PIDAccepted) { + if (selectorElectron.getStatusTrackPIDRICH(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorElectron.getStatusTrackPIDRICH(trackNeg) == TrackSelectorPID::Status::PIDRejected) { hfSelJpsiToEECandidate(0); continue; } // track-level muon PID MID selection //LOGF(info, "Muon selection: Start"); - if (selectorMuon.getStatusTrackPIDMID(trackPos) != TrackSelectorPID::Status::PIDAccepted || - selectorMuon.getStatusTrackPIDMID(trackNeg) != TrackSelectorPID::Status::PIDAccepted) { + if (selectorMuon.getStatusTrackPIDMID(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorMuon.getStatusTrackPIDMID(trackNeg) == TrackSelectorPID::Status::PIDRejected) { //LOGF(info, "Muon selection: Rejected"); hfSelJpsiToEECandidate(0); continue; From 10f07028d60e2c198a252bfcad3f5f551fa9cd61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Tue, 8 Jun 2021 18:44:16 +0200 Subject: [PATCH 17/43] =?UTF-8?q?Add=20J/=CF=88=20=E2=86=92=20=CE=BC+=20?= =?UTF-8?q?=CE=BC=E2=88=92=20selection=20in=20selector=20(#6350)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix micro to mu * Add ALICE 2/3 switch * Reshuffle ALICE 2/3 detectors * Add μ+ μ− selection column in selector * Define things when needed * Remove ee from selector names --- .../HFCandidateSelectionTables.h | 6 +- .../AnalysisDataModel/HFSecondaryVertex.h | 2 +- Analysis/Tasks/PWGHF/CMakeLists.txt | 4 +- Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx | 2 +- ...lector.cxx => HFJpsiCandidateSelector.cxx} | 107 +++++++++++------- .../PWGHF/HFXToJpsiPiPiCandidateSelector.cxx | 2 +- Analysis/Tasks/PWGHF/taskJpsi.cxx | 4 +- 7 files changed, 74 insertions(+), 53 deletions(-) rename Analysis/Tasks/PWGHF/{HFJpsiToEECandidateSelector.cxx => HFJpsiCandidateSelector.cxx} (70%) diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h b/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h index cd45f99573411..6780e2c324968 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h @@ -39,9 +39,11 @@ DECLARE_SOA_TABLE(HFSelLcCandidate, "AOD", "HFSELLCCAND", //! namespace hf_selcandidate_jpsi { DECLARE_SOA_COLUMN(IsSelJpsiToEE, isSelJpsiToEE, int); //! +DECLARE_SOA_COLUMN(IsSelJpsiToMuMu, isSelJpsiToMuMu, int); //! } // namespace hf_selcandidate_jpsi -DECLARE_SOA_TABLE(HFSelJpsiToEECandidate, "AOD", "HFSELJPSICAND", //! - hf_selcandidate_jpsi::IsSelJpsiToEE); +DECLARE_SOA_TABLE(HFSelJpsiCandidate, "AOD", "HFSELJPSICAND", //! + hf_selcandidate_jpsi::IsSelJpsiToEE, + hf_selcandidate_jpsi::IsSelJpsiToMuMu); namespace hf_selcandidate_lc_k0sp { diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h index c6814461b288a..1db71decd538b 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h @@ -297,7 +297,7 @@ auto InvMassJpsiToEE(const T& candidate) return candidate.m(array{RecoDecay::getMassPDG(kElectron), RecoDecay::getMassPDG(kElectron)}); } -// J/ψ → µ+ µ− +// J/ψ → μ+ μ− template auto InvMassJpsiToMuMu(const T& candidate) diff --git a/Analysis/Tasks/PWGHF/CMakeLists.txt b/Analysis/Tasks/PWGHF/CMakeLists.txt index 6d97dbd3a1e5b..4786abcd788d1 100644 --- a/Analysis/Tasks/PWGHF/CMakeLists.txt +++ b/Analysis/Tasks/PWGHF/CMakeLists.txt @@ -68,8 +68,8 @@ o2_add_dpl_workflow(hf-lc-candidate-selector PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing COMPONENT_NAME Analysis) -o2_add_dpl_workflow(hf-jpsi-toee-candidate-selector - SOURCES HFJpsiToEECandidateSelector.cxx +o2_add_dpl_workflow(hf-jpsi-candidate-selector + SOURCES HFJpsiCandidateSelector.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::ALICE3Analysis COMPONENT_NAME Analysis) diff --git a/Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx b/Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx index 77f54977d0b92..f257cdbba0329 100644 --- a/Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx +++ b/Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx @@ -68,7 +68,7 @@ struct HFCandidateCreatorX { void process(aod::Collision const& collision, soa::Filtered> const& jpsiCands, + aod::HFSelJpsiCandidate>> const& jpsiCands, aod::BigTracks const& tracks) { // 2-prong vertex fitter (to rebuild Jpsi vertex) diff --git a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx similarity index 70% rename from Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx rename to Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx index 0f6eb8e393dbe..054be874f1a4c 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiToEECandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx @@ -8,7 +8,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file HFJpsiToEECandidateSelector.cxx +/// \file HFJpsiCandidateSelector.cxx /// \brief J/ψ → e+ e− selection task /// /// \author Biao Zhang , CCNU @@ -88,16 +88,16 @@ struct Alice3PidIndexBuilder { }; /// Struct for applying J/ψ → e+ e− selection cuts -struct HFJpsiToEECandidateSelector { - Produces hfSelJpsiToEECandidate; +struct HFJpsiCandidateSelector { + Produces hfSelJpsiCandidate; + Configurable isALICE3{"isALICE3", false, "Switch between ALICE 2 and ALICE 3 detector setup"}; 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_nSigmaTPC{"d_nSigmaTPC", 3., "Nsigma cut on TPC only"}; - //Configurable d_TPCNClsFindablePIDCut{"d_TPCNClsFindablePIDCut", 70., "Lower bound of TPC findable clusters for good PID"}; // TOF 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"}; @@ -107,18 +107,17 @@ struct HFJpsiToEECandidateSelector { 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"}; - // 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"}; /// Conjugate-independent topological cuts /// \param candidate is candidate - /// \param trackPositron is the track with the positron hypothesis - /// \param trackElectron is the track with the electron hypothesis + /// \param trackPos is the positive track + /// \param trackNeg is the negative track /// \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& trackPos, const T2& trackNeg, int& selEE, int& selMuMu) { auto candpT = candidate.pt(); auto pTBin = findBin(pTBins, candpT); @@ -131,23 +130,32 @@ struct HFJpsiToEECandidateSelector { return false; } - // cut on invariant mass + // cut on e+ e− invariant mass if (std::abs(InvMassJpsiToEE(candidate) - RecoDecay::getMassPDG(pdg::Code::kJpsi)) > cuts->get(pTBin, "m")) { + selEE = 0; + } + + // cut on μ+ μ− invariant mass + if (std::abs(InvMassJpsiToMuMu(candidate) - RecoDecay::getMassPDG(pdg::Code::kJpsi)) > cuts->get(pTBin, "m")) { + selMuMu = 0; + } + + if (selEE == 0 && selMuMu == 0) { return false; } - // cut on daughter pT - if (trackElectron.pt() < cuts->get(pTBin, "pT El") || trackPositron.pt() < cuts->get(pTBin, "pT El")) { + // cut on daughter pT (same cut used for both channels) + if (trackNeg.pt() < cuts->get(pTBin, "pT El") || trackPos.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(trackNeg.dcaPrim0()) > cuts->get(pTBin, "DCA_xy") || std::abs(trackPos.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(trackNeg.dcaPrim1()) > cuts->get(pTBin, "DCA_z") || std::abs(trackPos.dcaPrim1()) > cuts->get(pTBin, "DCA_z")) { return false; } @@ -176,54 +184,65 @@ struct HFJpsiToEECandidateSelector { // looping over 2-prong candidates for (auto& candidate : candidates) { + if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE) && !(candidate.hfflag() & 1 << DecayType::JpsiToMuMu)) { + hfSelJpsiCandidate(0, 0); + continue; + } + auto trackPos = candidate.index0_as(); // positive daughter auto trackNeg = candidate.index1_as(); // negative daughter - if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE)) { - hfSelJpsiToEECandidate(0); - continue; - } + int selectedEE = 1; + int selectedMuMu = 1; // track selection level need to add special cuts (additional cuts on decay length and d0 norm) - if (!selectionTopol(candidate, trackPos, trackNeg)) { - hfSelJpsiToEECandidate(0); + if (!selectionTopol(candidate, trackPos, trackNeg, selectedEE, selectedMuMu)) { + hfSelJpsiCandidate(0, 0); continue; } - // track-level PID TPC selection - // FIXME: temporarily disabled for ALICE 3 development - //if (selectorElectron.getStatusTrackPIDTPC(trackPos) == TrackSelectorPID::Status::PIDRejected || - // selectorElectron.getStatusTrackPIDTPC(trackNeg) == TrackSelectorPID::Status::PIDRejected) { - // hfSelJpsiToEECandidate(0); - // continue; - //} - - // track-level PID TOF selection + // track-level electron PID TOF selection if (selectorElectron.getStatusTrackPIDTOF(trackPos) == TrackSelectorPID::Status::PIDRejected || selectorElectron.getStatusTrackPIDTOF(trackNeg) == TrackSelectorPID::Status::PIDRejected) { - hfSelJpsiToEECandidate(0); - continue; + selectedEE = 0; } - // track-level PID RICH selection - if (selectorElectron.getStatusTrackPIDRICH(trackPos) == TrackSelectorPID::Status::PIDRejected || - selectorElectron.getStatusTrackPIDRICH(trackNeg) == TrackSelectorPID::Status::PIDRejected) { - hfSelJpsiToEECandidate(0); + if (selectedEE == 0 && selectedMuMu == 0) { + hfSelJpsiCandidate(0, 0); continue; } - // track-level muon PID MID selection - //LOGF(info, "Muon selection: Start"); - if (selectorMuon.getStatusTrackPIDMID(trackPos) == TrackSelectorPID::Status::PIDRejected || - selectorMuon.getStatusTrackPIDMID(trackNeg) == TrackSelectorPID::Status::PIDRejected) { - //LOGF(info, "Muon selection: Rejected"); - hfSelJpsiToEECandidate(0); - continue; + if (isALICE3) { // ALICE 3 detectors + // track-level electron PID RICH selection + if (selectorElectron.getStatusTrackPIDRICH(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorElectron.getStatusTrackPIDRICH(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + selectedEE = 0; + } + + if (selectedEE == 0 && selectedMuMu == 0) { + hfSelJpsiCandidate(0, 0); + continue; + } + + // track-level muon PID MID selection + //LOGF(info, "Muon selection: Start"); + if (selectorMuon.getStatusTrackPIDMID(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorMuon.getStatusTrackPIDMID(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + //LOGF(info, "Muon selection: Rejected"); + selectedMuMu = 0; + } + //LOGF(info, "Muon selection: Selected"); + + } else { // ALICE 2 detectors + // track-level electron PID TPC selection + if (selectorElectron.getStatusTrackPIDTPC(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorElectron.getStatusTrackPIDTPC(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + selectedEE = 0; + } } - //LOGF(info, "Muon selection: Selected"); - hfSelJpsiToEECandidate(1); + hfSelJpsiCandidate(selectedEE, selectedMuMu); } } }; @@ -234,5 +253,5 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) //adaptAnalysisTask(cfgc), //adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc, TaskName{"hf-jpsi-toee-candidate-selector"})}; + adaptAnalysisTask(cfgc, TaskName{"hf-jpsi-candidate-selector"})}; } diff --git a/Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx index 39a5b9675cffd..0efd8a6dbe538 100644 --- a/Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx @@ -10,7 +10,7 @@ /// \file HFXToJpsiPiPiCandidateSelector.cxx /// \brief X(3872) selection task. -/// \note Adapted from HFJpsiToEECandidateSelector.cxx +/// \note Adapted from HFJpsiCandidateSelector.cxx /// \author Rik Spijkers , Utrecht University #include "Framework/runDataProcessing.h" diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index c7cc6827e3183..57679acb28054 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -63,7 +63,7 @@ struct TaskJpsi { Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi); - void process(soa::Filtered> const& candidates) + void process(soa::Filtered> const& candidates) { for (auto& candidate : candidates) { if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE)) { @@ -134,7 +134,7 @@ struct TaskJpsiMC { Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi); - void process(soa::Filtered> const& candidates, + void process(soa::Filtered> const& candidates, soa::Join const& particlesMC, aod::BigTracksMC const& tracks) { // MC rec. From b2cae9b34d030602358601f4c96ef81eabd12814 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Thu, 10 Jun 2021 17:20:27 +0200 Subject: [PATCH 18/43] Fix selector to allow compatibility with MID (#6356) Co-authored-by: Gian Michele Innocenti --- .../Tasks/PWGHF/HFJpsiCandidateSelector.cxx | 2 + Analysis/Tasks/PWGHF/taskJpsi.cxx | 81 ++++++++++++++----- 2 files changed, 64 insertions(+), 19 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx index 054be874f1a4c..53ed04e1942f4 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx @@ -107,6 +107,7 @@ struct HFJpsiCandidateSelector { 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 nSigmaRICHCombinedTOF{"nSigmaRICHCombinedTOF", 5., "Nsigma cut on RICH combined with TOF"}; // 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"}; @@ -178,6 +179,7 @@ struct HFJpsiCandidateSelector { selectorElectron.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); selectorElectron.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); selectorElectron.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); + selectorElectron.setRangeNSigmaRICHCondTOF(-nSigmaRICHCombinedTOF, nSigmaRICHCombinedTOF); TrackSelectorPID selectorMuon(kMuonMinus); diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index 57679acb28054..f0bd86f32a2f8 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -42,13 +42,14 @@ struct TaskJpsi { {"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 d_selectionFlagJpsi{"d_selectionFlagJpsi", 0, "Selection Flag for Jpsi"}; + Configurable d_modeJpsiToMuMu{"d_modeJpsiToMuMu", false, "Perform Jpsi to mu+mu- analysis"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable> bins{"pTBins", std::vector{hf_cuts_jpsi_toee::pTBins_v}, "pT bin limits"}; void init(o2::framework::InitContext&) { - registry.add("hmass", "2-prong candidates;inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hmass", "2-prong candidates;inv. mass (l^{#plus} l^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hdeclength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hdeclengthxy", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -61,19 +62,35 @@ struct TaskJpsi { registry.add("hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi); + Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMu >= d_selectionFlagJpsi); void process(soa::Filtered> const& candidates) { + int decayMode = d_modeJpsiToMuMu ? DecayType::JpsiToMuMu : DecayType::JpsiToEE; + for (auto& candidate : candidates) { - if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE)) { + + if (!(candidate.hfflag() & 1 << decayMode)) { continue; } + if (d_selectionFlagJpsi > 0) { + if (d_modeJpsiToMuMu) { + if (candidate.isSelJpsiToMuMu() <= 0) + continue; + } else { + if (candidate.isSelJpsiToEE() <= 0) + continue; + } + } if (cutYCandMax >= 0. && std::abs(YJpsi(candidate)) > cutYCandMax) { continue; } - registry.fill(HIST("hmass"), InvMassJpsiToEE(candidate), candidate.pt()); + if (d_modeJpsiToMuMu) { + registry.fill(HIST("hmass"), InvMassJpsiToMuMu(candidate), candidate.pt()); + } else { + registry.fill(HIST("hmass"), InvMassJpsiToEE(candidate), candidate.pt()); + } registry.fill(HIST("hptcand"), candidate.pt()); registry.fill(HIST("hptprong0"), candidate.ptProng0()); registry.fill(HIST("hptprong1"), candidate.ptProng1()); @@ -107,13 +124,14 @@ struct TaskJpsiMC { {"hEtaGen", "2-prong candidates (gen. matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}}}; Configurable d_selectionFlagJpsi{"d_selectionFlagJpsi", 1, "Selection Flag for Jpsi"}; + Configurable d_modeJpsiToMuMu{"d_modeJpsiToMuMu", false, "Perform Jpsi to mu+mu- analysis"}; Configurable cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"}; Configurable> bins{"pTBins", std::vector{hf_cuts_jpsi_toee::pTBins_v}, "pT bin limits"}; void init(o2::framework::InitContext&) { - registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hmassBg", "2-prong candidates (rec unmatched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (l^{#plus} l^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hmassBg", "2-prong candidates (rec unmatched);inv. mass (l^{#plus} l^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hdeclengthSig", "2-prong candidates (rec matched);decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hdeclengthBg", "2-prong candidates (rec unmatched);decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hdeclengthxySig", "2-prong candidates (rec matched);decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -124,29 +142,44 @@ struct TaskJpsiMC { registry.add("hd0Prong1Bg", "2-prong candidates (rec unmatched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hd0d0Sig", "2-prong candidates (rec matched);product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hd0d0Bg", "2-prong candidates (rec unmatched);product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hChi2PCASig", "3-prong candidates (rec. matched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hChi2PCABg", "3-prong candidates (rec. unmatched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCtSig", "3-prong candidates (rec. matched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hCtBg", "3-prong candidates (rec. unmatched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hYSig", "3-prong candidates (rec. matched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hYBg", "3-prong candidates (rec. unmatched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hChi2PCASig", "2-prong candidates (rec. matched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hChi2PCABg", "2-prong candidates (rec. unmatched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCtSig", "2-prong candidates (rec. matched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hCtBg", "2-prong candidates (rec. unmatched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hYGenSig", "2-prong candidates (rec. matched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector)bins, "#it{p}^{gen}_{T} (GeV/#it{c})"}}}); + registry.add("hYSig", "2-prong candidates (rec. matched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hYBg", "2-prong candidates (rec. unmatched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hYGen", "2-prong MC particles (gen. matched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi); + Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMu >= d_selectionFlagJpsi); void process(soa::Filtered> const& candidates, soa::Join const& particlesMC, aod::BigTracksMC const& tracks) { // MC rec. //Printf("MC Candidates: %d", candidates.size()); + int decayMode = d_modeJpsiToMuMu ? DecayType::JpsiToMuMu : DecayType::JpsiToEE; + for (auto& candidate : candidates) { - if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE)) { + + if (!(candidate.hfflag() & 1 << decayMode)) { continue; } + if (d_selectionFlagJpsi > 0) { + if (d_modeJpsiToMuMu) { + if (candidate.isSelJpsiToMuMu() <= 0) + continue; + } else { + if (candidate.isSelJpsiToEE() <= 0) + continue; + } + } + if (cutYCandMax >= 0. && std::abs(YJpsi(candidate)) > cutYCandMax) { continue; } - if (candidate.flagMCMatchRec() == 1 << DecayType::JpsiToEE) { + if (candidate.flagMCMatchRec() == 1 << decayMode) { //Get the corresponding MC particle. auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as().mcParticle_as>(), 443, true); auto particleMother = particlesMC.iteratorAt(indexMother); @@ -154,7 +187,11 @@ struct TaskJpsiMC { registry.fill(HIST("hPtRecSig"), candidate.pt()); // rec. level pT registry.fill(HIST("hCPARecSig"), candidate.cpa()); registry.fill(HIST("hEtaRecSig"), candidate.eta()); - registry.fill(HIST("hmassSig"), InvMassJpsiToEE(candidate), candidate.pt()); + if (d_modeJpsiToMuMu) { + registry.fill(HIST("hmassSig"), InvMassJpsiToMuMu(candidate), candidate.pt()); + } else { + registry.fill(HIST("hmassSig"), InvMassJpsiToEE(candidate), candidate.pt()); + } registry.fill(HIST("hdeclengthSig"), candidate.decayLength(), candidate.pt()); registry.fill(HIST("hdeclengthxySig"), candidate.decayLengthXY(), candidate.pt()); registry.fill(HIST("hd0Prong0Sig"), candidate.impactParameter0(), candidate.pt()); @@ -163,12 +200,17 @@ struct TaskJpsiMC { registry.fill(HIST("hChi2PCASig"), candidate.chi2PCA(), candidate.pt()); registry.fill(HIST("hCtSig"), CtJpsi(candidate), candidate.pt()); registry.fill(HIST("hYSig"), YJpsi(candidate), candidate.pt()); + registry.fill(HIST("hYGenSig"), RecoDecay::Y(array{particleMother.px(), particleMother.py(), particleMother.pz()}, RecoDecay::getMassPDG(particleMother.pdgCode())), particleMother.pt()); } else { registry.fill(HIST("hPtRecBg"), candidate.pt()); registry.fill(HIST("hCPARecBg"), candidate.cpa()); registry.fill(HIST("hEtaRecBg"), candidate.eta()); - registry.fill(HIST("hmassBg"), InvMassJpsiToEE(candidate), candidate.pt()); + if (d_modeJpsiToMuMu) { + registry.fill(HIST("hmassSig"), InvMassJpsiToMuMu(candidate), candidate.pt()); + } else { + registry.fill(HIST("hmassSig"), InvMassJpsiToEE(candidate), candidate.pt()); + } registry.fill(HIST("hdeclengthBg"), candidate.decayLength(), candidate.pt()); registry.fill(HIST("hdeclengthxyBg"), candidate.decayLengthXY(), candidate.pt()); registry.fill(HIST("hd0Prong0Bg"), candidate.impactParameter0(), candidate.pt()); @@ -182,12 +224,13 @@ struct TaskJpsiMC { // MC gen. //Printf("MC Particles: %d", particlesMC.size()); for (auto& particle : particlesMC) { - if (particle.flagMCMatchGen() == 1 << DecayType::JpsiToEE) { + if (particle.flagMCMatchGen() == 1 << decayMode) { if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode()))) > cutYCandMax) { continue; } registry.fill(HIST("hPtGen"), particle.pt()); registry.fill(HIST("hEtaGen"), particle.eta()); + registry.fill(HIST("hYGen"), RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode())), particle.pt()); } } } From f4f8d6fb10175fc7396418a8ef8e9ccb0ca24d7d Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Thu, 10 Jun 2021 17:49:07 +0200 Subject: [PATCH 19/43] fix name (#6377) Co-authored-by: Gian Michele Innocenti --- Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx index 53ed04e1942f4..77348962ef665 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx @@ -107,7 +107,7 @@ struct HFJpsiCandidateSelector { 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 nSigmaRICHCombinedTOF{"nSigmaRICHCombinedTOF", 5., "Nsigma cut on RICH combined with TOF"}; + Configurable d_nSigmaRICHCombinedTOF{"d_nSigmaRICHCombinedTOF", 5., "Nsigma cut on RICH combined with TOF"}; // 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"}; @@ -179,7 +179,7 @@ struct HFJpsiCandidateSelector { selectorElectron.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); selectorElectron.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); selectorElectron.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); - selectorElectron.setRangeNSigmaRICHCondTOF(-nSigmaRICHCombinedTOF, nSigmaRICHCombinedTOF); + selectorElectron.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); TrackSelectorPID selectorMuon(kMuonMinus); From eae194475c0900feae67a7bdfe8f19693b43dbf4 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Thu, 10 Jun 2021 18:06:41 +0200 Subject: [PATCH 20/43] Adjust mass histogram according to channel (#6378) Co-authored-by: Gian Michele Innocenti --- Analysis/Tasks/PWGHF/taskJpsi.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index f0bd86f32a2f8..af553affb43a7 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -49,7 +49,11 @@ struct TaskJpsi { void init(o2::framework::InitContext&) { - registry.add("hmass", "2-prong candidates;inv. mass (l^{#plus} l^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + if (d_modeJpsiToMuMu) { + registry.add("hmass", "2-prong candidates;inv. mass (#mu^{#plus} #mu^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } else { + registry.add("hmass", "2-prong candidates;inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } registry.add("hdeclength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hdeclengthxy", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -130,8 +134,14 @@ struct TaskJpsiMC { void init(o2::framework::InitContext&) { - registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (l^{#plus} l^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hmassBg", "2-prong candidates (rec unmatched);inv. mass (l^{#plus} l^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + if (d_modeJpsiToMuMu) { + registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (#mu^{#plus} #mu^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hmassBg", "2-prong candidates (rec unmatched);inv. mass (#mu^{#plus} #mu^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } + else { + registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hmassBg", "2-prong candidates (rec unmatched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + } registry.add("hdeclengthSig", "2-prong candidates (rec matched);decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hdeclengthBg", "2-prong candidates (rec unmatched);decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hdeclengthxySig", "2-prong candidates (rec matched);decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); From cfadd8ef0dd93d64279d97f207e092e23cea2e1c Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Thu, 10 Jun 2021 18:17:28 +0200 Subject: [PATCH 21/43] Clang (#6379) (#6380) Co-authored-by: Gian Michele Innocenti --- Analysis/Tasks/PWGHF/taskJpsi.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index af553affb43a7..3136ad5a18a47 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -52,7 +52,7 @@ struct TaskJpsi { if (d_modeJpsiToMuMu) { registry.add("hmass", "2-prong candidates;inv. mass (#mu^{#plus} #mu^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } else { - registry.add("hmass", "2-prong candidates;inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hmass", "2-prong candidates;inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } registry.add("hdeclength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hdeclengthxy", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -137,8 +137,7 @@ struct TaskJpsiMC { if (d_modeJpsiToMuMu) { registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (#mu^{#plus} #mu^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hmassBg", "2-prong candidates (rec unmatched);inv. mass (#mu^{#plus} #mu^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - } - else { + } else { registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hmassBg", "2-prong candidates (rec unmatched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } From acfacb8663c4a6a4020c5b8c1a352f69019b7eb6 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 12 Jun 2021 00:48:05 +0200 Subject: [PATCH 22/43] Add task to check contaminations (#6401) --- Analysis/Tasks/PWGHF/CMakeLists.txt | 5 + Analysis/Tasks/PWGHF/qaPidRejection.cxx | 287 ++++++++++++++++++++++++ 2 files changed, 292 insertions(+) create mode 100644 Analysis/Tasks/PWGHF/qaPidRejection.cxx diff --git a/Analysis/Tasks/PWGHF/CMakeLists.txt b/Analysis/Tasks/PWGHF/CMakeLists.txt index 4786abcd788d1..64eb7efbac058 100644 --- a/Analysis/Tasks/PWGHF/CMakeLists.txt +++ b/Analysis/Tasks/PWGHF/CMakeLists.txt @@ -18,6 +18,11 @@ o2_add_dpl_workflow(qa-efficiency PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore COMPONENT_NAME Analysis) +o2_add_dpl_workflow(qa-rejection + SOURCES qaPidRejection.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::ALICE3Analysis + COMPONENT_NAME Analysis) + o2_add_dpl_workflow(hf-track-index-skims-creator SOURCES HFTrackIndexSkimsCreator.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::AnalysisTasksUtils ROOT::EG diff --git a/Analysis/Tasks/PWGHF/qaPidRejection.cxx b/Analysis/Tasks/PWGHF/qaPidRejection.cxx new file mode 100644 index 0000000000000..8fc1090a45f64 --- /dev/null +++ b/Analysis/Tasks/PWGHF/qaPidRejection.cxx @@ -0,0 +1,287 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// 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. +/// \author Peter Hristov , CERN +/// \author Gian Michele Innocenti , CERN +/// \author Henrique J C Zanoli , Utrecht University +/// \author Nicolo' Jacazio , CERN + +// O2 inlcudes +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "ReconstructionDataFormats/DCA.h" +#include "AnalysisCore/trackUtilities.h" +#include "AnalysisCore/MC.h" +#include "AnalysisDataModel/TrackSelectionTables.h" +#include "AnalysisDataModel/HFSecondaryVertex.h" +#include "AnalysisCore/TrackSelectorPID.h" +#include "ALICE3Analysis/RICH.h" +#include "ALICE3Analysis/MID.h" + +using namespace o2; + +using namespace o2::framework; + +namespace o2::aod +{ + +namespace hf_track_index_alice3_pid +{ +DECLARE_SOA_INDEX_COLUMN(Track, track); //! +DECLARE_SOA_INDEX_COLUMN(RICH, rich); //! +DECLARE_SOA_INDEX_COLUMN(MID, mid); //! +} // namespace hf_track_index_alice3_pid + +DECLARE_SOA_INDEX_TABLE_USER(HfTrackIndexALICE3PID, Tracks, "HFTRKIDXA3PID", //! + hf_track_index_alice3_pid::TrackId, + hf_track_index_alice3_pid::RICHId, + hf_track_index_alice3_pid::MIDId); +} // namespace o2::aod + +struct Alice3PidIndexBuilder { + Builds index; + void init(o2::framework::InitContext&) {} +}; + +void customize(std::vector& workflowOptions) +{ + std::vector options{ + {"rej-el", VariantType::Int, 1, {"Efficiency for the Electron PDG code"}}, + {"rej-mu", VariantType::Int, 1, {"Efficiency for the Muon PDG code"}}, + {"rej-pi", VariantType::Int, 1, {"Efficiency for the Pion PDG code"}}, + {"rej-ka", VariantType::Int, 1, {"Efficiency for the Kaon PDG code"}}, + {"rej-pr", VariantType::Int, 0, {"Efficiency for the Proton PDG code"}}}; + std::swap(workflowOptions, options); +} + +#include "Framework/runDataProcessing.h" + +// ROOT includes +#include "TPDGCode.h" +#include "TEfficiency.h" +#include "TList.h" + +/// Task to QA the efficiency of a particular particle defined by particlePDG +template +struct QaTrackingRejection { + static constexpr PDG_t PDGs[5] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; + static_assert(particle < 5 && "Maximum of particles reached"); + static constexpr int particlePDG = PDGs[particle]; + // Particle selection + Configurable etaBins{"etaBins", 40, "Number of eta bins"}; + Configurable etaMin{"etaMin", -2.f, "Lower limit in eta"}; + Configurable etaMax{"etaMax", 2.f, "Upper limit in eta"}; + Configurable ptBins{"ptBins", 400, "Number of pT bins"}; + Configurable ptMin{"ptMin", 0.f, "Lower limit in pT"}; + Configurable ptMax{"ptMax", 4.f, "Upper limit in pT"}; + // TPC + Configurable d_pidTPCMinpT{"d_pidTPCMinpT", 9999., "Lower bound of track pT for TPC PID"}; + Configurable d_pidTPCMaxpT{"d_pidTPCMaxpT", 999999., "Upper bound of track pT for TPC PID"}; + Configurable d_nSigmaTPC{"d_nSigmaTPC", 99999, "Nsigma cut on TPC only"}; + // TOF + 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_nSigmaTOFCombined{"d_nSigmaTOFCombined", 0., "Nsigma cut on TOF combined with TPC"}; + // RICH + 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_nSigmaRICHCombinedTOF{"d_nSigmaRICHCombinedTOF", 0., "Nsigma cut on RICH combined with TOF"}; + HistogramRegistry histos{"HistogramsRejection"}; + + void init(InitContext&) + { + AxisSpec ptAxis{ptBins, ptMin, ptMax}; + AxisSpec etaAxis{etaBins, etaMin, etaMax}; + + TString commonTitle = ""; + if (particlePDG != 0) { + commonTitle += Form("PDG %i", particlePDG); + } + + const TString pt = "#it{p}_{T} [GeV/#it{c}]"; + const TString p = "#it{p} [GeV/#it{c}]"; + const TString eta = "#it{#eta}"; + const TString phi = "#it{#varphi} [rad]"; + + histos.add("tracking/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingTOFselElectron/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingTOFselPion/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingTOFselKaon/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingTOFselProton/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingRICHselElectron/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingRICHselPion/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingRICHselKaon/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingRICHselProton/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingMIDselMuon/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + + histos.add("tracking/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingTOFselElectron/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingTOFselPion/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingTOFselKaon/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingTOFselProton/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingRICHselElectron/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingRICHselPion/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingRICHselKaon/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingRICHselProton/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("trackingMIDselMuon/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + } + + using TracksPID = soa::Join; + + void process(const o2::soa::Join& collisions, + const o2::soa::Join& tracks, + const o2::aod::McCollisions& mcCollisions, + const o2::aod::McParticles& mcParticles, aod::RICHs const&, aod::MIDs 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); + selectorElectron.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); + selectorElectron.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); + selectorElectron.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); + + TrackSelectorPID selectorPion(kPiPlus); + selectorPion.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); + selectorPion.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); + selectorPion.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); + selectorPion.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); + selectorPion.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); + selectorPion.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); + selectorPion.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); + selectorPion.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); + + TrackSelectorPID selectorKaon(kKPlus); + selectorKaon.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); + selectorKaon.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); + selectorKaon.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); + selectorKaon.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); + selectorKaon.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); + selectorKaon.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); + selectorKaon.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); + selectorKaon.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); + + TrackSelectorPID selectorProton(kProton); + selectorProton.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); + selectorProton.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); + selectorProton.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); + selectorProton.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); + selectorProton.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); + selectorProton.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); + selectorProton.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); + selectorProton.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); + + TrackSelectorPID selectorMuon(kMuonPlus); + + std::vector recoEvt(collisions.size()); + std::vector recoTracks(tracks.size()); + LOGF(info, "%d", particlePDG); + for (const auto& track : tracks) { + const auto mcParticle = track.mcParticle(); + if (particlePDG != 0 && mcParticle.pdgCode() != particlePDG) { // Checking PDG code + continue; + } + bool isTOFhpElectron = !(selectorElectron.getStatusTrackPIDTOF(track) == TrackSelectorPID::Status::PIDRejected); + bool isRICHhpElectron = !(selectorElectron.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); + bool isTOFhpPion = !(selectorPion.getStatusTrackPIDTOF(track) == TrackSelectorPID::Status::PIDRejected); + bool isRICHhpPion = !(selectorPion.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); + bool isTOFhpKaon = !(selectorKaon.getStatusTrackPIDTOF(track) == TrackSelectorPID::Status::PIDRejected); + bool isRICHhpKaon = !(selectorKaon.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); + bool isTOFhpProton = !(selectorProton.getStatusTrackPIDTOF(track) == TrackSelectorPID::Status::PIDRejected); + bool isRICHhpProton = !(selectorProton.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); + bool isMIDhpMuon = !(selectorMuon.getStatusTrackPIDMID(track) == TrackSelectorPID::Status::PIDRejected); + + if (MC::isPhysicalPrimary(mcParticles, mcParticle)) { + histos.fill(HIST("tracking/pteta"), track.pt(), track.eta()); + if (isTOFhpElectron) { + histos.fill(HIST("trackingTOFselElectron/pteta"), track.pt(), track.eta()); + } + if (isTOFhpPion) { + histos.fill(HIST("trackingTOFselPion/pteta"), track.pt(), track.eta()); + } + if (isTOFhpKaon) { + histos.fill(HIST("trackingTOFselKaon/pteta"), track.pt(), track.eta()); + } + if (isTOFhpProton) { + histos.fill(HIST("trackingTOFselProton/pteta"), track.pt(), track.eta()); + } + if (isRICHhpElectron) { + histos.fill(HIST("trackingRICHselElectron/pteta"), track.pt(), track.eta()); + } + if (isRICHhpPion) { + histos.fill(HIST("trackingRICHselPion/pteta"), track.pt(), track.eta()); + } + if (isRICHhpKaon) { + histos.fill(HIST("trackingRICHselKaon/pteta"), track.pt(), track.eta()); + } + if (isRICHhpProton) { + histos.fill(HIST("trackingRICHselProton/pteta"), track.pt(), track.eta()); + } + if (isMIDhpMuon) { + histos.fill(HIST("trackingMIDselMuon/pteta"), track.pt(), track.eta()); + } + + histos.fill(HIST("tracking/peta"), track.p(), track.eta()); + if (isTOFhpElectron) { + histos.fill(HIST("trackingTOFselElectron/peta"), track.p(), track.eta()); + } + if (isTOFhpPion) { + histos.fill(HIST("trackingTOFselPion/peta"), track.p(), track.eta()); + } + if (isTOFhpKaon) { + histos.fill(HIST("trackingTOFselKaon/peta"), track.p(), track.eta()); + } + if (isTOFhpProton) { + histos.fill(HIST("trackingTOFselProton/peta"), track.p(), track.eta()); + } + if (isRICHhpElectron) { + histos.fill(HIST("trackingRICHselElectron/peta"), track.p(), track.eta()); + } + if (isRICHhpPion) { + histos.fill(HIST("trackingRICHselPion/peta"), track.p(), track.eta()); + } + if (isRICHhpKaon) { + histos.fill(HIST("trackingRICHselKaon/peta"), track.p(), track.eta()); + } + if (isRICHhpProton) { + histos.fill(HIST("trackingRICHselProton/peta"), track.p(), track.eta()); + } + if (isMIDhpMuon) { + histos.fill(HIST("trackingMIDselMuon/peta"), track.p(), track.eta()); + } + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec w; + w.push_back(adaptAnalysisTask(cfgc)); + if (cfgc.options().get("rej-el")) { + w.push_back(adaptAnalysisTask>(cfgc, TaskName{"qa-tracking-rejection-electron"})); + } + if (cfgc.options().get("rej-ka")) { + w.push_back(adaptAnalysisTask>(cfgc, TaskName{"qa-tracking-rejection-kaon"})); + } + if (cfgc.options().get("rej-pr")) { + w.push_back(adaptAnalysisTask>(cfgc, TaskName{"qa-tracking-rejection-proton"})); + } + if (cfgc.options().get("rej-mu")) { + w.push_back(adaptAnalysisTask>(cfgc, TaskName{"qa-tracking-rejection-mu"})); + } + if (cfgc.options().get("rej-pi")) { + w.push_back(adaptAnalysisTask>(cfgc, TaskName{"qa-tracking-rejection-pion"})); + } + return w; +} From 56c34e1adc86e663e17f8706fe8863dfe39072c4 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 12 Jun 2021 18:31:01 +0200 Subject: [PATCH 23/43] Add study for particle ration and PID contamination (#6404) --- Analysis/Tasks/PWGHF/qaPidRejection.cxx | 196 ++++++++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/Analysis/Tasks/PWGHF/qaPidRejection.cxx b/Analysis/Tasks/PWGHF/qaPidRejection.cxx index 8fc1090a45f64..377b2c48234e9 100644 --- a/Analysis/Tasks/PWGHF/qaPidRejection.cxx +++ b/Analysis/Tasks/PWGHF/qaPidRejection.cxx @@ -263,6 +263,201 @@ struct QaTrackingRejection { } } }; +struct QaRejectionGeneral { + static constexpr PDG_t PDGs[5] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; + // Cuts + Configurable etaMax{"etaMaxSel", 1.44, "Max #eta single track"}; + Configurable ptMin{"ptMinSel", 0.6, "p_{T} min single track"}; + // Particle selection + Configurable etaBins{"etaBins", 40, "Number of eta bins"}; + Configurable etaMin{"etaMin", -2.f, "Lower limit in eta"}; + Configurable etaMax{"etaMax", 2.f, "Upper limit in eta"}; + Configurable ptBins{"ptBins", 80, "Number of pT bins"}; + Configurable ptMin{"ptMin", 0.f, "Lower limit in pT"}; + Configurable ptMax{"ptMax", 8.f, "Upper limit in pT"}; + // TPC + Configurable d_pidTPCMinpT{"d_pidTPCMinpT", 9999., "Lower bound of track pT for TPC PID"}; + Configurable d_pidTPCMaxpT{"d_pidTPCMaxpT", 999999., "Upper bound of track pT for TPC PID"}; + Configurable d_nSigmaTPC{"d_nSigmaTPC", 99999, "Nsigma cut on TPC only"}; + // TOF + 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_nSigmaTOFCombined{"d_nSigmaTOFCombined", 0., "Nsigma cut on TOF combined with TPC"}; + // RICH + 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_nSigmaRICHCombinedTOF{"d_nSigmaRICHCombinedTOF", 0., "Nsigma cut on RICH combined with TOF"}; + HistogramRegistry histos{"HistogramsRejection"}; + + void init(InitContext&) + { + AxisSpec ptAxis{ptBins, ptMin, ptMax}; + AxisSpec etaAxis{etaBins, etaMin, etaMax}; + + TString commonTitle = ""; + + const TString pt = "#it{p}_{T} [GeV/#it{c}]"; + const TString p = "#it{p} [GeV/#it{c}]"; + const TString eta = "#it{#eta}"; + const TString phi = "#it{#varphi} [rad]"; + + histos.add("hAllNoSel/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hPionNoSel/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hElectronNoSel/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hMuonNoSel/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hKaonNoSel/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + + histos.add("hAllRICHSelHpElTight/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hPionRICHSelHpElTight/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hElectronRICHSelHpElTight/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hMuonRICHSelHpElTight/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hKaonRICHSelHpElTight/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + + histos.add("hAllRICHSelHpElLoose/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hPionRICHSelHpElLoose/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hElectronRICHSelHpElLoose/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hMuonRICHSelHpElLoose/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hKaonRICHSelHpElLoose/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + + histos.add("hAllMID/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hElectronMID/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hMuonMID/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hPionMID/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hKaonMID/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + } + + using TracksPID = soa::Join; + + void process(const o2::soa::Join& collisions, + const o2::soa::Join& tracks, + const o2::aod::McCollisions& mcCollisions, + const o2::aod::McParticles& mcParticles, aod::RICHs const&, aod::MIDs 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); + selectorElectron.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); + selectorElectron.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); + selectorElectron.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); + + TrackSelectorPID selectorPion(kPiPlus); + selectorPion.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); + selectorPion.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); + selectorPion.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); + selectorPion.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); + selectorPion.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); + selectorPion.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); + selectorPion.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); + selectorPion.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); + + TrackSelectorPID selectorKaon(kKPlus); + selectorKaon.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); + selectorKaon.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); + selectorKaon.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); + selectorKaon.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); + selectorKaon.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); + selectorKaon.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); + selectorKaon.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); + selectorKaon.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); + + TrackSelectorPID selectorProton(kProton); + selectorProton.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); + selectorProton.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); + selectorProton.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); + selectorProton.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); + selectorProton.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); + selectorProton.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); + selectorProton.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); + selectorProton.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); + + TrackSelectorPID selectorMuon(kMuonPlus); + + static constexpr PDG_t PDGs[5] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; + + for (const auto& track : tracks) { + + if (std::abs(track.eta()) > etaMaxSel || track.pt() < ptMinSel) + continue; + const auto mcParticle = track.mcParticle(); + histos.fill(HIST("hAllNoSel/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kElectron) + histos.fill(HIST("hElectronNoSel/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kMuonPlus) + histos.fill(HIST("hMuonNoSel/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kPiPlus) + histos.fill(HIST("hPionNoSel/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kKPlus) + histos.fill(HIST("hKaonNoSel/pteta"), track.pt(), track.eta()); + + bool isRICHhpElectron = !(selectorElectron.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); + bool isRICHhpPion = !(selectorPion.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); + bool isRICHhpKaon = !(selectorKaon.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); + bool isRICHhpProton = !(selectorProton.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); + bool isMIDhpMuon = !(selectorMuon.getStatusTrackPIDMID(track) == TrackSelectorPID::Status::PIDRejected); + + bool isRICHElLoose = isRICHhpElectron; + + bool isRICHElTight = true; + bool isrichel = true; + bool istofel = true; + bool istofpi = false; + bool isrichpi = false; + + if (track.p() < 0.6) { + istofel = std::abs(track.tofNSigmaEl()) < 3.0; + istofpi = std::abs(track.tofNSigmaPi()) < 3.0; + isrichel = std::abs(track.rich().richNsigmaEl()) < 3.0; + } else if (track.p() > 0.6 && track.p() < 1.0) { + isrichel = std::abs(track.rich().richNsigmaEl()) < 3.0; + } else if (track.p() > 1.0 && track.p() < 2.0) { + isrichel = std::abs(track.rich().richNsigmaEl()) < 3.0; + isrichpi = std::abs(track.rich().richNsigmaPi()) < 3.0; + } else { + isrichel = std::abs(track.rich().richNsigmaEl()) < 3.0; + } + isRICHElTight = isrichel && !isrichpi && istofel && !istofpi; + + if (isRICHElLoose) { + histos.fill(HIST("hAllRICHSelHpElLoose/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kElectron) + histos.fill(HIST("hElectronRICHSelHpElLoose/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kMuonPlus) + histos.fill(HIST("hMuonRICHSelHpElLoose/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kPiPlus) + histos.fill(HIST("hPionRICHSelHpElLoose/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kKPlus) + histos.fill(HIST("hKaonRICHSelHpElLoose/pteta"), track.pt(), track.eta()); + } + if (isRICHElTight) { + histos.fill(HIST("hAllRICHSelHpElTight/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kElectron) + histos.fill(HIST("hElectronRICHSelHpElTight/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kMuonPlus) + histos.fill(HIST("hMuonRICHSelHpElTight/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kPiPlus) + histos.fill(HIST("hPionRICHSelHpElTight/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kKPlus) + histos.fill(HIST("hKaonRICHSelHpElTight/pteta"), track.pt(), track.eta()); + } + if (isMIDhpMuon) { + histos.fill(HIST("hAllMID/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kElectron) + histos.fill(HIST("hElectronMID/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kMuonPlus) + histos.fill(HIST("hMuonMID/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kPiPlus) + histos.fill(HIST("hPionMID/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kKPlus) + histos.fill(HIST("hKaonMID/pteta"), track.pt(), track.eta()); + } + } + } +}; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { @@ -283,5 +478,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) if (cfgc.options().get("rej-pi")) { w.push_back(adaptAnalysisTask>(cfgc, TaskName{"qa-tracking-rejection-pion"})); } + w.push_back(adaptAnalysisTask(cfgc)); return w; } From 88e6d278b294c37c37aa0b2025afb221566b8abd Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 12 Jun 2021 18:36:49 +0200 Subject: [PATCH 24/43] Fix name (#6405) Co-authored-by: Gian Michele Innocenti --- Analysis/Tasks/PWGHF/qaPidRejection.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Analysis/Tasks/PWGHF/qaPidRejection.cxx b/Analysis/Tasks/PWGHF/qaPidRejection.cxx index 377b2c48234e9..f8a8abb9b5b39 100644 --- a/Analysis/Tasks/PWGHF/qaPidRejection.cxx +++ b/Analysis/Tasks/PWGHF/qaPidRejection.cxx @@ -266,8 +266,8 @@ struct QaTrackingRejection { struct QaRejectionGeneral { static constexpr PDG_t PDGs[5] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; // Cuts - Configurable etaMax{"etaMaxSel", 1.44, "Max #eta single track"}; - Configurable ptMin{"ptMinSel", 0.6, "p_{T} min single track"}; + Configurable etaMax{"etaMaxSel", 1.44, "Max #eta single track"}; + Configurable ptMin{"ptMinSel", 0.6, "p_{T} min single track"}; // Particle selection Configurable etaBins{"etaBins", 40, "Number of eta bins"}; Configurable etaMin{"etaMin", -2.f, "Lower limit in eta"}; From f5a958021880b1b6cdfd99ae6589a6b8e967f178 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 12 Jun 2021 18:39:53 +0200 Subject: [PATCH 25/43] Fix name (#6406) Co-authored-by: Gian Michele Innocenti --- Analysis/Tasks/PWGHF/qaPidRejection.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Analysis/Tasks/PWGHF/qaPidRejection.cxx b/Analysis/Tasks/PWGHF/qaPidRejection.cxx index f8a8abb9b5b39..04e6e3e231097 100644 --- a/Analysis/Tasks/PWGHF/qaPidRejection.cxx +++ b/Analysis/Tasks/PWGHF/qaPidRejection.cxx @@ -266,8 +266,8 @@ struct QaTrackingRejection { struct QaRejectionGeneral { static constexpr PDG_t PDGs[5] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; // Cuts - Configurable etaMax{"etaMaxSel", 1.44, "Max #eta single track"}; - Configurable ptMin{"ptMinSel", 0.6, "p_{T} min single track"}; + Configurable etaMaxSel{"etaMaxSel", 1.44, "Max #eta single track"}; + Configurable ptMinSel{"ptMinSel", 0.6, "p_{T} min single track"}; // Particle selection Configurable etaBins{"etaBins", 40, "Number of eta bins"}; Configurable etaMin{"etaMin", -2.f, "Lower limit in eta"}; From 92f77c668fc5f0ff9bb6063d3a5444870b6789a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Sat, 12 Jun 2021 20:10:11 +0200 Subject: [PATCH 26/43] Fix track PID for cases where RICH or MID is not available (#6407) --- .../include/AnalysisCore/TrackSelectorPID.h | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h b/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h index f2c958b5143fb..489dc77e0f719 100644 --- a/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h +++ b/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h @@ -280,6 +280,9 @@ class TrackSelectorPID template bool isValidTrackPIDRICH(const T& track) { + if (track.richId() < 0) { + return false; + } auto pt = track.pt(); return mPtRICHMin <= pt && pt <= mPtRICHMax; } @@ -355,6 +358,15 @@ class TrackSelectorPID // MID + /// Checks if track is OK for MID PID. + /// \param track track + /// \return true if track is OK for MID PID + template + bool isValidTrackPIDMID(const T& track) + { + return track.midId() > -1; + } + /// Checks if track is compatible with muon hypothesis in the MID detector. /// \param track track /// \return true if track has been identified as muon by the MID detector @@ -362,12 +374,8 @@ class TrackSelectorPID bool isSelectedTrackPIDMID(const T& track) { if (mPdg != kMuonMinus) { - //LOGF(info, "isSelectedTrackPIDMID: Not a muon hypothesis"); return false; } - //LOGF(info, "isSelectedTrackPIDMID: Getting muon response"); - //LOGF(info, "isSelectedTrackPIDMID: Got: %d", track.mid().midIsMuon()); - //LOGF(info, "isSelectedTrackPIDMID: Return: %d", track.mid().midIsMuon() == 1); return track.mid().midIsMuon() == 1; // FIXME: change to return track.midIsMuon() once the column is bool. } @@ -377,17 +385,17 @@ class TrackSelectorPID template int getStatusTrackPIDMID(const T& track) { - //LOGF(info, "getStatusTrackPIDMID: Start"); if (mPdg != kMuonMinus) { - //LOGF(info, "getStatusTrackPIDMID: Not a muon hypothesis"); return Status::PIDRejected; } - if (isSelectedTrackPIDMID(track)) { - //LOGF(info, "getStatusTrackPIDMID: Accepted"); - return Status::PIDAccepted; // accepted + if (isValidTrackPIDMID(track)) { + if (isSelectedTrackPIDMID(track)) { + return Status::PIDAccepted; // accepted + } else { + return Status::PIDRejected; // rejected + } } else { - //LOGF(info, "getStatusTrackPIDMID: Rejected"); - return Status::PIDRejected; // rejected + return Status::PIDNotApplicable; // PID not applicable } } From 8aa2dd552693d010ca4adfca8f5ace808cbdafab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Sat, 12 Jun 2021 22:31:10 +0200 Subject: [PATCH 27/43] Add e/pi selection (#6410) --- .../include/AnalysisCore/TrackSelectorPID.h | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h b/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h index 489dc77e0f719..ee720440be96a 100644 --- a/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h +++ b/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h @@ -422,6 +422,58 @@ class TrackSelectorPID return Status::PIDNotApplicable; // (NotApplicable for one detector) and (NotApplicable or Conditional for the other) } + /// Checks whether a track is identified as electron and rejected as pion by TOF or RICH. + /// \param track track + /// \param useTOF switch to use TOF + /// \param useRICH switch to use RICH + /// \return true if track is selected by TOF or RICH + /// \note Ported from https://github.com/feisenhu/ALICE3-LoI-LMee/blob/main/efficiency/macros/anaEEstudy.cxx + template + bool isElectronAndNotPion(const T& track, bool useTOF = true, bool useRICH = true) + { + bool isSelTOF = false; + bool isSelRICH = false; + bool hasRICH = track.richId() > -1; + bool hasTOF = isValidTrackPIDTOF(track); + auto nSigmaTOFEl = track.tofNSigmaEl(); + auto nSigmaTOFPi = track.tofNSigmaPi(); + auto nSigmaRICHEl = hasRICH ? track.rich().richNsigmaEl() : -1000.; + auto nSigmaRICHPi = hasRICH ? track.rich().richNsigmaPi() : -1000.; + auto p = track.p(); + + // TOF + if (useTOF && hasTOF && (p < 0.6)) { + if (p > 0.4 && hasRICH) { + if ((std::abs(nSigmaTOFEl) < mNSigmaTOFMax) && (std::abs(nSigmaRICHEl) < mNSigmaRICHMax)) + isSelTOF = true; // is selected as electron by TOF and RICH + } else if (p <= 0.4) { + if (std::abs(nSigmaTOFEl) < mNSigmaTOFMax) + isSelTOF = true; // is selected as electron by TOF + } else { + isSelTOF = false; // This is rejecting all the heavier particles which do not have a RICH signal in the p area of 0.4-0.6 GeV/c + } + if (std::abs(nSigmaTOFPi) < mNSigmaTOFMax) { + isSelTOF = false; // is selected as pion by TOF + } + } else { + isSelTOF = false; + } + + // RICH + if (useRICH && hasRICH) { + if (std::abs(nSigmaRICHEl) < mNSigmaRICHMax) { + isSelRICH = true; // is selected as electron by RICH + } + if ((std::abs(nSigmaRICHPi) < mNSigmaRICHMax) && (p > 1.0)) { + isSelRICH = false; // is selected as pion by RICH + } + } else { + isSelRICH = false; + } + + return isSelRICH || isSelTOF; + } + private: uint mPdg = kPiPlus; ///< PDG code of the expected particle From f64148b6d927a10a89413454f466c48ee10abc3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Sun, 13 Jun 2021 00:02:55 +0200 Subject: [PATCH 28/43] Simplify selector initialisation --- Analysis/Tasks/PWGHF/qaPidRejection.cxx | 74 ++++++------------------- 1 file changed, 16 insertions(+), 58 deletions(-) diff --git a/Analysis/Tasks/PWGHF/qaPidRejection.cxx b/Analysis/Tasks/PWGHF/qaPidRejection.cxx index 04e6e3e231097..8719cf90ccfb2 100644 --- a/Analysis/Tasks/PWGHF/qaPidRejection.cxx +++ b/Analysis/Tasks/PWGHF/qaPidRejection.cxx @@ -151,35 +151,14 @@ struct QaTrackingRejection { selectorElectron.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); selectorElectron.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); - TrackSelectorPID selectorPion(kPiPlus); - selectorPion.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); - selectorPion.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); - selectorPion.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); - selectorPion.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); - selectorPion.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); - selectorPion.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); - selectorPion.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); - selectorPion.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); - - TrackSelectorPID selectorKaon(kKPlus); - selectorKaon.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); - selectorKaon.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); - selectorKaon.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); - selectorKaon.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); - selectorKaon.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); - selectorKaon.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); - selectorKaon.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); - selectorKaon.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); - - TrackSelectorPID selectorProton(kProton); - selectorProton.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); - selectorProton.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); - selectorProton.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); - selectorProton.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); - selectorProton.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); - selectorProton.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); - selectorProton.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); - selectorProton.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); + auto selectorPion(selectorElectron); + selectorPion.setPDG(kPiPlus); + + auto selectorKaon(selectorElectron); + selectorKaon.setPDG(kKPlus); + + auto selectorProton(selectorElectron); + selectorProton.setPDG(kProton); TrackSelectorPID selectorMuon(kMuonPlus); @@ -345,35 +324,14 @@ struct QaRejectionGeneral { selectorElectron.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); selectorElectron.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); - TrackSelectorPID selectorPion(kPiPlus); - selectorPion.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); - selectorPion.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); - selectorPion.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); - selectorPion.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); - selectorPion.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); - selectorPion.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); - selectorPion.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); - selectorPion.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); - - TrackSelectorPID selectorKaon(kKPlus); - selectorKaon.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); - selectorKaon.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); - selectorKaon.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); - selectorKaon.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); - selectorKaon.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); - selectorKaon.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); - selectorKaon.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); - selectorKaon.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); - - TrackSelectorPID selectorProton(kProton); - selectorProton.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); - selectorProton.setRangeNSigmaTPC(-d_nSigmaTPC, d_nSigmaTPC); - selectorProton.setRangePtTOF(d_pidTOFMinpT, d_pidTOFMaxpT); - selectorProton.setRangeNSigmaTOF(-d_nSigmaTOF, d_nSigmaTOF); - selectorProton.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined); - selectorProton.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); - selectorProton.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); - selectorProton.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); + auto selectorPion(selectorElectron); + selectorPion.setPDG(kPiPlus); + + auto selectorKaon(selectorElectron); + selectorKaon.setPDG(kKPlus); + + auto selectorProton(selectorElectron); + selectorProton.setPDG(kProton); TrackSelectorPID selectorMuon(kMuonPlus); From aa2374631f3015f3b00d8496b689a6aadc58a765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Sun, 13 Jun 2021 18:15:09 +0200 Subject: [PATCH 29/43] Add comparison of e/pi selections --- Analysis/Tasks/PWGHF/qaPidRejection.cxx | 53 ++++++++++++++++++++----- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/Analysis/Tasks/PWGHF/qaPidRejection.cxx b/Analysis/Tasks/PWGHF/qaPidRejection.cxx index 8719cf90ccfb2..d0a2a5cc7f2ad 100644 --- a/Analysis/Tasks/PWGHF/qaPidRejection.cxx +++ b/Analysis/Tasks/PWGHF/qaPidRejection.cxx @@ -242,6 +242,7 @@ struct QaTrackingRejection { } } }; + struct QaRejectionGeneral { static constexpr PDG_t PDGs[5] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; // Cuts @@ -294,6 +295,18 @@ struct QaRejectionGeneral { histos.add("hMuonRICHSelHpElTight/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); histos.add("hKaonRICHSelHpElTight/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hAllRICHSelHpElTightAlt/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hPionRICHSelHpElTightAlt/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hElectronRICHSelHpElTightAlt/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hMuonRICHSelHpElTightAlt/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hKaonRICHSelHpElTightAlt/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + + histos.add("hAllRICHSelHpElTightAltDiff/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hPionRICHSelHpElTightAltDiff/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hElectronRICHSelHpElTightAltDiff/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hMuonRICHSelHpElTightAltDiff/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hKaonRICHSelHpElTightAltDiff/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + histos.add("hAllRICHSelHpElLoose/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); histos.add("hPionRICHSelHpElLoose/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); histos.add("hElectronRICHSelHpElLoose/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); @@ -335,8 +348,6 @@ struct QaRejectionGeneral { TrackSelectorPID selectorMuon(kMuonPlus); - static constexpr PDG_t PDGs[5] = {kElectron, kMuonMinus, kPiPlus, kKPlus, kProton}; - for (const auto& track : tracks) { if (std::abs(track.eta()) > etaMaxSel || track.pt() < ptMinSel) @@ -367,19 +378,21 @@ struct QaRejectionGeneral { bool isrichpi = false; if (track.p() < 0.6) { - istofel = std::abs(track.tofNSigmaEl()) < 3.0; - istofpi = std::abs(track.tofNSigmaPi()) < 3.0; - isrichel = std::abs(track.rich().richNsigmaEl()) < 3.0; + istofel = std::abs(track.tofNSigmaEl()) < d_pidTOFMaxpT; + istofpi = std::abs(track.tofNSigmaPi()) < d_pidTOFMaxpT; + isrichel = std::abs(track.rich().richNsigmaEl()) < d_pidRICHMaxpT; } else if (track.p() > 0.6 && track.p() < 1.0) { - isrichel = std::abs(track.rich().richNsigmaEl()) < 3.0; + isrichel = std::abs(track.rich().richNsigmaEl()) < d_pidRICHMaxpT; } else if (track.p() > 1.0 && track.p() < 2.0) { - isrichel = std::abs(track.rich().richNsigmaEl()) < 3.0; - isrichpi = std::abs(track.rich().richNsigmaPi()) < 3.0; + isrichel = std::abs(track.rich().richNsigmaEl()) < d_pidRICHMaxpT; + isrichpi = std::abs(track.rich().richNsigmaPi()) < d_pidRICHMaxpT; } else { - isrichel = std::abs(track.rich().richNsigmaEl()) < 3.0; + isrichel = std::abs(track.rich().richNsigmaEl()) < d_pidRICHMaxpT; } isRICHElTight = isrichel && !isrichpi && istofel && !istofpi; + auto isRICHElTightAlt = selectorElectron.isElectronAndNotPion(track); + if (isRICHElLoose) { histos.fill(HIST("hAllRICHSelHpElLoose/pteta"), track.pt(), track.eta()); if (mcParticle.pdgCode() == kElectron) @@ -402,6 +415,28 @@ struct QaRejectionGeneral { if (mcParticle.pdgCode() == kKPlus) histos.fill(HIST("hKaonRICHSelHpElTight/pteta"), track.pt(), track.eta()); } + if (isRICHElTightAlt) { + histos.fill(HIST("hAllRICHSelHpElTightAlt/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kElectron) + histos.fill(HIST("hElectronRICHSelHpElTightAlt/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kMuonPlus) + histos.fill(HIST("hMuonRICHSelHpElTightAlt/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kPiPlus) + histos.fill(HIST("hPionRICHSelHpElTightAlt/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kKPlus) + histos.fill(HIST("hKaonRICHSelHpElTightAlt/pteta"), track.pt(), track.eta()); + } + if (isRICHElTightAlt != isRICHElTight) { + histos.fill(HIST("hAllRICHSelHpElTightAltDiff/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kElectron) + histos.fill(HIST("hElectronRICHSelHpElTightAltDiff/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kMuonPlus) + histos.fill(HIST("hMuonRICHSelHpElTightAltDiff/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kPiPlus) + histos.fill(HIST("hPionRICHSelHpElTightAltDiff/pteta"), track.pt(), track.eta()); + if (mcParticle.pdgCode() == kKPlus) + histos.fill(HIST("hKaonRICHSelHpElTightAltDiff/pteta"), track.pt(), track.eta()); + } if (isMIDhpMuon) { histos.fill(HIST("hAllMID/pteta"), track.pt(), track.eta()); if (mcParticle.pdgCode() == kElectron) From 4c3686b8b3f51652e2d6cb403f9c77eff9aca728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Mon, 14 Jun 2021 20:21:30 +0200 Subject: [PATCH 30/43] Restrict pion rejection by RICH to 2 GeV/c --- Analysis/Core/include/AnalysisCore/TrackSelectorPID.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h b/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h index ee720440be96a..0f3574e98b404 100644 --- a/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h +++ b/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h @@ -464,7 +464,7 @@ class TrackSelectorPID if (std::abs(nSigmaRICHEl) < mNSigmaRICHMax) { isSelRICH = true; // is selected as electron by RICH } - if ((std::abs(nSigmaRICHPi) < mNSigmaRICHMax) && (p > 1.0)) { + if ((std::abs(nSigmaRICHPi) < mNSigmaRICHMax) && (p > 1.0) && (p < 2.0)) { isSelRICH = false; // is selected as pion by RICH } } else { From 8dd1aea783b88fd51c2fe102bd2753a9d2aa3f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Tue, 15 Jun 2021 02:56:17 +0200 Subject: [PATCH 31/43] Add e/pi selection in Jpsi selector --- .../Tasks/PWGHF/HFJpsiCandidateSelector.cxx | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx index 77348962ef665..468bdce318d06 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx @@ -92,6 +92,7 @@ struct HFJpsiCandidateSelector { Produces hfSelJpsiCandidate; Configurable isALICE3{"isALICE3", false, "Switch between ALICE 2 and ALICE 3 detector setup"}; + Configurable selectENotPi{"selectENotPi", true, "Apply combined TOF + RICH e/π selection"}; Configurable d_pTCandMin{"d_pTCandMin", 0., "Lower bound of candidate pT"}; Configurable d_pTCandMax{"d_pTCandMax", 50., "Upper bound of candidate pT"}; // TPC @@ -204,10 +205,12 @@ struct HFJpsiCandidateSelector { continue; } - // track-level electron PID TOF selection - if (selectorElectron.getStatusTrackPIDTOF(trackPos) == TrackSelectorPID::Status::PIDRejected || - selectorElectron.getStatusTrackPIDTOF(trackNeg) == TrackSelectorPID::Status::PIDRejected) { - selectedEE = 0; + if (!(isALICE3 && selectENotPi)) { + // track-level electron PID TOF selection + if (selectorElectron.getStatusTrackPIDTOF(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorElectron.getStatusTrackPIDTOF(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + selectedEE = 0; + } } if (selectedEE == 0 && selectedMuMu == 0) { @@ -216,10 +219,18 @@ struct HFJpsiCandidateSelector { } if (isALICE3) { // ALICE 3 detectors - // track-level electron PID RICH selection - if (selectorElectron.getStatusTrackPIDRICH(trackPos) == TrackSelectorPID::Status::PIDRejected || - selectorElectron.getStatusTrackPIDRICH(trackNeg) == TrackSelectorPID::Status::PIDRejected) { - selectedEE = 0; + if (selectENotPi) { + // combined TOF + RICH e selection with π rejection + if (!selectorElectron.isElectronAndNotPion(trackPos) || + !selectorElectron.isElectronAndNotPion(trackNeg)) { + selectedEE = 0; + } + } else { + // track-level electron PID RICH selection + if (selectorElectron.getStatusTrackPIDRICH(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorElectron.getStatusTrackPIDRICH(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + selectedEE = 0; + } } if (selectedEE == 0 && selectedMuMu == 0) { @@ -228,13 +239,10 @@ struct HFJpsiCandidateSelector { } // track-level muon PID MID selection - //LOGF(info, "Muon selection: Start"); if (selectorMuon.getStatusTrackPIDMID(trackPos) == TrackSelectorPID::Status::PIDRejected || selectorMuon.getStatusTrackPIDMID(trackNeg) == TrackSelectorPID::Status::PIDRejected) { - //LOGF(info, "Muon selection: Rejected"); selectedMuMu = 0; } - //LOGF(info, "Muon selection: Selected"); } else { // ALICE 2 detectors // track-level electron PID TPC selection From 3be908b5454c358c8904126fbae63ef1716b85bc Mon Sep 17 00:00:00 2001 From: zhangbiao-phy <52267892+zhangbiao-phy@users.noreply.github.com> Date: Tue, 15 Jun 2021 18:16:12 +0800 Subject: [PATCH 32/43] Add 2D histograms for pt jpsi vs pt daughter (#6374) * fix name and add pt jpsi vs daughters * fix name and add pt jpsi vs daughters Co-authored-by: Biao Zhang --- Analysis/Tasks/PWGHF/taskJpsi.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index 3136ad5a18a47..00d66252a3015 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -159,6 +159,8 @@ struct TaskJpsiMC { registry.add("hYSig", "2-prong candidates (rec. matched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hYBg", "2-prong candidates (rec. unmatched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hYGen", "2-prong MC particles (gen. matched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hPtGenProng0", "2-prong candidates (gen. matched);prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hPtGenProng1", "2-prong candidates (gen. matched);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}) } Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMu >= d_selectionFlagJpsi); @@ -216,9 +218,9 @@ struct TaskJpsiMC { registry.fill(HIST("hCPARecBg"), candidate.cpa()); registry.fill(HIST("hEtaRecBg"), candidate.eta()); if (d_modeJpsiToMuMu) { - registry.fill(HIST("hmassSig"), InvMassJpsiToMuMu(candidate), candidate.pt()); + registry.fill(HIST("hmassBg"), InvMassJpsiToMuMu(candidate), candidate.pt()); } else { - registry.fill(HIST("hmassSig"), InvMassJpsiToEE(candidate), candidate.pt()); + registry.fill(HIST("hmassBg"), InvMassJpsiToEE(candidate), candidate.pt()); } registry.fill(HIST("hdeclengthBg"), candidate.decayLength(), candidate.pt()); registry.fill(HIST("hdeclengthxyBg"), candidate.decayLengthXY(), candidate.pt()); @@ -240,6 +242,8 @@ struct TaskJpsiMC { registry.fill(HIST("hPtGen"), particle.pt()); registry.fill(HIST("hEtaGen"), particle.eta()); registry.fill(HIST("hYGen"), RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode())), particle.pt()); + registry.fill(HIST("hPtGenProng0"), particlesMC.iteratorAt(particle.daughter0()).pt(), particle.pt()); + registry.fill(HIST("hPtGenProng1"), particlesMC.iteratorAt(particle.daughter1()).pt(), particle.pt()); } } } From f32400f6fd2c37a83d4151f06f100c1b6f45011c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Tue, 15 Jun 2021 12:42:39 +0200 Subject: [PATCH 33/43] Fix missing ; (#6429) --- Analysis/Tasks/PWGHF/taskJpsi.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index 00d66252a3015..fcf04b232831b 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -160,7 +160,7 @@ struct TaskJpsiMC { registry.add("hYBg", "2-prong candidates (rec. unmatched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hYGen", "2-prong MC particles (gen. matched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hPtGenProng0", "2-prong candidates (gen. matched);prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("hPtGenProng1", "2-prong candidates (gen. matched);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}) + registry.add("hPtGenProng1", "2-prong candidates (gen. matched);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMu >= d_selectionFlagJpsi); From 51e312c17a54b445b35e031eaea538e6316fa544 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Thu, 17 Jun 2021 00:01:15 +0200 Subject: [PATCH 34/43] Fix selection on MID, only PIDAccepted kept (#6448) Co-authored-by: Gian Michele Innocenti --- .../Tasks/PWGHF/HFJpsiCandidateSelector.cxx | 4 ++-- Analysis/Tasks/PWGHF/qaPidRejection.cxx | 22 ++++++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx index 468bdce318d06..99de8e51e7dc7 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx @@ -239,8 +239,8 @@ struct HFJpsiCandidateSelector { } // track-level muon PID MID selection - if (selectorMuon.getStatusTrackPIDMID(trackPos) == TrackSelectorPID::Status::PIDRejected || - selectorMuon.getStatusTrackPIDMID(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + if (selectorMuon.getStatusTrackPIDMID(trackPos) != TrackSelectorPID::Status::PIDAccepted || + selectorMuon.getStatusTrackPIDMID(trackNeg) != TrackSelectorPID::Status::PIDAccepted) { selectedMuMu = 0; } diff --git a/Analysis/Tasks/PWGHF/qaPidRejection.cxx b/Analysis/Tasks/PWGHF/qaPidRejection.cxx index d0a2a5cc7f2ad..e6838a94cee9d 100644 --- a/Analysis/Tasks/PWGHF/qaPidRejection.cxx +++ b/Analysis/Tasks/PWGHF/qaPidRejection.cxx @@ -79,7 +79,7 @@ struct QaTrackingRejection { Configurable etaMax{"etaMax", 2.f, "Upper limit in eta"}; Configurable ptBins{"ptBins", 400, "Number of pT bins"}; Configurable ptMin{"ptMin", 0.f, "Lower limit in pT"}; - Configurable ptMax{"ptMax", 4.f, "Upper limit in pT"}; + Configurable ptMax{"ptMax", 20.f, "Upper limit in pT"}; // TPC Configurable d_pidTPCMinpT{"d_pidTPCMinpT", 9999., "Lower bound of track pT for TPC PID"}; Configurable d_pidTPCMaxpT{"d_pidTPCMaxpT", 999999., "Upper bound of track pT for TPC PID"}; @@ -252,9 +252,9 @@ struct QaRejectionGeneral { Configurable etaBins{"etaBins", 40, "Number of eta bins"}; Configurable etaMin{"etaMin", -2.f, "Lower limit in eta"}; Configurable etaMax{"etaMax", 2.f, "Upper limit in eta"}; - Configurable ptBins{"ptBins", 80, "Number of pT bins"}; + Configurable ptBins{"ptBins", 400, "Number of pT bins"}; Configurable ptMin{"ptMin", 0.f, "Lower limit in pT"}; - Configurable ptMax{"ptMax", 8.f, "Upper limit in pT"}; + Configurable ptMax{"ptMax", 20.f, "Upper limit in pT"}; // TPC Configurable d_pidTPCMinpT{"d_pidTPCMinpT", 9999., "Lower bound of track pT for TPC PID"}; Configurable d_pidTPCMaxpT{"d_pidTPCMaxpT", 999999., "Upper bound of track pT for TPC PID"}; @@ -318,6 +318,12 @@ struct QaRejectionGeneral { histos.add("hMuonMID/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); histos.add("hPionMID/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); histos.add("hKaonMID/pteta", commonTitle + " Primary;" + pt, kTH2D, {ptAxis, etaAxis}); + + histos.add("hAllMID/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("hElectronMID/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("hMuonMID/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("hPionMID/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); + histos.add("hKaonMID/peta", commonTitle + " Primary;" + p, kTH2D, {ptAxis, etaAxis}); } using TracksPID = soa::Join; @@ -447,6 +453,16 @@ struct QaRejectionGeneral { histos.fill(HIST("hPionMID/pteta"), track.pt(), track.eta()); if (mcParticle.pdgCode() == kKPlus) histos.fill(HIST("hKaonMID/pteta"), track.pt(), track.eta()); + + histos.fill(HIST("hAllMID/peta"), track.p(), track.eta()); + if (mcParticle.pdgCode() == kElectron) + histos.fill(HIST("hElectronMID/peta"), track.p(), track.eta()); + if (mcParticle.pdgCode() == kMuonPlus) + histos.fill(HIST("hMuonMID/peta"), track.p(), track.eta()); + if (mcParticle.pdgCode() == kPiPlus) + histos.fill(HIST("hPionMID/peta"), track.p(), track.eta()); + if (mcParticle.pdgCode() == kKPlus) + histos.fill(HIST("hKaonMID/peta"), track.p(), track.eta()); } } } From 6349cc36b38350b5e7062d05366420526d93da09 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Thu, 17 Jun 2021 00:09:56 +0200 Subject: [PATCH 35/43] Propagate fixed MID sel (#6449) Co-authored-by: Gian Michele Innocenti --- Analysis/Tasks/PWGHF/qaPidRejection.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analysis/Tasks/PWGHF/qaPidRejection.cxx b/Analysis/Tasks/PWGHF/qaPidRejection.cxx index e6838a94cee9d..7c239db53b308 100644 --- a/Analysis/Tasks/PWGHF/qaPidRejection.cxx +++ b/Analysis/Tasks/PWGHF/qaPidRejection.cxx @@ -178,7 +178,7 @@ struct QaTrackingRejection { bool isRICHhpKaon = !(selectorKaon.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); bool isTOFhpProton = !(selectorProton.getStatusTrackPIDTOF(track) == TrackSelectorPID::Status::PIDRejected); bool isRICHhpProton = !(selectorProton.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); - bool isMIDhpMuon = !(selectorMuon.getStatusTrackPIDMID(track) == TrackSelectorPID::Status::PIDRejected); + bool isMIDhpMuon = (selectorMuon.getStatusTrackPIDMID(track) == TrackSelectorPID::Status::PIDAccepted); if (MC::isPhysicalPrimary(mcParticles, mcParticle)) { histos.fill(HIST("tracking/pteta"), track.pt(), track.eta()); From 7b7693506d5859c57884d0df55bfc2625401bc47 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Thu, 17 Jun 2021 00:14:17 +0200 Subject: [PATCH 36/43] propagate changes (#6450) Co-authored-by: Gian Michele Innocenti --- Analysis/Tasks/PWGHF/qaPidRejection.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analysis/Tasks/PWGHF/qaPidRejection.cxx b/Analysis/Tasks/PWGHF/qaPidRejection.cxx index 7c239db53b308..2dc9b4ed5faeb 100644 --- a/Analysis/Tasks/PWGHF/qaPidRejection.cxx +++ b/Analysis/Tasks/PWGHF/qaPidRejection.cxx @@ -373,7 +373,7 @@ struct QaRejectionGeneral { bool isRICHhpPion = !(selectorPion.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); bool isRICHhpKaon = !(selectorKaon.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); bool isRICHhpProton = !(selectorProton.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); - bool isMIDhpMuon = !(selectorMuon.getStatusTrackPIDMID(track) == TrackSelectorPID::Status::PIDRejected); + bool isMIDhpMuon = (selectorMuon.getStatusTrackPIDMID(track) == TrackSelectorPID::Status::PIDAccepted); bool isRICHElLoose = isRICHhpElectron; From 03d92c218bef560feab63103eef0c3c12d164244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Sun, 27 Jun 2021 22:49:14 +0200 Subject: [PATCH 37/43] =?UTF-8?q?Split=20J/=CF=88=20selector=20to=20ALICE?= =?UTF-8?q?=202=20and=203=20(#6520)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove obsolete code * Remove TaskName * Add MuMu in documentation * Split process function * Differentiate process functions --- .../Tasks/PWGHF/HFJpsiCandidateSelector.cxx | 178 ++++++++++-------- 1 file changed, 95 insertions(+), 83 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx index 99de8e51e7dc7..a6d28d13ceb3d 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx @@ -9,13 +9,12 @@ // or submit itself to any jurisdiction. /// \file HFJpsiCandidateSelector.cxx -/// \brief J/ψ → e+ e− selection task +/// \brief J/ψ → e+ e−, μ+ μ− selection task /// /// \author Biao Zhang , CCNU /// \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" @@ -28,47 +27,8 @@ using namespace o2::framework; using namespace o2::aod::hf_cand_prong2; using namespace o2::analysis::hf_cuts_jpsi_toee; -/* -namespace o2::aod -{ - -namespace indices_rich -{ -DECLARE_SOA_INDEX_COLUMN(Track, track); -DECLARE_SOA_INDEX_COLUMN(RICH, rich); -} // namespace indices_rich - -DECLARE_SOA_INDEX_TABLE_USER(RICHTracksIndex, Tracks, "RICHTRK", - indices_rich::TrackId, indices_rich::RICHId); -} // namespace o2::aod - -struct RICHindexbuilder { - Builds ind; - void init(o2::framework::InitContext&) {} -}; - namespace o2::aod { - -namespace indices_mid -{ -DECLARE_SOA_INDEX_COLUMN(Track, track); -DECLARE_SOA_INDEX_COLUMN(MID, mid); -} // namespace indices_mid - -DECLARE_SOA_INDEX_TABLE_USER(MIDTracksIndex, Tracks, "MIDTRK", - indices_mid::TrackId, indices_mid::MIDId); -} // namespace o2::aod - -struct MidIndexBuilder { - Builds ind; - void init(o2::framework::InitContext&) {} -}; -*/ - -namespace o2::aod -{ - namespace hf_track_index_alice3_pid { DECLARE_SOA_INDEX_COLUMN(Track, track); //! @@ -87,11 +47,18 @@ struct Alice3PidIndexBuilder { void init(o2::framework::InitContext&) {} }; -/// Struct for applying J/ψ → e+ e− selection cuts -struct HFJpsiCandidateSelector { +void customize(std::vector& workflowOptions) +{ + ConfigParamSpec isAlice3{"isAlice3", VariantType::Bool, false, {"Switch between ALICE 2 and ALICE 3 detector setup"}}; + workflowOptions.push_back(isAlice3); +} + +#include "Framework/runDataProcessing.h" + +/// Struct for applying J/ψ → e+ e−, μ+ μ− selection cuts +struct HfJpsiCandidateSelector { Produces hfSelJpsiCandidate; - Configurable isALICE3{"isALICE3", false, "Switch between ALICE 2 and ALICE 3 detector setup"}; Configurable selectENotPi{"selectENotPi", true, "Apply combined TOF + RICH e/π selection"}; Configurable d_pTCandMin{"d_pTCandMin", 0., "Lower bound of candidate pT"}; Configurable d_pTCandMax{"d_pTCandMax", 50., "Upper bound of candidate pT"}; @@ -170,7 +137,60 @@ struct HFJpsiCandidateSelector { using TracksPID = soa::Join; - void process(aod::HfCandProng2 const& candidates, TracksPID const&, aod::RICHs const&, aod::MIDs const&) + void processAlice2(aod::HfCandProng2 const& candidates, aod::BigTracksPID 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); + selectorElectron.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT); + selectorElectron.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH); + selectorElectron.setRangeNSigmaRICHCondTOF(-d_nSigmaRICHCombinedTOF, d_nSigmaRICHCombinedTOF); + + // looping over 2-prong candidates + for (auto& candidate : candidates) { + + if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE) && !(candidate.hfflag() & 1 << DecayType::JpsiToMuMu)) { + hfSelJpsiCandidate(0, 0); + continue; + } + + auto trackPos = candidate.index0_as(); // positive daughter + auto trackNeg = candidate.index1_as(); // negative daughter + + int selectedEE = 1; + int selectedMuMu = 1; + + // track selection level need to add special cuts (additional cuts on decay length and d0 norm) + + if (!selectionTopol(candidate, trackPos, trackNeg, selectedEE, selectedMuMu)) { + hfSelJpsiCandidate(0, 0); + continue; + } + + // track-level electron PID TOF selection + if (selectorElectron.getStatusTrackPIDTOF(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorElectron.getStatusTrackPIDTOF(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + selectedEE = 0; + if (selectedMuMu == 0) { + hfSelJpsiCandidate(0, 0); + continue; + } + } + + // track-level electron PID TPC selection + if (selectorElectron.getStatusTrackPIDTPC(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorElectron.getStatusTrackPIDTPC(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + selectedEE = 0; + } + + hfSelJpsiCandidate(selectedEE, selectedMuMu); + } + } + + void processAlice3(aod::HfCandProng2 const& candidates, TracksPID const&, aod::RICHs const&, aod::MIDs const&) { TrackSelectorPID selectorElectron(kElectron); selectorElectron.setRangePtTPC(d_pidTPCMinpT, d_pidTPCMaxpT); @@ -205,11 +225,27 @@ struct HFJpsiCandidateSelector { continue; } - if (!(isALICE3 && selectENotPi)) { + if (selectENotPi) { + // combined TOF + RICH e selection with π rejection + if (!selectorElectron.isElectronAndNotPion(trackPos) || + !selectorElectron.isElectronAndNotPion(trackNeg)) { + selectedEE = 0; + } + } else { // track-level electron PID TOF selection if (selectorElectron.getStatusTrackPIDTOF(trackPos) == TrackSelectorPID::Status::PIDRejected || selectorElectron.getStatusTrackPIDTOF(trackNeg) == TrackSelectorPID::Status::PIDRejected) { selectedEE = 0; + if (selectedMuMu == 0) { + hfSelJpsiCandidate(0, 0); + continue; + } + } + + // track-level electron PID RICH selection + if (selectorElectron.getStatusTrackPIDRICH(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorElectron.getStatusTrackPIDRICH(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + selectedEE = 0; } } @@ -218,38 +254,10 @@ struct HFJpsiCandidateSelector { continue; } - if (isALICE3) { // ALICE 3 detectors - if (selectENotPi) { - // combined TOF + RICH e selection with π rejection - if (!selectorElectron.isElectronAndNotPion(trackPos) || - !selectorElectron.isElectronAndNotPion(trackNeg)) { - selectedEE = 0; - } - } else { - // track-level electron PID RICH selection - if (selectorElectron.getStatusTrackPIDRICH(trackPos) == TrackSelectorPID::Status::PIDRejected || - selectorElectron.getStatusTrackPIDRICH(trackNeg) == TrackSelectorPID::Status::PIDRejected) { - selectedEE = 0; - } - } - - if (selectedEE == 0 && selectedMuMu == 0) { - hfSelJpsiCandidate(0, 0); - continue; - } - - // track-level muon PID MID selection - if (selectorMuon.getStatusTrackPIDMID(trackPos) != TrackSelectorPID::Status::PIDAccepted || - selectorMuon.getStatusTrackPIDMID(trackNeg) != TrackSelectorPID::Status::PIDAccepted) { - selectedMuMu = 0; - } - - } else { // ALICE 2 detectors - // track-level electron PID TPC selection - if (selectorElectron.getStatusTrackPIDTPC(trackPos) == TrackSelectorPID::Status::PIDRejected || - selectorElectron.getStatusTrackPIDTPC(trackNeg) == TrackSelectorPID::Status::PIDRejected) { - selectedEE = 0; - } + // track-level muon PID MID selection + if (selectorMuon.getStatusTrackPIDMID(trackPos) != TrackSelectorPID::Status::PIDAccepted || + selectorMuon.getStatusTrackPIDMID(trackNeg) != TrackSelectorPID::Status::PIDAccepted) { + selectedMuMu = 0; } hfSelJpsiCandidate(selectedEE, selectedMuMu); @@ -259,9 +267,13 @@ struct HFJpsiCandidateSelector { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{ - //adaptAnalysisTask(cfgc), - //adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc, TaskName{"hf-jpsi-candidate-selector"})}; + WorkflowSpec workflow{}; + const bool isAlice3 = cfgc.options().get("isAlice3"); + if (isAlice3) { + workflow.push_back(adaptAnalysisTask(cfgc)); + workflow.push_back(adaptAnalysisTask(cfgc, Processes{&HfJpsiCandidateSelector::processAlice3})); + } else { + workflow.push_back(adaptAnalysisTask(cfgc, Processes{&HfJpsiCandidateSelector::processAlice2})); + } + return workflow; } From d45ef4b355e5f63892a872be3fbca3cf14d6c93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Thu, 1 Jul 2021 10:58:14 +0200 Subject: [PATCH 38/43] =?UTF-8?q?Add=20columns=20to=20store=20decision=20o?= =?UTF-8?q?f=20each=20J/=CF=88=20selector=20step=20(#6548)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HFCandidateSelectionTables.h | 18 ++- .../Tasks/PWGHF/HFJpsiCandidateSelector.cxx | 128 ++++++++++++------ Analysis/Tasks/PWGHF/taskJpsi.cxx | 12 +- 3 files changed, 111 insertions(+), 47 deletions(-) diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h b/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h index 6780e2c324968..0964daf4553be 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFCandidateSelectionTables.h @@ -39,11 +39,25 @@ DECLARE_SOA_TABLE(HFSelLcCandidate, "AOD", "HFSELLCCAND", //! namespace hf_selcandidate_jpsi { DECLARE_SOA_COLUMN(IsSelJpsiToEE, isSelJpsiToEE, int); //! -DECLARE_SOA_COLUMN(IsSelJpsiToMuMu, isSelJpsiToMuMu, int); //! +DECLARE_SOA_COLUMN(IsSelJpsiToMuMu, isSelJpsiToMuMu, int); //! +DECLARE_SOA_COLUMN(IsSelJpsiToEETopol, isSelJpsiToEETopol, int); //! +DECLARE_SOA_COLUMN(IsSelJpsiToEETpc, isSelJpsiToEETpc, int); //! +DECLARE_SOA_COLUMN(IsSelJpsiToEETof, isSelJpsiToEETof, int); //! +DECLARE_SOA_COLUMN(IsSelJpsiToEERich, isSelJpsiToEERich, int); //! +DECLARE_SOA_COLUMN(IsSelJpsiToEETofRich, isSelJpsiToEETofRich, int); //! +DECLARE_SOA_COLUMN(IsSelJpsiToMuMuTopol, isSelJpsiToMuMuTopol, int); //! +DECLARE_SOA_COLUMN(IsSelJpsiToMuMuMid, isSelJpsiToMuMuMid, int); //! } // namespace hf_selcandidate_jpsi DECLARE_SOA_TABLE(HFSelJpsiCandidate, "AOD", "HFSELJPSICAND", //! hf_selcandidate_jpsi::IsSelJpsiToEE, - hf_selcandidate_jpsi::IsSelJpsiToMuMu); + hf_selcandidate_jpsi::IsSelJpsiToMuMu, + hf_selcandidate_jpsi::IsSelJpsiToEETopol, + hf_selcandidate_jpsi::IsSelJpsiToEETpc, + hf_selcandidate_jpsi::IsSelJpsiToEETof, + hf_selcandidate_jpsi::IsSelJpsiToEERich, + hf_selcandidate_jpsi::IsSelJpsiToEETofRich, + hf_selcandidate_jpsi::IsSelJpsiToMuMuTopol, + hf_selcandidate_jpsi::IsSelJpsiToMuMuMid); namespace hf_selcandidate_lc_k0sp { diff --git a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx index a6d28d13ceb3d..29dd3ca75b865 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx @@ -153,40 +153,64 @@ struct HfJpsiCandidateSelector { for (auto& candidate : candidates) { if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE) && !(candidate.hfflag() & 1 << DecayType::JpsiToMuMu)) { - hfSelJpsiCandidate(0, 0); + hfSelJpsiCandidate(0, 0, 0, 0, 0, 0, 0, 0, 0); + //hfSelJpsiCandidate(0, 0); continue; } auto trackPos = candidate.index0_as(); // positive daughter auto trackNeg = candidate.index1_as(); // negative daughter + int selectedEETopol = 1; + int selectedEETpc = 1; + int selectedEETof = 1; + int selectedEERich = 1; + int selectedEETofRich = 1; + int selectedMuMuTopol = 1; + int selectedMuMuMid = 1; int selectedEE = 1; int selectedMuMu = 1; // track selection level need to add special cuts (additional cuts on decay length and d0 norm) - if (!selectionTopol(candidate, trackPos, trackNeg, selectedEE, selectedMuMu)) { - hfSelJpsiCandidate(0, 0); - continue; + if (!selectionTopol(candidate, trackPos, trackNeg, selectedEETopol, selectedMuMuTopol)) { + selectedEETopol = 0; + selectedMuMuTopol = 0; + selectedEE = 0; + selectedMuMu = 0; + //if (!selectionTopol(candidate, trackPos, trackNeg, selectedEE, selectedMuMu)) { + //hfSelJpsiCandidate(0, 0); + //continue; } // track-level electron PID TOF selection if (selectorElectron.getStatusTrackPIDTOF(trackPos) == TrackSelectorPID::Status::PIDRejected || selectorElectron.getStatusTrackPIDTOF(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + selectedEETof = 0; selectedEE = 0; - if (selectedMuMu == 0) { - hfSelJpsiCandidate(0, 0); - continue; - } + //if (selectedMuMu == 0) { + // hfSelJpsiCandidate(0, 0); + // continue; + //} } // track-level electron PID TPC selection if (selectorElectron.getStatusTrackPIDTPC(trackPos) == TrackSelectorPID::Status::PIDRejected || selectorElectron.getStatusTrackPIDTPC(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + selectedEETpc = 0; selectedEE = 0; } - hfSelJpsiCandidate(selectedEE, selectedMuMu); + hfSelJpsiCandidate(selectedEE, + selectedMuMu, + selectedEETopol, + selectedEETpc, + selectedEETof, + selectedEERich, + selectedEETofRich, + selectedMuMuTopol, + selectedMuMuMid); + //hfSelJpsiCandidate(selectedEE, selectedMuMu); } } @@ -208,59 +232,85 @@ struct HfJpsiCandidateSelector { for (auto& candidate : candidates) { if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE) && !(candidate.hfflag() & 1 << DecayType::JpsiToMuMu)) { - hfSelJpsiCandidate(0, 0); + hfSelJpsiCandidate(0, 0, 0, 0, 0, 0, 0, 0, 0); + //hfSelJpsiCandidate(0, 0); continue; } auto trackPos = candidate.index0_as(); // positive daughter auto trackNeg = candidate.index1_as(); // negative daughter + int selectedEETopol = 1; + int selectedEETpc = 1; + int selectedEETof = 1; + int selectedEERich = 1; + int selectedEETofRich = 1; + int selectedMuMuTopol = 1; + int selectedMuMuMid = 1; int selectedEE = 1; int selectedMuMu = 1; // track selection level need to add special cuts (additional cuts on decay length and d0 norm) - if (!selectionTopol(candidate, trackPos, trackNeg, selectedEE, selectedMuMu)) { - hfSelJpsiCandidate(0, 0); - continue; + if (!selectionTopol(candidate, trackPos, trackNeg, selectedEETopol, selectedMuMuTopol)) { + selectedEETopol = 0; + selectedMuMuTopol = 0; + selectedEE = 0; + selectedMuMu = 0; + //if (!selectionTopol(candidate, trackPos, trackNeg, selectedEE, selectedMuMu)) { + //hfSelJpsiCandidate(0, 0); + //continue; } - if (selectENotPi) { - // combined TOF + RICH e selection with π rejection - if (!selectorElectron.isElectronAndNotPion(trackPos) || - !selectorElectron.isElectronAndNotPion(trackNeg)) { - selectedEE = 0; - } - } else { - // track-level electron PID TOF selection - if (selectorElectron.getStatusTrackPIDTOF(trackPos) == TrackSelectorPID::Status::PIDRejected || - selectorElectron.getStatusTrackPIDTOF(trackNeg) == TrackSelectorPID::Status::PIDRejected) { - selectedEE = 0; - if (selectedMuMu == 0) { - hfSelJpsiCandidate(0, 0); - continue; - } - } - - // track-level electron PID RICH selection - if (selectorElectron.getStatusTrackPIDRICH(trackPos) == TrackSelectorPID::Status::PIDRejected || - selectorElectron.getStatusTrackPIDRICH(trackNeg) == TrackSelectorPID::Status::PIDRejected) { - selectedEE = 0; - } + //if (selectENotPi) { + // combined TOF + RICH e selection with π rejection + if (!selectorElectron.isElectronAndNotPion(trackPos) || + !selectorElectron.isElectronAndNotPion(trackNeg)) { + selectedEETofRich = 0; + selectedEE = 0; + } + //} else { + // track-level electron PID TOF selection + if (selectorElectron.getStatusTrackPIDTOF(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorElectron.getStatusTrackPIDTOF(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + selectedEETof = 0; + selectedEE = 0; + //if (selectedMuMu == 0) { + // hfSelJpsiCandidate(0, 0); + // continue; + //} } - if (selectedEE == 0 && selectedMuMu == 0) { - hfSelJpsiCandidate(0, 0); - continue; + // track-level electron PID RICH selection + if (selectorElectron.getStatusTrackPIDRICH(trackPos) == TrackSelectorPID::Status::PIDRejected || + selectorElectron.getStatusTrackPIDRICH(trackNeg) == TrackSelectorPID::Status::PIDRejected) { + selectedEERich = 0; + selectedEE = 0; } + //} + + //if (selectedEE == 0 && selectedMuMu == 0) { + // hfSelJpsiCandidate(0, 0); + // continue; + //} // track-level muon PID MID selection if (selectorMuon.getStatusTrackPIDMID(trackPos) != TrackSelectorPID::Status::PIDAccepted || selectorMuon.getStatusTrackPIDMID(trackNeg) != TrackSelectorPID::Status::PIDAccepted) { + selectedMuMuMid = 0; selectedMuMu = 0; } - hfSelJpsiCandidate(selectedEE, selectedMuMu); + hfSelJpsiCandidate(selectedEE, + selectedMuMu, + selectedEETopol, + selectedEETpc, + selectedEETof, + selectedEERich, + selectedEETofRich, + selectedMuMuTopol, + selectedMuMuMid); + //hfSelJpsiCandidate(selectedEE, selectedMuMu); } } }; diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index fcf04b232831b..a02cad7482f98 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -66,7 +66,7 @@ struct TaskJpsi { registry.add("hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMu >= d_selectionFlagJpsi); + Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEETopol >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMuTopol >= d_selectionFlagJpsi); void process(soa::Filtered> const& candidates) { @@ -79,10 +79,10 @@ struct TaskJpsi { } if (d_selectionFlagJpsi > 0) { if (d_modeJpsiToMuMu) { - if (candidate.isSelJpsiToMuMu() <= 0) + if (candidate.isSelJpsiToMuMuTopol() <= 0) continue; } else { - if (candidate.isSelJpsiToEE() <= 0) + if (candidate.isSelJpsiToEETopol() <= 0) continue; } } @@ -163,7 +163,7 @@ struct TaskJpsiMC { registry.add("hPtGenProng1", "2-prong candidates (gen. matched);prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH2F, {{100, 0., 10.}, {(std::vector)bins, "#it{p}_{T} (GeV/#it{c})"}}}); } - Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMu >= d_selectionFlagJpsi); + Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEETopol >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMuTopol >= d_selectionFlagJpsi); void process(soa::Filtered> const& candidates, soa::Join const& particlesMC, aod::BigTracksMC const& tracks) @@ -179,10 +179,10 @@ struct TaskJpsiMC { } if (d_selectionFlagJpsi > 0) { if (d_modeJpsiToMuMu) { - if (candidate.isSelJpsiToMuMu() <= 0) + if (candidate.isSelJpsiToMuMuTopol() <= 0) continue; } else { - if (candidate.isSelJpsiToEE() <= 0) + if (candidate.isSelJpsiToEETopol() <= 0) continue; } } From b290d4d9f68fbccada8ccd89c4c1e093a27f3ef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Tue, 20 Jul 2021 17:57:24 +0200 Subject: [PATCH 39/43] Add Jpsi -> mumu to skimming --- .../include/AnalysisCore/HFSelectorCuts.h | 2 +- .../Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx | 26 +++++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h b/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h index 5b4b3ae58131c..66a6f09428765 100644 --- a/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h +++ b/Analysis/Core/include/AnalysisCore/HFSelectorCuts.h @@ -100,7 +100,7 @@ auto pTBinsVec = std::vector{pTBins, pTBins + npTBins + 1}; // default values for the cuts constexpr double cuts[npTBins][nCutVars] = {{1.65, 2.15, 0.5, 100.}, /* 1 < pt < 5 */ - {1.65, 2.15, 0.5, 100.}}; /* 5 < pt > 1000 */ + {1.65, 2.15, 0.5, 100.}}; /* 5 < pt < 1000 */ // row labels static const std::vector pTBinLabels{}; diff --git a/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx b/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx index 1cdb30a62c53f..40bce9e2b72e2 100644 --- a/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx +++ b/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx @@ -448,9 +448,12 @@ struct HfTrackIndexSkimsCreator { // D0 cuts Configurable> pTBinsD0ToPiK{"pTBinsD0ToPiK", std::vector{hf_cuts_presel_2prong::pTBinsVec}, "pT bin limits for D0->piK pT-depentend cuts"}; Configurable> cutsD0ToPiK{"cutsD0ToPiK", {hf_cuts_presel_2prong::cuts[0], hf_cuts_presel_2prong::npTBins, hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::pTBinLabels, hf_cuts_presel_2prong::cutVarLabels}, "D0->piK selections per pT bin"}; - // Jpsi cuts + // Jpsi -> ee cuts Configurable> pTBinsJpsiToEE{"pTBinsJpsiToEE", std::vector{hf_cuts_presel_2prong::pTBinsVec}, "pT bin limits for Jpsi->ee pT-depentend cuts"}; Configurable> cutsJpsiToEE{"cutsJpsiToEE", {hf_cuts_presel_2prong::cuts[0], hf_cuts_presel_2prong::npTBins, hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::pTBinLabels, hf_cuts_presel_2prong::cutVarLabels}, "Jpsi->ee selections per pT bin"}; + // Jpsi -> mumu cuts + Configurable> pTBinsJpsiToMuMu{"pTBinsJpsiToMuMu", std::vector{hf_cuts_presel_2prong::pTBinsVec}, "pT bin limits for Jpsi->mumu pT-depentend cuts"}; + Configurable> cutsJpsiToMuMu{"cutsJpsiToMuMu", {hf_cuts_presel_2prong::cuts[0], hf_cuts_presel_2prong::npTBins, hf_cuts_presel_2prong::nCutVars, hf_cuts_presel_2prong::pTBinLabels, hf_cuts_presel_2prong::cutVarLabels}, "Jpsi->mumu selections per pT bin"}; // D+ cuts Configurable> pTBinsDPlusToPiKPi{"pTBinsDPlusToPiKPi", std::vector{hf_cuts_presel_3prong::pTBinsVec}, "pT bin limits for D+->piKpi pT-depentend cuts"}; Configurable> cutsDPlusToPiKPi{"cutsDPlusToPiKPi", {hf_cuts_presel_3prong::cuts[0], hf_cuts_presel_3prong::npTBins, hf_cuts_presel_3prong::nCutVars, hf_cuts_presel_3prong::pTBinLabels, hf_cuts_presel_3prong::cutVarLabels}, "D+->piKpi selections per pT bin"}; @@ -475,6 +478,7 @@ struct HfTrackIndexSkimsCreator { {"hNCand2ProngVsNTracks", "2-prong candidates preselected;# of selected tracks;# of candidates;entries", {HistType::kTH2F, {{2500, 0., 25000.}, {2000, 0., 200000.}}}}, {"hmassD0ToPiK", "D^{0} candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}}, {"hmassJpsiToEE", "J/#psi candidates;inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}}, + {"hmassJpsiToMuMu", "J/#psi candidates;inv. mass (#mu^{#plus} #mu^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}}, // 3-prong histograms {"hVtx3ProngX", "3-prong candidates;#it{x}_{sec. vtx.} (cm);entries", {HistType::kTH1F, {{1000, -2., 2.}}}}, {"hVtx3ProngY", "3-prong candidates;#it{y}_{sec. vtx.} (cm);entries", {HistType::kTH1F, {{1000, -2., 2.}}}}, @@ -521,8 +525,8 @@ struct HfTrackIndexSkimsCreator { array{massPi, massK, massProton}}; // cuts for 2-prong decays retrieved by json. the order must be then one in hf_cand_prong2::DecayType - cut2Prong = {cutsD0ToPiK, cutsJpsiToEE}; - pTBins2Prong = {pTBinsD0ToPiK, pTBinsJpsiToEE}; + cut2Prong = {cutsD0ToPiK, cutsJpsiToEE, cutsJpsiToMuMu}; + pTBins2Prong = {pTBinsD0ToPiK, pTBinsJpsiToEE, pTBinsJpsiToMuMu}; // cuts for 3-prong decays retrieved by json. the order must be then one in hf_cand_prong3::DecayType cut3Prong = {cutsDPlusToPiKPi, cutsLcToPKPi, cutsDsToPiKK, cutsXicToPKPi}; pTBins3Prong = {pTBinsDPlusToPiKPi, pTBinsLcToPKPi, pTBinsDsToPiKK, pTBinsXicToPKPi}; @@ -860,7 +864,7 @@ struct HfTrackIndexSkimsCreator { } } } - rowProng2CutStatus(Prong2CutStatus[0], Prong2CutStatus[1]); //FIXME when we can do this by looping over n2ProngDecays + rowProng2CutStatus(Prong2CutStatus[0], Prong2CutStatus[1], Prong2CutStatus[2]); //FIXME when we can do this by looping over n2ProngDecays } // fill histograms @@ -873,10 +877,16 @@ struct HfTrackIndexSkimsCreator { if (TESTBIT(isSelected2ProngCand, iDecay2P)) { if (whichHypo2Prong[iDecay2P] == 1 || whichHypo2Prong[iDecay2P] == 3) { auto mass2Prong = RecoDecay::M(arrMom, arrMass2Prong[iDecay2P][0]); - if (iDecay2P == hf_cand_prong2::DecayType::D0ToPiK) { - registry.get(HIST("hmassD0ToPiK"))->Fill(mass2Prong); - } else if (iDecay2P == hf_cand_prong2::DecayType::JpsiToEE) { - registry.get(HIST("hmassJpsiToEE"))->Fill(mass2Prong); + switch (iDecay2P) { + case hf_cand_prong2::DecayType::D0ToPiK: + registry.get(HIST("hmassD0ToPiK"))->Fill(mass2Prong); + break; + case hf_cand_prong2::DecayType::JpsiToEE: + registry.get(HIST("hmassJpsiToEE"))->Fill(mass2Prong); + break; + case hf_cand_prong2::DecayType::JpsiToMuMu: + registry.get(HIST("hmassJpsiToMuMu"))->Fill(mass2Prong); + break; } } if (whichHypo2Prong[iDecay2P] >= 2) { From 81e5af659b10af7ace599863e7bdb1a5abc7b6d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Tue, 20 Jul 2021 18:30:59 +0200 Subject: [PATCH 40/43] Fix missing mass array --- Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx b/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx index 40bce9e2b72e2..976555365af5d 100644 --- a/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx +++ b/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx @@ -48,6 +48,7 @@ static const double massPi = RecoDecay::getMassPDG(kPiPlus); static const double massK = RecoDecay::getMassPDG(kKPlus); static const double massProton = RecoDecay::getMassPDG(kProton); static const double massElectron = RecoDecay::getMassPDG(kElectron); +static const double massMuon = RecoDecay::getMassPDG(kMuonPlus); void customize(std::vector& workflowOptions) { @@ -512,6 +513,9 @@ struct HfTrackIndexSkimsCreator { arrMass2Prong[hf_cand_prong2::DecayType::JpsiToEE] = array{array{massElectron, massElectron}, array{massElectron, massElectron}}; + arrMass2Prong[hf_cand_prong2::DecayType::JpsiToMuMu] = array{array{massMuon, massMuon}, + array{massMuon, massMuon}}; + arrMass3Prong[hf_cand_prong3::DecayType::DPlusToPiKPi] = array{array{massPi, massK, massPi}, array{massPi, massK, massPi}}; From 6d82ee45699af1e120192ad4b5883ff5ba7c1ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Wed, 21 Jul 2021 15:45:24 +0200 Subject: [PATCH 41/43] Fix copyright headers and braces --- Analysis/ALICE3/include/ALICE3Analysis/MID.h | 9 +- .../include/AnalysisCore/TrackSelectorPID.h | 6 +- Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx | 9 +- .../Tasks/PWGHF/HFJpsiCandidateSelector.cxx | 9 +- .../PWGHF/HFXToJpsiPiPiCandidateSelector.cxx | 9 +- Analysis/Tasks/PWGHF/qaPidRejection.cxx | 99 ++++++++++++------- Analysis/Tasks/PWGHF/taskJpsi.cxx | 12 ++- 7 files changed, 97 insertions(+), 56 deletions(-) diff --git a/Analysis/ALICE3/include/ALICE3Analysis/MID.h b/Analysis/ALICE3/include/ALICE3Analysis/MID.h index b6964d056467c..7d932b90802d3 100644 --- a/Analysis/ALICE3/include/ALICE3Analysis/MID.h +++ b/Analysis/ALICE3/include/ALICE3Analysis/MID.h @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h b/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h index c03e336dc342a..6c0267c3bab41 100644 --- a/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h +++ b/Analysis/Core/include/AnalysisCore/TrackSelectorPID.h @@ -445,11 +445,13 @@ class TrackSelectorPID // TOF if (useTOF && hasTOF && (p < 0.6)) { if (p > 0.4 && hasRICH) { - if ((std::abs(nSigmaTOFEl) < mNSigmaTOFMax) && (std::abs(nSigmaRICHEl) < mNSigmaRICHMax)) + if ((std::abs(nSigmaTOFEl) < mNSigmaTOFMax) && (std::abs(nSigmaRICHEl) < mNSigmaRICHMax)) { isSelTOF = true; // is selected as electron by TOF and RICH + } } else if (p <= 0.4) { - if (std::abs(nSigmaTOFEl) < mNSigmaTOFMax) + if (std::abs(nSigmaTOFEl) < mNSigmaTOFMax) { isSelTOF = true; // is selected as electron by TOF + } } else { isSelTOF = false; // This is rejecting all the heavier particles which do not have a RICH signal in the p area of 0.4-0.6 GeV/c } diff --git a/Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx b/Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx index f257cdbba0329..0d62fa63f4f9e 100644 --- a/Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx +++ b/Analysis/Tasks/PWGHF/HFCandidateCreatorX.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx index 29dd3ca75b865..ac82087116245 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx index 0efd8a6dbe538..a2b2fb5f72ea1 100644 --- a/Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFXToJpsiPiPiCandidateSelector.cxx @@ -1,8 +1,9 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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 diff --git a/Analysis/Tasks/PWGHF/qaPidRejection.cxx b/Analysis/Tasks/PWGHF/qaPidRejection.cxx index 2dc9b4ed5faeb..42652d8a2d888 100644 --- a/Analysis/Tasks/PWGHF/qaPidRejection.cxx +++ b/Analysis/Tasks/PWGHF/qaPidRejection.cxx @@ -1,18 +1,20 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". +// 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. // -// See http://alice-o2.web.cern.ch/license for full licensing information. +// 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. + /// \author Peter Hristov , CERN /// \author Gian Michele Innocenti , CERN /// \author Henrique J C Zanoli , Utrecht University /// \author Nicolo' Jacazio , CERN -// O2 inlcudes +// O2 includes #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "ReconstructionDataFormats/DCA.h" @@ -356,18 +358,23 @@ struct QaRejectionGeneral { for (const auto& track : tracks) { - if (std::abs(track.eta()) > etaMaxSel || track.pt() < ptMinSel) + if (std::abs(track.eta()) > etaMaxSel || track.pt() < ptMinSel) { continue; + } const auto mcParticle = track.mcParticle(); histos.fill(HIST("hAllNoSel/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kElectron) + if (mcParticle.pdgCode() == kElectron) { histos.fill(HIST("hElectronNoSel/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kMuonPlus) + } + if (mcParticle.pdgCode() == kMuonPlus) { histos.fill(HIST("hMuonNoSel/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kPiPlus) + } + if (mcParticle.pdgCode() == kPiPlus) { histos.fill(HIST("hPionNoSel/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kKPlus) + } + if (mcParticle.pdgCode() == kKPlus) { histos.fill(HIST("hKaonNoSel/pteta"), track.pt(), track.eta()); + } bool isRICHhpElectron = !(selectorElectron.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); bool isRICHhpPion = !(selectorPion.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); @@ -401,68 +408,92 @@ struct QaRejectionGeneral { if (isRICHElLoose) { histos.fill(HIST("hAllRICHSelHpElLoose/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kElectron) + if (mcParticle.pdgCode() == kElectron) { histos.fill(HIST("hElectronRICHSelHpElLoose/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kMuonPlus) + } + if (mcParticle.pdgCode() == kMuonPlus) { histos.fill(HIST("hMuonRICHSelHpElLoose/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kPiPlus) + } + if (mcParticle.pdgCode() == kPiPlus) { histos.fill(HIST("hPionRICHSelHpElLoose/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kKPlus) + } + if (mcParticle.pdgCode() == kKPlus) { histos.fill(HIST("hKaonRICHSelHpElLoose/pteta"), track.pt(), track.eta()); + } } if (isRICHElTight) { histos.fill(HIST("hAllRICHSelHpElTight/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kElectron) + if (mcParticle.pdgCode() == kElectron) { histos.fill(HIST("hElectronRICHSelHpElTight/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kMuonPlus) + } + if (mcParticle.pdgCode() == kMuonPlus) { histos.fill(HIST("hMuonRICHSelHpElTight/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kPiPlus) + } + if (mcParticle.pdgCode() == kPiPlus) { histos.fill(HIST("hPionRICHSelHpElTight/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kKPlus) + } + if (mcParticle.pdgCode() == kKPlus) { histos.fill(HIST("hKaonRICHSelHpElTight/pteta"), track.pt(), track.eta()); + } } if (isRICHElTightAlt) { histos.fill(HIST("hAllRICHSelHpElTightAlt/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kElectron) + if (mcParticle.pdgCode() == kElectron) { histos.fill(HIST("hElectronRICHSelHpElTightAlt/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kMuonPlus) + } + if (mcParticle.pdgCode() == kMuonPlus) { histos.fill(HIST("hMuonRICHSelHpElTightAlt/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kPiPlus) + } + if (mcParticle.pdgCode() == kPiPlus) { histos.fill(HIST("hPionRICHSelHpElTightAlt/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kKPlus) + } + if (mcParticle.pdgCode() == kKPlus) { histos.fill(HIST("hKaonRICHSelHpElTightAlt/pteta"), track.pt(), track.eta()); + } } if (isRICHElTightAlt != isRICHElTight) { histos.fill(HIST("hAllRICHSelHpElTightAltDiff/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kElectron) + if (mcParticle.pdgCode() == kElectron) { histos.fill(HIST("hElectronRICHSelHpElTightAltDiff/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kMuonPlus) + } + if (mcParticle.pdgCode() == kMuonPlus) { histos.fill(HIST("hMuonRICHSelHpElTightAltDiff/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kPiPlus) + } + if (mcParticle.pdgCode() == kPiPlus) { histos.fill(HIST("hPionRICHSelHpElTightAltDiff/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kKPlus) + } + if (mcParticle.pdgCode() == kKPlus) { histos.fill(HIST("hKaonRICHSelHpElTightAltDiff/pteta"), track.pt(), track.eta()); + } } if (isMIDhpMuon) { histos.fill(HIST("hAllMID/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kElectron) + if (mcParticle.pdgCode() == kElectron) { histos.fill(HIST("hElectronMID/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kMuonPlus) + } + if (mcParticle.pdgCode() == kMuonPlus) { histos.fill(HIST("hMuonMID/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kPiPlus) + } + if (mcParticle.pdgCode() == kPiPlus) { histos.fill(HIST("hPionMID/pteta"), track.pt(), track.eta()); - if (mcParticle.pdgCode() == kKPlus) + } + if (mcParticle.pdgCode() == kKPlus) { histos.fill(HIST("hKaonMID/pteta"), track.pt(), track.eta()); + } histos.fill(HIST("hAllMID/peta"), track.p(), track.eta()); - if (mcParticle.pdgCode() == kElectron) + if (mcParticle.pdgCode() == kElectron) { histos.fill(HIST("hElectronMID/peta"), track.p(), track.eta()); - if (mcParticle.pdgCode() == kMuonPlus) + } + if (mcParticle.pdgCode() == kMuonPlus) { histos.fill(HIST("hMuonMID/peta"), track.p(), track.eta()); - if (mcParticle.pdgCode() == kPiPlus) + } + if (mcParticle.pdgCode() == kPiPlus) { histos.fill(HIST("hPionMID/peta"), track.p(), track.eta()); - if (mcParticle.pdgCode() == kKPlus) + } + if (mcParticle.pdgCode() == kKPlus) { histos.fill(HIST("hKaonMID/peta"), track.p(), track.eta()); + } } } } diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index f0559f1630bb1..d6735abc3da26 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -80,11 +80,13 @@ struct TaskJpsi { } if (d_selectionFlagJpsi > 0) { if (d_modeJpsiToMuMu) { - if (candidate.isSelJpsiToMuMuTopol() <= 0) + if (candidate.isSelJpsiToMuMuTopol() <= 0) { continue; + } } else { - if (candidate.isSelJpsiToEETopol() <= 0) + if (candidate.isSelJpsiToEETopol() <= 0) { continue; + } } } if (cutYCandMax >= 0. && std::abs(YJpsi(candidate)) > cutYCandMax) { @@ -180,11 +182,13 @@ struct TaskJpsiMC { } if (d_selectionFlagJpsi > 0) { if (d_modeJpsiToMuMu) { - if (candidate.isSelJpsiToMuMuTopol() <= 0) + if (candidate.isSelJpsiToMuMuTopol() <= 0) { continue; + } } else { - if (candidate.isSelJpsiToEETopol() <= 0) + if (candidate.isSelJpsiToEETopol() <= 0) { continue; + } } } From 1cf7cdc498b0e636078d661266d4ac05bc22b572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Sat, 14 Aug 2021 05:20:38 +0200 Subject: [PATCH 42/43] Introduce changes from dev --- Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx | 8 ++++++-- Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx | 2 -- Analysis/Tasks/PWGHF/qaPidRejection.cxx | 2 +- Analysis/Tasks/PWGHF/taskJpsi.cxx | 10 ++++++---- Analysis/Tasks/PWGHF/taskX.cxx | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx index ac82087116245..e2535948a66fb 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx @@ -215,6 +215,8 @@ struct HfJpsiCandidateSelector { } } + PROCESS_SWITCH(HfJpsiCandidateSelector, processAlice2, "Use ALICE 2 detector setup", true); + void processAlice3(aod::HfCandProng2 const& candidates, TracksPID const&, aod::RICHs const&, aod::MIDs const&) { TrackSelectorPID selectorElectron(kElectron); @@ -314,6 +316,8 @@ struct HfJpsiCandidateSelector { //hfSelJpsiCandidate(selectedEE, selectedMuMu); } } + + PROCESS_SWITCH(HfJpsiCandidateSelector, processAlice3, "Use ALICE 3 detector setup", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) @@ -322,9 +326,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) const bool isAlice3 = cfgc.options().get("isAlice3"); if (isAlice3) { workflow.push_back(adaptAnalysisTask(cfgc)); - workflow.push_back(adaptAnalysisTask(cfgc, Processes{&HfJpsiCandidateSelector::processAlice3})); + workflow.push_back(adaptAnalysisTask(cfgc)); } else { - workflow.push_back(adaptAnalysisTask(cfgc, Processes{&HfJpsiCandidateSelector::processAlice2})); + workflow.push_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{{{"processAlice2", false}, {"processAlice3", true}}})); } return workflow; } diff --git a/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx b/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx index 573c6c02b0924..46481073e7ea4 100644 --- a/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx +++ b/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx @@ -77,7 +77,6 @@ using MyTracks = soa::Join rowSelectedCollision; Configurable fillHistograms{"fillHistograms", true, "fill histograms"}; @@ -144,7 +143,6 @@ struct HfTagSelCollisions { /// Track selection struct HfTagSelTracks { - Produces rowSelectedTrack; Configurable fillHistograms{"fillHistograms", true, "fill histograms"}; diff --git a/Analysis/Tasks/PWGHF/qaPidRejection.cxx b/Analysis/Tasks/PWGHF/qaPidRejection.cxx index 42652d8a2d888..7a25b5f83ecdc 100644 --- a/Analysis/Tasks/PWGHF/qaPidRejection.cxx +++ b/Analysis/Tasks/PWGHF/qaPidRejection.cxx @@ -182,7 +182,7 @@ struct QaTrackingRejection { bool isRICHhpProton = !(selectorProton.getStatusTrackPIDRICH(track) == TrackSelectorPID::Status::PIDRejected); bool isMIDhpMuon = (selectorMuon.getStatusTrackPIDMID(track) == TrackSelectorPID::Status::PIDAccepted); - if (MC::isPhysicalPrimary(mcParticles, mcParticle)) { + if (MC::isPhysicalPrimary(mcParticle)) { histos.fill(HIST("tracking/pteta"), track.pt(), track.eta()); if (isTOFhpElectron) { histos.fill(HIST("trackingTOFselElectron/pteta"), track.pt(), track.eta()); diff --git a/Analysis/Tasks/PWGHF/taskJpsi.cxx b/Analysis/Tasks/PWGHF/taskJpsi.cxx index d6735abc3da26..7b1a8070f0592 100644 --- a/Analysis/Tasks/PWGHF/taskJpsi.cxx +++ b/Analysis/Tasks/PWGHF/taskJpsi.cxx @@ -168,8 +168,10 @@ struct TaskJpsiMC { Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEETopol >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMuTopol >= d_selectionFlagJpsi); + using McParticlesHf = soa::Join; + void process(soa::Filtered> const& candidates, - soa::Join const& particlesMC, aod::BigTracksMC const& tracks) + McParticlesHf const& particlesMC, aod::BigTracksMC const& tracks) { // MC rec. //Printf("MC Candidates: %d", candidates.size()); @@ -197,7 +199,7 @@ struct TaskJpsiMC { } if (candidate.flagMCMatchRec() == 1 << decayMode) { //Get the corresponding MC particle. - auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as().mcParticle_as>(), 443, true); + auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as().mcParticle_as(), pdg::Code::kJpsi, true); auto particleMother = particlesMC.iteratorAt(indexMother); registry.fill(HIST("hPtGenSig"), particleMother.pt()); // gen. level pT registry.fill(HIST("hPtRecSig"), candidate.pt()); // rec. level pT @@ -247,8 +249,8 @@ struct TaskJpsiMC { registry.fill(HIST("hPtGen"), particle.pt()); registry.fill(HIST("hEtaGen"), particle.eta()); registry.fill(HIST("hYGen"), RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode())), particle.pt()); - registry.fill(HIST("hPtGenProng0"), particlesMC.iteratorAt(particle.daughter0()).pt(), particle.pt()); - registry.fill(HIST("hPtGenProng1"), particlesMC.iteratorAt(particle.daughter1()).pt(), 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/Analysis/Tasks/PWGHF/taskX.cxx b/Analysis/Tasks/PWGHF/taskX.cxx index 94b67eef54d50..7280ed78e0d58 100644 --- a/Analysis/Tasks/PWGHF/taskX.cxx +++ b/Analysis/Tasks/PWGHF/taskX.cxx @@ -213,7 +213,7 @@ struct TaskXMC { // properties of gen matched X(3872), to get a first look at some cuts float ptProngs[3]; int counter = 0; - for (int iD = particle.daughter0(); iD <= particle.daughter1(); ++iD) { + for (int iD = particle.daughter0Id(); iD <= particle.daughter1Id(); ++iD) { ptProngs[counter] = particlesMC.iteratorAt(iD).pt(); counter++; } From f7c16d711a1e9745a214f2a96db4cdda64a4d666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Sat, 14 Aug 2021 16:13:51 +0200 Subject: [PATCH 43/43] Fix process selection --- Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx index e2535948a66fb..2d4ae314256c2 100644 --- a/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx +++ b/Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx @@ -326,9 +326,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) const bool isAlice3 = cfgc.options().get("isAlice3"); if (isAlice3) { workflow.push_back(adaptAnalysisTask(cfgc)); - workflow.push_back(adaptAnalysisTask(cfgc)); - } else { workflow.push_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{{{"processAlice2", false}, {"processAlice3", true}}})); + } else { + workflow.push_back(adaptAnalysisTask(cfgc)); } return workflow; }