Skip to content

Commit 7a6bcb5

Browse files
authored
[PWGLF] replaced TProfile with ThnSparse and cleaned up the code (#8366)
1 parent 45032b3 commit 7a6bcb5

File tree

1 file changed

+31
-69
lines changed

1 file changed

+31
-69
lines changed

PWGLF/Tasks/Strangeness/lambdapolsp.cxx

Lines changed: 31 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
// #include "Common/DataModel/Qvectors.h"
3636
#include "PWGLF/DataModel/SPCalibrationTables.h"
37-
// #include "SPCalibrationTableswrite.h"
3837
#include "Framework/runDataProcessing.h"
3938
#include "Framework/AnalysisTask.h"
4039
#include "Framework/AnalysisDataModel.h"
@@ -75,6 +74,7 @@ struct lambdapolsp {
7574
Configurable<bool> additionalEvSel2{"additionalEvSel2", false, "additionalEvSel2"};
7675
Configurable<bool> additionalEvSel3{"additionalEvSel3", false, "additionalEvSel3"};
7776
Configurable<bool> correction{"correction", false, "fill histograms including corrections"};
77+
Configurable<bool> QA{"QA", false, "flag for QA"};
7878
Configurable<bool> mycut{"mycut", false, "select tracks based on my cuts"};
7979
Configurable<bool> tofhit{"tofhit", true, "select tracks based on tof hit"};
8080
Configurable<bool> globalpt{"globalpt", true, "select tracks based on pt global vs tpc"};
@@ -99,7 +99,6 @@ struct lambdapolsp {
9999
Configurable<int> cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"};
100100
Configurable<bool> isPVContributor{"isPVContributor", true, "is PV contributor"};
101101
Configurable<bool> checkwithpub{"checkwithpub", true, "checking results with published"};
102-
Configurable<bool> checkwithpubv2{"checkwithpubv2", true, "checking results with published v2"};
103102
// Configs for V0
104103
Configurable<float> ConfV0PtMin{"ConfV0PtMin", 0.f, "Minimum transverse momentum of V0"};
105104
Configurable<float> ConfV0Rap{"ConfV0Rap", 0.8f, "Rapidity range of V0"};
@@ -134,6 +133,9 @@ struct lambdapolsp {
134133
Configurable<int> ptNbins{"ptNbins", 50, "Number of bins in pt"};
135134
Configurable<float> lbinpt{"lbinpt", 0.0, "lower bin value in pt histograms"};
136135
Configurable<float> hbinpt{"hbinpt", 10.0, "higher bin value in pt histograms"};
136+
Configurable<int> resNbins{"resNbins", 50, "Number of bins in reso"};
137+
Configurable<float> lbinres{"lbinres", 0.0, "lower bin value in reso histograms"};
138+
Configurable<float> hbinres{"hbinres", 10.0, "higher bin value in reso histograms"};
137139
Configurable<int> etaNbins{"etaNbins", 20, "Number of bins in eta"};
138140
Configurable<float> lbineta{"lbineta", -1.0, "lower bin value in eta histograms"};
139141
Configurable<float> hbineta{"hbineta", 1.0, "higher bin value in eta histograms"};
@@ -151,12 +153,12 @@ struct lambdapolsp {
151153
void init(o2::framework::InitContext&)
152154
{
153155
AxisSpec thnAxispT{ptNbins, lbinpt, hbinpt, "#it{p}_{T} (GeV/#it{c})"};
156+
AxisSpec thnAxisres{resNbins, lbinres, hbinres, "Reso"};
154157
AxisSpec thnAxisInvMass{IMNbins, lbinIM, hbinIM, "#it{M} (GeV/#it{c}^{2})"};
155158
AxisSpec thnAxisPol{PolNbins, lbinPol, hbinPol, "Sin(#phi - #psi)"};
156159
AxisSpec thnAxisCosThetaStar{SANbins, lbinSA, hbinSA, "SA"};
157160
AxisSpec centAxis = {CentNbins, lbinCent, hbinCent, "V0M (%)"};
158161
AxisSpec etaAxis = {etaNbins, lbineta, hbineta, "Eta"};
159-
// AxisSpec ptAxis = {200, 0.0, 20.0, "Pt"};
160162
AxisSpec spAxis = {spNbins, lbinsp, hbinsp, "Sp"};
161163
AxisSpec qxZDCAxis = {QxyNbins, lbinQxy, hbinQxy, "Qx"};
162164

@@ -206,37 +208,26 @@ struct lambdapolsp {
206208
}
207209
}
208210

209-
if (checkwithpubv2) {
210-
histos.add("hpx2Tx1Ax1Cvscent", "hpx2Tx1Ax1Cvscent", kTProfile, {centAxis}, true);
211-
histos.add("hpx2Ty1Ay1Cvscent", "hpx2Ty1Ay1Cvscent", kTProfile, {centAxis}, true);
212-
histos.add("hpx1Ax1Cvscent", "hpx1Ax1Cvscent", kTProfile, {centAxis}, true);
213-
histos.add("hpy1Ay1Cvscent", "hpy1Ay1Cvscent", kTProfile, {centAxis}, true);
214-
histos.add("hpy2Tx1Ay1Cvscent", "hpy2Tx1Ay1Cvscent", kTProfile, {centAxis}, true);
215-
histos.add("hpy2Ty1Ax1Cvscent", "hpy2Ty1Ax1Cvscent", kTProfile, {centAxis}, true);
216-
}
217-
218211
histos.add("hCentrality", "Centrality distribution", kTH1F, {{centAxis}});
219212
histos.add("hCentrality0", "Centrality distribution0", kTH1F, {{centAxis}});
220213
histos.add("hCentrality1", "Centrality distribution1", kTH1F, {{centAxis}});
221214
histos.add("hCentrality2", "Centrality distribution2", kTH1F, {{centAxis}});
222215
histos.add("hCentrality3", "Centrality distribution3", kTH1F, {{centAxis}});
223216

224-
// histos.add("hDiff", "Diff distribution", kTH2F, {{100,0.0,10.0}, {100000, -5.0, 5.0}});
225-
// histos.add("hPhi", "Phi distribution", kTH1F, {{120, -6.28, 6.28}});
226-
227217
if (!checkwithpub) {
228-
histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{20, -10.0, 10.0}});
229-
histos.add("hpRes", "hpRes", kTProfile, {centAxis});
230-
histos.add("hpResSin", "hpResSin", kTProfile, {centAxis});
231-
histos.add("hpCosPsiA", "hpCosPsiA", kTProfile, {centAxis});
232-
histos.add("hpCosPsiC", "hpCosPsiC", kTProfile, {centAxis});
233-
histos.add("hpSinPsiA", "hpSinPsiA", kTProfile, {centAxis});
234-
histos.add("hpSinPsiC", "hpSinPsiC", kTProfile, {centAxis});
235-
histos.add("hcentQxZDCA", "hcentQxZDCA", kTH2F, {{centAxis}, {qxZDCAxis}});
236-
histos.add("hcentQyZDCA", "hcentQyZDCA", kTH2F, {{centAxis}, {qxZDCAxis}});
237-
histos.add("hcentQxZDCC", "hcentQxZDCC", kTH2F, {{centAxis}, {qxZDCAxis}});
238-
histos.add("hcentQyZDCC", "hcentQyZDCC", kTH2F, {{centAxis}, {qxZDCAxis}});
239-
218+
// histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{20, -10.0, 10.0}});
219+
histos.add("hpRes", "hpRes", HistType::kTHnSparseF, {centAxis, thnAxisres});
220+
if (QA) {
221+
histos.add("hpResSin", "hpResSin", HistType::kTHnSparseF, {centAxis, thnAxisres});
222+
histos.add("hpCosPsiA", "hpCosPsiA", HistType::kTHnSparseF, {centAxis, thnAxisres});
223+
histos.add("hpCosPsiC", "hpCosPsiC", HistType::kTHnSparseF, {centAxis, thnAxisres});
224+
histos.add("hpSinPsiA", "hpSinPsiA", HistType::kTHnSparseF, {centAxis, thnAxisres});
225+
histos.add("hpSinPsiC", "hpSinPsiC", HistType::kTHnSparseF, {centAxis, thnAxisres});
226+
histos.add("hcentQxZDCA", "hcentQxZDCA", kTH2F, {{centAxis}, {qxZDCAxis}});
227+
histos.add("hcentQyZDCA", "hcentQyZDCA", kTH2F, {{centAxis}, {qxZDCAxis}});
228+
histos.add("hcentQxZDCC", "hcentQxZDCC", kTH2F, {{centAxis}, {qxZDCAxis}});
229+
histos.add("hcentQyZDCC", "hcentQyZDCC", kTH2F, {{centAxis}, {qxZDCAxis}});
230+
}
240231
histos.add("hSparseLambdaPolA", "hSparseLambdaPolA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxispT, thnAxisPol, centAxis}, true);
241232
histos.add("hSparseLambdaPolC", "hSparseLambdaPolC", HistType::kTHnSparseF, {thnAxisInvMass, thnAxispT, thnAxisPol, centAxis}, true);
242233
histos.add("hSparseAntiLambdaPolA", "hSparseAntiLambdaPolA", HistType::kTHnSparseF, {thnAxisInvMass, thnAxispT, thnAxisPol, centAxis}, true);
@@ -378,7 +369,6 @@ struct lambdapolsp {
378369
Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT);
379370
Filter dcaCutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz);
380371

381-
// using EventCandidates = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::FT0Mults, aod::FV0Mults, aod::TPCMults, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0Cs, aod::CentFT0As, aod::SPCalibrationTableswrite, aod::Mults, aod::Qvectors>>;
382372
using EventCandidates = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::FT0Mults, aod::FV0Mults, aod::TPCMults, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0Cs, aod::CentFT0As, aod::SPCalibrationTables, aod::Mults>>;
383373
// using AllTrackCandidates = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTPCFullPi, aod::pidTPCFullPr>;
384374
using AllTrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTPCFullPi, aod::pidTPCFullPr, aod::pidTPCFullKa>>;
@@ -412,13 +402,6 @@ struct lambdapolsp {
412402
return;
413403
}
414404

415-
// if (collision.qvecAmp()[6] < 1e-5)
416-
// return;
417-
418-
/*
419-
auto qyTPC = collision.qvecIm()[27];
420-
auto qxTPC = collision.qvecRe()[27];
421-
*/
422405
auto qxZDCA = collision.qxZDCA();
423406
auto qxZDCC = collision.qxZDCC();
424407
auto qyZDCA = collision.qyZDCA();
@@ -428,40 +411,22 @@ struct lambdapolsp {
428411

429412
histos.fill(HIST("hCentrality"), centrality);
430413
if (!checkwithpub) {
431-
histos.fill(HIST("hVtxZ"), collision.posZ());
414+
// histos.fill(HIST("hVtxZ"), collision.posZ());
432415
histos.fill(HIST("hpRes"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA - psiZDCC))));
433-
histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC))));
434-
histos.fill(HIST("hpCosPsiA"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA))));
435-
histos.fill(HIST("hpCosPsiC"), centrality, (TMath::Cos(GetPhiInRange(psiZDCC))));
436-
histos.fill(HIST("hpSinPsiA"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA))));
437-
histos.fill(HIST("hpSinPsiC"), centrality, (TMath::Sin(GetPhiInRange(psiZDCC))));
438-
histos.fill(HIST("hcentQxZDCA"), centrality, qxZDCA);
439-
histos.fill(HIST("hcentQyZDCA"), centrality, qyZDCA);
440-
histos.fill(HIST("hcentQxZDCC"), centrality, qxZDCC);
441-
histos.fill(HIST("hcentQyZDCC"), centrality, qyZDCC);
442-
}
443-
444-
/*
445-
if (checkwithpubv2)
446-
{
447-
auto x2Tx1Ax1C=qxTPC*qxZDCA*qxZDCC;
448-
auto x2Ty1Ay1C=qxTPC*qyZDCA*qyZDCC;
449-
auto x1Ax1C=qxZDCA*qxZDCC;
450-
auto y1Ay1C=qyZDCA*qyZDCC;
451-
auto y2Tx1Ay1C=qyTPC*qxZDCA*qyZDCC;
452-
auto y2Ty1Ax1C=qyTPC*qyZDCA*qxZDCC;
453-
454-
histos.fill(HIST("hpx2Tx1Ax1Cvscent"), centrality, x2Tx1Ax1C);
455-
histos.fill(HIST("hpx2Ty1Ay1Cvscent"), centrality, x2Ty1Ay1C);
456-
histos.fill(HIST("hpx1Ax1Cvscent"), centrality, x1Ax1C);
457-
histos.fill(HIST("hpy1Ay1Cvscent"), centrality, y1Ay1C);
458-
histos.fill(HIST("hpy2Tx1Ay1Cvscent"), centrality, y2Tx1Ay1C);
459-
histos.fill(HIST("hpy2Ty1Ax1Cvscent"), centrality, y2Ty1Ax1C);
460-
416+
if (QA) {
417+
histos.fill(HIST("hpResSin"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA - psiZDCC))));
418+
histos.fill(HIST("hpCosPsiA"), centrality, (TMath::Cos(GetPhiInRange(psiZDCA))));
419+
histos.fill(HIST("hpCosPsiC"), centrality, (TMath::Cos(GetPhiInRange(psiZDCC))));
420+
histos.fill(HIST("hpSinPsiA"), centrality, (TMath::Sin(GetPhiInRange(psiZDCA))));
421+
histos.fill(HIST("hpSinPsiC"), centrality, (TMath::Sin(GetPhiInRange(psiZDCC))));
422+
histos.fill(HIST("hcentQxZDCA"), centrality, qxZDCA);
423+
histos.fill(HIST("hcentQyZDCA"), centrality, qyZDCA);
424+
histos.fill(HIST("hcentQxZDCC"), centrality, qxZDCC);
425+
histos.fill(HIST("hcentQyZDCC"), centrality, qyZDCC);
461426
}
462-
*/
427+
}
463428

464-
///////////checking v1 and v2////////////////////////////////
429+
///////////checking v1////////////////////////////////
465430
if (checkwithpub) {
466431

467432
auto QxtQxp = qxZDCA * qxZDCC;
@@ -485,9 +450,6 @@ struct lambdapolsp {
485450
if (sign == 0.0) // removing neutral particles
486451
continue;
487452

488-
// histos.fill(HIST("hDiff"), track.pt(), (track.p() - track.tpcInnerParam()));
489-
// LOG(info) << "Sign of tracks are:\t" << sign;
490-
491453
auto ux = TMath::Cos(GetPhiInRange(track.phi()));
492454
auto uy = TMath::Sin(GetPhiInRange(track.phi()));
493455

0 commit comments

Comments
 (0)