From ba059a8caebfff699db438fe7c7c22bbda833ad6 Mon Sep 17 00:00:00 2001 From: David Dobrigkeit Chinellato Date: Sun, 16 Apr 2023 05:49:58 -0300 Subject: [PATCH 1/4] initial tutorial --- CODEOWNERS | 2 +- Tutorials/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index bc16b94cea1..584764c16e3 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -49,5 +49,5 @@ /Tutorials/PWGHF @alibuild @ginnocen @vkucera @fcolamar /Tutorials/PWGJE @alibuild @lhavener @maoyx @nzardosh @ddobrigk @mfasDa /Tutorials/PWGLF @alibuild @alcaliva @lbariogl @chiarapinto @BongHwi @lbarnby @mbombara @iravasen @njacazio @ChiaraDeMartin95 @skundu692 -/Tutorials/PWGMM @alibuild @aalkin +/Tutorials/PWGMM @alibuild @aalkin @ddobrigk /Tutorials/PWGUD @alibuild @pbuehler diff --git a/Tutorials/CMakeLists.txt b/Tutorials/CMakeLists.txt index 5247a5491fb..b66dabf4fbe 100644 --- a/Tutorials/CMakeLists.txt +++ b/Tutorials/CMakeLists.txt @@ -15,6 +15,7 @@ add_subdirectory(ML) add_subdirectory(PWGEM) add_subdirectory(PWGLF) add_subdirectory(PWGCF) +add_subdirectory(PWGMM) o2physics_add_dpl_workflow(histogram-track-selection SOURCES src/histogramTrackSelection.cxx From b9e77c49f03145e35514afb21b14ca5ea026343d Mon Sep 17 00:00:00 2001 From: David Dobrigkeit Chinellato Date: Sun, 16 Apr 2023 05:50:22 -0300 Subject: [PATCH 2/4] Add files --- Tutorials/PWGMM/CMakeLists.txt | 16 +++++++++++ Tutorials/PWGMM/myExampleTask.cxx | 48 +++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 Tutorials/PWGMM/CMakeLists.txt create mode 100644 Tutorials/PWGMM/myExampleTask.cxx diff --git a/Tutorials/PWGMM/CMakeLists.txt b/Tutorials/PWGMM/CMakeLists.txt new file mode 100644 index 00000000000..67b87c9847f --- /dev/null +++ b/Tutorials/PWGMM/CMakeLists.txt @@ -0,0 +1,16 @@ +# 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. + +# Basic analysis tutorial +o2physics_add_dpl_workflow(my-example-task + SOURCES myExampleTask.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) \ No newline at end of file diff --git a/Tutorials/PWGMM/myExampleTask.cxx b/Tutorials/PWGMM/myExampleTask.cxx new file mode 100644 index 00000000000..3619b37cc14 --- /dev/null +++ b/Tutorials/PWGMM/myExampleTask.cxx @@ -0,0 +1,48 @@ +// 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. +/// +/// \brief This task is an empty skeleton that fills a simple eta histogram. +/// it is meant to be a blank page for further developments. +/// \author everyone + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" + +using namespace o2; +using namespace o2::framework; + +struct myExampleTask { + // Histogram registry: an object to hold your histograms + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext const&) + { + // define axes you want to use + const AxisSpec axisEta{30, -1.5, +1.5, "#eta"}; + + // create histograms + histos.add("etaHistogram", "etaHistogram", kTH1F, {axisEta}); + } + + void process(aod::TracksIU const& tracks) + { + for (auto& track : tracks) { + histos.fill(HIST("etaHistogram"), track.eta()); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc) + }; +} \ No newline at end of file From bf4293bbc2075ae832af7d5412b8ffe44c48f9ea Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Sun, 16 Apr 2023 10:52:15 +0200 Subject: [PATCH 3/4] Please consider the following formatting changes (#98) --- Tutorials/PWGMM/myExampleTask.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Tutorials/PWGMM/myExampleTask.cxx b/Tutorials/PWGMM/myExampleTask.cxx index 3619b37cc14..0993edac265 100644 --- a/Tutorials/PWGMM/myExampleTask.cxx +++ b/Tutorials/PWGMM/myExampleTask.cxx @@ -22,7 +22,7 @@ using namespace o2::framework; struct myExampleTask { // Histogram registry: an object to hold your histograms HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - + void init(InitContext const&) { // define axes you want to use @@ -43,6 +43,5 @@ struct myExampleTask { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc) - }; + adaptAnalysisTask(cfgc)}; } \ No newline at end of file From 5472644471339da79e1c3a28fdfc11adb022c967 Mon Sep 17 00:00:00 2001 From: David Dobrigkeit Chinellato Date: Sun, 16 Apr 2023 08:44:29 -0300 Subject: [PATCH 4/4] Add newlines at EOF --- Tutorials/PWGMM/CMakeLists.txt | 2 +- Tutorials/PWGMM/myExampleTask.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tutorials/PWGMM/CMakeLists.txt b/Tutorials/PWGMM/CMakeLists.txt index 67b87c9847f..8b1b3775957 100644 --- a/Tutorials/PWGMM/CMakeLists.txt +++ b/Tutorials/PWGMM/CMakeLists.txt @@ -13,4 +13,4 @@ o2physics_add_dpl_workflow(my-example-task SOURCES myExampleTask.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME AnalysisTutorial) \ No newline at end of file + COMPONENT_NAME AnalysisTutorial) diff --git a/Tutorials/PWGMM/myExampleTask.cxx b/Tutorials/PWGMM/myExampleTask.cxx index 0993edac265..f7035781b6e 100644 --- a/Tutorials/PWGMM/myExampleTask.cxx +++ b/Tutorials/PWGMM/myExampleTask.cxx @@ -44,4 +44,4 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ adaptAnalysisTask(cfgc)}; -} \ No newline at end of file +}