diff --git a/PWGCF/Femto3D/TableProducer/singleTrackSelectorPIDMaker.cxx b/PWGCF/Femto3D/TableProducer/singleTrackSelectorPIDMaker.cxx new file mode 100644 index 00000000000..bf2a25dea7e --- /dev/null +++ b/PWGCF/Femto3D/TableProducer/singleTrackSelectorPIDMaker.cxx @@ -0,0 +1,156 @@ +// 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 singleTrackSelectorPIDMaker.cxx +/// \brief creates dummy tables for PID columns that are not in the derived data +/// \author Sofia Tomassini, Gleb Romanenko, Nicolò Jacazio +/// \since 22 January 2025 + +#include +#include +#include + +#include "PWGCF/Femto3D/DataModel/singletrackselector.h" + +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::track; +using namespace o2::aod; +//::singletrackselector; // the namespace defined in .h + +template +struct StPid { + Produces table; + void process(o2::aod::SingleTrackSels const& tracks) + { + table.reserve(tracks.size()); + for (int i = 0; i < tracks.size(); i++) { + table(singletrackselector::binning::nsigma::underflowBin, + singletrackselector::binning::nsigma::underflowBin); + } + } +}; + +struct StPidEl { + Produces table; + void process(o2::aod::SingleTrackSels const& tracks) + { + table.reserve(tracks.size()); + for (int i = 0; i < tracks.size(); i++) { + table(singletrackselector::binning::nsigma::underflowBin, + singletrackselector::binning::nsigma::underflowBin); + } + } +}; +struct StPidPi { + Produces table; + void process(o2::aod::SingleTrackSels const& tracks) + { + table.reserve(tracks.size()); + for (int i = 0; i < tracks.size(); i++) { + table(singletrackselector::binning::nsigma::underflowBin, + singletrackselector::binning::nsigma::underflowBin); + } + } +}; +struct StPidKa { + Produces table; + void process(o2::aod::SingleTrackSels const& tracks) + { + table.reserve(tracks.size()); + for (int i = 0; i < tracks.size(); i++) { + table(singletrackselector::binning::nsigma::underflowBin, + singletrackselector::binning::nsigma::underflowBin); + } + } +}; +struct StPidPr { + Produces table; + void process(o2::aod::SingleTrackSels const& tracks) + { + table.reserve(tracks.size()); + for (int i = 0; i < tracks.size(); i++) { + table(singletrackselector::binning::nsigma::underflowBin, + singletrackselector::binning::nsigma::underflowBin); + } + } +}; +struct StPidDe { + Produces table; + void process(o2::aod::SingleTrackSels const& tracks) + { + table.reserve(tracks.size()); + for (int i = 0; i < tracks.size(); i++) { + table(singletrackselector::binning::nsigma::underflowBin, + singletrackselector::binning::nsigma::underflowBin); + } + } +}; +struct StPidHe { + Produces table; + void process(o2::aod::SingleTrackSels const& tracks) + { + table.reserve(tracks.size()); + for (int i = 0; i < tracks.size(); i++) { + table(singletrackselector::binning::nsigma::underflowBin, + singletrackselector::binning::nsigma::underflowBin); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + auto workflow = WorkflowSpec{}; + + // Check if 'aod-metadata-tables' option is available in the config context + if (cfgc.options().hasOption("aod-metadata-tables")) { + const std::vector tables = cfgc.options().get>("aod-metadata-tables"); + + // Map of table names to their corresponding converter task functions + std::unordered_map>> tableToTasks = { + {"O2singlepidel", {[&]() { workflow.push_back(adaptAnalysisTask(cfgc)); }}}, + {"O2singlepidpi", {[&]() { workflow.push_back(adaptAnalysisTask(cfgc)); }}}, + {"O2singlepidka", {[&]() { workflow.push_back(adaptAnalysisTask(cfgc)); }}}, + {"O2singlepidpr", {[&]() { workflow.push_back(adaptAnalysisTask(cfgc)); }}}, + {"O2singlepidde", {[&]() { workflow.push_back(adaptAnalysisTask(cfgc)); }}}, + {"O2singlepidhe", {[&]() { workflow.push_back(adaptAnalysisTask(cfgc)); }}} + + }; + + for (auto const& tableInWorkflow : tables) { + LOG(info) << tableInWorkflow; + } + + // Iterate through the tables and process based on the mapping + for (auto const& table : tableToTasks) { + bool foundIt = false; + for (auto const& tableInWorkflow : tables) { + if (tableInWorkflow == table.first) { + foundIt = true; + break; + } + } + if (foundIt) + continue; + for (auto const& task : table.second) { + LOG(info) << "Adding task " << table.first; + task(); + } + } + } else { + LOG(warning) << "AOD converter: No tables found in the meta data"; + } + return workflow; +}