Skip to content

Commit 1c28b73

Browse files
author
jimun_lee
committed
[PWGLF] Fixed and added couple of options about KstarInOO.cxx
1 parent 0682194 commit 1c28b73

File tree

1 file changed

+98
-68
lines changed

1 file changed

+98
-68
lines changed

PWGLF/Tasks/Resonances/kstarInOO.cxx

Lines changed: 98 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#include "Common/DataModel/Centrality.h"
1616
#include "Common/DataModel/EventSelection.h"
1717
#include "Common/DataModel/Multiplicity.h"
18-
#include "Common/DataModel/PIDResponseTOF.h"
19-
#include "Common/DataModel/PIDResponseTPC.h"
18+
#include "Common/DataModel/PIDResponse.h"
2019
#include "Common/DataModel/TrackSelectionTables.h"
2120

2221
#include "CommonConstants/PhysicsConstants.h"
@@ -72,9 +71,10 @@ struct kstarInOO {
7271
// Track Selection
7372
// General
7473
Configurable<double> cfgTrackMinPt{"cfgTrackMinPt", 0.15, "set track min pT"};
75-
Configurable<double> cfgTrackMaxEta{"cfgTrackMaxEta", 0.9, "set track max Eta"};
74+
Configurable<double> cfgTrackMaxEta{"cfgTrackMaxEta", 0.8, "set track max Eta"};
7675
Configurable<double> cfgTrackMaxDCArToPVcut{"cfgTrackMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"};
7776
Configurable<double> cfgTrackMaxDCAzToPVcut{"cfgTrackMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"};
77+
Configurable<bool> cfgTrackGlobalSel{"cfgTrackGlobalSel", true, "Global track selection"};
7878
Configurable<bool> cfgTrackPrimaryTrack{"cfgTrackPrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz
7979
Configurable<bool> cfgTrackConnectedToPV{"cfgTrackConnectedToPV", true, "PV contributor track selection"}; // PV Contriuibutor
8080
Configurable<bool> cfgTrackGlobalWoDCATrack{"cfgTrackGlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange)
@@ -188,6 +188,12 @@ struct kstarInOO {
188188
histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
189189
histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
190190
histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis});
191+
192+
histos.add("hMC_USS_pion", "hMC_USS_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
193+
histos.add("hMC_LSS_pion", "hMC_LSS_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
194+
histos.add("hMC_USS_Mix_pion", "hMC_USS_Mix_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
195+
histos.add("hMC_LSS_Mix_pion", "hMC_LSS_Mix_pion", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
196+
histos.add("hMC_USS_pion_True", "hMC_USS_pion_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
191197
}
192198
} // end of init
193199

@@ -244,9 +250,9 @@ struct kstarInOO {
244250
};
245251

246252
template <typename TracksType>
247-
bool trackSelection(const TracksType track)
253+
bool trackSelection(const TracksType track, const bool QA)
248254
{
249-
if (cfgTrackCutQA) {
255+
if (cfgTrackCutQA && QA) {
250256
histos.fill(HIST("hDCArToPv_BC"), track.dcaXY());
251257
histos.fill(HIST("hDCAzToPv_BC"), track.dcaZ());
252258
histos.fill(HIST("hIsPrim_BC"), track.isPrimaryTrack());
@@ -258,7 +264,7 @@ struct kstarInOO {
258264
histos.fill(HIST("hTPCChi2_BC"), track.tpcChi2NCl());
259265
histos.fill(HIST("QA_track_pT_BC"), track.pt());
260266
}
261-
if (!track.isGlobalTrack())
267+
if (cfgTrackGlobalSel && !track.isGlobalTrack())
262268
return false;
263269
if (track.pt() < cfgTrackMinPt)
264270
return false;
@@ -285,7 +291,7 @@ struct kstarInOO {
285291
if (cfgTrackConnectedToPV && !track.isPVContributor())
286292
return false;
287293

288-
if (cfgTrackCutQA) {
294+
if (cfgTrackCutQA && QA) {
289295
histos.fill(HIST("hDCArToPv_AC"), track.dcaXY());
290296
histos.fill(HIST("hDCAzToPv_AC"), track.dcaZ());
291297
histos.fill(HIST("hIsPrim_AC"), track.isPrimaryTrack());
@@ -301,15 +307,16 @@ struct kstarInOO {
301307
};
302308

303309
template <typename TrackPID>
304-
bool trackPIDKaon(const TrackPID& candidate)
310+
bool trackPIDKaon(const TrackPID& candidate, const bool QA)
305311
{
306-
bool tpcPIDPassed{false}, tofPIDPassed{false};
307-
// TPC
308-
if (cfgTrackCutQA) {
312+
if (cfgTrackCutQA && QA) {
309313
histos.fill(HIST("QA_nSigma_kaon_TPC_BC"), candidate.pt(), candidate.tpcNSigmaKa());
310314
histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), candidate.pt(), candidate.tofNSigmaKa());
311315
histos.fill(HIST("QA_kaon_TPC_TOF_BC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa());
312316
}
317+
318+
bool tpcPIDPassed{false}, tofPIDPassed{false};
319+
// TPC
313320
if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig)
314321
tpcPIDPassed = true;
315322
// TOF
@@ -322,7 +329,7 @@ struct kstarInOO {
322329
}
323330
// TPC & TOF
324331
if (tpcPIDPassed && tofPIDPassed) {
325-
if (cfgTrackCutQA) {
332+
if (cfgTrackCutQA && QA) {
326333
histos.fill(HIST("QA_nSigma_kaon_TPC_AC"), candidate.pt(), candidate.tpcNSigmaKa());
327334
histos.fill(HIST("QA_nSigma_kaon_TOF_AC"), candidate.pt(), candidate.tofNSigmaKa());
328335
histos.fill(HIST("QA_kaon_TPC_TOF_AC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa());
@@ -333,15 +340,15 @@ struct kstarInOO {
333340
}
334341

335342
template <typename TrackPID>
336-
bool trackPIDPion(const TrackPID& candidate)
343+
bool trackPIDPion(const TrackPID& candidate, const bool QA)
337344
{
338-
bool tpcPIDPassed{false}, tofPIDPassed{false};
339-
// TPC
340-
if (cfgTrackCutQA) {
345+
if (cfgTrackCutQA && QA) {
341346
histos.fill(HIST("QA_nSigma_pion_TPC_BC"), candidate.pt(), candidate.tpcNSigmaPi());
342347
histos.fill(HIST("QA_nSigma_pion_TOF_BC"), candidate.pt(), candidate.tofNSigmaPi());
343348
histos.fill(HIST("QA_pion_TPC_TOF_BC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi());
344349
}
350+
bool tpcPIDPassed{false}, tofPIDPassed{false};
351+
// TPC
345352
if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig)
346353
tpcPIDPassed = true;
347354
if (candidate.hasTOF()) {
@@ -353,7 +360,7 @@ struct kstarInOO {
353360
}
354361
// TPC & TOF
355362
if (tpcPIDPassed && tofPIDPassed) {
356-
if (cfgTrackCutQA) {
363+
if (cfgTrackCutQA && QA) {
357364
histos.fill(HIST("QA_nSigma_pion_TPC_AC"), candidate.pt(), candidate.tpcNSigmaPi());
358365
histos.fill(HIST("QA_nSigma_pion_TOF_AC"), candidate.pt(), candidate.tofNSigmaPi());
359366
histos.fill(HIST("QA_pion_TPC_TOF_AC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi());
@@ -364,69 +371,90 @@ struct kstarInOO {
364371
}
365372

366373
template <typename CollisionType, typename TracksType>
367-
void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix)
374+
void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix, const bool QA)
368375
{
369376
auto tracks1 = kaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache);
370377
auto tracks2 = pion->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache);
371378
auto centrality = collision1.centFT0C();
372379

373380
for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) {
374-
auto [KstarPt, Minv] = minvReconstruction(trk1, trk2);
375-
if (Minv < 0)
381+
if (std::fabs(trk1.signed1Pt()) <= 0.f || std::fabs(trk2.signed1Pt()) <= 0.f)
376382
continue;
377383

384+
auto [KstarPt, Minv] = minvReconstruction(trk1, trk2, QA);
385+
378386
double conjugate = trk1.sign() * trk2.sign();
379387
if (cfgDataHistos) {
380-
if (!IsMix) {
381-
if (conjugate < 0) {
382-
histos.fill(HIST("hUSS"), centrality, KstarPt, Minv);
383-
} else if (conjugate > 0) {
384-
histos.fill(HIST("hLSS"), centrality, KstarPt, Minv);
385-
}
386-
} else {
387-
if (conjugate < 0) {
388-
histos.fill(HIST("hUSS_Mix"), centrality, KstarPt, Minv);
389-
} else if (conjugate > 0) {
390-
histos.fill(HIST("hLSS_Mix"), centrality, KstarPt, Minv);
388+
if (Minv > 0) {
389+
if (!IsMix) {
390+
if (conjugate < 0) {
391+
histos.fill(HIST("hUSS"), centrality, KstarPt, Minv);
392+
} else if (conjugate > 0) {
393+
histos.fill(HIST("hLSS"), centrality, KstarPt, Minv);
394+
}
395+
} else {
396+
if (conjugate < 0) {
397+
histos.fill(HIST("hUSS_Mix"), centrality, KstarPt, Minv);
398+
} else if (conjugate > 0) {
399+
histos.fill(HIST("hLSS_Mix"), centrality, KstarPt, Minv);
400+
}
391401
}
392402
}
393403
} // cfgDataHistos
394404
} // for
395405
} // TrackSlicing
396406

397407
template <typename CollisionType, typename TracksType>
398-
void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix)
408+
void TrackSlicingMC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool IsMix, const bool QA)
399409
{
400410
auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache);
401411
auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache);
402412
auto centrality = collision1.centFT0C();
403413

404414
for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) {
405-
auto [KstarPt, Minv] = minvReconstruction(trk1, trk2);
406-
if (Minv < 0)
415+
if (!trk1.has_mcParticle() || !trk2.has_mcParticle())
416+
continue;
417+
if (std::fabs(trk1.signed1Pt()) <= 0.f || std::fabs(trk2.signed1Pt()) <= 0.f)
407418
continue;
408419

420+
auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA);
421+
// auto [KstarPt_piK, Minv_piK] = minvReconstruction(trk2, trk1, false);
422+
409423
double conjugate = trk1.sign() * trk2.sign();
410424
if (cfgMcHistos) {
411-
if (!IsMix) {
412-
if (conjugate < 0) {
413-
histos.fill(HIST("hMC_USS"), centrality, KstarPt, Minv);
414-
} else if (conjugate > 0) {
415-
histos.fill(HIST("hMC_LSS"), centrality, KstarPt, Minv);
416-
}
417-
} else {
418-
if (conjugate < 0) {
419-
histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt, Minv);
420-
} else if (conjugate > 0) {
421-
histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt, Minv);
425+
if (Minv_Kpi > 0) {
426+
if (!IsMix) {
427+
if (conjugate < 0) {
428+
histos.fill(HIST("hMC_USS"), centrality, KstarPt_Kpi, Minv_Kpi);
429+
} else if (conjugate > 0) {
430+
histos.fill(HIST("hMC_LSS"), centrality, KstarPt_Kpi, Minv_Kpi);
431+
}
432+
} else {
433+
if (conjugate < 0) {
434+
histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi);
435+
} else if (conjugate > 0) {
436+
histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi);
437+
}
422438
}
423-
}
424-
} // cfgMcHistos
425-
439+
} // else if (Minv_piK > 0){
440+
// if (!IsMix) {
441+
// if (conjugate < 0) {
442+
// histos.fill(HIST("hMC_USS_pion"), centrality, KstarPt_piK, Minv_piK);
443+
// } else if (conjugate > 0) {
444+
// histos.fill(HIST("hMC_LSS_pion"), centrality, KstarPt_piK, Minv_piK);
445+
// }
446+
// }
447+
// else {
448+
// if (conjugate < 0) {
449+
// histos.fill(HIST("hMC_USS_Mix_pion"), centrality, KstarPt_piK, Minv_piK);
450+
// } else if (conjugate > 0) {
451+
// histos.fill(HIST("hMC_LSS_Mix_pion"), centrality, KstarPt_piK, Minv_piK);
452+
// }
453+
// }
454+
// }
455+
}
426456
//======================
427457
// Gen MC
428-
if (!trk1.has_mcParticle() || !trk2.has_mcParticle())
429-
continue;
430458

431459
auto particle1 = trk1.mcParticle();
432460
auto particle2 = trk2.mcParticle();
@@ -435,11 +463,9 @@ struct kstarInOO {
435463
if (std::fabs(particle2.pdgCode()) != 211)
436464
continue; // Not Pion
437465

438-
if (!particle1.has_mothers()) {
466+
if (!particle1.has_mothers() || !particle2.has_mothers()) {
439467
continue;
440468
}
441-
if (!particle2.has_mothers())
442-
continue;
443469

444470
std::vector<int> mothers1{};
445471
std::vector<int> mothers1PDG{};
@@ -464,24 +490,25 @@ struct kstarInOO {
464490
continue; // Kaon and pion not from the same K*0
465491

466492
if (cfgMcHistos) {
467-
histos.fill(HIST("hMC_USS_True"), centrality, KstarPt, Minv);
493+
histos.fill(HIST("hMC_USS_True"), centrality, KstarPt_Kpi, Minv_Kpi);
494+
// histos.fill(HIST("hMC_USS_pion_True"), centrality, KstarPt_piK, Minv_piK);
468495
}
469496
//======================
470497
} // for
471498
} // TrackSlicingMC
472499

473500
template <typename TracksType>
474-
std::pair<double, double> minvReconstruction(const TracksType& trk1, const TracksType& trk2)
501+
std::pair<double, double> minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA)
475502
{
476-
TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
477-
478-
if (!trackSelection(trk1) || !trackSelection(trk2))
503+
if (!trackSelection(trk1, false) || !trackSelection(trk2, false))
479504
return {-1.0, -1.0};
480-
if (!trackPIDKaon(trk1) || !trackPIDPion(trk2))
505+
if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA))
481506
return {-1.0, -1.0};
482-
if (trk1.globalIndex() == trk2.globalIndex()) {
483-
return {-1.0, -1.0}; // For Kstar, we need to run (0,1), (1,0) pairs as well. but same id pairs are not need.
484-
}
507+
if (trk1.globalIndex() == trk2.globalIndex())
508+
return {-1.0, -1.0};
509+
510+
TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
511+
485512
lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa);
486513
lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi);
487514
lResonance = lDecayDaughter1 + lDecayDaughter2;
@@ -515,7 +542,7 @@ struct kstarInOO {
515542

516543
bool INELgt0 = false;
517544
for (const auto& track : tracks) {
518-
if (!trackSelection(track))
545+
if (!trackSelection(track, true))
519546
continue;
520547
if (std::fabs(track.eta()) < cfgTrackMaxEta) {
521548
INELgt0 = true;
@@ -527,7 +554,7 @@ struct kstarInOO {
527554
if (cfgDataHistos) {
528555
histos.fill(HIST("nEvents"), 1.5);
529556
}
530-
TrackSlicing(collision, tracks, collision, tracks, false);
557+
TrackSlicing(collision, tracks, collision, tracks, false, true);
531558

532559
} // processSameEvents
533560
PROCESS_SWITCH(kstarInOO, processDataSameEvent, "process Data Same Event", false);
@@ -556,7 +583,7 @@ struct kstarInOO {
556583
if (!goodEv1 || !goodEv2)
557584
continue;
558585

559-
TrackSlicing(collision1, tracks1, collision2, tracks2, false);
586+
TrackSlicing(collision1, tracks1, collision2, tracks2, true, false);
560587
}
561588
}
562589
PROCESS_SWITCH(kstarInOO, processDataMixedEvent, "process DATA Mixed Event", false);
@@ -586,6 +613,8 @@ struct kstarInOO {
586613

587614
bool INELgt0 = false;
588615
for (const auto& track : tracks) {
616+
if (!trackSelection(track, true))
617+
continue;
589618
if (std::fabs(track.eta()) < cfgTrackMaxEta) {
590619
INELgt0 = true;
591620
}
@@ -596,7 +625,7 @@ struct kstarInOO {
596625
if (cfgMcHistos) {
597626
histos.fill(HIST("nEvents_MC"), 1.5);
598627
}
599-
TrackSlicingMC(collision, tracks, collision, tracks, false);
628+
TrackSlicingMC(collision, tracks, collision, tracks, false, true);
600629
} // processSameEvents_MC
601630
PROCESS_SWITCH(kstarInOO, processSameEventMC, "process Same Event MC", true);
602631

@@ -620,10 +649,11 @@ struct kstarInOO {
620649
}
621650
auto goodEv1 = eventSelection(collision1);
622651
auto goodEv2 = eventSelection(collision2);
623-
if (!goodEv1 || !goodEv2)
652+
if (!goodEv1 || !goodEv2) {
624653
continue;
654+
}
625655

626-
TrackSlicingMC(collision1, tracks1, collision2, tracks2, true);
656+
TrackSlicingMC(collision1, tracks1, collision2, tracks2, true, false);
627657
} // mixing
628658
} // processMixedEvent_MC
629659
PROCESS_SWITCH(kstarInOO, processMixedEventMC, "process Mixed Event MC", false);

0 commit comments

Comments
 (0)