Skip to content

Commit 32984cf

Browse files
authored
[PWGUD] Applying NUA correction and adding nMax option (#12932)
1 parent 6b8100a commit 32984cf

File tree

1 file changed

+86
-35
lines changed

1 file changed

+86
-35
lines changed

PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx

Lines changed: 86 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,18 @@ struct UpcPhotonuclearAnalysisJMG {
139139
Configurable<float> cutMyTPCChi2NclMax{"cutMyTPCChi2NclMax", 4.f, {"My Track cut"}};
140140
Configurable<float> myWeightMin{"myWeightMin", 0.2f, {"My Track cut"}};
141141
Configurable<float> myWeightMax{"myWeightMax", 5.f, {"My Track cut"}};
142-
Configurable<float> myEpsilonToWeight{"myEpsilonToWeight", 1e-6f, {"My Track cut"}};
143-
Configurable<bool> useEpsilon{"useEpsilon", false, {"My Track cut"}};
142+
Configurable<float> myEpsilonToWeight{"myEpsilonToWeight", 1e-6f, {"NUA correction"}};
143+
Configurable<bool> useEpsilon{"useEpsilon", false, {"NUA correction"}};
144+
Configurable<bool> useNMax{"useNMax", true, {"NUA correction"}};
144145
Configurable<LabeledArray<float>> cfgPairCut{"cfgPairCut",
145146
{CFGPairCutDefaults[0],
146147
5,
147148
{"Photon", "K0", "Lambda", "Phi", "Rho"}},
148149
"Pair cuts on various particles"};
149150
Configurable<float> cfgTwoTrackCut{"cfgTwoTrackCut", -1, {"Two track cut"}};
150-
ConfigurableAxis axisVertex{"axisVertex", {10, -10, 10}, "vertex axis for histograms"};
151+
ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"};
151152
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, kThreeHalfPi}, "delta phi axis for histograms"};
152-
ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -2, 2}, "delta eta axis for histograms"};
153+
ConfigurableAxis axisDeltaEta{"axisDeltaEta", {32, -1.6, 1.6}, "delta eta axis for histograms"};
153154
ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"};
154155
ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pt associated axis for histograms"};
155156
ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100, 110.1}, "multiplicity / multiplicity axis for histograms"};
@@ -417,7 +418,6 @@ struct UpcPhotonuclearAnalysisJMG {
417418
continue;
418419
}
419420
float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f);
420-
421421
histos.fill(HIST("yields"), multiplicity, track.pt(), eta(track.px(), track.py(), track.pz()));
422422
histos.fill(HIST("etaphi"), multiplicity, eta(track.px(), track.py(), track.pz()), phiVal);
423423
}
@@ -431,32 +431,6 @@ struct UpcPhotonuclearAnalysisJMG {
431431
return true;
432432
}
433433

434-
template <typename TTarget, typename TTracks>
435-
void fillCorrelationsUD(TTarget target, const TTracks tracks1, const TTracks tracks2, float multiplicity, float posZ)
436-
{
437-
multiplicity = tracks1.size();
438-
for (const auto& track1 : tracks1) {
439-
if (isTrackCut(track1) == false) {
440-
return;
441-
}
442-
target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, track1.pt(), multiplicity, posZ, 1.0);
443-
for (const auto& track2 : tracks2) {
444-
if (track1 == track2) {
445-
continue;
446-
}
447-
if (isTrackCut(track2) == false) {
448-
return;
449-
}
450-
/*if (doPairCuts && mPairCuts.conversionCuts(track1, track2)) {
451-
continue;
452-
}*/
453-
float deltaPhi = phi(track1.px(), track1.py()) - phi(track2.px(), track2.py());
454-
deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf);
455-
target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, eta(track1.px(), track1.py(), track1.pz()) - eta(track2.px(), track2.py(), track2.pz()), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, 1.0);
456-
}
457-
}
458-
}
459-
460434
void makeNUAWeights(std::shared_ptr<TH3> histoRaw3D)
461435
{
462436
const int nPhi = histoRaw3D->GetZaxis()->GetNbins();
@@ -466,12 +440,23 @@ struct UpcPhotonuclearAnalysisJMG {
466440
for (int jEtha = 1; jEtha <= nEta; ++jEtha) {
467441
for (int iVtxZ = 1; iVtxZ <= nVz; ++iVtxZ) {
468442
// average on phi to (eta_jEtha, vz_iVtxZ)
469-
double sum = 0, count = 0;
443+
double sum = 0.0;
444+
double nMax = 0.0;
445+
int count = 0;
470446
for (int kPhi = 1; kPhi <= nPhi; ++kPhi) {
471-
sum += histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi);
447+
double nEntry = histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi);
448+
sum += nEntry;
472449
count += 1.0;
450+
if (nEntry > nMax) {
451+
nMax = nEntry;
452+
}
453+
}
454+
double nMean;
455+
if (useNMax) {
456+
nMean = nMax;
457+
} else {
458+
nMean = (count > 0) ? sum / count : 0.0;
473459
}
474-
const double nMean = (count > 0) ? sum / count : 0.0;
475460

476461
for (int kPhi = 1; kPhi <= nPhi; ++kPhi) {
477462
double nEntry = histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi);
@@ -511,6 +496,51 @@ struct UpcPhotonuclearAnalysisJMG {
511496
return hWeight->GetBinContent(iVz, iEta, iPhi);
512497
}
513498

499+
template <typename TTarget, typename TTracks>
500+
void fillCorrelationsUD(TTarget target, const TTracks tracks1, const TTracks tracks2, float multiplicity, float posZ)
501+
{
502+
// multiplicity = tracks1.size();
503+
for (const auto& track1 : tracks1) {
504+
if (isTrackCut(track1) == false) {
505+
return;
506+
}
507+
// weight NUA for track1
508+
float phi1 = phi(track1.px(), track1.py());
509+
phi1 = RecoDecay::constrainAngle(phi1, 0.f);
510+
float eta1 = eta(track1.px(), track1.py(), track1.pz());
511+
float w1 = getNUAWeight(posZ, eta1, phi1);
512+
target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, track1.pt(), multiplicity, posZ, 1.0);
513+
for (const auto& track2 : tracks2) {
514+
if (track1 == track2) {
515+
continue;
516+
}
517+
if (isTrackCut(track2) == false) {
518+
return;
519+
}
520+
// weight NUA for track 2
521+
float phi2 = phi(track2.px(), track2.py());
522+
phi2 = RecoDecay::constrainAngle(phi2, 0.f);
523+
float eta2 = eta(track2.px(), track2.py(), track2.pz());
524+
float w2 = getNUAWeight(posZ, eta2, phi2);
525+
// total weight
526+
float wPair = w1 * w2;
527+
/*if (doPairCuts && mPairCuts.conversionCuts(track1, track2)) {
528+
continue;
529+
}*/
530+
float deltaPhi = phi1 - phi2;
531+
float deltaEta = eta1 - eta2;
532+
deltaPhi = RecoDecay::constrainAngle(deltaPhi, -PIHalf);
533+
target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed,
534+
deltaEta,
535+
track2.pt(), track1.pt(),
536+
multiplicity,
537+
deltaPhi,
538+
posZ,
539+
wPair);
540+
}
541+
}
542+
}
543+
514544
void processSG(FullSGUDCollision::iterator const& reconstructedCollision, FullUDTracks const& reconstructedTracks)
515545
{
516546
histos.fill(HIST("Events/hCountCollisions"), 0);
@@ -777,6 +807,27 @@ struct UpcPhotonuclearAnalysisJMG {
777807
if (isCollisionCutSG(reconstructedCollision) == false) {
778808
return;
779809
}
810+
811+
// Configure track flow histogram labels
812+
auto hFlow = histos.get<TH1>(HIST("Tracks/hTracksAfterCuts"));
813+
hFlow->GetXaxis()->SetBinLabel(1, "All tracks");
814+
hFlow->GetXaxis()->SetBinLabel(2, "Track sign");
815+
hFlow->GetXaxis()->SetBinLabel(3, "p_{T} range");
816+
hFlow->GetXaxis()->SetBinLabel(4, "#eta range");
817+
hFlow->GetXaxis()->SetBinLabel(5, "dcaZ");
818+
hFlow->GetXaxis()->SetBinLabel(6, "dcaXY");
819+
hFlow->GetXaxis()->SetBinLabel(7, "PV contrib cut");
820+
hFlow->GetXaxis()->SetBinLabel(8, "has ITS cut");
821+
hFlow->GetXaxis()->SetBinLabel(9, "N clusters ITS cut");
822+
hFlow->GetXaxis()->SetBinLabel(10, "#chi^{2} N cluster ITS cut");
823+
hFlow->GetXaxis()->SetBinLabel(11, "has TPC cut");
824+
hFlow->GetXaxis()->SetBinLabel(12, "N clusters crossed row TPC cut");
825+
hFlow->GetXaxis()->SetBinLabel(13, "(N cluster findable - N cluster minus findable) TPC cut");
826+
hFlow->GetXaxis()->SetBinLabel(14, "N cluster findable TPC cut");
827+
hFlow->GetXaxis()->SetBinLabel(15, "(N cluster crossed row / N cluster findable) TPC cut");
828+
hFlow->GetXaxis()->SetBinLabel(16, "(N cluster findable - N cluster minus findable) / N cluster findable cut");
829+
hFlow->GetXaxis()->SetBinLabel(17, "#chi^{2} N cluster TPC cut");
830+
780831
for (const auto& track : reconstructedTracks) {
781832
histos.fill(HIST("Tracks/hTracksAfterCuts"), 0);
782833
if (track.sign() != 1 && track.sign() != -1) {
@@ -881,7 +932,7 @@ struct UpcPhotonuclearAnalysisJMG {
881932
if (fillCollisionUD(sameGapSideA, multiplicity) == false) {
882933
return;
883934
}
884-
// LOGF(debug, "Filling sameGapSideA events");
935+
LOGF(info, "Filling sameGapSideA events");
885936
histos.fill(HIST("eventcount"), -2);
886937
fillQAUD(reconstructedTracks);
887938
fillCorrelationsUD(sameGapSideA, reconstructedTracks, reconstructedTracks, multiplicity, reconstructedCollision.posZ());

0 commit comments

Comments
 (0)