Skip to content

Commit 341166e

Browse files
committed
disable isSingleSidedGap
1 parent 471ff5f commit 341166e

File tree

3 files changed

+136
-141
lines changed

3 files changed

+136
-141
lines changed

PWGHF/D2H/Tasks/taskD0.cxx

Lines changed: 74 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -606,97 +606,94 @@ struct HfTaskD0 {
606606
zdcEnergyZNA = zdc.energyCommonZNA();
607607
zdcEnergyZNC = zdc.energyCommonZNC();
608608
registry.fill(HIST("Data/zdc/energyZNA_vs_energyZNC"), zdcEnergyZNA, zdcEnergyZNC);
609-
610609
}
611610

612611
registry.fill(HIST("Data/fitInfo/ampFT0A_vs_ampFT0C"), fitInfo.ampFT0A, fitInfo.ampFT0C);
613612
registry.fill(HIST("Data/hUpcGapAfterSelection"), gap);
614613

615-
if (hf_upc::isSingleSidedGap(gap)) {
616-
const auto thisCollId = collision.globalIndex();
617-
const auto& groupedD0Candidates = candidates.sliceBy(candD0PerCollision, thisCollId);
614+
const auto thisCollId = collision.globalIndex();
615+
const auto& groupedD0Candidates = candidates.sliceBy(candD0PerCollision, thisCollId);
618616

619-
// Calculate occupancy and interaction rate if needed
620-
float occ{-1.f};
621-
float ir{-1.f};
622-
if (storeOccupancyAndIR && occEstimator != OccupancyEstimator::None) {
623-
occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator);
624-
ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource, true) * 1.e-3; // kHz
617+
// Calculate occupancy and interaction rate if needed
618+
float occ{-1.f};
619+
float ir{-1.f};
620+
if (storeOccupancyAndIR && occEstimator != OccupancyEstimator::None) {
621+
occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator);
622+
ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource, true) * 1.e-3; // kHz
623+
}
624+
625+
for (const auto& candidate : groupedD0Candidates) {
626+
if (yCandRecoMax >= 0. && std::abs(HfHelper::yD0(candidate)) > yCandRecoMax) {
627+
continue;
625628
}
626629

627-
for (const auto& candidate : groupedD0Candidates) {
628-
if (yCandRecoMax >= 0. && std::abs(HfHelper::yD0(candidate)) > yCandRecoMax) {
629-
continue;
630-
}
630+
const float massD0 = HfHelper::invMassD0ToPiK(candidate);
631+
const float massD0bar = HfHelper::invMassD0barToKPi(candidate);
632+
const auto ptCandidate = candidate.pt();
631633

632-
const float massD0 = HfHelper::invMassD0ToPiK(candidate);
633-
const float massD0bar = HfHelper::invMassD0barToKPi(candidate);
634-
const auto ptCandidate = candidate.pt();
634+
if (candidate.isSelD0() >= selectionFlagD0) {
635+
registry.fill(HIST("hMass"), massD0, ptCandidate);
636+
registry.fill(HIST("hMassFinerBinning"), massD0, ptCandidate);
637+
registry.fill(HIST("hMassVsPhi"), massD0, ptCandidate, candidate.phi());
638+
}
639+
if (candidate.isSelD0bar() >= selectionFlagD0bar) {
640+
registry.fill(HIST("hMass"), massD0bar, ptCandidate);
641+
registry.fill(HIST("hMassFinerBinning"), massD0bar, ptCandidate);
642+
registry.fill(HIST("hMassVsPhi"), massD0bar, ptCandidate, candidate.phi());
643+
}
635644

636-
if (candidate.isSelD0() >= selectionFlagD0) {
637-
registry.fill(HIST("hMass"), massD0, ptCandidate);
638-
registry.fill(HIST("hMassFinerBinning"), massD0, ptCandidate);
639-
registry.fill(HIST("hMassVsPhi"), massD0, ptCandidate, candidate.phi());
645+
// 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]
646+
auto fillTHnData = [&](float mass, int d0Type) {
647+
// Pre-calculate vector size to avoid reallocations
648+
constexpr int NAxesBase = 12; // mass, pt, rapidity, d0Type, gapType, FT0A, FT0C, FV0A, FDDA, FDDC, ZNA, ZNC
649+
constexpr int NAxesMl = FillMl ? 3 : 0; // 3 ML scores if FillMl
650+
int const nAxesCent = storeCentrality ? 1 : 0; // centrality if storeCentrality
651+
int const nAxesOccIR = storeOccupancyAndIR ? 2 : 0; // occupancy and IR if storeOccupancyAndIR
652+
int const nAxesTotal = NAxesBase + NAxesMl + nAxesCent + nAxesOccIR;
653+
654+
std::vector<double> valuesToFill;
655+
valuesToFill.reserve(nAxesTotal);
656+
657+
// Fill values in order matching histogram axes
658+
valuesToFill.push_back(static_cast<double>(mass));
659+
valuesToFill.push_back(static_cast<double>(ptCandidate));
660+
if constexpr (FillMl) {
661+
valuesToFill.push_back(candidate.mlProbD0()[0]);
662+
valuesToFill.push_back(candidate.mlProbD0()[1]);
663+
valuesToFill.push_back(candidate.mlProbD0()[2]);
640664
}
641-
if (candidate.isSelD0bar() >= selectionFlagD0bar) {
642-
registry.fill(HIST("hMass"), massD0bar, ptCandidate);
643-
registry.fill(HIST("hMassFinerBinning"), massD0bar, ptCandidate);
644-
registry.fill(HIST("hMassVsPhi"), massD0bar, ptCandidate, candidate.phi());
665+
valuesToFill.push_back(static_cast<double>(HfHelper::yD0(candidate)));
666+
valuesToFill.push_back(static_cast<double>(d0Type));
667+
if (storeCentrality) {
668+
valuesToFill.push_back(centrality);
645669
}
646-
647-
// 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]
648-
auto fillTHnData = [&](float mass, int d0Type) {
649-
// Pre-calculate vector size to avoid reallocations
650-
constexpr int NAxesBase = 12; // mass, pt, rapidity, d0Type, gapType, FT0A, FT0C, FV0A, FDDA, FDDC, ZNA, ZNC
651-
constexpr int NAxesMl = FillMl ? 3 : 0; // 3 ML scores if FillMl
652-
int const nAxesCent = storeCentrality ? 1 : 0; // centrality if storeCentrality
653-
int const nAxesOccIR = storeOccupancyAndIR ? 2 : 0; // occupancy and IR if storeOccupancyAndIR
654-
int const nAxesTotal = NAxesBase + NAxesMl + nAxesCent + nAxesOccIR;
655-
656-
std::vector<double> valuesToFill;
657-
valuesToFill.reserve(nAxesTotal);
658-
659-
// Fill values in order matching histogram axes
660-
valuesToFill.push_back(static_cast<double>(mass));
661-
valuesToFill.push_back(static_cast<double>(ptCandidate));
662-
if constexpr (FillMl) {
663-
valuesToFill.push_back(candidate.mlProbD0()[0]);
664-
valuesToFill.push_back(candidate.mlProbD0()[1]);
665-
valuesToFill.push_back(candidate.mlProbD0()[2]);
666-
}
667-
valuesToFill.push_back(static_cast<double>(HfHelper::yD0(candidate)));
668-
valuesToFill.push_back(static_cast<double>(d0Type));
669-
if (storeCentrality) {
670-
valuesToFill.push_back(centrality);
671-
}
672-
if (storeOccupancyAndIR) {
673-
valuesToFill.push_back(occ);
674-
valuesToFill.push_back(ir);
675-
}
676-
valuesToFill.push_back(static_cast<double>(gap));
677-
valuesToFill.push_back(static_cast<double>(fitInfo.ampFT0A));
678-
valuesToFill.push_back(static_cast<double>(fitInfo.ampFT0C));
679-
valuesToFill.push_back(static_cast<double>(fitInfo.ampFV0A));
680-
valuesToFill.push_back(static_cast<double>(fitInfo.ampFDDA));
681-
valuesToFill.push_back(static_cast<double>(fitInfo.ampFDDC));
682-
valuesToFill.push_back(static_cast<double>(zdcEnergyZNA));
683-
valuesToFill.push_back(static_cast<double>(zdcEnergyZNC));
684-
685-
if constexpr (FillMl) {
686-
registry.get<THnSparse>(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"))->Fill(valuesToFill.data());
687-
} else {
688-
registry.get<THnSparse>(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"))->Fill(valuesToFill.data());
689-
}
690-
};
691-
692-
if (candidate.isSelD0() >= selectionFlagD0) {
693-
fillTHnData(massD0, SigD0);
694-
fillTHnData(massD0, candidate.isSelD0bar() ? ReflectedD0 : PureSigD0);
670+
if (storeOccupancyAndIR) {
671+
valuesToFill.push_back(occ);
672+
valuesToFill.push_back(ir);
695673
}
696-
if (candidate.isSelD0bar() >= selectionFlagD0bar) {
697-
fillTHnData(massD0bar, SigD0bar);
698-
fillTHnData(massD0bar, candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar);
674+
valuesToFill.push_back(static_cast<double>(gap));
675+
valuesToFill.push_back(static_cast<double>(fitInfo.ampFT0A));
676+
valuesToFill.push_back(static_cast<double>(fitInfo.ampFT0C));
677+
valuesToFill.push_back(static_cast<double>(fitInfo.ampFV0A));
678+
valuesToFill.push_back(static_cast<double>(fitInfo.ampFDDA));
679+
valuesToFill.push_back(static_cast<double>(fitInfo.ampFDDC));
680+
valuesToFill.push_back(static_cast<double>(zdcEnergyZNA));
681+
valuesToFill.push_back(static_cast<double>(zdcEnergyZNC));
682+
683+
if constexpr (FillMl) {
684+
registry.get<THnSparse>(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"))->Fill(valuesToFill.data());
685+
} else {
686+
registry.get<THnSparse>(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"))->Fill(valuesToFill.data());
699687
}
688+
};
689+
690+
if (candidate.isSelD0() >= selectionFlagD0) {
691+
fillTHnData(massD0, SigD0);
692+
fillTHnData(massD0, candidate.isSelD0bar() ? ReflectedD0 : PureSigD0);
693+
}
694+
if (candidate.isSelD0bar() >= selectionFlagD0bar) {
695+
fillTHnData(massD0bar, SigD0bar);
696+
fillTHnData(massD0bar, candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar);
700697
}
701698
}
702699
}

PWGHF/D2H/Tasks/taskDplus.cxx

Lines changed: 60 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -747,72 +747,70 @@ struct HfTaskDplus {
747747
registry.fill(HIST("Data/fitInfo/ampFT0A_vs_ampFT0C"), fitInfo.ampFT0A, fitInfo.ampFT0C);
748748
registry.fill(HIST("Data/hUpcGapAfterSelection"), gap);
749749

750-
if (hf_upc::isSingleSidedGap(gap)) {
751-
const auto thisCollId = collision.globalIndex();
752-
const auto& groupedDplusCandidates = candidates.sliceBy(candDplusPerCollision, thisCollId);
753-
754-
float cent{-1.f};
755-
float occ{-1.f};
756-
float ir{-1.f};
757-
if (storeOccupancy && occEstimator != OccupancyEstimator::None) {
758-
occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator);
750+
const auto thisCollId = collision.globalIndex();
751+
const auto& groupedDplusCandidates = candidates.sliceBy(candDplusPerCollision, thisCollId);
752+
753+
float cent{-1.f};
754+
float occ{-1.f};
755+
float ir{-1.f};
756+
if (storeOccupancy && occEstimator != OccupancyEstimator::None) {
757+
occ = o2::hf_occupancy::getOccupancyColl(collision, occEstimator);
758+
}
759+
if (storeIR) {
760+
ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource, true) * 1.e-3; // kHz
761+
}
762+
static constexpr auto HSparseMass = HIST("hSparseMass");
763+
// Lambda function to fill THn - handles both ML and non-ML cases
764+
auto fillTHnData = [&](const auto& candidate) {
765+
// Pre-calculate vector size to avoid reallocations
766+
constexpr int NAxesBase = 10; // mass, pt, gapType, FT0A, FT0C, FV0A, FDDA, FDDC, ZNA, ZNC
767+
constexpr int NAxesMl = FillMl ? 3 : 0; // 3 ML scores if FillMl
768+
int const nAxesCent = storeCentrality ? 1 : 0; // centrality if storeCentrality
769+
int const nAxesOcc = storeOccupancy ? 1 : 0; // occupancy if storeOccupancy
770+
int const nAxesIR = storeIR ? 1 : 0; // IR if storeIR
771+
int const nAxesTotal = NAxesBase + NAxesMl + nAxesCent + nAxesOcc + nAxesIR;
772+
773+
std::vector<double> valuesToFill;
774+
valuesToFill.reserve(nAxesTotal);
775+
776+
// Fill values in order matching histogram axes
777+
valuesToFill.push_back(HfHelper::invMassDplusToPiKPi(candidate));
778+
valuesToFill.push_back(static_cast<double>(candidate.pt()));
779+
if constexpr (FillMl) {
780+
std::vector<float> outputMl = {-999., -999., -999.};
781+
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
782+
outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)];
783+
}
784+
valuesToFill.push_back(outputMl[0]);
785+
valuesToFill.push_back(outputMl[1]);
786+
valuesToFill.push_back(outputMl[2]);
787+
}
788+
if (storeCentrality) {
789+
valuesToFill.push_back(cent);
790+
}
791+
if (storeOccupancy) {
792+
valuesToFill.push_back(occ);
759793
}
760794
if (storeIR) {
761-
ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), bc.runNumber(), irSource, true) * 1.e-3; // kHz
795+
valuesToFill.push_back(ir);
762796
}
763-
static constexpr auto HSparseMass = HIST("hSparseMass");
764-
// Lambda function to fill THn - handles both ML and non-ML cases
765-
auto fillTHnData = [&](const auto& candidate) {
766-
// Pre-calculate vector size to avoid reallocations
767-
constexpr int NAxesBase = 10; // mass, pt, gapType, FT0A, FT0C, FV0A, FDDA, FDDC, ZNA, ZNC
768-
constexpr int NAxesMl = FillMl ? 3 : 0; // 3 ML scores if FillMl
769-
int const nAxesCent = storeCentrality ? 1 : 0; // centrality if storeCentrality
770-
int const nAxesOcc = storeOccupancy ? 1 : 0; // occupancy if storeOccupancy
771-
int const nAxesIR = storeIR ? 1 : 0; // IR if storeIR
772-
int const nAxesTotal = NAxesBase + NAxesMl + nAxesCent + nAxesOcc + nAxesIR;
773-
774-
std::vector<double> valuesToFill;
775-
valuesToFill.reserve(nAxesTotal);
776-
777-
// Fill values in order matching histogram axes
778-
valuesToFill.push_back(HfHelper::invMassDplusToPiKPi(candidate));
779-
valuesToFill.push_back(static_cast<double>(candidate.pt()));
780-
if constexpr (FillMl) {
781-
std::vector<float> outputMl = {-999., -999., -999.};
782-
for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) {
783-
outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)];
784-
}
785-
valuesToFill.push_back(outputMl[0]);
786-
valuesToFill.push_back(outputMl[1]);
787-
valuesToFill.push_back(outputMl[2]);
788-
}
789-
if (storeCentrality) {
790-
valuesToFill.push_back(cent);
791-
}
792-
if (storeOccupancy) {
793-
valuesToFill.push_back(occ);
794-
}
795-
if (storeIR) {
796-
valuesToFill.push_back(ir);
797-
}
798-
valuesToFill.push_back(static_cast<double>(gap));
799-
valuesToFill.push_back(static_cast<double>(fitInfo.ampFT0A));
800-
valuesToFill.push_back(static_cast<double>(fitInfo.ampFT0C));
801-
valuesToFill.push_back(static_cast<double>(fitInfo.ampFV0A));
802-
valuesToFill.push_back(static_cast<double>(fitInfo.ampFDDA));
803-
valuesToFill.push_back(static_cast<double>(fitInfo.ampFDDC));
804-
valuesToFill.push_back(static_cast<double>(zdcEnergyZNA));
805-
valuesToFill.push_back(static_cast<double>(zdcEnergyZNC));
806-
registry.get<THnSparse>(HSparseMass)->Fill(valuesToFill.data());
807-
};
808-
809-
for (const auto& candidate : groupedDplusCandidates) {
810-
if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) {
811-
continue;
812-
}
813-
fillHisto(candidate);
814-
fillTHnData(candidate);
797+
valuesToFill.push_back(static_cast<double>(gap));
798+
valuesToFill.push_back(static_cast<double>(fitInfo.ampFT0A));
799+
valuesToFill.push_back(static_cast<double>(fitInfo.ampFT0C));
800+
valuesToFill.push_back(static_cast<double>(fitInfo.ampFV0A));
801+
valuesToFill.push_back(static_cast<double>(fitInfo.ampFDDA));
802+
valuesToFill.push_back(static_cast<double>(fitInfo.ampFDDC));
803+
valuesToFill.push_back(static_cast<double>(zdcEnergyZNA));
804+
valuesToFill.push_back(static_cast<double>(zdcEnergyZNC));
805+
registry.get<THnSparse>(HSparseMass)->Fill(valuesToFill.data());
806+
};
807+
808+
for (const auto& candidate : groupedDplusCandidates) {
809+
if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) {
810+
continue;
815811
}
812+
fillHisto(candidate);
813+
fillTHnData(candidate);
816814
}
817815
}
818816
}

PWGHF/Utils/utilsUpcHf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ inline auto determineGapType(TCollision const& collision,
111111
thresholds.ft0aThreshold.value,
112112
thresholds.ft0cThreshold.value);
113113
}
114-
114+
/*
115115
/// \brief Check if the gap type is a single-sided gap (SingleGapA or SingleGapC)
116116
/// \param gap TrueGap enum value
117117
/// \return true if single-sided gap, false otherwise
118118
constexpr bool isSingleSidedGap(int gap) noexcept
119119
{
120120
return (gap == TrueGap::SingleGapA || gap == TrueGap::SingleGapC || gap == TrueGap::DoubleGap || gap == TrueGap::BadDoubleGap || gap == TrueGap::TrkOutOfRange || gap == TrueGap::NoUpc);
121121
}
122-
122+
*/
123123
/// \brief Get gap type name as string
124124
/// \param gap TrueGap enum value
125125
/// \return String representation of gap type

0 commit comments

Comments
 (0)