Skip to content

Commit 00ea7e0

Browse files
rspijkersalibuild
andauthored
[PWGLF] minor bugfixes (#14069)
Co-authored-by: ALICE Builder <alibuild@users.noreply.github.com>
1 parent d34c9ba commit 00ea7e0

File tree

1 file changed

+58
-55
lines changed

1 file changed

+58
-55
lines changed

PWGLF/Tasks/Strangeness/cascadecorrelations.cxx

Lines changed: 58 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
using namespace o2;
5555
using namespace o2::soa;
5656
using namespace o2::constants::math;
57+
using namespace o2::constants::physics;
5758
using namespace o2::framework;
5859
using namespace o2::framework::expressions;
5960
using std::array;
@@ -138,6 +139,7 @@ struct CascadeSelector {
138139
ConfigurableAxis ptAxis = {"ptAxis", {150, 0, 15}, "#it{p}_{T}"};
139140
ConfigurableAxis rapidityAxis{"rapidityAxis", {100, -1.f, 1.f}, "y"};
140141
ConfigurableAxis invLambdaMassAxis{"invLambdaMassAxis", {100, 1.07f, 1.17f}, "Inv. Mass (GeV/c^{2})"};
142+
ConfigurableAxis chi2Axis{"chi2Axis", {100, 0.f, 10.f}, "Chi2"};
141143
AxisSpec itsClustersAxis{8, -0.5, 7.5, "number of ITS clusters"};
142144
AxisSpec tpcRowsAxis{160, -0.5, 159.5, "TPC crossed rows"};
143145
HistogramRegistry registry{
@@ -148,10 +150,10 @@ struct CascadeSelector {
148150
{"hCascRadius", "hCascRadius", {HistType::kTH3F, {radiusAxis, invXiMassAxis, ptAxis}}},
149151
{"hV0CosPA", "hV0CosPA", {HistType::kTH3F, {cpaAxis, invXiMassAxis, ptAxis}}},
150152
{"hCascCosPA", "hCascCosPA", {HistType::kTH3F, {cpaAxis, invXiMassAxis, ptAxis}}},
151-
{"hDCAPosToPV", "hDCAPosToPV", {HistType::kTH3F, {vertexAxis, invXiMassAxis, ptAxis}}},
152-
{"hDCANegToPV", "hDCANegToPV", {HistType::kTH3F, {vertexAxis, invXiMassAxis, ptAxis}}},
153-
{"hDCABachToPV", "hDCABachToPV", {HistType::kTH3F, {vertexAxis, invXiMassAxis, ptAxis}}},
154-
{"hDCAV0ToPV", "hDCAV0ToPV", {HistType::kTH3F, {vertexAxis, invXiMassAxis, ptAxis}}},
153+
{"hDCAPosToPV", "hDCAPosToPV", {HistType::kTH3F, {dcaAxis, invXiMassAxis, ptAxis}}},
154+
{"hDCANegToPV", "hDCANegToPV", {HistType::kTH3F, {dcaAxis, invXiMassAxis, ptAxis}}},
155+
{"hDCABachToPV", "hDCABachToPV", {HistType::kTH3F, {dcaAxis, invXiMassAxis, ptAxis}}},
156+
{"hDCAV0ToPV", "hDCAV0ToPV", {HistType::kTH3F, {dcaAxis, invXiMassAxis, ptAxis}}},
155157
{"hDCAV0Dau", "hDCAV0Dau", {HistType::kTH3F, {dcaAxis, invXiMassAxis, ptAxis}}},
156158
{"hDCACascDau", "hDCACascDau", {HistType::kTH3F, {dcaAxis, invXiMassAxis, ptAxis}}},
157159
{"hLambdaMass", "hLambdaMass", {HistType::kTH3F, {invLambdaMassAxis, invXiMassAxis, ptAxis}}},
@@ -161,27 +163,19 @@ struct CascadeSelector {
161163
{"hMassOmegaMinus", "hMassOmegaMinus", {HistType::kTH3F, {invOmegaMassAxis, ptAxis, rapidityAxis}}},
162164
{"hMassOmegaPlus", "hMassOmegaPlus", {HistType::kTH3F, {invOmegaMassAxis, ptAxis, rapidityAxis}}},
163165

164-
// // invariant mass per cut, start with Xi
165-
// {"hMassXi0", "Xi inv mass before selections", {HistType::kTH2F, {invMassAxis, ptAxis}}},
166-
// {"hMassXi1", "Xi inv mass after TPCnCrossedRows cut", {HistType::kTH2F, {invMassAxis, ptAxis}}},
167-
// {"hMassXi2", "Xi inv mass after ITSnClusters cut", {HistType::kTH2F, {invMassAxis, ptAxis}}},
168-
// {"hMassXi3", "Xi inv mass after topo cuts", {HistType::kTH2F, {invMassAxis, ptAxis}}},
169-
// {"hMassXi4", "Xi inv mass after V0 daughters PID cut", {HistType::kTH2F, {invMassAxis, ptAxis}}},
170-
// {"hMassXi5", "Xi inv mass after bachelor PID cut", {HistType::kTH2F, {invMassAxis, ptAxis}}},
171-
172166
// ITS & TPC clusters, with Xi inv mass
173167
{"hTPCnCrossedRowsPos", "hTPCnCrossedRowsPos", {HistType::kTH3F, {tpcRowsAxis, invXiMassAxis, ptAxis}}},
174168
{"hTPCnCrossedRowsNeg", "hTPCnCrossedRowsNeg", {HistType::kTH3F, {tpcRowsAxis, invXiMassAxis, ptAxis}}},
175169
{"hTPCnCrossedRowsBach", "hTPCnCrossedRowsBach", {HistType::kTH3F, {tpcRowsAxis, invXiMassAxis, ptAxis}}},
176170
{"hITSnClustersPos", "hITSnClustersPos", {HistType::kTH3F, {itsClustersAxis, invXiMassAxis, ptAxis}}},
177171
{"hITSnClustersNeg", "hITSnClustersNeg", {HistType::kTH3F, {itsClustersAxis, invXiMassAxis, ptAxis}}},
178172
{"hITSnClustersBach", "hITSnClustersBach", {HistType::kTH3F, {itsClustersAxis, invXiMassAxis, ptAxis}}},
179-
{"hTPCChi2Pos", "hTPCChi2Pos", {HistType::kTH1F, {{100, 0, 10, "TPC Chi2 Pos"}}}},
180-
{"hTPCChi2Neg", "hTPCChi2Neg", {HistType::kTH1F, {{100, 0, 10, "TPC Chi2 Neg"}}}},
181-
{"hTPCChi2Bach", "hTPCChi2Bach", {HistType::kTH1F, {{100, 0, 10, "TPC Chi2 Bach"}}}},
182-
{"hITSChi2Pos", "hITSChi2Pos", {HistType::kTH1F, {{100, 0, 100, "ITS Chi2 Pos"}}}},
183-
{"hITSChi2Neg", "hITSChi2Neg", {HistType::kTH1F, {{100, 0, 100, "ITS Chi2 Neg"}}}},
184-
{"hITSChi2Bach", "hITSChi2Bach", {HistType::kTH1F, {{100, 0, 100, "ITS Chi2 Bach"}}}},
173+
{"hTPCChi2Pos", "hTPCChi2Pos", {HistType::kTH1F, {chi2Axis}}},
174+
{"hTPCChi2Neg", "hTPCChi2Neg", {HistType::kTH1F, {chi2Axis}}},
175+
{"hTPCChi2Bach", "hTPCChi2Bach", {HistType::kTH1F, {chi2Axis}}},
176+
{"hITSChi2Pos", "hITSChi2Pos", {HistType::kTH1F, {chi2Axis}}},
177+
{"hITSChi2Neg", "hITSChi2Neg", {HistType::kTH1F, {chi2Axis}}},
178+
{"hITSChi2Bach", "hITSChi2Bach", {HistType::kTH1F, {chi2Axis}}},
185179

186180
{"hTriggerQA", "hTriggerQA", {HistType::kTH1F, {{2, -0.5, 1.5, "Trigger y/n"}}}},
187181
},
@@ -193,7 +187,7 @@ struct CascadeSelector {
193187
ccdb->setURL(ccdbUrl);
194188
ccdb->setCaching(true);
195189

196-
auto h = registry.add<TH1>("hSelectionStatus", "hSelectionStatus", HistType::kTH1I, {{10, 0, 10, "status"}});
190+
auto h = registry.add<TH1>("hSelectionStatus", "hSelectionStatus", HistType::kTH1F, {{10, 0, 10, "status"}});
197191
h->GetXaxis()->SetBinLabel(1, "All");
198192
h->GetXaxis()->SetBinLabel(2, "nTPC OK");
199193
h->GetXaxis()->SetBinLabel(3, "nITS OK");
@@ -204,7 +198,7 @@ struct CascadeSelector {
204198
h->GetXaxis()->SetBinLabel(8, "V0 PID OK");
205199
h->GetXaxis()->SetBinLabel(9, "Bach PID OK");
206200

207-
auto hEventSel = registry.add<TH1>("hEventSel", "hEventSel", HistType::kTH1I, {{10, 0, 10, "selection criteria"}});
201+
auto hEventSel = registry.add<TH1>("hEventSel", "hEventSel", HistType::kTH1F, {{10, 0, 10, "selection criteria"}});
208202
hEventSel->GetXaxis()->SetBinLabel(1, "All");
209203
hEventSel->GetXaxis()->SetBinLabel(2, "sel8");
210204
hEventSel->GetXaxis()->SetBinLabel(3, "INEL0");
@@ -218,10 +212,10 @@ struct CascadeSelector {
218212
registry.add("truerec/hCascRadius", "hCascRadius", HistType::kTH1F, {radiusAxis});
219213
registry.add("truerec/hV0CosPA", "hV0CosPA", HistType::kTH1F, {cpaAxis});
220214
registry.add("truerec/hCascCosPA", "hCascCosPA", HistType::kTH1F, {cpaAxis});
221-
registry.add("truerec/hDCAPosToPV", "hDCAPosToPV", HistType::kTH1F, {vertexAxis});
222-
registry.add("truerec/hDCANegToPV", "hDCANegToPV", HistType::kTH1F, {vertexAxis});
223-
registry.add("truerec/hDCABachToPV", "hDCABachToPV", HistType::kTH1F, {vertexAxis});
224-
registry.add("truerec/hDCAV0ToPV", "hDCAV0ToPV", HistType::kTH1F, {vertexAxis});
215+
registry.add("truerec/hDCAPosToPV", "hDCAPosToPV", HistType::kTH1F, {dcaAxis});
216+
registry.add("truerec/hDCANegToPV", "hDCANegToPV", HistType::kTH1F, {dcaAxis});
217+
registry.add("truerec/hDCABachToPV", "hDCABachToPV", HistType::kTH1F, {dcaAxis});
218+
registry.add("truerec/hDCAV0ToPV", "hDCAV0ToPV", HistType::kTH1F, {dcaAxis});
225219
registry.add("truerec/hDCAV0Dau", "hDCAV0Dau", HistType::kTH1F, {dcaAxis});
226220
registry.add("truerec/hDCACascDau", "hDCACascDau", HistType::kTH1F, {dcaAxis});
227221
registry.add("truerec/hLambdaMass", "hLambdaMass", HistType::kTH1F, {invLambdaMassAxis});
@@ -231,12 +225,12 @@ struct CascadeSelector {
231225
registry.add("truerec/hITSnClustersPos", "hITSnClustersPos", HistType::kTH1F, {itsClustersAxis});
232226
registry.add("truerec/hITSnClustersNeg", "hITSnClustersNeg", HistType::kTH1F, {itsClustersAxis});
233227
registry.add("truerec/hITSnClustersBach", "hITSnClustersBach", HistType::kTH1F, {itsClustersAxis});
234-
registry.add("truerec/hTPCChi2Pos", "hTPCChi2Pos", HistType::kTH1F, {{100, 0, 10, "TPC Chi2 Pos"}});
235-
registry.add("truerec/hTPCChi2Neg", "hTPCChi2Neg", HistType::kTH1F, {{100, 0, 10, "TPC Chi2 Neg"}});
236-
registry.add("truerec/hTPCChi2Bach", "hTPCChi2Bach", HistType::kTH1F, {{100, 0, 10, "TPC Chi2 Bach"}});
237-
registry.add("truerec/hITSChi2Pos", "hITSChi2Pos", HistType::kTH1F, {{100, 0, 100, "ITS Chi2 Pos"}});
238-
registry.add("truerec/hITSChi2Neg", "hITSChi2Neg", HistType::kTH1F, {{100, 0, 100, "ITS Chi2 Neg"}});
239-
registry.add("truerec/hITSChi2Bach", "hITSChi2Bach", HistType::kTH1F, {{100, 0, 100, "ITS Chi2 Bach"}});
228+
registry.add("truerec/hTPCChi2Pos", "hTPCChi2Pos", HistType::kTH1F, {chi2Axis});
229+
registry.add("truerec/hTPCChi2Neg", "hTPCChi2Neg", HistType::kTH1F, {chi2Axis});
230+
registry.add("truerec/hTPCChi2Bach", "hTPCChi2Bach", HistType::kTH1F, {chi2Axis});
231+
registry.add("truerec/hITSChi2Pos", "hITSChi2Pos", HistType::kTH1F, {chi2Axis});
232+
registry.add("truerec/hITSChi2Neg", "hITSChi2Neg", HistType::kTH1F, {chi2Axis});
233+
registry.add("truerec/hITSChi2Bach", "hITSChi2Bach", HistType::kTH1F, {chi2Axis});
240234
registry.add("truerec/hXiMinus", "hXiMinus", HistType::kTH2F, {ptAxis, rapidityAxis});
241235
registry.add("truerec/hXiPlus", "hXiPlus", HistType::kTH2F, {ptAxis, rapidityAxis});
242236
registry.add("truerec/hOmegaMinus", "hOmegaMinus", HistType::kTH2F, {ptAxis, rapidityAxis});
@@ -313,7 +307,7 @@ struct CascadeSelector {
313307
if (!gen.isPhysicalPrimary())
314308
return;
315309
int genpdg = gen.pdgCode();
316-
if ((flag < 3 && std::abs(genpdg) == 3312) || (flag > 1 && std::abs(genpdg) == 3334)) {
310+
if ((flag < 3 && std::abs(genpdg) == kXiMinus) || (flag > 1 && std::abs(genpdg) == kOmegaMinus)) {
317311
// if casc is consistent with Xi and has matched gen Xi OR cand is consistent with Omega and has matched gen omega
318312
// have to do this in case we reco true Xi with only Omega hypothesis (or vice versa) (very unlikely)
319313
registry.fill(HIST("truerec/hV0Radius"), rec.v0radius());
@@ -340,16 +334,16 @@ struct CascadeSelector {
340334
registry.fill(HIST("truerec/hTPCChi2Neg"), rec.negTrack_as<FullTracksExtIUWithPID>().tpcChi2NCl());
341335
registry.fill(HIST("truerec/hTPCChi2Bach"), rec.bachelor_as<FullTracksExtIUWithPID>().tpcChi2NCl());
342336
switch (genpdg) { // is matched so we can use genpdg
343-
case 3312:
337+
case kXiMinus:
344338
registry.fill(HIST("truerec/hXiMinus"), rec.pt(), rec.yXi());
345339
break;
346-
case -3312:
340+
case kXiPlusBar:
347341
registry.fill(HIST("truerec/hXiPlus"), rec.pt(), rec.yXi());
348342
break;
349-
case 3334:
343+
case kOmegaMinus:
350344
registry.fill(HIST("truerec/hOmegaMinus"), rec.pt(), rec.yOmega());
351345
break;
352-
case -3334:
346+
case kOmegaPlusBar:
353347
registry.fill(HIST("truerec/hOmegaPlus"), rec.pt(), rec.yOmega());
354348
break;
355349
}
@@ -423,8 +417,13 @@ struct CascadeSelector {
423417
casc.cascradius() < cascadesetting_cascradius ||
424418
casc.v0cosPA(pvx, pvy, pvz) < v0setting_cospa ||
425419
casc.casccosPA(pvx, pvy, pvz) < cascadesetting_cospa ||
426-
casc.dcav0topv(pvx, pvy, pvz) < cascadesetting_mindcav0topv ||
427-
std::abs(casc.mLambda() - 1.115683) > cascadesetting_v0masswindow)
420+
std::abs(casc.dcav0topv(pvx, pvy, pvz)) < cascadesetting_mindcav0topv ||
421+
std::abs(casc.mLambda() - o2::constants::physics::MassLambda) > cascadesetting_v0masswindow ||
422+
std::abs(casc.dcapostopv()) < v0setting_dcapostopv ||
423+
std::abs(casc.dcanegtopv()) < v0setting_dcanegtopv ||
424+
casc.dcaV0daughters() > v0setting_dcav0dau ||
425+
std::abs(casc.dcabachtopv()) < cascadesetting_dcabachtopv ||
426+
casc.dcacascdaughters() > cascadesetting_dcacascdau)
428427
return 0; // It failed at least one topo selection
429428

430429
registry.fill(HIST("hSelectionStatus"), 4); // passes topo
@@ -466,7 +465,7 @@ struct CascadeSelector {
466465
int flag = 0;
467466
if (std::abs(bachTrack.tpcNSigmaPi()) < tpcNsigmaBachelor)
468467
flag = 1;
469-
if (std::abs(bachTrack.tpcNSigmaKa()) < tpcNsigmaBachelor && (!doCompetingMassCut || std::abs(pdgDB->Mass(3312) - casc.mXi()) > competingMassWindow))
468+
if (std::abs(bachTrack.tpcNSigmaKa()) < tpcNsigmaBachelor && (!doCompetingMassCut || std::abs(o2::constants::physics::MassXiMinus - casc.mXi()) > competingMassWindow))
470469
flag = 3 - flag; // 3 if only consistent with omega, 2 if consistent with both
471470

472471
switch (flag) {
@@ -519,16 +518,16 @@ struct CascadeSelector {
519518
continue;
520519

521520
switch (mcPart.pdgCode()) {
522-
case 3312:
521+
case kXiMinus:
523522
registry.fill(HIST("gen/hXiMinus"), mcPart.pt(), mcPart.y());
524523
break;
525-
case -3312:
524+
case kXiPlusBar:
526525
registry.fill(HIST("gen/hXiPlus"), mcPart.pt(), mcPart.y());
527526
break;
528-
case 3334:
527+
case kOmegaMinus:
529528
registry.fill(HIST("gen/hOmegaMinus"), mcPart.pt(), mcPart.y());
530529
break;
531-
case -3334:
530+
case kOmegaPlusBar:
532531
registry.fill(HIST("gen/hOmegaPlus"), mcPart.pt(), mcPart.y());
533532
break;
534533
}
@@ -556,16 +555,16 @@ struct CascadeSelector {
556555
continue;
557556

558557
switch (mcPart.pdgCode()) {
559-
case 3312:
558+
case kXiMinus:
560559
registry.fill(HIST("genwithrec/hXiMinus"), mcPart.pt(), mcPart.y());
561560
break;
562-
case -3312:
561+
case kXiPlusBar:
563562
registry.fill(HIST("genwithrec/hXiPlus"), mcPart.pt(), mcPart.y());
564563
break;
565-
case 3334:
564+
case kOmegaMinus:
566565
registry.fill(HIST("genwithrec/hOmegaMinus"), mcPart.pt(), mcPart.y());
567566
break;
568-
case -3334:
567+
case kOmegaPlusBar:
569568
registry.fill(HIST("genwithrec/hOmegaPlus"), mcPart.pt(), mcPart.y());
570569
break;
571570
}
@@ -625,6 +624,7 @@ struct CascadeCorrelations {
625624
Configurable<std::string> efficiencyCCDBPath{"efficiencyCCDBPath", "Users/r/rspijker/test/EffTest", "Path of the efficiency corrections"};
626625
Configurable<bool> doTFBorderCut{"doTFBorderCut", true, "Switch to apply TimeframeBorderCut event selection"};
627626
Configurable<bool> doSel8{"doSel8", true, "Switch to apply sel8 event selection"};
627+
Configurable<int> INEL{"INEL", 0, "Number of charged tracks within |eta| < 1 has to be greater than value"}; // used in MC closure
628628

629629
ConfigurableAxis radiusAxis = {"radiusAxis", {100, 0.0f, 50.0f}, "cm"};
630630
ConfigurableAxis cpaAxis = {"cpaAxis", {100, 0.95f, 1.0f}, "CPA"};
@@ -686,8 +686,8 @@ struct CascadeCorrelations {
686686
bool autoCorrelation(std::array<int, 3> triggerTracks, std::array<int, 3> assocTracks)
687687
{
688688
// function that loops over 2 arrays of track indices, checking for common elements
689-
for (int triggerTrack : triggerTracks) {
690-
for (int assocTrack : assocTracks) {
689+
for (const int triggerTrack : triggerTracks) {
690+
for (const int assocTrack : assocTracks) {
691691
if (triggerTrack == assocTrack)
692692
return true;
693693
}
@@ -1004,31 +1004,34 @@ struct CascadeCorrelations {
10041004
} // process mixed events
10051005

10061006
Configurable<float> etaGenCascades{"etaGenCascades", 0.8, "min/max of eta for generated cascades"};
1007-
Filter genCascadesFilter = nabs(aod::mcparticle::pdgCode) == 3312;
1007+
Filter genCascadesFilter = nabs(aod::mcparticle::pdgCode) == static_cast<int>(kXiMinus);
10081008

1009-
void processMC(aod::McCollision const&, soa::SmallGroups<soa::Join<aod::McCollisionLabels, MyCollisionsMult>> const& collisions, soa::Filtered<aod::McParticles> const& genCascades, aod::McParticles const& mcParticles)
1009+
void processMC(aod::McCollision const& mcCollision, soa::SmallGroups<soa::Join<aod::McCollisionLabels, MyCollisionsMult>> const& collisions, soa::Filtered<aod::McParticles> const& genCascades, aod::McParticles const& mcParticles)
10101010
{
1011+
// apply evsel
1012+
if (INEL >= 0 && !pwglf::isINELgtNmc(mcParticles, INEL, pdgDB))
1013+
return;
1014+
if (std::abs(mcCollision.posZ()) > zVertexCut)
1015+
return;
1016+
10111017
// Let's do some logic on matched reconstructed collisions - if there less or more than one, fill some QA and skip the rest
10121018
double FT0mult = -1; // non-sensible default value just in case
1013-
double vtxz = -999.; // non-sensible default value just in case
1019+
double vtxz = mcCollision.posZ();
10141020
if (collisions.size() < 1) {
10151021
registry.fill(HIST("MC/hSplitEvents"), 0);
10161022
registry.fill(HIST("MC/hGenMultNoReco"), mCounter.countFT0A(mcParticles) + mCounter.countFT0C(mcParticles));
1017-
return;
10181023
} else if (collisions.size() == 1) {
10191024
registry.fill(HIST("MC/hSplitEvents"), 1);
10201025
registry.fill(HIST("MC/hGenMultOneReco"), mCounter.countFT0A(mcParticles) + mCounter.countFT0C(mcParticles));
10211026
for (auto const& collision : collisions) { // not really a loop, as there is only one collision
10221027
FT0mult = collision.centFT0M();
1023-
vtxz = collision.posZ();
10241028
}
10251029
} else if (collisions.size() > 1) {
10261030
registry.fill(HIST("MC/hSplitEvents"), collisions.size());
1027-
return;
10281031
}
10291032

10301033
// QA
1031-
for (auto& casc : genCascades) {
1034+
for (const auto& casc : genCascades) {
10321035
if (!casc.isPhysicalPrimary())
10331036
continue;
10341037
registry.fill(HIST("MC/hPhi"), casc.phi());

0 commit comments

Comments
 (0)