diff --git a/Common/DataModel/SelectionStudyTables.h b/Common/DataModel/SelectionStudyTables.h new file mode 100644 index 00000000000..3a62c30b267 --- /dev/null +++ b/Common/DataModel/SelectionStudyTables.h @@ -0,0 +1,57 @@ +// 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 SelectionStudyTables +/// \brief tables meant to do event selection studies for O-O / light systems +/// +/// \author ALICE + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" + +#include + +#ifndef COMMON_DATAMODEL_SELECTIONSTUDYTABLES_H_ +#define COMMON_DATAMODEL_SELECTIONSTUDYTABLES_H_ + +namespace o2::aod +{ +namespace selectionstudy +{ +DECLARE_SOA_COLUMN(PtPions, ptPions, std::vector); +DECLARE_SOA_COLUMN(PtKaons, ptKaons, std::vector); +DECLARE_SOA_COLUMN(PtProtons, ptProtons, std::vector); +DECLARE_SOA_COLUMN(PtK0s, ptPK0s, std::vector); +DECLARE_SOA_COLUMN(PtLambdas, ptLambdas, std::vector); +DECLARE_SOA_COLUMN(PtXis, ptXis, std::vector); +DECLARE_SOA_COLUMN(PtOmegas, ptOmegas, std::vector); +DECLARE_SOA_COLUMN(PtPhis, ptPhis, std::vector); +DECLARE_SOA_COLUMN(PtKStars, ptKStars, std::vector); +DECLARE_SOA_COLUMN(PtDs, ptDs, std::vector); +DECLARE_SOA_COLUMN(PtLambdaCs, ptLambdaCs, std::vector); +DECLARE_SOA_COLUMN(PtJPsis, ptJPsis, std::vector); +} // namespace selectionstudy + +DECLARE_SOA_TABLE(PIDPts, "AOD", "PIDPTS", o2::soa::Index<>, + o2::aod::selectionstudy::PtPions, + o2::aod::selectionstudy::PtKaons, + o2::aod::selectionstudy::PtProtons, + o2::aod::selectionstudy::PtK0s, + o2::aod::selectionstudy::PtLambdas, + o2::aod::selectionstudy::PtXis, + o2::aod::selectionstudy::PtOmegas, + o2::aod::selectionstudy::PtPhis, + o2::aod::selectionstudy::PtKStars, + o2::aod::selectionstudy::PtDs, + o2::aod::selectionstudy::PtLambdaCs, + o2::aod::selectionstudy::PtJPsis); +} // namespace o2::aod +#endif // COMMON_DATAMODEL_SELECTIONSTUDYTABLES_H_ diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index 62211406807..502f3c3d076 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -160,3 +160,7 @@ o2physics_add_dpl_workflow(muon-realignment PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2::DetectorsCommonDataFormats O2::MathUtils O2::MCHTracking O2::DataFormatsMCH O2::GlobalTracking O2::MCHBase O2::MCHGeometryTransformer O2::CommonUtils COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(selectionstudytable + SOURCES selectionStudyTable.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/Common/TableProducer/selectionStudyTable.cxx b/Common/TableProducer/selectionStudyTable.cxx new file mode 100644 index 00000000000..4d27e358ed1 --- /dev/null +++ b/Common/TableProducer/selectionStudyTable.cxx @@ -0,0 +1,133 @@ +// 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 selectionStudyTable.cxx +/// \brief Produces tables for centrality selection bias studies +/// +/// \author ALICE +/// + +#include "Common/DataModel/SelectionStudyTables.h" + +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ConfigParamSpec.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" +#include "Framework/runDataProcessing.h" + +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct SelectionStudyTable { + Produces pidpts; + + // could be done in a vector of vectors + // left for future iteration + std::vector ptpi; + std::vector ptka; + std::vector ptpr; + std::vector ptk0; + std::vector ptla; + std::vector ptxi; + std::vector ptom; + std::vector ptph; + std::vector ptks; + std::vector ptd; + std::vector ptlc; + std::vector ptjp; + + void init(InitContext&) + { + } + + void process(aod::McCollision const&, aod::McParticles const& mcParticles) + { + ptpi.clear(); + ptka.clear(); + ptpr.clear(); + ptk0.clear(); + ptla.clear(); + ptxi.clear(); + ptom.clear(); + ptph.clear(); + ptks.clear(); + ptd.clear(); + ptlc.clear(); + ptjp.clear(); + for (auto const& mcPart : mcParticles) { + if (std::fabs(mcPart.y()) > 0.5) { + continue; // only do midrapidity particles + } + + // handle resonances first to make sure phys prim crit does not reject them + if (mcPart.pdgCode() == 333) { + ptph.push_back(mcPart.pt()); + } + if (std::abs(mcPart.pdgCode()) == 313) { + ptks.push_back(mcPart.pt()); + } + + // resonances handled, move to primaries + if (!mcPart.isPhysicalPrimary()) { + continue; + } + if (std::abs(mcPart.pdgCode()) == 211) { + ptpi.push_back(mcPart.pt()); + } + if (std::abs(mcPart.pdgCode()) == 321) { + ptka.push_back(mcPart.pt()); + } + if (std::abs(mcPart.pdgCode()) == 2212) { + ptpr.push_back(mcPart.pt()); + } + if (std::abs(mcPart.pdgCode()) == 310) { + ptk0.push_back(mcPart.pt()); + } + if (std::abs(mcPart.pdgCode()) == 3122) { + ptla.push_back(mcPart.pt()); + } + if (std::abs(mcPart.pdgCode()) == 3312) { + ptxi.push_back(mcPart.pt()); + } + if (std::abs(mcPart.pdgCode()) == 3334) { + ptom.push_back(mcPart.pt()); + } + if (std::abs(mcPart.pdgCode()) == 3334) { + ptom.push_back(mcPart.pt()); + } + // inclusive HF for now + if (std::abs(mcPart.pdgCode()) == 421) { + ptd.push_back(mcPart.pt()); + } + if (std::abs(mcPart.pdgCode()) == 4122) { + ptd.push_back(mcPart.pt()); + } + if (std::abs(mcPart.pdgCode()) == 443) { + ptjp.push_back(mcPart.pt()); + } + } + + pidpts(ptpi, ptka, ptpr, ptk0, ptla, ptxi, ptom, ptph, ptks, ptd, ptlc, ptjp); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +}