Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9c28789
Unified multcent wip
Jun 5, 2025
740637c
Git add for new files
Jun 6, 2025
1253333
Run 3 centrality in place
Jun 6, 2025
6d0f837
Minor adjustments
Jun 6, 2025
041129f
Please consider the following formatting changes (#421)
alibuild Jun 6, 2025
8bf3e30
Feature added: BC centrality
ddobrigk Jun 6, 2025
e85db0f
Please consider the following formatting changes (#422)
alibuild Jun 6, 2025
8004d2d
Merge branch 'AliceO2Group:master' into perbccent
ddobrigk Jun 7, 2025
c0cba9f
Add missing FDDMults in table names + add filling of multsGlobal tabl…
romainschotter Jun 9, 2025
36981c5
Merge pull request #423 from romainschotter/david
romainschotter Jun 9, 2025
26a0afa
Put back table enabling checks + set multiplicity default values to 0…
romainschotter Jun 10, 2025
3c38215
Merge pull request #424 from romainschotter/david
romainschotter Jun 11, 2025
c435422
Add multiplicity + centrality for Run 2 converted data
romainschotter Jun 11, 2025
ab6398a
Merge pull request #425 from romainschotter/david
romainschotter Jun 11, 2025
b5a8676
Please consider the following formatting changes
romainschotter Jun 11, 2025
291249e
Merge pull request #427 from romainschotter/david
romainschotter Jun 11, 2025
bb5b31c
Add SPD clusters L0&L1 multiplicities
romainschotter Jun 12, 2025
4c1d636
Merge pull request #428 from romainschotter/david
romainschotter Jun 12, 2025
f619c2c
Add dependency check for enabling Zeqs for centrality
ddobrigk Jun 12, 2025
9f22658
Please consider the following formatting changes (#426)
alibuild Jun 12, 2025
c628d7c
Fix typecast errors
ddobrigk Jun 12, 2025
6f1b574
Fixes
ddobrigk Jun 12, 2025
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
9 changes: 9 additions & 0 deletions Common/DataModel/Centrality.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in Common/DataModel/Centrality.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -8,7 +8,7 @@
// 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.
#ifndef COMMON_DATAMODEL_CENTRALITY_H_

Check failure on line 11 in Common/DataModel/Centrality.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \author is missing, incorrect or misplaced.

Check failure on line 11 in Common/DataModel/Centrality.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

Check failure on line 11 in Common/DataModel/Centrality.h

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.
#define COMMON_DATAMODEL_CENTRALITY_H_

#include "Framework/AnalysisDataModel.h"
Expand Down Expand Up @@ -60,6 +60,11 @@
// Run 3 variant tables
DECLARE_SOA_TABLE(CentFT0CVariant1s, "AOD", "CENTFT0Cvar1", cent::CentFT0CVariant1); //! Run 3 FT0C variant 1

// Run 3 centrality per BC (joinable with BC)
DECLARE_SOA_TABLE(BCCentFT0Ms, "AOD", "BCCENTFT0M", cent::CentFT0M, o2::soa::Marker<1>); //! Run 3 FT0M BC centrality table
DECLARE_SOA_TABLE(BCCentFT0As, "AOD", "BCCENTFT0A", cent::CentFT0A, o2::soa::Marker<1>); //! Run 3 FT0A BC centrality table
DECLARE_SOA_TABLE(BCCentFT0Cs, "AOD", "BCCENTFT0C", cent::CentFT0C, o2::soa::Marker<1>); //! Run 3 FT0C BC centrality table

using CentRun2V0M = CentRun2V0Ms::iterator;
using CentRun2V0A = CentRun2V0As::iterator;
using CentRun2SPDTrk = CentRun2SPDTrks::iterator;
Expand All @@ -77,6 +82,10 @@
using CentNGlobal = CentNGlobals::iterator;
using CentMFT = CentMFTs::iterator;

using BCCentFT0M = BCCentFT0Ms::iterator;
using BCCentFT0A = BCCentFT0As::iterator;
using BCCentFT0C = BCCentFT0Cs::iterator;

template <typename T>
concept HasRun2Centrality = requires(T&& t) {
{ t.centRun2V0M() };
Expand Down
5 changes: 5 additions & 0 deletions Common/TableProducer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(multcenttable

Check failure on line 35 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name multcenttable does not match its file name multCentTable.cxx. (Matches multcenttable.cxx.)
SOURCES multCentTable.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(multiplicity-extra-table
SOURCES multiplicityExtraTable.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
Expand Down Expand Up @@ -72,7 +77,7 @@
PUBLIC_LINK_LIBRARIES O2::DataFormatsPHOS O2::PHOSBase O2::PHOSReconstruction O2Physics::DataModel
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(fwdtrackextension

Check failure on line 80 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name calo-clusters does not match its file name caloClusterProducer.cxx. (Matches caloClusters.cxx.)
SOURCES fwdtrackextension.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
O2::ReconstructionDataFormats
Expand All @@ -95,12 +100,12 @@
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(qvector-table

Check failure on line 103 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name mccollisionextra does not match its file name mcCollsExtra.cxx. (Matches mccollisionextra.cxx.)
SOURCES qVectorsTable.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
O2Physics::AnalysisCore
O2::DetectorsCommonDataFormats
O2Physics::DataModel

Check failure on line 108 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name qvector-table does not match its file name qVectorsTable.cxx. (Matches qvectorTable.cxx.)
O2::CCDB
COMPONENT_NAME Analysis)

Expand All @@ -109,7 +114,7 @@
PUBLIC_LINK_LIBRARIES O2::Framework
O2Physics::AnalysisCore
ONNXRuntime::ONNXRuntime
O2::CCDB O2Physics::MLCore

Check failure on line 117 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name mftmchmatchingml does not match its file name mftmchMatchingML.cxx. (Matches mftmchmatchingml.cxx.)
O2::ReconstructionDataFormats
COMPONENT_NAME Analysis)

Expand All @@ -118,7 +123,7 @@
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
O2::ReconstructionDataFormats
O2::DetectorsBase O2::DetectorsCommonDataFormats
COMPONENT_NAME Analysis)

Check failure on line 126 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name match-mft-ft0 does not match its file name match-mft-ft0.cxx. (Matches matchMftFt0.cxx.)

o2physics_add_dpl_workflow(zdc-task-intercalib
SOURCES zdc-task-intercalib.cxx
Expand Down
204 changes: 204 additions & 0 deletions Common/TableProducer/multCentTable.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
// 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 multCentTable.cxx
/// \brief unified, self-configuring mult/cent provider
/// \author ALICE

//===============================================================
//
// Unified, self-configuring multiplicity+centrality task
// still work in progress: use at your own discretion
//
//===============================================================

#include "Framework/AnalysisDataModel.h"
#include "Framework/AnalysisTask.h"
#include "Framework/runDataProcessing.h"
#include "Framework/RunningWorkflowInfo.h"
#include "Common/DataModel/TrackSelectionTables.h"
#include "Common/Core/trackUtilities.h"
#include "ReconstructionDataFormats/DCA.h"
#include "DetectorsBase/Propagator.h"
#include "DetectorsBase/GeometryManager.h"
#include "CommonUtils/NameConf.h"
#include "CCDB/CcdbApi.h"
#include "DataFormatsParameters/GRPMagField.h"
#include "CCDB/BasicCCDBManager.h"
#include "Framework/HistogramRegistry.h"
#include "DataFormatsCalibration/MeanVertexObject.h"
#include "CommonConstants/GeomConstants.h"
#include "Common/Tools/TrackPropagationModule.h"
#include "Common/Tools/StandardCCDBLoader.h"
#include "Framework/O2DatabasePDGPlugin.h"
#include "MetadataHelper.h"
#include "Common/Tools/MultModule.h"

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

MetadataHelper metadataInfo; // Metadata helper

struct MultCentTable {
o2::common::multiplicity::standardConfigurables opts;
o2::common::multiplicity::products products;
o2::common::multiplicity::MultModule module;

// CCDB boilerplate declarations
o2::framework::Configurable<std::string> ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Service<o2::ccdb::BasicCCDBManager> ccdb;
Service<o2::framework::O2DatabasePDG> pdg;

// hold multiplicity values for layover to centrality calculation
std::vector<o2::common::multiplicity::multEntry> mults;

// slicers
Preslice<soa::Join<aod::TracksIU, aod::TracksExtra>> slicerTracksIU = o2::aod::track::collisionId;
Preslice<soa::Join<aod::TracksIU, aod::TracksExtra, aod::TrackSelection, aod::TrackSelectionExtension>> slicerTracksIUwithSelections = o2::aod::track::collisionId;
Preslice<soa::Join<aod::Tracks, aod::TracksExtra>> slicerTrackRun2 = o2::aod::track::collisionId;

void init(o2::framework::InitContext& initContext)
{
// CCDB boilerplate init
ccdb->setCaching(true);
ccdb->setLocalObjectValidityChecking();
ccdb->setURL(ccdburl.value);

// task-specific
module.init(opts, initContext);
}

void processRun2(soa::Join<aod::Collisions, aod::Run2MatchedSparse> const& collisions,
soa::Join<aod::Tracks, aod::TracksExtra> const& tracks,
soa::Join<aod::BCs, aod::Run2BCInfos, aod::Timestamps> const& bcs,
aod::Zdcs const&,
aod::FV0As const&,
aod::FV0Cs const&,
aod::FT0s const&)
{
mults.clear();
for (auto const& collision : collisions) {
o2::common::multiplicity::multEntry mult;
const auto& bc = bcs.rawIteratorAt(collision.getId<aod::indices::BCId>());
const uint64_t collIdx = collision.globalIndex();
auto tracksThisCollision = tracks.sliceBy(slicerTrackRun2, collIdx);
mult = module.collisionProcessRun2(collision, tracksThisCollision, bc, products);
mults.push_back(mult);
}
}

void processRun3(soa::Join<aod::Collisions, aod::EvSels> const& collisions,
soa::Join<aod::TracksIU, aod::TracksExtra> const& tracks,
soa::Join<aod::BCs, aod::Timestamps, aod::Run3MatchedToBCSparse> const&,
aod::Zdcs const&,
aod::FV0As const&,
aod::FT0s const&,
aod::FDDs const&)
{
mults.clear();
for (auto const& collision : collisions) {
o2::common::multiplicity::multEntry mult;
const auto& bc = collision.bc_as<soa::Join<aod::BCs, aod::Timestamps, aod::Run3MatchedToBCSparse>>();
const uint64_t collIdx = collision.globalIndex();
auto tracksThisCollision = tracks.sliceBy(slicerTracksIU, collIdx);
mult = module.collisionProcessRun3(ccdb, metadataInfo, collision, tracksThisCollision, bc, products);
mults.push_back(mult);
}
}

void processRun3WithGlobalCounters(soa::Join<aod::Collisions, aod::EvSels> const& collisions,
soa::Join<aod::TracksIU, aod::TracksExtra, aod::TrackSelection, aod::TrackSelectionExtension> const& tracks,
soa::Join<aod::BCs, aod::Timestamps, aod::Run3MatchedToBCSparse> const&,
aod::Zdcs const&,
aod::FV0As const&,
aod::FT0s const&,
aod::FDDs const&)
{
mults.clear();
for (auto const& collision : collisions) {
o2::common::multiplicity::multEntry mult;
const auto& bc = collision.bc_as<soa::Join<aod::BCs, aod::Timestamps, aod::Run3MatchedToBCSparse>>();
const uint64_t collIdx = collision.globalIndex();
auto tracksThisCollision = tracks.sliceBy(slicerTracksIUwithSelections, collIdx);
mult = module.collisionProcessRun3(ccdb, metadataInfo, collision, tracksThisCollision, bc, products);
mults.push_back(mult);
}
}
void processMFT(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision,
o2::aod::MFTTracks const& mfttracks,
soa::SmallGroups<aod::BestCollisionsFwd> const& retracks)
{
if (opts.mEnabledTables[o2::common::multiplicity::kMFTMults]) {
// populates MFT information in the mults buffer (in addition to filling table)
module.collisionProcessMFT(collision, mfttracks, retracks, mults, products);
}
}
void processMonteCarlo(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles)
{
if (opts.mEnabledTables[o2::common::multiplicity::kMultMCExtras]) {
module.collisionProcessMonteCarlo(mcCollision, mcParticles, pdg, products);
}
}
void processMonteCarlo2Mults(soa::Join<aod::McCollisionLabels, aod::Collisions>::iterator const& collision)
{
if (opts.mEnabledTables[o2::common::multiplicity::kMult2MCExtras]) {
// establish simple interlink for posterior analysis (derived data)
products.tableExtraMult2MCExtras(collision.mcCollisionId());
}
}
void processCentralityRun2(aod::Collisions const& collisions, soa::Join<aod::BCs, aod::Run2BCInfos, aod::Timestamps> const& bcs)
{
// it is important that this function is at the end of the other process functions.
// it requires `mults` to be properly set, which will only happen after the other process
// functions have been called.

// internally, the function below will do nothing if no centrality is requested.
// it is thus safer to always keep the actual process function for centrality
// generation to true, since the requisites for being in this context are
// always fulfilled
if (collisions.size() != static_cast<int64_t>(mults.size())) {
LOGF(fatal, "Size of collisions doesn't match size of multiplicity buffer!");
}
module.generateCentralitiesRun2(ccdb, metadataInfo, bcs, mults, products);
}
void processCentralityRun3(aod::Collisions const& collisions, soa::Join<aod::BCs, aod::BcSels, aod::Timestamps> const& bcs, aod::FT0s const&)
{
// it is important that this function is at the end of the other process functions.
// it requires `mults` to be properly set, which will only happen after the other process
// functions have been called.

// internally, the function below will do nothing if no centrality is requested.
// it is thus safer to always keep the actual process function for centrality
// generation to true, since the requisites for being in this context are
// always fulfilled
if (collisions.size() != static_cast<int64_t>(mults.size())) {
LOGF(fatal, "Size of collisions doesn't match size of multiplicity buffer!");
}
module.generateCentralitiesRun3(ccdb, metadataInfo, bcs, mults, products);
}

PROCESS_SWITCH(MultCentTable, processRun2, "Process Run 2", false);
PROCESS_SWITCH(MultCentTable, processRun3, "Process Run 3", true);
PROCESS_SWITCH(MultCentTable, processRun3WithGlobalCounters, "Process Run 3 + global tracking counters", false);
PROCESS_SWITCH(MultCentTable, processMFT, "Process MFT info", false);
PROCESS_SWITCH(MultCentTable, processMonteCarlo, "Process Monte Carlo information", false);
PROCESS_SWITCH(MultCentTable, processMonteCarlo2Mults, "Process Monte Carlo information", false);
PROCESS_SWITCH(MultCentTable, processCentralityRun2, "Generate Run 2 centralities", false);
PROCESS_SWITCH(MultCentTable, processCentralityRun3, "Generate Run 3 centralities", true);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
metadataInfo.initMetadata(cfgc);
WorkflowSpec workflow{adaptAnalysisTask<MultCentTable>(cfgc)};
return workflow;
}
Loading
Loading