Skip to content

Commit 0b772ad

Browse files
committed
fix O2linter pt2
1 parent bea7a79 commit 0b772ad

File tree

1 file changed

+48
-37
lines changed

1 file changed

+48
-37
lines changed

PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ using namespace o2::aod;
6262
using namespace o2::framework;
6363
using namespace o2::framework::expressions;
6464

65+
enum Modes {
66+
kDbarPbar = 0,
67+
kDP,
68+
kDbarP,
69+
kDPbar,
70+
kPbarP,
71+
kPbarPbar,
72+
kPP,
73+
kPPbar
74+
};
75+
6576
struct hadronnucleicorrelation {
6677

6778
static constexpr int betahasTOFthr = -100;
@@ -746,7 +757,7 @@ struct hadronnucleicorrelation {
746757
}
747758
}
748759

749-
if (mode == 5 || mode == 6) { // Identical particle combinations
760+
if (mode == kPbarPbar || mode == kPP) { // Identical particle combinations
750761

751762
for (const auto& [part0, part1] : combinations(CombinationsStrictlyUpperIndexPolicy(tracks, tracks))) {
752763

@@ -765,14 +776,14 @@ struct hadronnucleicorrelation {
765776
continue;
766777

767778
// mode 6
768-
if (mode == 6) {
779+
if (mode == kPP) {
769780
if (!IsProton(part0, +1))
770781
continue;
771782
if (!IsProton(part1, +1))
772783
continue;
773784
}
774785
// mode 5
775-
if (mode == 5) {
786+
if (mode == kPbarPbar) {
776787
if (!IsProton(part0, -1))
777788
continue;
778789
if (!IsProton(part1, -1))
@@ -801,37 +812,37 @@ struct hadronnucleicorrelation {
801812
continue;
802813

803814
// modes 0,1,2,3,4,7
804-
if (mode == 0) {
815+
if (mode == kDbarPbar) {
805816
if (!IsDeuteron(part0, -1))
806817
continue;
807818
if (!IsProton(part1, -1))
808819
continue;
809820
}
810-
if (mode == 1) {
821+
if (mode == kDP) {
811822
if (!IsDeuteron(part0, +1))
812823
continue;
813824
if (!IsProton(part1, +1))
814825
continue;
815826
}
816-
if (mode == 2) {
827+
if (mode == kDbarP) {
817828
if (!IsDeuteron(part0, -1))
818829
continue;
819830
if (!IsProton(part1, +1))
820831
continue;
821832
}
822-
if (mode == 3) {
833+
if (mode == kDPbar) {
823834
if (!IsDeuteron(part0, +1))
824835
continue;
825836
if (!IsProton(part1, -1))
826837
continue;
827838
}
828-
if (mode == 4) {
839+
if (mode == kPbarP) {
829840
if (!IsProton(part0, -1))
830841
continue;
831842
if (!IsProton(part1, +1))
832843
continue;
833844
}
834-
if (mode == 7) {
845+
if (mode == kPPbar) {
835846
if (!IsProton(part0, +1))
836847
continue;
837848
if (!IsProton(part1, -1))
@@ -878,57 +889,57 @@ struct hadronnucleicorrelation {
878889
continue;
879890

880891
//{"mode", 0, "0: antid-antip, 1: d-p, 2: antid-p, 3: d-antip, 4: antip-p, 5: antip-antip, 6: p-p, 7: p-antip"};
881-
if (mode == 0) {
892+
if (mode == kDbarPbar) {
882893
if (!IsDeuteron(part0, -1))
883894
continue;
884895
if (!IsProton(part1, -1))
885896
continue;
886897
}
887-
if (mode == 1) {
898+
if (mode == kDP) {
888899
if (!IsDeuteron(part0, +1))
889900
continue;
890901
if (!IsProton(part1, +1))
891902
continue;
892903
}
893-
if (mode == 2) {
904+
if (mode == kDbarP) {
894905
if (!IsDeuteron(part0, -1))
895906
continue;
896907
if (!IsProton(part1, +1))
897908
continue;
898909
}
899-
if (mode == 3) {
910+
if (mode == kDPbar) {
900911
if (!IsDeuteron(part0, +1))
901912
continue;
902913
if (!IsProton(part1, -1))
903914
continue;
904915
}
905-
if (mode == 4) {
916+
if (mode == kPbarP) {
906917
if (!IsProton(part0, -1))
907918
continue;
908919
if (!IsProton(part1, +1))
909920
continue;
910921
}
911-
if (mode == 5) {
922+
if (mode == kPbarPbar) {
912923
if (!IsProton(part0, -1))
913924
continue;
914925
if (!IsProton(part1, -1))
915926
continue;
916927
}
917-
if (mode == 6) {
928+
if (mode == kPP) {
918929
if (!IsProton(part0, +1))
919930
continue;
920931
if (!IsProton(part1, +1))
921932
continue;
922933
}
923-
if (mode == 7) {
934+
if (mode == kPPbar) {
924935
if (!IsProton(part0, +1))
925936
continue;
926937
if (!IsProton(part1, -1))
927938
continue;
928939
}
929940

930941
bool isIdentical = false;
931-
if (mode == 5 || mode == 6)
942+
if (mode == kPbarPbar || mode == kPP)
932943
isIdentical = true;
933944

934945
fillHistograms(part0, part1, true, isIdentical);
@@ -939,7 +950,7 @@ struct hadronnucleicorrelation {
939950

940951
void processMC(FilteredCollisions const&, FilteredTracksMC const& tracks)
941952
{
942-
for (auto track : tracks) {
953+
for (const auto& track : tracks) {
943954
if (std::abs(track.template singleCollSel_as<FilteredCollisions>().posZ()) > cutzvertex)
944955
continue;
945956

@@ -1311,7 +1322,7 @@ struct hadronnucleicorrelation {
13111322

13121323
registry.fill(HIST("Generated/hNEventsMC"), 0.5);
13131324

1314-
for (auto particle : mcParticles) {
1325+
for (const auto& particle : mcParticles) {
13151326

13161327
if (particle.pdgCode() == PDG_t::kProton) {
13171328
registry.fill(HIST("Generated/hQAProtons"), 0.5);
@@ -1361,19 +1372,19 @@ struct hadronnucleicorrelation {
13611372
}
13621373
}
13631374

1364-
if (mode == 5 || mode == 6) { // Identical particle combinations
1375+
if (mode == kPbarPbar || mode == kPP) { // Identical particle combinations
13651376

13661377
for (const auto& [part0, part1] : combinations(CombinationsStrictlyUpperIndexPolicy(mcParticles, mcParticles))) {
13671378

13681379
// mode 6
1369-
if (mode == 6) {
1380+
if (mode == kPP) {
13701381
if (part0.pdgCode() != PDG_t::kProton)
13711382
continue;
13721383
if (part1.pdgCode() != PDG_t::kProton)
13731384
continue;
13741385
}
13751386
// mode 5
1376-
if (mode == 5) {
1387+
if (mode == kPbarPbar) {
13771388
if (part0.pdgCode() != -PDG_t::kProton)
13781389
continue;
13791390
if (part1.pdgCode() != -PDG_t::kProton)
@@ -1387,37 +1398,37 @@ struct hadronnucleicorrelation {
13871398

13881399
for (const auto& [part0, part1] : combinations(CombinationsFullIndexPolicy(mcParticles, mcParticles))) {
13891400

1390-
if (mode == 0) {
1401+
if (mode == kDbarPbar) {
13911402
if (part0.pdgCode() != -o2::constants::physics::Pdg::kDeuteron)
13921403
continue;
13931404
if (part1.pdgCode() != -PDG_t::kProton)
13941405
continue;
13951406
}
1396-
if (mode == 1) {
1407+
if (mode == kDP) {
13971408
if (part0.pdgCode() != o2::constants::physics::Pdg::kDeuteron)
13981409
continue;
13991410
if (part1.pdgCode() != PDG_t::kProton)
14001411
continue;
14011412
}
1402-
if (mode == 2) {
1413+
if (mode == kDbarP) {
14031414
if (part0.pdgCode() != -o2::constants::physics::Pdg::kDeuteron)
14041415
continue;
14051416
if (part1.pdgCode() != PDG_t::kProton)
14061417
continue;
14071418
}
1408-
if (mode == 3) {
1419+
if (mode == kDPbar) {
14091420
if (part0.pdgCode() != o2::constants::physics::Pdg::kDeuteron)
14101421
continue;
14111422
if (part1.pdgCode() != -PDG_t::kProton)
14121423
continue;
14131424
}
1414-
if (mode == 4) {
1425+
if (mode == kPbarP) {
14151426
if (part0.pdgCode() != -PDG_t::kProton)
14161427
continue;
14171428
if (part1.pdgCode() != PDG_t::kProton)
14181429
continue;
14191430
}
1420-
if (mode == 7) {
1431+
if (mode == kPPbar) {
14211432
if (part0.pdgCode() != PDG_t::kProton)
14221433
continue;
14231434
if (part1.pdgCode() != -PDG_t::kProton)
@@ -1442,49 +1453,49 @@ struct hadronnucleicorrelation {
14421453

14431454
for (const auto& [part0, part1] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) {
14441455

1445-
if (mode == 0) {
1456+
if (mode == kDbarPbar) {
14461457
if (part0.pdgCode() != -o2::constants::physics::Pdg::kDeuteron)
14471458
continue;
14481459
if (part1.pdgCode() != -PDG_t::kProton)
14491460
continue;
14501461
}
1451-
if (mode == 1) {
1462+
if (mode == kDP) {
14521463
if (part0.pdgCode() != o2::constants::physics::Pdg::kDeuteron)
14531464
continue;
14541465
if (part1.pdgCode() != PDG_t::kProton)
14551466
continue;
14561467
}
1457-
if (mode == 2) {
1468+
if (mode == kDbarP) {
14581469
if (part0.pdgCode() != -o2::constants::physics::Pdg::kDeuteron)
14591470
continue;
14601471
if (part1.pdgCode() != PDG_t::kProton)
14611472
continue;
14621473
}
1463-
if (mode == 3) {
1474+
if (mode == kDPbar) {
14641475
if (part0.pdgCode() != o2::constants::physics::Pdg::kDeuteron)
14651476
continue;
14661477
if (part1.pdgCode() != -PDG_t::kProton)
14671478
continue;
14681479
}
1469-
if (mode == 4) {
1480+
if (mode == kPbarP) {
14701481
if (part0.pdgCode() != -PDG_t::kProton)
14711482
continue;
14721483
if (part1.pdgCode() != PDG_t::kProton)
14731484
continue;
14741485
}
1475-
if (mode == 5) {
1486+
if (mode == kPbarPbar) {
14761487
if (part0.pdgCode() != -PDG_t::kProton)
14771488
continue;
14781489
if (part1.pdgCode() != -PDG_t::kProton)
14791490
continue;
14801491
}
1481-
if (mode == 6) {
1492+
if (mode == kPP) {
14821493
if (part0.pdgCode() != PDG_t::kProton)
14831494
continue;
14841495
if (part1.pdgCode() != PDG_t::kProton)
14851496
continue;
14861497
}
1487-
if (mode == 7) {
1498+
if (mode == kPPbar) {
14881499
if (part0.pdgCode() != PDG_t::kProton)
14891500
continue;
14901501
if (part1.pdgCode() != -PDG_t::kProton)

0 commit comments

Comments
 (0)