@@ -287,6 +287,7 @@ struct FlowGenericFramework {
287287 TH1 * mEfficiency = nullptr ;
288288 std::vector<TH1 *> mPIDEfficiencies ;
289289 std::vector<GFWWeights*> mAcceptance ;
290+ std::map<int , std::vector<std::shared_ptr<GFWWeights>>> mAcceptanceByRun ;
290291 bool correctionsLoaded = false ;
291292 } cfg;
292293
@@ -1205,6 +1206,7 @@ struct FlowGenericFramework {
12051206 return ;
12061207 }
12071208 if (!cfgAcceptance.value .empty ()) {
1209+ <<<<<<< HEAD
12081210 std::string runstr = (cfgFill.cfgRunByRun ) ? " RunByRun/" : " " ;
12091211 cfg.mAcceptance .clear ();
12101212 if (cfgFill.cfgUsePID ) {
@@ -1215,6 +1217,42 @@ struct FlowGenericFramework {
12151217 cfg.mAcceptance .push_back (ccdb->getForTimeStamp <GFWWeights>(cfgAcceptance.value + runstr + " pr/" , timestamp));
12161218 } else {
12171219 cfg.mAcceptance .push_back (ccdb->getForTimeStamp <GFWWeights>(cfgAcceptance.value + runstr, timestamp));
1220+ =======
1221+ const int acceptanceKey = cfgRunByRun ? bc.runNumber () : 0 ;
1222+ auto cachedAcceptance = cfg.mAcceptanceByRun .find (acceptanceKey);
1223+ if (cachedAcceptance == cfg.mAcceptanceByRun .end ()) {
1224+ std::vector<std::shared_ptr<GFWWeights>> acceptanceWeights;
1225+ auto loadAcceptance = [&](const std::string& path) {
1226+ auto * weights = ccdb->getForTimeStamp <GFWWeights>(path, timestamp);
1227+ if (weights == nullptr ) {
1228+ LOGF (fatal, " Could not load acceptance weights from %s" , path.c_str ());
1229+ }
1230+ auto * clonedWeights = dynamic_cast <GFWWeights*>(weights->Clone ());
1231+ if (clonedWeights == nullptr ) {
1232+ LOGF (fatal, " Could not clone acceptance weights from %s" , path.c_str ());
1233+ }
1234+ acceptanceWeights.emplace_back (clonedWeights);
1235+ };
1236+
1237+ std::string runstr = (cfgRunByRun) ? " RunByRun/" : " " ;
1238+ if (cfgUsePID) {
1239+ loadAcceptance (cfgAcceptance.value + runstr + " ref/" );
1240+ loadAcceptance (cfgAcceptance.value + runstr + " ch/" );
1241+ loadAcceptance (cfgAcceptance.value + runstr + " pi/" );
1242+ loadAcceptance (cfgAcceptance.value + runstr + " ka/" );
1243+ loadAcceptance (cfgAcceptance.value + runstr + " pr/" );
1244+ } else {
1245+ loadAcceptance (cfgAcceptance.value + runstr);
1246+ }
1247+ cachedAcceptance = cfg.mAcceptanceByRun .emplace (acceptanceKey, std::move (acceptanceWeights)).first ;
1248+ LOGF (info, " Loaded acceptance weights for run %d" , bc.runNumber ());
1249+ }
1250+
1251+ cfg.mAcceptance .clear ();
1252+ cfg.mAcceptance .reserve (cachedAcceptance->second .size ());
1253+ for (const auto & weights : cachedAcceptance->second ) {
1254+ cfg.mAcceptance .push_back (weights.get ());
1255+ >>>>>>> fc25e54b2 (Cache acceptance maps per run)
12181256 }
12191257 }
12201258 // Run-by-run efficiencies are not supported at the moment
0 commit comments