diff --git a/Analysis/Tasks/PWGCF/correlations.cxx b/Analysis/Tasks/PWGCF/correlations.cxx index 93c47963c9187..835b985848efc 100644 --- a/Analysis/Tasks/PWGCF/correlations.cxx +++ b/Analysis/Tasks/PWGCF/correlations.cxx @@ -153,6 +153,9 @@ struct CorrelationTask { same->fillEvent(centrality, CorrelationContainer::kCFStepAll); + if (!collision.alias()[kINT7]) { + return; + } if (!collision.sel7()) { return; } diff --git a/Analysis/Tasks/PWGCF/filterCF.cxx b/Analysis/Tasks/PWGCF/filterCF.cxx index 7c689f2aca3cc..e1cdce004b7e2 100644 --- a/Analysis/Tasks/PWGCF/filterCF.cxx +++ b/Analysis/Tasks/PWGCF/filterCF.cxx @@ -50,6 +50,9 @@ struct FilterCF { { LOGF(info, "Tracks for collision: %d | Vertex: %.1f | INT7: %d | V0M: %.1f", tracks.size(), collision.posZ(), collision.sel7(), collision.centV0M()); + if (!collision.alias()[kINT7]) { + return; + } if (!collision.sel7()) { return; } diff --git a/Analysis/Tutorials/CMakeLists.txt b/Analysis/Tutorials/CMakeLists.txt index 07edbd72dd749..c9333bf941327 100644 --- a/Analysis/Tutorials/CMakeLists.txt +++ b/Analysis/Tutorials/CMakeLists.txt @@ -172,3 +172,8 @@ o2_add_dpl_workflow(compatible-bcs SOURCES src/compatibleBCs.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisCore O2::AnalysisDataModel COMPONENT_NAME AnalysisTutorial) + +o2_add_dpl_workflow(multiplicity-event-track-selection + SOURCES src/multiplicityEventTrackSelection.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisCore O2::AnalysisDataModel + COMPONENT_NAME AnalysisTutorial) diff --git a/Analysis/Tutorials/src/multiplicityEventTrackSelection.cxx b/Analysis/Tutorials/src/multiplicityEventTrackSelection.cxx new file mode 100644 index 0000000000000..d0b35bb7f2287 --- /dev/null +++ b/Analysis/Tutorials/src/multiplicityEventTrackSelection.cxx @@ -0,0 +1,57 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// 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. + +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include + +#include "AnalysisDataModel/EventSelection.h" +#include "AnalysisDataModel/TrackSelectionTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// Example task generating a multiplicity distribution of +// collision which pass the INT7 selection and +// tracks which pass the "isGlobalTrack" selection +// +// Needs to run with event and track selection: +// o2-analysis-timestamp | o2-analysis-event-selection | o2-analysis-trackextension | o2-analysis-trackselection | o2-analysistutorial-multiplicity-event-track-selection + +struct MultiplicityEventTrackSelection { + + OutputObj multiplicity{TH1F("multiplicity", "multiplicity", 5000, -0.5, 4999.5)}; + + Filter collisionZFilter = nabs(aod::collision::posZ) < 10.0f; + Filter trackFilter = (nabs(aod::track::eta) < 0.8f) && (aod::track::pt > 0.15f) && (aod::track::isGlobalTrack == (uint8_t) true); + + void process(soa::Filtered>::iterator const& collision, + soa::Filtered> const& tracks) + { + if (!collision.alias()[kINT7]) { + return; + } + if (!collision.sel7()) { + return; + } + + LOGP(INFO, "Collision with {} tracks", tracks.size()); + multiplicity->Fill(tracks.size()); + } +}; + +// Workflow definition +WorkflowSpec defineDataProcessing(ConfigContext const&) +{ + return WorkflowSpec{ + adaptAnalysisTask("multiplicity-event-track-selection")}; +}