Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c99af92
Add MC centrality for FT0CVariant, FDDM, NTPVs, Nglobals, MFTs
romainschotter Aug 25, 2026
3ca438d
Update MC centrality task to use the mcCentModule.h
romainschotter Aug 25, 2026
8475697
Adapt strangederivedbuilder to new StraMCMults model
romainschotter Aug 25, 2026
e827983
Add new StraMCCollMult version
romainschotter Aug 25, 2026
8fdaed0
Add StrangenessMcCentrality task
romainschotter Aug 25, 2026
7790b7f
Add McCentralityModule.h
romainschotter Aug 25, 2026
e0067a3
Add converter task for StraMCCollMults_002
romainschotter Aug 25, 2026
62d6737
Add option to use MC centrality
romainschotter Aug 25, 2026
4c5d1e7
Add histograms as a function of MC Centrality
romainschotter Aug 25, 2026
58060ce
Remove unused include
romainschotter Aug 25, 2026
19e3054
Please consider the following formatting changes
alibuild Aug 25, 2026
3c24efc
Merge pull request #77 from alibuild/alibot-cleanup-17601
romainschotter Aug 25, 2026
399d5bb
Fix derivedlambdakzeroanalysis
romainschotter Aug 25, 2026
efbdd3d
Fix include for mcCentrality.cxx
romainschotter Aug 25, 2026
63fd67b
Fix include in strangenessMcCentrality
romainschotter Aug 25, 2026
222acf4
Add strangeness-mc-centrality in CMakeLists.txt
romainschotter Aug 25, 2026
1d329f8
Please consider the following formatting changes
alibuild Aug 25, 2026
6a2c947
Merge pull request #78 from alibuild/alibot-cleanup-17601
romainschotter Aug 25, 2026
ec38e3e
Fix mcCentralityModule.h
romainschotter Aug 25, 2026
68a2a19
Fix strangenessMcCentrality
romainschotter Aug 25, 2026
6ff23cb
Fix include of mcCentrality.cxx
romainschotter Aug 25, 2026
8a24243
Please consider the following formatting changes
alibuild Aug 25, 2026
f4dfc9a
Merge pull request #79 from alibuild/alibot-cleanup-17601
romainschotter Aug 25, 2026
7648416
Fix typo in mcCentralityModule.h
romainschotter Aug 25, 2026
cb93b45
Address cpp code-check errors for strangederivedbuilder.cxx
romainschotter Aug 26, 2026
bd775eb
Address cpp code-check errors in mcCentralityModule.h
romainschotter Aug 26, 2026
21b131e
Fix strangederivedbuilder.cxx
romainschotter Aug 26, 2026
a137dcd
Address cpp code check in derivedlambdakzeroanalysis
romainschotter Aug 26, 2026
f4de14b
Please consider the following formatting changes
alibuild Aug 26, 2026
74a3024
Merge pull request #81 from alibuild/alibot-cleanup-17601
romainschotter Aug 26, 2026
f037e34
Please consider the following formatting changes
alibuild Aug 26, 2026
6a9a47d
Merge pull request #82 from alibuild/alibot-cleanup-17601
romainschotter Aug 26, 2026
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
4 changes: 3 additions & 1 deletion PWGLF/DataModel/LFStrangenessTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
namespace stracollision
{
DECLARE_SOA_DYNAMIC_COLUMN(IsUPC, isUPC, //! check whether this is a UPC or hadronic collision
[](int value) -> bool { return value <= 2 ? true : false; });

Check failure on line 80 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
DECLARE_SOA_DYNAMIC_COLUMN(TotalFV0AmplitudeA, totalFV0AmplitudeA, //! get the total sum of the FV0 A amplitudes
[](float value) -> float { return value; });
DECLARE_SOA_DYNAMIC_COLUMN(TotalFT0AmplitudeA, totalFT0AmplitudeA, //! get the total sum of the FT0 A amplitudes
Expand Down Expand Up @@ -440,8 +440,10 @@
mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, o2::soa::Marker<2>);
DECLARE_SOA_TABLE_VERSIONED(StraMCCollMults_001, "AOD", "STRAMCCOLLMULTS", 1, //! MC collision multiplicities
mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, stramccollision::TotalMultMCParticles);
DECLARE_SOA_TABLE_VERSIONED(StraMCCollMults_002, "AOD", "STRAMCCOLLMULTS", 2, //! MC collision multiplicities
mult::MultMCFT0A, mult::MultMCFT0C, mult::MultMCFV0A, mult::MultMCFDDA, mult::MultMCFDDC, mult::MultMCNParticlesEta05, mult::MultMCNParticlesEta08, mult::MultMCNParticlesEta10, stramccollision::TotalMultMCParticles);

using StraMCCollMults = StraMCCollMults_001;
using StraMCCollMults = StraMCCollMults_002;

namespace dautrack
{
Expand All @@ -465,7 +467,7 @@
DECLARE_SOA_DYNAMIC_COLUMN(ITSClusterMap, itsClusterMap, //! ITS cluster map, one bit per layer, starting from the innermost
[](uint32_t itsClusterSizes) -> uint8_t {
uint8_t clmap = 0;
for (unsigned int layer = 0; layer < 7; layer++) {

Check failure on line 470 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if ((itsClusterSizes >> (layer * 4)) & 0xf) {
clmap |= (1 << layer);
}
Expand All @@ -475,7 +477,7 @@
DECLARE_SOA_DYNAMIC_COLUMN(ITSNCls, itsNCls, //! Number of ITS clusters
[](uint32_t itsClusterSizes) -> uint8_t {
uint8_t itsNcls = 0;
for (int layer = 0; layer < 7; layer++) {

Check failure on line 480 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if ((itsClusterSizes >> (layer * 4)) & 0xf)
itsNcls++;
}
Expand All @@ -490,9 +492,9 @@
DECLARE_SOA_DYNAMIC_COLUMN(HasTOF, hasTOF, //! Flag to check if track has a TOF measurement
[](uint8_t detectorMap) -> bool { return detectorMap & o2::aod::track::TOF; });
DECLARE_SOA_DYNAMIC_COLUMN(HasITSTracker, hasITSTracker, //! Flag to check if track is from ITS tracker
[](uint8_t detectorMap, float itsChi2PerNcl) -> bool { return (detectorMap & o2::aod::track::ITS) ? (itsChi2PerNcl > -1e-3f) : false; });

Check failure on line 495 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
DECLARE_SOA_DYNAMIC_COLUMN(HasITSAfterburner, hasITSAfterburner, //! Flag to check if track is from ITS AB
[](uint8_t detectorMap, float itsChi2PerNcl) -> bool { return (detectorMap & o2::aod::track::ITS) ? (itsChi2PerNcl < -1e-3f) : false; });

Check failure on line 497 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.

// sub-namespace for compatibility purposes
namespace compatibility
Expand Down Expand Up @@ -855,13 +857,13 @@
return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassPionCharged});
if (value == 1)
return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged});
if (value == 2)

Check failure on line 860 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton});
if (value == 3)

Check failure on line 862 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron});
if (value == 4)

Check failure on line 864 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return RecoDecay::m(std::array{std::array{2.0f * pxpos, 2.0f * pypos, 2.0f * pzpos}, std::array{pxneg, pyneg, pzneg}}, std::array{o2::constants::physics::MassHelium3, o2::constants::physics::MassPionCharged});
if (value == 5)

Check failure on line 866 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return RecoDecay::m(std::array{std::array{pxpos, pypos, pzpos}, std::array{2.0f * pxneg, 2.0f * pyneg, 2.0f * pzneg}}, std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassHelium3});
return 0.0f;
});
Expand All @@ -882,7 +884,7 @@
[](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg, int value) -> float {
if (value == 0)
return RecoDecay::y(std::array{pxpos + pxneg, pypos + pyneg, pzpos + pzneg}, o2::constants::physics::MassKaonNeutral);
if (value == 1 || value == 2)

Check failure on line 887 in PWGLF/DataModel/LFStrangenessTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return RecoDecay::y(std::array{pxpos + pxneg, pypos + pyneg, pzpos + pzneg}, o2::constants::physics::MassLambda);
return 0.0f;
});
Expand Down
9 changes: 7 additions & 2 deletions PWGLF/DataModel/mcCentrality.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#ifndef PWGLF_DATAMODEL_MCCENTRALITY_H_
#define PWGLF_DATAMODEL_MCCENTRALITY_H_

// O2 includes
#include "Common/DataModel/Centrality.h"

#include <Framework/ASoA.h>
Expand All @@ -38,8 +39,12 @@ DECLARE_SOA_TABLE(McCentFV0As, "AOD", "MCCENTFV0A", o2::soa::Marker<1>, cent::Ce
DECLARE_SOA_TABLE(McCentFT0Ms, "AOD", "MCCENTFT0M", o2::soa::Marker<2>, cent::CentFT0M);
DECLARE_SOA_TABLE(McCentFT0As, "AOD", "MCCENTFT0A", o2::soa::Marker<3>, cent::CentFT0A);
DECLARE_SOA_TABLE(McCentFT0Cs, "AOD", "MCCENTFT0C", o2::soa::Marker<4>, cent::CentFT0C);
DECLARE_SOA_TABLE(McCentFDDMs, "AOD", "MCCENTFDDM", o2::soa::Marker<5>, cent::CentFDDM);
DECLARE_SOA_TABLE(McCentNTPVs, "AOD", "MCCENTNTPV", o2::soa::Marker<6>, cent::CentNTPV);
DECLARE_SOA_TABLE(McCentFT0CVariant1s, "AOD", "MCCENTFT0CVAR1", o2::soa::Marker<5>, cent::CentFT0CVariant1);
DECLARE_SOA_TABLE(McCentFT0CVariant2s, "AOD", "MCCENTFT0CVAR2", o2::soa::Marker<6>, cent::CentFT0CVariant2);
DECLARE_SOA_TABLE(McCentFDDMs, "AOD", "MCCENTFDDM", o2::soa::Marker<7>, cent::CentFDDM);
DECLARE_SOA_TABLE(McCentNTPVs, "AOD", "MCCENTNTPV", o2::soa::Marker<8>, cent::CentNTPV);
DECLARE_SOA_TABLE(McCentNGlobals, "AOD", "MCCENTNGLOBAL", o2::soa::Marker<9>, cent::CentNGlobal);
DECLARE_SOA_TABLE(McCentMFTs, "AOD", "MCCENTMFT", o2::soa::Marker<10>, cent::CentMFT);

} // namespace o2::aod

Expand Down
151 changes: 17 additions & 134 deletions PWGLF/TableProducer/Common/mcCentrality.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,20 @@
/// \brief Task to produce the table for the equalized multiplicity into centrality bins
///

#include "PWGLF/DataModel/mcCentrality.h"
#include "PWGLF/Utils/mcCentralityModule.h"

#include "PWGLF/Utils/inelGt.h"
#include "Common/DataModel/Multiplicity.h"

#include <CCDB/BasicCCDBManager.h>
#include <CCDB/CcdbApi.h>
#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisHelpers.h>
#include <Framework/AnalysisTask.h>
#include <Framework/Configurable.h>
#include <Framework/HistogramRegistry.h>
#include <Framework/HistogramSpec.h>
#include <Framework/InitContext.h>
#include <Framework/O2DatabasePDGPlugin.h>
#include <Framework/OutputObjHeader.h>
#include <Framework/runDataProcessing.h>

#include <TFile.h>
#include <TH1.h>

#include <chrono>
#include <cstdint>
#include <string>

using namespace o2;
Expand All @@ -47,146 +39,37 @@ using namespace o2::framework::expressions;

/// Task to produce the response table
struct McCentrality {

// Tables to produce
Produces<aod::McCentFV0As> centFV0A;
Produces<aod::McCentFT0Ms> centFT0M;
Produces<aod::McCentFT0As> centFT0A;
Produces<aod::McCentFT0Cs> centFT0C;
Produces<aod::McCentFDDMs> centFDDM;
Produces<aod::McCentNTPVs> centNTPV;

// Input parameters
o2::framework::Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Service<o2::ccdb::BasicCCDBManager> ccdb;
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<int64_t> ccdbTimestamp{"ccdbTimestamp", -1, "timestamp of the object used to query in CCDB the detector response. If 0 the object corresponding to the run number is used, if < 0 the latest object is used"};
Configurable<std::string> path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"};
Configurable<bool> selectPrimaries{"selectPrimaries", true, "Select only primary particles"};
Service<o2::framework::O2DatabasePDG> pdgDB;
ConfigurableAxis binsPercentile{"binsPercentile", {VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"};
ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"};
Configurable<bool> fillFt0M{"fillFt0M", true, "Fills the FT0M histogram"};
Configurable<bool> fillFt0A{"fillFt0A", false, "Fills the FT0A histogram"};
Configurable<bool> fillFt0C{"fillFt0C", false, "Fills the FT0C histogram"};
Configurable<bool> doNotCrashOnNull{"doNotCrashOnNull", false, "If ccdb object does not exist, fill with dummy values"};

HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};

TH1F* h1dFT0M = nullptr;
TH1F* h1dFT0A = nullptr;
TH1F* h1dFT0C = nullptr;
// TH1F* h1dFDD;
// TH1F* h1dNTP;
o2::pwglf::mccentrality::products products;
o2::pwglf::mccentrality::coreConfigurables baseOpts;
o2::pwglf::mccentrality::BuilderModule mcCentralityBuilderModule;

o2::pwglf::ParticleCounter<o2::framework::O2DatabasePDG> mCounter;
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};

void init(o2::framework::InitContext& /*initContext*/)
void init(o2::framework::InitContext& initContext)
{
// Set up the CCDB
ccdb->setURL(ccdbUrl.value);
ccdb->setCaching(true);
ccdb->setLocalObjectValidityChecking();
ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
ccdb->setFatalWhenNull(false);

mCounter.mPdgDatabase = pdgDB.service;
mCounter.mSelectPrimaries = selectPrimaries.value;

if (fillFt0M) {
histos.add("FT0M/percentile", "FT0M percentile.", HistType::kTH1D, {{binsPercentile, "FT0M percentile"}});
histos.add("FT0M/percentilevsMult", "FT0M percentile.", HistType::kTH2D, {{binsPercentile, "FT0M percentile"}, {binsMultiplicity, "FT0M mult."}});
}
if (fillFt0A) {
histos.add("FT0A/percentile", "FT0A percentile.", HistType::kTH1D, {{binsPercentile, "FT0A percentile"}});
histos.add("FT0A/percentilevsMult", "FT0A percentile.", HistType::kTH2D, {{binsPercentile, "FT0A percentile"}, {binsMultiplicity, "FT0A mult."}});
}
if (fillFt0C) {
histos.add("FT0C/percentile", "FT0C percentile.", HistType::kTH1D, {{binsPercentile, "FT0C percentile"}});
histos.add("FT0C/percentilevsMult", "FT0C percentile.", HistType::kTH2D, {{binsPercentile, "FT0C percentile"}, {binsMultiplicity, "FT0C mult."}});
}

TList* lOfInput = nullptr;
if (path.value.rfind("ccdb://", 0) == 0) { // Getting post calib. from CCDB
path.value.replace(0, 7, "");
lOfInput = ccdb->get<TList>(path);
if (!lOfInput) {
if (doNotCrashOnNull) {
LOG(info) << "Could not find the calibration TList from CCDB in path " << path << ", will fill tables with dummy values";
} else {
LOG(fatal) << "Could not find the calibration TList from CCDB in path " << path;
return;
}
}
} else { // Getting post calib. from file
TFile* f = TFile::Open(path.value.c_str(), "READ");
if (!f) {
LOG(fatal) << "The input file " << path << " is not valid";
}
if (!f->IsOpen()) {
LOG(fatal) << "The input file " << f->GetName() << " is not open";
}
lOfInput = static_cast<TList*>(f->Get("ccdb_object"));
if (!lOfInput) {
f->ls();
LOG(fatal) << "The input file " << path.value << " does not contain the TList ccdb_object";
}
}
auto getHist = [this, lOfInput](const char* name) -> TH1F* {
if (!lOfInput) {
return nullptr;
}
auto hist = static_cast<TH1F*>(lOfInput->FindObject(name));
if (!hist) {
lOfInput->ls();
if (this->doNotCrashOnNull) {
LOG(info) << "Could not open histogram " << name << " from TList, will fill tables with dummy values";
} else {
LOG(fatal) << "Could not open histogram " << name << " from TList";
}
}
return hist;
};
if (fillFt0M) {
h1dFT0M = getHist("h1dFT0M");
}
if (fillFt0A) {
h1dFT0A = getHist("h1dFT0A");
}
if (fillFt0C) {
h1dFT0C = getHist("h1dFT0C");
}
mcCentralityBuilderModule.init(baseOpts, histos, initContext);
}

// Full tables (independent on central calibrations)
void process(aod::McCollision const& /*mcCollision*/,
aod::McParticles const& mcParticles)
void process(soa::Join<aod::McCollisions, aod::MultMCExtras> const& mcCollisions,
aod::BCsWithTimestamps const& bcs)
{
const float nFT0A = mCounter.countFT0A(mcParticles);
const float nFT0C = mCounter.countFT0C(mcParticles);
const float nFT0M = nFT0A + nFT0C;
// const float nFV0A = mCounter.countFV0A(mcParticles);

if (fillFt0M) {
const float valueCentFT0M = h1dFT0M ? h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0M)) : 105.0f;
centFT0M(valueCentFT0M);
histos.fill(HIST("FT0M/percentile"), valueCentFT0M);
histos.fill(HIST("FT0M/percentilevsMult"), valueCentFT0M, nFT0M);
}
if (fillFt0A) {
const float valueCentFT0A = h1dFT0A ? h1dFT0A->GetBinContent(h1dFT0A->FindBin(nFT0A)) : 105.0f;
centFT0A(valueCentFT0A);
histos.fill(HIST("FT0A/percentile"), valueCentFT0A);
histos.fill(HIST("FT0A/percentilevsMult"), valueCentFT0A, nFT0A);
}
if (fillFt0C) {
const float valueCentFT0C = h1dFT0C ? h1dFT0C->GetBinContent(h1dFT0C->FindBin(nFT0C)) : 105.0f;
centFT0C(valueCentFT0C);
histos.fill(HIST("FT0C/percentile"), valueCentFT0C);
histos.fill(HIST("FT0C/percentilevsMult"), valueCentFT0C, nFT0C);
}
// const float valueCentFV0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFV0A));
// centFV0A(valueCentFV0A);
mcCentralityBuilderModule.dataProcess(ccdb, histos, bcs, mcCollisions, products);
}
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<McCentrality>(cfgc)}; }
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<McCentrality>(cfgc)};
}
5 changes: 5 additions & 0 deletions PWGLF/TableProducer/Strangeness/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,8 @@ o2physics_add_dpl_workflow(phi-strange-correlator
SOURCES phiStrangeCorrelator.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(strangeness-mc-centrality
SOURCES strangenessMcCentrality.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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.
#include "PWGLF/DataModel/LFStrangenessTables.h"

#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisHelpers.h>
#include <Framework/AnalysisTask.h>
#include <Framework/runDataProcessing.h>

using namespace o2;
using namespace o2::framework;

// Converts V0 version 001 to 002
struct stramccollmultconverter2 {
Produces<aod::StraMCCollMults_002> straMCCollMults_002;

void process(aod::StraMCCollMults_001 const& straMCcolls)
{
straMCCollMults_002.reserve(straMCcolls.size());
for (auto& straMCcoll : straMCcolls) {
straMCCollMults_002(straMCcoll.multMCFT0A(),
straMCcoll.multMCFT0C(),
-1., // dummy value multMCFV0A
-1., // dummy value multMCFDDA
-1., // dummy value multMCFDDC
straMCcoll.multMCNParticlesEta05(),
straMCcoll.multMCNParticlesEta08(),
straMCcoll.multMCNParticlesEta10(),
straMCcoll.totalMultMCParticles());
}
}
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<stramccollmultconverter2>(cfgc)};
}
15 changes: 8 additions & 7 deletions PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ struct strangederivedbuilder {
std::vector<uint32_t> genOmegaPlus;

// create collision indices beforehand
std::vector<uint64_t> TrackCollIndices; // index -1: no collision
std::vector<uint64_t> TrackGlobalBc;
std::vector<int> V0CollIndices; // index -1: no collision
std::vector<int> CascadeCollIndices; // index -1: no collision
std::vector<int> KFCascadeCollIndices; // index -1: no collision
Expand All @@ -280,15 +280,15 @@ struct strangederivedbuilder {
}

template <typename VType>
void getCfg(o2::framework::InitContext& initContext, const std::string& name, VType& v, const std::string& task)
void getCfg(o2::framework::InitContext& initContext, const std::string& name, VType& v, const std::string task)
{
if (!o2::common::core::getTaskOptionValue(initContext, task, name, v, inheritEvtSelFromTaskVerbose)) {
LOG(fatal) << "Could not get " << name << " from " << task << " task";
}
}

template <typename TCollision>
bool isCollisionAccepted(TCollision collision, std::array<int, o2::aod::straselections::kNsel>& nSelected)
bool isCollisionAccepted(TCollision const& collision, std::array<int, o2::aod::straselections::kNsel>& nSelected)
// check whether the collision passes our collision selections
{
if (requireTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) {
Expand Down Expand Up @@ -552,13 +552,13 @@ struct strangederivedbuilder {
void populateCollisionTables(coll const& collisions, udcoll const& udCollisions, tracks const& Tracks, v0d const& V0s, cad const& Cascades, kfcad const& KFCascades, tracad const& TraCascades, bcType const& /*bcs*/)
{
// create collision indices beforehand
TrackCollIndices.clear();
TrackGlobalBc.clear();
V0CollIndices.clear();
CascadeCollIndices.clear();
KFCascadeCollIndices.clear();
TraCascadeCollIndices.clear();

TrackCollIndices.resize(Tracks.size(), 0); // index -1: no collision
TrackGlobalBc.resize(Tracks.size(), 0);
V0CollIndices.resize(V0s.size(), -1); // index -1: no collision
CascadeCollIndices.resize(Cascades.size(), -1); // index -1: no collision
KFCascadeCollIndices.resize(KFCascades.size(), -1); // index -1: no collision
Expand Down Expand Up @@ -645,7 +645,7 @@ struct strangederivedbuilder {
}

for (const auto& track : TrackTable_thisColl)
TrackCollIndices[track.globalIndex()] = bc.globalBC();
TrackGlobalBc[track.globalIndex()] = bc.globalBC();

if (fillOnlySelectedCollisions && !isCollisionAccepted(collision, totalNbrCollisionsPerSelection)) {
continue;
Expand Down Expand Up @@ -854,6 +854,7 @@ struct strangederivedbuilder {
products.strangeMCColl(mccollision.posX(), mccollision.posY(), mccollision.posZ(),
mccollision.impactParameter(), mccollision.eventPlaneAngle(), mccollision.generatorsID());
products.strangeMCMults(mccollision.multMCFT0A(), mccollision.multMCFT0C(),
mccollision.multMCFV0A(), mccollision.multMCFDDA(), mccollision.multMCFDDC(),
mccollision.multMCNParticlesEta05(),
mccollision.multMCNParticlesEta08(),
mccollision.multMCNParticlesEta10(),
Expand Down Expand Up @@ -1047,7 +1048,7 @@ struct strangederivedbuilder {
aod::dautrack::packing::packInInt8(tr.tpcNSigmaPr()));
// populate daughter-level TOF information
if (tr.hasTOF()) {
products.dauTrackTOFPIDs(TrackCollIndices[tr.globalIndex()], products.dauTrackExtras.lastIndex(), tr.tofSignal(), tr.tofEvTime(), tr.tofEvTimeErr(), tr.length(), tr.tofExpMom());
products.dauTrackTOFPIDs(TrackGlobalBc[tr.globalIndex()], products.dauTrackExtras.lastIndex(), tr.tofSignal(), tr.tofEvTime(), tr.tofEvTimeErr(), tr.length(), tr.tofExpMom());
}
} else {
// populate with empty fully-compatible Nsigmas if no corresponding table available
Expand Down
Loading
Loading