Skip to content

Commit 8908fe6

Browse files
committed
Minor fix with event counter
1 parent a3ee786 commit 8908fe6

1 file changed

Lines changed: 134 additions & 72 deletions

File tree

PWGLF/Tasks/Nuspex/piKpRAA.cxx

Lines changed: 134 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ struct PiKpRAA {
501501

502502
if (doprocessSim) {
503503
registry.add("EventCounterMC", ";;Events", kTH1F, {{5, 0, 5}});
504-
registry.add("zPosMC", "Generated Events With at least One Rec. Collision + Sel. criteria;;Entries;", kTH1F, {axisZpos});
504+
registry.add("zPosMC", "From the association between the MC event & the Rec. Coll with largest number of PV contributors & NO Evy. Sel.;;Entries;", kTH1F, {axisZpos});
505+
registry.add("zPosMCAll", "All MC Events;;Entries;", kTH1F, {axisZpos});
505506
registry.add("EtaMCParAllMCColl", "#eta from all MC particles in all MC collisions;#eta;Entries;", kTH1F, {{50, -10.0, 10.0}});
506507
registry.add("EtaMCParAllMCColl_Pion", "#eta from all MC particles in all MC collisions;#eta;Entries;", kTH1F, {{50, -10.0, 10.0}});
507508
registry.add("EtaMCParAllMCColl_Kaon", "#eta from all MC particles in all MC collisions;#eta;Entries;", kTH1F, {{50, -10.0, 10.0}});
@@ -517,7 +518,8 @@ struct PiKpRAA {
517518

518519
registry.add("CentralityVsBCVsFT0VsTVXVsEvSel", "All=1 | BC=2 | FT0=3 | TVX=4 | EvSel=5;;Status;", kTH2F, {{axisCent}, {5, 0.5, 5.5}});
519520
registry.add("NumOfRecColl", "Num. of times a MC evt. is reconstructed;N;Entries", kTH1F, {{5, -0.5, 4.5}});
520-
registry.add("NumOfRecCollVsNContributors", "Num. of times a MC evt. is reconstructed VS Num. of PV contributors;Number of times a MC event is reconstructed;Number of tracks used for the PV", kTH2F, {{5, -0.5, 4.5}, axisNch});
521+
registry.add("NumOfRecCollVsNContri", "Num. of times a MC evt. is reconstructed VS Num. of PV contributors;Number of times a MC event is reconstructed;Number of tracks used for the PV", kTH2F, {{5, -0.5, 4.5}, axisNch});
522+
registry.add("NumOfRecCollVsNContriWithEvtSel", "Num. of times a MC evt. is reconstructed VS Num. of PV contributors WITH EVT SEL;Number of times a MC event is reconstructed;Number of tracks used for the PV", kTH2F, {{5, -0.5, 4.5}, axisNch});
521523

522524
// Pt resolution
523525
registry.add("PtResolution", "p_{T} resolution;;(pt_{rec} - pt_{gen})/pt_{gen};", kTH2F, {axisPt, {100, -1.0, 1.0}});
@@ -546,9 +548,9 @@ struct PiKpRAA {
546548
registry.add("NchMC_WithOnlyRecColl", "Gen Nch from MC event associated with a ONLY ONE Rec. Coll from last Num. of Contributors;Gen. Nch;Entries", kTH1F, {axisNch});
547549

548550
// Needed to measure Event Splitting
549-
registry.add("Centrality_WRecoEvt", "Generated Events With at least One Rec. Collision And NO Sel. criteria;;Entries", kTH1F, {axisCent});
550-
registry.add("Centrality_WRecoEvtWSelCri", "Generated Events With at least One Rec. Collision + Sel. criteria;;Entries", kTH1F, {axisCent});
551-
registry.add("Centrality_AllRecoEvt", "Generated Events Irrespective of the number of times it was reconstructed + Evt. Selections;;Entries", kTH1F, {axisCent});
551+
registry.add("Centrality_WRecoEvt", "From the association between the MC event & the Rec. Coll with largest number of PV contributors & NO Evt. Sel.;;Entries", kTH1F, {axisCent});
552+
registry.add("Centrality_WRecoEvtWSelCri", "From the association between the MC event & the Rec. Coll with largest number of PV contributors + Evt. Sel.;;Entries", kTH1F, {axisCent});
553+
registry.add("Centrality_AllRecoEvt", "All Rec. Coll. Irrespective of the times it was reconstructed + Evt. Sel.;;Entries", kTH1F, {axisCent});
552554

553555
// Needed to calculate the numerator of the Signal Loss correction
554556
registry.add("PtPiVsNchMC_WithRecoEvt", "Generated Events With at least One Rec. Collision;;Gen. Nch;", kTH2F, {axisPt, axisNch});
@@ -1420,6 +1422,7 @@ struct PiKpRAA {
14201422
// Only charge particles within tpcNchAcceptance and without pT selection
14211423
//---------------------------
14221424
registry.fill(HIST("NchMC_AllGen"), nChMCTPCAcc);
1425+
registry.fill(HIST("zPosMCAll"), mccollision.posZ());
14231426

14241427
//---------------------------
14251428
// How many times was the MC event reconstrued?
@@ -1433,84 +1436,27 @@ struct PiKpRAA {
14331436
if (nRecColls > KzeroInt) {
14341437

14351438
//---------------------------
1436-
// Looks for the collision with the largest number of tracks contributing to the primary vertex reconstruction
1439+
// Looks for the collision with the largest number of tracks contributing to the PV reconstruction
14371440
// The selected collision is identified by its global index (bestCollisionIndex)
14381441
//---------------------------
14391442
int biggestNContribs{-1};
14401443
int bestCollisionIndex{-1};
1441-
for (const auto& collision : collisions) {
1442-
1443-
float centrality{-999.0};
1444-
if (centralitySelector.value == "FT0C") {
1445-
centrality = collision.centFT0C();
1446-
} else if (centralitySelector.value == "FT0M") {
1447-
centrality = collision.centFT0M();
1448-
} else if (centralitySelector.value == "FV0A") {
1449-
centrality = collision.centFV0A();
1450-
} else {
1451-
centrality = -999.0;
1452-
}
14531444

1454-
registry.fill(HIST("NumOfRecCollVsNContributors"), nRecColls, collision.numContrib());
1455-
1456-
if (selHasFT0 && !collision.has_foundFT0()) {
1457-
continue;
1458-
}
1459-
1460-
if (selHasBC && !collision.has_foundBC()) {
1461-
continue;
1462-
}
1463-
1464-
if (useSel8 && !collision.sel8()) {
1465-
continue;
1466-
}
1467-
1468-
// kIsTriggerTVX
1469-
if (selTriggerTVX && !collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) {
1470-
continue;
1471-
}
1472-
1473-
// kNoITSROFrameBorder
1474-
if (selNoITSROFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
1475-
continue;
1476-
}
1477-
1478-
// kNoTimeFrameBorder
1479-
if (selNoTimeFrameBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
1480-
continue;
1481-
}
1482-
1483-
// Zvtx
1484-
if (isZvtxPosSel && std::fabs(collision.posZ()) > posZcut) {
1485-
continue;
1486-
}
1487-
1488-
if (selIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) {
1489-
continue;
1490-
}
1445+
for (const auto& collision : collisions) {
14911446

1492-
if (selNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) {
1493-
continue;
1494-
}
1447+
registry.fill(HIST("NumOfRecCollVsNContri"), nRecColls, collision.numContrib());
14951448

1449+
//---------------------------
14961450
// Gets the index of the collision with the largest number of contributors
1451+
//---------------------------
14971452
if (biggestNContribs < collision.numContrib()) {
14981453
biggestNContribs = collision.numContrib();
14991454
bestCollisionIndex = collision.globalIndex();
15001455
}
15011456

15021457
//---------------------------
1503-
// Needed to calculate denominator of the EVENT SPLITTING correction
1504-
// MC Collisions that are reconstructed more than one will be stored here
1458+
// This is only for QA
15051459
//---------------------------
1506-
registry.fill(HIST("Centrality_AllRecoEvt"), centrality);
1507-
}
1508-
1509-
//---------------------------
1510-
// This is only for QA purposes
1511-
//---------------------------
1512-
for (const auto& collision : collisions) {
1513-
15141460
int mcNchInTPCAcc{0};
15151461
for (const auto& particle : mcParticles) {
15161462

@@ -1576,6 +1522,110 @@ struct PiKpRAA {
15761522
}
15771523
}
15781524

1525+
//---------------------------
1526+
// Needed to calculate denominator of the EVENT SPLITTING correction
1527+
// MC Collisions that are reconstructed more than one will be stored here
1528+
//---------------------------
1529+
for (const auto& collision : collisions) {
1530+
1531+
float centrality{-999.0};
1532+
if (centralitySelector.value == "FT0C") {
1533+
centrality = collision.centFT0C();
1534+
} else if (centralitySelector.value == "FT0M") {
1535+
centrality = collision.centFT0M();
1536+
} else if (centralitySelector.value == "FV0A") {
1537+
centrality = collision.centFV0A();
1538+
} else {
1539+
centrality = -999.0;
1540+
}
1541+
1542+
//---------------------------
1543+
// Event Selection
1544+
// Applied manually to avoid double filling the EventCounter
1545+
//---------------------------
1546+
1547+
// Has BC?
1548+
if (selHasBC) {
1549+
if (!collision.has_foundBC()) {
1550+
continue;
1551+
}
1552+
}
1553+
1554+
// Has FT0 information?
1555+
if (selHasFT0) {
1556+
if (!collision.has_foundFT0()) {
1557+
continue;
1558+
}
1559+
}
1560+
1561+
// Use sel8?
1562+
if (useSel8) {
1563+
if (!collision.sel8()) {
1564+
continue;
1565+
}
1566+
}
1567+
1568+
// kIsTriggerTVX
1569+
if (selTriggerTVX) {
1570+
if (!collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) {
1571+
continue;
1572+
}
1573+
}
1574+
1575+
// kNoITSROFrameBorder
1576+
if (selNoITSROFrameBorder) {
1577+
if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
1578+
continue;
1579+
}
1580+
}
1581+
1582+
// kNoTimeFrameBorder
1583+
if (selNoTimeFrameBorder) {
1584+
if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
1585+
continue;
1586+
}
1587+
}
1588+
1589+
// Zvtx
1590+
if (isZvtxPosSel) {
1591+
if (std::fabs(collision.posZ()) > posZcut) {
1592+
continue;
1593+
}
1594+
}
1595+
1596+
// Short distance between FT0 & PV vertices
1597+
if (selIsGoodZvtxFT0vsPV) {
1598+
if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) {
1599+
continue;
1600+
}
1601+
}
1602+
1603+
if (selNoSameBunchPileup) {
1604+
if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) {
1605+
continue;
1606+
}
1607+
}
1608+
1609+
if (isCentSel) {
1610+
if (centrality < minCentCut || centrality > maxCentCut) {
1611+
continue;
1612+
}
1613+
}
1614+
1615+
if (selINELgt0) {
1616+
if (!collision.isInelGt0()) {
1617+
continue;
1618+
}
1619+
}
1620+
1621+
//---------------------------
1622+
// Needed to calculate denominator of the EVENT SPLITTING correction
1623+
// MC Collisions that are reconstructed more than one will be stored here
1624+
//---------------------------
1625+
registry.fill(HIST("Centrality_AllRecoEvt"), centrality);
1626+
registry.fill(HIST("NumOfRecCollVsNContriWithEvtSel"), nRecColls, collision.numContrib());
1627+
}
1628+
15791629
//---------------------------
15801630
// Loop over the reconstructed collisions
15811631
// Only that one with the largest number of contributors is considered
@@ -1619,9 +1669,6 @@ struct PiKpRAA {
16191669
}
16201670
}
16211671

1622-
//---------------------------
1623-
// Needed to construct the correlation between MC Nch v.s. centrality
1624-
//---------------------------
16251672
registry.fill(HIST("Centrality_WRecoEvt"), centrality);
16261673
registry.fill(HIST("zPosMC"), mccollision.posZ());
16271674

@@ -1698,6 +1745,9 @@ struct PiKpRAA {
16981745
return;
16991746
}
17001747

1748+
//---------------------------
1749+
// Needed to construct the correlation between MC Nch v.s. centrality
1750+
//---------------------------
17011751
registry.fill(HIST("Centrality_WRecoEvtWSelCri"), centrality); // To calculate numerator of EVENT SPLITTING
17021752
registry.fill(HIST("NchMCVsCent"), centrality, nChMCTPCAcc); // Needed for the mapping betwee MC Nch and centrality
17031753
registry.fill(HIST("NchMC_WithRecoEvt"), nChMCTPCAcc); // Numerator of EVENT LOSS correction
@@ -2534,7 +2584,19 @@ struct PiKpRAA {
25342584
}
25352585

25362586
if (isCentSel) {
2537-
if (col.centFT0C() < minCentCut || col.centFT0C() > maxCentCut) {
2587+
2588+
float cenT{-999.0};
2589+
if (centralitySelector.value == "FT0C") {
2590+
cenT = col.centFT0C();
2591+
} else if (centralitySelector.value == "FT0M") {
2592+
cenT = col.centFT0M();
2593+
} else if (centralitySelector.value == "FV0A") {
2594+
cenT = col.centFV0A();
2595+
} else {
2596+
cenT = -999.0;
2597+
}
2598+
2599+
if (cenT < minCentCut || cenT > maxCentCut) {
25382600
return false;
25392601
}
25402602
registry.fill(HIST("EventCounter"), EvCutLabel::Centrality);

0 commit comments

Comments
 (0)