@@ -100,7 +100,8 @@ struct upcPhotonuclearAnalysisJMG {
100100 HistogramRegistry histos{" histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
101101
102102 // Declare configurables on events/collisions
103- Configurable<int > nEvenstMixed{" nEvenstMixed" , 3 , {" Events to be Mixed" }};
103+ Configurable<int > nEventsMixed{" nEventsMixed" , 3 , {" Events to be Mixed" }};
104+ Configurable<int > factorEventsMixed{" factorEventsMixed" , 100 , {" factorEventsMixed to events mixed" }};
104105 Configurable<float > myZVtxCut{" myZVtxCut" , 10 ., {" My collision cut" }};
105106 Configurable<float > myTimeZNACut{" myTimeZNACut" , 2 ., {" My collision cut" }};
106107 Configurable<float > myTimeZNCCut{" myTimeZNCCut" , 2 ., {" My collision cut" }};
@@ -275,23 +276,18 @@ struct upcPhotonuclearAnalysisJMG {
275276 mixedGapSideC.setObject (new CorrelationContainer (" mixedEventGapSideC" , " mixedEventGapSideC" , corrAxis, effAxis, {}));
276277 }
277278
278- std::vector<double > vtxBinsEdges{VARIABLE_WIDTH, -10 .0f , -5 .0f , 0 .0f , 5 .0f , 10 .0f };
279+ std::vector<double > vtxBinsEdges{VARIABLE_WIDTH, -10 .0f , -7 . 0f , - 5 .0f , - 2 . 5f , 0 .0f , 2 . 5f , 5 . 0f , 7 .0f , 10 .0f };
279280 std::vector<double > gapSideBinsEdges{VARIABLE_WIDTH, -0.5 , 0.5 , 1.5 };
280281
281282 SliceCache cache;
283+ int countGapA = 0 ;
284+ int countGapC = 0 ;
282285
283286 // Binning only on PosZ without multiplicity
284287 // using BinningType = ColumnBinningPolicy<aod::collision::PosZ>;
285288 using BinningType = ColumnBinningPolicy<aod::collision::PosZ, aod::udcollision::GapSide>;
286- BinningType bindingOnVtx{{vtxBinsEdges, {gapSideBinsEdges}}, true };
287- SameKindPair<FullSGUDCollision, FullUDTracks, BinningType> pairs{bindingOnVtx, nEvenstMixed, -1 , &cache};
288-
289- // ColumnBinningPolicy<aod::collision::PosZ, aod::udcollision::TotalFT0AmplitudeC> bindingOnVtx{{vtxBinsEdges, multBinsEdges}, true};
290-
291- // SameKindPair<soa::Join<aod::UDCollisions, aod::UDCollisionsSels, aod::SGCollisions, aod::UDZdcsReduced>,
292- // FullUDTracks,
293- // ColumnBinningPolicy<aod::collision::PosZ, aod::udcollision::TotalFT0AmplitudeC>>
294- // pair{bindingOnVtx, 5, -1, &cache};
289+ BinningType bindingOnVtx{{vtxBinsEdges, gapSideBinsEdges}, true };
290+ SameKindPair<FullSGUDCollision, FullUDTracks, BinningType> pairs{bindingOnVtx, nEventsMixed, -1 , &cache};
295291
296292 template <typename CSG>
297293 bool isCollisionCutSG (CSG const & collision, int SideGap)
@@ -584,7 +580,8 @@ struct upcPhotonuclearAnalysisJMG {
584580 if (fillCollisionUD (sameGapSideC, multiplicity) == false ) {
585581 return ;
586582 }
587- // LOGF(debug, "Filling sameGapSideC events");
583+ histos.fill (HIST (" eventcount" ), -1 );
584+ // LOGF(info, "Filling sameGapSideC events");
588585 fillCorrelationsUD (sameGapSideC, reconstructedTracks, reconstructedTracks, multiplicity, reconstructedCollision.posZ ());
589586 break ;
590587 default :
@@ -601,39 +598,57 @@ struct upcPhotonuclearAnalysisJMG {
601598 // int sgSide = reconstructedCollision.gapSide();
602599 // int sgSide = 0;
603600
601+ int maxCountGapA = 0 ;
602+ int maxCountGapC = 0 ;
603+
604+ if (auto histEventCount = histos.get <TH1>(HIST (" eventcount" ))) {
605+ int binA = histEventCount->GetXaxis ()->FindBin (-2 ); // Gap A
606+ int binC = histEventCount->GetXaxis ()->FindBin (-1 ); // Gap C
607+
608+ maxCountGapA = histEventCount->GetBinContent (binA) * factorEventsMixed;
609+ maxCountGapC = histEventCount->GetBinContent (binC) * factorEventsMixed;
610+ }
611+
604612 for (const auto & [collision1, tracks1, collision2, tracks2] : pairs) {
605613 if (collision1.size () == 0 || collision2.size () == 0 ) {
606- // LOGF(debug , "One or both collisions are empty.");
614+ // LOGF(info , "One or both collisions are empty.");
607615 continue ;
608616 }
609617
618+ if (countGapA >= maxCountGapA && countGapC >= maxCountGapC) {
619+ break ;
620+ }
610621 float multiplicity = 0 ;
611622 if (collision1.gapSide () == 0 && collision2.gapSide () == 0 ) { // gap on side A
612623 if (isCollisionCutSG (collision1, 0 ) == false && isCollisionCutSG (collision2, 0 ) == false ) {
613624 continue ;
614625 }
615- // LOGF(debug, "In the pairs loop, gap side A");
626+ // std::cout << "Counts for Gap A: " << countGapA << " Maximum Count for Gap A " << maxCountGapA << std::endl;
627+ ++countGapA;
628+ // LOGF(info, "In the pairs loop, gap side A");
616629 multiplicity = tracks1.size ();
617630 if (fillCollisionUD (mixedGapSideA, multiplicity) == false ) {
618631 return ;
619632 }
620633 // histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ()}));
621634 histos.fill (HIST (" eventcount" ), bindingOnVtx.getBin ({collision1.posZ (), collision1.gapSide ()}));
622635 fillCorrelationsUD (mixedGapSideA, tracks1, tracks2, multiplicity, collision1.posZ ());
623- // LOGF(debug , "Filling mixedGapSideA events, Gap for side A");
636+ // LOGF(info , "Filling mixedGapSideA events, Gap for side A");
624637 }
625638
626639 if (collision1.gapSide () == 1 && collision2.gapSide () == 1 ) { // gap on side C
627640 if (isCollisionCutSG (collision1, 1 ) == false && isCollisionCutSG (collision2, 1 ) == false ) {
628641 continue ;
629642 }
630- // LOGF(debug, "In the pairs loop, gap side C");
643+ // std::cout << "Counts for Gap C: " << countGapC << " Maximum Count for Gap C" << maxCountGapC << std::endl;
644+ ++countGapC;
645+ // LOGF(info, "In the pairs loop, gap side C");
631646 multiplicity = tracks1.size ();
632647 if (fillCollisionUD (mixedGapSideC, multiplicity) == false ) {
633648 return ;
634649 }
635650 fillCorrelationsUD (mixedGapSideC, tracks1, tracks2, multiplicity, collision1.posZ ());
636- // LOGF(debug , "Filling mixedGapSideC events, Gap for side C");
651+ // LOGF(info , "Filling mixedGapSideC events, Gap for side C");
637652 } else {
638653 continue ;
639654 }
0 commit comments