Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PWG-LF] tutorial update #7666

Merged
merged 14 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions Tutorials/PWGLF/Strangeness/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,6 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

# Strangeness analysis tutorial
o2physics_add_dpl_workflow(strangeness-step0
SOURCES strangeness_step0.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)
add_subdirectory(pp)
add_subdirectory(PbPb)

o2physics_add_dpl_workflow(strangeness-step1
SOURCES strangeness_step1.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)

o2physics_add_dpl_workflow(strangeness-step2
SOURCES strangeness_step2.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)

o2physics_add_dpl_workflow(strangeness-step3
SOURCES strangeness_step3.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)

o2physics_add_dpl_workflow(strangeness-step4
SOURCES strangeness_step4.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)
41 changes: 41 additions & 0 deletions Tutorials/PWGLF/Strangeness/PbPb/Analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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.

o2physics_add_dpl_workflow(strangeness-pbpb-skeleton
SOURCES strangeness_pbpb_skeleton.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)

o2physics_add_dpl_workflow(strangeness-pbpb-step0
SOURCES strangeness_pbpb_step0.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)

o2physics_add_dpl_workflow(strangeness-pbpb-step1
SOURCES strangeness_pbpb_step1.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)

o2physics_add_dpl_workflow(strangeness-pbpb-step2
SOURCES strangeness_pbpb_step2.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)

o2physics_add_dpl_workflow(strangeness-pbpb-step3
SOURCES strangeness_pbpb_step3.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)

o2physics_add_dpl_workflow(strangeness-pbpb-step4
SOURCES strangeness_pbpb_step4.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME AnalysisTutorial)

24 changes: 24 additions & 0 deletions Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_skeleton.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# log file where the terminal output will be saved
STEP="skeleton"
LOGFILE="log-${STEP}.txt"

#directory of this script
DIR_THIS=$PWD

OPTION="-b --configuration json://configuration_skeleton.json"

o2-analysistutorial-lf-strangeness-pbpb-skeleton "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1

# report status
rc=$?
if [ $rc -eq 0 ]; then
echo "No problems!"
mkdir -p "${DIR_THIS}/results/${STEP}"
mv AnalysisResults.root "${DIR_THIS}/results/${STEP}/AnalysisResults.root"
mv dpl-config.json "${DIR_THIS}/results/${STEP}/${STEP}.json"
else
echo "Error: Exit code ${rc}"
echo "Check the log file ${LOGFILE}"
exit ${rc}
fi
24 changes: 24 additions & 0 deletions Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# log file where the terminal output will be saved
STEP="0"
LOGFILE="log-${STEP}.txt"

#directory of this script
DIR_THIS=$PWD

OPTION="-b --configuration json://configuration_step0.json"

o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step0 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1

# report status
rc=$?
if [ $rc -eq 0 ]; then
echo "No problems!"
mkdir -p "${DIR_THIS}/results/step${STEP}"
mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root"
mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json"
else
echo "Error: Exit code ${rc}"
echo "Check the log file ${LOGFILE}"
exit ${rc}
fi
24 changes: 24 additions & 0 deletions Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# log file where the terminal output will be saved
STEP="1"
LOGFILE="log-${STEP}.txt"

#directory of this script
DIR_THIS=$PWD

OPTION="-b --configuration json://configuration_step1.json"

o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step1 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1

# report status
rc=$?
if [ $rc -eq 0 ]; then
echo "No problems!"
mkdir -p "${DIR_THIS}/results/step${STEP}"
mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root"
mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json"
else
echo "Error: Exit code ${rc}"
echo "Check the log file ${LOGFILE}"
exit ${rc}
fi
24 changes: 24 additions & 0 deletions Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# log file where the terminal output will be saved
STEP="2"
LOGFILE="log-${STEP}.txt"

#directory of this script
DIR_THIS=$PWD

OPTION="-b --configuration json://configuration_step2.json"

o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step2 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1

# report status
rc=$?
if [ $rc -eq 0 ]; then
echo "No problems!"
mkdir -p "${DIR_THIS}/results/step${STEP}"
mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root"
mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json"
else
echo "Error: Exit code ${rc}"
echo "Check the log file ${LOGFILE}"
exit ${rc}
fi
24 changes: 24 additions & 0 deletions Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# log file where the terminal output will be saved
STEP="3"
LOGFILE="log-${STEP}.txt"

#directory of this script
DIR_THIS=$PWD

OPTION="-b --configuration json://configuration_step3.json"

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

# report status
rc=$?
if [ $rc -eq 0 ]; then
echo "No problems!"
mkdir -p "${DIR_THIS}/results/step${STEP}"
mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root"
mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json"
else
echo "Error: Exit code ${rc}"
echo "Check the log file ${LOGFILE}"
exit ${rc}
fi
24 changes: 24 additions & 0 deletions Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step4.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# log file where the terminal output will be saved
STEP="4"
LOGFILE="log-${STEP}.txt"

#directory of this script
DIR_THIS=$PWD

OPTION="-b --configuration json://configuration_step4.json"

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

# report status
rc=$?
if [ $rc -eq 0 ]; then
echo "No problems!"
mkdir -p "${DIR_THIS}/results/step${STEP}"
mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root"
mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json"
else
echo "Error: Exit code ${rc}"
echo "Check the log file ${LOGFILE}"
exit ${rc}
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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 Step4 of the Strangeness tutorial
/// \author Romain Schotter
/// based on the original codes from:
/// \author Nepeivoda Roman ([email protected])
/// \author Chiara De Martin ([email protected])

#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "Common/DataModel/EventSelection.h"
#include "PWGLF/DataModel/LFStrangenessTables.h"
#include "Framework/O2DatabasePDGPlugin.h"

using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;

struct strangeness_pbpb_tutorial {
// Histograms are defined with HistogramRegistry
HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};

// Configurable for histograms
Configurable<int> nBins{"nBins", 100, "N bins in all histos"};

// Configurable for event selection
Configurable<float> cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"};

// PDG data base
Service<o2::framework::O2DatabasePDG> pdgDB;

void init(InitContext const&)
{
// Axes
AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm]"};

// Histograms
// Event selection
rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}});
}

// Defining filters for events (event selection)
// Processed events will be already fulfilling the event selection requirements
Filter eventFilter = (o2::aod::evsel::sel8 == true);
Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex);

void process(soa::Filtered<soa::Join<aod::StraCollisions, aod::StraEvSels>>::iterator const& collision)
{
// Fill the event counter
rEventSelection.fill(HIST("hVertexZRec"), collision.posZ());
}
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<strangeness_pbpb_tutorial>(cfgc)};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// 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 Step4 of the Strangeness tutorial
/// \author Romain Schotter
/// based on the original codes from:
/// \author Nepeivoda Roman ([email protected])
/// \author Chiara De Martin ([email protected])

#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "Common/DataModel/EventSelection.h"
#include "PWGLF/DataModel/LFStrangenessTables.h"
#include "Framework/O2DatabasePDGPlugin.h"

using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;

// STEP 0
// Starting point: loop over all cascades and fill invariant mass histogram

struct strangeness_pbpb_tutorial {
// Histograms are defined with HistogramRegistry
HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
HistogramRegistry rXi{"xi", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
HistogramRegistry rOmega{"omega", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};

// Configurable for histograms
Configurable<int> nBins{"nBins", 100, "N bins in all histos"};

// Configurable for event selection
Configurable<float> cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"};

// PDG data base
Service<o2::framework::O2DatabasePDG> pdgDB;

void init(InitContext const&)
{
// Axes
AxisSpec XiMassAxis = {100, 1.28f, 1.36f, "#it{M}_{inv} [GeV/#it{c}^{2}]"};
AxisSpec OmegaMassAxis = {100, 1.63f, 1.7f, "#it{M}_{inv} [GeV/#it{c}^{2}]"};
AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm]"};

// Histograms
// Event selection
rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}});

// Xi/Omega reconstruction
rXi.add("hMassXi", "hMassXi", {HistType::kTH1F, {XiMassAxis}});

rOmega.add("hMassOmega", "hMassOmega", {HistType::kTH1F, {OmegaMassAxis}});
}

// Defining filters for events (event selection)
// Processed events will be already fulfilling the event selection requirements
Filter eventFilter = (o2::aod::evsel::sel8 == true);
Filter posZFilter = (nabs(o2::aod::collision::posZ) < cutzvertex);

void process(soa::Filtered<soa::Join<aod::StraCollisions, aod::StraEvSels>>::iterator const& collision,
aod::CascCores const& Cascades)
{
// Fill the event counter
rEventSelection.fill(HIST("hVertexZRec"), collision.posZ());

// Cascades
for (const auto& casc : Cascades) {
rXi.fill(HIST("hMassXi"), casc.mXi());
rOmega.fill(HIST("hMassOmega"), casc.mOmega());
}
}
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<strangeness_pbpb_tutorial>(cfgc)};
}
Loading
Loading