@@ -103,8 +103,6 @@ struct HfTaskD0 {
103103 Configurable<float > upcZDCThreshold{" upcZDCThreshold" , 1 .0f , " ZDC energy threshold for UPC gap determination (a.u.)" };
104104
105105 HfEventSelection hfEvSel; // event selection and monitoring
106- SGSelector sgSelector; // UPC gap selector
107-
108106 ctpRateFetcher mRateFetcher ;
109107
110108 SliceCache cache;
@@ -161,8 +159,10 @@ struct HfTaskD0 {
161159 ConfigurableAxis thnConfigAxisMinTpcNCrossedRows{" thnConfigAxisMinTpcNCrossedRows" , {10 , 70 , 180 }, " axis for minimum TPC NCls crossed rows of candidate prongs" };
162160 ConfigurableAxis thnConfigAxisIR{" thnConfigAxisIR" , {5000 , 0 , 500 }, " Interaction rate (kHz)" };
163161 ConfigurableAxis thnConfigAxisGapType{" thnConfigAxisGapType" , {7 , -1.5 , 5.5 }, " axis for UPC gap type (-1=NoGap, 0=SingleGapA, 1=SingleGapC, 2=DoubleGap, 3=NoUpc, 4=TrkOutOfRange, 5=BadDoubleGap)" };
164- ConfigurableAxis thnConfigAxisFT0A{" thnConfigAxisFT0A" , {1001 , -1.5 , 999.5 }, " axis for FT0-A amplitude (a.u.)" };
165- ConfigurableAxis thnConfigAxisFT0C{" thnConfigAxisFT0C" , {1001 , -1.5 , 999.5 }, " axis for FT0-C amplitude (a.u.)" };
162+ ConfigurableAxis thnConfigAxisFT0{" thnConfigAxisFT0" , {1001 , -1.5 , 999.5 }, " axis for FT0 amplitude (a.u.)" };
163+ ConfigurableAxis thnConfigAxisFV0A{" thnConfigAxisFV0A" , {2001 , -1.5 , 1999.5 }, " axis for FV0-A amplitude (a.u.)" };
164+ ConfigurableAxis thnConfigAxisFDD{" thnConfigAxisFDD" , {200 , 0 ., 4000 .}, " axis for FDD amplitude (a.u.)" };
165+ ConfigurableAxis thnConfigAxisZN{" thnConfigAxisZN" , {510 , -1.5 , 49.5 }, " axis for ZN energy (a.u.)" };
166166
167167 HistogramRegistry registry{
168168 " registry" ,
@@ -306,8 +306,13 @@ struct HfTaskD0 {
306306 const AxisSpec thnAxisMinTpcNCrossedRows{thnConfigAxisMinTpcNCrossedRows, " Minimum TPC crossed rows" };
307307 const AxisSpec thnAxisIR{thnConfigAxisIR, " Interaction rate" };
308308 const AxisSpec thnAxisGapType{thnConfigAxisGapType, " Gap type" };
309- const AxisSpec thnAxisFT0A{thnConfigAxisFT0A, " FT0-A amplitude" };
310- const AxisSpec thnAxisFT0C{thnConfigAxisFT0C, " FT0-C amplitude" };
309+ const AxisSpec thnAxisFT0A{thnConfigAxisFT0, " FT0-A amplitude" };
310+ const AxisSpec thnAxisFT0C{thnConfigAxisFT0, " FT0-C amplitude" };
311+ const AxisSpec thnAxisFV0A{thnConfigAxisFV0A, " FV0-A amplitude" };
312+ const AxisSpec thnAxisFDDA{thnConfigAxisFDD, " FDD-A amplitude" };
313+ const AxisSpec thnAxisFDDC{thnConfigAxisFDD, " FDD-C amplitude" };
314+ const AxisSpec thnAxisZNA{thnConfigAxisZN, " ZNA energy" };
315+ const AxisSpec thnAxisZNC{thnConfigAxisZN, " ZNC energy" };
311316
312317 if (doprocessMcWithDCAFitterN || doprocessMcWithDCAFitterNCent || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithDCAFitterNMlCent || doprocessMcWithKFParticleMl) {
313318 std::vector<AxisSpec> axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr};
@@ -361,6 +366,11 @@ struct HfTaskD0 {
361366 axes.push_back (thnAxisGapType);
362367 axes.push_back (thnAxisFT0A);
363368 axes.push_back (thnAxisFT0C);
369+ axes.push_back (thnAxisFV0A);
370+ axes.push_back (thnAxisFDDA);
371+ axes.push_back (thnAxisFDDC);
372+ axes.push_back (thnAxisZNA);
373+ axes.push_back (thnAxisZNC);
364374 }
365375
366376 if (applyMl) {
@@ -576,23 +586,42 @@ struct HfTaskD0 {
576586 if (rejectionMask != 0 ) {
577587 continue ;
578588 }
579- const auto & bc = collision.template bc_as <BCsType>();
580- upchelpers::FITInfo fitInfo{};
581- udhelpers::getFITinfo (fitInfo, bc, bcs, ft0s, fv0as, fdds);
589+ auto bc = collision.template bc_as <BCsType>();
582590
583591 // Determine gap type using SGSelector with BC range checking
584- int gap = hf_upc::determineGapType (collision, bcs, sgSelector,
585- upcFV0AThreshold, upcFT0AThreshold, upcFT0CThreshold);
592+ const auto gapResult = hf_upc::determineGapType (collision, bcs,
593+ upcFV0AThreshold, upcFT0AThreshold, upcFT0CThreshold);
594+ const int gap = gapResult.value ;
595+
596+ // Use the BC with FIT activity if available from SGSelector
597+ auto bcForUPC = bc;
598+ if (gapResult.bc ) {
599+ bcForUPC = *(gapResult.bc );
600+ }
601+
602+ // Get FIT information from the UPC BC
603+ upchelpers::FITInfo fitInfo{};
604+ udhelpers::getFITinfo (fitInfo, bcForUPC, bcs, ft0s, fv0as, fdds);
605+
606+ // Get ZDC energies if available (extract once and reuse)
607+ const bool hasZdc = bcForUPC.has_zdc ();
608+ float zdcEnergyZNA = -1 .f ;
609+ float zdcEnergyZNC = -1 .f ;
610+ if (hasZdc) {
611+ const auto & zdc = bcForUPC.zdc ();
612+ zdcEnergyZNA = zdc.energyCommonZNA ();
613+ zdcEnergyZNC = zdc.energyCommonZNC ();
614+ }
586615
587- if (bc. has_zdc ()) {
588- const auto & zdc = bc. zdc ();
616+ // Fill QA histograms using the UPC BC for both FIT and ZDC
617+ if (hasZdc) {
589618 registry.fill (HIST (" Data/fitInfo/ampFT0A_vs_ampFT0C" ), fitInfo.ampFT0A , fitInfo.ampFT0C );
590- registry.fill (HIST (" Data/zdc/energyZNA_vs_energyZNC" ), zdc. energyCommonZNA (), zdc. energyCommonZNC () );
619+ registry.fill (HIST (" Data/zdc/energyZNA_vs_energyZNC" ), zdcEnergyZNA, zdcEnergyZNC );
591620 registry.fill (HIST (" Data/hUpcGapAfterSelection" ), hf_upc::gapTypeToInt (gap));
592621 }
593622
594623 if (hf_upc::isSingleSidedGap (gap)) {
595- int const gapTypeInt = hf_upc::gapTypeToInt (gap);
624+ const int gapTypeInt = hf_upc::gapTypeToInt (gap);
596625 const auto thisCollId = collision.globalIndex ();
597626 const auto & groupedD0Candidates = candidates.sliceBy (candD0PerCollision, thisCollId);
598627
@@ -624,10 +653,10 @@ struct HfTaskD0 {
624653 registry.fill (HIST (" hMassVsPhi" ), massD0bar, ptCandidate, candidate.phi ());
625654 }
626655
627- // Fill THnSparse with structure matching histogram axes: [mass, pt, (mlScores if FillMl), rapidity, d0Type, (cent if storeCentrality), (occ, ir if storeOccupancyAndIR), gapType, FT0A, FT0C]
656+ // Fill THnSparse with structure matching histogram axes: [mass, pt, (mlScores if FillMl), rapidity, d0Type, (cent if storeCentrality), (occ, ir if storeOccupancyAndIR), gapType, FT0A, FT0C, FV0A, FDDA, FDDC, ZNA, ZNC ]
628657 auto fillTHnData = [&](float mass, int d0Type) {
629658 // Pre-calculate vector size to avoid reallocations
630- constexpr int NAxesBase = 7 ; // mass, pt, rapidity, d0Type, gapType, FT0A, FT0C
659+ constexpr int NAxesBase = 12 ; // mass, pt, rapidity, d0Type, gapType, FT0A, FT0C, FV0A, FDDA, FDDC, ZNA, ZNC
631660 constexpr int NAxesMl = FillMl ? 3 : 0 ; // 3 ML scores if FillMl
632661 int const nAxesCent = storeCentrality ? 1 : 0 ; // centrality if storeCentrality
633662 int const nAxesOccIR = storeOccupancyAndIR ? 2 : 0 ; // occupancy and IR if storeOccupancyAndIR
@@ -656,6 +685,11 @@ struct HfTaskD0 {
656685 valuesToFill.push_back (static_cast <double >(gapTypeInt));
657686 valuesToFill.push_back (static_cast <double >(fitInfo.ampFT0A ));
658687 valuesToFill.push_back (static_cast <double >(fitInfo.ampFT0C ));
688+ valuesToFill.push_back (static_cast <double >(fitInfo.ampFV0A ));
689+ valuesToFill.push_back (static_cast <double >(fitInfo.ampFDDA ));
690+ valuesToFill.push_back (static_cast <double >(fitInfo.ampFDDC ));
691+ valuesToFill.push_back (static_cast <double >(zdcEnergyZNA));
692+ valuesToFill.push_back (static_cast <double >(zdcEnergyZNC));
659693
660694 if constexpr (FillMl) {
661695 registry.get <THnSparse>(HIST (" hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type" ))->Fill (valuesToFill.data ());
0 commit comments