diff --git a/Common/DataModel/Multiplicity.h b/Common/DataModel/Multiplicity.h index 1f4a17e11b3..40175ded7a4 100644 --- a/Common/DataModel/Multiplicity.h +++ b/Common/DataModel/Multiplicity.h @@ -45,6 +45,10 @@ DECLARE_SOA_DYNAMIC_COLUMN(IsInelGt0, isInelGt0, //! is INEL > 0 [](int multPveta1) -> bool { return multPveta1 > 0; }); DECLARE_SOA_DYNAMIC_COLUMN(IsInelGt1, isInelGt1, //! is INEL > 1 [](int multPveta1) -> bool { return multPveta1 > 1; }); + +// forward track counters +DECLARE_SOA_COLUMN(MFTNtracks, mftNtracks, int); //! + // MC DECLARE_SOA_COLUMN(MultMCFT0A, multMCFT0A, int); //! DECLARE_SOA_COLUMN(MultMCFT0C, multMCFT0C, int); //! @@ -108,9 +112,12 @@ DECLARE_SOA_TABLE(PVMults, "AOD", "PVMULT", //! Multiplicity from the PV contrib mult::MultNTracksPVetaHalf, mult::IsInelGt0, mult::IsInelGt1); +DECLARE_SOA_TABLE(MFTMults, "AOD", "MFTMULT", //! Multiplicity with MFT + mult::MFTNtracks); using BarrelMults = soa::Join; using Mults = soa::Join; using FT0Mult = FT0Mults::iterator; +using MFTMult = MFTMults::iterator; using Mult = Mults::iterator; DECLARE_SOA_TABLE(MultsExtra_000, "AOD", "MULTEXTRA", //! diff --git a/Common/TableProducer/multiplicityTable.cxx b/Common/TableProducer/multiplicityTable.cxx index 6d468282b55..2f9040b569c 100644 --- a/Common/TableProducer/multiplicityTable.cxx +++ b/Common/TableProducer/multiplicityTable.cxx @@ -49,7 +49,8 @@ static constexpr int kFT0MultZeqs = 10; static constexpr int kFDDMultZeqs = 11; static constexpr int kPVMultZeqs = 12; static constexpr int kMultMCExtras = 13; -static constexpr int nTables = 14; +static constexpr int kMFTMults = 14; +static constexpr int nTables = 15; // Checking that the Zeq tables are after the normal ones static_assert(kFV0Mults < kFV0MultZeqs); @@ -71,9 +72,10 @@ static const std::vector tableNames{"FV0Mults", // 0 "FT0MultZeqs", // 10 "FDDMultZeqs", // 11 "PVMultZeqs", // 12 - "MultMCExtras"}; // 13 + "MultMCExtras", // 13 + "MFTMults"}; // 14 static const std::vector parameterNames{"Enable"}; -static const int defaultParameters[nTables][nParameters]{{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}}; +static const int defaultParameters[nTables][nParameters]{{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}}; struct MultiplicityTable { SliceCache cache; @@ -92,6 +94,7 @@ struct MultiplicityTable { Produces tablePVZeqs; // 12 Produces tableExtraMc; // 13 Produces tableExtraMult2MCExtras; + Produces mftMults; // 14 Produces multsGlobal; // Not accounted for, produced based on process function processGlobalTrackingCounters // For vertex-Z corrections in calibration @@ -105,6 +108,7 @@ struct MultiplicityTable { Partition pvContribTracksEta1 = (nabs(aod::track::eta) < 1.0f) && ((aod::track::flags & (uint32_t)o2::aod::track::PVContributor) == (uint32_t)o2::aod::track::PVContributor); Preslice perCol = aod::track::collisionId; Preslice perColIU = aod::track::collisionId; + Preslice perCollisionMFT = o2::aod::fwdtrack::collisionId; using BCsWithRun3Matchings = soa::Join; @@ -297,7 +301,8 @@ struct MultiplicityTable { aod::Zdcs const&, aod::FV0As const&, aod::FT0s const&, - aod::FDDs const&) + aod::FDDs const&, + aod::MFTTracks const& mftTracks) { // reserve memory for (auto i : mEnabledTables) { @@ -343,6 +348,9 @@ struct MultiplicityTable { break; case kMultMCExtras: // MC extra information (nothing to do in the data) break; + case kMFTMults: // Equalized multiplicity for PV + mftMults.reserve(collisions.size()); + break; default: LOG(fatal) << "Unknown table requested: " << i; break; @@ -621,6 +629,19 @@ struct MultiplicityTable { case kMultMCExtras: // MC only (nothing to do) { } break; + case kMFTMults: { + // for centrality estimation with the MFT if desired + // step 1: produce proper grouping + const uint64_t collIdx = collision.globalIndex(); + auto mftTracksGrouped = mftTracks.sliceBy(perCollisionMFT, collIdx); + int nTracks = 0; + for (auto& track : mftTracksGrouped) { + if (track.nClusters() >= 5) { // hardcoded on purpose to avoid trouble + nTracks++; + } + } + mftMults(nTracks); + } break; default: // Default { LOG(fatal) << "Unknown table requested: " << i;