diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h new file mode 100644 index 00000000000..3c44f0f790d --- /dev/null +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -0,0 +1,116 @@ +// 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. + +/// +/// \file LFHypernucleiTables.h +/// \brief Slim hypernuclei tables +/// + +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" + +#ifndef PWGLF_DATAMODEL_LFHYPERNUCLEITABLES_H_ +#define PWGLF_DATAMODEL_LFHYPERNUCLEITABLES_H_ + +namespace o2::aod +{ +namespace hyperrec +{ +DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter +DECLARE_SOA_COLUMN(Pt, pt, float); // Momentum of the candidate (x direction) +DECLARE_SOA_COLUMN(Phi, phi, float); // Momentum of the candidate (y direction) +DECLARE_SOA_COLUMN(Eta, eta, float); // Momentum of the candidate (z direction) +DECLARE_SOA_COLUMN(XDecVtx, xDecVtx, float); // Decay vertex of the candidate (x direction) +DECLARE_SOA_COLUMN(YDecVtx, yDecVtx, float); // Decay vertex of the candidate (y direction) +DECLARE_SOA_COLUMN(ZDecVtx, zDecVtx, float); // Decay vertex of the candidate (z direction) +DECLARE_SOA_COLUMN(MassH3L, massH3L, float); // Squared mass w/ hypertriton mass hypo +DECLARE_SOA_COLUMN(MassH4L, massH4L, float); // Squared mass w/ H4L mass hypo +DECLARE_SOA_COLUMN(DcaV0Daug, dcaV0Daug, float); // DCA between daughters +DECLARE_SOA_COLUMN(CosPA, cosPA, double); // Cosine of the pointing angle +DECLARE_SOA_COLUMN(NSigmaHe, nSigmaHe, float); // Number of sigmas of the He daughter +DECLARE_SOA_COLUMN(NTPCclusHe, nTPCclusHe, uint8_t); // Number of TPC clusters of the He daughter +DECLARE_SOA_COLUMN(NTPCclusPi, nTPCclusPi, uint8_t); // Number of TPC clusters of the Pi daughter +DECLARE_SOA_COLUMN(TPCsignalHe, tpcSignalHe, uint16_t); // TPC signal of the He daughter +DECLARE_SOA_COLUMN(TPCsignalPi, tpcSignalPi, uint16_t); // TPC signal of the Pi daughter +DECLARE_SOA_COLUMN(TPCmomHe, tpcMomHe, float); // TPC momentum of the He daughter +DECLARE_SOA_COLUMN(TPCmomPi, tpcMomPi, float); // TPC momentum of the Pi daughter +DECLARE_SOA_COLUMN(DcaHe, dcaHe, float); // DCA between He daughter and V0 +DECLARE_SOA_COLUMN(DcaPi, dcaPi, float); // DCA between pi daughter and V0 +DECLARE_SOA_COLUMN(GenPt, genPt, float); // Momentum of the candidate (x direction) +DECLARE_SOA_COLUMN(GenPhi, genPhi, float); // Momentum of the candidate (y direction) +DECLARE_SOA_COLUMN(GenEta, genEta, float); // Momentum of the candidate (z direction) +DECLARE_SOA_COLUMN(GenXDecVtx, genXDecVtx, float); // Decay vertex of the candidate (x direction) +DECLARE_SOA_COLUMN(GenYDecVtx, genYDecVtx, float); // Decay vertex of the candidate (y direction) +DECLARE_SOA_COLUMN(GenZDecVtx, genZDecVtx, float); // Decay vertex of the candidate (z direction) +DECLARE_SOA_COLUMN(IsReco, isReco, bool); // bool: true for reco +DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: true for signal +} // namespace hyperrec + +DECLARE_SOA_TABLE(DataHypCands, "AOD", "DATAHYPCANDS", + o2::soa::Index<>, + hyperrec::IsMatter, + hyperrec::Pt, + hyperrec::Phi, + hyperrec::Eta, + hyperrec::XDecVtx, + hyperrec::YDecVtx, + hyperrec::ZDecVtx, + hyperrec::MassH3L, + hyperrec::MassH4L, + hyperrec::DcaV0Daug, + hyperrec::CosPA, + hyperrec::NSigmaHe, + hyperrec::NTPCclusHe, + hyperrec::NTPCclusPi, + hyperrec::TPCmomHe, + hyperrec::TPCmomPi, + hyperrec::TPCsignalHe, + hyperrec::TPCsignalPi, + hyperrec::DcaHe, + hyperrec::DcaPi); + +DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", + o2::soa::Index<>, + hyperrec::IsMatter, + hyperrec::Pt, + hyperrec::Phi, + hyperrec::Eta, + hyperrec::XDecVtx, + hyperrec::YDecVtx, + hyperrec::ZDecVtx, + hyperrec::MassH3L, + hyperrec::MassH4L, + hyperrec::DcaV0Daug, + hyperrec::CosPA, + hyperrec::NSigmaHe, + hyperrec::NTPCclusHe, + hyperrec::NTPCclusPi, + hyperrec::TPCmomHe, + hyperrec::TPCmomPi, + hyperrec::TPCsignalHe, + hyperrec::TPCsignalPi, + hyperrec::DcaHe, + hyperrec::DcaPi, + hyperrec::GenPt, + hyperrec::GenPhi, + hyperrec::GenEta, + hyperrec::GenXDecVtx, + hyperrec::GenYDecVtx, + hyperrec::GenZDecVtx, + hyperrec::IsReco, + hyperrec::IsSignal); + +using DataHypCand = DataHypCands::iterator; +using MCHypCand = MCHypCands::iterator; + +} // namespace o2::aod + +#endif // PWGLF_DATAMODEL_LFHYPERNUCLEITABLES_H_ diff --git a/PWGLF/DataModel/LFSlimNucleiTables.h b/PWGLF/DataModel/LFSlimNucleiTables.h new file mode 100644 index 00000000000..4d233b461eb --- /dev/null +++ b/PWGLF/DataModel/LFSlimNucleiTables.h @@ -0,0 +1,68 @@ +// 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. + +/// +/// \file LFSlimNucleiTables.h +/// \brief Slim nuclei tables +/// + +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" + +#ifndef PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_ +#define PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_ + +namespace o2::aod +{ +namespace NucleiTableNS +{ +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Eta, eta, float); +DECLARE_SOA_COLUMN(ITSclsMap, itsClsMap, uint8_t); +DECLARE_SOA_COLUMN(TPCnCls, tpcNCls, uint8_t); +DECLARE_SOA_COLUMN(DCAxy, dcaxy, int8_t); +DECLARE_SOA_COLUMN(DCAz, dcaz, int8_t); +DECLARE_SOA_COLUMN(Flags, flags, uint16_t); +DECLARE_SOA_COLUMN(TPCnsigma, tpcnsigma, uint8_t); +DECLARE_SOA_COLUMN(TOFmass, tofmass, uint8_t); +DECLARE_SOA_COLUMN(gPt, genPt, float); +DECLARE_SOA_COLUMN(gEta, genEta, float); +DECLARE_SOA_COLUMN(PDGcode, pdgCode, int); + +} // namespace NucleiTableNS +DECLARE_SOA_TABLE(NucleiTable, "AOD", "NUCLEITABLE", + NucleiTableNS::Pt, + NucleiTableNS::Eta, + NucleiTableNS::ITSclsMap, + NucleiTableNS::TPCnCls, + NucleiTableNS::DCAxy, + NucleiTableNS::DCAz, + NucleiTableNS::Flags, + NucleiTableNS::TPCnsigma, + NucleiTableNS::TOFmass) + +DECLARE_SOA_TABLE(NucleiTableMC, "AOD", "NUCLEITABLEMC", + NucleiTableNS::Pt, + NucleiTableNS::Eta, + NucleiTableNS::ITSclsMap, + NucleiTableNS::TPCnCls, + NucleiTableNS::DCAxy, + NucleiTableNS::DCAz, + NucleiTableNS::Flags, + NucleiTableNS::TPCnsigma, + NucleiTableNS::TOFmass, + NucleiTableNS::gPt, + NucleiTableNS::gEta, + NucleiTableNS::PDGcode) + +} // namespace o2::aod + +#endif // PWGLF_DATAMODEL_LFSLIMNUCLEITABLES_H_ diff --git a/PWGLF/TableProducer/CMakeLists.txt b/PWGLF/TableProducer/CMakeLists.txt index bdf5461ad45..cbe2318c407 100644 --- a/PWGLF/TableProducer/CMakeLists.txt +++ b/PWGLF/TableProducer/CMakeLists.txt @@ -72,6 +72,17 @@ o2physics_add_dpl_workflow(nucleustreecreator PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(nuclei-spectra + SOURCES nucleiSpectra.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase + COMPONENT_NAME Analysis) + +# Hypernuclei +o2physics_add_dpl_workflow(hypertriton-reco-task + SOURCES hyperRecoTask.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter + COMPONENT_NAME Analysis) + # Resonances o2physics_add_dpl_workflow(reso2initializer SOURCES LFResonanceInitializer.cxx diff --git a/PWGLF/Tasks/hyperRecoTask.cxx b/PWGLF/TableProducer/hyperRecoTask.cxx similarity index 82% rename from PWGLF/Tasks/hyperRecoTask.cxx rename to PWGLF/TableProducer/hyperRecoTask.cxx index 664130747e3..2c5d8fbefae 100644 --- a/PWGLF/Tasks/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/hyperRecoTask.cxx @@ -32,6 +32,8 @@ #include "DataFormatsTPC/BetheBlochAleph.h" #include "DCAFitter/DCAFitterN.h" +#include "PWGLF/DataModel/LFHypernucleiTables.h" + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -50,98 +52,6 @@ std::shared_ptr hDeDx3HeSel; std::shared_ptr hDeDxTot; } // namespace -namespace o2::aod -{ -namespace hyperrec -{ -DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter -DECLARE_SOA_COLUMN(Pt, pt, float); // Momentum of the candidate (x direction) -DECLARE_SOA_COLUMN(Phi, phi, float); // Momentum of the candidate (y direction) -DECLARE_SOA_COLUMN(Eta, eta, float); // Momentum of the candidate (z direction) -DECLARE_SOA_COLUMN(XDecVtx, xDecVtx, float); // Decay vertex of the candidate (x direction) -DECLARE_SOA_COLUMN(YDecVtx, yDecVtx, float); // Decay vertex of the candidate (y direction) -DECLARE_SOA_COLUMN(ZDecVtx, zDecVtx, float); // Decay vertex of the candidate (z direction) -DECLARE_SOA_COLUMN(MassH3L, massH3L, float); // Squared mass w/ hypertriton mass hypo -DECLARE_SOA_COLUMN(MassH4L, massH4L, float); // Squared mass w/ H4L mass hypo -DECLARE_SOA_COLUMN(DcaV0Daug, dcaV0Daug, float); // DCA between daughters -DECLARE_SOA_COLUMN(CosPA, cosPA, double); // Cosine of the pointing angle -DECLARE_SOA_COLUMN(NSigmaHe, nSigmaHe, float); // Number of sigmas of the He daughter -DECLARE_SOA_COLUMN(NTPCclusHe, nTPCclusHe, uint8_t); // Number of TPC clusters of the He daughter -DECLARE_SOA_COLUMN(NTPCclusPi, nTPCclusPi, uint8_t); // Number of TPC clusters of the Pi daughter -DECLARE_SOA_COLUMN(TPCsignalHe, tpcSignalHe, uint16_t); // TPC signal of the He daughter -DECLARE_SOA_COLUMN(TPCsignalPi, tpcSignalPi, uint16_t); // TPC signal of the Pi daughter -DECLARE_SOA_COLUMN(TPCmomHe, tpcMomHe, float); // TPC momentum of the He daughter -DECLARE_SOA_COLUMN(TPCmomPi, tpcMomPi, float); // TPC momentum of the Pi daughter -DECLARE_SOA_COLUMN(DcaHe, dcaHe, float); // DCA between He daughter and V0 -DECLARE_SOA_COLUMN(DcaPi, dcaPi, float); // DCA between pi daughter and V0 -DECLARE_SOA_COLUMN(GenPt, genPt, float); // Momentum of the candidate (x direction) -DECLARE_SOA_COLUMN(GenPhi, genPhi, float); // Momentum of the candidate (y direction) -DECLARE_SOA_COLUMN(GenEta, genEta, float); // Momentum of the candidate (z direction) -DECLARE_SOA_COLUMN(GenXDecVtx, genXDecVtx, float); // Decay vertex of the candidate (x direction) -DECLARE_SOA_COLUMN(GenYDecVtx, genYDecVtx, float); // Decay vertex of the candidate (y direction) -DECLARE_SOA_COLUMN(GenZDecVtx, genZDecVtx, float); // Decay vertex of the candidate (z direction) -DECLARE_SOA_COLUMN(IsReco, isReco, bool); // bool: true for reco -DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: true for signal -} // namespace hyperrec - -DECLARE_SOA_TABLE(DataHypCands, "AOD", "DATAHYPCANDS", - o2::soa::Index<>, - hyperrec::IsMatter, - hyperrec::Pt, - hyperrec::Phi, - hyperrec::Eta, - hyperrec::XDecVtx, - hyperrec::YDecVtx, - hyperrec::ZDecVtx, - hyperrec::MassH3L, - hyperrec::MassH4L, - hyperrec::DcaV0Daug, - hyperrec::CosPA, - hyperrec::NSigmaHe, - hyperrec::NTPCclusHe, - hyperrec::NTPCclusPi, - hyperrec::TPCmomHe, - hyperrec::TPCmomPi, - hyperrec::TPCsignalHe, - hyperrec::TPCsignalPi, - hyperrec::DcaHe, - hyperrec::DcaPi); - -DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", - o2::soa::Index<>, - hyperrec::IsMatter, - hyperrec::Pt, - hyperrec::Phi, - hyperrec::Eta, - hyperrec::XDecVtx, - hyperrec::YDecVtx, - hyperrec::ZDecVtx, - hyperrec::MassH3L, - hyperrec::MassH4L, - hyperrec::DcaV0Daug, - hyperrec::CosPA, - hyperrec::NSigmaHe, - hyperrec::NTPCclusHe, - hyperrec::NTPCclusPi, - hyperrec::TPCmomHe, - hyperrec::TPCmomPi, - hyperrec::TPCsignalHe, - hyperrec::TPCsignalPi, - hyperrec::DcaHe, - hyperrec::DcaPi, - hyperrec::GenPt, - hyperrec::GenPhi, - hyperrec::GenEta, - hyperrec::GenXDecVtx, - hyperrec::GenYDecVtx, - hyperrec::GenZDecVtx, - hyperrec::IsReco, - hyperrec::IsSignal); - -using DataHypCand = DataHypCands::iterator; -using MCHypCand = MCHypCands::iterator; -} // namespace o2::aod - struct hyperCandidate { float recoPt() const { return std::hypot(mom[0], mom[1]); } float recoPhi() const { return std::atan2(mom[1], mom[0]); } diff --git a/PWGLF/Tasks/NucleiSpectraTask.cxx b/PWGLF/TableProducer/nucleiSpectra.cxx similarity index 92% rename from PWGLF/Tasks/NucleiSpectraTask.cxx rename to PWGLF/TableProducer/nucleiSpectra.cxx index 64bbbbccfb5..be3cd9c4984 100644 --- a/PWGLF/Tasks/NucleiSpectraTask.cxx +++ b/PWGLF/TableProducer/nucleiSpectra.cxx @@ -47,6 +47,8 @@ #include "ReconstructionDataFormats/Track.h" +#include "PWGLF/DataModel/LFSlimNucleiTables.h" + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -155,52 +157,7 @@ o2::base::MatLayerCylSet* lut = nullptr; std::vector candidates; } // namespace nuclei -namespace o2::aod -{ -namespace NucleiTableNS -{ -DECLARE_SOA_COLUMN(Pt, pt, float); -DECLARE_SOA_COLUMN(Eta, eta, float); -DECLARE_SOA_COLUMN(ITSclsMap, itsClsMap, uint8_t); -DECLARE_SOA_COLUMN(TPCnCls, tpcNCls, uint8_t); -DECLARE_SOA_COLUMN(DCAxy, dcaxy, int8_t); -DECLARE_SOA_COLUMN(DCAz, dcaz, int8_t); -DECLARE_SOA_COLUMN(Flags, flags, uint16_t); -DECLARE_SOA_COLUMN(TPCnsigma, tpcnsigma, uint8_t); -DECLARE_SOA_COLUMN(TOFmass, tofmass, uint8_t); -DECLARE_SOA_COLUMN(gPt, genPt, float); -DECLARE_SOA_COLUMN(gEta, genEta, float); -DECLARE_SOA_COLUMN(PDGcode, pdgCode, int); - -} // namespace NucleiTableNS -DECLARE_SOA_TABLE(NucleiTable, "AOD", "NUCLEITABLE", - NucleiTableNS::Pt, - NucleiTableNS::Eta, - NucleiTableNS::ITSclsMap, - NucleiTableNS::TPCnCls, - NucleiTableNS::DCAxy, - NucleiTableNS::DCAz, - NucleiTableNS::Flags, - NucleiTableNS::TPCnsigma, - NucleiTableNS::TOFmass) - -DECLARE_SOA_TABLE(NucleiTableMC, "AOD", "NUCLEITABLEMC", - NucleiTableNS::Pt, - NucleiTableNS::Eta, - NucleiTableNS::ITSclsMap, - NucleiTableNS::TPCnCls, - NucleiTableNS::DCAxy, - NucleiTableNS::DCAz, - NucleiTableNS::Flags, - NucleiTableNS::TPCnsigma, - NucleiTableNS::TOFmass, - NucleiTableNS::gPt, - NucleiTableNS::gEta, - NucleiTableNS::PDGcode) - -} // namespace o2::aod - -struct NucleiSpectraTask { +struct nucleiSpectra { enum { kDeuteron = BIT(0), kTriton = BIT(1), @@ -456,7 +413,7 @@ struct NucleiSpectraTask { nucleiTable(c.pt, c.eta, c.ITSclsMap, c.TPCnCls, c.DCAxy, c.DCAz, c.flags, c.TPCnsigma, c.TOFmass); } } - PROCESS_SWITCH(NucleiSpectraTask, processData, "Data analysis", true); + PROCESS_SWITCH(nucleiSpectra, processData, "Data analysis", true); void processMCrec(soa::Filtered>::iterator const& collision, TrackCandidates const& tracks, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC, aod::BCsWithTimestamps const&) { @@ -484,7 +441,7 @@ struct NucleiSpectraTask { } } } - PROCESS_SWITCH(NucleiSpectraTask, processMCrec, "MC analysis rec", false); + PROCESS_SWITCH(nucleiSpectra, processMCrec, "MC analysis rec", false); void processMCgen(aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) { @@ -523,11 +480,11 @@ struct NucleiSpectraTask { index++; } } - PROCESS_SWITCH(NucleiSpectraTask, processMCgen, "MC analysis gen", false); + PROCESS_SWITCH(nucleiSpectra, processMCgen, "MC analysis gen", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"nuclei-spectra"})}; + adaptAnalysisTask(cfgc, TaskName{"nuclei-spectra"})}; } diff --git a/PWGLF/Tasks/CMakeLists.txt b/PWGLF/Tasks/CMakeLists.txt index 2be2d30ef53..53d9c811e01 100644 --- a/PWGLF/Tasks/CMakeLists.txt +++ b/PWGLF/Tasks/CMakeLists.txt @@ -11,11 +11,6 @@ add_subdirectory(QC) -o2physics_add_dpl_workflow(hypertriton-reco-task - SOURCES hyperRecoTask.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(hyperon-reco-test SOURCES hyperon-reco-test.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -61,21 +56,6 @@ o2physics_add_dpl_workflow(spectra-tpc-tiny-pikapr PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(nuclei-spectra - SOURCES NucleiSpectraTask.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(nuclei-efficiency - SOURCES NucleiSpectraEfficiency.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(nuclei-efficiencylight - SOURCES NucleiSpectraEfficiencyLight.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(lambdakzeroanalysis SOURCES lambdakzeroanalysis.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGLF/Tasks/NucleiSpectraEfficiency.cxx b/PWGLF/Tasks/NucleiSpectraEfficiency.cxx deleted file mode 100644 index 3a0880e0910..00000000000 --- a/PWGLF/Tasks/NucleiSpectraEfficiency.cxx +++ /dev/null @@ -1,179 +0,0 @@ -// 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. -// O2 includes - -#include "ReconstructionDataFormats/Track.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Centrality.h" - -#include "Framework/HistogramRegistry.h" - -#include -#include -#include - -#include - -using namespace o2; -using namespace o2::framework; -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); -} - -#include "Framework/runDataProcessing.h" // important to declare after the options - -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) - { - histVertexTrueZ->Fill(mcCollision.posZ()); - } -}; - -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., 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("histGenPt", "generated particles", HistType::kTH1F, {ptAxis}); - } - - void process(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) - { - // - // loop over generated particles and fill generated particles - // - for (auto& mcParticleGen : mcParticles) { - if (mcParticleGen.pdgCode() != -1000020030) { - continue; - } - if (!mcParticleGen.isPhysicalPrimary()) { - continue; - } - if (abs(mcParticleGen.y()) > 0.5) { - continue; - } - spectra.fill(HIST("histGenPt"), 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("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.)"}}); - } - - 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) && (requireGlobalTrackInFilter()); - - using TrackCandidates = soa::Filtered>; - - void process(soa::Filtered>::iterator const& collision, - TrackCandidates const& tracks, aod::McParticles_000& mcParticles, aod::McCollisions const& mcCollisions) - { - // - // check the vertex-z distribution - // - spectra.fill(HIST("histRecVtxZ"), collision.posZ()); - // - // loop over reconstructed particles and fill reconstructed tracks - // - for (auto track : tracks) { - TLorentzVector lorentzVector{}; - lorentzVector.SetPtEtaPhiM(track.pt() * 2.0, track.eta(), track.phi(), constants::physics::MassHelium3); - 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()); - // - spectra.fill(HIST("histTpcSignal"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); - spectra.fill(HIST("histTpcNsigma"), track.tpcInnerParam(), nSigmaHe3); - // - // fill histograms - // - if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { - // check on perfect PID - if (track.mcParticle_as().pdgCode() != -1000020030) { - continue; - } - // fill reconstructed histogram - spectra.fill(HIST("histRecPt"), track.pt() * 2.0); - } - } - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - 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"})); - } - if (rec) { - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"nuclei-efficiency-rec"})); - } - // - return workflow; -} diff --git a/PWGLF/Tasks/NucleiSpectraEfficiencyLight.cxx b/PWGLF/Tasks/NucleiSpectraEfficiencyLight.cxx deleted file mode 100644 index c38759bb747..00000000000 --- a/PWGLF/Tasks/NucleiSpectraEfficiencyLight.cxx +++ /dev/null @@ -1,257 +0,0 @@ -// 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. -// O2 includes - -#include "ReconstructionDataFormats/Track.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoAHelpers.h" -#include "Common/DataModel/PIDResponse.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Common/DataModel/Centrality.h" - -#include "Framework/HistogramRegistry.h" - -#include -#include -#include - -#include - -using namespace o2; -using namespace o2::framework; -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); -} - -#include "Framework/runDataProcessing.h" // important to declare after the options - -struct NucleiSpectraEfficiencyLightVtx { - OutputObj histVertexTrueZ{TH1F("histVertexTrueZ", "MC true z position of z-vertex; vertex z (cm)", 200, -20., 20.)}; - - void process(aod::McCollision const& mcCollision) - { - histVertexTrueZ->Fill(mcCollision.posZ()); - } -}; - -struct NucleiSpectraEfficiencyLightGen { - - HistogramRegistry spectra{"spectraGen", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - - void init(o2::framework::InitContext&) - { - std::vector ptBinning = {0.0, 0.05, 0.1, 0.15, 0.2, 0.3, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, - 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4., 5., 6., 8., 10., 12., 14.}; - // - AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; - // - spectra.add("histGenPtPion", "generated particles", HistType::kTH1F, {ptAxis}); - spectra.add("histGenPtProton", "generated particles", HistType::kTH1F, {ptAxis}); - spectra.add("histGenPtHe3", "generated particles", HistType::kTH1F, {ptAxis}); - } - - void process(aod::McCollision const& mcCollision, aod::McParticles_000& mcParticles) - { - // - // loop over generated particles and fill generated particles - // - for (auto& mcParticleGen : mcParticles) { - if (!mcParticleGen.isPhysicalPrimary()) { - continue; - } - if (abs(mcParticleGen.y()) > 0.5) { - continue; - } - // - if (mcParticleGen.pdgCode() == 211) { - spectra.fill(HIST("histGenPtPion"), mcParticleGen.pt()); - } - if (mcParticleGen.pdgCode() == -2212) { - spectra.fill(HIST("histGenPtProton"), mcParticleGen.pt()); - } - if (mcParticleGen.pdgCode() == -1000020030) { - spectra.fill(HIST("histGenPtHe3"), mcParticleGen.pt()); - } - } - } -}; - -struct NucleiSpectraEfficiencyLightRec { - - HistogramRegistry spectra{"spectraRec", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; - - void init(o2::framework::InitContext&) - { - std::vector ptBinning = {0.0, 0.05, 0.1, 0.15, 0.2, 0.3, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, - 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4., 5., 6., 8., 10., 12., 14.}; - // - AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"}; - // - spectra.add("histEvSel", "eventselection", HistType::kTH1D, {{10, -0.5, 9.5}}); - spectra.add("histRecVtxZ", "collision z position", HistType::kTH1F, {{200, -20., +20., "z position (cm)"}}); - spectra.add("histRecPtPion", "reconstructed particles", HistType::kTH1F, {ptAxis}); - spectra.add("histRecPtProton", "reconstructed particles", HistType::kTH1F, {ptAxis}); - spectra.add("histRecPtHe3", "reconstructed particles", HistType::kTH1F, {ptAxis}); - spectra.add("histTpcSignal", "Specific energy loss", HistType::kTH2F, {{600, -6., 6., "#it{p/z} (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.2, "#beta (TOF)"}}); - spectra.add("histTpcNsigmaHe3", "n-sigmaHe3 TPC", HistType::kTH2F, {ptAxis, {200, -100., +100., "n#sigma_{He} (a. u.)"}}); - spectra.add("histTpcNsigmaPr", "n-sigmaPr TPC", HistType::kTH2F, {ptAxis, {200, -100., +100., "n#sigma_{Pr} (a. u.)"}}); - spectra.add("histTpcNsigmaPi", "n-sigmaPi TPC", HistType::kTH2F, {ptAxis, {200, -100., +100., "n#sigma_{Pi} (a. u.)"}}); - spectra.add("histItsClusters", "number of ITS clusters", HistType::kTH1F, {{10, -0.5, +9.5, "number of ITS clusters"}}); - spectra.add("histDcaXYprimary", "dca XY primary particles", HistType::kTH1F, {{200, -1., +1., "dca XY (cm)"}}); - spectra.add("histDcaXYsecondary", "dca XY secondary particles", HistType::kTH1F, {{200, -1., +1., "dca XY (cm)"}}); - } - - Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; - Configurable cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; - Configurable nsigmacutLow{"nsigmacutLow", -20.0, "Value of the Nsigma cut"}; - Configurable nsigmacutHigh{"nsigmacutHigh", +20.0, "Value of the Nsigma cut"}; - - Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; - //Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (requireGlobalTrackInFilter()); - - using TrackCandidates = soa::Join; - - void process(soa::Filtered>::iterator const& collision, - TrackCandidates const& tracks, aod::McParticles_000& mcParticles, aod::McCollisions const& mcCollisions) - { - // - // check event selection - // - spectra.get(HIST("histEvSel"))->Fill("all", 1.f); - if (collision.sel8()) { - spectra.get(HIST("histEvSel"))->Fill("sel8", 1.f); - } else { - return; - } - // - // check the vertex-z distribution - // - spectra.fill(HIST("histRecVtxZ"), collision.posZ()); - // - // loop over reconstructed particles and fill reconstructed tracks - // - for (auto track : tracks) { - // - // apply minimal cuts - // - if (track.itsNCls() == 0) { - continue; - } - // - // fill QA histograms - // - float nSigmaHe3 = track.tpcNSigmaHe(); - nSigmaHe3 += 94.222101 * TMath::Exp(-0.905203 * track.tpcInnerParam()); - float nSigmaPr = track.tpcNSigmaPr(); - float nSigmaPi = track.tpcNSigmaPi(); - // - // TPC-QA - // - spectra.fill(HIST("histTpcSignal"), track.tpcInnerParam() * track.sign(), track.tpcSignal()); - // - spectra.fill(HIST("histTpcNsigmaPi"), track.tpcInnerParam(), nSigmaPi); - spectra.fill(HIST("histTpcNsigmaPr"), track.tpcInnerParam(), nSigmaPr); - spectra.fill(HIST("histTpcNsigmaHe3"), track.tpcInnerParam(), nSigmaHe3); - // - // ITS-QA - // - spectra.fill(HIST("histItsClusters"), track.itsNCls()); - // - /* - // TOF-QA - // - if (track.hasTOF()) { - Float_t tofTime = track.tofSignal(); - Float_t tofLength = track.length(); - Float_t beta = tofLength / (TMath::C() * 1e-10 * tofTime); - spectra.fill(HIST("histTofSignalData"), track.tpcInnerParam() * track.sign(), beta); - } - */ - // - // dca to primary vertex -- wait for tracksextented - // - //spectra.fill(HIST("histDcaXYprimary"), track.dcaXY()); - // - // fill histograms for pions - // - if (nSigmaPi > nsigmacutLow && nSigmaPi < nsigmacutHigh) { - // check on perfect PID - if (track.mcParticle_as().pdgCode() == 211 && track.mcParticle_as().isPhysicalPrimary()) { - TLorentzVector lorentzVector{}; - lorentzVector.SetPtEtaPhiM(track.pt(), track.eta(), track.phi(), constants::physics::MassPionCharged); - if (lorentzVector.Rapidity() > -0.5 && lorentzVector.Rapidity() < 0.5) { - spectra.fill(HIST("histRecPtPion"), track.pt()); - } - } - } - // - // fill histograms for protons - // - if (nSigmaPr > nsigmacutLow && nSigmaPr < nsigmacutHigh) { - // check on perfect PID - if (track.mcParticle_as().pdgCode() == -2212 && track.mcParticle_as().isPhysicalPrimary()) { - TLorentzVector lorentzVector{}; - lorentzVector.SetPtEtaPhiM(track.pt(), track.eta(), track.phi(), constants::physics::MassProton); - if (lorentzVector.Rapidity() > -0.5 && lorentzVector.Rapidity() < 0.5) { - spectra.fill(HIST("histRecPtProton"), track.pt()); - } - } - } - // - // fill histograms for he3 - // - if (nSigmaHe3 > nsigmacutLow && nSigmaHe3 < nsigmacutHigh) { - // check on perfect PID - if (track.mcParticle_as().pdgCode() == -1000020030) { - TLorentzVector lorentzVector{}; - lorentzVector.SetPtEtaPhiM(track.pt() * 2.0, track.eta(), track.phi(), constants::physics::MassHelium3); - if (lorentzVector.Rapidity() > -0.5 && lorentzVector.Rapidity() < 0.5) { - // fill reconstructed histogram - spectra.fill(HIST("histRecPtHe3"), track.pt() * 2.0); - } - } - } - } - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - 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"})); - } - if (rec) { - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"nuclei-efficiency-rec"})); - } - // - return workflow; -}