Skip to content

Commit da00dac

Browse files
authored
[PWGLF] Optimised code (#12825)
1 parent 5c1113a commit da00dac

File tree

1 file changed

+31
-47
lines changed

1 file changed

+31
-47
lines changed

PWGLF/Tasks/Resonances/kstarqa.cxx

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,30 +2043,7 @@ struct Kstarqa {
20432043
void processEvtLossSigLossMC(EventMCGenerated::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups<EventCandidatesMC>& recCollisions)
20442044
// void processEvtLossSigLossMC(aod::McCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups<EventCandidatesMC>& recCollisions)
20452045
{
2046-
// if (selectionConfig.isINELgt0 && !mcCollision.isInelGt0()) {
2047-
// return;
2048-
// }
2049-
2050-
bool isINELgt0true = false;
2051-
2052-
if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) {
2053-
isINELgt0true = true;
2054-
}
2055-
if (selectionConfig.isINELgt0 && !isINELgt0true) {
2056-
return;
2057-
}
2058-
2059-
if (selectionConfig.checkVzEvSigLoss && (std::abs(mcCollision.posZ()) >= selectionConfig.cutzvertex)) {
2060-
return;
2061-
}
2062-
2063-
auto impactPar = mcCollision.impactParameter();
20642046
auto multiplicityRec = -1;
2065-
auto multiplicityGen = -1;
2066-
multiplicityGen = mcCollision.centFT0M();
2067-
hInvMass.fill(HIST("MCcorrections/hImpactParameterGen"), impactPar);
2068-
hInvMass.fill(HIST("MCcorrections/MultiplicityGen"), multiplicityGen);
2069-
20702047
bool isSelectedEvent = false;
20712048
auto multiplicity1 = -999.;
20722049
for (const auto& RecCollision : recCollisions) {
@@ -2093,6 +2070,25 @@ struct Kstarqa {
20932070
isSelectedEvent = true;
20942071
}
20952072

2073+
bool isINELgt0true = false;
2074+
2075+
if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) {
2076+
isINELgt0true = true;
2077+
}
2078+
if (selectionConfig.isINELgt0 && !isINELgt0true) {
2079+
return;
2080+
}
2081+
2082+
if (selectionConfig.checkVzEvSigLoss && (std::abs(mcCollision.posZ()) >= selectionConfig.cutzvertex)) {
2083+
return;
2084+
}
2085+
2086+
auto impactPar = mcCollision.impactParameter();
2087+
auto multiplicityGen = -1;
2088+
multiplicityGen = mcCollision.centFT0M();
2089+
hInvMass.fill(HIST("MCcorrections/hImpactParameterGen"), impactPar);
2090+
hInvMass.fill(HIST("MCcorrections/MultiplicityGen"), multiplicityGen);
2091+
20962092
// Event loss
20972093
if (isSelectedEvent) {
20982094
hInvMass.fill(HIST("MCcorrections/hImpactParameterRec"), impactPar);
@@ -2106,7 +2102,6 @@ struct Kstarqa {
21062102
if (std::abs(mcPart.y()) >= selectionConfig.rapidityMotherData || std::abs(mcPart.pdgCode()) != o2::constants::physics::kK0Star892)
21072103
continue;
21082104

2109-
// signal loss estimation
21102105
hInvMass.fill(HIST("MCcorrections/hSignalLossDenominator"), mcPart.pt(), multiplicityGen);
21112106
if (isSelectedEvent) {
21122107
hInvMass.fill(HIST("MCcorrections/hSignalLossNumerator"), mcPart.pt(), multiplicityGen);
@@ -2319,24 +2314,12 @@ struct Kstarqa {
23192314
continue;
23202315
}
23212316
rEventSelection.fill(HIST("recMCparticles"), 5.5);
2322-
2323-
// if (!(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kPiPlus)) {
2324-
// continue;
2325-
// }
2326-
if (selectionConfig.isPDGCheckMC && (track1PDG != PDG_t::kKPlus) && (track1PDG != PDG_t::kPiPlus)) {
2327-
continue;
2328-
}
2329-
if (selectionConfig.isPDGCheckMC && (track2PDG != PDG_t::kKPlus) && (track2PDG != PDG_t::kPiPlus)) {
2330-
continue;
2331-
}
23322317
rEventSelection.fill(HIST("recMCparticles"), 6.5);
23332318

2334-
if (selectionConfig.isPDGCheckMC && (track1PDG == PDG_t::kKPlus) && (track2PDG == PDG_t::kKPlus)) {
2335-
continue;
2336-
}
2337-
if (selectionConfig.isPDGCheckMC && (track1PDG == PDG_t::kPiPlus) && (track2PDG == PDG_t::kPiPlus)) {
2319+
if (selectionConfig.isPDGCheckMC && !(track1PDG == PDG_t::kPiPlus && track2PDG == PDG_t::kKPlus) && !(track1PDG == PDG_t::kKPlus && track2PDG == PDG_t::kPiPlus)) {
23382320
continue;
23392321
}
2322+
23402323
rEventSelection.fill(HIST("recMCparticles"), 7.5);
23412324

23422325
for (const auto& mothertrack1 : mctrack1.mothers_as<aod::McParticles>()) {
@@ -2601,6 +2584,7 @@ struct Kstarqa {
26012584
continue;
26022585
}
26032586
rEventSelection.fill(HIST("recMCparticles"), 6.5);
2587+
rEventSelection.fill(HIST("recMCparticles"), 7.5);
26042588

26052589
for (const auto& mothertrack1 : mctrack1.mothers_as<aod::McParticles>()) {
26062590
for (const auto& mothertrack2 : mctrack2.mothers_as<aod::McParticles>()) {
@@ -2611,29 +2595,29 @@ struct Kstarqa {
26112595
if (mothertrack1.globalIndex() != mothertrack2.globalIndex()) {
26122596
continue;
26132597
}
2614-
rEventSelection.fill(HIST("recMCparticles"), 7.5);
2598+
rEventSelection.fill(HIST("recMCparticles"), 8.5);
26152599

26162600
if (!mothertrack1.producedByGenerator()) {
26172601
continue;
26182602
}
2619-
rEventSelection.fill(HIST("recMCparticles"), 8.5);
2603+
rEventSelection.fill(HIST("recMCparticles"), 9.5);
26202604

26212605
if (std::abs(mothertrack1.y()) >= selectionConfig.rapidityMotherData) {
26222606
continue;
26232607
}
2624-
rEventSelection.fill(HIST("recMCparticles"), 9.5);
2608+
rEventSelection.fill(HIST("recMCparticles"), 10.5);
26252609

26262610
if (selectionConfig.isPDGCheckMC && (std::abs(mothertrack1.pdgCode()) != o2::constants::physics::kPhi)) {
26272611
continue;
26282612
}
2629-
rEventSelection.fill(HIST("recMCparticles"), 10.5);
2613+
rEventSelection.fill(HIST("recMCparticles"), 11.5);
26302614

26312615
if (!applypTdepPID && !(selectionPID(track1, 1) && selectionPID(track2, 1))) { // kaon and kaon
26322616
continue;
26332617
} else if (applypTdepPID && !(selectionPIDNew(track1, 1) && selectionPIDNew(track2, 1))) { // kaon and kaon
26342618
continue;
26352619
}
2636-
rEventSelection.fill(HIST("recMCparticles"), 11.5);
2620+
rEventSelection.fill(HIST("recMCparticles"), 12.5);
26372621

26382622
if (selectionConfig.isApplyParticleMID) {
26392623
if (selectionMID(track1, 0)) // Kaon misidentified as pion
@@ -2645,14 +2629,14 @@ struct Kstarqa {
26452629
if (selectionMID(track2, 2)) // Kaon misidentified as proton
26462630
continue;
26472631
}
2648-
rEventSelection.fill(HIST("recMCparticles"), 12.5);
2632+
rEventSelection.fill(HIST("recMCparticles"), 13.5);
26492633

26502634
if (std::abs(track1.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity)
26512635
continue;
26522636

26532637
if (std::abs(track2.rapidity(o2::track::PID::getMass(o2::track::PID::Kaon))) > selectionConfig.ctrackRapidity)
26542638
continue;
2655-
rEventSelection.fill(HIST("recMCparticles"), 13.5);
2639+
rEventSelection.fill(HIST("recMCparticles"), 14.5);
26562640
if (cQAplots) {
26572641
hPID.fill(HIST("After/hTPCnsigKa_mult_pt"), track1.tpcNSigmaKa(), multiplicity, track1.pt());
26582642
// hPID.fill(HIST("After/hTPCnsigPi_mult_pt"), track2.tpcNSigmaPi(), multiplicity, track2.pt());
@@ -2671,12 +2655,12 @@ struct Kstarqa {
26712655
hInvMass.fill(HIST("h1KSRecsplit"), mothertrack1.pt());
26722656
continue;
26732657
}
2674-
rEventSelection.fill(HIST("recMCparticles"), 14.5);
2658+
rEventSelection.fill(HIST("recMCparticles"), 15.5);
26752659

26762660
if (!selectionPair(track1, track2)) {
26772661
continue;
26782662
}
2679-
rEventSelection.fill(HIST("recMCparticles"), 15.5);
2663+
rEventSelection.fill(HIST("recMCparticles"), 16.5);
26802664

26812665
oldindex = mothertrack1.globalIndex();
26822666
if (track1.sign() * track2.sign() < 0) {

0 commit comments

Comments
 (0)