Skip to content

Commit deb7708

Browse files
JimunLeejimun_lee
andauthored
[PWGLF] Fixed and added some options about QA in KstarInOO.cxx (#13022)
Co-authored-by: jimun_lee <jimun.lee@cern.ch>
1 parent dc5990a commit deb7708

File tree

1 file changed

+79
-68
lines changed

1 file changed

+79
-68
lines changed

PWGLF/Tasks/Resonances/kstarInOO.cxx

Lines changed: 79 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,82 +371,83 @@ 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;
419+
auto [KstarPt_Kpi, Minv_Kpi] = minvReconstruction(trk1, trk2, QA);
408420

409421
double conjugate = trk1.sign() * trk2.sign();
410422
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);
423+
if (Minv_Kpi > 0) {
424+
if (!IsMix) {
425+
if (conjugate < 0) {
426+
histos.fill(HIST("hMC_USS"), centrality, KstarPt_Kpi, Minv_Kpi);
427+
} else if (conjugate > 0) {
428+
histos.fill(HIST("hMC_LSS"), centrality, KstarPt_Kpi, Minv_Kpi);
429+
}
430+
} else {
431+
if (conjugate < 0) {
432+
histos.fill(HIST("hMC_USS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi);
433+
} else if (conjugate > 0) {
434+
histos.fill(HIST("hMC_LSS_Mix"), centrality, KstarPt_Kpi, Minv_Kpi);
435+
}
422436
}
423437
}
424-
} // cfgMcHistos
425-
438+
}
426439
//======================
427440
// Gen MC
428-
if (!trk1.has_mcParticle() || !trk2.has_mcParticle())
429-
continue;
430-
431441
auto particle1 = trk1.mcParticle();
432442
auto particle2 = trk2.mcParticle();
433443
if (std::fabs(particle1.pdgCode()) != 321)
434444
continue; // Not Kaon
435445
if (std::fabs(particle2.pdgCode()) != 211)
436446
continue; // Not Pion
437447

438-
if (!particle1.has_mothers()) {
448+
if (!particle1.has_mothers() || !particle2.has_mothers()) {
439449
continue;
440450
}
441-
if (!particle2.has_mothers())
442-
continue;
443451

444452
std::vector<int> mothers1{};
445453
std::vector<int> mothers1PDG{};
@@ -464,24 +472,24 @@ struct kstarInOO {
464472
continue; // Kaon and pion not from the same K*0
465473

466474
if (cfgMcHistos) {
467-
histos.fill(HIST("hMC_USS_True"), centrality, KstarPt, Minv);
475+
histos.fill(HIST("hMC_USS_True"), centrality, KstarPt_Kpi, Minv_Kpi);
468476
}
469477
//======================
470478
} // for
471479
} // TrackSlicingMC
472480

473481
template <typename TracksType>
474-
std::pair<double, double> minvReconstruction(const TracksType& trk1, const TracksType& trk2)
482+
std::pair<double, double> minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA)
475483
{
476-
TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
477-
478-
if (!trackSelection(trk1) || !trackSelection(trk2))
484+
if (!trackSelection(trk1, false) || !trackSelection(trk2, false))
479485
return {-1.0, -1.0};
480-
if (!trackPIDKaon(trk1) || !trackPIDPion(trk2))
486+
if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA))
481487
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-
}
488+
if (trk1.globalIndex() == trk2.globalIndex())
489+
return {-1.0, -1.0};
490+
491+
TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance;
492+
485493
lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa);
486494
lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi);
487495
lResonance = lDecayDaughter1 + lDecayDaughter2;
@@ -515,7 +523,7 @@ struct kstarInOO {
515523

516524
bool INELgt0 = false;
517525
for (const auto& track : tracks) {
518-
if (!trackSelection(track))
526+
if (!trackSelection(track, true))
519527
continue;
520528
if (std::fabs(track.eta()) < cfgTrackMaxEta) {
521529
INELgt0 = true;
@@ -527,7 +535,7 @@ struct kstarInOO {
527535
if (cfgDataHistos) {
528536
histos.fill(HIST("nEvents"), 1.5);
529537
}
530-
TrackSlicing(collision, tracks, collision, tracks, false);
538+
TrackSlicing(collision, tracks, collision, tracks, false, true);
531539

532540
} // processSameEvents
533541
PROCESS_SWITCH(kstarInOO, processDataSameEvent, "process Data Same Event", false);
@@ -556,7 +564,7 @@ struct kstarInOO {
556564
if (!goodEv1 || !goodEv2)
557565
continue;
558566

559-
TrackSlicing(collision1, tracks1, collision2, tracks2, false);
567+
TrackSlicing(collision1, tracks1, collision2, tracks2, true, false);
560568
}
561569
}
562570
PROCESS_SWITCH(kstarInOO, processDataMixedEvent, "process DATA Mixed Event", false);
@@ -586,6 +594,8 @@ struct kstarInOO {
586594

587595
bool INELgt0 = false;
588596
for (const auto& track : tracks) {
597+
if (!trackSelection(track, true))
598+
continue;
589599
if (std::fabs(track.eta()) < cfgTrackMaxEta) {
590600
INELgt0 = true;
591601
}
@@ -596,7 +606,7 @@ struct kstarInOO {
596606
if (cfgMcHistos) {
597607
histos.fill(HIST("nEvents_MC"), 1.5);
598608
}
599-
TrackSlicingMC(collision, tracks, collision, tracks, false);
609+
TrackSlicingMC(collision, tracks, collision, tracks, false, true);
600610
} // processSameEvents_MC
601611
PROCESS_SWITCH(kstarInOO, processSameEventMC, "process Same Event MC", true);
602612

@@ -620,10 +630,11 @@ struct kstarInOO {
620630
}
621631
auto goodEv1 = eventSelection(collision1);
622632
auto goodEv2 = eventSelection(collision2);
623-
if (!goodEv1 || !goodEv2)
633+
if (!goodEv1 || !goodEv2) {
624634
continue;
635+
}
625636

626-
TrackSlicingMC(collision1, tracks1, collision2, tracks2, true);
637+
TrackSlicingMC(collision1, tracks1, collision2, tracks2, true, false);
627638
} // mixing
628639
} // processMixedEvent_MC
629640
PROCESS_SWITCH(kstarInOO, processMixedEventMC, "process Mixed Event MC", false);

0 commit comments

Comments
 (0)