diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx index 6d2a76941dfd4..b41be93946bc3 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx @@ -7,14 +7,25 @@ // 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. +// O2 includes + +#include "ReconstructionDataFormats/Track.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" - +#include "Framework/ASoAHelpers.h" #include "AnalysisDataModel/PID/PIDResponse.h" +#include "AnalysisDataModel/TrackSelectionTables.h" + +// #include "AnalysisDataModel/EventSelection.h" +// #include "AnalysisDataModel/TrackSelectionTables.h" +// #include "AnalysisDataModel/Centrality.h" + +#include "Framework/HistogramRegistry.h" + +#include -#include -#include +#include using namespace o2; using namespace o2::framework; @@ -22,39 +33,54 @@ using namespace o2::framework::expressions; struct NucleiSpecraTask { - OutputObj hTPCsignal{TH2F("hTPCsignal", ";#it{p} (GeV/#it{c}); d#it{E} / d#it{X} (a. u.)", 600, 0., 3, 1400, 0, 1400)}; - OutputObj hMomentum{TH1F("hMomentum", ";#it{p} (GeV/#it{c});", 600, 0., 3.)}; + HistogramRegistry spectra{"spectra", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - Configurable absEtaMax{"absEtaMax", 0.8, "pseudo-rapidity edges"}; - Configurable absYmax{"absYmax", 0.5, "rapidity edges"}; - Configurable beamRapidity{"yBeam", 0., "beam rapidity"}; - Configurable chi2TPCperNDF{"chi2TPCperNDF", 4., "chi2 per NDF in TPC"}; - Configurable foundFractionTPC{"foundFractionTPC", 0., "TPC clusters / TPC crossed rows"}; - Configurable recPointsTPC{"recPointsTPC", 0, "clusters in TPC"}; - Configurable signalClustersTPC{"signalClustersTPC", 70, "clusters with PID in TPC"}; - Configurable minEnergyLoss{"minEnergyLoss", 0., "energy loss in TPC"}; - Configurable recPointsITS{"recPointsITS", 2, "number of ITS points"}; - Configurable recPointsITSInnerBarrel{"recPointsITSInnerBarrel", 1, "number of points in ITS Inner Barrel"}; + void init(o2::framework::InitContext&) + { + std::vector ptBinning = {0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4., 5.}; + std::vector centBinning = {0., 1., 5., 10., 20., 30., 40., 50., 70., 100.}; + + AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec centAxis = {centBinning, "V0M (%)"}; + + spectra.add("fTPCsignal", "Specific energy loss", HistType::kTH2F, {{600, 0., 3, "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); + + spectra.add("fTPCcounts", "n-sigma TPC", HistType::kTH2F, {ptAxis, {200, -5, 5, "n#sigma_{d} (a. u.)"}}); + } - Filter etaFilter = aod::track::eta > -1 * absEtaMax&& aod::track::eta < absEtaMax; - Filter chi2Filter = aod::track::tpcChi2NCl < chi2TPCperNDF; + Configurable yMin{"yMin", -0.5, "Maximum rapidity"}; + Configurable yMax{"yMax", 0.5, "Minimum rapidity"}; + Configurable yBeam{"yBeam", 0., "Beam rapidity"}; - void process(soa::Filtered> const& tracks) + Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; + Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; + Configurable nsigmacut{"nsigmacut", 3, "Value of the Nsigma cut"}; + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; + Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::isGlobalTrack == (uint8_t) true); + + using TrackCandidates = soa::Filtered>; + + void process(/*soa::Join aod::Collisions::iterator const& col, */ TrackCandidates const& tracks) { - for (auto& track : tracks) { - // Part not covered by filters - if (track.tpcNClsFound() < recPointsTPC) { - continue; - } - if (track.itsNCls() < recPointsITS) { - continue; - } - if (track.itsNClsInnerBarrel() < recPointsITSInnerBarrel) { + /* + if (!col.alias()[kINT7]) + return; + if (!col.sel7()) + return; + + fMultiplicity->Fill(col.centV0M()); + */ + for (auto track : tracks) { + + TLorentzVector cutVector{}; + cutVector.SetPtEtaPhiM(track.pt(), track.eta(), track.phi(), constants::physics::MassDeuteron); + if (cutVector.Rapidity() < yMin + yBeam || cutVector.Rapidity() > yMax + yBeam) { continue; } - hTPCsignal->Fill(track.tpcInnerParam(), track.tpcSignal()); - hMomentum->Fill(track.p()); + spectra.fill(HIST("fTPCsignal"), track.p(), track.tpcSignal()); + spectra.fill(HIST("fTPCcounts"), fabs(track.pt()), track.tpcNSigmaDe()); } } };