Skip to content

Commit ed5acbd

Browse files
authored
[PWGUD] Adding new histos for angular correlation studies (#13596)
1 parent 3d17d5c commit ed5acbd

File tree

1 file changed

+72
-90
lines changed

1 file changed

+72
-90
lines changed

PWGUD/Tasks/upcPhotonuclearAnalysisJMG.cxx

Lines changed: 72 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ struct UpcPhotonuclearAnalysisJMG {
104104
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
105105

106106
// Declare configurables on events/collisions
107+
Configurable<int> minMultiplicity{"minMultiplicity", 2, {"Range on multiplicity"}};
108+
Configurable<int> range1Max{"range1Max", 10, {"Range on multiplicity"}};
109+
Configurable<int> range2Min{"range2Min", 11, {"Range on multiplicity"}};
110+
Configurable<int> range2Max{"range2Max", 20, {"Range on multiplicity"}};
111+
Configurable<int> range3Min{"range3Min", 21, {"Range on multiplicity"}};
112+
Configurable<int> range3Max{"range3Max", 30, {"Range on multiplicity"}};
113+
Configurable<int> range4Min{"range4Min", 31, {"Range on multiplicity"}};
114+
Configurable<int> range4Max{"range4Max", 40, {"Range on multiplicity"}};
115+
Configurable<int> range5Min{"range5Min", 41, {"Range on multiplicity"}};
116+
Configurable<int> range5Max{"range5Max", 50, {"Range on multiplicity"}};
107117
Configurable<int> nEventsMixed{"nEventsMixed", 3, {"Events to be Mixed"}};
108118
Configurable<int> factorEventsMixed{"factorEventsMixed", 100, {"factorEventsMixed to events mixed"}};
109119
Configurable<float> myZVtxCut{"myZVtxCut", 10., {"My collision cut"}};
@@ -149,7 +159,7 @@ struct UpcPhotonuclearAnalysisJMG {
149159
"Pair cuts on various particles"};
150160
Configurable<float> cfgTwoTrackCut{"cfgTwoTrackCut", -1, {"Two track cut"}};
151161
ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for histograms"};
152-
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, kThreeHalfPi}, "delta phi axis for histograms"};
162+
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {32, -PIHalf, kThreeHalfPi}, "delta phi axis for histograms"};
153163
ConfigurableAxis axisDeltaEta{"axisDeltaEta", {32, -1.6, 1.6}, "delta eta axis for histograms"};
154164
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"};
155165
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 +208,18 @@ struct UpcPhotonuclearAnalysisJMG {
198208
histos.add("yields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{100, 0, 100, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}});
199209
histos.add("etaphi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{100, 0, 100, "multiplicity"}, {100, -2, 2, "#eta"}, {64, 0., TwoPI, "#varphi"}}});
200210
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"}}});
211+
histos.add("sameEvent2D", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
212+
histos.add("sameEvent_2_10", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
213+
histos.add("sameEvent_11_20", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
214+
histos.add("sameEvent_21_30", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
215+
histos.add("sameEvent_31_40", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
216+
histos.add("sameEvent_41_50", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
217+
histos.add("mixedEvent2D", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
218+
histos.add("mixedEvent_2_10", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
219+
histos.add("mixedEvent_11_20", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
220+
histos.add("mixedEvent_21_30", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
221+
histos.add("mixedEvent_31_40", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
222+
histos.add("mixedEvent_41_50", "#Delta #eta vs #Delta #phi", {HistType::kTH2F, {axisDeltaEta, axisDeltaPhi}});
202223

203224
const int maxMixBin = axisMultiplicity->size() * axisVertex->size();
204225
histos.add("eventcount", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}});
@@ -215,8 +236,6 @@ struct UpcPhotonuclearAnalysisJMG {
215236
histos.add("Events/hCountCollisions", "0 total - 1 side A - 2 side C - 3 both side; Number of analysed collision; counts", kTH1F, {axisCollision});
216237
histos.add("Events/hCountCollisionsMixed", "0 total - 1 side A - 2 side C - 3 both side; Number of analysed collision; counts", kTH1F, {axisCollision});
217238
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});
220239

221240
// histos to selection gap in side A
222241
histos.add("Tracks/SGsideA/hTrackPt", "#it{p_{T}} distribution; #it{p_{T}}; counts", kTH1F, {axisPt});
@@ -303,6 +322,11 @@ struct UpcPhotonuclearAnalysisJMG {
303322
std::vector<double> vtxBinsEdges{VARIABLE_WIDTH, -10.0f, -7.0f, -5.0f, -2.5f, 0.0f, 2.5f, 5.0f, 7.0f, 10.0f};
304323
std::vector<double> gapSideBinsEdges{VARIABLE_WIDTH, -0.5, 0.5, 1.5};
305324

325+
struct SameEventTag {
326+
};
327+
struct MixedEventTag {
328+
};
329+
306330
SliceCache cache;
307331
// int countEvents = 0;
308332
// int countGapA = 0;
@@ -431,84 +455,16 @@ struct UpcPhotonuclearAnalysisJMG {
431455
return true;
432456
}
433457

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)
458+
template <typename TTarget, typename TTracks, typename TTag>
459+
void fillCorrelationsUD(TTarget target, const TTracks& tracks1, const TTracks& tracks2, float multiplicity, float posZ, TTag)
501460
{
502-
// multiplicity = tracks1.size();
503461
for (const auto& track1 : tracks1) {
504462
if (isTrackCut(track1) == false) {
505463
return;
506464
}
507-
// weight NUA for track1
508465
float phi1 = phi(track1.px(), track1.py());
509466
phi1 = RecoDecay::constrainAngle(phi1, 0.f);
510467
float eta1 = eta(track1.px(), track1.py(), track1.pz());
511-
float w1 = getNUAWeight(posZ, eta1, phi1);
512468
target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, track1.pt(), multiplicity, posZ, 1.0);
513469
for (const auto& track2 : tracks2) {
514470
if (track1 == track2) {
@@ -517,13 +473,9 @@ struct UpcPhotonuclearAnalysisJMG {
517473
if (isTrackCut(track2) == false) {
518474
return;
519475
}
520-
// weight NUA for track 2
521476
float phi2 = phi(track2.px(), track2.py());
522477
phi2 = RecoDecay::constrainAngle(phi2, 0.f);
523478
float eta2 = eta(track2.px(), track2.py(), track2.pz());
524-
float w2 = getNUAWeight(posZ, eta2, phi2);
525-
// total weight
526-
float wPair = w1 * w2;
527479
/*if (doPairCuts && mPairCuts.conversionCuts(track1, track2)) {
528480
continue;
529481
}*/
@@ -535,8 +487,46 @@ struct UpcPhotonuclearAnalysisJMG {
535487
track2.pt(), track1.pt(),
536488
multiplicity,
537489
deltaPhi,
538-
posZ,
539-
wPair);
490+
posZ);
491+
if constexpr (std::is_same_v<TTag, SameEventTag>) {
492+
if (minMultiplicity <= multiplicity) {
493+
histos.fill(HIST("sameEvent2D"), deltaEta, deltaPhi);
494+
}
495+
if (minMultiplicity <= multiplicity && multiplicity <= range1Max) {
496+
histos.fill(HIST("sameEvent_2_10"), deltaEta, deltaPhi);
497+
}
498+
if (range2Min <= multiplicity && multiplicity <= range2Max) {
499+
histos.fill(HIST("sameEvent_11_20"), deltaEta, deltaPhi);
500+
}
501+
if (range3Min <= multiplicity && multiplicity <= range3Max) {
502+
histos.fill(HIST("sameEvent_21_30"), deltaEta, deltaPhi);
503+
}
504+
if (range4Min <= multiplicity && multiplicity <= range4Max) {
505+
histos.fill(HIST("sameEvent_31_40"), deltaEta, deltaPhi);
506+
}
507+
if (range5Min <= multiplicity && multiplicity <= range5Max) {
508+
histos.fill(HIST("sameEvent_41_50"), deltaEta, deltaPhi);
509+
}
510+
} else if constexpr (std::is_same_v<TTag, MixedEventTag>) {
511+
if (minMultiplicity <= multiplicity) {
512+
histos.fill(HIST("mixedEvent2D"), deltaEta, deltaPhi);
513+
}
514+
if (minMultiplicity <= multiplicity && multiplicity <= range1Max) {
515+
histos.fill(HIST("mixedEvent_2_10"), deltaEta, deltaPhi);
516+
}
517+
if (range2Min <= multiplicity && multiplicity <= range2Max) {
518+
histos.fill(HIST("mixedEvent_11_20"), deltaEta, deltaPhi);
519+
}
520+
if (range3Min <= multiplicity && multiplicity <= range3Max) {
521+
histos.fill(HIST("mixedEvent_21_30"), deltaEta, deltaPhi);
522+
}
523+
if (range4Min <= multiplicity && multiplicity <= range4Max) {
524+
histos.fill(HIST("mixedEvent_31_40"), deltaEta, deltaPhi);
525+
}
526+
if (range5Min <= multiplicity && multiplicity <= range5Max) {
527+
histos.fill(HIST("mixedEvent_41_50"), deltaEta, deltaPhi);
528+
}
529+
}
540530
}
541531
}
542532
}
@@ -563,7 +553,6 @@ struct UpcPhotonuclearAnalysisJMG {
563553
}
564554
float phiVal = RecoDecay::constrainAngle(phi(track.px(), track.py()), 0.f);
565555
histos.fill(HIST("etaphiVtx"), reconstructedCollision.posZ(), eta(track.px(), track.py(), track.pz()), phiVal);
566-
histos.fill(HIST("Tracks/hTrackPhiBeforeCorr"), phiVal);
567556
}
568557

569558
switch (sgSide) {
@@ -717,9 +706,6 @@ struct UpcPhotonuclearAnalysisJMG {
717706
// maxCountGapC = histEventCount->GetBinContent(binC) * factorEventsMixed;
718707
// }
719708

720-
auto histoEthaPhiVtxZ = histos.get<TH3>(HIST("etaphiVtx"));
721-
makeNUAWeights(histoEthaPhiVtxZ);
722-
723709
BinningType bindingOnVtx{{vtxBinsEdges, gapSideBinsEdges}, true};
724710
// BinningType bindingOnVtx{{vtxBinsEdges}, true};
725711
auto tracksTuple = std::make_tuple(reconstructedTracks);
@@ -758,7 +744,7 @@ struct UpcPhotonuclearAnalysisJMG {
758744
histos.fill(HIST("Events/hCountCollisionsMixed"), 2);
759745
// histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ()}));
760746
histos.fill(HIST("eventcount"), bindingOnVtx.getBin({collision1.posZ(), collision1.gapSide()}));
761-
fillCorrelationsUD(mixed, tracks1, tracks2, multiplicity, collision1.posZ());
747+
fillCorrelationsUD(mixed, tracks1, tracks2, multiplicity, collision1.posZ(), MixedEventTag{});
762748
// LOGF(info, "Filling mixed events");
763749

764750
// if (collision1.gapSide() == 0 && collision2.gapSide() == 0) { gap on side A
@@ -909,10 +895,6 @@ struct UpcPhotonuclearAnalysisJMG {
909895
continue;
910896
}
911897
++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);
916898
}
917899
// multiplicity = reconstructedTracks.size();
918900
if (fillCollisionUD(same, multiplicity) == false) {
@@ -921,7 +903,7 @@ struct UpcPhotonuclearAnalysisJMG {
921903
// LOGF(debug, "Filling same events");
922904
histos.fill(HIST("eventcount"), -2);
923905
fillQAUD(reconstructedTracks, multiplicity);
924-
fillCorrelationsUD(same, reconstructedTracks, reconstructedTracks, multiplicity, reconstructedCollision.posZ());
906+
fillCorrelationsUD(same, reconstructedTracks, reconstructedTracks, multiplicity, reconstructedCollision.posZ(), SameEventTag{});
925907

926908
/*switch (sgSide) {
927909
case 0: // gap for side A

0 commit comments

Comments
 (0)