Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 34 additions & 13 deletions PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@

std::vector<std::vector<float>> axisRanges;

const float ctauxiPDG = 4.91; // from PDG

Check failure on line 265 in PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
const float ctauomegaPDG = 2.461; // from PDG

Check failure on line 266 in PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.

/// Function to aid in calculating delta-phi
/// \param phi1 first phi value
Expand Down Expand Up @@ -524,9 +524,9 @@
return false;
// dcacascdaughters
float ptDepCut = systCuts.dcaCacsDauPar0;
if (casc.pt() > 1 && casc.pt() < 4)

Check failure on line 527 in PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
ptDepCut = systCuts.dcaCacsDauPar1;
else if (casc.pt() > 4)

Check failure on line 529 in PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
ptDepCut = systCuts.dcaCacsDauPar2;
if (casc.dcacascdaughters() > ptDepCut)
return false;
Expand Down Expand Up @@ -559,21 +559,21 @@
double phaseProton = (-0.3 * B * assoc[2]) / (2 * assoc[1]);
double phaseTrack = (-0.3 * B * trigg[2]) / (2 * trigg[1]);

for (double r = 0.8; r <= 2.5; r += 0.05) {

Check failure on line 562 in PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
dPhiStar = dPhi + std::asin(phaseProton * r) - std::asin(phaseTrack * r);
dPhiStarMean += (dPhiStar / 34);
}

return dPhiStarMean;
}
void fillTriggerHistogram(std::shared_ptr<TH2> hist, double pt, double mult, float eff, float effUncert)
void fillTriggerHistogram(std::shared_ptr<TH2> hist, double pt, double mult, float eff, float effUncert, float purity, float purityErr)
{
int binx = hist->GetXaxis()->FindBin(pt);
int biny = hist->GetYaxis()->FindBin(mult);
float previousContent = hist->GetBinContent(binx, biny);
float previousUncert = hist->GetBinError(binx, biny);
float newContent = previousContent + 1 / eff;
float newUncert = std::sqrt(previousUncert * previousUncert + 1 / std::pow(eff, 2) + std::pow(effUncert, 2) / std::pow(eff, 4));
float newContent = previousContent + purity / eff;
float newUncert = std::sqrt(previousUncert * previousUncert + std::pow(purity / eff, 2) + std::pow(purityErr / eff, 2) + std::pow(effUncert, 2) / std::pow(eff, 4));
hist->SetBinContent(binx, biny, newContent);
hist->SetBinError(binx, biny, newUncert);
}
Expand All @@ -600,16 +600,23 @@
if (!mixing) {
float efficiency = 1.0f;
float efficiencyError = 0.0f;
float purity = 1.0f;
float purityErr = 0.0;
if (efficiencyFlags.applyEfficiencyForTrigger) {
efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta());
if (efficiencyFlags.applyEfficiencyPropagation)
if (efficiencyFlags.applyPurityTrigger)
purity = hPurityHadron->Interpolate(trigg.pt());
if (efficiencyFlags.applyEfficiencyPropagation) {
efficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta());
if (efficiencyFlags.applyPurityTrigger)
purityErr = hPurityHadron->Interpolate(trigg.pt());
}
if (efficiency == 0) { // check for zero efficiency, do not apply if the case
efficiency = 1;
efficiencyError = 0;
}
}
fillTriggerHistogram(histos.get<TH2>(HIST("sameEvent/TriggerParticlesV0")), trigg.pt(), mult, efficiency, efficiencyError);
fillTriggerHistogram(histos.get<TH2>(HIST("sameEvent/TriggerParticlesV0")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityErr);
}

double triggSign = trigg.sign();
Expand Down Expand Up @@ -727,7 +734,7 @@
if (doDeltaPhiStarCheck) {
double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField);
double deltaPhiStarPion = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStarPion, bField);
if ((Index == 0 && triggSign > 0) || (Index == 1 && triggSign > 0) || (Index == 2 && triggSign < 0)) {

Check failure on line 737 in PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("sameEvent/LeftBg/") + HIST(kV0names[Index]) + HIST("DeltaPhiStar"), deltaPhiStar, trigg.eta() - etaProton, 0.5);
if (Index == 0) {
histos.fill(HIST("sameEvent/LeftBg/") + HIST(kV0names[Index]) + HIST("DeltaPhiStar"), deltaPhiStarPion, trigg.eta() - etaPion, -0.5);
Expand All @@ -742,18 +749,18 @@
}
if (assocCandidate.compatible(Index, systCuts.dEdxCompatibility) && (!doMCassociation || assocCandidate.mcTrue(Index)) && (!doAssocPhysicalPrimary || assocCandidate.mcPhysicalPrimary()) && !mixing && -massWindowConfigurations.maxPeakNSigma < assocCandidate.invMassNSigma(Index) && assocCandidate.invMassNSigma(Index) < +massWindowConfigurations.maxPeakNSigma) {
fillCorrelationHistogram(histos.get<THn>(HIST("sameEvent/Signal/") + HIST(kV0names[Index])), binFillThn, etaWeight, efficiency * efficiencytrigg, totalEffUncert, 1.0f, 0.0f);
if (std::abs(deltaphi) < 0.8 && doITSClustersQA) {

Check failure on line 752 in PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("hITSClusters") + HIST(kV0names[Index]) + HIST("NegativeDaughterToward"), ptassoc, negtrack.itsNCls(), assoc.v0radius());
histos.fill(HIST("hITSClusters") + HIST(kV0names[Index]) + HIST("PositiveDaughterToward"), ptassoc, postrack.itsNCls(), assoc.v0radius());
}
if (std::abs(deltaphi) > 1 && std::abs(deltaphi) < 2 && doITSClustersQA) {

Check failure on line 756 in PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("hITSClusters") + HIST(kV0names[Index]) + HIST("NegativeDaughterTransverse"), ptassoc, negtrack.itsNCls(), assoc.v0radius());
histos.fill(HIST("hITSClusters") + HIST(kV0names[Index]) + HIST("PositiveDaughterTransverse"), ptassoc, postrack.itsNCls(), assoc.v0radius());
}
if (doDeltaPhiStarCheck) {
double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField);
double deltaPhiStarPion = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStarPion, bField);
if ((Index == 0 && triggSign > 0) || (Index == 1 && triggSign > 0) || (Index == 2 && triggSign < 0)) {

Check failure on line 763 in PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("sameEvent/Signal/") + HIST(kV0names[Index]) + HIST("DeltaPhiStar"), deltaPhiStar, trigg.eta() - etaProton, 0.5);
if (Index == 0) {
histos.fill(HIST("sameEvent/Signal/") + HIST(kV0names[Index]) + HIST("DeltaPhiStar"), deltaPhiStarPion, trigg.eta() - etaPion, -0.5);
Expand All @@ -771,7 +778,7 @@
if (doDeltaPhiStarCheck) {
double deltaPhiStar = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStar, bField);
double deltaPhiStarPion = calculateAverageDeltaPhiStar(triggForDeltaPhiStar, assocForDeltaPhiStarPion, bField);
if ((Index == 0 && triggSign > 0) || (Index == 1 && triggSign > 0) || (Index == 2 && triggSign < 0)) {

Check failure on line 781 in PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("sameEvent/RightBg/") + HIST(kV0names[Index]) + HIST("DeltaPhiStar"), deltaPhiStar, trigg.eta() - etaProton, 0.5);
if (Index == 0) {
histos.fill(HIST("sameEvent/RightBg/") + HIST(kV0names[Index]) + HIST("DeltaPhiStar"), deltaPhiStarPion, trigg.eta() - etaPion, -0.5);
Expand Down Expand Up @@ -808,16 +815,23 @@
if (!mixing) {
float efficiency = 1.0f;
float efficiencyError = 0.0f;
float purity = 1.0f;
float purityErr = 0.0f;
if (efficiencyFlags.applyEfficiencyForTrigger) {
efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta());
if (efficiencyFlags.applyEfficiencyPropagation)
if (efficiencyFlags.applyPurityTrigger)
purity = hPurityHadron->Interpolate(trigg.pt());
if (efficiencyFlags.applyEfficiencyPropagation) {
efficiencyError = hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta());
if (efficiencyFlags.applyPurityTrigger)
purityErr = hPurityUncertaintyHadron->Interpolate(trigg.pt());
}
if (efficiency == 0) { // check for zero efficiency, do not apply if the case
efficiency = 1;
efficiencyError = 0;
}
}
fillTriggerHistogram(histos.get<TH2>(HIST("sameEvent/TriggerParticlesCascade")), trigg.pt(), mult, efficiency, efficiencyError);
fillTriggerHistogram(histos.get<TH2>(HIST("sameEvent/TriggerParticlesCascade")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityErr);
}
double triggSign = trigg.sign();
double triggForDeltaPhiStar[] = {trigg.phi(), trigg.pt(), triggSign};
Expand Down Expand Up @@ -985,19 +999,26 @@
if (!mixing) {
float efficiency = 1.0f;
float efficiencyError = 0.0f;
float purity = 1.0f;
float purityError = 0.0f;
if (efficiencyFlags.applyEfficiencyForTrigger) {
efficiency = hEfficiencyTrigger->Interpolate(trigg.pt(), trigg.eta());
if (efficiencyFlags.applyEfficiencyPropagation)
if (efficiencyFlags.applyPurityTrigger)
purity = hPurityHadron->Interpolate(trigg.pt());
if (efficiencyFlags.applyEfficiencyPropagation) {
hEfficiencyUncertaintyTrigger->Interpolate(trigg.pt(), trigg.eta());
if (efficiencyFlags.applyPurityTrigger)
purityError = hPurityUncertaintyHadron->Interpolate(trigg.pt());
}
if (efficiency == 0) { // check for zero efficiency, do not apply if the case
efficiency = 1;
efficiencyError = 0;
}
}
if constexpr (requires { triggerTrack.extra(); })
fillTriggerHistogram(histos.get<TH2>(HIST("sameEvent/TriggerParticlesPion")), trigg.pt(), mult, efficiency, efficiencyError);
fillTriggerHistogram(histos.get<TH2>(HIST("sameEvent/TriggerParticlesPion")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityError);
else
fillTriggerHistogram(histos.get<TH2>(HIST("sameEvent/TriggerParticlesHadron")), trigg.pt(), mult, efficiency, efficiencyError);
fillTriggerHistogram(histos.get<TH2>(HIST("sameEvent/TriggerParticlesHadron")), trigg.pt(), mult, efficiency, efficiencyError, purity, purityError);
}
double triggSign = trigg.sign();
double triggForDeltaPhiStar[] = {trigg.phi(), trigg.pt(), triggSign};
Expand Down Expand Up @@ -1073,9 +1094,9 @@
if (efficiencyFlags.applyPurityTrigger)
purityTrigger = hPurityHadron->Interpolate(pttrigger);
if (efficiencyFlags.applyEfficiencyPropagation) {
triggerEfficiencyUncert = hEfficiencyUncertaintyTrigger->Interpolate(ptassoc, assoc.eta());
triggerEfficiencyUncert = hEfficiencyUncertaintyTrigger->Interpolate(pttrigger, trigg.eta());
if (efficiencyFlags.applyPurityTrigger)
triggerPurityUncertainty = hPurityUncertaintyHadron->Interpolate(ptassoc);
triggerPurityUncertainty = hPurityUncertaintyHadron->Interpolate(pttrigger);
}
}
if (efficiency == 0) { // check for zero efficiency, do not apply if the case
Expand Down Expand Up @@ -2449,7 +2470,7 @@
histos.fill(HIST("ClosureTest/hTrigger"), gpt, geta, bestCollisionFT0Mpercentile);
if (doCorrelationHadron) {
assocHadronIndices.emplace_back(iteratorNum);
histos.fill(HIST("ClosureTest/hHadron"), gpt, geta, bestCollisionFT0Mpercentile);
histos.fill(HIST("ClosureTest/hHadron"), gpt, geta, gphi);
}
}
}
Expand Down
Loading