Skip to content

Commit e09db65

Browse files
[PWGLF] Small fixes in sigma0 analysis (#15659)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent a161052 commit e09db65

File tree

2 files changed

+45
-48
lines changed

2 files changed

+45
-48
lines changed

PWGLF/TableProducer/Strangeness/sigma0builder.cxx

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ struct sigma0builder {
10961096
for (size_t i = 0; i < cluster.mcParticleIds().size(); i++) {
10971097

10981098
int mcId = cluster.mcParticleIds()[i];
1099-
auto mcPart = mcparticles.iteratorAt(mcId);
1099+
auto mcPart = mcparticles.rawIteratorAt(mcId);
11001100

11011101
// Accumulate total momentum (fallback strategy)
11021102
sumPx += mcPart.px();
@@ -1112,31 +1112,28 @@ struct sigma0builder {
11121112
if (daughterId < 0)
11131113
continue; // Not from Sigma0 -> try next contributor
11141114

1115-
auto mcPhoton = mcparticles.iteratorAt(daughterId);
1116-
1117-
// Sanity check: are we getting the correct particles?
1118-
auto dummy = mcparticles.rawIteratorAt(daughterId);
1119-
if (mcPhoton.globalIndex() != dummy.globalIndex())
1120-
LOGF(fatal, "The behave of rawIteratorAt != iteratorAt. Index %i != %i. Please check. Aborting.", mcPhoton.globalIndex(), dummy.globalIndex());
1115+
auto mcPhoton = mcparticles.rawIteratorAt(daughterId);
11211116

11221117
// Require true photon, please
11231118
if (mcPhoton.pdgCode() != PDG_t::kGamma)
11241119
continue;
11251120

11261121
// Get Sigma0 index from photon mother
1127-
auto mothers = mcPhoton.mothersIds();
1128-
if (mothers.empty()) // No mothers? Weird
1122+
auto const& photonMothers = mcPhoton.template mothers_as<aod::McParticles>();
1123+
if (photonMothers.empty()) // No mothers? Weird
11291124
continue;
11301125

1131-
int sigmaIndex = mothers[0];
1126+
// Assumption: first mother is the physical one
1127+
auto const& photonMother = photonMothers.front();
1128+
int photonMotherIndex = photonMother.globalIndex();
11321129

11331130
// ------------------------------------------------------------
11341131
// Check 2:
11351132
// Does this photon share the same mother as the Lambda?
11361133
// ------------------------------------------------------------
1137-
if (sigmaIndex == lambdaMotherIndex) {
1134+
if (photonMotherIndex == lambdaMotherIndex) {
11381135
matchedPhotonId = daughterId;
1139-
matchedMotherIndex = sigmaIndex;
1136+
matchedMotherIndex = photonMotherIndex;
11401137
MCinfo.EMCalClusterAmplitude = cluster.amplitudeA()[i];
11411138
break; // SUCCESS -> stop loop
11421139
}
@@ -1148,8 +1145,8 @@ struct sigma0builder {
11481145

11491146
if (matchedPhotonId >= 0 && matchedMotherIndex >= 0) {
11501147

1151-
auto mcPhoton = mcparticles.iteratorAt(matchedPhotonId);
1152-
auto mcSigma = mcparticles.iteratorAt(matchedMotherIndex);
1148+
auto mcPhoton = mcparticles.rawIteratorAt(matchedPhotonId);
1149+
auto mcSigma = mcparticles.rawIteratorAt(matchedMotherIndex);
11531150

11541151
// --- Pair (Sigma0) information
11551152
MCinfo.fV0PairProducedByGenerator = mcSigma.producedByGenerator();
@@ -1172,7 +1169,7 @@ struct sigma0builder {
11721169
MCinfo.V01PDGCode = mcPhoton.pdgCode();
11731170

11741171
if (!mcPhoton.mothersIds().empty()) {
1175-
auto mcMother = mcparticles.iteratorAt(mcPhoton.mothersIds()[0]);
1172+
auto mcMother = mcparticles.rawIteratorAt(mcPhoton.mothersIds()[0]);
11761173
MCinfo.V01PDGCodeMother = mcMother.pdgCode();
11771174
}
11781175

@@ -2405,7 +2402,7 @@ struct sigma0builder {
24052402
// Momentum components
24062403
float gammapx = gammapT * std::cos(gamma.phi());
24072404
float gammapy = gammapT * std::sin(gamma.phi());
2408-
float gammapz = gammapT * std::sinh(gamma.phi());
2405+
float gammapz = gammapT * std::sinh(gamma.eta());
24092406

24102407
//_______________________________________________
24112408
// Sigma0 pre-selections

PWGLF/Tasks/Strangeness/sigmaanalysis.cxx

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@
4141
#include "ReconstructionDataFormats/Track.h"
4242

4343
#include <Math/Vector4D.h>
44-
#include <TDatabasePDG.h>
4544
#include <TFile.h>
4645
#include <TH2F.h>
47-
#include <TLorentzVector.h>
4846
#include <TPDGCode.h>
4947
#include <TProfile.h>
5048

@@ -258,6 +256,7 @@ struct sigmaanalysis {
258256
ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "p_{T} (GeV/c)"};
259257
ConfigurableAxis axisInvPt{"axisInvPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 2.0, 5.0, 10.0, 20.0, 50.0}, ""};
260258
ConfigurableAxis axisDeltaPt{"axisDeltaPt", {400, -50.0, 50.0}, ""};
259+
ConfigurableAxis axisReso{"axisReso", {400, -2.0, 2.0}, ""};
261260
ConfigurableAxis axisRapidity{"axisRapidity", {100, -2.0f, 2.0f}, "Rapidity"};
262261
ConfigurableAxis axisIRBinning{"axisIRBinning", {150, 0, 1500}, "Binning for the interaction rate (kHz)"};
263262
ConfigurableAxis axisNch{"axisNch", {300, 0.0f, 3000.0f}, "N_{ch}"};
@@ -502,18 +501,16 @@ struct sigmaanalysis {
502501
histos.add(histodir + "/MC/ASigma0/h3dMCProcess", "h3dMCProcess", kTH3D, {{50, -0.5f, 49.5f}, axisPt, axisSigmaMass});
503502

504503
// pT Resolution:
505-
if (fillResoQAhistos && histodir == "BeforeSel") {
506-
histos.add(histodir + "/MC/Reso/h2dGammaInvPtResolution", "h2dGammaPtResolution", kTH2D, {axisInvPt, axisDeltaPt});
504+
if (fillResoQAhistos) {
505+
histos.add(histodir + "/MC/Reso/h2dGammaPtResolution", "h2dGammaPtResolution", kTH2D, {axisInvPt, axisReso});
507506
histos.add(histodir + "/MC/Reso/h2dGammaInvPtResolution", "h2dGammaInvPtResolution", kTH2D, {axisInvPt, axisDeltaPt});
508507
histos.add(histodir + "/MC/Reso/h2dLambdaPtResolution", "h2dLambdaPtResolution", kTH2D, {axisInvPt, axisDeltaPt});
509508
histos.add(histodir + "/MC/Reso/h3dLambdaPtResoVsTPCCR", "h3dLambdaPtResoVsTPCCR", kTH3D, {axisInvPt, axisDeltaPt, axisTPCrows});
510-
histos.add(histodir + "/MC/Reso/h3dLambdaPtResoVsTPCCR", "h3dLambdaPtResoVsTPCCR", kTH3D, {axisInvPt, axisDeltaPt, axisTPCrows});
511509
histos.add(histodir + "/MC/Reso/h2dAntiLambdaPtResolution", "h2dAntiLambdaPtResolution", kTH2D, {axisInvPt, axisDeltaPt});
512510
histos.add(histodir + "/MC/Reso/h3dAntiLambdaPtResoVsTPCCR", "h3dAntiLambdaPtResoVsTPCCR", kTH3D, {axisInvPt, axisDeltaPt, axisTPCrows});
513-
histos.add(histodir + "/MC/Reso/h3dAntiLambdaPtResoVsTPCCR", "h3dAntiLambdaPtResoVsTPCCR", kTH3D, {axisInvPt, axisDeltaPt, axisTPCrows});
514-
histos.add(histodir + "/MC/Reso/h2dSigma0PtResolution", "h2dSigma0PtResolution", kTH2D, {axisInvPt, axisDeltaPt});
511+
histos.add(histodir + "/MC/Reso/h2dSigma0PtResolution", "h2dSigma0PtResolution", kTH2D, {axisInvPt, axisReso});
515512
histos.add(histodir + "/MC/Reso/h2dSigma0InvPtResolution", "h2dSigma0InvPtResolution", kTH2D, {axisInvPt, axisDeltaPt});
516-
histos.add(histodir + "/MC/Reso/h2dAntiSigma0PtResolution", "h2dAntiSigma0PtResolution", kTH2D, {axisInvPt, axisDeltaPt});
513+
histos.add(histodir + "/MC/Reso/h2dAntiSigma0PtResolution", "h2dAntiSigma0PtResolution", kTH2D, {axisInvPt, axisReso});
517514
histos.add(histodir + "/MC/Reso/h2dSigma0RadiusResolution", "h2dSigma0RadiusResolution", kTH2D, {axisPt, axisDeltaPt});
518515
histos.add(histodir + "/MC/Reso/h2dASigma0RadiusResolution", "h2dASigma0RadiusResolution", kTH2D, {axisPt, axisDeltaPt});
519516
}
@@ -1003,52 +1000,55 @@ struct sigmaanalysis {
10031000
return TrkCode;
10041001
}
10051002

1006-
template <typename TSigma0Object>
1003+
template <int mode, typename TSigma0Object>
10071004
void getResolution(TSigma0Object const& sigma)
10081005
{
10091006

1007+
// Check whether it is before or after selections
1008+
static constexpr std::string_view MainDir[] = {"BeforeSel", "AfterSel"};
1009+
10101010
//_______________________________________
10111011
// Gamma MC association
1012-
if (sigma.photonPDGCode() == 22) {
1012+
if (sigma.photonPDGCode() == PDG_t::kGamma) {
10131013
if (sigma.photonmcpt() > 0) {
1014-
histos.fill(HIST("BeforeSel/MC/Reso/h2dGammaPtResolution"), sigma.photonmcpt(), sigma.photonPt() - sigma.photonmcpt()); // pT resolution
1015-
histos.fill(HIST("BeforeSel/MC/Reso/h2dGammaInvPtResolution"), 1.f / sigma.photonmcpt(), 1.f / sigma.photonPt() - 1.f / sigma.photonmcpt()); // pT resolution
1014+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h2dGammaPtResolution"), sigma.photonmcpt(), (sigma.photonPt() / sigma.photonmcpt()) - 1.f); // pT resolution
1015+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h2dGammaInvPtResolution"), 1.f / sigma.photonmcpt(), 1.f / sigma.photonPt() - 1.f / sigma.photonmcpt()); // pT resolution
10161016
}
10171017
}
10181018

10191019
//_______________________________________
10201020
// Lambda MC association
1021-
if (sigma.lambdaPDGCode() == 3122) {
1021+
if (sigma.lambdaPDGCode() == PDG_t::kLambda0) {
10221022
if (sigma.lambdamcpt() > 0) {
1023-
histos.fill(HIST("BeforeSel/MC/Reso/h2dLambdaPtResolution"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt()); // 1/pT resolution
1024-
histos.fill(HIST("BeforeSel/MC/Reso/h3dLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), -1 * sigma.lambdaNegTPCCrossedRows()); // 1/pT resolution
1025-
histos.fill(HIST("BeforeSel/MC/Reso/h3dLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), sigma.lambdaPosTPCCrossedRows()); // 1/pT resolution
1023+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h2dLambdaPtResolution"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt()); // 1/pT resolution
1024+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h3dLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), -1 * sigma.lambdaNegTPCCrossedRows()); // 1/pT resolution
1025+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h3dLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), sigma.lambdaPosTPCCrossedRows()); // 1/pT resolution
10261026
}
10271027
}
10281028

10291029
//_______________________________________
10301030
// AntiLambda MC association
1031-
if (sigma.lambdaPDGCode() == -3122) {
1031+
if (sigma.lambdaPDGCode() == PDG_t::kLambda0Bar) {
10321032
if (sigma.lambdamcpt() > 0) {
1033-
histos.fill(HIST("BeforeSel/MC/Reso/h2dAntiLambdaPtResolution"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt()); // pT resolution
1034-
histos.fill(HIST("BeforeSel/MC/Reso/h3dAntiLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), -1 * sigma.lambdaNegTPCCrossedRows()); // 1/pT resolution
1035-
histos.fill(HIST("BeforeSel/MC/Reso/h3dAntiLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), sigma.lambdaPosTPCCrossedRows()); // 1/pT resolution
1033+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h2dAntiLambdaPtResolution"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt()); // pT resolution
1034+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h3dAntiLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), -1 * sigma.lambdaNegTPCCrossedRows()); // 1/pT resolution
1035+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h3dAntiLambdaPtResoVsTPCCR"), 1.f / sigma.lambdamcpt(), 1.f / sigma.lambdaPt() - 1.f / sigma.lambdamcpt(), sigma.lambdaPosTPCCrossedRows()); // 1/pT resolution
10361036
}
10371037
}
10381038

10391039
//_______________________________________
10401040
// Sigma and AntiSigma MC association
10411041
if (sigma.isSigma0()) {
1042-
histos.fill(HIST("BeforeSel/MC/Reso/h2dSigma0RadiusResolution"), sigma.mcpt(), sigma.radius() - sigma.mcradius()); // pT resolution
1042+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h2dSigma0RadiusResolution"), sigma.mcpt(), sigma.radius() - sigma.mcradius()); // pT resolution
10431043
if (sigma.mcpt() > 0) {
1044-
histos.fill(HIST("BeforeSel/MC/Reso/h2dSigma0PtResolution"), sigma.mcpt(), sigma.pt() - sigma.mcpt()); // pT resolution
1045-
histos.fill(HIST("BeforeSel/MC/Reso/h2dSigma0InvPtResolution"), 1.f / sigma.mcpt(), 1.f / sigma.pt() - 1.f / sigma.mcpt()); // pT resolution
1044+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h2dSigma0PtResolution"), sigma.mcpt(), (sigma.pt() / sigma.mcpt()) - 1.f); // pT resolution
1045+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h2dSigma0InvPtResolution"), 1.f / sigma.mcpt(), 1.f / sigma.pt() - 1.f / sigma.mcpt()); // pT resolution
10461046
}
10471047
}
10481048
if (sigma.isAntiSigma0()) {
1049-
histos.fill(HIST("BeforeSel/MC/Reso/h2dASigma0RadiusResolution"), sigma.mcpt(), sigma.radius() - sigma.mcradius()); // pT resolution
1049+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h2dASigma0RadiusResolution"), sigma.mcpt(), sigma.radius() - sigma.mcradius()); // pT resolution
10501050
if (sigma.mcpt() > 0)
1051-
histos.fill(HIST("BeforeSel/MC/Reso/h2dAntiSigma0PtResolution"), 1.f / sigma.mcpt(), 1.f / sigma.pt() - 1.f / sigma.mcpt()); // pT resolution
1051+
histos.fill(HIST(MainDir[mode]) + HIST("/MC/Reso/h2dAntiSigma0PtResolution"), 1.f / sigma.mcpt(), 1.f / sigma.pt() - 1.f / sigma.mcpt()); // pT resolution
10521052
}
10531053
}
10541054

@@ -1072,24 +1072,24 @@ struct sigmaanalysis {
10721072

10731073
//_______________________________________
10741074
// Real Gamma x Real Lambda - but not from the same sigma0/antisigma0!
1075-
if ((PhotonPDGCode == 22) && ((LambdaPDGCode == 3122) || (LambdaPDGCode == -3122)) && (!fIsSigma && !fIsAntiSigma)) {
1075+
if ((PhotonPDGCode == PDG_t::kGamma) && ((LambdaPDGCode == PDG_t::kLambda0) || (LambdaPDGCode == PDG_t::kLambda0Bar)) && (!fIsSigma && !fIsAntiSigma)) {
10761076
histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dPtVsMassSigma_TrueDaughters"), sigmapT, sigmaMass);
10771077
histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dTrueDaughtersMatrix"), LambdaPDGCodeMother, PhotonPDGCodeMother);
10781078
}
10791079

10801080
//_______________________________________
10811081
// Real Gamma x fake Lambda
1082-
if ((PhotonPDGCode == 22) && (LambdaPDGCode != 3122) && (LambdaPDGCode != -3122))
1082+
if ((PhotonPDGCode == PDG_t::kGamma) && (LambdaPDGCode != PDG_t::kLambda0) && (LambdaPDGCode != PDG_t::kLambda0Bar))
10831083
histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dPtVsMassSigma_TrueGammaFakeLambda"), sigmapT, sigmaMass);
10841084

10851085
//_______________________________________
10861086
// Fake Gamma x Real Lambda
1087-
if ((PhotonPDGCode != 22) && ((LambdaPDGCode == 3122) || (LambdaPDGCode == -3122)))
1087+
if ((PhotonPDGCode != PDG_t::kGamma) && ((LambdaPDGCode == PDG_t::kLambda0) || (LambdaPDGCode == PDG_t::kLambda0Bar)))
10881088
histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dPtVsMassSigma_FakeGammaTrueLambda"), sigmapT, sigmaMass);
10891089

10901090
//_______________________________________
10911091
// Fake Gamma x Fake Lambda
1092-
if ((PhotonPDGCode != 22) && (LambdaPDGCode != 3122) && (LambdaPDGCode != -3122))
1092+
if ((PhotonPDGCode != PDG_t::kGamma) && (LambdaPDGCode != PDG_t::kLambda0) && (LambdaPDGCode != PDG_t::kLambda0Bar))
10931093
histos.fill(HIST(MainDir[mode]) + HIST("/MC/BkgStudy/h2dPtVsMassSigma_FakeDaughters"), sigmapT, sigmaMass);
10941094
}
10951095

@@ -1220,7 +1220,7 @@ struct sigmaanalysis {
12201220

12211221
//_______________________________________
12221222
// MC specific
1223-
if (doprocessMonteCarlo) {
1223+
if (doprocessMonteCarlo || doprocessMonteCarloWithEMCal) {
12241224
if constexpr (requires { sigma.lambdaPDGCode(); sigma.photonPDGCode(); }) {
12251225

12261226
if (fillSelhistos) {
@@ -1302,8 +1302,8 @@ struct sigmaanalysis {
13021302

13031303
//_______________________________________
13041304
// pT resolution histos
1305-
if ((mode == 0) && fillResoQAhistos)
1306-
getResolution(sigma);
1305+
if (fillResoQAhistos)
1306+
getResolution<mode>(sigma);
13071307
}
13081308
}
13091309
}

0 commit comments

Comments
 (0)