@@ -84,6 +84,10 @@ struct DndetaMFTPbPb {
8484 false ,
8585 true };
8686
87+ Configurable<bool > cfgDoIR{" cfgDoIR" , false , " Flag to retrieve Interaction rate from CCDB" };
88+ Configurable<bool > cfgIRCrashOnNull{" cfgIRCrashOnNull" , false , " Flag to avoid CTP RateFetcher crash" };
89+ Configurable<std::string> cfgIRSource{" cfgIRSource" , " T0VTX" , " Estimator of the interaction rate (Pb-Pb: ZNC hadronic)" };
90+
8791 struct : ConfigurableGroup {
8892 Configurable<bool > usephiCut{" usephiCut" , false , " use azimuthal angle cut" };
8993 Configurable<float > phiCut{" phiCut" , 0 .1f ,
@@ -129,7 +133,6 @@ struct DndetaMFTPbPb {
129133 " minOccupancy" , -1 , " minimum occupancy from neighbouring collisions" };
130134 Configurable<float > maxOccupancy{
131135 " maxOccupancy" , -1 , " maximum occupancy from neighbouring collisions" };
132- Configurable<bool > cfgSelInteractionRate{" cfgSelInteractionRate" , false , " Get Interaction rate from CCDB" };
133136 Configurable<float > minIR{" minIR" , -1 , " minimum IR (kHz) collisions" };
134137 Configurable<float > maxIR{" maxIR" , -1 , " maximum IR (kHz) collisions" };
135138 } eventCuts;
@@ -259,8 +262,10 @@ struct DndetaMFTPbPb {
259262 x->SetBinLabel (1 , " All" );
260263 x->SetBinLabel (2 , " Selected" );
261264
262- qaregistry.add (" hOccIRate" , " hOccIRate" , HistType::kTH2F ,
263- {occupancyAxis, irBins});
265+ if (cfgDoIR) {
266+ qaregistry.add (" hOccIRate" , " hOccIRate" , HistType::kTH2F ,
267+ {occupancyAxis, irBins});
268+ }
264269
265270 registry.add ({" Events/NtrkZvtx" ,
266271 " ; N_{trk}; Z_{vtx} (cm); occupancy" ,
@@ -345,8 +350,10 @@ struct DndetaMFTPbPb {
345350 hstat->GetAxis (0 )->SetBinLabel (1 , " All" );
346351 hstat->GetAxis (0 )->SetBinLabel (2 , " Selected" );
347352
348- qaregistry.add (" hCentOccIRate" , " hCentOccIRate" , HistType::kTHnSparseF ,
349- {centralityAxis, occupancyAxis, irBins});
353+ if (cfgDoIR) {
354+ qaregistry.add (" hCentOccIRate" , " hCentOccIRate" , HistType::kTHnSparseF ,
355+ {centralityAxis, occupancyAxis, irBins});
356+ }
350357
351358 qaregistry.add ({" Events/Centrality/hCent" ,
352359 " ; centrality; occupancy" ,
@@ -714,7 +721,6 @@ struct DndetaMFTPbPb {
714721
715722 // / Joined tables
716723 using FullBCs = soa::Join<aod::BCsWithTimestamps, aod::BcSels>;
717- using CollBCs = soa::Join<aod::BCsWithTimestamps, aod::Run3MatchedToBCSparse>;
718724 using Colls = soa::Join<aod::Collisions, aod::EvSels>;
719725 using Coll = Colls::iterator;
720726 using CollsCentFT0C = soa::Join<aod::Collisions, aod::CentFT0Cs, aod::EvSels>;
@@ -737,28 +743,6 @@ struct DndetaMFTPbPb {
737743 using FiltBestTracks = soa::Filtered<aod::BestCollisionsFwd>;
738744 using FiltParticles = soa::Filtered<aod::McParticles>;
739745
740- bool isIRSelected (CollBCs::iterator const & bc, bool fillHis = false )
741- {
742- double ir = (eventCuts.minIR >= 0 || eventCuts.maxIR >= 0 )
743- ? rateFetcher.fetch (ccdb.service , bc.timestamp (),
744- bc.runNumber (), " ZNC hadronic" ) *
745- 1 .e -3
746- : -1 ;
747- if (eventCuts.minIR >= 0 && ir < eventCuts.minIR ) {
748- return false ;
749- }
750- if (fillHis) {
751- registry.fill (HIST (" hEvtSel" ), 13 );
752- }
753- if (eventCuts.maxIR >= 0 && ir > eventCuts.maxIR ) {
754- return false ;
755- }
756- if (fillHis) {
757- registry.fill (HIST (" hEvtSel" ), 14 );
758- }
759- return true ;
760- }
761-
762746 template <typename T>
763747 bool isTrackSelected (const T& track)
764748 {
@@ -1016,6 +1000,19 @@ struct DndetaMFTPbPb {
10161000 if constexpr (fillHis) {
10171001 registry.fill (HIST (" hEvtSel" ), 12 );
10181002 }
1003+ double ir = (eventCuts.minIR >= 0 || eventCuts.maxIR >= 0 ) ? rateFetcher.fetch (ccdb.service , collision.timestamp (), collision.runNumber (), cfgIRSource, cfgIRCrashOnNull) * 1 .e -3 : -1 ;
1004+ if (eventCuts.minIR >= 0 && ir < eventCuts.minIR ) {
1005+ return false ;
1006+ }
1007+ if (fillHis) {
1008+ registry.fill (HIST (" hEvtSel" ), 13 );
1009+ }
1010+ if (eventCuts.maxIR >= 0 && ir > eventCuts.maxIR ) {
1011+ return false ;
1012+ }
1013+ if (fillHis) {
1014+ registry.fill (HIST (" hEvtSel" ), 14 );
1015+ }
10191016 return true ;
10201017 }
10211018
@@ -1109,13 +1106,14 @@ struct DndetaMFTPbPb {
11091106 // / @brief process function for counting tracks
11101107 template <typename C>
11111108 void processData (typename C::iterator const & collision,
1112- FiltMftTracks const & tracks, CollBCs const & /* bcs */ )
1109+ FiltMftTracks const & tracks)
11131110 {
11141111 auto occ = getOccupancy (collision, eventCuts.occupancyEstimator );
11151112 float c = getRecoCent (collision);
1116- auto bc = collision.template foundBC_as <CollBCs>();
1117- double ir = rateFetcher.fetch (ccdb.service , bc.timestamp (), bc.runNumber (), " ZNC hadronic" ) * 1 .e -3 ;
1118-
1113+ float ir = -1 ;
1114+ if (cfgDoIR) {
1115+ ir = rateFetcher.fetch (ccdb.service , coll.timestamp (), coll.runNumber (), cfgIRSource, cfgIRCrashOnNull) * 1 .e -3 ;
1116+ }
11191117 if constexpr (has_reco_cent<C>) {
11201118 registry.fill (HIST (" Events/Centrality/Selection" ), 1 ., c, occ);
11211119 } else {
@@ -1125,23 +1123,17 @@ struct DndetaMFTPbPb {
11251123 if (!isGoodEvent<true >(collision)) {
11261124 return ;
11271125 }
1128- if (eventCuts.cfgSelInteractionRate ) {
1129- if (!isIRSelected (bc, true )) {
1130- return ;
1131- }
1132- }
11331126
11341127 auto z = collision.posZ ();
11351128 if constexpr (has_reco_cent<C>) {
11361129 registry.fill (HIST (" Events/Centrality/Selection" ), 2 ., c, occ);
11371130 qaregistry.fill (HIST (" Events/Centrality/hZvtxCent" ), z, c, occ);
11381131 qaregistry.fill (HIST (" Events/Centrality/hCent" ), c, occ);
1139- if (eventCuts. cfgSelInteractionRate ) {
1132+ if (cfgDoIR ) {
11401133 qaregistry.fill (HIST (" hCentOccIRate" ), c, occ, ir);
11411134 }
1142-
11431135 } else {
1144- if (eventCuts. cfgSelInteractionRate ) {
1136+ if (cfgDoIR ) {
11451137 qaregistry.fill (HIST (" hOccIRate" ), occ, ir);
11461138 }
11471139 registry.fill (HIST (" Events/Selection" ), 2 ., occ);
@@ -1161,14 +1153,14 @@ struct DndetaMFTPbPb {
11611153 template <typename C>
11621154 void processDatawBestTracks (
11631155 typename C::iterator const & collision, FiltMftTracks const & tracks,
1164- soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks,
1165- CollBCs const & /* bcs*/ )
1156+ soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks)
11661157 {
11671158 auto occ = getOccupancy (collision, eventCuts.occupancyEstimator );
11681159 float c = getRecoCent (collision);
1169- auto bc = collision.template foundBC_as <CollBCs>();
1170- double ir = rateFetcher.fetch (ccdb.service , bc.timestamp (), bc.runNumber (), " ZNC hadronic" ) * 1 .e -3 ;
1171-
1160+ float ir = -1 ;
1161+ if (cfgDoIR) {
1162+ ir = rateFetcher.fetch (ccdb.service , coll.timestamp (), coll.runNumber (), cfgIRSource, cfgIRCrashOnNull) * 1 .e -3 ;
1163+ }
11721164 if constexpr (has_reco_cent<C>) {
11731165 registry.fill (HIST (" Events/Centrality/Selection" ), 1 ., c, occ);
11741166 } else {
@@ -1178,21 +1170,16 @@ struct DndetaMFTPbPb {
11781170 if (!isGoodEvent<false >(collision)) {
11791171 return ;
11801172 }
1181- if (eventCuts.cfgSelInteractionRate ) {
1182- if (!isIRSelected (bc, true )) {
1183- return ;
1184- }
1185- }
11861173
11871174 auto z = collision.posZ ();
11881175 if constexpr (has_reco_cent<C>) {
11891176 registry.fill (HIST (" Events/Centrality/Selection" ), 2 ., c, occ);
1190- if (eventCuts. cfgSelInteractionRate ) {
1177+ if (cfgDoIR ) {
11911178 qaregistry.fill (HIST (" hCentOccIRate" ), c, occ, ir);
11921179 }
11931180 } else {
11941181 registry.fill (HIST (" Events/Selection" ), 2 ., occ);
1195- if (eventCuts. cfgSelInteractionRate ) {
1182+ if (cfgDoIR ) {
11961183 qaregistry.fill (HIST (" hOccIRate" ), occ, ir);
11971184 }
11981185 }
@@ -1208,66 +1195,65 @@ struct DndetaMFTPbPb {
12081195 }
12091196
12101197 void processDataInclusive (Colls::iterator const & collision,
1211- FiltMftTracks const & tracks, CollBCs const & bcs )
1198+ FiltMftTracks const & tracks)
12121199 {
1213- processData<Colls>(collision, tracks, bcs );
1200+ processData<Colls>(collision, tracks);
12141201 }
12151202
12161203 PROCESS_SWITCH (DndetaMFTPbPb, processDataInclusive,
12171204 " Count tracks (inclusive)" , false );
12181205
12191206 void processDataCentFT0C (CollsCentFT0C::iterator const & collision,
1220- FiltMftTracks const & tracks, CollBCs const & bcs )
1207+ FiltMftTracks const & tracks)
12211208 {
1222- processData<CollsCentFT0C>(collision, tracks, bcs );
1209+ processData<CollsCentFT0C>(collision, tracks);
12231210 }
12241211
12251212 PROCESS_SWITCH (DndetaMFTPbPb, processDataCentFT0C,
12261213 " Count tracks in FT0C centrality bins" , false );
12271214
12281215 void
12291216 processDataCentFT0CVariant1 (CollsCentFT0CVariant1::iterator const & collision,
1230- FiltMftTracks const & tracks, CollBCs const & bcs )
1217+ FiltMftTracks const & tracks)
12311218 {
1232- processData<CollsCentFT0CVariant1>(collision, tracks, bcs );
1219+ processData<CollsCentFT0CVariant1>(collision, tracks);
12331220 }
12341221
12351222 PROCESS_SWITCH (DndetaMFTPbPb, processDataCentFT0CVariant1,
12361223 " Count tracks in FT0CVariant1 centrality bins" , false );
12371224
12381225 void processDataCentFT0M (CollsCentFT0M::iterator const & collision,
1239- FiltMftTracks const & tracks, CollBCs const & bcs )
1226+ FiltMftTracks const & tracks)
12401227 {
1241- processData<CollsCentFT0M>(collision, tracks, bcs );
1228+ processData<CollsCentFT0M>(collision, tracks);
12421229 }
12431230
12441231 PROCESS_SWITCH (DndetaMFTPbPb, processDataCentFT0M,
12451232 " Count tracks in FT0M centrality bins" , false );
12461233
12471234 void processDataCentNGlobal (CollsCentNGlobal::iterator const & collision,
1248- FiltMftTracks const & tracks, CollBCs const & bcs )
1235+ FiltMftTracks const & tracks)
12491236 {
1250- processData<CollsCentNGlobal>(collision, tracks, bcs );
1237+ processData<CollsCentNGlobal>(collision, tracks);
12511238 }
12521239
12531240 PROCESS_SWITCH (DndetaMFTPbPb, processDataCentNGlobal,
12541241 " Count tracks in NGlobal centrality bins" , false );
12551242
12561243 void processDataCentMFT (CollsCentMFT::iterator const & collision,
1257- FiltMftTracks const & tracks, CollBCs const & bcs )
1244+ FiltMftTracks const & tracks)
12581245 {
1259- processData<CollsCentMFT>(collision, tracks, bcs );
1246+ processData<CollsCentMFT>(collision, tracks);
12601247 }
12611248
12621249 PROCESS_SWITCH (DndetaMFTPbPb, processDataCentMFT,
12631250 " Count tracks in MFT centrality bins" , false );
12641251
12651252 void processDatawBestTracksInclusive (
12661253 Colls::iterator const & collision, FiltMftTracks const & tracks,
1267- soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks,
1268- CollBCs const & bcs)
1254+ soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks)
12691255 {
1270- processDatawBestTracks<Colls>(collision, tracks, besttracks, bcs );
1256+ processDatawBestTracks<Colls>(collision, tracks, besttracks);
12711257 }
12721258
12731259 PROCESS_SWITCH (DndetaMFTPbPb, processDatawBestTracksInclusive,
@@ -1276,10 +1262,9 @@ struct DndetaMFTPbPb {
12761262
12771263 void processDatawBestTracksCentFT0C (
12781264 CollsCentFT0C::iterator const & collision, FiltMftTracks const & tracks,
1279- soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks,
1280- CollBCs const & bcs)
1265+ soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks)
12811266 {
1282- processDatawBestTracks<CollsCentFT0C>(collision, tracks, besttracks, bcs );
1267+ processDatawBestTracks<CollsCentFT0C>(collision, tracks, besttracks);
12831268 }
12841269
12851270 PROCESS_SWITCH (DndetaMFTPbPb, processDatawBestTracksCentFT0C,
@@ -1289,11 +1274,9 @@ struct DndetaMFTPbPb {
12891274 void processDatawBestTracksCentFT0CVariant1 (
12901275 CollsCentFT0CVariant1::iterator const & collision,
12911276 FiltMftTracks const & tracks,
1292- soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks,
1293- CollBCs const & bcs)
1277+ soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks)
12941278 {
1295- processDatawBestTracks<CollsCentFT0CVariant1>(collision, tracks, besttracks,
1296- bcs);
1279+ processDatawBestTracks<CollsCentFT0CVariant1>(collision, tracks, besttracks);
12971280 }
12981281
12991282 PROCESS_SWITCH (DndetaMFTPbPb, processDatawBestTracksCentFT0CVariant1,
@@ -1303,10 +1286,9 @@ struct DndetaMFTPbPb {
13031286
13041287 void processDatawBestTracksCentFT0M (
13051288 CollsCentFT0M::iterator const & collision, FiltMftTracks const & tracks,
1306- soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks,
1307- CollBCs const & bcs)
1289+ soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks)
13081290 {
1309- processDatawBestTracks<CollsCentFT0M>(collision, tracks, besttracks, bcs );
1291+ processDatawBestTracks<CollsCentFT0M>(collision, tracks, besttracks);
13101292 }
13111293
13121294 PROCESS_SWITCH (DndetaMFTPbPb, processDatawBestTracksCentFT0M,
@@ -1315,11 +1297,9 @@ struct DndetaMFTPbPb {
13151297
13161298 void processDatawBestTracksCentNGlobal (
13171299 CollsCentNGlobal::iterator const & collision, FiltMftTracks const & tracks,
1318- soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks,
1319- CollBCs const & bcs)
1300+ soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks)
13201301 {
1321- processDatawBestTracks<CollsCentNGlobal>(collision, tracks, besttracks,
1322- bcs);
1302+ processDatawBestTracks<CollsCentNGlobal>(collision, tracks, besttracks);
13231303 }
13241304
13251305 PROCESS_SWITCH (DndetaMFTPbPb, processDatawBestTracksCentNGlobal,
@@ -1329,10 +1309,9 @@ struct DndetaMFTPbPb {
13291309
13301310 void processDatawBestTracksCentMFT (
13311311 CollsCentMFT::iterator const & collision, FiltMftTracks const & tracks,
1332- soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks,
1333- CollBCs const & bcs)
1312+ soa::SmallGroups<aod::BestCollisionsFwd> const & besttracks)
13341313 {
1335- processDatawBestTracks<CollsCentMFT>(collision, tracks, besttracks, bcs );
1314+ processDatawBestTracks<CollsCentMFT>(collision, tracks, besttracks);
13361315 }
13371316
13381317 PROCESS_SWITCH (DndetaMFTPbPb, processDatawBestTracksCentMFT,
0 commit comments