From 870c26fdcf42ed0d92cf61f3586de5376744bb9d Mon Sep 17 00:00:00 2001 From: rolavick Date: Tue, 13 Aug 2024 00:47:20 +0200 Subject: [PATCH] PWGUD: Fixing bug in personal task (#7274) * fixing bug in logic * Please consider the following formatting changes * forgot to delete useless histogram --------- Co-authored-by: ALICE Action Bot --- PWGUD/Tasks/upcEventITSROFcounter.cxx | 29 ++++++++++++++------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/PWGUD/Tasks/upcEventITSROFcounter.cxx b/PWGUD/Tasks/upcEventITSROFcounter.cxx index 852671f9324..a49ee0c8f07 100644 --- a/PWGUD/Tasks/upcEventITSROFcounter.cxx +++ b/PWGUD/Tasks/upcEventITSROFcounter.cxx @@ -98,23 +98,24 @@ struct UpcEventITSROFcounter { int arrUPCcolls[1000] = {0}; // next is based on matching of collision bc within ITSROF range in bcs - for (auto& collision : collisions) { - int index = 0; - for (auto& itsrofBorder : vecITSROFborders) { + for (auto& itsrofBorder : vecITSROFborders) { + int nAllCollsInROF = 0; + int nUpcCollsInROF = 0; + for (auto& collision : collisions) { if ((itsrofBorder.first < collision.bcId()) && (collision.bcId() < itsrofBorder.second)) { - break; + nAllCollsInROF++; + if (collision.numContrib() < nTracksForUPCevent + 1) { + nUpcCollsInROF++; + } } - index++; - } - arrAllColls[index]++; - if (collision.numContrib() < nTracksForUPCevent + 1) { - arrUPCcolls[index]++; - } - } // end loop over collisions + } // end loop over collisions + arrAllColls[nAllCollsInROF]++; + arrUPCcolls[nUpcCollsInROF]++; + } // end loop over ITSROFs - for (int i = 0; i < vecITSROFborders.size(); i++) { - histos.get(HIST("Events/hCountCollisionsInROFborderMatching"))->Fill(arrAllColls[i]); - histos.get(HIST("Events/hCountUPCcollisionsInROFborderMatching"))->Fill(arrUPCcolls[i]); + for (int ncol = 0; ncol < 12; ncol++) { + histos.get(HIST("Events/hCountCollisionsInROFborderMatching"))->Fill(ncol, arrAllColls[ncol]); + histos.get(HIST("Events/hCountUPCcollisionsInROFborderMatching"))->Fill(ncol, arrUPCcolls[ncol]); } }