Skip to content

Commit ae26b6d

Browse files
committed
Resolved comments from Vit
1 parent 789ce4b commit ae26b6d

3 files changed

Lines changed: 121 additions & 74 deletions

File tree

‎PWGLF/Tasks/Resonances/CMakeLists.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,12 @@ o2physics_add_dpl_workflow(hresonancecorrelation
374374
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::EventFilteringUtils
375375
COMPONENT_NAME Analysis)
376376

377-
o2physics_add_dpl_workflow(phiphimcinjected
377+
o2physics_add_dpl_workflow(phiphi-mc-injected
378378
SOURCES phiphimcinjected.cxx
379379
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
380380
COMPONENT_NAME Analysis)
381381

382-
o2physics_add_dpl_workflow(phiphimctrigger
382+
o2physics_add_dpl_workflow(phiphi-mc-trigger
383383
SOURCES phiphimctrigger.cxx
384384
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
385385
COMPONENT_NAME Analysis)

‎PWGLF/Tasks/Resonances/phiphimcinjected.cxx‎

Lines changed: 61 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
// or submit itself to any jurisdiction.
1111

1212
/// \file phiphimcinjected.cxx
13-
/// \brief Code for doublephi resonance MC
13+
/// \brief Code for injected doublephi resonance MC
1414
/// \author Sawan
15-
/// \since 25/09/2026
1615

1716
#include "Common/DataModel/EventSelection.h"
1817
#include "Common/DataModel/PIDResponseTOF.h"
@@ -76,12 +75,36 @@ struct PhiPhiMCInjected {
7675
ConfigurableAxis phiPhiMassAxis{"phiPhiMassAxis", {200, 2.0, 4.0}, "Phi-Phi Mass Axis"};
7776
ConfigurableAxis phiPhiPtAxis{"phiPhiPtAxis", {200, 0.0, 50.0}, "Phi-Phi Pt Axis"};
7877

78+
enum RecoSelectionStage {
79+
kLoop1Track = 0,
80+
kLoop1DCA,
81+
kLoop1PID,
82+
kLoop1MCLabel,
83+
kLoop1Eta,
84+
kLoop2Track,
85+
kLoop2Index,
86+
kLoop2Eta,
87+
kLoop2DCA,
88+
kLoop2PID,
89+
kLoop2MCLabel,
90+
kLoop2Charge,
91+
kLoop2KaonDaughters,
92+
kCommonMotherLoop,
93+
kCommonMother,
94+
kPhiMother,
95+
kPhiMassCut,
96+
kInjectedMother,
97+
kLoop2PhiPairs,
98+
kUniqueTracks,
99+
kValidPhiPhiPair
100+
};
101+
79102
void init(InitContext const&)
80103
{
81104

82105
// Event histogram
83-
registry.add("h1_TrackCount", "Track Count;Track Count;Counts", kTH1F, {{20, -0.5, 19.5}});
84-
registry.add("h1_EventCount", "Event Count;Event Count;Counts", kTH1F, {{15, -0.5, 14.5}});
106+
registry.add("h1_TrackCount", "Track Count;Track Count;Counts", kTH1F, {{25, -0.5, 24.5}});
107+
registry.add("h1_EventCount", "Event Count;Event Count;Counts", kTH1F, {{5, -0.5, 4.5}});
85108
// Generated MC Histograms
86109
registry.add("Generated/h2_InvMassPhiPhi", "Gen Phi-Phi: Mass vs pT;Mass (GeV/#it{c}^{2});p_{T} (GeV/#it{c})", kTHnSparseF, {{phiPhiMassAxis}, {phiPhiPtAxis}});
87110
registry.add("Generated/h2_InvMassPhiPhi2", "Gen Phi-Phi: Mass vs pT;Mass (GeV/#it{c}^{2});p_{T} (GeV/#it{c})", kTHnSparseF, {{phiPhiMassAxis}, {phiPhiPtAxis}});
@@ -179,34 +202,31 @@ struct PhiPhiMCInjected {
179202
ROOT::Math::PxPyPzEVector vecGen, vecDau1, vecDau2;
180203
ROOT::Math::PxPyPzMVector daughter1Gen, daughter2Gen, motherGen, daughter1Rec, daughter2Rec, motherRec;
181204

182-
double massKaPDG = o2::constants::physics::MassKPlus;
183-
double massPhi = o2::constants::physics::MassPhi; // GeV/c^2
184-
185205
// Process Generated MC
186206
void processGen(aod::McCollision const&, aod::McParticles const& mcParticles)
187207
{
188208
for (const auto& mcParticle : mcParticles) {
189209
if (mcParticle.pdgCode() == injectedMotherPDG) {
190210

191-
auto kDaughters = mcParticle.daughters_as<aod::McParticles>();
192-
if (kDaughters.size() != 2) {
211+
auto phiPhiDaughters = mcParticle.daughters_as<aod::McParticles>();
212+
if (phiPhiDaughters.size() != 2) {
193213
continue;
194214
}
195215

196216
int phiCount = 0;
197-
for (const auto& kCurrentDaughter : kDaughters) {
217+
for (const auto& kCurrentDaughter : phiPhiDaughters) {
198218

199219
if (kCurrentDaughter.pdgCode() != o2::constants::physics::kPhi) {
200220
continue;
201221
}
202222

203223
if (phiCount == 0) {
204-
vecDau1 = ROOT::Math::PxPyPzEVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), kCurrentDaughter.e()); // Phi meson mass
205-
daughter1Gen = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massPhi); // Phi meson mass
224+
vecDau1 = ROOT::Math::PxPyPzEVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), kCurrentDaughter.e()); // Phi meson mass
225+
daughter1Gen = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassPhi); // Phi meson mass
206226
phiCount++;
207227
registry.fill(HIST("Generated/h2_InvMassPhiFromT4s"), vecDau1.M(), daughter1Gen.Pt());
208228
} else if (phiCount == 1) {
209-
daughter2Gen = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massPhi); // Phi meson mass
229+
daughter2Gen = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassPhi); // Phi meson mass
210230
phiCount++;
211231
}
212232
}
@@ -226,22 +246,22 @@ struct PhiPhiMCInjected {
226246

227247
if (mcParticle.pdgCode() == o2::constants::physics::kPhi) {
228248

229-
auto kDaughters = mcParticle.daughters_as<aod::McParticles>();
230-
if (kDaughters.size() != 2) {
249+
auto phiDaughters = mcParticle.daughters_as<aod::McParticles>();
250+
if (phiDaughters.size() != 2) {
231251
continue;
232252
}
233253

234254
bool passPosKaon = false;
235255
bool passNegKaon = false;
236-
for (const auto& kCurrentDaughter : kDaughters) {
256+
for (const auto& kCurrentDaughter : phiDaughters) {
237257

238258
if (kCurrentDaughter.pdgCode() == PDG_t::kKPlus) {
239259
passPosKaon = true;
240-
daughter1Gen = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKaPDG);
260+
daughter1Gen = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassKPlus);
241261

242262
} else if (kCurrentDaughter.pdgCode() == PDG_t::kKMinus) {
243263
passNegKaon = true;
244-
daughter2Gen = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKaPDG);
264+
daughter2Gen = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), o2::constants::physics::MassKPlus);
245265
}
246266
}
247267

@@ -283,58 +303,60 @@ struct PhiPhiMCInjected {
283303

284304
// STEP 1: Reconstruct individual Phi candidates (Kaon track pairs)
285305
for (const auto& t1 : tracks) {
286-
registry.fill(HIST("h1_TrackCount"), 0.0);
306+
registry.fill(HIST("h1_TrackCount"), kLoop1Track);
287307

288308
if (std::abs(t1.dcaXY()) > config.cutDCAxy || std::abs(t1.dcaZ()) > config.cutDCAz) {
289309
continue;
290310
}
291-
registry.fill(HIST("h1_TrackCount"), 1.0);
311+
registry.fill(HIST("h1_TrackCount"), kLoop1DCA);
292312

293313
if (config.isApplyPIDSelection && !checkPID(t1.pt(), t1.tpcNSigmaKa(), t1.tofNSigmaKa(), t1.hasTOF())) {
294314
continue;
295315
}
296-
registry.fill(HIST("h1_TrackCount"), 2.0);
316+
registry.fill(HIST("h1_TrackCount"), kLoop1PID);
297317

298318
if (!t1.has_mcParticle()) {
299319
continue;
300320
}
301-
registry.fill(HIST("h1_TrackCount"), 3.0);
321+
registry.fill(HIST("h1_TrackCount"), kLoop1MCLabel);
302322

303323
if (std::abs(t1.eta()) > config.trackEtaCut) {
304324
continue;
305325
}
326+
registry.fill(HIST("h1_TrackCount"), kLoop1Eta);
306327

307328
for (const auto& t2 : tracks) {
308-
registry.fill(HIST("h1_TrackCount"), 4.0);
329+
registry.fill(HIST("h1_TrackCount"), kLoop2Track);
309330

310331
if (t2.index() <= t1.index()) {
311332
continue;
312333
}
313-
registry.fill(HIST("h1_TrackCount"), 5.0);
334+
registry.fill(HIST("h1_TrackCount"), kLoop2Index);
314335

315336
if (std::abs(t2.eta()) > config.trackEtaCut) {
316337
continue;
317338
}
339+
registry.fill(HIST("h1_TrackCount"), kLoop2Eta);
318340

319341
if (std::abs(t2.dcaXY()) > config.cutDCAxy || std::abs(t2.dcaZ()) > config.cutDCAz) {
320342
continue;
321343
}
322-
registry.fill(HIST("h1_TrackCount"), 6.0);
344+
registry.fill(HIST("h1_TrackCount"), kLoop2DCA);
323345

324346
if (config.isApplyPIDSelection && !checkPID(t2.pt(), t2.tpcNSigmaKa(), t2.tofNSigmaKa(), t2.hasTOF())) {
325347
continue;
326348
}
327-
registry.fill(HIST("h1_TrackCount"), 7.0);
349+
registry.fill(HIST("h1_TrackCount"), kLoop2PID);
328350

329351
if (!t2.has_mcParticle()) {
330352
continue;
331353
}
332-
registry.fill(HIST("h1_TrackCount"), 8.0);
354+
registry.fill(HIST("h1_TrackCount"), kLoop2MCLabel);
333355

334356
if (t1.sign() * t2.sign() > 0) {
335357
continue;
336358
}
337-
registry.fill(HIST("h1_TrackCount"), 9.0);
359+
registry.fill(HIST("h1_TrackCount"), kLoop2Charge);
338360

339361
auto mcKaTrk1 = t1.mcParticle();
340362
auto mcKaTrk2 = t2.mcParticle();
@@ -343,7 +365,7 @@ struct PhiPhiMCInjected {
343365
std::abs(mcKaTrk2.pdgCode()) != PDG_t::kKPlus) {
344366
continue;
345367
}
346-
registry.fill(HIST("h1_TrackCount"), 10.0);
368+
registry.fill(HIST("h1_TrackCount"), kLoop2KaonDaughters);
347369

348370
bool foundMother = false;
349371

@@ -352,28 +374,27 @@ struct PhiPhiMCInjected {
352374

353375
for (const auto& KaMotherPhi2 : mcKaTrk2.template mothers_as<aod::McParticles>()) {
354376

355-
registry.fill(HIST("h1_TrackCount"), 11.0);
377+
registry.fill(HIST("h1_TrackCount"), kCommonMotherLoop);
356378

357379
if (KaMotherPhi1.globalIndex() != KaMotherPhi2.globalIndex())
358380
continue;
359-
360-
registry.fill(HIST("h1_TrackCount"), 12.0);
381+
registry.fill(HIST("h1_TrackCount"), kCommonMother);
361382

362383
int motherPdg = KaMotherPhi1.pdgCode();
363384

364385
if (motherPdg != o2::constants::physics::kPhi)
365386
continue;
387+
registry.fill(HIST("h1_TrackCount"), kPhiMother);
366388

367-
registry.fill(HIST("h1_TrackCount"), 13.0);
368-
369-
daughter1Rec = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKaPDG);
370-
daughter2Rec = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massKaPDG);
389+
daughter1Rec = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassKPlus);
390+
daughter2Rec = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), o2::constants::physics::MassKPlus);
371391
motherRec = daughter1Rec + daughter2Rec;
372392

373393
// Phi invariant mass window cut (0.9 - 1.1 GeV/c^2)
374394
if (motherRec.M() < config.phiMassCutLow || motherRec.M() > config.phiMassCutHigh) {
375395
continue;
376396
}
397+
registry.fill(HIST("h1_TrackCount"), kPhiMassCut);
377398

378399
PhiCandidateInjected phiCand;
379400

@@ -387,7 +408,7 @@ struct PhiPhiMCInjected {
387408
if (gm.pdgCode() == injectedMotherPDG) {
388409
phiCand.isFrom999999 = true;
389410
phiCand.mc999999Index = gm.globalIndex();
390-
registry.fill(HIST("h1_TrackCount"), 14.0);
411+
registry.fill(HIST("h1_TrackCount"), kInjectedMother);
391412
}
392413
}
393414

@@ -437,19 +458,20 @@ struct PhiPhiMCInjected {
437458
for (size_t j = i + 1; j < phiCandidates.size(); ++j) {
438459
const auto& phi2 = phiCandidates[j];
439460

440-
registry.fill(HIST("h1_TrackCount"), 15.0);
461+
registry.fill(HIST("h1_TrackCount"), kLoop2PhiPairs);
441462

442463
// Ensure all 4 kaon tracks are unique
443464
if (phi1.t1Index == phi2.t1Index || phi1.t1Index == phi2.t2Index ||
444465
phi1.t2Index == phi2.t1Index || phi1.t2Index == phi2.t2Index) {
445466
continue;
446467
}
468+
registry.fill(HIST("h1_TrackCount"), kUniqueTracks);
447469

448470
if (!phi1.isValidMcPhi || !phi2.isValidMcPhi) {
449471
continue;
450472
}
451473

452-
registry.fill(HIST("h1_TrackCount"), 16.0);
474+
registry.fill(HIST("h1_TrackCount"), kValidPhiPhiPair);
453475

454476
// Combined 4-momentum of the Mother Phi-Phi System
455477
ROOT::Math::PxPyPzMVector phiPhiMother = phi1.p4 + phi2.p4;

0 commit comments

Comments
 (0)