Skip to content
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
18 changes: 12 additions & 6 deletions Common/DataModel/Multiplicity.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
[](int multPveta1) -> bool { return multPveta1 > 1; });

// forward track counters
DECLARE_SOA_COLUMN(MFTNalltracks, mftNalltracks, int); //! overall counter, uses AO2D coll assoc

Check failure on line 56 in Common/DataModel/Multiplicity.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(MFTNtracks, mftNtracks, int); //! reassigned, uses mult group software

Check failure on line 57 in Common/DataModel/Multiplicity.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.

// MC
DECLARE_SOA_COLUMN(MultMCFT0A, multMCFT0A, int); //!
Expand Down Expand Up @@ -209,14 +209,16 @@

using MultHepMCHI = MultHepMCHIs::iterator;

namespace multZeq

Check failure on line 212 in Common/DataModel/Multiplicity.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/namespace]

Use snake_case for names of namespaces. Double underscores are not allowed.
{
DECLARE_SOA_COLUMN(MultZeqFV0A, multZeqFV0A, float); //! Multiplicity equalized for the vertex position with the FV0A detector
DECLARE_SOA_COLUMN(MultZeqFT0A, multZeqFT0A, float); //! Multiplicity equalized for the vertex position with the FT0A detector
DECLARE_SOA_COLUMN(MultZeqFT0C, multZeqFT0C, float); //! Multiplicity equalized for the vertex position with the FT0C detector
DECLARE_SOA_COLUMN(MultZeqFDDA, multZeqFDDA, float); //! Multiplicity equalized for the vertex position with the FDDA detector
DECLARE_SOA_COLUMN(MultZeqFDDC, multZeqFDDC, float); //! Multiplicity equalized for the vertex position with the FDDC detector
DECLARE_SOA_COLUMN(MultZeqNTracksPV, multZeqNTracksPV, float); //! Multiplicity equalized for the vertex position from the PV contributors
DECLARE_SOA_COLUMN(MultZeqFV0A, multZeqFV0A, float); //! Multiplicity equalized for the vertex position with the FV0A detector
DECLARE_SOA_COLUMN(MultZeqFT0A, multZeqFT0A, float); //! Multiplicity equalized for the vertex position with the FT0A detector
DECLARE_SOA_COLUMN(MultZeqFT0C, multZeqFT0C, float); //! Multiplicity equalized for the vertex position with the FT0C detector
DECLARE_SOA_COLUMN(MultZeqFDDA, multZeqFDDA, float); //! Multiplicity equalized for the vertex position with the FDDA detector
DECLARE_SOA_COLUMN(MultZeqFDDC, multZeqFDDC, float); //! Multiplicity equalized for the vertex position with the FDDC detector
DECLARE_SOA_COLUMN(MultZeqNTracksPV, multZeqNTracksPV, float); //! Multiplicity equalized for the vertex position from the PV contributors
DECLARE_SOA_COLUMN(MultZeqNTracksGlobal, multZeqNTracksGlobal, float); //! Multiplicity equalized for the vertex position, global tracks
DECLARE_SOA_COLUMN(MultZeqMFTNtracks, multZeqMFTNtracks, float); //! Multiplicity equalized for the vertex position, MFT tracks
} // namespace multZeq
DECLARE_SOA_TABLE(FV0MultZeqs, "AOD", "FV0MULTZEQ", //! Multiplicity equalized for the vertex position with the FV0 detector
multZeq::MultZeqFV0A);
Expand All @@ -226,6 +228,10 @@
multZeq::MultZeqFDDA, multZeq::MultZeqFDDC);
DECLARE_SOA_TABLE(PVMultZeqs, "AOD", "PVMULTZEQ", //! Multiplicity equalized for the vertex position from the PV contributors
multZeq::MultZeqNTracksPV);
DECLARE_SOA_TABLE(GlobalMultZeqs, "AOD", "GLOBALMULTZEQ", //! Multiplicity equalized for the vertex position, global tracks
multZeq::MultZeqNTracksGlobal);
DECLARE_SOA_TABLE(MFTMultZeqs, "AOD", "MFTMULTZEQS", //! Multiplicity equalized for the vertex position, MFT tracks
multZeq::MultZeqMFTNtracks);
using MultZeqs = soa::Join<FV0MultZeqs, FT0MultZeqs, FDDMultZeqs, PVMultZeqs>;
using MultZeq = MultZeqs::iterator;

Expand Down Expand Up @@ -273,9 +279,9 @@
{
DECLARE_SOA_INDEX_COLUMN(MultBC, multBC);
}
namespace multBC

Check failure on line 282 in Common/DataModel/Multiplicity.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/namespace]

Use snake_case for names of namespaces. Double underscores are not allowed.
{
DECLARE_SOA_INDEX_COLUMN(FT0Mult, ft0Mult);

Check failure on line 284 in Common/DataModel/Multiplicity.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
}

// for QA purposes
Expand Down
84 changes: 69 additions & 15 deletions Common/Tools/MultModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
"FT0MultZeqs",
"FDDMultZeqs",
"PVMultZeqs",
"GlobalMultZeqs",
"MFTMultZeqs",
"MultMCExtras",
"Mult2MCExtras",
"MFTMults",
Expand All @@ -86,7 +88,7 @@
"BCCentFT0As",
"BCCentFT0Cs"};

static constexpr int nTablesConst = 36;
static constexpr int nTablesConst = 38;

static const std::vector<std::string> parameterNames{"enable"};
static const int defaultParameters[nTablesConst][nParameters]{
Expand Down Expand Up @@ -125,6 +127,8 @@
{-1},
{-1},
{-1},
{-1},
{-1},
{-1}};

// table index : match order above
Expand All @@ -142,6 +146,8 @@
kFT0MultZeqs, // zeq calib, standard
kFDDMultZeqs, // zeq calib, standard
kPVMultZeqs, // zeq calib, standard
kGlobalMultZeqs, // zeq calib, extra
kMFTMultZeqs, // zeq calib, extra
kMultMCExtras, // MC exclusive
kMult2MCExtras, // MC exclusive
kMFTMults, // requires MFT task
Expand Down Expand Up @@ -185,6 +191,8 @@
o2::framework::Produces<aod::FT0MultZeqs> tableFT0Zeqs;
o2::framework::Produces<aod::FDDMultZeqs> tableFDDZeqs;
o2::framework::Produces<aod::PVMultZeqs> tablePVZeqs;
o2::framework::Produces<aod::GlobalMultZeqs> tableNGlobalZeqs;
o2::framework::Produces<aod::MFTMultZeqs> tableNMFTZeqs;
o2::framework::Produces<aod::MultMCExtras> tableExtraMc;
o2::framework::Produces<aod::Mult2MCExtras> tableExtraMult2MCExtras;
o2::framework::Produces<aod::MFTMults> mftMults;
Expand Down Expand Up @@ -256,6 +264,8 @@
float multFDDAZeq = -999.0f;
float multFDDCZeq = -999.0f;
float multNContribsZeq = 0;
float multMFTTracksZeq = 0;
float multGlobalTracksZeq = 0;

int multGlobalTracks = 0; // multsGlobal
int multNbrContribsEta05GlobalTrackWoDCA = 0; // multsGlobal
Expand Down Expand Up @@ -317,6 +327,8 @@
hVtxZFDDA = nullptr;
hVtxZFDDC = nullptr;
hVtxZNTracks = nullptr;
hVtxZNMFTTracks = nullptr;
hVtxZNGlobalTracks = nullptr;
}

// internal: calib related, vtx-z profiles
Expand All @@ -330,6 +342,8 @@
TProfile* hVtxZFDDA;
TProfile* hVtxZFDDC;
TProfile* hVtxZNTracks;
TProfile* hVtxZNMFTTracks; // non-legacy, added August/2025
TProfile* hVtxZNGlobalTracks; // non-legacy, added August/2025

// declaration of structs here
// (N.B.: will be invisible to the outside, create your own copies)
Expand Down Expand Up @@ -469,15 +483,28 @@
internalOpts.mEnabledTables[kMFTMults] = 1;
listOfRequestors[kMFTMults].Append(Form("%s ", "dependency check"));
}
if (internalOpts.mEnabledTables[kCentMFTs] && !internalOpts.mEnabledTables[kMFTMultZeqs]) {
internalOpts.mEnabledTables[kMFTMultZeqs] = 1;
listOfRequestors[kMFTMultZeqs].Append(Form("%s ", "dependency check"));
}
if (internalOpts.mEnabledTables[kCentNGlobals] && !internalOpts.mEnabledTables[kMultsGlobal]) {
internalOpts.mEnabledTables[kMultsGlobal] = 1;
listOfRequestors[kMultsGlobal].Append(Form("%s ", "dependency check"));
}
if (internalOpts.mEnabledTables[kCentNGlobals] && !internalOpts.mEnabledTables[kGlobalMultZeqs]) {
internalOpts.mEnabledTables[kGlobalMultZeqs] = 1;
listOfRequestors[kGlobalMultZeqs].Append(Form("%s ", "dependency check"));
}
if (internalOpts.embedINELgtZEROselection.value > 0 && !internalOpts.mEnabledTables[kPVMults]) {
internalOpts.mEnabledTables[kPVMults] = 1;
listOfRequestors[kPVMults].Append(Form("%s ", "dependency check"));
}

// capture the need for PYTHIA calibration in Pb-Pb runs
if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) {

Check failure on line 504 in Common/Tools/MultModule.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.
internalOpts.generatorName.value = "PYTHIA";
}

// list enabled tables
for (int i = 0; i < nTablesConst; i++) {
// printout to be improved in the future
Expand All @@ -486,11 +513,6 @@
}
}

// capture the need for PYTHIA calibration in Pb-Pb runs
if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) {
internalOpts.generatorName.value = "PYTHIA";
}

mRunNumber = 0;
mRunNumberCentrality = 0;
lCalibLoaded = false;
Expand All @@ -500,8 +522,9 @@
hVtxZFDDA = nullptr;
hVtxZFDDC = nullptr;
hVtxZNTracks = nullptr;
hVtxZNMFTTracks = nullptr;
hVtxZNGlobalTracks = nullptr;

// pass to the outside
opts = internalOpts;
}

Expand Down Expand Up @@ -555,9 +578,9 @@
if (internalOpts.mEnabledTables[kPVMults]) {
if (std::abs(track.eta()) < 1.0) {
mults.multNContribsEta1++; // pvmults
if (std::abs(track.eta()) < 0.8) {

Check failure on line 581 in Common/Tools/MultModule.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.
mults.multNContribs++; // pvmults
if (std::abs(track.eta()) < 0.5) {

Check failure on line 583 in Common/Tools/MultModule.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.
mults.multNContribsEtaHalf++; // pvmults
}
}
Expand Down Expand Up @@ -632,12 +655,20 @@
hVtxZFDDA = static_cast<TProfile*>(lCalibObjects->FindObject("hVtxZFDDA"));
hVtxZFDDC = static_cast<TProfile*>(lCalibObjects->FindObject("hVtxZFDDC"));
hVtxZNTracks = static_cast<TProfile*>(lCalibObjects->FindObject("hVtxZNTracksPV"));
hVtxZNMFTTracks = static_cast<TProfile*>(lCalibObjects->FindObject("hVtxZMFT"));
hVtxZNGlobalTracks = static_cast<TProfile*>(lCalibObjects->FindObject("hVtxZNGlobals"));
lCalibLoaded = true;
// Capture error
if (!hVtxZFV0A || !hVtxZFT0A || !hVtxZFT0C || !hVtxZFDDA || !hVtxZFDDC || !hVtxZNTracks) {
LOGF(error, "Problem loading CCDB objects! Please check");
lCalibLoaded = false;
}
if (!hVtxZNMFTTracks) {
LOGF(info, "MFT track counter: vertex-Z calibration not loaded, will run without.");
}
if (!hVtxZNGlobalTracks) {
LOGF(info, "Global track counter: vertex-Z calibration not loaded, will run without.");
}
} else {
LOGF(error, "Problem loading CCDB object! Please check");
lCalibLoaded = false;
Expand All @@ -653,7 +684,7 @@
auto amplitude = fv0.amplitude()[ii];
auto channel = fv0.channel()[ii];
mults.multFV0A += amplitude;
if (channel > 7) {

Check failure on line 687 in Common/Tools/MultModule.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.
mults.multFV0AOuter += amplitude;
}
}
Expand Down Expand Up @@ -722,17 +753,17 @@
}

//_______________________________________________________________________
// forward detector signals, vertex-Z equalized
// vertex-Z equalized signals
if (internalOpts.mEnabledTables[kFV0MultZeqs]) {
if (std::fabs(collision.posZ() && lCalibLoaded)) {
if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) {

Check failure on line 758 in Common/Tools/MultModule.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.
mults.multFV0AZeq = hVtxZFV0A->Interpolate(0.0) * mults.multFV0A / hVtxZFV0A->Interpolate(collision.posZ());
} else {
mults.multFV0AZeq = 0.0f;
}
cursors.tableFV0Zeqs(mults.multFV0AZeq);
}
if (internalOpts.mEnabledTables[kFT0MultZeqs]) {
if (std::fabs(collision.posZ() && lCalibLoaded)) {
if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) {
mults.multFT0AZeq = hVtxZFT0A->Interpolate(0.0) * mults.multFT0A / hVtxZFT0A->Interpolate(collision.posZ());
mults.multFT0CZeq = hVtxZFT0C->Interpolate(0.0) * mults.multFT0C / hVtxZFT0C->Interpolate(collision.posZ());
} else {
Expand All @@ -742,7 +773,7 @@
cursors.tableFT0Zeqs(mults.multFT0AZeq, mults.multFT0CZeq);
}
if (internalOpts.mEnabledTables[kFDDMultZeqs]) {
if (std::fabs(collision.posZ() && lCalibLoaded)) {
if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) {
mults.multFDDAZeq = hVtxZFDDA->Interpolate(0.0) * mults.multFDDA / hVtxZFDDA->Interpolate(collision.posZ());
mults.multFDDCZeq = hVtxZFDDC->Interpolate(0.0) * mults.multFDDC / hVtxZFDDC->Interpolate(collision.posZ());
} else {
Expand All @@ -754,7 +785,7 @@

//_______________________________________________________________________
// determine if barrel track loop is required, do it (once!) if so but save CPU if not
if (internalOpts.mEnabledTables[kTPCMults] || internalOpts.mEnabledTables[kPVMults] || internalOpts.mEnabledTables[kMultsExtra] || internalOpts.mEnabledTables[kPVMultZeqs] || internalOpts.mEnabledTables[kMultsGlobal]) {
if (internalOpts.mEnabledTables[kTPCMults] || internalOpts.mEnabledTables[kPVMults] || internalOpts.mEnabledTables[kMultsExtra] || internalOpts.mEnabledTables[kPVMultZeqs] || internalOpts.mEnabledTables[kMultsGlobal] || internalOpts.mEnabledTables[kGlobalMultZeqs]) {
// single loop to calculate all
for (const auto& track : tracks) {
if (track.hasTPC()) {
Expand Down Expand Up @@ -822,6 +853,17 @@
}

cursors.multsGlobal(mults.multGlobalTracks, mults.multNbrContribsEta08GlobalTrackWoDCA, mults.multNbrContribsEta10GlobalTrackWoDCA, mults.multNbrContribsEta05GlobalTrackWoDCA);

if (!hVtxZNGlobalTracks || std::fabs(collision.posZ()) > 15.0f) {
mults.multGlobalTracksZeq = mults.multGlobalTracks; // if no equalization available, don't do it
} else {
mults.multGlobalTracksZeq = hVtxZNGlobalTracks->Interpolate(0.0) * mults.multFT0C / hVtxZNGlobalTracks->Interpolate(collision.posZ());
}

// provide vertex-Z equalized Nglobals (or non-equalized if missing or beyond range)
if (internalOpts.mEnabledTables[kGlobalMultZeqs]) {
cursors.tableNGlobalZeqs(mults.multGlobalTracksZeq);
}
}

// fill track counters at this stage if requested
Expand All @@ -842,7 +884,7 @@
collision.flags());
}
if (internalOpts.mEnabledTables[kPVMultZeqs]) {
if (std::fabs(collision.posZ()) && lCalibLoaded) {
if (std::fabs(collision.posZ()) < 15.0f && lCalibLoaded) {
mults.multNContribsZeq = hVtxZNTracks->Interpolate(0.0) * mults.multNContribs / hVtxZNTracks->Interpolate(collision.posZ());
} else {
mults.multNContribsZeq = 0.0f;
Expand Down Expand Up @@ -934,6 +976,18 @@
cursors.mftMults(nAllTracks, nTracks);
mults[collision.globalIndex()].multMFTAllTracks = nAllTracks;
mults[collision.globalIndex()].multMFTTracks = nTracks;

// vertex-Z equalized MFT
if (!hVtxZNMFTTracks || std::fabs(collision.posZ()) > 15.0f) {
mults[collision.globalIndex()].multMFTTracksZeq = mults[collision.globalIndex()].multMFTTracks; // if no equalization available, don't do it
} else {
mults[collision.globalIndex()].multMFTTracksZeq = hVtxZNMFTTracks->Interpolate(0.0) * mults[collision.globalIndex()].multMFTTracks / hVtxZNMFTTracks->Interpolate(collision.posZ());
}

// provide vertex-Z equalized Nglobals (or non-equalized if missing or beyond range)
if (internalOpts.mEnabledTables[kMFTMultZeqs]) {
cursors.tableNMFTZeqs(mults[collision.globalIndex()].multMFTTracksZeq);
}
}

//__________________________________________________
Expand Down Expand Up @@ -1225,9 +1279,9 @@
if (internalOpts.mEnabledTables[kCentNTPVs])
populateTable(cursors.centNTPV, ntpvInfo, mults[iEv].multNContribs, isInelGt0);
if (internalOpts.mEnabledTables[kCentNGlobals])
populateTable(cursors.centNGlobals, nGlobalInfo, mults[iEv].multGlobalTracks, isInelGt0);
populateTable(cursors.centNGlobals, nGlobalInfo, mults[iEv].multGlobalTracksZeq, isInelGt0);
if (internalOpts.mEnabledTables[kCentMFTs])
populateTable(cursors.centMFTs, mftInfo, mults[iEv].multMFTTracks, isInelGt0);
populateTable(cursors.centMFTs, mftInfo, mults[iEv].multMFTTracksZeq, isInelGt0);
}

// populate centralities per BC
Expand Down
Loading