diff --git a/ALICE3/TableProducer/alice3-pidTOF.cxx b/ALICE3/TableProducer/alice3-pidTOF.cxx index 2098986d054..7e4fbc9178d 100644 --- a/ALICE3/TableProducer/alice3-pidTOF.cxx +++ b/ALICE3/TableProducer/alice3-pidTOF.cxx @@ -11,7 +11,7 @@ /// /// \file alice3-pidTOF.cxx -/// \author Nicolo' Jacazio +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch /// \brief Task to produce PID tables for TOF split for each particle. /// Only the tables for the mass hypotheses requested are filled, the others are sent empty. /// @@ -245,13 +245,13 @@ struct ALICE3pidTOFTaskQA { }); } - template - void fillParticleHistos(const T& t, const float& tof, const float& exp_diff, const float& expsigma, const float& nsigma) + template + void fillParticleHistos(const T& t, const float& tof, const float& exp_diff, const float& expsigma) { histos.fill(HIST(hexpected[i]), t.p(), tof - exp_diff); histos.fill(HIST(hexpected_diff[i]), t.p(), exp_diff); histos.fill(HIST(hexpsigma[i]), t.p(), expsigma); - histos.fill(HIST(hnsigma[i]), t.p(), nsigma); + histos.fill(HIST(hnsigma[i]), t.p(), o2::aod::pidutils::tofNSigma(i, t)); } void process(aod::Collision const& collision, @@ -302,15 +302,15 @@ struct ALICE3pidTOFTaskQA { histos.fill(HIST("event/pt"), t.pt()); histos.fill(HIST("event/ptreso"), t.p(), t.sigma1Pt() * t.pt() * t.pt()); // - fillParticleHistos<0>(t, tof, t.tofExpSignalDiffEl(), t.tofExpSigmaEl(), t.tofNSigmaEl()); - fillParticleHistos<1>(t, tof, t.tofExpSignalDiffMu(), t.tofExpSigmaMu(), t.tofNSigmaMu()); - fillParticleHistos<2>(t, tof, t.tofExpSignalDiffPi(), t.tofExpSigmaPi(), t.tofNSigmaPi()); - fillParticleHistos<3>(t, tof, t.tofExpSignalDiffKa(), t.tofExpSigmaKa(), t.tofNSigmaKa()); - fillParticleHistos<4>(t, tof, t.tofExpSignalDiffPr(), t.tofExpSigmaPr(), t.tofNSigmaPr()); - fillParticleHistos<5>(t, tof, t.tofExpSignalDiffDe(), t.tofExpSigmaDe(), t.tofNSigmaDe()); - fillParticleHistos<6>(t, tof, t.tofExpSignalDiffTr(), t.tofExpSigmaTr(), t.tofNSigmaTr()); - fillParticleHistos<7>(t, tof, t.tofExpSignalDiffHe(), t.tofExpSigmaHe(), t.tofNSigmaHe()); - fillParticleHistos<8>(t, tof, t.tofExpSignalDiffAl(), t.tofExpSigmaAl(), t.tofNSigmaAl()); + fillParticleHistos(t, tof, t.tofExpSignalDiffEl(), t.tofExpSigmaEl()); + fillParticleHistos(t, tof, t.tofExpSignalDiffMu(), t.tofExpSigmaMu()); + fillParticleHistos(t, tof, t.tofExpSignalDiffPi(), t.tofExpSigmaPi()); + fillParticleHistos(t, tof, t.tofExpSignalDiffKa(), t.tofExpSigmaKa()); + fillParticleHistos(t, tof, t.tofExpSignalDiffPr(), t.tofExpSigmaPr()); + fillParticleHistos(t, tof, t.tofExpSignalDiffDe(), t.tofExpSigmaDe()); + fillParticleHistos(t, tof, t.tofExpSignalDiffTr(), t.tofExpSigmaTr()); + fillParticleHistos(t, tof, t.tofExpSignalDiffHe(), t.tofExpSigmaHe()); + fillParticleHistos(t, tof, t.tofExpSignalDiffAl(), t.tofExpSigmaAl()); } } }; diff --git a/Common/Core/PID/PIDResponse.h b/Common/Core/PID/PIDResponse.h index 76137996720..c38e76a908d 100644 --- a/Common/Core/PID/PIDResponse.h +++ b/Common/Core/PID/PIDResponse.h @@ -11,14 +11,16 @@ /// /// \file PIDResponse.h -/// \author Nicolo' Jacazio -/// \brief Set of tables, tasks and utilities to provide the interface between -/// the analysis data model and the PID response +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch +/// \brief Set of tables, tasks and utilities to provide the interface between +/// the analysis data model and the PID response /// #ifndef O2_FRAMEWORK_PIDRESPONSE_H_ #define O2_FRAMEWORK_PIDRESPONSE_H_ +#include + // O2 includes #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" @@ -42,6 +44,173 @@ void packInTable(const float& separation, tableType& table, const float& lowest, table(static_cast(separation / width - 0.5f)); } } + +static constexpr float defaultNSigma = -999.f; /// Default return value in case N sigma measurement is not available + +template +using hasTOFEl = decltype(std::declval().tofNSigmaEl()); +template +using hasTOFMu = decltype(std::declval().tofNSigmaMu()); +template +using hasTOFPi = decltype(std::declval().tofNSigmaPi()); +template +using hasTOFKa = decltype(std::declval().tofNSigmaKa()); +template +using hasTOFPr = decltype(std::declval().tofNSigmaPr()); +template +using hasTOFDe = decltype(std::declval().tofNSigmaDe()); +template +using hasTOFTr = decltype(std::declval().tofNSigmaTr()); +template +using hasTOFHe = decltype(std::declval().tofNSigmaHe()); +template +using hasTOFAl = decltype(std::declval().tofNSigmaAl()); + +template +const auto tofNSigma(const o2::track::PID::ID& index, const TrackType& track) +{ + switch (index) { + case o2::track::PID::Electron: + if constexpr (std::experimental::is_detected::value) { + return track.tofNSigmaEl(); + } else { + return defaultNSigma; + } + case o2::track::PID::Muon: + if constexpr (std::experimental::is_detected::value) { + return track.tofNSigmaMu(); + } else { + return defaultNSigma; + } + case o2::track::PID::Pion: + if constexpr (std::experimental::is_detected::value) { + return track.tofNSigmaPi(); + } else { + return defaultNSigma; + } + case o2::track::PID::Kaon: + if constexpr (std::experimental::is_detected::value) { + return track.tofNSigmaKa(); + } else { + return defaultNSigma; + } + case o2::track::PID::Proton: + if constexpr (std::experimental::is_detected::value) { + return track.tofNSigmaPr(); + } else { + return defaultNSigma; + } + case o2::track::PID::Deuteron: + if constexpr (std::experimental::is_detected::value) { + return track.tofNSigmaDe(); + } else { + return defaultNSigma; + } + case o2::track::PID::Triton: + if constexpr (std::experimental::is_detected::value) { + return track.tofNSigmaTr(); + } else { + return defaultNSigma; + } + case o2::track::PID::Helium3: + if constexpr (std::experimental::is_detected::value) { + return track.tofNSigmaHe(); + } else { + return defaultNSigma; + } + case o2::track::PID::Alpha: + if constexpr (std::experimental::is_detected::value) { + return track.tofNSigmaAl(); + } else { + return defaultNSigma; + } + default: + return defaultNSigma; + } +} + +template +using hasTPCEl = decltype(std::declval().tpcNSigmaEl()); +template +using hasTPCMu = decltype(std::declval().tpcNSigmaMu()); +template +using hasTPCPi = decltype(std::declval().tpcNSigmaPi()); +template +using hasTPCKa = decltype(std::declval().tpcNSigmaKa()); +template +using hasTPCPr = decltype(std::declval().tpcNSigmaPr()); +template +using hasTPCDe = decltype(std::declval().tpcNSigmaDe()); +template +using hasTPCTr = decltype(std::declval().tpcNSigmaTr()); +template +using hasTPCHe = decltype(std::declval().tpcNSigmaHe()); +template +using hasTPCAl = decltype(std::declval().tpcNSigmaAl()); + +template +const auto tpcNSigma(const o2::track::PID::ID& index, const TrackType& track) +{ + switch (index) { + case o2::track::PID::Electron: + if constexpr (std::experimental::is_detected::value) { + return track.tpcNSigmaEl(); + } else { + return defaultNSigma; + } + case o2::track::PID::Muon: + if constexpr (std::experimental::is_detected::value) { + return track.tpcNSigmaMu(); + } else { + return defaultNSigma; + } + case o2::track::PID::Pion: + if constexpr (std::experimental::is_detected::value) { + return track.tpcNSigmaPi(); + } else { + return defaultNSigma; + } + case o2::track::PID::Kaon: + if constexpr (std::experimental::is_detected::value) { + return track.tpcNSigmaKa(); + } else { + return defaultNSigma; + } + case o2::track::PID::Proton: + if constexpr (std::experimental::is_detected::value) { + return track.tpcNSigmaPr(); + } else { + return defaultNSigma; + } + case o2::track::PID::Deuteron: + if constexpr (std::experimental::is_detected::value) { + return track.tpcNSigmaDe(); + } else { + return defaultNSigma; + } + case o2::track::PID::Triton: + if constexpr (std::experimental::is_detected::value) { + return track.tpcNSigmaTr(); + } else { + return defaultNSigma; + } + case o2::track::PID::Helium3: + if constexpr (std::experimental::is_detected::value) { + return track.tpcNSigmaHe(); + } else { + return defaultNSigma; + } + case o2::track::PID::Alpha: + if constexpr (std::experimental::is_detected::value) { + return track.tpcNSigmaAl(); + } else { + return defaultNSigma; + } + default: + return defaultNSigma; + } +} + } // namespace pidutils namespace pidtofsignal @@ -122,34 +291,6 @@ DECLARE_SOA_COLUMN(TOFNSigmaDe, tofNSigmaDe, float); //! Nsigma separation with DECLARE_SOA_COLUMN(TOFNSigmaTr, tofNSigmaTr, float); //! Nsigma separation with the TOF detector for triton DECLARE_SOA_COLUMN(TOFNSigmaHe, tofNSigmaHe, float); //! Nsigma separation with the TOF detector for helium3 DECLARE_SOA_COLUMN(TOFNSigmaAl, tofNSigmaAl, float); //! Nsigma separation with the TOF detector for alpha -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigma, tofNSigma, //! Nsigma separation with the TOF detector for the combined species - [](const float& El, const float& Mu, const float& Pi, - const float& Ka, const float& Pr, const float& De, - const float& Tr, const float& He, const float& Al, - const o2::track::PID::ID& index) -> float { - switch (index) { - case o2::track::PID::Electron: - return El; - case o2::track::PID::Muon: - return Mu; - case o2::track::PID::Pion: - return Pi; - case o2::track::PID::Kaon: - return Ka; - case o2::track::PID::Proton: - return Pr; - case o2::track::PID::Deuteron: - return De; - case o2::track::PID::Triton: - return Tr; - case o2::track::PID::Helium3: - return He; - case o2::track::PID::Alpha: - return Al; - default: - return -999.f; - } - }); } // namespace pidtof // Macro to convert the stored Nsigmas to floats @@ -186,34 +327,6 @@ DEFINE_UNWRAP_NSIGMA_COLUMN(TOFNSigmaDe, tofNSigmaDe); //! Unwrapped (float) nsi DEFINE_UNWRAP_NSIGMA_COLUMN(TOFNSigmaTr, tofNSigmaTr); //! Unwrapped (float) nsigma with the TOF detector for triton DEFINE_UNWRAP_NSIGMA_COLUMN(TOFNSigmaHe, tofNSigmaHe); //! Unwrapped (float) nsigma with the TOF detector for helium3 DEFINE_UNWRAP_NSIGMA_COLUMN(TOFNSigmaAl, tofNSigmaAl); //! Unwrapped (float) nsigma with the TOF detector for alpha -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigma, tofNSigma, //! Nsigma separation with the TOF detector for the combined species - [](const float& El, const float& Mu, const float& Pi, - const float& Ka, const float& Pr, const float& De, - const float& Tr, const float& He, const float& Al, - const o2::track::PID::ID& index) -> float { - switch (index) { - case o2::track::PID::Electron: - return bin_width * static_cast(El); - case o2::track::PID::Muon: - return bin_width * static_cast(Mu); - case o2::track::PID::Pion: - return bin_width * static_cast(Pi); - case o2::track::PID::Kaon: - return bin_width * static_cast(Ka); - case o2::track::PID::Proton: - return bin_width * static_cast(Pr); - case o2::track::PID::Deuteron: - return bin_width * static_cast(De); - case o2::track::PID::Triton: - return bin_width * static_cast(Tr); - case o2::track::PID::Helium3: - return bin_width * static_cast(He); - case o2::track::PID::Alpha: - return bin_width * static_cast(Al); - default: - return -999.f; - } - }); } // namespace pidtof_tiny @@ -263,10 +376,7 @@ DECLARE_SOA_TABLE(pidTOFFullAl, "AOD", "pidTOFFullAl", //! Table of the TOF (ful pidtof::TOFExpSignalDiffAl, pidtof::TOFExpSignalAl, pidtof::TOFExpSigmaAl, pidtof::TOFNSigmaAl); -DECLARE_SOA_TABLE(pidTOFFull, "AOD", "pidTOFFull", //! Table of the TOF NSigmas with full tables - pidtof::TOFNSigma); + // Tiny size tables DECLARE_SOA_TABLE(pidTOFEl, "AOD", "pidTOFEl", //! Table of the TOF response with binned Nsigma for electron pidtof_tiny::TOFNSigmaStoreEl, pidtof_tiny::TOFNSigmaEl); @@ -286,10 +396,7 @@ DECLARE_SOA_TABLE(pidTOFHe, "AOD", "pidTOFHe", //! Table of the TOF response wit pidtof_tiny::TOFNSigmaStoreHe, pidtof_tiny::TOFNSigmaHe); DECLARE_SOA_TABLE(pidTOFAl, "AOD", "pidTOFAl", //! Table of the TOF response with binned Nsigma for alpha pidtof_tiny::TOFNSigmaStoreAl, pidtof_tiny::TOFNSigmaAl); -DECLARE_SOA_TABLE(pidTOF, "AOD", "pidTOF", //! Table of the TOF NSigmas with binned Nsigma - pidtof_tiny::TOFNSigma); + namespace pidtpc { // Expected signals @@ -331,34 +438,6 @@ DECLARE_SOA_COLUMN(TPCNSigmaDe, tpcNSigmaDe, float); //! Nsigma separation with DECLARE_SOA_COLUMN(TPCNSigmaTr, tpcNSigmaTr, float); //! Nsigma separation with the TPC detector for triton DECLARE_SOA_COLUMN(TPCNSigmaHe, tpcNSigmaHe, float); //! Nsigma separation with the TPC detector for helium3 DECLARE_SOA_COLUMN(TPCNSigmaAl, tpcNSigmaAl, float); //! Nsigma separation with the TPC detector for alpha -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigma, tpcNSigma, //! Nsigma separation with the TPC detector for the combined species - [](const float& El, const float& Mu, const float& Pi, - const float& Ka, const float& Pr, const float& De, - const float& Tr, const float& He, const float& Al, - const o2::track::PID::ID& index) -> float { - switch (index) { - case o2::track::PID::Electron: - return El; - case o2::track::PID::Muon: - return Mu; - case o2::track::PID::Pion: - return Pi; - case o2::track::PID::Kaon: - return Ka; - case o2::track::PID::Proton: - return Pr; - case o2::track::PID::Deuteron: - return De; - case o2::track::PID::Triton: - return Tr; - case o2::track::PID::Helium3: - return He; - case o2::track::PID::Alpha: - return Al; - default: - return -999.f; - } - }); } // namespace pidtpc @@ -391,34 +470,7 @@ DEFINE_UNWRAP_NSIGMA_COLUMN(TPCNSigmaDe, tpcNSigmaDe); //! Unwrapped (float) nsi DEFINE_UNWRAP_NSIGMA_COLUMN(TPCNSigmaTr, tpcNSigmaTr); //! Unwrapped (float) nsigma with the TPC detector for triton DEFINE_UNWRAP_NSIGMA_COLUMN(TPCNSigmaHe, tpcNSigmaHe); //! Unwrapped (float) nsigma with the TPC detector for helium3 DEFINE_UNWRAP_NSIGMA_COLUMN(TPCNSigmaAl, tpcNSigmaAl); //! Unwrapped (float) nsigma with the TPC detector for alpha -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigma, tpcNSigma, //! Nsigma separation with the TPC detector for the combined species - [](const float& El, const float& Mu, const float& Pi, - const float& Ka, const float& Pr, const float& De, - const float& Tr, const float& He, const float& Al, - const o2::track::PID::ID& index) -> float { - switch (index) { - case o2::track::PID::Electron: - return bin_width * static_cast(El); - case o2::track::PID::Muon: - return bin_width * static_cast(Mu); - case o2::track::PID::Pion: - return bin_width * static_cast(Pi); - case o2::track::PID::Kaon: - return bin_width * static_cast(Ka); - case o2::track::PID::Proton: - return bin_width * static_cast(Pr); - case o2::track::PID::Deuteron: - return bin_width * static_cast(De); - case o2::track::PID::Triton: - return bin_width * static_cast(Tr); - case o2::track::PID::Helium3: - return bin_width * static_cast(He); - case o2::track::PID::Alpha: - return bin_width * static_cast(Al); - default: - return -999.f; - } - }); + } // namespace pidtpc_tiny // Per particle tables @@ -440,10 +492,6 @@ DECLARE_SOA_TABLE(pidTPCFullHe, "AOD", "pidTPCFullHe", //! Table of the TPC (ful pidtpc::TPCExpSignalDiffHe, pidtpc::TPCExpSigmaHe, pidtpc::TPCNSigmaHe); DECLARE_SOA_TABLE(pidTPCFullAl, "AOD", "pidTPCFullAl", //! Table of the TPC (full) response with expected signal, expected resolution and Nsigma for alpha pidtpc::TPCExpSignalDiffAl, pidtpc::TPCExpSigmaAl, pidtpc::TPCNSigmaAl); -DECLARE_SOA_TABLE(pidTPCFull, "AOD", "pidTPCFull", //! Table of the TPC NSigmas with full tables - pidtpc::TPCNSigma); // Tiny size tables DECLARE_SOA_TABLE(pidTPCEl, "AOD", "pidTPCEl", //! Table of the TPC response with binned Nsigma for electron @@ -464,10 +512,6 @@ DECLARE_SOA_TABLE(pidTPCHe, "AOD", "pidTPCHe", //! Table of the TPC response wit pidtpc_tiny::TPCNSigmaStoreHe, pidtpc_tiny::TPCNSigmaHe); DECLARE_SOA_TABLE(pidTPCAl, "AOD", "pidTPCAl", //! Table of the TPC response with binned Nsigma for alpha pidtpc_tiny::TPCNSigmaStoreAl, pidtpc_tiny::TPCNSigmaAl); -DECLARE_SOA_TABLE(pidTPC, "AOD", "pidTPC", //! Table of the TPC NSigmas with binned Nsigma - pidtpc_tiny::TPCNSigma); #undef DEFINE_UNWRAP_NSIGMA_COLUMN diff --git a/Common/TableProducer/PID/pidTOF.cxx b/Common/TableProducer/PID/pidTOF.cxx index f6e593dbda2..478b843f2b8 100644 --- a/Common/TableProducer/PID/pidTOF.cxx +++ b/Common/TableProducer/PID/pidTOF.cxx @@ -11,7 +11,7 @@ /// /// \file pidTOF.cxx -/// \author Nicolò Jacazio +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch /// \brief Task to produce PID tables for TOF split for each particle with only the Nsigma information. /// Only the tables for the mass hypotheses requested are filled, the others are sent empty. /// @@ -234,10 +234,10 @@ struct tofPidQa { addParticleHistos<8>(); } - template - void fillParticleHistos(const T& t, const float nsigma) + template + void fillParticleHistos(const T& t) { - histos.fill(HIST(hnsigma[i]), t.p(), nsigma); + histos.fill(HIST(hnsigma[i]), t.p(), o2::aod::pidutils::tofNSigma(i, t)); } void process(aod::Collision const& collision, soa::Join(t, t.tofNSigmaEl()); - fillParticleHistos<1>(t, t.tofNSigmaMu()); - fillParticleHistos<2>(t, t.tofNSigmaPi()); - fillParticleHistos<3>(t, t.tofNSigmaKa()); - fillParticleHistos<4>(t, t.tofNSigmaPr()); - fillParticleHistos<5>(t, t.tofNSigmaDe()); - fillParticleHistos<6>(t, t.tofNSigmaTr()); - fillParticleHistos<7>(t, t.tofNSigmaHe()); - fillParticleHistos<8>(t, t.tofNSigmaAl()); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); } } }; diff --git a/Common/TableProducer/PID/pidTOFFull.cxx b/Common/TableProducer/PID/pidTOFFull.cxx index 0a59f7368fe..339a34693c3 100644 --- a/Common/TableProducer/PID/pidTOFFull.cxx +++ b/Common/TableProducer/PID/pidTOFFull.cxx @@ -542,7 +542,7 @@ struct tofPidFullQa { } template - void fillParticleHistos(const T& t, const float& tof, const float& exp_diff, const float& expsigma, const float& nsigma) + void fillParticleHistos(const T& t, const float& tof, const float& exp_diff, const float& expsigma) { const float y = TMath::ASinH(t.pt() / TMath::Sqrt(PID::getMass2(id) + t.pt() * t.pt()) * TMath::SinH(t.eta())); if (abs(y) > 0.5) { @@ -552,6 +552,7 @@ struct tofPidFullQa { histos.fill(HIST(hexpected[id]), t.p(), tof - exp_diff); histos.fill(HIST(hexpected_diff[id]), t.p(), exp_diff); histos.fill(HIST(hexpsigma[id]), t.p(), expsigma); + const auto& nsigma = o2::aod::pidutils::tofNSigma(id, t); histos.fill(HIST(hnsigma[id]), t.p(), nsigma); histos.fill(HIST(hnsigmapt[id]), t.pt(), nsigma); } @@ -619,15 +620,15 @@ struct tofPidFullQa { histos.fill(HIST("event/pt"), t.pt()); // histos.fill(HIST("event/ptreso"), t.p(), t.sigma1Pt() * t.pt() * t.pt()); // - fillParticleHistos(t, tof, t.tofExpSignalDiffEl(), t.tofExpSigmaEl(), t.tofNSigmaEl()); - fillParticleHistos(t, tof, t.tofExpSignalDiffMu(), t.tofExpSigmaMu(), t.tofNSigmaMu()); - fillParticleHistos(t, tof, t.tofExpSignalDiffPi(), t.tofExpSigmaPi(), t.tofNSigmaPi()); - fillParticleHistos(t, tof, t.tofExpSignalDiffKa(), t.tofExpSigmaKa(), t.tofNSigmaKa()); - fillParticleHistos(t, tof, t.tofExpSignalDiffPr(), t.tofExpSigmaPr(), t.tofNSigmaPr()); - fillParticleHistos(t, tof, t.tofExpSignalDiffDe(), t.tofExpSigmaDe(), t.tofNSigmaDe()); - fillParticleHistos(t, tof, t.tofExpSignalDiffTr(), t.tofExpSigmaTr(), t.tofNSigmaTr()); - fillParticleHistos(t, tof, t.tofExpSignalDiffHe(), t.tofExpSigmaHe(), t.tofNSigmaHe()); - fillParticleHistos(t, tof, t.tofExpSignalDiffAl(), t.tofExpSigmaAl(), t.tofNSigmaAl()); + fillParticleHistos(t, tof, t.tofExpSignalDiffEl(), t.tofExpSigmaEl()); + fillParticleHistos(t, tof, t.tofExpSignalDiffMu(), t.tofExpSigmaMu()); + fillParticleHistos(t, tof, t.tofExpSignalDiffPi(), t.tofExpSigmaPi()); + fillParticleHistos(t, tof, t.tofExpSignalDiffKa(), t.tofExpSigmaKa()); + fillParticleHistos(t, tof, t.tofExpSignalDiffPr(), t.tofExpSigmaPr()); + fillParticleHistos(t, tof, t.tofExpSignalDiffDe(), t.tofExpSigmaDe()); + fillParticleHistos(t, tof, t.tofExpSignalDiffTr(), t.tofExpSigmaTr()); + fillParticleHistos(t, tof, t.tofExpSignalDiffHe(), t.tofExpSigmaHe()); + fillParticleHistos(t, tof, t.tofExpSignalDiffAl(), t.tofExpSigmaAl()); } } }; diff --git a/Common/TableProducer/PID/pidTPC.cxx b/Common/TableProducer/PID/pidTPC.cxx index d4ae79c76cd..86acd50236e 100644 --- a/Common/TableProducer/PID/pidTPC.cxx +++ b/Common/TableProducer/PID/pidTPC.cxx @@ -245,7 +245,7 @@ struct tpcPidQa { } template - void fillParticleHistos(const T& t, const float& nsigma) + void fillParticleHistos(const T& t) { if (applyRapidityCut) { const float y = TMath::ASinH(t.pt() / TMath::Sqrt(PID::getMass2(id) + t.pt() * t.pt()) * TMath::SinH(t.eta())); @@ -254,6 +254,7 @@ struct tpcPidQa { } } // Fill histograms + const auto& nsigma = o2::aod::pidutils::tpcNSigma(id, t); histos.fill(HIST(hnsigma[id]), t.p(), nsigma); histos.fill(HIST(hnsigmapt[id]), t.pt(), nsigma); if (t.sign() > 0) { @@ -309,15 +310,15 @@ struct tpcPidQa { histos.fill(HIST("event/tpcsignal"), mom, t.tpcSignal()); histos.fill(HIST("event/signedtpcsignal"), mom * t.sign(), t.tpcSignal()); // - fillParticleHistos(t, t.tpcNSigmaEl()); - fillParticleHistos(t, t.tpcNSigmaMu()); - fillParticleHistos(t, t.tpcNSigmaPi()); - fillParticleHistos(t, t.tpcNSigmaKa()); - fillParticleHistos(t, t.tpcNSigmaPr()); - fillParticleHistos(t, t.tpcNSigmaDe()); - fillParticleHistos(t, t.tpcNSigmaTr()); - fillParticleHistos(t, t.tpcNSigmaHe()); - fillParticleHistos(t, t.tpcNSigmaAl()); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); + fillParticleHistos(t); } } }; diff --git a/Common/TableProducer/PID/pidTPCFull.cxx b/Common/TableProducer/PID/pidTPCFull.cxx index e3fb24f36c7..5702bb839b7 100644 --- a/Common/TableProducer/PID/pidTPCFull.cxx +++ b/Common/TableProducer/PID/pidTPCFull.cxx @@ -11,7 +11,7 @@ /// /// \file pidTPCFull.cxx -/// \author Nicolò Jacazio +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch /// \brief Task to produce PID tables for TPC split for each particle. /// Only the tables for the mass hypotheses requested are filled, the others are sent empty. /// @@ -267,7 +267,7 @@ struct tpcPidFullQa { } template - void fillParticleHistos(const T& t, const float& mom, const float& exp_diff, const float& expsigma, const float& nsigma) + void fillParticleHistos(const T& t, const float& mom, const float& exp_diff, const float& expsigma) { if (applyRapidityCut) { const float y = TMath::ASinH(t.pt() / TMath::Sqrt(PID::getMass2(id) + t.pt() * t.pt()) * TMath::SinH(t.eta())); @@ -279,6 +279,7 @@ struct tpcPidFullQa { histos.fill(HIST(hexpected[id]), mom, t.tpcSignal() - exp_diff); histos.fill(HIST(hexpected_diff[id]), mom, exp_diff); histos.fill(HIST(hexpsigma[id]), t.p(), expsigma); + const auto& nsigma = o2::aod::pidutils::tpcNSigma(id, t); histos.fill(HIST(hnsigma[id]), t.p(), nsigma); histos.fill(HIST(hnsigmapt[id]), t.pt(), nsigma); if (t.sign() > 0) { @@ -334,15 +335,15 @@ struct tpcPidFullQa { histos.fill(HIST("event/tpcsignal"), mom, t.tpcSignal()); histos.fill(HIST("event/signedtpcsignal"), mom * t.sign(), t.tpcSignal()); // - fillParticleHistos(t, mom, t.tpcExpSignalDiffEl(), t.tpcExpSigmaEl(), t.tpcNSigmaEl()); - fillParticleHistos(t, mom, t.tpcExpSignalDiffMu(), t.tpcExpSigmaMu(), t.tpcNSigmaMu()); - fillParticleHistos(t, mom, t.tpcExpSignalDiffPi(), t.tpcExpSigmaPi(), t.tpcNSigmaPi()); - fillParticleHistos(t, mom, t.tpcExpSignalDiffKa(), t.tpcExpSigmaKa(), t.tpcNSigmaKa()); - fillParticleHistos(t, mom, t.tpcExpSignalDiffPr(), t.tpcExpSigmaPr(), t.tpcNSigmaPr()); - fillParticleHistos(t, mom, t.tpcExpSignalDiffDe(), t.tpcExpSigmaDe(), t.tpcNSigmaDe()); - fillParticleHistos(t, mom, t.tpcExpSignalDiffTr(), t.tpcExpSigmaTr(), t.tpcNSigmaTr()); - fillParticleHistos(t, mom, t.tpcExpSignalDiffHe(), t.tpcExpSigmaHe(), t.tpcNSigmaHe()); - fillParticleHistos(t, mom, t.tpcExpSignalDiffAl(), t.tpcExpSigmaAl(), t.tpcNSigmaAl()); + fillParticleHistos(t, mom, t.tpcExpSignalDiffEl(), t.tpcExpSigmaEl()); + fillParticleHistos(t, mom, t.tpcExpSignalDiffMu(), t.tpcExpSigmaMu()); + fillParticleHistos(t, mom, t.tpcExpSignalDiffPi(), t.tpcExpSigmaPi()); + fillParticleHistos(t, mom, t.tpcExpSignalDiffKa(), t.tpcExpSigmaKa()); + fillParticleHistos(t, mom, t.tpcExpSignalDiffPr(), t.tpcExpSigmaPr()); + fillParticleHistos(t, mom, t.tpcExpSignalDiffDe(), t.tpcExpSigmaDe()); + fillParticleHistos(t, mom, t.tpcExpSignalDiffTr(), t.tpcExpSigmaTr()); + fillParticleHistos(t, mom, t.tpcExpSignalDiffHe(), t.tpcExpSigmaHe()); + fillParticleHistos(t, mom, t.tpcExpSignalDiffAl(), t.tpcExpSigmaAl()); } } };