@@ -357,9 +357,9 @@ struct HadNucleiFemto {
357357 ConfigurableAxis axisVertex{" axisVertex" , {30 , -10 , 10 }, " Binning for vtxz" };
358358 ConfigurableAxis axisCentrality{" axisCentrality" , {40 , 0 , 100 }, " Binning for centrality" };
359359 using BinningType = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C>;
360+ using SelectedCollisions = soa::Filtered<CollisionsFull>;
360361 BinningType binningPolicy{{axisVertex, axisCentrality}, true };
361362 SliceCache cache;
362- SameKindPair<CollisionsFull, TrackCandidates, BinningType> mPair {binningPolicy, eventMixing.settingNoMixedEvents , -1 , &cache};
363363 // Pair<CollisionsFull, TrackCandidates, o2::aod::DataHypCandsWColl, BinningType> hyperPair{binningPolicy, eventMixing.settingNoMixedEvents, -1, &cache};
364364
365365 std::array<float , 6 > mBBparamsNucleus {};
@@ -383,6 +383,7 @@ struct HadNucleiFemto {
383383 {" hCentrality" , " Centrality" , {HistType::kTH1F , {{100 , 0 .0f , 100 .0f }}}},
384384 {" hSkipReasons" , " Why storedEvent skipped;Reason;Counts" , {HistType::kTH1F , {{5 , -0.5 , 4.5 }}}},
385385 {" hEvents" , " ; Events;" , {HistType::kTH1F , {{3 , -0.5 , 2.5 }}}},
386+ {" hMixedEventSelections" , " Mixed-event collision selection;Step;Counts" , {HistType::kTH1F , {{4 , -0.5 , 3.5 }}}},
386387
387388 // Candidate topology and kinematics
388389 {" hTrackSel" , " Accepted hadron tracks" , {HistType::kTH1F , {{Selections::kAll , -0.5 , static_cast <double >(Selections::kAll ) - 0.5 }}}},
@@ -535,6 +536,11 @@ struct HadNucleiFemto {
535536 for (int i = 0 ; i < Selections::kAll ; i++) {
536537 mQaRegistry .get <TH1 >(HIST (" hEvents" ))->GetXaxis ()->SetBinLabel (i + 1 , eventsLabels[i].c_str ());
537538 }
539+
540+ const std::array<std::string, 4 > mixedEventLabels = {" All collisions" , " Event selection" , " Mixing pool" , " Mixed combinations" };
541+ for (size_t i = 0 ; i < mixedEventLabels.size (); i++) {
542+ mQaRegistry .get <TH1 >(HIST (" hMixedEventSelections" ))->GetXaxis ()->SetBinLabel (i + 1 , mixedEventLabels[i].c_str ());
543+ }
538544 }
539545
540546 template <bool isMC>
@@ -623,18 +629,6 @@ struct HadNucleiFemto {
623629 return mZorro .isSelected (bc.globalBC ());
624630 }
625631
626- template <bool isMC, typename Tcollision>
627- bool passesCollisionSelection (const Tcollision& collision)
628- {
629- if (!passesEventSelection<isMC>(collision)) {
630- return false ;
631- }
632- if constexpr (!isMC) {
633- return passesZorroSelection (collision);
634- }
635- return true ;
636- }
637-
638632 template <bool isMC, typename Tcollision>
639633 bool selectCollision (const Tcollision& collision, const aod::BCsWithTimestamps&)
640634 {
@@ -2216,10 +2210,31 @@ struct HadNucleiFemto {
22162210 {
22172211 LOG (debug) << " Processing mixed event" ;
22182212
2219- for (const auto & [c1, tracks1, c2, tracks2] : mPair ) {
2220- if (!passesCollisionSelection</* isMC*/ false >(c1) || !passesCollisionSelection</* isMC*/ false >(c2)) {
2213+ // Zorro is a runtime selection, so build its filtered collision table before applying the mixing depth.
2214+ soa::SelectionVector selectedCollisionRows;
2215+ int64_t rowIndex = 0 ;
2216+ for (const auto & collision : collisions) {
2217+ mQaRegistry .fill (HIST (" hMixedEventSelections" ), 0 );
2218+ if (!passesEventSelection</* isMC*/ false >(collision)) {
2219+ ++rowIndex;
22212220 continue ;
22222221 }
2222+ mQaRegistry .fill (HIST (" hMixedEventSelections" ), 1 );
2223+ if (!passesZorroSelection (collision)) {
2224+ ++rowIndex;
2225+ continue ;
2226+ }
2227+ selectedCollisionRows.push_back (rowIndex++);
2228+ mQaRegistry .fill (HIST (" hMixedEventSelections" ), 2 );
2229+ }
2230+
2231+ SelectedCollisions selectedCollisions{{collisions.asArrowTableRef ()}, std::move (selectedCollisionRows)};
2232+ collisions.copyIndexBindings (selectedCollisions);
2233+ auto tracksTuple = std::make_tuple (tracks);
2234+ SameKindPair<SelectedCollisions, TrackCandidates, BinningType> selectedPairs{binningPolicy, eventMixing.settingNoMixedEvents , -1 , selectedCollisions, tracksTuple, &cache};
2235+
2236+ for (const auto & [c1, tracks1, c2, tracks2] : selectedPairs) {
2237+ mQaRegistry .fill (HIST (" hMixedEventSelections" ), 3 );
22232238
22242239 mQaRegistry .fill (HIST (" hNcontributor" ), c1.numContrib ());
22252240 mQaRegistry .fill (HIST (" hVtxZ" ), c1.posZ ());
0 commit comments