Skip to content

Commit 63c4344

Browse files
authored
Add Kaon correlation support in hResonanceCorrelation
Added support for Kaon correlation and updated related configurations.
1 parent 6122b6b commit 63c4344

1 file changed

Lines changed: 50 additions & 15 deletions

File tree

‎PWGLF/Tasks/Resonances/hResonanceCorrelation.cxx‎

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
#include <memory>
6969
#include <string>
7070
#include <string_view>
71-
#include <variant>
7271
#include <vector>
7372

7473
using namespace o2;
@@ -105,6 +104,7 @@ struct HResonanceCorrelation {
105104
Configurable<bool> doCorrelationPhi{"doCorrelationPhi", false, "do Phi correlation"};
106105
Configurable<bool> doCorrelationKstar{"doCorrelationKstar", false, "do K*0 correlation"};
107106
Configurable<bool> doCorrelationPion{"doCorrelationPion", false, "do Pion correlation"};
107+
Configurable<bool> doCorrelationKaon{"doCorrelationKaon", false, "do Kaon correlation"};
108108
Configurable<bool> doGenEventSelection{"doGenEventSelection", true, "use event selections when performing closure test for the gen events"};
109109
Configurable<bool> selectINELgtZERO{"selectINELgtZERO", true, "select INEL>0 events"};
110110
Configurable<float> zVertexCut{"zVertexCut", 10, "Cut on PV position"};
@@ -284,6 +284,7 @@ struct HResonanceCorrelation {
284284
TH3F* hEfficiencyTriggerMult = nullptr;
285285
THnF* hEfficiencyTriggerMultVsPhi = nullptr;
286286
TH2F* hEfficiencyPion = nullptr;
287+
TH2F* hEfficiencyKaon = nullptr;
287288
TH2F* hEfficiencyPhi = nullptr;
288289
THnF* hEfficiencyPhiMultVsPhi = nullptr;
289290
TH2F* hEfficiencyKstar = nullptr;
@@ -297,6 +298,7 @@ struct HResonanceCorrelation {
297298
TH2F* hEfficiencyUncertaintyTrigger = nullptr;
298299
TH3F* hEfficiencyUncertaintyTriggerMult = nullptr;
299300
TH2F* hEfficiencyUncertaintyPion = nullptr;
301+
TH2F* hEfficiencyUncertaintyKaon = nullptr;
300302
TH2F* hEfficiencyUncertaintyPhi = nullptr;
301303
TH2F* hEfficiencyUncertaintyKstar = nullptr;
302304
TH2F* hEfficiencyUncertaintyHadron = nullptr;
@@ -315,12 +317,22 @@ struct HResonanceCorrelation {
315317
Preslice<aod::AssocPhis> collisionSlicePhis = aod::assocPhis::collisionId;
316318
Preslice<aod::AssocKstars> collisionSliceKstars = aod::assocKstars::collisionId;
317319

318-
static constexpr std::string_view Particlenames[] = {"Phi", "Kstar0", "Pion", "Hadron"};
319-
static constexpr int PdgCodes[] = {333, 313, 211, 0}; // Hadron has no single PDG code; 0 is a harmless placeholder
320+
// Kaon sits after Pion, taking the slot Hadron used to occupy (Hadron
321+
// moves to IndexHadron below) -- same reason Hadron itself sits outside
322+
// AssocParticleTypesNoHadron: the generator-level MC-truth matching used by
323+
// the closure test/prediction blocks further down is "intentionally
324+
// restricted to Pion only" (see the NOTE comments at their static_for<...>
325+
// calls) and was never extended to Kstar0 either, so Kaon joins Hadron
326+
// outside that group rather than shifting Pion's/Kstar0's/Phi's indices or
327+
// AssocParticleTypesNoHadron's boundary.
328+
static constexpr std::string_view Particlenames[] = {"Phi", "Kstar0", "Pion", "Kaon", "Hadron"};
329+
static constexpr int PdgCodes[] = {333, 313, 211, 321, 0}; // Hadron has no single PDG code; 0 is a harmless placeholder
320330

321331
static constexpr int IndexPhi = 0;
322332
static constexpr int IndexKstar = 1;
323333
static constexpr int IndexPion = 2;
334+
static constexpr int IndexKaon = 3;
335+
static constexpr int IndexHadron = 4;
324336

325337
uint16_t doCorrelation = 0;
326338
int mRunNumber = 0;
@@ -333,8 +345,8 @@ struct HResonanceCorrelation {
333345

334346
static constexpr float Neutral = 0.0;
335347

336-
static constexpr int AssocParticleTypes = 4; // Phi, Kstar0, Pion, Hadron
337-
static constexpr int AssocParticleTypesNoHadron = 3; // Phi, Kstar0, Pion
348+
static constexpr int AssocParticleTypes = 5; // Phi, Kstar0, Pion, Kaon, Hadron
349+
static constexpr int AssocParticleTypesNoHadron = 3; // Phi, Kstar0, Pion (Kaon excluded too -- see the comment above IndexKaon)
338350

339351
/// Function to aid in calculating delta-phi
340352
/// \param phi1 first phi value
@@ -387,13 +399,15 @@ struct HResonanceCorrelation {
387399
hEfficiencyHadron = static_cast<TH2F*>(listEfficiencies->FindObject("hEfficiencyHadron"));
388400
hEfficiencyHadronMult = static_cast<TH3F*>(listEfficiencies->FindObject("hEfficiencyHadronMult"));
389401
hEfficiencyPion = static_cast<TH2F*>(listEfficiencies->FindObject("hEfficiencyPion"));
402+
hEfficiencyKaon = static_cast<TH2F*>(listEfficiencies->FindObject("hEfficiencyKaon"));
390403
hPurityHadron = static_cast<TH1F*>(listEfficiencies->FindObject("hPurityHadron"));
391404
hPurityHadronMult = static_cast<TH2F*>(listEfficiencies->FindObject("hPurityHadronMult"));
392405
hEfficiencyUncertaintyTrigger = static_cast<TH2F*>(listEfficiencies->FindObject("hEfficiencyUncertaintyTrigger"));
393406
hEfficiencyUncertaintyTriggerMult = static_cast<TH3F*>(listEfficiencies->FindObject("hEfficiencyUncertaintyTriggerMult"));
394407
hEfficiencyUncertaintyPhi = static_cast<TH2F*>(listEfficiencies->FindObject("hEfficiencyUncertaintyPhi"));
395408
hEfficiencyUncertaintyKstar = static_cast<TH2F*>(listEfficiencies->FindObject("hEfficiencyUncertaintyKstar"));
396409
hEfficiencyUncertaintyPion = static_cast<TH2F*>(listEfficiencies->FindObject("hEfficiencyUncertaintyPion"));
410+
hEfficiencyUncertaintyKaon = static_cast<TH2F*>(listEfficiencies->FindObject("hEfficiencyUncertaintyKaon"));
397411
hEfficiencyUncertaintyHadron = static_cast<TH2F*>(listEfficiencies->FindObject("hEfficiencyUncertaintyHadron"));
398412
hEfficiencyUncertaintyHadronMult = static_cast<TH3F*>(listEfficiencies->FindObject("hEfficiencyUncertaintyHadronMult"));
399413
hPurityUncertaintyHadron = static_cast<TH1F*>(listEfficiencies->FindObject("hPurityUncertaintyHadron"));
@@ -411,10 +425,12 @@ struct HResonanceCorrelation {
411425
mRunNumber = 0;
412426
mRunNumberZorro = 0;
413427
hEfficiencyPion = 0x0;
428+
hEfficiencyKaon = 0x0;
414429
hEfficiencyPhi = 0x0;
415430
hEfficiencyKstar = 0x0;
416431
hEfficiencyUncertaintyTrigger = 0x0;
417432
hEfficiencyUncertaintyPion = 0x0;
433+
hEfficiencyUncertaintyKaon = 0x0;
418434
hEfficiencyUncertaintyPhi = 0x0;
419435
hEfficiencyUncertaintyKstar = 0x0;
420436

@@ -431,8 +447,10 @@ struct HResonanceCorrelation {
431447
SETBIT(doCorrelation, IndexKstar);
432448
if (masterConfigurations.doCorrelationPion)
433449
SETBIT(doCorrelation, IndexPion);
450+
if (masterConfigurations.doCorrelationKaon)
451+
SETBIT(doCorrelation, IndexKaon);
434452
if (masterConfigurations.doCorrelationHadron)
435-
SETBIT(doCorrelation, 3);
453+
SETBIT(doCorrelation, IndexHadron);
436454

437455
// Store axis ranges to prevent spurious filling
438456
// axis status:
@@ -623,8 +641,8 @@ struct HResonanceCorrelation {
623641
// ========================================================================
624642
// SHARED QA HISTOGRAMS
625643
// ========================================================================
626-
bool anySameEvent = doprocessSameEventHPhis || doprocessSameEventHKstars || doprocessSameEventHPions || doprocessSameEventHHadrons;
627-
bool anyMixedEvent = doprocessMixedEventHPhis || doprocessMixedEventHPhisInBuffer || doprocessMixedEventHKstars || doprocessMixedEventHKstarsInBuffer || doprocessMixedEventHPions || doprocessMixedEventHHadrons;
644+
bool anySameEvent = doprocessSameEventHPhis || doprocessSameEventHKstars || doprocessSameEventHPions || doprocessSameEventHKaons || doprocessSameEventHHadrons;
645+
bool anyMixedEvent = doprocessMixedEventHPhis || doprocessMixedEventHPhisInBuffer || doprocessMixedEventHKstars || doprocessMixedEventHKstarsInBuffer || doprocessMixedEventHPions || doprocessMixedEventHKaons || doprocessMixedEventHHadrons;
628646

629647
if (doMixingQAandEventQA && (anySameEvent || anyMixedEvent)) {
630648
if (anySameEvent)
@@ -669,6 +687,9 @@ struct HResonanceCorrelation {
669687
} else if (i == IndexPion) { // Pion
670688
doSE = doprocessSameEventHPions;
671689
doME = doprocessMixedEventHPions;
690+
} else if (i == IndexKaon) { // Kaon
691+
doSE = doprocessSameEventHKaons;
692+
doME = doprocessMixedEventHKaons;
672693
} else { // Hadron
673694
doSE = doprocessSameEventHHadrons;
674695
doME = doprocessMixedEventHHadrons;
@@ -772,7 +793,18 @@ struct HResonanceCorrelation {
772793
histos.add("hNegativePionEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult});
773794
}
774795

775-
if (TESTBIT(doCorrelation, 3) && doprocessSameEventHHadrons) {
796+
if (TESTBIT(doCorrelation, IndexKaon) && doprocessSameEventHKaons) {
797+
if (masterConfigurations.doFullCorrelationStudy) {
798+
histos.add("sameEvent/TriggerParticlesKaon", "TriggersKaon", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult});
799+
}
800+
histos.add("hNumberOfRejectedPairsKaon", "hNumberOfRejectedPairsKaon", kTH1F, {{1, 0, 1}});
801+
histos.add("hKaonEtaVsPtAllSelected", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult});
802+
histos.add("hKaonEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult});
803+
histos.add("hPositiveKaonEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult});
804+
histos.add("hNegativeKaonEtaVsPt", "", kTH3F, {axesConfigurations.axisPtQA, axesConfigurations.axisEta, axesConfigurations.axisMult});
805+
}
806+
807+
if (TESTBIT(doCorrelation, IndexHadron) && doprocessSameEventHHadrons) {
776808
if (masterConfigurations.doFullCorrelationStudy) {
777809
histos.add("sameEvent/TriggerParticlesHadron", "TriggersHadron", kTH2F, {axesConfigurations.axisPtQA, axesConfigurations.axisMult});
778810
}
@@ -933,7 +965,7 @@ struct HResonanceCorrelation {
933965

934966
// event selections in Pb-Pb
935967
template <typename TCollision>
936-
bool isisCollisionSelectPbPb(TCollision collision, bool fillHists)
968+
bool isisCollisionSelectPbPb(TCollision const& collision, bool fillHists)
937969
{
938970
if (fillHists)
939971
histos.fill(HIST("hEventSelection"), 0.5 /* all collisions */);
@@ -1012,7 +1044,7 @@ struct HResonanceCorrelation {
10121044
}
10131045

10141046
template <class TTrack>
1015-
bool isValidTrigger(TTrack track, bool isLeading)
1047+
bool isValidTrigger(TTrack const& track, bool isLeading)
10161048
{
10171049
if (track.tpcNClsCrossedRows() < trackSelection.minTPCNCrossedRowsTrigger) {
10181050
return false; // crossed rows
@@ -1049,7 +1081,7 @@ struct HResonanceCorrelation {
10491081
return true;
10501082
}
10511083
template <class TTrack>
1052-
bool isValidAssocHadron(TTrack track)
1084+
bool isValidAssocHadron(TTrack const& track)
10531085
{
10541086
if (track.tpcNClsCrossedRows() < trackSelection.minTPCNCrossedRowsAssociated) {
10551087
return false; // crossed rows
@@ -1086,14 +1118,17 @@ struct HResonanceCorrelation {
10861118
double phaseProton = (-0.3 * B * assoc[2]) / (2 * assoc[1]);
10871119
double phaseTrack = (-0.3 * B * trigg[2]) / (2 * trigg[1]);
10881120

1089-
for (double r = MinRadiusTPC; r <= MaxRadiusTPC; r += 0.05) {
1121+
constexpr double kRadiusStep = 0.05;
1122+
int nSteps = static_cast<int>((MaxRadiusTPC - MinRadiusTPC) / kRadiusStep);
1123+
for (int iR = 0; iR <= nSteps; ++iR) {
1124+
double r = MinRadiusTPC + iR * kRadiusStep;
10901125
dPhiStar = dPhi + std::asin(phaseProton * r) - std::asin(phaseTrack * r);
10911126
dPhiStarMean += (dPhiStar / 34);
10921127
}
10931128

10941129
return dPhiStarMean;
10951130
}
1096-
void fillTriggerHistogram(std::shared_ptr<TH2> hist, double pt, double mult, float eff, float effUncert, float purity, float purityErr)
1131+
void fillTriggerHistogram(std::shared_ptr<TH2> const& hist, double pt, double mult, float eff, float effUncert, float purity, float purityErr)
10971132
{
10981133
int binx = hist->GetXaxis()->FindBin(pt);
10991134
int biny = hist->GetYaxis()->FindBin(mult);
@@ -1104,7 +1139,7 @@ struct HResonanceCorrelation {
11041139
hist->SetBinContent(binx, biny, newContent);
11051140
hist->SetBinError(binx, biny, newUncert);
11061141
}
1107-
void fillCorrelationHistogram(std::shared_ptr<THn> hist, double binFillThn[], float etaWeight, float efficiency, float totalEffUncert, float purity, float totalPurityUncert)
1142+
void fillCorrelationHistogram(std::shared_ptr<THn> const& hist, double binFillThn[], float etaWeight, float efficiency, float totalEffUncert, float purity, float totalPurityUncert)
11081143
{
11091144
float previousContent, previousError2, currentContent, currentError2;
11101145
int bin = hist->GetBin(binFillThn);

0 commit comments

Comments
 (0)