Skip to content

Commit f2d2dce

Browse files
[PWG-LF] tutorial update (#7666)
* Add LF Strangeness exercises for O2AT Oct 2024 * Add CMakeLists for old tutorial * Remove JSON files * Final adjustments for O2AT * Add link to O2AT page in README file --------- Co-authored-by: romainschotter <romain.schotter@gmail.com> Co-authored-by: SCHOTTER Romain <47983209+romainschotter@users.noreply.github.com>
1 parent cf8bbac commit f2d2dce

24 files changed

Lines changed: 1390 additions & 28 deletions

Tutorials/PWGLF/Strangeness/CMakeLists.txt

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,6 @@
99
# granted to it by virtue of its status as an Intergovernmental Organization
1010
# or submit itself to any jurisdiction.
1111

12-
# Strangeness analysis tutorial
13-
o2physics_add_dpl_workflow(strangeness-step0
14-
SOURCES strangeness_step0.cxx
15-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
16-
COMPONENT_NAME AnalysisTutorial)
12+
add_subdirectory(pp)
13+
add_subdirectory(PbPb)
1714

18-
o2physics_add_dpl_workflow(strangeness-step1
19-
SOURCES strangeness_step1.cxx
20-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
21-
COMPONENT_NAME AnalysisTutorial)
22-
23-
o2physics_add_dpl_workflow(strangeness-step2
24-
SOURCES strangeness_step2.cxx
25-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
26-
COMPONENT_NAME AnalysisTutorial)
27-
28-
o2physics_add_dpl_workflow(strangeness-step3
29-
SOURCES strangeness_step3.cxx
30-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
31-
COMPONENT_NAME AnalysisTutorial)
32-
33-
o2physics_add_dpl_workflow(strangeness-step4
34-
SOURCES strangeness_step4.cxx
35-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
36-
COMPONENT_NAME AnalysisTutorial)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
# All rights not expressly granted are reserved.
4+
#
5+
# This software is distributed under the terms of the GNU General Public
6+
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
#
8+
# In applying this license CERN does not waive the privileges and immunities
9+
# granted to it by virtue of its status as an Intergovernmental Organization
10+
# or submit itself to any jurisdiction.
11+
12+
o2physics_add_dpl_workflow(strangeness-pbpb-skeleton
13+
SOURCES strangeness_pbpb_skeleton.cxx
14+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
15+
COMPONENT_NAME AnalysisTutorial)
16+
17+
o2physics_add_dpl_workflow(strangeness-pbpb-step0
18+
SOURCES strangeness_pbpb_step0.cxx
19+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
20+
COMPONENT_NAME AnalysisTutorial)
21+
22+
o2physics_add_dpl_workflow(strangeness-pbpb-step1
23+
SOURCES strangeness_pbpb_step1.cxx
24+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
25+
COMPONENT_NAME AnalysisTutorial)
26+
27+
o2physics_add_dpl_workflow(strangeness-pbpb-step2
28+
SOURCES strangeness_pbpb_step2.cxx
29+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
30+
COMPONENT_NAME AnalysisTutorial)
31+
32+
o2physics_add_dpl_workflow(strangeness-pbpb-step3
33+
SOURCES strangeness_pbpb_step3.cxx
34+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
35+
COMPONENT_NAME AnalysisTutorial)
36+
37+
o2physics_add_dpl_workflow(strangeness-pbpb-step4
38+
SOURCES strangeness_pbpb_step4.cxx
39+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
40+
COMPONENT_NAME AnalysisTutorial)
41+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# log file where the terminal output will be saved
3+
STEP="skeleton"
4+
LOGFILE="log-${STEP}.txt"
5+
6+
#directory of this script
7+
DIR_THIS=$PWD
8+
9+
OPTION="-b --configuration json://configuration_skeleton.json"
10+
11+
o2-analysistutorial-lf-strangeness-pbpb-skeleton "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1
12+
13+
# report status
14+
rc=$?
15+
if [ $rc -eq 0 ]; then
16+
echo "No problems!"
17+
mkdir -p "${DIR_THIS}/results/${STEP}"
18+
mv AnalysisResults.root "${DIR_THIS}/results/${STEP}/AnalysisResults.root"
19+
mv dpl-config.json "${DIR_THIS}/results/${STEP}/${STEP}.json"
20+
else
21+
echo "Error: Exit code ${rc}"
22+
echo "Check the log file ${LOGFILE}"
23+
exit ${rc}
24+
fi
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# log file where the terminal output will be saved
3+
STEP="0"
4+
LOGFILE="log-${STEP}.txt"
5+
6+
#directory of this script
7+
DIR_THIS=$PWD
8+
9+
OPTION="-b --configuration json://configuration_step0.json"
10+
11+
o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step0 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1
12+
13+
# report status
14+
rc=$?
15+
if [ $rc -eq 0 ]; then
16+
echo "No problems!"
17+
mkdir -p "${DIR_THIS}/results/step${STEP}"
18+
mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root"
19+
mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json"
20+
else
21+
echo "Error: Exit code ${rc}"
22+
echo "Check the log file ${LOGFILE}"
23+
exit ${rc}
24+
fi
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# log file where the terminal output will be saved
3+
STEP="1"
4+
LOGFILE="log-${STEP}.txt"
5+
6+
#directory of this script
7+
DIR_THIS=$PWD
8+
9+
OPTION="-b --configuration json://configuration_step1.json"
10+
11+
o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step1 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1
12+
13+
# report status
14+
rc=$?
15+
if [ $rc -eq 0 ]; then
16+
echo "No problems!"
17+
mkdir -p "${DIR_THIS}/results/step${STEP}"
18+
mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root"
19+
mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json"
20+
else
21+
echo "Error: Exit code ${rc}"
22+
echo "Check the log file ${LOGFILE}"
23+
exit ${rc}
24+
fi
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# log file where the terminal output will be saved
3+
STEP="2"
4+
LOGFILE="log-${STEP}.txt"
5+
6+
#directory of this script
7+
DIR_THIS=$PWD
8+
9+
OPTION="-b --configuration json://configuration_step2.json"
10+
11+
o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step2 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1
12+
13+
# report status
14+
rc=$?
15+
if [ $rc -eq 0 ]; then
16+
echo "No problems!"
17+
mkdir -p "${DIR_THIS}/results/step${STEP}"
18+
mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root"
19+
mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json"
20+
else
21+
echo "Error: Exit code ${rc}"
22+
echo "Check the log file ${LOGFILE}"
23+
exit ${rc}
24+
fi
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# log file where the terminal output will be saved
3+
STEP="3"
4+
LOGFILE="log-${STEP}.txt"
5+
6+
#directory of this script
7+
DIR_THIS=$PWD
8+
9+
OPTION="-b --configuration json://configuration_step3.json"
10+
11+
o2-analysis-lf-cascadepid "${OPTION}" | o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step3 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1
12+
13+
# report status
14+
rc=$?
15+
if [ $rc -eq 0 ]; then
16+
echo "No problems!"
17+
mkdir -p "${DIR_THIS}/results/step${STEP}"
18+
mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root"
19+
mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json"
20+
else
21+
echo "Error: Exit code ${rc}"
22+
echo "Check the log file ${LOGFILE}"
23+
exit ${rc}
24+
fi
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# log file where the terminal output will be saved
3+
STEP="4"
4+
LOGFILE="log-${STEP}.txt"
5+
6+
#directory of this script
7+
DIR_THIS=$PWD
8+
9+
OPTION="-b --configuration json://configuration_step4.json"
10+
11+
o2-analysis-lf-cascadepid "${OPTION}" | o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step4 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1
12+
13+
# report status
14+
rc=$?
15+
if [ $rc -eq 0 ]; then
16+
echo "No problems!"
17+
mkdir -p "${DIR_THIS}/results/step${STEP}"
18+
mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root"
19+
mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json"
20+
else
21+
echo "Error: Exit code ${rc}"
22+
echo "Check the log file ${LOGFILE}"
23+
exit ${rc}
24+
fi
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
///
12+
/// \brief Step4 of the Strangeness tutorial
13+
/// \author Romain Schotter
14+
/// based on the original codes from:
15+
/// \author Nepeivoda Roman (roman.nepeivoda@cern.ch)
16+
/// \author Chiara De Martin (chiara.de.martin@cern.ch)
17+
18+
#include "Framework/runDataProcessing.h"
19+
#include "Framework/AnalysisTask.h"
20+
#include "Common/DataModel/EventSelection.h"
21+
#include "PWGLF/DataModel/LFStrangenessTables.h"
22+
#include "Framework/O2DatabasePDGPlugin.h"
23+
24+
using namespace o2;
25+
using namespace o2::framework;
26+
using namespace o2::framework::expressions;
27+
28+
struct strangeness_pbpb_tutorial {
29+
// Histograms are defined with HistogramRegistry
30+
HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
31+
32+
// Configurable for histograms
33+
Configurable<int> nBins{"nBins", 100, "N bins in all histos"};
34+
35+
// Configurable for event selection
36+
Configurable<float> cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"};
37+
38+
// PDG data base
39+
Service<o2::framework::O2DatabasePDG> pdgDB;
40+
41+
void init(InitContext const&)
42+
{
43+
// Axes
44+
AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm]"};
45+
46+
// Histograms
47+
// Event selection
48+
rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}});
49+
}
50+
51+
// Defining filters for events (event selection)
52+
// Processed events will be already fulfilling the event selection requirements
53+
Filter eventFilter = (o2::aod::evsel::sel8 == true);
54+
Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex);
55+
56+
void process(soa::Filtered<soa::Join<aod::StraCollisions, aod::StraEvSels>>::iterator const& collision)
57+
{
58+
// Fill the event counter
59+
rEventSelection.fill(HIST("hVertexZRec"), collision.posZ());
60+
}
61+
};
62+
63+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
64+
{
65+
return WorkflowSpec{
66+
adaptAnalysisTask<strangeness_pbpb_tutorial>(cfgc)};
67+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
///
12+
/// \brief Step4 of the Strangeness tutorial
13+
/// \author Romain Schotter
14+
/// based on the original codes from:
15+
/// \author Nepeivoda Roman (roman.nepeivoda@cern.ch)
16+
/// \author Chiara De Martin (chiara.de.martin@cern.ch)
17+
18+
#include "Framework/runDataProcessing.h"
19+
#include "Framework/AnalysisTask.h"
20+
#include "Common/DataModel/EventSelection.h"
21+
#include "PWGLF/DataModel/LFStrangenessTables.h"
22+
#include "Framework/O2DatabasePDGPlugin.h"
23+
24+
using namespace o2;
25+
using namespace o2::framework;
26+
using namespace o2::framework::expressions;
27+
28+
// STEP 0
29+
// Starting point: loop over all cascades and fill invariant mass histogram
30+
31+
struct strangeness_pbpb_tutorial {
32+
// Histograms are defined with HistogramRegistry
33+
HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
34+
HistogramRegistry rXi{"xi", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
35+
HistogramRegistry rOmega{"omega", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
36+
37+
// Configurable for histograms
38+
Configurable<int> nBins{"nBins", 100, "N bins in all histos"};
39+
40+
// Configurable for event selection
41+
Configurable<float> cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"};
42+
43+
// PDG data base
44+
Service<o2::framework::O2DatabasePDG> pdgDB;
45+
46+
void init(InitContext const&)
47+
{
48+
// Axes
49+
AxisSpec XiMassAxis = {100, 1.28f, 1.36f, "#it{M}_{inv} [GeV/#it{c}^{2}]"};
50+
AxisSpec OmegaMassAxis = {100, 1.63f, 1.7f, "#it{M}_{inv} [GeV/#it{c}^{2}]"};
51+
AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm]"};
52+
53+
// Histograms
54+
// Event selection
55+
rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}});
56+
57+
// Xi/Omega reconstruction
58+
rXi.add("hMassXi", "hMassXi", {HistType::kTH1F, {XiMassAxis}});
59+
60+
rOmega.add("hMassOmega", "hMassOmega", {HistType::kTH1F, {OmegaMassAxis}});
61+
}
62+
63+
// Defining filters for events (event selection)
64+
// Processed events will be already fulfilling the event selection requirements
65+
Filter eventFilter = (o2::aod::evsel::sel8 == true);
66+
Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex);
67+
68+
void process(soa::Filtered<soa::Join<aod::StraCollisions, aod::StraEvSels>>::iterator const& collision,
69+
aod::CascCores const& Cascades)
70+
{
71+
// Fill the event counter
72+
rEventSelection.fill(HIST("hVertexZRec"), collision.posZ());
73+
74+
// Cascades
75+
for (const auto& casc : Cascades) {
76+
rXi.fill(HIST("hMassXi"), casc.mXi());
77+
rOmega.fill(HIST("hMassOmega"), casc.mOmega());
78+
}
79+
}
80+
};
81+
82+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
83+
{
84+
return WorkflowSpec{
85+
adaptAnalysisTask<strangeness_pbpb_tutorial>(cfgc)};
86+
}

0 commit comments

Comments
 (0)