Skip to content

Commit 22cbf60

Browse files
committed
Fixed: Use constant references for non-modified iterators in range-based for loops.
1 parent f3ef57e commit 22cbf60

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

PWGLF/Tasks/Resonances/k892hadronphoton.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -813,24 +813,24 @@ struct k892hadronphoton {
813813

814814
//_______________________________________
815815
// Real Gamma x Real KShort - but not from the same kstar!
816-
if ((!fIsKStar)) { //(std::abs(PhotonPDGCode) == PDG_t::kGamma) && (std::abs(KShortPDGCode) == PDG_t::kK0Short) &&
816+
if ((!fIsKStar)) { //(std::abs(photonPDGCode) == PDG_t::kGamma) && (std::abs(KShortPDGCode) == PDG_t::kK0Short) &&
817817
histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dPtVsMassKStar_TrueDaughters"), kstarpT, kstarMass);
818818
histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dTrueDaughtersMatrix"), kshortPDGCodeMother, photonPDGCodeMother);
819819
}
820820

821821
//_______________________________________
822822
// Real Gamma x fake KShort
823-
if ((std::abs(PhotonPDGCode) == PDG_t::kGamma) && (std::abs(KShortPDGCode) != PDG_t::kK0Short))
823+
if ((std::abs(photonPDGCode) == PDG_t::kGamma) && (std::abs(kshortPDGCode) != PDG_t::kK0Short))
824824
histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dPtVsMassKStar_TrueGammaFakeKShort"), kstarpT, kstarMass);
825825

826826
//_______________________________________
827827
// Fake Gamma x Real KShort
828-
if ((std::abs(PhotonPDGCode) != PDG_t::kGamma) && ((std::abs(KShortPDGCode) == PDG_t::kK0Short)))
828+
if ((std::abs(photonPDGCode) != PDG_t::kGamma) && ((std::abs(kshortPDGCode) == PDG_t::kK0Short)))
829829
histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dPtVsMassKStar_FakeGammaTrueKShort"), kstarpT, kstarMass);
830830

831831
//_______________________________________
832832
// Fake Gamma x Fake KShort
833-
if ((std::abs(PhotonPDGCode) != PDG_t::kGamma) && (std::abs(KShortPDGCode) != PDG_t::kK0Short))
833+
if ((std::abs(photonPDGCode) != PDG_t::kGamma) && (std::abs(kshortPDGCode) != PDG_t::kK0Short))
834834
histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dPtVsMassKStar_FakeDaughters"), kstarpT, kstarMass);
835835
}
836836

PWGLF/Tasks/Resonances/k892hadronphotonBkg.cxx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,11 @@ struct k892hadronphotonBkg {
534534
return;
535535

536536
const float centrality = doPPAnalysis ? coll.centFT0M() : coll.centFT0C();
537-
for (int kIdx : kshortIndices) {
538-
auto kshort = fullV0s.rawIteratorAt(kIdx);
537+
for (const int& kIdx : kshortIndices) {
538+
const auto& kshort = fullV0s.rawIteratorAt(kIdx);
539539

540-
for (int pIdx : photonIndices) {
541-
auto photon = fullV0s.rawIteratorAt(pIdx);
540+
for (const int& pIdx : photonIndices) {
541+
const auto& photon = fullV0s.rawIteratorAt(pIdx);
542542

543543
// photon as a massless 4-vector
544544
ROOT::Math::PtEtaPhiMVector pGamma(photon.pt(),
@@ -631,7 +631,7 @@ struct k892hadronphotonBkg {
631631
// the framework applies JSON overrides), silently ignoring user configuration.
632632
BkgBinningType bkgColBinning{{axisVertexMixBkg, axisCentralityMixBkg}, true};
633633

634-
for (auto& [coll1, coll2] : selfCombinations(bkgColBinning, kstarBkgConfig.nMix, -1,
634+
for (const auto& [coll1, coll2] : selfCombinations(bkgColBinning, kstarBkgConfig.nMix, -1,
635635
collisions, collisions)) {
636636
if (coll1.globalIndex() == coll2.globalIndex())
637637
continue;
@@ -651,17 +651,17 @@ struct k892hadronphotonBkg {
651651

652652
// K0s(coll1) × γ(coll2)
653653
if (!kshorts1.empty() && !photons2.empty()) {
654-
for (int kIdx : kshorts1) {
655-
auto kshort = fullV0s.rawIteratorAt(kIdx);
654+
for (const int& kIdx : kshorts1) {
655+
const auto& kshort = fullV0s.rawIteratorAt(kIdx);
656656
float kP = std::hypot(kshort.px(), kshort.py(), kshort.pz());
657657
ROOT::Math::PxPyPzEVector fourMomKShort(
658658
kshort.px(), kshort.py(), kshort.pz(),
659659
std::sqrt(kP * kP +
660660
o2::constants::physics::MassK0Short *
661661
o2::constants::physics::MassK0Short));
662662

663-
for (int pIdx : photons2) {
664-
auto photon = fullV0s.rawIteratorAt(pIdx);
663+
for (const int& pIdx : photons2) {
664+
const auto& photon = fullV0s.rawIteratorAt(pIdx);
665665
float pP = std::hypot(photon.px(), photon.py(), photon.pz());
666666
ROOT::Math::PxPyPzEVector fourMomPhoton(
667667
photon.px(), photon.py(), photon.pz(), pP);
@@ -698,14 +698,14 @@ struct k892hadronphotonBkg {
698698

699699
// γ(coll1) × K0s(coll2)
700700
if (!photons1.empty() && !kshorts2.empty()) {
701-
for (int pIdx : photons1) {
702-
auto photon = fullV0s.rawIteratorAt(pIdx);
701+
for (const int pIdx : photons1) {
702+
const auto& photon = fullV0s.rawIteratorAt(pIdx);
703703
float pP = std::hypot(photon.px(), photon.py(), photon.pz());
704704
ROOT::Math::PxPyPzEVector fourMomPhoton(
705705
photon.px(), photon.py(), photon.pz(), pP);
706706

707-
for (int kIdx : kshorts2) {
708-
auto kshort = fullV0s.rawIteratorAt(kIdx);
707+
for (const int kIdx : kshorts2) {
708+
const auto& kshort = fullV0s.rawIteratorAt(kIdx);
709709
float kP = std::hypot(kshort.px(), kshort.py(), kshort.pz());
710710
ROOT::Math::PxPyPzEVector fourMomKShort(
711711
kshort.px(), kshort.py(), kshort.pz(),

0 commit comments

Comments
 (0)