diff --git a/PWGUD/Core/SGTrackSelector.h b/PWGUD/Core/SGTrackSelector.h new file mode 100644 index 00000000000..84b31f2dd9d --- /dev/null +++ b/PWGUD/Core/SGTrackSelector.h @@ -0,0 +1,97 @@ +// 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. +// +// 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. +// +// \Single Gap Event Analyzer +// \author Sasha Bylinkin, alexander.bylinkin@gmail.com +// \since April 2023 + +#ifndef PWGUD_CORE_SGTRACKSELECTOR_H_ +#define PWGUD_CORE_SGTRACKSELECTOR_H_ + +#include +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "iostream" +#include "PWGUD/DataModel/UDTables.h" +#include "PWGUD/Core/SGSelector.h" +//#include "Common/DataModel/PIDResponse.h" +//#include "PWGUD/Core/RLhelper.h" +#include +#include "TLorentzVector.h" +using namespace std; +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +#define mpion 0.1396 +#define mkaon 0.4937 +#define mproton 0.9383 +template +int trackselector(const T& track, const std::vector& params) +{ + // Ensure the params vector contains all the necessary parameters + if (params.size() < 7) { + throw std::runtime_error("Insufficient parameters provided"); + } + TLorentzVector a; + a.SetXYZM(track.px(), track.py(), track.pz(), mpion); + if (params[0] == 1 && !track.isPVContributor()) + return 0; + if (std::abs(track.dcaZ()) > params[1]) + return 0; + if (!params[2]) { + if (std::abs(track.dcaXY()) > .0105 + .035 / pow(a.Pt(), 1.1)) + return 0; + } else { + if (std::abs(track.dcaXY()) > params[2]) + return 0; + } + if (track.tpcChi2NCl() > params[3]) + return 0; + if (track.tpcNClsFindable() < params[4]) + return 0; + if (track.itsChi2NCl() > params[5]) + return 0; + if (std::abs(a.Eta()) > params[6]) + return 0; + return 1; +} +template +int trackpid(const T& track, bool use_tof) +{ + int pid = 0; + float pi, ka, pr; + float tpi, tka, tpr; + pi = std::abs(track.tpcNSigmaPi()); + ka = std::abs(track.tpcNSigmaKa()); + pr = std::abs(track.tpcNSigmaPr()); + if (pi < 1. && pi < ka && pi < pr) + pid = 1; + else if (ka < 1. && ka < pi && ka < pr) + pid = 2; + else if (pr < 1. && pr < pi && pr < ka) + pid = 3; + if (use_tof && track.tofChi2() > -1) { + tpi = std::abs(track.tofNSigmaPi()); + tka = std::abs(track.tofNSigmaKa()); + tpr = std::abs(track.tofNSigmaPr()); + if (std::sqrt(pi * pi + tpi * tpi) < 2 && std::sqrt(pi * pi + tpi * tpi) < std::sqrt(ka * ka + tka * tka) && std::sqrt(pi * pi + tpi * tpi) < std::sqrt(pr * pr + tpr * tpr)) + pid = 1; + else if (std::sqrt(ka * ka + tka * tka) < 2 && std::sqrt(pi * pi + tpi * tpi) > std::sqrt(ka * ka + tka * tka) && std::sqrt(ka * ka + tka * tka) < std::sqrt(pr * pr + tpr * tpr)) + pid = 2; + else if (std::sqrt(pr * pr + tpr * tpr) < 2 && std::sqrt(pr * pr + tpr * tpr) < std::sqrt(ka * ka + tka * tka) && std::sqrt(pi * pi + tpi * tpi) > std::sqrt(pr * pr + tpr * tpr)) + pid = 3; + } + return pid; +} + +#endif // PWGUD_CORE_SGTRACKSELECTOR_H_ diff --git a/PWGUD/Tasks/sgD0Analyzer.cxx b/PWGUD/Tasks/sgD0Analyzer.cxx index fa1780558c7..1890263f50b 100644 --- a/PWGUD/Tasks/sgD0Analyzer.cxx +++ b/PWGUD/Tasks/sgD0Analyzer.cxx @@ -20,7 +20,7 @@ #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/SGSelector.h" #include "Common/DataModel/PIDResponse.h" -#include "PWGUD/Tasks/SGTrackSelector.h" +#include "PWGUD/Core/SGTrackSelector.h" #include #include "TLorentzVector.h" using namespace std; @@ -82,7 +82,20 @@ struct SGD0Analyzer { {"ss_KPi_invm_2", "K#pi Mass (GeV/c^2); Entries", {HistType::kTH1F, {{5000, 0, 10}}}}, {"os_Ntr_KPi_invm_0", "N tracks vs K#pi Mass", {HistType::kTH2F, {{48, 1.5, 49.5}, {750, .7, 2.2}}}}, {"os_Ntr_KPi_invm_1", "N tracks vs K#pi Mass", {HistType::kTH2F, {{48, 1.5, 49.5}, {750, .7, 2.2}}}}, - {"os_Ntr_KPi_invm_2", "N tracks vs K#pi Mass", {HistType::kTH2F, {{48, 1.5, 49.5}, {750, .7, 2.2}}}}}}; + {"os_Ntr_KPi_invm_2", "N tracks vs K#pi Mass", {HistType::kTH2F, {{48, 1.5, 49.5}, {750, .7, 2.2}}}}, + {"D0_FT0A", "FIT Amplitude", {HistType::kTH1F, {{500, 0, 1000}}}}, + {"D0_FT0C", "FIT Amplitude", {HistType::kTH1F, {{500, 0, 1000}}}}, + {"D0_FV0A", "FIT Amplitude", {HistType::kTH1F, {{500, 0, 1000}}}}, + {"D0_FDDA", "FIT Amplitude", {HistType::kTH1F, {{500, 0, 1000}}}}, + {"D0_FDDC", "FIT Amplitude", {HistType::kTH1F, {{500, 0, 1000}}}}, + {"D0_ZNA", "ZDC Energy", {HistType::kTH1F, {{500, 0, 200}}}}, + {"D0_ZNC", "ZDC Energy", {HistType::kTH1F, {{500, 0, 200}}}}, + {"D0_Ntr_0", "Tracks", {HistType::kTH1F, {{100, 0.5, 100.5}}}}, + {"D0_Ntr_1", "Tracks", {HistType::kTH1F, {{100, 0.5, 100.5}}}}, + {"D0_Ntr_2", "Tracks", {HistType::kTH1F, {{100, 0.5, 100.5}}}}, + {"D0_NtrPV_0", "Tracks", {HistType::kTH1F, {{50, 0.5, 50.5}}}}, + {"D0_NtrPV_1", "Tracks", {HistType::kTH1F, {{50, 0.5, 50.5}}}}, + {"D0_NtrPV_2", "Tracks", {HistType::kTH1F, {{50, 0.5, 50.5}}}}}}; using udtracks = soa::Join; using udtracksfull = soa::Join; using UDCollisionsFull = soa::Join; // @@ -107,6 +120,11 @@ struct SGD0Analyzer { registry.fill(HIST("GapSide"), gapSide); registry.fill(HIST("TrueGapSide"), truegapSide); gapSide = truegapSide; + int pvtracks = 0; + for (auto& t0 : tracks) { + if (trackselector(t0, parameters) && t0.isPVContributor()) + pvtracks++; + } // Look for D0 and D0bar if (tracks.size() < Ntr_min || tracks.size() > Ntr_max) return; @@ -129,18 +147,37 @@ struct SGD0Analyzer { registry.fill(HIST("os_KPi_eTa_0"), v01.Eta()); registry.fill(HIST("os_KPi_invm_0"), v01.M()); registry.fill(HIST("os_Ntr_KPi_invm_0"), tracks.size(), v01.M()); + if (v01.M() > 1.8 && v01.M() < 1.9) { + registry.fill(HIST("D0_Ntr_0"), tracks.size()); + registry.fill(HIST("D0_NtrPV_0"), pvtracks); + } } if (gapSide == 1) { registry.fill(HIST("os_KPi_pT_1"), v01.Pt()); registry.fill(HIST("os_KPi_eTa_1"), v01.Eta()); registry.fill(HIST("os_KPi_invm_1"), v01.M()); registry.fill(HIST("os_Ntr_KPi_invm_1"), tracks.size(), v01.M()); + if (v01.M() > 1.8 && v01.M() < 1.9) { + registry.fill(HIST("D0_Ntr_1"), tracks.size()); + registry.fill(HIST("D0_NtrPV_1"), pvtracks); + } } if (gapSide == 2) { registry.fill(HIST("os_KPi_pT_2"), v01.Pt()); registry.fill(HIST("os_KPi_eTa_2"), v01.Eta()); registry.fill(HIST("os_KPi_invm_2"), v01.M()); registry.fill(HIST("os_Ntr_KPi_invm_2"), tracks.size(), v01.M()); + if (v01.M() > 1.8 && v01.M() < 1.9) { + registry.fill(HIST("D0_Ntr_2"), tracks.size()); + registry.fill(HIST("D0_NtrPV_2"), pvtracks); + registry.fill(HIST("D0_FT0A"), collision.totalFT0AmplitudeA()); + registry.fill(HIST("D0_FT0C"), collision.totalFT0AmplitudeC()); + registry.fill(HIST("D0_FV0A"), collision.totalFV0AmplitudeA()); + registry.fill(HIST("D0_FDDA"), collision.totalFDDAmplitudeA()); + registry.fill(HIST("D0_FDDC"), collision.totalFDDAmplitudeC()); + registry.fill(HIST("D0_ZNA"), collision.energyCommonZNA()); + registry.fill(HIST("D0_ZNC"), collision.energyCommonZNC()); + } } } else if (t0.sign() == t1.sign()) { registry.fill(HIST("ss_KPi_pT"), v01.Pt()); @@ -177,18 +214,37 @@ struct SGD0Analyzer { registry.fill(HIST("os_KPi_eTa_0"), v01.Eta()); registry.fill(HIST("os_KPi_invm_0"), v01.M()); registry.fill(HIST("os_Ntr_KPi_invm_0"), tracks.size(), v01.M()); + if (v01.M() > 1.8 && v01.M() < 1.9) { + registry.fill(HIST("D0_Ntr_0"), tracks.size()); + registry.fill(HIST("D0_NtrPV_0"), pvtracks); + } } if (gapSide == 1) { registry.fill(HIST("os_KPi_pT_1"), v01.Pt()); registry.fill(HIST("os_KPi_eTa_1"), v01.Eta()); registry.fill(HIST("os_KPi_invm_1"), v01.M()); registry.fill(HIST("os_Ntr_KPi_invm_1"), tracks.size(), v01.M()); + if (v01.M() > 1.8 && v01.M() < 1.9) { + registry.fill(HIST("D0_Ntr_1"), tracks.size()); + registry.fill(HIST("D0_NtrPV_1"), pvtracks); + } } if (gapSide == 2) { registry.fill(HIST("os_KPi_pT_2"), v01.Pt()); registry.fill(HIST("os_KPi_eTa_2"), v01.Eta()); registry.fill(HIST("os_KPi_invm_2"), v01.M()); registry.fill(HIST("os_Ntr_KPi_invm_2"), tracks.size(), v01.M()); + if (v01.M() > 1.8 && v01.M() < 1.9) { + registry.fill(HIST("D0_Ntr_2"), tracks.size()); + registry.fill(HIST("D0_NtrPV_2"), pvtracks); + registry.fill(HIST("D0_FT0A"), collision.totalFT0AmplitudeA()); + registry.fill(HIST("D0_FT0C"), collision.totalFT0AmplitudeC()); + registry.fill(HIST("D0_FV0A"), collision.totalFV0AmplitudeA()); + registry.fill(HIST("D0_FDDA"), collision.totalFDDAmplitudeA()); + registry.fill(HIST("D0_FDDC"), collision.totalFDDAmplitudeC()); + registry.fill(HIST("D0_ZNA"), collision.energyCommonZNA()); + registry.fill(HIST("D0_ZNC"), collision.energyCommonZNC()); + } } } else if (t0.sign() == t1.sign()) { registry.fill(HIST("ss_KPi_pT"), v01.Pt()); diff --git a/PWGUD/Tasks/sgFITAnalyzer.cxx b/PWGUD/Tasks/sgFITAnalyzer.cxx index bc4ae0f7cb5..19c01d136de 100644 --- a/PWGUD/Tasks/sgFITAnalyzer.cxx +++ b/PWGUD/Tasks/sgFITAnalyzer.cxx @@ -21,7 +21,7 @@ #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/UDHelpers.h" #include "PWGUD/Core/SGSelector.h" -#include "PWGUD/Tasks/SGTrackSelector.h" +#include "PWGUD/Core/SGTrackSelector.h" #define mpion 0.1396 #define mmuon 0.1057 #define mkaon 0.4937 diff --git a/PWGUD/Tasks/sgFourPiAnalyzer.cxx b/PWGUD/Tasks/sgFourPiAnalyzer.cxx index f9f62f990c5..4275976824b 100644 --- a/PWGUD/Tasks/sgFourPiAnalyzer.cxx +++ b/PWGUD/Tasks/sgFourPiAnalyzer.cxx @@ -19,7 +19,7 @@ #include "iostream" #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/SGSelector.h" -#include "PWGUD/Tasks/SGTrackSelector.h" +#include "PWGUD/Core/SGTrackSelector.h" #include "Common/DataModel/PIDResponse.h" #include "Framework/ASoA.h" #include "Framework/DataTypes.h" diff --git a/PWGUD/Tasks/sgSpectraAnalyzer.cxx b/PWGUD/Tasks/sgSpectraAnalyzer.cxx index 448086c5500..7be510e4e61 100644 --- a/PWGUD/Tasks/sgSpectraAnalyzer.cxx +++ b/PWGUD/Tasks/sgSpectraAnalyzer.cxx @@ -19,7 +19,7 @@ #include "iostream" #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/SGSelector.h" -#include "PWGUD/Tasks/SGTrackSelector.h" +#include "PWGUD/Core/SGTrackSelector.h" //#include "Common/DataModel/PIDResponse.h" //#include "PWGUD/Core/RLhelper.h" #include @@ -40,7 +40,6 @@ struct SGSpectraAnalyzer { Configurable FDDA_cut{"FDDA", 10000., "FDDA threshold"}; Configurable FDDC_cut{"FDDC", 10000., "FDDC threshold"}; Configurable ZDC_cut{"ZDC", 10., "ZDC threshold"}; - Configurable eta_cut{"Eta", 0.9, "Eta cut"}; Configurable use_tof{"Use_TOF", true, "TOF PID"}; // Track Selections Configurable PV_cut{"PV_cut", 1.0, "Use Only PV tracks"}; @@ -49,6 +48,7 @@ struct SGSpectraAnalyzer { Configurable tpcChi2_cut{"tpcChi2_cut", 4, "Max tpcChi2NCl"}; Configurable tpcNClsFindable_cut{"tpcNClsFindable_cut", 70, "Min tpcNClsFindable"}; Configurable itsChi2_cut{"itsChi2_cut", 36, "Max itsChi2NCl"}; + Configurable eta_cut{"Eta", 0.9, "Eta cut"}; HistogramRegistry registry{ "registry", {// Pion histograms for each eta bin and gapSide @@ -199,7 +199,7 @@ struct SGSpectraAnalyzer { sum.SetXYZM(0, 0, 0, 0); int gapSide = collision.gapSide(); float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; - std::vector parameters = {PV_cut, dcaZ_cut, dcaXY_cut, tpcChi2_cut, tpcNClsFindable_cut, itsChi2_cut}; + std::vector parameters = {PV_cut, dcaZ_cut, dcaXY_cut, tpcChi2_cut, tpcNClsFindable_cut, itsChi2_cut, eta_cut}; int truegapSide = sgSelector.trueGap(collision, FIT_cut[0], FIT_cut[1], FIT_cut[3], ZDC_cut); gapSide = truegapSide; if (gapSide < 0 || gapSide > 2) diff --git a/PWGUD/Tasks/sgTwoPiAnalyzer.cxx b/PWGUD/Tasks/sgTwoPiAnalyzer.cxx index 182dbbec8d0..dbaaa4227d6 100644 --- a/PWGUD/Tasks/sgTwoPiAnalyzer.cxx +++ b/PWGUD/Tasks/sgTwoPiAnalyzer.cxx @@ -19,7 +19,7 @@ #include "iostream" #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/SGSelector.h" -#include "PWGUD/Tasks/SGTrackSelector.h" +#include "PWGUD/Core/SGTrackSelector.h" #include "Common/DataModel/PIDResponse.h" #include "Framework/ASoA.h" #include "Framework/DataTypes.h"