@@ -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
8588static const std::vector<std::string> parameterNames{" enable" };
8689static 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
158167struct 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