Skip to content

Commit 8db765c

Browse files
committed
Code optimisation to include rapidity shift
1 parent 3faeaa7 commit 8db765c

File tree

1 file changed

+88
-88
lines changed

1 file changed

+88
-88
lines changed

PWGLF/Tasks/Resonances/kstar892LightIon.cxx

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ struct Kstar892LightIon {
9898
Configurable<bool> isGlobalTracks{"isGlobalTracks", true, "isGlobalTracks"};
9999

100100
Configurable<float> cfgCutPT{"cfgCutPT", 0.1f, "PT cut on daughter track"};
101-
Configurable<float> cfgCutEtaMax{"cfgCutEtaMax", 0.8f, "Eta cut on daughter track"};
102-
Configurable<float> cfgCutDCAxyMax{"cfgCutDCAxyMax", 0.1f, "DCAxy range for tracks"};
101+
Configurable<float> cfgCutEta{"cfgCutEta", 0.8f, "Eta cut on daughter track"};
102+
Configurable<float> cfgCutDCAxy{"cfgCutDCAxy", 0.1f, "DCAxy range for tracks"};
103103
Configurable<float> cfgCutDCAz{"cfgCutDCAz", 0.1f, "DCAz range for tracks"};
104104
Configurable<int> cfgNoMixedEvents{"cfgNoMixedEvents", 15, "Number of mixed events per event"};
105105
Configurable<int> cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"};
@@ -121,9 +121,10 @@ struct Kstar892LightIon {
121121
// Configurable<bool> isApplyCutsOnMother{"isApplyCutsOnMother", false, "Enable additional cuts on Kstar mother"};
122122
// Configurable<float> cMaxPtMotherCut{"cMaxPtMotherCut", 15.0, "Maximum pt of mother cut"};
123123
// Configurable<float> cMaxMinvMotherCut{"cMaxMinvMotherCut", 1.5, "Maximum mass of mother cut"};
124-
Configurable<float> motherRapidityCut{"motherRapidityCut", 0.5, "Maximum rapidity of mother"};
125-
// PID selections
124+
Configurable<float> motherRapidityMax{"motherRapidityMax", 0.5, "Maximum rapidity of mother"};
125+
Configurable<float> motherRapidityMin{"motherRapidityMin", -0.5, "Minimum rapidity of mother"};
126126

127+
// PID selections
127128
Configurable<bool> onlyTOF{"onlyTOF", false, "only TOF tracks"};
128129
Configurable<bool> onlyTOFHIT{"onlyTOFHIT", false, "accept only TOF hit tracks at high pt"};
129130
Configurable<bool> onlyTPC{"onlyTPC", false, "only TPC tracks"};
@@ -324,6 +325,7 @@ struct Kstar892LightIon {
324325
if (doprocessLossMCMultiplicity) {
325326
hMC.add("LossMult/hMultMC", "Charged Paticle multiplicity in generated MC before event selection", kTH1F, {axisNch});
326327
hMC.add("LossMult/hCentVsMultMC", "Centrality vs Charged Particle Multiplicity", kTH2F, {centralityAxis, axisNch});
328+
hMC.add("LossMult/hCentVsMultMC_EvtSel", "Centrality vs Charged Particle Multiplicity after event selection", kTH2F, {centralityAxis, axisNch});
327329
hMC.add("LossMult/hGenEvt_vs_multMC", "Charged Paticle multiplicity in generated MC after event selection", kTH1F, {axisNch});
328330
hMC.add("LossMult/hGenEvtRecoEvt_vs_multMC", "Charged Paticle multiplicity in generated MC before event selection with reconstruction", kTH1F, {axisNch});
329331
hMC.add("LossMult/hGenKstar_vs_pt_vs_multMC", "pT vs Charged particle multiplicity", kTH2F, {ptAxis, axisNch});
@@ -419,10 +421,10 @@ struct Kstar892LightIon {
419421
if (std::abs(candidate.pt()) < selectionConfig.cfgCutPT)
420422
return false;
421423

422-
if (std::abs(candidate.eta()) > selectionConfig.cfgCutEtaMax)
424+
if (std::abs(candidate.eta()) > selectionConfig.cfgCutEta)
423425
return false;
424426
if (!selectionConfig.isApplyPtDepDCAxyCut) {
425-
if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxyMax)
427+
if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxy)
426428
return false;
427429
} else {
428430
if (std::abs(candidate.dcaXY()) > (0.0105 + 0.035 / std::pow(candidate.pt(), 1.1)))
@@ -449,11 +451,11 @@ struct Kstar892LightIon {
449451
} else if (!selectionConfig.isGlobalTracks) {
450452
if (std::abs(candidate.pt()) < selectionConfig.cfgCutPT)
451453
return false;
452-
// if (std::abs(candidate.eta()) > selectionConfig.cfgCutEtaMax || std::abs(candidate.eta()) < selectionConfig.cfgCutEtaMin)
453-
if (std::abs(candidate.eta()) > selectionConfig.cfgCutEtaMax)
454+
// if (std::abs(candidate.eta()) > selectionConfig.cfgCutEta || std::abs(candidate.eta()) < selectionConfig.cfgCutEtaMin)
455+
if (std::abs(candidate.eta()) > selectionConfig.cfgCutEta)
454456
return false;
455-
// if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxyMax || std::abs(candidate.dcaXY()) < selectionConfig.cfgCutDCAxyMin)
456-
if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxyMax)
457+
// if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxy || std::abs(candidate.dcaXY()) < selectionConfig.cfgCutDCAxyMin)
458+
if (std::abs(candidate.dcaXY()) > selectionConfig.cfgCutDCAxy)
457459
return false;
458460
if (std::abs(candidate.dcaZ()) > selectionConfig.cfgCutDCAz)
459461
return false;
@@ -586,7 +588,7 @@ struct Kstar892LightIon {
586588
{
587589
if (track1.sign() * track2.sign() < 0) {
588590
if (!isMix) {
589-
if (std::abs(mother.Rapidity()) < selectionConfig.motherRapidityCut) {
591+
if (mother.Rapidity() > selectionConfig.motherRapidityMin && mother.Rapidity() < selectionConfig.motherRapidityMax) {
590592
hInvMass.fill(HIST("h3KstarInvMassUnlikeSign"), centrality, mother.Pt(), mother.M());
591593
}
592594
for (int i = 0; i < cRotations; i++) {
@@ -595,15 +597,15 @@ struct Kstar892LightIon {
595597
daughterRot = ROOT::Math::PxPyPzMVector(daughter1.Px() * std::cos(theta2) - daughter1.Py() * std::sin(theta2), daughter1.Px() * std::sin(theta2) + daughter1.Py() * std::cos(theta2), daughter1.Pz(), daughter1.M());
596598
motherRot = daughterRot + daughter2;
597599

598-
if (calcRotational && std::abs(motherRot.Rapidity()) < selectionConfig.motherRapidityCut)
600+
if (calcRotational && (motherRot.Rapidity() > selectionConfig.motherRapidityMin && motherRot.Rapidity() < selectionConfig.motherRapidityMax))
599601
hInvMass.fill(HIST("h3KstarInvMassRotated"), centrality, motherRot.Pt(), motherRot.M());
600602
}
601-
} else if (isMix && std::abs(mother.Rapidity()) < selectionConfig.motherRapidityCut) {
603+
} else if (isMix && (mother.Rapidity() > selectionConfig.motherRapidityMin && mother.Rapidity() < selectionConfig.motherRapidityMax)) {
602604
hInvMass.fill(HIST("h3KstarInvMassMixed"), centrality, mother.Pt(), mother.M());
603605
}
604606
} else {
605607
if (!isMix) {
606-
if (calcLikeSign && std::abs(mother.Rapidity()) < selectionConfig.motherRapidityCut) {
608+
if (calcLikeSign && (mother.Rapidity() > selectionConfig.motherRapidityMin && mother.Rapidity() < selectionConfig.motherRapidityMax)) {
607609
if (track1.sign() > 0 && track2.sign() > 0) {
608610
hInvMass.fill(HIST("h3KstarInvMasslikeSignPP"), centrality, mother.Pt(), mother.M());
609611
} else if (track1.sign() < 0 && track2.sign() < 0) {
@@ -619,8 +621,8 @@ struct Kstar892LightIon {
619621
// requirements
620622
// Filter eventFilter = (o2::aod::evsel::sel8 == true);
621623
Filter posZFilter = (nabs(o2::aod::collision::posZ) < selectionConfig.cfgVrtxZCut);
622-
Filter acceptanceFilter = (nabs(aod::track::eta) < selectionConfig.cfgCutEtaMax && nabs(aod::track::pt) > selectionConfig.cfgCutPT);
623-
Filter fDCAcutFilter = (nabs(aod::track::dcaXY) < selectionConfig.cfgCutDCAxyMax) && (nabs(aod::track::dcaZ) < selectionConfig.cfgCutDCAz);
624+
Filter acceptanceFilter = (nabs(aod::track::eta) < selectionConfig.cfgCutEta && nabs(aod::track::pt) > selectionConfig.cfgCutPT);
625+
Filter fDCAcutFilter = (nabs(aod::track::dcaXY) < selectionConfig.cfgCutDCAxy) && (nabs(aod::track::dcaZ) < selectionConfig.cfgCutDCAz);
624626

625627
// using EventCandidates = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::FT0Mults, aod::MultZeqs, aod::CentFT0Ms, aod::CentFT0Cs, aod::CentFT0As, aod::CentFV0As, aod::PVMults>>; // aod::CentNGlobals, aod::CentNTPVs, aod::CentMFTs
626628
// using EventCandidatesMC = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::FT0Mults, aod::PVMults, aod::CentFV0As>>;
@@ -950,9 +952,7 @@ struct Kstar892LightIon {
950952

951953
isMix = true;
952954

953-
if (std::abs(mother.Rapidity()) < selectionConfig.motherRapidityCut) {
954-
fillInvMass(daughter1, daughter2, mother, centrality, isMix, t1, t2);
955-
}
955+
fillInvMass(daughter1, daughter2, mother, centrality, isMix, t1, t2);
956956
}
957957
}
958958
};
@@ -1031,9 +1031,7 @@ struct Kstar892LightIon {
10311031

10321032
isMix = true;
10331033

1034-
if (std::abs(mother.Rapidity()) < selectionConfig.motherRapidityCut) {
1035-
fillInvMass(daughter1, daughter2, mother, centrality, isMix, t1, t2);
1036-
}
1034+
fillInvMass(daughter1, daughter2, mother, centrality, isMix, t1, t2);
10371035
}
10381036
}
10391037
};
@@ -1086,7 +1084,7 @@ struct Kstar892LightIon {
10861084
selectedEvents.resize(nevts);
10871085

10881086
for (const auto& mcParticle : mcParticles) {
1089-
if (std::abs(mcParticle.y()) < selectionConfig.motherRapidityCut && std::abs(mcParticle.pdgCode()) == o2::constants::physics::kK0Star892) {
1087+
if ((mcParticle.y() > selectionConfig.motherRapidityMin && mcParticle.y() < selectionConfig.motherRapidityMax) && std::abs(mcParticle.pdgCode()) == o2::constants::physics::kK0Star892) {
10901088
hMC.fill(HIST("Gen/hAllKstarGenCollisisons"), mcParticle.pt(), centrality);
10911089
}
10921090
}
@@ -1102,7 +1100,7 @@ struct Kstar892LightIon {
11021100

11031101
for (const auto& mcParticle : mcParticles) {
11041102

1105-
if (std::abs(mcParticle.y()) >= selectionConfig.motherRapidityCut) {
1103+
if (mcParticle.y() < selectionConfig.motherRapidityMin || mcParticle.y() > selectionConfig.motherRapidityMax) {
11061104
continue;
11071105
}
11081106

@@ -1265,7 +1263,7 @@ struct Kstar892LightIon {
12651263
continue;
12661264
}
12671265

1268-
if (std::abs(mothertrack1.y()) >= selectionConfig.motherRapidityCut) {
1266+
if (mothertrack1.y() < selectionConfig.motherRapidityMin || mothertrack1.y() > selectionConfig.motherRapidityMax) {
12691267
continue;
12701268
}
12711269

@@ -1342,7 +1340,7 @@ struct Kstar892LightIon {
13421340

13431341
hMC.fill(HIST("Rec/h2KstarRecpt2"), mothertrack1.pt(), centrality, std::sqrt(mothertrack1.e() * mothertrack1.e() - mothertrack1.p() * mothertrack1.p()));
13441342

1345-
if (mother.Rapidity() >= selectionConfig.motherRapidityCut) {
1343+
if (mother.Rapidity() < selectionConfig.motherRapidityMin || mother.Rapidity() > selectionConfig.motherRapidityMax) {
13461344
continue;
13471345
}
13481346

@@ -1389,8 +1387,7 @@ struct Kstar892LightIon {
13891387

13901388
// Generated MC
13911389
for (const auto& mcPart : mcParticles) {
1392-
1393-
if (std::abs(mcPart.y()) >= selectionConfig.motherRapidityCut || std::abs(mcPart.pdgCode()) != o2::constants::physics::kK0Star892)
1390+
if ((mcPart.y() < selectionConfig.motherRapidityMin || mcPart.y() > selectionConfig.motherRapidityMax) || std::abs(mcPart.pdgCode()) != o2::constants::physics::kK0Star892)
13941391
continue;
13951392

13961393
// signal loss estimation
@@ -1438,9 +1435,9 @@ struct Kstar892LightIon {
14381435
hMC.fill(HIST("CorrFactors/hNrecInGen"), collisions.size());
14391436

14401437
for (const auto& mcParticle : mcParticles) {
1441-
1442-
if (std::abs(mcParticle.y()) >= selectionConfig.motherRapidityCut)
1438+
if (mcParticle.y() < selectionConfig.motherRapidityMin || mcParticle.y() > selectionConfig.motherRapidityMax) {
14431439
continue;
1440+
}
14441441

14451442
if (std::abs(mcParticle.pdgCode()) == o2::constants::physics::kK0Star892) {
14461443

@@ -1492,6 +1489,61 @@ struct Kstar892LightIon {
14921489
}
14931490
PROCESS_SWITCH(Kstar892LightIon, processCorrFactors, "Process Signal Loss, Event Loss using chaged particle multiplicity", false);
14941491

1492+
void processLossMCMultiplicity(McCollisionMults::iterator const& mcCollision, aod::McParticles const& mcParticles, soa::SmallGroups<EventCandidatesMC> const& recCollisions)
1493+
{
1494+
const int multMC = mcCollision.multMCNParticlesEta05();
1495+
hMC.fill(HIST("LossMult/hMultMC"), multMC);
1496+
1497+
bool isSelectedEvent = false;
1498+
float centrality = -1.f;
1499+
1500+
for (auto const& collision : recCollisions) {
1501+
1502+
if (!selectionEvent(collision, false))
1503+
continue;
1504+
1505+
if (selectCentEstimator == kFT0M) {
1506+
centrality = collision.centFT0M();
1507+
} else if (selectCentEstimator == kFT0A) {
1508+
centrality = collision.centFT0A();
1509+
} else if (selectCentEstimator == kFT0C) {
1510+
centrality = collision.centFT0C();
1511+
} else if (selectCentEstimator == kFV0A) {
1512+
centrality = collision.centFV0A();
1513+
} else {
1514+
centrality = collision.centFT0M(); // default
1515+
}
1516+
1517+
isSelectedEvent = true;
1518+
}
1519+
1520+
hMC.fill(HIST("LossMult/hCentVsMultMC"), centrality, multMC);
1521+
1522+
// Event loss histograms
1523+
hMC.fill(HIST("LossMult/hGenEvt_vs_multMC"), multMC);
1524+
1525+
if (isSelectedEvent) {
1526+
hMC.fill(HIST("LossMult/hCentVsMultMC_EvtSel"), centrality, multMC);
1527+
hMC.fill(HIST("LossMult/hGenEvtRecoEvt_vs_multMC"), multMC);
1528+
}
1529+
1530+
// Signal loss histograms
1531+
for (auto const& mcPart : mcParticles) {
1532+
1533+
if ((mcPart.y() < selectionConfig.motherRapidityMin || mcPart.y() > selectionConfig.motherRapidityMax) || std::abs(mcPart.pdgCode()) != o2::constants::physics::kK0Star892)
1534+
continue;
1535+
1536+
const float pt = mcPart.pt();
1537+
1538+
hMC.fill(HIST("LossMult/hGenKstar_vs_pt_vs_multMC"), pt, multMC);
1539+
1540+
if (isSelectedEvent) {
1541+
hMC.fill(HIST("LossMult/hGenKstarRecoEvt_vs_pt_vs_multMC"), pt, multMC);
1542+
}
1543+
}
1544+
}
1545+
PROCESS_SWITCH(Kstar892LightIon, processLossMCMultiplicity, "Signal + Event loss (using MC multiplicity)", false);
1546+
14951547
void processRecMisID(EventCandidatesMC::iterator const& collision, TrackCandidatesMC const& tracks, aod::McParticles const&, EventMCGenerated const&)
14961548
{
14971549
if (!collision.has_mcCollision()) {
@@ -1548,7 +1600,9 @@ struct Kstar892LightIon {
15481600
ROOT::Math::PxPyPzMVector p2True(track2.px(), track2.py(), track2.pz(), massPi);
15491601

15501602
auto misIDMother = p1Fake + p2True;
1551-
hMC.fill(HIST("RecMisID/hMassMisID"), misIDMother.Pt(), centrality, misIDMother.M());
1603+
if (misIDMother.Rapidity() > selectionConfig.motherRapidityMin && misIDMother.Rapidity() < selectionConfig.motherRapidityMax) {
1604+
hMC.fill(HIST("RecMisID/hMassMisID"), misIDMother.Pt(), centrality, misIDMother.M());
1605+
}
15521606
}
15531607

15541608
// KK misidentification
@@ -1557,67 +1611,13 @@ struct Kstar892LightIon {
15571611
ROOT::Math::PxPyPzMVector p2True(track2.px(), track2.py(), track2.pz(), massKa);
15581612

15591613
auto misIDMother = p1Fake + p2True;
1560-
hMC.fill(HIST("RecMisID/hMassMisID"), misIDMother.Pt(), centrality, misIDMother.M());
1614+
if (misIDMother.Rapidity() > selectionConfig.motherRapidityMin && misIDMother.Rapidity() < selectionConfig.motherRapidityMax) {
1615+
hMC.fill(HIST("RecMisID/hMassMisID"), misIDMother.Pt(), centrality, misIDMother.M());
1616+
}
15611617
}
15621618
}
15631619
}
15641620
PROCESS_SWITCH(Kstar892LightIon, processRecMisID, "Process Reconstructed MisID Background", false);
1565-
1566-
void processLossMCMultiplicity(McCollisionMults::iterator const& mcCollision, soa::SmallGroups<EventCandidatesMC> const& collisions, aod::McParticles const& mcParticles)
1567-
{
1568-
const int multMC = mcCollision.multMCNParticlesEta05();
1569-
hMC.fill(HIST("LossMult/hMultMC"), multMC);
1570-
1571-
bool hasRecoEvent = false;
1572-
float centrality = -1.f;
1573-
1574-
for (auto const& coll : collisions) {
1575-
1576-
if (!selectionEvent(coll, false))
1577-
continue;
1578-
1579-
if (selectCentEstimator == kFT0M) {
1580-
centrality = coll.centFT0M();
1581-
} else if (selectCentEstimator == kFT0A) {
1582-
centrality = coll.centFT0A();
1583-
} else if (selectCentEstimator == kFT0C) {
1584-
centrality = coll.centFT0C();
1585-
} else if (selectCentEstimator == kFV0A) {
1586-
centrality = coll.centFV0A();
1587-
} else {
1588-
centrality = coll.centFT0M(); // default
1589-
}
1590-
1591-
hasRecoEvent = true;
1592-
}
1593-
1594-
hMC.fill(HIST("LossMult/hCentVsMultMC"), centrality, multMC);
1595-
1596-
// Event loss histograms
1597-
hMC.fill(HIST("LossMult/hGenEvt_vs_multMC"), multMC);
1598-
1599-
if (hasRecoEvent) {
1600-
hMC.fill(HIST("LossMult/hGenEvtRecoEvt_vs_multMC"), multMC);
1601-
}
1602-
1603-
// Signal loss histograms
1604-
for (auto const& p : mcParticles) {
1605-
1606-
if (std::abs(p.pdgCode()) != o2::constants::physics::kK0Star892)
1607-
continue;
1608-
if (std::abs(p.y()) >= selectionConfig.motherRapidityCut)
1609-
continue;
1610-
1611-
const float pt = p.pt();
1612-
1613-
hMC.fill(HIST("LossMult/hGenKstar_vs_pt_vs_multMC"), pt, multMC);
1614-
1615-
if (hasRecoEvent) {
1616-
hMC.fill(HIST("LossMult/hGenKstarRecoEvt_vs_pt_vs_multMC"), pt, multMC);
1617-
}
1618-
}
1619-
}
1620-
PROCESS_SWITCH(Kstar892LightIon, processLossMCMultiplicity, "Signal + Event loss (using MC multiplicity)", false);
16211621
};
16221622

16231623
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)