Skip to content

Commit 49d5d8d

Browse files
authored
[PWGLF] Add weight option to histograms (#15660)
1 parent b0e28ad commit 49d5d8d

File tree

1 file changed

+108
-23
lines changed

1 file changed

+108
-23
lines changed

PWGLF/Tasks/Resonances/lambda1520analysisinpp.cxx

Lines changed: 108 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ struct Lambda1520analysisinpp {
178178
Configurable<float> cEtacutMC{"cEtacutMC", 0.5f, "MC eta cut"};
179179
Configurable<bool> cUseRapcutMC{"cUseRapcutMC", true, "MC eta cut"};
180180
Configurable<bool> cUseEtacutMC{"cUseEtacutMC", true, "MC eta cut"};
181+
Configurable<bool> useWeight{"useWeight", false, "Use weight for signal loss calculation"};
181182

182183
// cuts on mother
183184
Configurable<bool> cfgUseCutsOnMother{"cfgUseCutsOnMother", false, "Enable additional cuts on mother"};
@@ -431,7 +432,11 @@ struct Lambda1520analysisinpp {
431432
if (doprocessdummy) {
432433
histos.add("Result/dummy/Genprotonpt", "pT distribution of #Lambda(1520) from Proton", kTH3F, {axisMClabel, axisPt, axisMult});
433434
histos.add("Result/dummy/Genlambdapt", "pT distribution of #Lambda(1520) from #Lambda", kTH3F, {axisMClabel, axisPt, axisMult});
434-
histos.add("Result/dummy/Genxipt", "pT distribution of #Lambda(1520) from #Xi^{-}", kTH3F, {axisMClabel, axisPt, axisMult});
435+
histos.add("Result/dummy/Genxipt", "pT distribution of #Lambda(1520) from #Xi", kTH3F, {axisMClabel, axisPt, axisMult});
436+
437+
histos.add("Result/dummy/GenTrueprotonpt", "pT distribution of True MC Proton", kTH3F, {axisMClabel, axisPt, axisMult});
438+
histos.add("Result/dummy/GenTruelambdapt", "pT distribution of True MC #Lambda", kTH3F, {axisMClabel, axisPt, axisMult});
439+
histos.add("Result/dummy/GenTruexipt", "pT distribution of True MC #Xi", kTH3F, {axisMClabel, axisPt, axisMult});
435440
}
436441

437442
// Print output histograms statistics
@@ -1309,95 +1314,175 @@ struct Lambda1520analysisinpp {
13091314
return (ptL2 > 0) ? std::sqrt(ptL2) : -1.f;
13101315
};
13111316

1312-
for (auto& part : mcPartsAll) {
1317+
for (const auto& part : mcPartsAll) {
13131318

13141319
if (!part.isPhysicalPrimary())
13151320
continue;
13161321

13171322
float pt = part.pt();
13181323

1324+
float weight;
1325+
13191326
if (cUseRapcutMC && std::abs(part.y()) > configTracks.cfgCutRapidity) // rapidity cut
13201327
continue;
13211328

13221329
if (std::abs(part.pdgCode()) == kProton) {
13231330

1331+
// true proton
1332+
histos.fill(HIST("Result/dummy/GenTrueprotonpt"), 0, pt, centrality);
1333+
1334+
if (inVtx10) // vtx10
1335+
histos.fill(HIST("Result/dummy/GenTrueprotonpt"), 1, pt, centrality);
1336+
1337+
if (inVtx10 && isSel8) // vtx10, sel8
1338+
histos.fill(HIST("Result/dummy/GenTrueprotonpt"), 2, pt, centrality);
1339+
1340+
if (inVtx10 && isTriggerTVX) // vtx10, TriggerTVX
1341+
histos.fill(HIST("Result/dummy/GenTrueprotonpt"), 3, pt, centrality);
1342+
1343+
if (inVtx10 && isTrueINELgt0) // vtx10, INEL>0
1344+
histos.fill(HIST("Result/dummy/GenTrueprotonpt"), 4, pt, centrality);
1345+
1346+
if (isInAfterAllCuts) // after all event selection
1347+
histos.fill(HIST("Result/dummy/GenTrueprotonpt"), 5, pt, centrality);
1348+
1349+
if (isInAfterAllCuts && isTrueINELgt0) // after all event selection && INEL>0
1350+
histos.fill(HIST("Result/dummy/GenTrueprotonpt"), 6, pt, centrality);
1351+
13241352
float ptL = computePtL(pt, massPr);
13251353
if (ptL < 0)
13261354
continue;
13271355

1328-
histos.fill(HIST("Result/dummy/Genprotonpt"), 0, ptL, centrality);
1356+
if (useWeight)
1357+
weight = ptL / pt;
1358+
else
1359+
weight = 1.f;
1360+
1361+
histos.fill(HIST("Result/dummy/Genprotonpt"), 0, ptL, centrality, weight);
13291362

13301363
if (inVtx10) // vtx10
1331-
histos.fill(HIST("Result/dummy/Genprotonpt"), 1, ptL, centrality);
1364+
histos.fill(HIST("Result/dummy/Genprotonpt"), 1, ptL, centrality, weight);
13321365

13331366
if (inVtx10 && isSel8) // vtx10, sel8
1334-
histos.fill(HIST("Result/dummy/Genprotonpt"), 2, ptL, centrality);
1367+
histos.fill(HIST("Result/dummy/Genprotonpt"), 2, ptL, centrality, weight);
13351368

13361369
if (inVtx10 && isTriggerTVX) // vtx10, TriggerTVX
1337-
histos.fill(HIST("Result/dummy/Genprotonpt"), 3, ptL, centrality);
1370+
histos.fill(HIST("Result/dummy/Genprotonpt"), 3, ptL, centrality, weight);
13381371

13391372
if (inVtx10 && isTrueINELgt0) // vtx10, INEL>0
1340-
histos.fill(HIST("Result/dummy/Genprotonpt"), 4, ptL, centrality);
1373+
histos.fill(HIST("Result/dummy/Genprotonpt"), 4, ptL, centrality, weight);
13411374

13421375
if (isInAfterAllCuts) // after all event selection
1343-
histos.fill(HIST("Result/dummy/Genprotonpt"), 5, ptL, centrality);
1376+
histos.fill(HIST("Result/dummy/Genprotonpt"), 5, ptL, centrality, weight);
13441377

13451378
if (isInAfterAllCuts && isTrueINELgt0) // after all event selection && INEL>0
1346-
histos.fill(HIST("Result/dummy/Genprotonpt"), 6, ptL, centrality);
1379+
histos.fill(HIST("Result/dummy/Genprotonpt"), 6, ptL, centrality, weight);
13471380
}
13481381

13491382
if (std::abs(part.pdgCode()) == kLambda0) {
13501383

1384+
// true lambda
1385+
histos.fill(HIST("Result/dummy/GenTruelambdapt"), 0, pt, centrality);
1386+
1387+
if (inVtx10) // vtx10
1388+
histos.fill(HIST("Result/dummy/GenTruelambdapt"), 1, pt, centrality);
1389+
1390+
if (inVtx10 && isSel8) // vtx10, sel8
1391+
histos.fill(HIST("Result/dummy/GenTruelambdapt"), 2, pt, centrality);
1392+
1393+
if (inVtx10 && isTriggerTVX) // vtx10, TriggerTVX
1394+
histos.fill(HIST("Result/dummy/GenTruelambdapt"), 3, pt, centrality);
1395+
1396+
if (inVtx10 && isTrueINELgt0) // vtx10, INEL>0
1397+
histos.fill(HIST("Result/dummy/GenTruelambdapt"), 4, pt, centrality);
1398+
1399+
if (isInAfterAllCuts) // after all event selection
1400+
histos.fill(HIST("Result/dummy/GenTruelambdapt"), 5, pt, centrality);
1401+
1402+
if (isInAfterAllCuts && isTrueINELgt0) // after all event selection && INEL>0
1403+
histos.fill(HIST("Result/dummy/GenTruelambdapt"), 6, pt, centrality);
1404+
13511405
float ptL = computePtL(pt, MassLambda0);
13521406
if (ptL < 0)
13531407
continue;
13541408

1355-
histos.fill(HIST("Result/dummy/Genlambdapt"), 0, ptL, centrality);
1409+
if (useWeight)
1410+
weight = ptL / pt;
1411+
else
1412+
weight = 1.f;
1413+
1414+
histos.fill(HIST("Result/dummy/Genlambdapt"), 0, ptL, centrality, weight);
13561415

13571416
if (inVtx10) // vtx10
1358-
histos.fill(HIST("Result/dummy/Genlambdapt"), 1, ptL, centrality);
1417+
histos.fill(HIST("Result/dummy/Genlambdapt"), 1, ptL, centrality, weight);
13591418

13601419
if (inVtx10 && isSel8) // vtx10, sel8
1361-
histos.fill(HIST("Result/dummy/Genlambdapt"), 2, ptL, centrality);
1420+
histos.fill(HIST("Result/dummy/Genlambdapt"), 2, ptL, centrality, weight);
13621421

13631422
if (inVtx10 && isTriggerTVX) // vtx10, TriggerTVX
1364-
histos.fill(HIST("Result/dummy/Genlambdapt"), 3, ptL, centrality);
1423+
histos.fill(HIST("Result/dummy/Genlambdapt"), 3, ptL, centrality, weight);
13651424

13661425
if (inVtx10 && isTrueINELgt0) // vtx10, INEL>0
1367-
histos.fill(HIST("Result/dummy/Genlambdapt"), 4, ptL, centrality);
1426+
histos.fill(HIST("Result/dummy/Genlambdapt"), 4, ptL, centrality, weight);
13681427

13691428
if (isInAfterAllCuts) // after all event selection
1370-
histos.fill(HIST("Result/dummy/Genlambdapt"), 5, ptL, centrality);
1429+
histos.fill(HIST("Result/dummy/Genlambdapt"), 5, ptL, centrality, weight);
13711430

13721431
if (isInAfterAllCuts && isTrueINELgt0) // after all event selection && INEL>0
1373-
histos.fill(HIST("Result/dummy/Genlambdapt"), 6, ptL, centrality);
1432+
histos.fill(HIST("Result/dummy/Genlambdapt"), 6, ptL, centrality, weight);
13741433
}
13751434

13761435
if (std::abs(part.pdgCode()) == PDG_t::kXiMinus) {
13771436

1437+
// true Xi
1438+
histos.fill(HIST("Result/dummy/GenTruexipt"), 0, pt, centrality);
1439+
1440+
if (inVtx10) // vtx10
1441+
histos.fill(HIST("Result/dummy/GenTruexipt"), 1, pt, centrality);
1442+
1443+
if (inVtx10 && isSel8) // vtx10, sel8
1444+
histos.fill(HIST("Result/dummy/GenTruexipt"), 2, pt, centrality);
1445+
1446+
if (inVtx10 && isTriggerTVX) // vtx10, TriggerTVX
1447+
histos.fill(HIST("Result/dummy/GenTruexipt"), 3, pt, centrality);
1448+
1449+
if (inVtx10 && isTrueINELgt0) // vtx10, INEL>0
1450+
histos.fill(HIST("Result/dummy/GenTruexipt"), 4, pt, centrality);
1451+
1452+
if (isInAfterAllCuts) // after all event selection
1453+
histos.fill(HIST("Result/dummy/GenTruexipt"), 5, pt, centrality);
1454+
1455+
if (isInAfterAllCuts && isTrueINELgt0) // after all event selection && INEL>0
1456+
histos.fill(HIST("Result/dummy/GenTruexipt"), 6, pt, centrality);
1457+
13781458
float ptL = computePtL(pt, MassXiMinus);
13791459
if (ptL < 0)
13801460
continue;
13811461

1382-
histos.fill(HIST("Result/dummy/Genxipt"), 0, ptL, centrality);
1462+
if (useWeight)
1463+
weight = ptL / pt;
1464+
else
1465+
weight = 1.f;
1466+
1467+
histos.fill(HIST("Result/dummy/Genxipt"), 0, ptL, centrality, weight);
13831468

13841469
if (inVtx10) // vtx10
1385-
histos.fill(HIST("Result/dummy/Genxipt"), 1, ptL, centrality);
1470+
histos.fill(HIST("Result/dummy/Genxipt"), 1, ptL, centrality, weight);
13861471

13871472
if (inVtx10 && isSel8) // vtx10, sel8
1388-
histos.fill(HIST("Result/dummy/Genxipt"), 2, ptL, centrality);
1473+
histos.fill(HIST("Result/dummy/Genxipt"), 2, ptL, centrality, weight);
13891474

13901475
if (inVtx10 && isTriggerTVX) // vtx10, TriggerTVX
1391-
histos.fill(HIST("Result/dummy/Genxipt"), 3, ptL, centrality);
1476+
histos.fill(HIST("Result/dummy/Genxipt"), 3, ptL, centrality, weight);
13921477

13931478
if (inVtx10 && isTrueINELgt0) // vtx10, INEL>0
1394-
histos.fill(HIST("Result/dummy/Genxipt"), 4, ptL, centrality);
1479+
histos.fill(HIST("Result/dummy/Genxipt"), 4, ptL, centrality, weight);
13951480

13961481
if (isInAfterAllCuts) // after all event selection
1397-
histos.fill(HIST("Result/dummy/Genxipt"), 5, ptL, centrality);
1482+
histos.fill(HIST("Result/dummy/Genxipt"), 5, ptL, centrality, weight);
13981483

13991484
if (isInAfterAllCuts && isTrueINELgt0) // after all event selection && INEL>0
1400-
histos.fill(HIST("Result/dummy/Genxipt"), 6, ptL, centrality);
1485+
histos.fill(HIST("Result/dummy/Genxipt"), 6, ptL, centrality, weight);
14011486
}
14021487
}
14031488
}

0 commit comments

Comments
 (0)