From 1e1511c28e6711968628a6b0fb04ff6ba644cc15 Mon Sep 17 00:00:00 2001
From: Thomas James Stevenson <thomas.james.stevenson@cern.ch>
Date: Fri, 22 Mar 2024 14:18:29 +0100
Subject: [PATCH] AnalysisTop Main: Move maxCycle vector in parseCutBookkeepers
 function to be indexed correctly

AnalysisTop Main: Move maxCycle vector in parseCutBookkeepers function to be indexed correctly
---
 PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx
index eabd8e2fe78f..4bd4e4b8c803 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx
@@ -92,12 +92,13 @@ namespace top {
     // workaround for PMGTruthWeightTool returning ZERO weights, when sample has ONLY ONE weight...
     const std::size_t modifiedSize = (size == 0) ? 1 : size;
 
+    std::vector<int> maxCycle;
+
     for (std::size_t icbk = 0; icbk < modifiedSize; ++icbk) {
       const std::string cbkName = (icbk == 0) ? "CutBookkeepers" : "CutBookkeepers_weight_" + std::to_string(icbk);
       const xAOD::CutBookkeeperContainer* cutBookKeepers = nullptr;
       top::check(xaodEvent.retrieveMetaInput(cutBookKeepers, cbkName), "Cannot retrieve CutBookkeepers: " + cbkName);
 
-      std::vector<int> maxCycle;
       for (const xAOD::CutBookkeeper *cbk : *cutBookKeepers) {
         // skip RDO and ESD numbers, which are nonsense; and
         // skip the derivation number, which is the one after skimming
-- 
GitLab