Skip to content

Commit 620a93b

Browse files
authored
[PWGLF] Add thnsparse in the output of f1p correlation (#9066)
1 parent 46aec9a commit 620a93b

File tree

1 file changed

+67
-11
lines changed

1 file changed

+67
-11
lines changed

PWGLF/Tasks/Resonances/f1protoncorrelation.cxx

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#include "Framework/AnalysisTask.h"
2727
#include "Framework/ASoAHelpers.h"
2828
#include "Framework/runDataProcessing.h"
29+
#include "Framework/AnalysisDataModel.h"
30+
#include "Framework/StepTHn.h"
31+
#include "Common/Core/trackUtilities.h"
2932
#include "PWGLF/DataModel/ReducedF1ProtonTables.h"
3033
#include "CommonConstants/PhysicsConstants.h"
3134

@@ -39,7 +42,9 @@ struct f1protoncorrelation {
3942
// PID selection
4043
Configurable<float> nsigmaCutTPC{"nsigmacutTPC", 3.0, "Value of the TPC Nsigma cut"};
4144
Configurable<float> nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Value of the TOF Nsigma cut"};
45+
Configurable<int> typeofCombined{"typeofCombined", 1, "type of combined"};
4246
// PID selection
47+
Configurable<bool> fillSparse{"fillSparse", 1, "Fill Sparse"};
4348
Configurable<bool> fillRotation{"fillRotation", 1, "Fill rotation"};
4449
Configurable<bool> pdepPID{"pdepPID", 1, "Momentum dependent pi, k PID"};
4550
Configurable<int> strategyPIDPion{"strategyPIDPion", 0, "PID strategy Pion"};
@@ -52,11 +57,19 @@ struct f1protoncorrelation {
5257
Configurable<float> momentumTOFPionMax{"momentumTOFPionMax", 1.2, "Pion momentum TOF Max"};
5358
Configurable<float> momentumTOFKaonMax{"momentumTOFKaonMax", 1.2, "Kaon momentum TOF Max"};
5459
Configurable<float> momentumTOFProton{"momentumTOFProton", 0.7, "Proton momentum TOF"};
60+
Configurable<float> momentumProtonMax{"momentumProtonMax", 3.0, "Maximum proton momentum"};
5561
Configurable<float> lowPtF1{"lowPtF1", 1.0, "PT cut F1"};
5662
// Event Mixing
57-
Configurable<int> nEvtMixing{"nEvtMixing", 1, "Number of events to mix"};
63+
Configurable<int> nEvtMixing{"nEvtMixing", 10, "Number of events to mix"};
5864
ConfigurableAxis CfgVtxBins{"CfgVtxBins", {10, -10, 10}, "Mixing bins - z-vertex"};
59-
ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0, 30.0, 40.0, 50.0, 60.0, 80.0, 200.0}, "Mixing bins - number of contributor"};
65+
ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0, 20.0, 40.0, 60.0, 80.0, 500.0}, "Mixing bins - number of contributor"};
66+
67+
// THnsparse bining
68+
ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {100, 1.0, 1.4}, "#it{M} (GeV/#it{c}^{2})"};
69+
ConfigurableAxis configThnAxisPt{"configThnAxisPt", {100, 0.0, 10.}, "#it{p}_{T} (GeV/#it{c})"};
70+
ConfigurableAxis configThnAxisKstar{"configThnAxisKstar", {100, 0.0, 1.0}, "#it{k}^{*} (GeV/#it{c})"};
71+
ConfigurableAxis configThnAxisPtProton{"configThnAxisPtProton", {20, 0.0, 4.}, "#it{p}_{T} (GeV/#it{c})"};
72+
ConfigurableAxis configThnAxisNsigma{"configThnAxisNsigma", {90, -9.0, 9.0}, "NsigmaCombined"};
6073

6174
// Initialize the ananlysis task
6275
void init(o2::framework::InitContext&)
@@ -75,6 +88,21 @@ struct f1protoncorrelation {
7588
histos.add("h2MixEventInvariantMassUnlike_mass", "Unlike Sign Invariant mass of f1 mix event", kTH3F, {{100, 0.0f, 1.0f}, {100, 0.0, 10.0}, {800, 1.0, 1.8}});
7689
histos.add("h2MixEventInvariantMassLike_mass", "Like Sign Invariant mass of f1 mix event", kTH3F, {{100, 0.0f, 1.0f}, {100, 0.0, 10.0}, {800, 1.0, 1.8}});
7790
histos.add("h2MixEventInvariantMassRot_mass", "Rotational Sign Invariant mass of f1 mix event", kTH3F, {{100, 0.0f, 1.0f}, {100, 0.0, 10.0}, {800, 1.0, 1.8}});
91+
92+
const AxisSpec thnAxisInvMass{configThnAxisInvMass, "#it{M} (GeV/#it{c}^{2})"};
93+
const AxisSpec thnAxisPt{configThnAxisPt, "#it{p}_{T} (GeV/#it{c})"};
94+
const AxisSpec thnAxisPtProton{configThnAxisPtProton, "#it{p}_{T} (GeV/#it{c})"};
95+
const AxisSpec thnAxisKstar{configThnAxisKstar, "#it{k}^{*} (GeV/#it{c})"};
96+
const AxisSpec thnAxisNsigma{configThnAxisNsigma, "NsigmaCombined"};
97+
if (fillSparse) {
98+
histos.add("SEMassUnlike", "SEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma});
99+
histos.add("SEMassLike", "SEMassLike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma});
100+
histos.add("SEMassRot", "SEMassRot", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma});
101+
102+
histos.add("MEMassUnlike", "MEMassUnlike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma});
103+
histos.add("MEMassLike", "MEMassLike", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma});
104+
histos.add("MEMassRot", "MEMassRot", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisPtProton, thnAxisKstar, thnAxisNsigma});
105+
}
78106
}
79107

80108
// get kstar
@@ -99,7 +127,7 @@ struct f1protoncorrelation {
99127
trackRelK = PartOneCMS - PartTwoCMS;
100128
return 0.5 * trackRelK.P();
101129
}
102-
130+
float combinedTPC;
103131
TLorentzVector F1, Proton, F1ProtonPair, Pion, Kaon, Kshort;
104132
TLorentzVector F1Rot, PionRot, KaonKshortPair, KaonKshortPairRot;
105133
// Process the data in same event
@@ -146,8 +174,17 @@ struct f1protoncorrelation {
146174
histos.fill(HIST("hNsigmaKaonTPC"), f1track.f1d2TPC(), Kaon.Pt());
147175
histos.fill(HIST("hNsigmaPionTPC"), f1track.f1d1TPC(), Pion.Pt());
148176
histos.fill(HIST("hNsigmaPionKaonTPC"), f1track.f1d1TPC(), f1track.f1d2TPC());
177+
if (typeofCombined == 0) {
178+
combinedTPC = TMath::Sqrt(f1track.f1d1TPC() * f1track.f1d1TPC() + f1track.f1d2TPC() * f1track.f1d2TPC());
179+
}
180+
if (typeofCombined == 1) {
181+
combinedTPC = (f1track.f1d1TPC() - f1track.f1d2TPC()) / (f1track.f1d1TPC() + f1track.f1d2TPC());
182+
}
149183
for (auto protontrack : protontracks) {
150184
Proton.SetXYZM(protontrack.protonPx(), protontrack.protonPy(), protontrack.protonPz(), 0.938);
185+
if (Proton.Pt() > momentumProtonMax) {
186+
continue;
187+
}
151188
if (Proton.P() < momentumTOFProton && TMath::Abs(protontrack.protonNsigmaTPC()) > 2.5) {
152189
continue;
153190
}
@@ -164,9 +201,15 @@ struct f1protoncorrelation {
164201
histos.fill(HIST("h2SameEventPtCorrelation"), relative_momentum, F1.Pt(), Proton.Pt());
165202
if (f1track.f1SignalStat() == 1) {
166203
histos.fill(HIST("h2SameEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M()); // F1 sign = 1 unlike, F1 sign = -1 like
204+
if (fillSparse) {
205+
histos.fill(HIST("SEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC);
206+
}
167207
}
168208
if (f1track.f1SignalStat() == -1) {
169209
histos.fill(HIST("h2SameEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M());
210+
if (fillSparse) {
211+
histos.fill(HIST("SEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC);
212+
}
170213
}
171214
if (fillRotation) {
172215
for (int nrotbkg = 0; nrotbkg < 9; nrotbkg++) {
@@ -181,6 +224,9 @@ struct f1protoncorrelation {
181224
auto relative_momentum_rot = getkstar(F1Rot, Proton);
182225
if (f1track.f1SignalStat() == 1) {
183226
histos.fill(HIST("h2SameEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M());
227+
if (fillSparse) {
228+
histos.fill(HIST("SEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC);
229+
}
184230
}
185231
}
186232
}
@@ -189,12 +235,6 @@ struct f1protoncorrelation {
189235
}
190236

191237
// Processing Event Mixing
192-
// using BinningTypeVtxZT0M = ColumnBinningPolicy<aod::collision::PosZ, aod::resocollision::MultV0M>;
193-
// for (auto& [collision1, tracks1, collision2, tracks2] : pairs) {
194-
// Pair<aod::RedF1PEvents, aod::F1Tracks, aod::ProtonTracks, BinningType> pairs{colBinning, nEvtMixing, -1, &cache}; // -1 is the number of the bin to skip
195-
//
196-
// tracks1 is an aod::Tracks table of f1tracks belonging to collision collision1 (aod::Collision::iterator)
197-
// tracks2 is an aod::Tracks table of protontracks belonging to collision collision2 (aod::Collision::iterator)
198238
SliceCache cache;
199239
using BinningType = ColumnBinningPolicy<aod::collision::PosZ, aod::collision::NumContrib>;
200240
BinningType colBinning{{CfgVtxBins, CfgMultBins}, true};
@@ -214,9 +254,7 @@ struct f1protoncorrelation {
214254
auto groupProton = protontracks.sliceBy(tracksPerCollisionPresliceP, collision2.globalIndex());
215255
// auto groupF1 = f1tracks.sliceByCached(aod::f1protondaughter::redF1PEventId, collision1.globalIndex(), cache);
216256
// auto groupProton = protontracks.sliceByCached(aod::f1protondaughter::redF1PEventId, collision2.globalIndex(), cache);
217-
// for (auto& [t1, t2] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(f1tracks, protontracks))) {
218257
for (auto& [t1, t2] : soa::combinations(o2::soa::CombinationsFullIndexPolicy(groupF1, groupProton))) {
219-
// LOGF(info, "Mixed event collision1 track1: (%d, %d)", collision1.index(), t1.index());
220258
if (t1.f1MassKaonKshort() > maxKKS0Mass) {
221259
continue;
222260
}
@@ -254,7 +292,16 @@ struct f1protoncorrelation {
254292
if (strategyPIDKaon == 1 && Kaon.Pt() > momentumTOFKaonMin && Kaon.Pt() <= momentumTOFKaonMax && t1.f1d2TOFHit() != 1) {
255293
continue;
256294
}
295+
if (typeofCombined == 0) {
296+
combinedTPC = TMath::Sqrt(t1.f1d1TPC() * t1.f1d1TPC() + t1.f1d2TPC() * t1.f1d2TPC());
297+
}
298+
if (typeofCombined == 1) {
299+
combinedTPC = (t1.f1d1TPC() - t1.f1d2TPC()) / (t1.f1d1TPC() + t1.f1d2TPC());
300+
}
257301
Proton.SetXYZM(t2.protonPx(), t2.protonPy(), t2.protonPz(), 0.938);
302+
if (Proton.Pt() > momentumProtonMax) {
303+
continue;
304+
}
258305
if (Proton.P() < momentumTOFProton && TMath::Abs(t2.protonNsigmaTPC()) > 2.5) {
259306
continue;
260307
}
@@ -264,9 +311,15 @@ struct f1protoncorrelation {
264311
auto relative_momentum = getkstar(F1, Proton);
265312
if (t1.f1SignalStat() == 1) {
266313
histos.fill(HIST("h2MixEventInvariantMassUnlike_mass"), relative_momentum, F1.Pt(), F1.M()); // F1 sign = 1 unlike, F1 sign = -1 like
314+
if (fillSparse) {
315+
histos.fill(HIST("MEMassUnlike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC);
316+
}
267317
}
268318
if (t1.f1SignalStat() == -1) {
269319
histos.fill(HIST("h2MixEventInvariantMassLike_mass"), relative_momentum, F1.Pt(), F1.M());
320+
if (fillSparse) {
321+
histos.fill(HIST("MEMassLike"), F1.M(), F1.Pt(), Proton.Pt(), relative_momentum, combinedTPC);
322+
}
270323
}
271324
if (fillRotation) {
272325
for (int nrotbkg = 0; nrotbkg < 9; nrotbkg++) {
@@ -281,6 +334,9 @@ struct f1protoncorrelation {
281334
auto relative_momentum_rot = getkstar(F1Rot, Proton);
282335
if (t1.f1SignalStat() == 1) {
283336
histos.fill(HIST("h2MixEventInvariantMassRot_mass"), relative_momentum_rot, F1Rot.Pt(), F1Rot.M());
337+
if (fillSparse) {
338+
histos.fill(HIST("MEMassRot"), F1Rot.M(), F1Rot.Pt(), Proton.Pt(), relative_momentum_rot, combinedTPC);
339+
}
284340
}
285341
}
286342
}

0 commit comments

Comments
 (0)