Skip to content

Commit

Permalink
[PWGDQ] fix configQA option in analysis-event-selection (AliceO2Group…
Browse files Browse the repository at this point in the history
…#8903)

Co-authored-by: Ionut Cristian Arsene <iarsene@cern.ch>
  • Loading branch information
2 people authored and Archita-Dash committed Dec 11, 2024
1 parent d2a3abe commit 642e810
Showing 1 changed file with 59 additions and 47 deletions.
106 changes: 59 additions & 47 deletions PWGDQ/Tasks/tableReader_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -304,51 +310,57 @@ struct AnalysisEventSelection {
// key: event global index, value: whether pileup event is a possible splitting
std::map<int64_t, bool> 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);
}
}
}
Expand Down

0 comments on commit 642e810

Please sign in to comment.