Skip to content

Commit a5842e7

Browse files
committed
some efficiency improvements
1 parent 11f63f1 commit a5842e7

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

PWGLF/Tasks/Nuspex/antinucleiInJets.cxx

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,10 @@ struct AntinucleiInJets {
14551455
// Loop over MC particles to analyze underlying event region
14561456
for (const auto& particle : mcParticles) {
14571457

1458+
// Antiproton selection based on the pdg
1459+
if (particle.user_index() != PDG_t::kProtonBar)
1460+
continue;
1461+
14581462
// Select physical primaries within the acceptance
14591463
static constexpr double MinPtParticle = 0.1;
14601464
if (particle.eta() < minEta || particle.eta() > maxEta || particle.pt() < MinPtParticle)
@@ -1478,10 +1482,6 @@ struct AntinucleiInJets {
14781482
if (deltaRUe1 > maxConeRadius && deltaRUe2 > maxConeRadius)
14791483
continue;
14801484

1481-
// Select antiprotons based on PDG
1482-
if (particle.pdgCode() != PDG_t::kProtonBar)
1483-
continue;
1484-
14851485
// Fill histogram for antiprotons in the UE
14861486
registryMC.fill(HIST("antiproton_gen_ue"), particle.pt());
14871487
}
@@ -1496,6 +1496,9 @@ struct AntinucleiInJets {
14961496
// Reconstructed events
14971497
void processJetsMCrec(RecCollisionsMc const& collisions, AntiNucleiTracksMc const& mcTracks, McParticles const&)
14981498
{
1499+
// Initialize ITS PID Response object
1500+
o2::aod::ITSResponse itsResponse;
1501+
14991502
// Loop over all reconstructed collisions
15001503
for (const auto& collision : collisions) {
15011504

@@ -1595,9 +1598,6 @@ struct AntinucleiInJets {
15951598
// Get jet constituents
15961599
std::vector<fastjet::PseudoJet> jetConstituents = jet.constituents();
15971600

1598-
// Initialize ITS PID Response object
1599-
o2::aod::ITSResponse itsResponse;
1600-
16011601
// Loop over jet constituents
16021602
for (const auto& particle : jetConstituents) {
16031603

@@ -1606,11 +1606,19 @@ struct AntinucleiInJets {
16061606
if (!passedTrackSelection(track))
16071607
continue;
16081608

1609+
// Antimatter selection
1610+
if (track.sign() > 0)
1611+
continue;
1612+
16091613
// Get corresponding MC particle
16101614
if (!track.has_mcParticle())
16111615
continue;
16121616
const auto mcparticle = track.mcParticle();
16131617

1618+
// Antiproton selection based on the PDG
1619+
if (mcparticle.pdgCode() != PDG_t::kProtonBar)
1620+
continue;
1621+
16141622
// Define variables
16151623
double nsigmaTPCPr = track.tpcNSigmaPr();
16161624
double nsigmaTOFPr = track.tofNSigmaPr();
@@ -1619,7 +1627,7 @@ struct AntinucleiInJets {
16191627
double dcaz = track.dcaZ();
16201628

16211629
// Fill DCA templates
1622-
if (mcparticle.pdgCode() == PDG_t::kProtonBar && std::fabs(dcaz) < maxDcaz) {
1630+
if (std::fabs(dcaz) < maxDcaz) {
16231631
if (mcparticle.isPhysicalPrimary()) {
16241632
registryMC.fill(HIST("antiproton_prim_dca_jet"), pt, dcaxy);
16251633
} else {
@@ -1631,10 +1639,6 @@ struct AntinucleiInJets {
16311639
if (std::fabs(dcaxy) > maxDcaxy || std::fabs(dcaz) > maxDcaz)
16321640
continue;
16331641

1634-
// Antiproton selection
1635-
if (track.sign() > 0 || mcparticle.pdgCode() != PDG_t::kProtonBar)
1636-
continue;
1637-
16381642
// Particle identification using the ITS cluster size
16391643
bool passedItsPidProt(true);
16401644
double nSigmaITSprot = static_cast<double>(itsResponse.nSigmaITS<o2::track::PID::Proton>(track));
@@ -1668,13 +1672,17 @@ struct AntinucleiInJets {
16681672
if (!passedTrackSelection(track))
16691673
continue;
16701674

1675+
// Antiproton selection
1676+
if (track.sign() > 0)
1677+
continue;
1678+
16711679
// Get corresponding MC particle
16721680
if (!track.has_mcParticle())
16731681
continue;
16741682
const auto mcparticle = track.mcParticle();
16751683

1676-
// Antiproton selection
1677-
if (track.sign() > 0 || mcparticle.pdgCode() != PDG_t::kProtonBar)
1684+
// Antiproton selection based on the PDG
1685+
if (mcparticle.pdgCode() != PDG_t::kProtonBar)
16781686
continue;
16791687

16801688
// Define variables
@@ -1685,7 +1693,7 @@ struct AntinucleiInJets {
16851693
double dcaz = track.dcaZ();
16861694

16871695
// Fill DCA templates
1688-
if (mcparticle.pdgCode() == PDG_t::kProtonBar && std::fabs(dcaz) < maxDcaz) {
1696+
if (std::fabs(dcaz) < maxDcaz) {
16891697
if (mcparticle.isPhysicalPrimary()) {
16901698
registryMC.fill(HIST("antiproton_prim_dca_ue"), pt, dcaxy);
16911699
} else {

0 commit comments

Comments
 (0)