From 5f345e0e215b3b38f8ce1a1fac5f92bdd1faee48 Mon Sep 17 00:00:00 2001 From: Alexander Kalweit Date: Tue, 15 Jun 2021 19:21:38 +0200 Subject: [PATCH 01/11] cleanup in order to prepare for bigger modifications --- Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx index 62bb2aed4f6d1..fb79e9f65a7e6 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx @@ -45,13 +45,12 @@ struct NucleiSpecraTask { spectra.add("fCollZpos", "collision z position", HistType::kTH1F, {{600, -20., +20., "z position (cm)"}}); spectra.add("fKeepEvent", "skimming histogram", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); - 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("fTPCsignal", "Specific energy loss", HistType::kTH2F, {{600, -3., 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, -100., +100., "n#sigma_{He} (a. u.)"}}); } Configurable yMin{"yMin", -0.8, "Maximum rapidity"}; Configurable yMax{"yMax", 0.8, "Minimum rapidity"}; - Configurable yBeam{"yBeam", 0., "Beam rapidity"}; Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; @@ -63,18 +62,12 @@ struct NucleiSpecraTask { using TrackCandidates = soa::Filtered>; - void process(soa::Filtered>::iterator const& collision, aod::BCsWithTimestamps const&, TrackCandidates const& tracks) + void process(soa::Filtered>::iterator const& collision, TrackCandidates const& tracks) { // // collision process loop // bool keepEvent = kFALSE; - if (!collision.alias()[kINT7]) { - return; - } - if (!collision.sel7()) { - return; - } // spectra.fill(HIST("fCollZpos"), collision.posZ()); // @@ -82,13 +75,13 @@ struct NucleiSpecraTask { TLorentzVector cutVector{}; cutVector.SetPtEtaPhiM(track.pt() * 2.0, track.eta(), track.phi(), constants::physics::MassHelium3); - if (cutVector.Rapidity() < yMin + yBeam || cutVector.Rapidity() > yMax + yBeam) { + if (cutVector.Rapidity() < yMin || cutVector.Rapidity() > yMax) { continue; } // // fill QA histograms // - spectra.fill(HIST("fTPCsignal"), track.tpcInnerParam(), track.tpcSignal()); + spectra.fill(HIST("fTPCsignal"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); spectra.fill(HIST("fTPCcounts"), track.tpcInnerParam(), track.tpcNSigmaHe()); // // check offline-trigger (skimming) condidition From c98b25c37c2a15ce3a6aa18241e2f6721e674706 Mon Sep 17 00:00:00 2001 From: Alexander Kalweit Date: Thu, 15 Jul 2021 15:30:49 +0200 Subject: [PATCH 02/11] adding task on efficiency --- .../Tasks/PWGLF/NucleiSpectraEfficiency.cxx | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx new file mode 100644 index 0000000000000..61dbb16897e88 --- /dev/null +++ b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx @@ -0,0 +1,159 @@ +// 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. +// O2 includes + +#include "ReconstructionDataFormats/Track.h" +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "AnalysisCore/MC.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; +using namespace o2::framework::expressions; + +struct NucleiSpectraEfficiency { + + HistogramRegistry spectra{"spectra", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + 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("fHistGen", "generated particles", HistType::kTH1F, {ptAxis}); + spectra.add("fCollZpos", "collision z position", HistType::kTH1F, {{600, -20., +20., "z position (cm)"}}); + spectra.add("fKeepEvent", "skimming histogram", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); + spectra.add("fTPCsignal", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); + spectra.add("fTOFsignal", "TOF signal", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {500, 0.0, 1.0, "#beta (TOF)"}}); + spectra.add("fTPCcounts", "n-sigma TPC", HistType::kTH2F, {ptAxis, {200, -100., +100., "n#sigma_{He} (a. u.)"}}); + spectra.add("fDcaVsPt", "dca vs Pt", HistType::kTH2F, {ptAxis, {400, -0.2, 0.2, "dca"}}); + spectra.add("fInvMass", "Invariant mass", HistType::kTH1F, {{600, 5.0, +15., "inv. mass GeV/c^{2}"}}); + } + + Configurable yMin{"yMin", -0.8, "Maximum rapidity"}; + Configurable yMax{"yMax", 0.8, "Minimum rapidity"}; + + Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; + Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; + Configurable nsigmacutLow{"nsigmacutLow", -10.0, "Value of the Nsigma cut"}; + Configurable nsigmacutHigh{"nsigmacutHigh", +10.0, "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::iterator const& collision, + // soa::Filtered> const& tracks, + // aod::McParticles& mcParticles, aod::McCollisions const& mcCollisions) + + void process(soa::Join::iterator const& collision, + TrackCandidates const& tracks, aod::McParticles& mcParticles, aod::McCollisions const& mcCollisions) + { + // + // collision process loop + // + bool keepEvent = kFALSE; + // + spectra.fill(HIST("fCollZpos"), collision.posZ()); + // + std::vector posTracks; + std::vector negTracks; + // + // loop over generated particles + // + + // + // loop over reconstructed particles + // + for (auto track : tracks) { // start loop over tracks + + TLorentzVector lorentzVector{}; + lorentzVector.SetPtEtaPhiM(track.pt() * 2.0, track.eta(), track.phi(), constants::physics::MassHelium3); + if (lorentzVector.Rapidity() < yMin || lorentzVector.Rapidity() > yMax) { + continue; + } + // + // fill QA histograms + // + float nSigmaHe3 = track.tpcNSigmaHe(); + nSigmaHe3 += 94.222101 * TMath::Exp(-0.905203 * track.tpcInnerParam()); // HERE I STOP: re-centre the dE/dx + // here i stop: re-center the dE/dx signal as we did all our life + // + spectra.fill(HIST("fTPCsignal"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); + spectra.fill(HIST("fTPCcounts"), track.tpcInnerParam(), nSigmaHe3); + // + // check offline-trigger (skimming) condidition + // + if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { + keepEvent = kTRUE; + if (track.sign() < 0) spectra.fill(HIST("fDcaVsPt"), track.pt(), track.dcaXY()); + // + // store tracks for invariant mass calculation + // + if (track.sign() < 0) + negTracks.push_back(lorentzVector); + if (track.sign() > 0) + posTracks.push_back(lorentzVector); + // + // calculate beta + // + if (!track.hasTOF()) + continue; + Float_t tofTime = track.tofSignal(); + Float_t tofLength = track.length(); + Float_t beta = tofLength / (TMath::C() * 1e-10 * tofTime); + spectra.fill(HIST("fTOFsignal"), track.tpcInnerParam() * track.sign(), beta); + } + + } // end loop over tracks + // + // fill trigger (skimming) results + // + spectra.fill(HIST("fKeepEvent"), keepEvent); + // + // calculate invariant mass + // + for (Int_t iPos = 0; iPos < posTracks.size(); iPos++) { + TLorentzVector& vecPos = posTracks[iPos]; + for (Int_t jNeg = 0; jNeg < negTracks.size(); jNeg++) { + TLorentzVector& vecNeg = negTracks[jNeg]; + TLorentzVector vecMother = vecPos + vecNeg; + spectra.fill(HIST("fInvMass"), vecMother.M()); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"nuclei-efficiency"})}; +} From 9e2d31efa5089c06959694ce57b84e8d8a894bfa Mon Sep 17 00:00:00 2001 From: Alexander Kalweit Date: Thu, 15 Jul 2021 15:31:23 +0200 Subject: [PATCH 03/11] smaller updates and adding efficiency task --- Analysis/Tasks/PWGLF/CMakeLists.txt | 5 ++ Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx | 63 ++++++++++++++++++---- 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/Analysis/Tasks/PWGLF/CMakeLists.txt b/Analysis/Tasks/PWGLF/CMakeLists.txt index 3718fc9e2d8be..2bfda82edd739 100644 --- a/Analysis/Tasks/PWGLF/CMakeLists.txt +++ b/Analysis/Tasks/PWGLF/CMakeLists.txt @@ -48,6 +48,11 @@ o2_add_dpl_workflow(nuclei-spectra PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2::AnalysisDataModel O2::AnalysisCore COMPONENT_NAME Analysis) +o2_add_dpl_workflow(nuclei-efficiency + SOURCES NucleiSpectraEfficiency.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2::AnalysisDataModel O2::AnalysisCore + COMPONENT_NAME Analysis) + o2_add_dpl_workflow(lambdakzerobuilder SOURCES lambdakzerobuilder.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing O2::AnalysisTasksUtils diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx index fb79e9f65a7e6..001edcb8542c7 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx @@ -24,6 +24,8 @@ #include "Framework/HistogramRegistry.h" #include +#include +#include #include @@ -31,7 +33,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -struct NucleiSpecraTask { +struct NucleiSpectraTask { HistogramRegistry spectra{"spectra", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -45,8 +47,11 @@ struct NucleiSpecraTask { spectra.add("fCollZpos", "collision z position", HistType::kTH1F, {{600, -20., +20., "z position (cm)"}}); spectra.add("fKeepEvent", "skimming histogram", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); - spectra.add("fTPCsignal", "Specific energy loss", HistType::kTH2F, {{600, -3., 3, "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); + spectra.add("fTPCsignal", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); + spectra.add("fTOFsignal", "TOF signal", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {500, 0.0, 1.0, "#beta (TOF)"}}); spectra.add("fTPCcounts", "n-sigma TPC", HistType::kTH2F, {ptAxis, {200, -100., +100., "n#sigma_{He} (a. u.)"}}); + spectra.add("fDcaVsPt", "dca vs Pt", HistType::kTH2F, {ptAxis, {400, -0.2, 0.2, "dca"}}); + spectra.add("fInvMass", "Invariant mass", HistType::kTH1F, {{600, 5.0, +15., "inv. mass GeV/c^{2}"}}); } Configurable yMin{"yMin", -0.8, "Maximum rapidity"}; @@ -54,13 +59,14 @@ struct NucleiSpecraTask { Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; - Configurable nsigmacutLow{"nsigmacutLow", -30.0, "Value of the Nsigma cut"}; - Configurable nsigmacutHigh{"nsigmacutHigh", +3., "Value of the Nsigma cut"}; + Configurable nsigmacutLow{"nsigmacutLow", -10.0, "Value of the Nsigma cut"}; + Configurable nsigmacutHigh{"nsigmacutHigh", +10.0, "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>; + using TrackCandidates = soa::Filtered>; void process(soa::Filtered>::iterator const& collision, TrackCandidates const& tracks) { @@ -71,23 +77,47 @@ struct NucleiSpecraTask { // spectra.fill(HIST("fCollZpos"), collision.posZ()); // + std::vector posTracks; + std::vector negTracks; + // for (auto track : tracks) { // start loop over tracks - TLorentzVector cutVector{}; - cutVector.SetPtEtaPhiM(track.pt() * 2.0, track.eta(), track.phi(), constants::physics::MassHelium3); - if (cutVector.Rapidity() < yMin || cutVector.Rapidity() > yMax) { + TLorentzVector lorentzVector{}; + lorentzVector.SetPtEtaPhiM(track.pt() * 2.0, track.eta(), track.phi(), constants::physics::MassHelium3); + if (lorentzVector.Rapidity() < yMin || lorentzVector.Rapidity() > yMax) { continue; } // // fill QA histograms // + float nSigmaHe3 = track.tpcNSigmaHe(); + nSigmaHe3 += 94.222101 * TMath::Exp(-0.905203 * track.tpcInnerParam()); // HERE I STOP: re-centre the dE/dx + // here i stop: re-center the dE/dx signal as we did all our life + // spectra.fill(HIST("fTPCsignal"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); - spectra.fill(HIST("fTPCcounts"), track.tpcInnerParam(), track.tpcNSigmaHe()); + spectra.fill(HIST("fTPCcounts"), track.tpcInnerParam(), nSigmaHe3); // // check offline-trigger (skimming) condidition // - if (track.tpcNSigmaHe() > nsigmacutLow && track.tpcNSigmaHe() < nsigmacutHigh) { + if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { keepEvent = kTRUE; + if (track.sign() < 0) spectra.fill(HIST("fDcaVsPt"), track.pt(), track.dcaXY()); + // + // store tracks for invariant mass calculation + // + if (track.sign() < 0) + negTracks.push_back(lorentzVector); + if (track.sign() > 0) + posTracks.push_back(lorentzVector); + // + // calculate beta + // + if (!track.hasTOF()) + continue; + Float_t tofTime = track.tofSignal(); + Float_t tofLength = track.length(); + Float_t beta = tofLength / (TMath::C() * 1e-10 * tofTime); + spectra.fill(HIST("fTOFsignal"), track.tpcInnerParam() * track.sign(), beta); } } // end loop over tracks @@ -95,11 +125,22 @@ struct NucleiSpecraTask { // fill trigger (skimming) results // spectra.fill(HIST("fKeepEvent"), keepEvent); + // + // calculate invariant mass + // + for (Int_t iPos = 0; iPos < posTracks.size(); iPos++) { + TLorentzVector& vecPos = posTracks[iPos]; + for (Int_t jNeg = 0; jNeg < negTracks.size(); jNeg++) { + TLorentzVector& vecNeg = negTracks[jNeg]; + TLorentzVector vecMother = vecPos + vecNeg; + spectra.fill(HIST("fInvMass"), vecMother.M()); + } + } } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"nuclei-spectra"})}; + adaptAnalysisTask(cfgc, TaskName{"nuclei-spectra"})}; } From 8f92fa73c6875d05ba030ac6351cc36282dc3174 Mon Sep 17 00:00:00 2001 From: Alexander Kalweit Date: Fri, 16 Jul 2021 18:46:22 +0200 Subject: [PATCH 04/11] several updates to complete version of analysis task --- .../Tasks/PWGLF/NucleiSpectraEfficiency.cxx | 148 +++++++++--------- Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx | 3 +- 2 files changed, 73 insertions(+), 78 deletions(-) diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx index 61dbb16897e88..eb7cc83684df7 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx @@ -10,7 +10,6 @@ // O2 includes #include "ReconstructionDataFormats/Track.h" -#include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" @@ -34,126 +33,123 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -struct NucleiSpectraEfficiency { +void customize(std::vector& workflowOptions) +{ + std::vector options{ + {"add-gen", VariantType::Int, 1, {"Generated plots"}}, + {"add-rec", VariantType::Int, 1, {"Reconstructed plots"}}}; + std::swap(workflowOptions, options); +} + +#include "Framework/runDataProcessing.h" // important to declare after the options - HistogramRegistry spectra{"spectra", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; +struct NucleiSpectraEfficiencyGen { + + HistogramRegistry spectra{"spectraGen", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; 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 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., 6., 8., 10., 12., 14.}; 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("fHistGen", "generated particles", HistType::kTH1F, {ptAxis}); - spectra.add("fCollZpos", "collision z position", HistType::kTH1F, {{600, -20., +20., "z position (cm)"}}); - spectra.add("fKeepEvent", "skimming histogram", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); + } + + void process(aod::McCollision const& mcCollision, aod::McParticles& mcParticles) + { + // + // loop over generated particles and fill generated particles + // + for (auto& mcParticleGen : mcParticles) { + if (mcParticleGen.pdgCode() != -1000020030) + continue; + if (!MC::isPhysicalPrimary(mcParticles, mcParticleGen)) + continue; + if (abs(mcParticleGen.y()) > 0.5) + continue; + spectra.fill(HIST("fHistGen"), mcParticleGen.pt()); + } + } +}; + +struct NucleiSpectraEfficiencyRec { + + HistogramRegistry spectra{"spectraRec", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + 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., 6., 8., 10., 12., 14.}; + 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("fHistRec", "reconstructed particles", HistType::kTH1F, {ptAxis}); spectra.add("fTPCsignal", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); - spectra.add("fTOFsignal", "TOF signal", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {500, 0.0, 1.0, "#beta (TOF)"}}); spectra.add("fTPCcounts", "n-sigma TPC", HistType::kTH2F, {ptAxis, {200, -100., +100., "n#sigma_{He} (a. u.)"}}); - spectra.add("fDcaVsPt", "dca vs Pt", HistType::kTH2F, {ptAxis, {400, -0.2, 0.2, "dca"}}); - spectra.add("fInvMass", "Invariant mass", HistType::kTH1F, {{600, 5.0, +15., "inv. mass GeV/c^{2}"}}); + } - Configurable yMin{"yMin", -0.8, "Maximum rapidity"}; - Configurable yMax{"yMax", 0.8, "Minimum rapidity"}; - Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; Configurable nsigmacutLow{"nsigmacutLow", -10.0, "Value of the Nsigma cut"}; Configurable nsigmacutHigh{"nsigmacutHigh", +10.0, "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::iterator const& collision, - // soa::Filtered> const& tracks, - // aod::McParticles& mcParticles, aod::McCollisions const& mcCollisions) - - void process(soa::Join::iterator const& collision, - TrackCandidates const& tracks, aod::McParticles& mcParticles, aod::McCollisions const& mcCollisions) + void process(soa::Join::iterator const& collision, + TrackCandidates const& tracks, aod::McParticles& mcParticles, aod::McCollisions const& mcCollisions) { // - // collision process loop - // - bool keepEvent = kFALSE; - // - spectra.fill(HIST("fCollZpos"), collision.posZ()); - // - std::vector posTracks; - std::vector negTracks; - // - // loop over generated particles + // loop over reconstructed particles and fill reconstructed tracks // - - // - // loop over reconstructed particles - // - for (auto track : tracks) { // start loop over tracks - + for (auto track : tracks) { TLorentzVector lorentzVector{}; lorentzVector.SetPtEtaPhiM(track.pt() * 2.0, track.eta(), track.phi(), constants::physics::MassHelium3); - if (lorentzVector.Rapidity() < yMin || lorentzVector.Rapidity() > yMax) { + if (lorentzVector.Rapidity() < -0.5 || lorentzVector.Rapidity() > 0.5) { continue; } // // fill QA histograms // float nSigmaHe3 = track.tpcNSigmaHe(); - nSigmaHe3 += 94.222101 * TMath::Exp(-0.905203 * track.tpcInnerParam()); // HERE I STOP: re-centre the dE/dx - // here i stop: re-center the dE/dx signal as we did all our life + nSigmaHe3 += 94.222101 * TMath::Exp(-0.905203 * track.tpcInnerParam()); // spectra.fill(HIST("fTPCsignal"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); spectra.fill(HIST("fTPCcounts"), track.tpcInnerParam(), nSigmaHe3); // - // check offline-trigger (skimming) condidition + // fill histograms // if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { - keepEvent = kTRUE; - if (track.sign() < 0) spectra.fill(HIST("fDcaVsPt"), track.pt(), track.dcaXY()); - // - // store tracks for invariant mass calculation - // - if (track.sign() < 0) - negTracks.push_back(lorentzVector); - if (track.sign() > 0) - posTracks.push_back(lorentzVector); - // - // calculate beta - // - if (!track.hasTOF()) - continue; - Float_t tofTime = track.tofSignal(); - Float_t tofLength = track.length(); - Float_t beta = tofLength / (TMath::C() * 1e-10 * tofTime); - spectra.fill(HIST("fTOFsignal"), track.tpcInnerParam() * track.sign(), beta); + spectra.fill(HIST("fHistRec"), track.pt() * 2.0); } - } // end loop over tracks - // - // fill trigger (skimming) results - // - spectra.fill(HIST("fKeepEvent"), keepEvent); - // - // calculate invariant mass - // - for (Int_t iPos = 0; iPos < posTracks.size(); iPos++) { - TLorentzVector& vecPos = posTracks[iPos]; - for (Int_t jNeg = 0; jNeg < negTracks.size(); jNeg++) { - TLorentzVector& vecNeg = negTracks[jNeg]; - TLorentzVector vecMother = vecPos + vecNeg; - spectra.fill(HIST("fInvMass"), vecMother.M()); - } } } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"nuclei-efficiency"})}; + const bool rec = cfgc.options().get("add-rec"); + const bool gen = cfgc.options().get("add-gen"); + // + WorkflowSpec workflow{}; + // + if (gen) { + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"nuclei-efficiency-gen"})); + } + if (rec) { + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"nuclei-efficiency-rec"})); + } + // + return workflow; } diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx index db8b2fc61b7bc..818539b3fa78e 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx @@ -92,8 +92,7 @@ struct NucleiSpectraTask { // fill QA histograms // float nSigmaHe3 = track.tpcNSigmaHe(); - nSigmaHe3 += 94.222101 * TMath::Exp(-0.905203 * track.tpcInnerParam()); // HERE I STOP: re-centre the dE/dx - // here i stop: re-center the dE/dx signal as we did all our life + nSigmaHe3 += 94.222101 * TMath::Exp(-0.905203 * track.tpcInnerParam()); // spectra.fill(HIST("fTPCsignal"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); spectra.fill(HIST("fTPCcounts"), track.tpcInnerParam(), nSigmaHe3); From b0162541d4face9dc8a059e90977e00d258bad61 Mon Sep 17 00:00:00 2001 From: Alexander Kalweit Date: Tue, 20 Jul 2021 19:02:17 +0200 Subject: [PATCH 05/11] updates to prepare for pilot testbeam challenge and MC testing --- .../Tasks/PWGLF/NucleiSpectraEfficiency.cxx | 48 +++++++++++++------ Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx | 32 ++++++------- 2 files changed, 50 insertions(+), 30 deletions(-) diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx index eb7cc83684df7..bda662e7d883b 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx @@ -36,6 +36,7 @@ using namespace o2::framework::expressions; void customize(std::vector& workflowOptions) { std::vector options{ + {"add-vertex", VariantType::Int, 1, {"Vertex plots"}}, {"add-gen", VariantType::Int, 1, {"Generated plots"}}, {"add-rec", VariantType::Int, 1, {"Reconstructed plots"}}}; std::swap(workflowOptions, options); @@ -43,6 +44,15 @@ void customize(std::vector& workflowOptions) #include "Framework/runDataProcessing.h" // important to declare after the options +struct NucleiSpectraEfficienctyVtx { + OutputObj histVertexTrueZ{TH1F("histVertexTrueZ", "MC true z position of z-vertex; vertex z (cm)", 100, -20., 20.)}; + + void process(aod::McCollision const& mcCollision) + { + histVertexTrueZ->Fill(mcCollision.posZ()); + } +}; + struct NucleiSpectraEfficiencyGen { HistogramRegistry spectra{"spectraGen", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; @@ -56,7 +66,7 @@ struct NucleiSpectraEfficiencyGen { AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec centAxis = {centBinning, "V0M (%)"}; // - spectra.add("fHistGen", "generated particles", HistType::kTH1F, {ptAxis}); + spectra.add("histGenPt", "generated particles", HistType::kTH1F, {ptAxis}); } void process(aod::McCollision const& mcCollision, aod::McParticles& mcParticles) @@ -71,7 +81,7 @@ struct NucleiSpectraEfficiencyGen { continue; if (abs(mcParticleGen.y()) > 0.5) continue; - spectra.fill(HIST("fHistGen"), mcParticleGen.pt()); + spectra.fill(HIST("histGenPt"), mcParticleGen.pt()); } } }; @@ -89,10 +99,10 @@ struct NucleiSpectraEfficiencyRec { AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec centAxis = {centBinning, "V0M (%)"}; // - spectra.add("fHistRec", "reconstructed particles", HistType::kTH1F, {ptAxis}); - spectra.add("fTPCsignal", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#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, -100., +100., "n#sigma_{He} (a. u.)"}}); - + spectra.add("histRecVtxZ", "collision z position", HistType::kTH1F, {{600, -20., +20., "z position (cm)"}}); + spectra.add("histRecPt", "reconstructed particles", HistType::kTH1F, {ptAxis}); + spectra.add("histTpcSignal", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); + spectra.add("histTpcNsigma", "n-sigma TPC", HistType::kTH2F, {ptAxis, {200, -100., +100., "n#sigma_{He} (a. u.)"}}); } Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; @@ -100,15 +110,18 @@ struct NucleiSpectraEfficiencyRec { Configurable nsigmacutLow{"nsigmacutLow", -10.0, "Value of the Nsigma cut"}; Configurable nsigmacutHigh{"nsigmacutHigh", +10.0, "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>; + using TrackCandidates = soa::Filtered>; - void process(soa::Join::iterator const& collision, + void process(soa::Filtered>::iterator const& collision, TrackCandidates const& tracks, aod::McParticles& mcParticles, aod::McCollisions const& mcCollisions) { + // + // check the vertex-z distribution + // + spectra.fill(HIST("histRecVtxZ"), collision.posZ()); // // loop over reconstructed particles and fill reconstructed tracks // @@ -124,26 +137,33 @@ struct NucleiSpectraEfficiencyRec { float nSigmaHe3 = track.tpcNSigmaHe(); nSigmaHe3 += 94.222101 * TMath::Exp(-0.905203 * track.tpcInnerParam()); // - spectra.fill(HIST("fTPCsignal"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); - spectra.fill(HIST("fTPCcounts"), track.tpcInnerParam(), nSigmaHe3); + spectra.fill(HIST("histTpcSignal"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); + spectra.fill(HIST("histTpcNsigma"), track.tpcInnerParam(), nSigmaHe3); // // fill histograms // if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { - spectra.fill(HIST("fHistRec"), track.pt() * 2.0); + // check on perfect PID + if (track.mcParticle().pdgCode() != -1000020030) + continue; + // fill reconstructed histogram + spectra.fill(HIST("histRecPt"), track.pt() * 2.0); } - } } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - const bool rec = cfgc.options().get("add-rec"); + const bool vertex = cfgc.options().get("add-vertex"); const bool gen = cfgc.options().get("add-gen"); + const bool rec = cfgc.options().get("add-rec"); // WorkflowSpec workflow{}; // + if (vertex) { + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"nuclei-efficiency-vtx"})); + } if (gen) { workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"nuclei-efficiency-gen"})); } diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx index 818539b3fa78e..cb4fe3987000b 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx @@ -46,17 +46,17 @@ struct NucleiSpectraTask { AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec centAxis = {centBinning, "V0M (%)"}; - spectra.add("fCollZpos", "collision z position", HistType::kTH1F, {{600, -20., +20., "z position (cm)"}}); - spectra.add("fKeepEvent", "skimming histogram", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); - spectra.add("fTPCsignal", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); - spectra.add("fTOFsignal", "TOF signal", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {500, 0.0, 1.0, "#beta (TOF)"}}); - spectra.add("fTPCcounts", "n-sigma TPC", HistType::kTH2F, {ptAxis, {200, -100., +100., "n#sigma_{He} (a. u.)"}}); - spectra.add("fDcaVsPt", "dca vs Pt", HistType::kTH2F, {ptAxis, {400, -0.2, 0.2, "dca"}}); - spectra.add("fInvMass", "Invariant mass", HistType::kTH1F, {{600, 5.0, +15., "inv. mass GeV/c^{2}"}}); + spectra.add("histRecVtxZData", "collision z position", HistType::kTH1F, {{600, -20., +20., "z position (cm)"}}); + spectra.add("histKeepEventData", "skimming histogram", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); + spectra.add("histTpcSignalData", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); + spectra.add("histTofSignalData", "TOF signal", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {500, 0.0, 1.0, "#beta (TOF)"}}); + spectra.add("histTpcNsigmaData", "n-sigma TPC", HistType::kTH2F, {ptAxis, {200, -100., +100., "n#sigma_{He} (a. u.)"}}); + spectra.add("histDcaVsPtData", "dca vs Pt", HistType::kTH2F, {ptAxis, {400, -0.2, 0.2, "dca"}}); + spectra.add("histInvMassData", "Invariant mass", HistType::kTH1F, {{600, 5.0, +15., "inv. mass GeV/c^{2}"}}); } - Configurable yMin{"yMin", -0.8, "Maximum rapidity"}; - Configurable yMax{"yMax", 0.8, "Minimum rapidity"}; + Configurable yMin{"yMin", -0.5, "Maximum rapidity"}; + Configurable yMax{"yMax", 0.5, "Minimum rapidity"}; Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; @@ -76,7 +76,7 @@ struct NucleiSpectraTask { // bool keepEvent = kFALSE; // - spectra.fill(HIST("fCollZpos"), collision.posZ()); + spectra.fill(HIST("histRecVtxZData"), collision.posZ()); // std::vector posTracks; std::vector negTracks; @@ -94,14 +94,14 @@ struct NucleiSpectraTask { float nSigmaHe3 = track.tpcNSigmaHe(); nSigmaHe3 += 94.222101 * TMath::Exp(-0.905203 * track.tpcInnerParam()); // - spectra.fill(HIST("fTPCsignal"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); - spectra.fill(HIST("fTPCcounts"), track.tpcInnerParam(), nSigmaHe3); + spectra.fill(HIST("histTpcSignalData"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); + spectra.fill(HIST("histTpcNsigmaData"), track.tpcInnerParam(), nSigmaHe3); // // check offline-trigger (skimming) condidition // if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { keepEvent = kTRUE; - if (track.sign() < 0) spectra.fill(HIST("fDcaVsPt"), track.pt(), track.dcaXY()); + if (track.sign() < 0) spectra.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); // // store tracks for invariant mass calculation // @@ -117,14 +117,14 @@ struct NucleiSpectraTask { Float_t tofTime = track.tofSignal(); Float_t tofLength = track.length(); Float_t beta = tofLength / (TMath::C() * 1e-10 * tofTime); - spectra.fill(HIST("fTOFsignal"), track.tpcInnerParam() * track.sign(), beta); + spectra.fill(HIST("histTofSignalData"), track.tpcInnerParam() * track.sign(), beta); } } // end loop over tracks // // fill trigger (skimming) results // - spectra.fill(HIST("fKeepEvent"), keepEvent); + spectra.fill(HIST("histKeepEventData"), keepEvent); // // calculate invariant mass // @@ -133,7 +133,7 @@ struct NucleiSpectraTask { for (Int_t jNeg = 0; jNeg < negTracks.size(); jNeg++) { TLorentzVector& vecNeg = negTracks[jNeg]; TLorentzVector vecMother = vecPos + vecNeg; - spectra.fill(HIST("fInvMass"), vecMother.M()); + spectra.fill(HIST("histInvMassData"), vecMother.M()); } } } From 5f0549340383ae3e77958300f5de051a2748d4e3 Mon Sep 17 00:00:00 2001 From: Alexander Kalweit Date: Tue, 20 Jul 2021 19:51:05 +0200 Subject: [PATCH 06/11] format change --- Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx index cb4fe3987000b..3efd9fdc5753a 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx @@ -65,7 +65,6 @@ struct NucleiSpectraTask { Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::isGlobalTrack == (uint8_t) true); - using TrackCandidates = soa::Filtered>; @@ -101,7 +100,8 @@ struct NucleiSpectraTask { // if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { keepEvent = kTRUE; - if (track.sign() < 0) spectra.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); + if (track.sign() < 0) + spectra.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); // // store tracks for invariant mass calculation // From 18cd57e0707b9fa413c51d9de0c32baff6719744 Mon Sep 17 00:00:00 2001 From: Alexander Kalweit Date: Wed, 21 Jul 2021 11:34:05 +0200 Subject: [PATCH 07/11] small improvements spotted by continous integration --- .../Tasks/PWGLF/NucleiSpectraEfficiency.cxx | 18 +++++++++++------- Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx | 12 ++++++++---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx index bda662e7d883b..3c9c04b67a48a 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.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 @@ -75,12 +76,15 @@ struct NucleiSpectraEfficiencyGen { // loop over generated particles and fill generated particles // for (auto& mcParticleGen : mcParticles) { - if (mcParticleGen.pdgCode() != -1000020030) + if (mcParticleGen.pdgCode() != -1000020030) { continue; - if (!MC::isPhysicalPrimary(mcParticles, mcParticleGen)) + } + if (!MC::isPhysicalPrimary(mcParticles, mcParticleGen)) { continue; - if (abs(mcParticleGen.y()) > 0.5) + } + if (abs(mcParticleGen.y()) > 0.5) { continue; + } spectra.fill(HIST("histGenPt"), mcParticleGen.pt()); } } diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx index 3efd9fdc5753a..8939f7c00a765 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx @@ -100,20 +100,24 @@ struct NucleiSpectraTask { // if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { keepEvent = kTRUE; - if (track.sign() < 0) + if (track.sign() < 0) { spectra.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); + } // // store tracks for invariant mass calculation // - if (track.sign() < 0) + if (track.sign() < 0) { negTracks.push_back(lorentzVector); - if (track.sign() > 0) + } + if (track.sign() > 0) { posTracks.push_back(lorentzVector); + } // // calculate beta // - if (!track.hasTOF()) + if (!track.hasTOF()) { continue; + } Float_t tofTime = track.tofSignal(); Float_t tofLength = track.length(); Float_t beta = tofLength / (TMath::C() * 1e-10 * tofTime); From f99ad23a530756da9ee718242b9565f44803ed77 Mon Sep 17 00:00:00 2001 From: Alexander Kalweit Date: Wed, 21 Jul 2021 14:06:02 +0200 Subject: [PATCH 08/11] forgotten brace --- Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx index 3c9c04b67a48a..1ae0af8787f9c 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx @@ -148,8 +148,9 @@ struct NucleiSpectraEfficiencyRec { // if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { // check on perfect PID - if (track.mcParticle().pdgCode() != -1000020030) + if (track.mcParticle().pdgCode() != -1000020030) { continue; + } // fill reconstructed histogram spectra.fill(HIST("histRecPt"), track.pt() * 2.0); } From 883c51ed147d1a861914c25fa74a52726ca9429f Mon Sep 17 00:00:00 2001 From: Alexander Kalweit Date: Sun, 25 Jul 2021 19:05:20 +0200 Subject: [PATCH 09/11] harmonize bins --- Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx | 4 ++-- Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx index 1ae0af8787f9c..1be5c542c4ee8 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx @@ -46,7 +46,7 @@ void customize(std::vector& workflowOptions) #include "Framework/runDataProcessing.h" // important to declare after the options struct NucleiSpectraEfficienctyVtx { - OutputObj histVertexTrueZ{TH1F("histVertexTrueZ", "MC true z position of z-vertex; vertex z (cm)", 100, -20., 20.)}; + OutputObj histVertexTrueZ{TH1F("histVertexTrueZ", "MC true z position of z-vertex; vertex z (cm)", 200, -20., 20.)}; void process(aod::McCollision const& mcCollision) { @@ -103,7 +103,7 @@ struct NucleiSpectraEfficiencyRec { AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec centAxis = {centBinning, "V0M (%)"}; // - spectra.add("histRecVtxZ", "collision z position", HistType::kTH1F, {{600, -20., +20., "z position (cm)"}}); + spectra.add("histRecVtxZ", "collision z position", HistType::kTH1F, {{200, -20., +20., "z position (cm)"}}); spectra.add("histRecPt", "reconstructed particles", HistType::kTH1F, {ptAxis}); spectra.add("histTpcSignal", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); spectra.add("histTpcNsigma", "n-sigma TPC", HistType::kTH2F, {ptAxis, {200, -100., +100., "n#sigma_{He} (a. u.)"}}); diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx index 8939f7c00a765..dd3dedeaf3b62 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx @@ -46,7 +46,7 @@ struct NucleiSpectraTask { AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec centAxis = {centBinning, "V0M (%)"}; - spectra.add("histRecVtxZData", "collision z position", HistType::kTH1F, {{600, -20., +20., "z position (cm)"}}); + spectra.add("histRecVtxZData", "collision z position", HistType::kTH1F, {{200, -20., +20., "z position (cm)"}}); spectra.add("histKeepEventData", "skimming histogram", HistType::kTH1F, {{2, -0.5, +1.5, "true: keep event, false: reject event"}}); spectra.add("histTpcSignalData", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {1400, 0, 1400, "d#it{E} / d#it{X} (a. u.)"}}); spectra.add("histTofSignalData", "TOF signal", HistType::kTH2F, {{600, -6., 6., "#it{p} (GeV/#it{c})"}, {500, 0.0, 1.0, "#beta (TOF)"}}); From e66423245dff8a27d675e2c0889b424465a0be98 Mon Sep 17 00:00:00 2001 From: Alexander Kalweit Date: Mon, 26 Jul 2021 11:17:50 +0200 Subject: [PATCH 10/11] several small bugfixes --- Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx index dd3dedeaf3b62..f2a088cde5c8a 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraTask.cxx @@ -40,7 +40,8 @@ struct NucleiSpectraTask { 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 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., 6., 8., 10., 12., 14.}; std::vector centBinning = {0., 1., 5., 10., 20., 30., 40., 50., 70., 100.}; AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; @@ -94,14 +95,16 @@ struct NucleiSpectraTask { nSigmaHe3 += 94.222101 * TMath::Exp(-0.905203 * track.tpcInnerParam()); // spectra.fill(HIST("histTpcSignalData"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); - spectra.fill(HIST("histTpcNsigmaData"), track.tpcInnerParam(), nSigmaHe3); + if (track.sign() < 0) { + spectra.fill(HIST("histTpcNsigmaData"), track.pt() * 2.0, nSigmaHe3); + } // // check offline-trigger (skimming) condidition // if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { keepEvent = kTRUE; if (track.sign() < 0) { - spectra.fill(HIST("histDcaVsPtData"), track.pt(), track.dcaXY()); + spectra.fill(HIST("histDcaVsPtData"), track.pt() * 2.0, track.dcaXY()); } // // store tracks for invariant mass calculation From 1f6cc5f28c396ba6b6922f1c7d449e794407a179 Mon Sep 17 00:00:00 2001 From: Alexander Kalweit Date: Mon, 26 Jul 2021 17:38:01 +0200 Subject: [PATCH 11/11] typo fix --- Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx index 1b4cc2e458bda..9ddde2c3734ba 100644 --- a/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx +++ b/Analysis/Tasks/PWGLF/NucleiSpectraEfficiency.cxx @@ -45,7 +45,7 @@ void customize(std::vector& workflowOptions) #include "Framework/runDataProcessing.h" // important to declare after the options -struct NucleiSpectraEfficienctyVtx { +struct NucleiSpectraEfficiencyVtx { OutputObj histVertexTrueZ{TH1F("histVertexTrueZ", "MC true z position of z-vertex; vertex z (cm)", 200, -20., 20.)}; void process(aod::McCollision const& mcCollision) @@ -167,7 +167,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) WorkflowSpec workflow{}; // if (vertex) { - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"nuclei-efficiency-vtx"})); + workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"nuclei-efficiency-vtx"})); } if (gen) { workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"nuclei-efficiency-gen"}));