From 642e81063ed7482a617c985730f7c7e3fe037aeb Mon Sep 17 00:00:00 2001 From: Ionut Cristian Arsene Date: Wed, 11 Dec 2024 10:20:15 +0100 Subject: [PATCH] [PWGDQ] fix configQA option in analysis-event-selection (#8903) Co-authored-by: Ionut Cristian Arsene --- PWGDQ/Tasks/tableReader_withAssoc.cxx | 106 ++++++++++++++------------ 1 file changed, 59 insertions(+), 47 deletions(-) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 65c89b78918..739a9ff1957 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -262,17 +262,23 @@ struct AnalysisEventSelection { bool decision = false; // Fill histograms in the class Event, before cuts - fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); + if (fConfigQA) { + fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); + } // Apply event cuts and fill histograms after selection if (fEventCut->IsSelected(VarManager::fgValues)) { if (fConfigRunZorro) { if (event.tag_bit(56)) { // This is the bit used for the software trigger event selections [TO BE DONE: find a more clear way to use it] - fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); + if (fConfigQA) { + fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); + } decision = true; } } else { - fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); + if (fConfigQA) { + fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); + } decision = true; } } @@ -304,51 +310,57 @@ struct AnalysisEventSelection { // key: event global index, value: whether pileup event is a possible splitting std::map collisionSplittingMap; - // Reset the fValues array and fill event observables - VarManager::ResetValues(0, VarManager::kNEventWiseVariables); - // loop over the BC map, get the collision vectors and make in-bunch and out of bunch 2-event correlations - for (auto bc1It = fBCCollMap.begin(); bc1It != fBCCollMap.end(); ++bc1It) { - uint64_t bc1 = bc1It->first; - auto bc1Events = bc1It->second; - - // same bunch event correlations, if more than 1 collisions in this bunch - if (bc1Events.size() > 1) { - for (auto ev1It = bc1Events.begin(); ev1It != bc1Events.end(); ++ev1It) { - auto ev1 = events.rawIteratorAt(*ev1It); - for (auto ev2It = std::next(ev1It); ev2It != bc1Events.end(); ++ev2It) { - auto ev2 = events.rawIteratorAt(*ev2It); - // compute 2-event quantities and mark the candidate split collisions - VarManager::FillTwoEvents(ev1, ev2); - if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < fConfigSplitCollisionsDeltaZ) { // this is a possible collision split - collisionSplittingMap[*ev1It] = true; - collisionSplittingMap[*ev2It] = true; - } - fHistMan->FillHistClass("SameBunchCorrelations", VarManager::fgValues); - } // end second event loop - } // end first event loop - } // end if BC1 events > 1 - - // loop over the following BCs in the TF - for (auto bc2It = std::next(bc1It); bc2It != fBCCollMap.end(); ++bc2It) { - uint64_t bc2 = bc2It->first; - if ((bc2 > bc1 ? bc2 - bc1 : bc1 - bc2) > fConfigSplitCollisionsDeltaBC) { - break; - } - auto bc2Events = bc2It->second; - - // loop over events in the first BC - for (auto ev1It : bc1Events) { - auto ev1 = events.rawIteratorAt(ev1It); - // loop over events in the second BC - for (auto ev2It : bc2Events) { - auto ev2 = events.rawIteratorAt(ev2It); - // compute 2-event quantities and mark the candidate split collisions - VarManager::FillTwoEvents(ev1, ev2); - if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < fConfigSplitCollisionsDeltaZ) { // this is a possible collision split - collisionSplittingMap[ev1It] = true; - collisionSplittingMap[ev2It] = true; + if (fConfigCheckSplitCollisions) { + // Reset the fValues array and fill event observables + VarManager::ResetValues(0, VarManager::kNEventWiseVariables); + // loop over the BC map, get the collision vectors and make in-bunch and out of bunch 2-event correlations + for (auto bc1It = fBCCollMap.begin(); bc1It != fBCCollMap.end(); ++bc1It) { + uint64_t bc1 = bc1It->first; + auto bc1Events = bc1It->second; + + // same bunch event correlations, if more than 1 collisions in this bunch + if (bc1Events.size() > 1) { + for (auto ev1It = bc1Events.begin(); ev1It != bc1Events.end(); ++ev1It) { + auto ev1 = events.rawIteratorAt(*ev1It); + for (auto ev2It = std::next(ev1It); ev2It != bc1Events.end(); ++ev2It) { + auto ev2 = events.rawIteratorAt(*ev2It); + // compute 2-event quantities and mark the candidate split collisions + VarManager::FillTwoEvents(ev1, ev2); + if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < fConfigSplitCollisionsDeltaZ) { // this is a possible collision split + collisionSplittingMap[*ev1It] = true; + collisionSplittingMap[*ev2It] = true; + } + if (fConfigQA) { + fHistMan->FillHistClass("SameBunchCorrelations", VarManager::fgValues); + } + } // end second event loop + } // end first event loop + } // end if BC1 events > 1 + + // loop over the following BCs in the TF + for (auto bc2It = std::next(bc1It); bc2It != fBCCollMap.end(); ++bc2It) { + uint64_t bc2 = bc2It->first; + if ((bc2 > bc1 ? bc2 - bc1 : bc1 - bc2) > fConfigSplitCollisionsDeltaBC) { + break; + } + auto bc2Events = bc2It->second; + + // loop over events in the first BC + for (auto ev1It : bc1Events) { + auto ev1 = events.rawIteratorAt(ev1It); + // loop over events in the second BC + for (auto ev2It : bc2Events) { + auto ev2 = events.rawIteratorAt(ev2It); + // compute 2-event quantities and mark the candidate split collisions + VarManager::FillTwoEvents(ev1, ev2); + if (TMath::Abs(VarManager::fgValues[VarManager::kTwoEvDeltaZ]) < fConfigSplitCollisionsDeltaZ) { // this is a possible collision split + collisionSplittingMap[ev1It] = true; + collisionSplittingMap[ev2It] = true; + } + if (fConfigQA) { + fHistMan->FillHistClass("OutOfBunchCorrelations", VarManager::fgValues); + } } - fHistMan->FillHistClass("OutOfBunchCorrelations", VarManager::fgValues); } } }