Skip to content

Commit 8bf3e30

Browse files
committed
Feature added: BC centrality
1 parent 041129f commit 8bf3e30

File tree

3 files changed

+56
-11
lines changed

3 files changed

+56
-11
lines changed

Common/DataModel/Centrality.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ DECLARE_SOA_TABLE(CentMFTs, "AOD", "CENTMFT", cent::CentMFT); //! Ru
6060
// Run 3 variant tables
6161
DECLARE_SOA_TABLE(CentFT0CVariant1s, "AOD", "CENTFT0Cvar1", cent::CentFT0CVariant1); //! Run 3 FT0C variant 1
6262

63+
// Run 3 centrality per BC (joinable with BC)
64+
DECLARE_SOA_TABLE(BCCentFT0Ms, "AOD", "BCCENTFT0M", cent::CentFT0M, o2::soa::Marker<1>); //! Run 3 FT0M BC centrality table
65+
DECLARE_SOA_TABLE(BCCentFT0As, "AOD", "BCCENTFT0A", cent::CentFT0A, o2::soa::Marker<1>); //! Run 3 FT0A BC centrality table
66+
DECLARE_SOA_TABLE(BCCentFT0Cs, "AOD", "BCCENTFT0C", cent::CentFT0C, o2::soa::Marker<1>); //! Run 3 FT0C BC centrality table
67+
6368
using CentRun2V0M = CentRun2V0Ms::iterator;
6469
using CentRun2V0A = CentRun2V0As::iterator;
6570
using CentRun2SPDTrk = CentRun2SPDTrks::iterator;
@@ -77,6 +82,10 @@ using CentNTPV = CentNTPVs::iterator;
7782
using CentNGlobal = CentNGlobals::iterator;
7883
using CentMFT = CentMFTs::iterator;
7984

85+
using BCCentFT0M = BCCentFT0Ms::iterator;
86+
using BCCentFT0A = BCCentFT0As::iterator;
87+
using BCCentFT0C = BCCentFT0Cs::iterator;
88+
8089
template <typename T>
8190
concept HasRun2Centrality = requires(T&& t) {
8291
{ t.centRun2V0M() };

Common/TableProducer/multCentTable.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ struct MultCentTable {
140140
products.tableExtraMult2MCExtras(collision.mcCollisionId());
141141
}
142142
}
143-
void processCentrality(aod::Collisions const& collisions, soa::Join<aod::BCs, aod::Timestamps> const&)
143+
void processCentrality(aod::Collisions const& collisions, soa::Join<aod::BCs, aod::BcSels, aod::Timestamps> const& bcs, aod::FT0s const&)
144144
{
145145
// it is important that this function is at the end of the other process functions.
146146
// it requires `mults` to be properly set, which will only happen after the other process
@@ -153,9 +153,7 @@ struct MultCentTable {
153153
if (collisions.size() != mults.size()) {
154154
LOGF(fatal, "Size of collisions doesn't match size of multiplicity buffer!");
155155
}
156-
auto const& collision = collisions.begin();
157-
const auto& bc = collision.bc_as<soa::Join<aod::BCs, aod::Timestamps>>();
158-
module.generateCentralities(ccdb, metadataInfo, bc, mults, products);
156+
module.generateCentralities(ccdb, metadataInfo, bcs, mults, products);
159157
}
160158

161159
PROCESS_SWITCH(MultCentTable, processRun2, "Process Run 2", false);

Common/Tools/MultModule.h

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ static const std::vector<std::string> tableNames{
7878
"CentFDDMs",
7979
"CentNTPVs",
8080
"CentNGlobals",
81-
"CentMFTs"};
81+
"CentMFTs",
82+
"BCCentFT0Ms",
83+
"BCCentFT0As",
84+
"BCCentFT0Cs"};
8285

83-
static constexpr int nTablesConst = 32;
86+
static constexpr int nTablesConst = 35;
8487

8588
static const std::vector<std::string> parameterNames{"enable"};
8689
static const int defaultParameters[nTablesConst][nParameters]{
@@ -115,6 +118,9 @@ static const int defaultParameters[nTablesConst][nParameters]{
115118
{-1},
116119
{-1},
117120
{-1},
121+
{-1},
122+
{-1},
123+
{-1},
118124
{-1}};
119125

120126
// table index : match order above
@@ -153,6 +159,9 @@ enum tableIndex { kFV0Mults, // standard
153159
kCentNTPVs, // standard Run 3
154160
kCentNGlobals, // requires track selection task
155161
kCentMFTs, // requires MFT task
162+
kBCCentFT0Ms, // bc centrality
163+
kBCCentFT0As, // bc centrality
164+
kBCCentFT0Cs, // bc centrality
156165
kNTables };
157166

158167
struct products : o2::framework::ProducesGroup {
@@ -194,6 +203,9 @@ struct products : o2::framework::ProducesGroup {
194203
o2::framework::Produces<aod::CentNTPVs> centNTPV;
195204
o2::framework::Produces<aod::CentNGlobals> centNGlobals;
196205
o2::framework::Produces<aod::CentMFTs> centMFTs;
206+
o2::framework::Produces<aod::BCCentFT0As> bcCentFT0A;
207+
o2::framework::Produces<aod::BCCentFT0Cs> bcCentFT0C;
208+
o2::framework::Produces<aod::BCCentFT0Ms> bcCentFT0M;
197209

198210
//__________________________________________________
199211
// centrality tables per BC
@@ -867,8 +879,8 @@ class MultModule
867879
}
868880

869881
//__________________________________________________
870-
template <typename TCCDB, typename TMetadata, typename TBC, typename TMultBuffer, typename TOutputGroup>
871-
void generateCentralities(TCCDB& ccdb, TMetadata const& metadataInfo, TBC const& bc, TMultBuffer const& mults, TOutputGroup& cursors)
882+
template <typename TCCDB, typename TMetadata, typename TBCs, typename TMultBuffer, typename TOutputGroup>
883+
void generateCentralities(TCCDB& ccdb, TMetadata const& metadataInfo, TBCs const& bcs, TMultBuffer const& mults, TOutputGroup& cursors)
872884
{
873885
// takes multiplicity buffer and generates the desirable centrality values (if any)
874886

@@ -881,9 +893,11 @@ class MultModule
881893
internalOpts.mEnabledTables[kCentFT0As] || internalOpts.mEnabledTables[kCentFT0Cs] ||
882894
internalOpts.mEnabledTables[kCentFT0CVariant1s] || internalOpts.mEnabledTables[kCentFDDMs] ||
883895
internalOpts.mEnabledTables[kCentNTPVs] || internalOpts.mEnabledTables[kCentNGlobals] ||
884-
internalOpts.mEnabledTables[kCentMFTs]) {
896+
internalOpts.mEnabledTables[kCentMFTs] || internalOpts.mEnabledTables[kBCCentFT0Ms] ||
897+
internalOpts.mEnabledTables[kBCCentFT0As] || internalOpts.mEnabledTables[kBCCentFT0Cs]) {
885898
// check and update centrality calibration objects for Run 3
886-
ConfigureCentralityRun3(ccdb, metadataInfo, bc);
899+
const auto& firstbc = bcs.begin();
900+
ConfigureCentralityRun3(ccdb, metadataInfo, firstbc);
887901

888902
/************************************************************
889903
* @brief Populates a table with data based on the given calibration information and multiplicity.
@@ -915,7 +929,7 @@ class MultModule
915929
return percentile;
916930
};
917931

918-
// populate centralities
932+
// populate centralities per event
919933
for (size_t iEv = 0; iEv < mults.size(); iEv++) {
920934
bool isInelGt0 = (mults[iEv].multNContribsEta1 > 0);
921935
if (internalOpts.mEnabledTables[kCentFV0As])
@@ -937,6 +951,30 @@ class MultModule
937951
if (internalOpts.mEnabledTables[kCentMFTs])
938952
populateTable(cursors.centMFTs, mftInfo, mults[iEv].multMFTTracks, isInelGt0);
939953
}
954+
955+
// populate centralities per BC
956+
for (size_t ibc = 0; ibc < bcs.size(); ibc++) {
957+
float bcMultFT0A = 0;
958+
float bcMultFT0C = 0;
959+
960+
const auto& bc = bcs.rawIteratorAt(ibc);
961+
if (bc.has_foundFT0()) {
962+
const auto& ft0 = bc.foundFT0();
963+
for (const auto& amplitude : ft0.amplitudeA()) {
964+
bcMultFT0A += amplitude;
965+
}
966+
for (const auto& amplitude : ft0.amplitudeC()) {
967+
bcMultFT0C += amplitude;
968+
}
969+
}
970+
971+
if (internalOpts.mEnabledTables[kBCCentFT0Ms])
972+
populateTable(cursors.bcCentFT0M, ft0mInfo, bcMultFT0A+bcMultFT0C, true);
973+
if (internalOpts.mEnabledTables[kBCCentFT0As])
974+
populateTable(cursors.bcCentFT0A, ft0aInfo, bcMultFT0A, true);
975+
if (internalOpts.mEnabledTables[kBCCentFT0Cs])
976+
populateTable(cursors.bcCentFT0C, ft0cInfo, bcMultFT0C, true);
977+
}
940978
}
941979
}
942980
}; // end BuilderModule

0 commit comments

Comments
 (0)