Skip to content

Commit 8341cc5

Browse files
committed
taking off the NUA correction and adding new histos for correlation
1 parent 2bf6a27 commit 8341cc5

File tree

1 file changed

+62
-90
lines changed

1 file changed

+62
-90
lines changed

PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx

Lines changed: 62 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ struct UpcPhotonuclearAnalysisJMG {
149149
"Pair cuts on various particles"};
150150
Configurable<float> cfgTwoTrackCut{"cfgTwoTrackCut", -1, {"Two track cut"}};
151151
ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"};
152-
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, kThreeHalfPi}, "delta phi axis for histograms"};
152+
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {32, -PIHalf, kThreeHalfPi}, "delta phi axis for histograms"};
153153
ConfigurableAxis axisDeltaEta{"axisDeltaEta", {32, -1.6, 1.6}, "delta eta axis for histograms"};
154154
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"};
155155
ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0}, "pt associated axis for histograms"};
@@ -198,7 +198,18 @@ struct UpcPhotonuclearAnalysisJMG {
198198
histos.add("yields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{100, 0, 100, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}});
199199
histos.add("etaphi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{100, 0, 100, "multiplicity"}, {100, -2, 2, "#eta"}, {64, 0., TwoPI, "#varphi"}}});
200200
histos.add("etaphiVtx", "vertex Z vs eta vs phi", {HistType::kTH3F, {{20, -10., 10., "vertex Z"}, {32, -0.8, 0.8, "#eta"}, {64, 0., TwoPI, "#varphi"}}});
201-
histos.add("weightNUA", "weight per bin", {HistType::kTH3F, {{20, -10., 10., "vertex Z"}, {32, -0.8, 0.8, "#eta"}, {64, 0., TwoPI, "#varphi"}}});
201+
histos.add("sameEvent2D", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
202+
histos.add("sameEvent_2_10", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
203+
histos.add("sameEvent_11_20", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
204+
histos.add("sameEvent_21_30", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
205+
histos.add("sameEvent_31_40", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
206+
histos.add("sameEvent_41_50", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
207+
histos.add("mixedEvent2D", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
208+
histos.add("mixedEvent_2_10", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
209+
histos.add("mixedEvent_11_20", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
210+
histos.add("mixedEvent_21_30", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
211+
histos.add("mixedEvent_31_40", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
212+
histos.add("mixedEvent_41_50", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
202213

203214
const int maxMixBin = axisMultiplicity->size() * axisVertex->size();
204215
histos.add("eventcount", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}});
@@ -215,8 +226,6 @@ struct UpcPhotonuclearAnalysisJMG {
215226
histos.add("Events/hCountCollisions", "0 total - 1 side A - 2 side C - 3 both side; Number of analysed collision; counts", kTH1F, {axisCollision});
216227
histos.add("Events/hCountCollisionsMixed", "0 total - 1 side A - 2 side C - 3 both side; Number of analysed collision; counts", kTH1F, {axisCollision});
217228
histos.add("Tracks/hTracksAfterCuts", " ; ; counts", kTH1F, {axisCountTracks});
218-
histos.add("Tracks/hTrackPhiBeforeCorr", "#it{#phi} distribution before NUA correction; #it{#phi}; counts", kTH1F, {axisPhi});
219-
histos.add("Tracks/hTrackPhiAfterCorr", "#it{#phi} distribution after NUA correction; #it{#phi}; counts", kTH1F, {axisPhi});
220229

221230
// histos to selection gap in side A
222231
histos.add("Tracks/SGsideA/hTrackPt", "#it{p_{T}} distribution; #it{p_{T}}; counts", kTH1F, {axisPt});
@@ -298,11 +307,15 @@ struct UpcPhotonuclearAnalysisJMG {
298307
// mixedGapSideA.setObject(new CorrelationContainer("mixedEventGapSideA", "mixedEventGapSideA", corrAxis, effAxis, {}));
299308
// sameGapSideC.setObject(new CorrelationContainer("sameEventGapSideC", "sameEventGapSideC", corrAxis, effAxis, {}));
300309
// mixedGapSideC.setObject(new CorrelationContainer("mixedEventGapSideC", "mixedEventGapSideC", corrAxis, effAxis, {}));
310+
301311
}
302312

303313
std::vector<double> vtxBinsEdges{VARIABLE_WIDTH, -10.0f, -7.0f, -5.0f, -2.5f, 0.0f, 2.5f, 5.0f, 7.0f, 10.0f};
304314
std::vector<double> gapSideBinsEdges{VARIABLE_WIDTH, -0.5, 0.5, 1.5};
305315

316+
struct SameEventTag {};
317+
struct MixedEventTag {};
318+
306319
SliceCache cache;
307320
// int countEvents = 0;
308321
// int countGapA = 0;
@@ -431,84 +444,16 @@ struct UpcPhotonuclearAnalysisJMG {
431444
return true;
432445
}
433446

434-
void makeNUAWeights(std::shared_ptr<TH3> histoRaw3D)
435-
{
436-
const int nPhi = histoRaw3D->GetZaxis()->GetNbins();
437-
const int nEta = histoRaw3D->GetYaxis()->GetNbins();
438-
const int nVz = histoRaw3D->GetXaxis()->GetNbins();
439-
440-
for (int jEtha = 1; jEtha <= nEta; ++jEtha) {
441-
for (int iVtxZ = 1; iVtxZ <= nVz; ++iVtxZ) {
442-
// average on phi to (eta_jEtha, vz_iVtxZ)
443-
double sum = 0.0;
444-
double nMax = 0.0;
445-
int count = 0;
446-
for (int kPhi = 1; kPhi <= nPhi; ++kPhi) {
447-
double nEntry = histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi);
448-
sum += nEntry;
449-
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;
459-
}
460-
461-
for (int kPhi = 1; kPhi <= nPhi; ++kPhi) {
462-
double nEntry = histoRaw3D->GetBinContent(iVtxZ, jEtha, kPhi);
463-
double w;
464-
if (useEpsilon) {
465-
if (nMean > 0) {
466-
w = nMean / std::max(nEntry, static_cast<double>(myEpsilonToWeight));
467-
} else {
468-
w = 1.0;
469-
}
470-
} else {
471-
if (nMean > 0) {
472-
w = nMean / nEntry;
473-
} else {
474-
w = 1.0;
475-
}
476-
}
477-
if (w < myWeightMin)
478-
w = myWeightMin;
479-
if (w > myWeightMax)
480-
w = myWeightMax;
481-
if (auto histoWeightNUA = histos.get<TH3>(HIST("weightNUA"))) {
482-
histoWeightNUA->SetBinContent(iVtxZ, jEtha, kPhi, w);
483-
}
484-
}
485-
}
486-
}
487-
}
488-
489-
float getNUAWeight(float vz, float eta, float phi)
490-
{
491-
auto hWeight = histos.get<TH3>(HIST("weightNUA"));
492-
phi = RecoDecay::constrainAngle(phi, 0.f);
493-
int iPhi = hWeight->GetZaxis()->FindBin(phi);
494-
int iEta = hWeight->GetYaxis()->FindBin(eta);
495-
int iVz = hWeight->GetXaxis()->FindBin(vz);
496-
return hWeight->GetBinContent(iVz, iEta, iPhi);
497-
}
498-
499-
template <typename TTarget, typename TTracks>
500-
void fillCorrelationsUD(TTarget target, const TTracks tracks1, const TTracks tracks2, float multiplicity, float posZ)
447+
template <typename TTarget, typename TTracks, typename TTag>
448+
void fillCorrelationsUD(TTarget target, const TTracks& tracks1, const TTracks& tracks2, float multiplicity, float posZ, TTag)
501449
{
502-
// multiplicity = tracks1.size();
503450
for (const auto& track1 : tracks1) {
504451
if (isTrackCut(track1) == false) {
505452
return;
506453
}
507-
// weight NUA for track1
508454
float phi1 = phi(track1.px(), track1.py());
509455
phi1 = RecoDecay::constrainAngle(phi1, 0.f);
510456
float eta1 = eta(track1.px(), track1.py(), track1.pz());
511-
float w1 = getNUAWeight(posZ, eta1, phi1);
512457
target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, track1.pt(), multiplicity, posZ, 1.0);
513458
for (const auto& track2 : tracks2) {
514459
if (track1 == track2) {
@@ -517,13 +462,9 @@ struct UpcPhotonuclearAnalysisJMG {
517462
if (isTrackCut(track2) == false) {
518463
return;
519464
}
520-
// weight NUA for track 2
521465
float phi2 = phi(track2.px(), track2.py());
522466
phi2 = RecoDecay::constrainAngle(phi2, 0.f);
523467
float eta2 = eta(track2.px(), track2.py(), track2.pz());
524-
float w2 = getNUAWeight(posZ, eta2, phi2);
525-
// total weight
526-
float wPair = w1 * w2;
527468
/*if (doPairCuts && mPairCuts.conversionCuts(track1, track2)) {
528469
continue;
529470
}*/
@@ -535,8 +476,47 @@ struct UpcPhotonuclearAnalysisJMG {
535476
track2.pt(), track1.pt(),
536477
multiplicity,
537478
deltaPhi,
538-
posZ,
539-
wPair);
479+
posZ);
480+
if constexpr (std::is_same_v<TTag, SameEventTag>) {
481+
if (2 <= multiplicity) {
482+
histos.fill(HIST("sameEvent2D"), deltaEta, deltaPhi);
483+
}
484+
if (2 <= multiplicity && multiplicity <= 10) {
485+
histos.fill(HIST("sameEvent_2_10"), deltaEta, deltaPhi);
486+
}
487+
if (11 <= multiplicity && multiplicity <= 20) {
488+
histos.fill(HIST("sameEvent_11_20"), deltaEta, deltaPhi);
489+
}
490+
if (21 <= multiplicity && multiplicity <= 30) {
491+
histos.fill(HIST("sameEvent_21_30"), deltaEta, deltaPhi);
492+
}
493+
if (31 <= multiplicity && multiplicity <= 40) {
494+
histos.fill(HIST("sameEvent_31_40"), deltaEta, deltaPhi);
495+
}
496+
if (41 <= multiplicity && multiplicity <= 50) {
497+
histos.fill(HIST("sameEvent_41_50"), deltaEta, deltaPhi);
498+
}
499+
}
500+
else if constexpr (std::is_same_v<TTag, MixedEventTag>) {
501+
if (2 <= multiplicity) {
502+
histos.fill(HIST("mixedEvent2D"), deltaEta, deltaPhi);
503+
}
504+
if (2 <= multiplicity && multiplicity <= 10) {
505+
histos.fill(HIST("mixedEvent_2_10"), deltaEta, deltaPhi);
506+
}
507+
if (11 <= multiplicity && multiplicity <= 20) {
508+
histos.fill(HIST("mixedEvent_11_20"), deltaEta, deltaPhi);
509+
}
510+
if (21 <= multiplicity && multiplicity <= 30) {
511+
histos.fill(HIST("mixedEvent_21_30"), deltaEta, deltaPhi);
512+
}
513+
if (31 <= multiplicity && multiplicity <= 40) {
514+
histos.fill(HIST("mixedEvent_31_40"), deltaEta, deltaPhi);
515+
}
516+
if (41 <= multiplicity && multiplicity <= 50) {
517+
histos.fill(HIST("mixedEvent_41_50"), deltaEta, deltaPhi);
518+
}
519+
}
540520
}
541521
}
542522
}
@@ -563,7 +543,6 @@ struct UpcPhotonuclearAnalysisJMG {
563543
}
564544
float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f);
565545
histos.fill(HIST("etaphiVtx"), reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phiVal);
566-
histos.fill(HIST("Tracks/hTrackPhiBeforeCorr"), phiVal);
567546
}
568547

569548
switch (sgSide) {
@@ -717,9 +696,6 @@ struct UpcPhotonuclearAnalysisJMG {
717696
// maxCountGapC = histEventCount->GetBinContent(binC) * factorEventsMixed;
718697
// }
719698

720-
auto histoEthaPhiVtxZ = histos.get<TH3>(HIST("etaphiVtx"));
721-
makeNUAWeights(histoEthaPhiVtxZ);
722-
723699
BinningType bindingOnVtx{{vtxBinsEdges, gapSideBinsEdges}, true};
724700
// BinningType bindingOnVtx{{vtxBinsEdges}, true};
725701
auto tracksTuple = std::make_tuple(reconstructedTracks);
@@ -758,7 +734,7 @@ struct UpcPhotonuclearAnalysisJMG {
758734
histos.fill(HIST("Events/hCountCollisionsMixed"), 2);
759735
// histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ()}));
760736
histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ(), collision1.gapSide()}));
761-
fillCorrelationsUD(mixed, tracks1, tracks2, multiplicity, collision1.posZ());
737+
fillCorrelationsUD(mixed, tracks1, tracks2, multiplicity, collision1.posZ(), MixedEventTag{});
762738
// LOGF(info, "Filling mixed events");
763739

764740
// if (collision1.gapSide() == 0 && collision2.gapSide() == 0) { gap on side A
@@ -909,10 +885,6 @@ struct UpcPhotonuclearAnalysisJMG {
909885
continue;
910886
}
911887
++multiplicity;
912-
913-
float weightNUA = getNUAWeight(reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phi(track.px(), track.py()));
914-
float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f);
915-
histos.fill(HIST("Tracks/hTrackPhiAfterCorr"), phiVal, weightNUA);
916888
}
917889
// multiplicity = reconstructedTracks.size();
918890
if (fillCollisionUD(same, multiplicity) == false) {
@@ -921,7 +893,7 @@ struct UpcPhotonuclearAnalysisJMG {
921893
// LOGF(debug, "Filling same events");
922894
histos.fill(HIST("eventcount"), -2);
923895
fillQAUD(reconstructedTracks, multiplicity);
924-
fillCorrelationsUD(same, reconstructedTracks, reconstructedTracks, multiplicity, reconstructedCollision.posZ());
896+
fillCorrelationsUD(same, reconstructedTracks, reconstructedTracks, multiplicity, reconstructedCollision.posZ(), SameEventTag{});
925897

926898
/*switch (sgSide) {
927899
case 0: // gap for side A

0 commit comments

Comments
 (0)