Skip to content

Commit bf129cc

Browse files
authored
[PWGLF] Fix histogram filling (#13065)
1 parent b63b897 commit bf129cc

File tree

1 file changed

+108
-39
lines changed

1 file changed

+108
-39
lines changed

PWGLF/Tasks/Strangeness/strangenessInJets.cxx

Lines changed: 108 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ using namespace o2::soa;
6969
using namespace o2::aod;
7070
using namespace o2::framework;
7171
using namespace o2::framework::expressions;
72-
using namespace o2::constants::physics;
7372
using namespace o2::constants::math;
7473
using std::array;
7574

@@ -591,10 +590,10 @@ struct StrangenessInJets {
591590
// Require that V0 is compatible with Lambda
592591
ROOT::Math::PxPyPzMVector pProton;
593592
ROOT::Math::PxPyPzMVector pPion;
594-
pProton.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), MassProton);
595-
pPion.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), MassPionCharged);
593+
pProton.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), o2::constants::physics::MassProton);
594+
pPion.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), o2::constants::physics::MassPionCharged);
596595
double mLambda = (pProton + pPion).M();
597-
if (std::fabs(mLambda - MassLambda0) > deltaMassLambda)
596+
if (std::fabs(mLambda - o2::constants::physics::MassLambda0) > deltaMassLambda)
598597
return false;
599598
}
600599

@@ -622,10 +621,10 @@ struct StrangenessInJets {
622621
// Require that V0 is compatible with Lambda
623622
ROOT::Math::PxPyPzMVector pProton;
624623
ROOT::Math::PxPyPzMVector pPion;
625-
pProton.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), MassProton);
626-
pPion.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), MassPionCharged);
627-
double mLambda = (pProton + pPion).M();
628-
if (std::fabs(mLambda - MassLambda0) > deltaMassLambda)
624+
pProton.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), o2::constants::physics::MassProton);
625+
pPion.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), o2::constants::physics::MassPionCharged);
626+
const double mLambda = (pProton + pPion).M();
627+
if (std::fabs(mLambda - o2::constants::physics::MassLambda0) > deltaMassLambda)
629628
return false;
630629
}
631630

@@ -664,7 +663,7 @@ struct StrangenessInJets {
664663
}
665664

666665
// Reject candidates compatible with Omega
667-
if (std::fabs(casc.mOmega() - MassOmegaMinus) < deltaMassOmega)
666+
if (std::fabs(casc.mOmega() - o2::constants::physics::MassOmegaMinus) < deltaMassOmega)
668667
return false;
669668
return true;
670669
}
@@ -705,10 +704,10 @@ struct StrangenessInJets {
705704
// Require that V0 is compatible with Lambda
706705
ROOT::Math::PxPyPzMVector pProton;
707706
ROOT::Math::PxPyPzMVector pPion;
708-
pProton.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), MassProton);
709-
pPion.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), MassPionCharged);
707+
pProton.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), o2::constants::physics::MassProton);
708+
pPion.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), o2::constants::physics::MassPionCharged);
710709
double mLambda = (pProton + pPion).M();
711-
if (std::fabs(mLambda - MassLambda0) > deltaMassLambda)
710+
if (std::fabs(mLambda - o2::constants::physics::MassLambda0) > deltaMassLambda)
712711
return false;
713712
}
714713

@@ -736,10 +735,10 @@ struct StrangenessInJets {
736735
// Require that V0 is compatible with Lambda
737736
ROOT::Math::PxPyPzMVector pProton;
738737
ROOT::Math::PxPyPzMVector pPion;
739-
pProton.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), MassProton);
740-
pPion.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), MassPionCharged);
738+
pProton.SetCoordinates(ptrack.px(), ptrack.py(), ptrack.pz(), o2::constants::physics::MassProton);
739+
pPion.SetCoordinates(ntrack.px(), ntrack.py(), ntrack.pz(), o2::constants::physics::MassPionCharged);
741740
double mLambda = (pProton + pPion).M();
742-
if (std::fabs(mLambda - MassLambda0) > deltaMassLambda)
741+
if (std::fabs(mLambda - o2::constants::physics::MassLambda0) > deltaMassLambda)
743742
return false;
744743
}
745744

@@ -778,7 +777,7 @@ struct StrangenessInJets {
778777
}
779778

780779
// Reject candidates compatible with Xi
781-
if (std::fabs(casc.mXi() - MassXiMinus) < deltaMassXi)
780+
if (std::fabs(casc.mXi() - o2::constants::physics::MassXiMinus) < deltaMassXi)
782781
return false;
783782
return true;
784783
}
@@ -842,7 +841,7 @@ struct StrangenessInJets {
842841
continue;
843842

844843
// 4-momentum representation of a particle
845-
fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(MassPionCharged));
844+
fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(o2::constants::physics::MassPionCharged));
846845
fjParticles.emplace_back(fourMomentum);
847846
}
848847

@@ -1103,7 +1102,8 @@ struct StrangenessInJets {
11031102
continue;
11041103

11051104
// Build 4-momentum assuming charged pion mass
1106-
double energy = std::sqrt(particle.p() * particle.p() + MassPionCharged * MassPionCharged);
1105+
static constexpr float kMassPionChargedSquared = o2::constants::physics::MassPionCharged * o2::constants::physics::MassPionCharged;
1106+
const double energy = std::sqrt(particle.p() * particle.p() + kMassPionChargedSquared);
11071107
fastjet::PseudoJet fourMomentum(particle.px(), particle.py(), particle.pz(), energy);
11081108
fourMomentum.set_user_index(particle.pdgCode());
11091109
fjParticles.emplace_back(fourMomentum);
@@ -1175,35 +1175,69 @@ struct StrangenessInJets {
11751175
if (deltaRJet < coneRadius) {
11761176
switch (pdg[index]) {
11771177
case kK0Short:
1178-
registryMC.fill(HIST("K0s_generated_jet"), genMultiplicity, hadron.Pt());
1178+
if (particleOfInterest == ParticleOfInterest::kV0Particles) {
1179+
registryMC.fill(HIST("K0s_generated_jet"), genMultiplicity, hadron.Pt());
1180+
}
11791181
break;
11801182
case kLambda0:
1181-
registryMC.fill(HIST("Lambda_generated_jet"), genMultiplicity, hadron.Pt());
1183+
if (particleOfInterest == ParticleOfInterest::kV0Particles) {
1184+
registryMC.fill(HIST("Lambda_generated_jet"), genMultiplicity, hadron.Pt());
1185+
}
11821186
break;
11831187
case kLambda0Bar:
1184-
registryMC.fill(HIST("AntiLambda_generated_jet"), genMultiplicity, hadron.Pt());
1188+
if (particleOfInterest == ParticleOfInterest::kV0Particles) {
1189+
registryMC.fill(HIST("AntiLambda_generated_jet"), genMultiplicity, hadron.Pt());
1190+
}
11851191
break;
11861192
case kXiMinus:
1187-
registryMC.fill(HIST("XiNeg_generated_jet"), genMultiplicity, hadron.Pt());
1193+
if (particleOfInterest == ParticleOfInterest::kCascades) {
1194+
registryMC.fill(HIST("XiNeg_generated_jet"), genMultiplicity, hadron.Pt());
1195+
}
11881196
break;
11891197
case kXiPlusBar:
1190-
registryMC.fill(HIST("XiPos_generated_jet"), genMultiplicity, hadron.Pt());
1198+
if (particleOfInterest == ParticleOfInterest::kCascades) {
1199+
registryMC.fill(HIST("XiPos_generated_jet"), genMultiplicity, hadron.Pt());
1200+
}
11911201
break;
11921202
case kOmegaMinus:
1193-
registryMC.fill(HIST("OmegaNeg_generated_jet"), genMultiplicity, hadron.Pt());
1203+
if (particleOfInterest == ParticleOfInterest::kCascades) {
1204+
registryMC.fill(HIST("OmegaNeg_generated_jet"), genMultiplicity, hadron.Pt());
1205+
}
11941206
break;
11951207
case kOmegaPlusBar:
1196-
registryMC.fill(HIST("OmegaPos_generated_jet"), genMultiplicity, hadron.Pt());
1208+
if (particleOfInterest == ParticleOfInterest::kCascades) {
1209+
registryMC.fill(HIST("OmegaPos_generated_jet"), genMultiplicity, hadron.Pt());
1210+
}
11971211
break;
11981212
case kPiPlus:
1213+
if (particleOfInterest == ParticleOfInterest::kPions) {
1214+
registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt());
1215+
}
1216+
break;
11991217
case kKPlus:
1200-
case ParticleOfInterest::kProtons:
1201-
registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt());
1218+
if (particleOfInterest == ParticleOfInterest::kKaons) {
1219+
registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt());
1220+
}
1221+
break;
1222+
case kProton:
1223+
if (particleOfInterest == ParticleOfInterest::kProtons) {
1224+
registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt());
1225+
}
12021226
break;
12031227
case kPiMinus:
1228+
if (particleOfInterest == ParticleOfInterest::kPions) {
1229+
registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt() * -1.f);
1230+
}
1231+
break;
12041232
case kKMinus:
1233+
if (particleOfInterest == ParticleOfInterest::kKaons) {
1234+
registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt() * -1.f);
1235+
}
1236+
break;
12051237
case kProtonBar:
1206-
registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt() * -1.f);
1238+
if (particleOfInterest == ParticleOfInterest::kProtons) {
1239+
registryMC.fill(HIST("ll_generated_in_jet"), genMultiplicity, hadron.Pt() * -1.f);
1240+
}
12071241
break;
12081242
default:
12091243
break;
@@ -1214,35 +1248,70 @@ struct StrangenessInJets {
12141248
if (deltaRUe1 < coneRadius || deltaRUe2 < coneRadius) {
12151249
switch (pdg[index]) {
12161250
case kK0Short:
1217-
registryMC.fill(HIST("K0s_generated_ue"), genMultiplicity, hadron.Pt());
1251+
if (particleOfInterest == ParticleOfInterest::kV0Particles) {
1252+
registryMC.fill(HIST("K0s_generated_ue"), genMultiplicity, hadron.Pt());
1253+
}
12181254
break;
12191255
case kLambda0:
1220-
registryMC.fill(HIST("Lambda_generated_ue"), genMultiplicity, hadron.Pt());
1256+
if (particleOfInterest == ParticleOfInterest::kV0Particles) {
1257+
registryMC.fill(HIST("Lambda_generated_ue"), genMultiplicity, hadron.Pt());
1258+
}
12211259
break;
12221260
case kLambda0Bar:
1223-
registryMC.fill(HIST("AntiLambda_generated_ue"), genMultiplicity, hadron.Pt());
1261+
if (particleOfInterest == ParticleOfInterest::kV0Particles) {
1262+
registryMC.fill(HIST("AntiLambda_generated_ue"), genMultiplicity, hadron.Pt());
1263+
}
12241264
break;
12251265
case kXiMinus:
1226-
registryMC.fill(HIST("XiNeg_generated_ue"), genMultiplicity, hadron.Pt());
1266+
if (particleOfInterest == ParticleOfInterest::kCascades) {
1267+
registryMC.fill(HIST("XiNeg_generated_ue"), genMultiplicity, hadron.Pt());
1268+
}
12271269
break;
12281270
case kXiPlusBar:
1229-
registryMC.fill(HIST("XiPos_generated_ue"), genMultiplicity, hadron.Pt());
1271+
if (particleOfInterest == ParticleOfInterest::kCascades) {
1272+
registryMC.fill(HIST("XiPos_generated_ue"), genMultiplicity, hadron.Pt());
1273+
}
12301274
break;
12311275
case kOmegaMinus:
1232-
registryMC.fill(HIST("OmegaNeg_generated_ue"), genMultiplicity, hadron.Pt());
1276+
if (particleOfInterest == ParticleOfInterest::kCascades) {
1277+
registryMC.fill(HIST("OmegaNeg_generated_ue"), genMultiplicity, hadron.Pt());
1278+
}
12331279
break;
12341280
case kOmegaPlusBar:
1235-
registryMC.fill(HIST("OmegaPos_generated_ue"), genMultiplicity, hadron.Pt());
1281+
if (particleOfInterest == ParticleOfInterest::kCascades) {
1282+
registryMC.fill(HIST("OmegaPos_generated_ue"), genMultiplicity, hadron.Pt());
1283+
}
12361284
break;
12371285
case kPiPlus:
1286+
if (particleOfInterest == ParticleOfInterest::kPions) {
1287+
registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt());
1288+
}
1289+
break;
12381290
case kKPlus:
1239-
case ParticleOfInterest::kProtons:
1240-
registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt());
1291+
if (particleOfInterest == ParticleOfInterest::kKaons) {
1292+
registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt());
1293+
}
1294+
break;
1295+
case kProton:
1296+
if (particleOfInterest == ParticleOfInterest::kProtons) {
1297+
registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt());
1298+
}
12411299
break;
12421300
case kPiMinus:
1301+
if (particleOfInterest == ParticleOfInterest::kPions) {
1302+
registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt() * -1.f);
1303+
}
1304+
break;
12431305
case kKMinus:
1306+
if (particleOfInterest == ParticleOfInterest::kKaons) {
1307+
registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt() * -1.f);
1308+
}
1309+
break;
12441310
case kProtonBar:
1245-
registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt() * -1.f);
1311+
if (particleOfInterest == ParticleOfInterest::kProtons) {
1312+
registryMC.fill(HIST("ll_generated_in_ue"), genMultiplicity, hadron.Pt() * -1.f);
1313+
}
1314+
break;
12461315
default:
12471316
break;
12481317
}
@@ -1288,7 +1357,7 @@ struct StrangenessInJets {
12881357
continue;
12891358

12901359
// 4-momentum representation of a particle
1291-
fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(MassPionCharged));
1360+
fastjet::PseudoJet fourMomentum(track.px(), track.py(), track.pz(), track.energy(o2::constants::physics::MassPionCharged));
12921361
fjParticles.emplace_back(fourMomentum);
12931362
}
12941363

0 commit comments

Comments
 (0)