Skip to content

Commit 0ed3576

Browse files
authored
[PWGLF] strangeness in pp: refine gen. sels; fix labels (#16837)
1 parent 60ab221 commit 0ed3576

3 files changed

Lines changed: 141 additions & 54 deletions

File tree

PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#include <TString.h>
5252

5353
#include <algorithm>
54-
#include <array>
5554
#include <cmath>
5655
#include <cstdint>
5756
#include <cstdlib>
@@ -85,12 +84,6 @@ struct Cascqaanalysis {
8584
kNEventTypeBins
8685
};
8786

88-
static constexpr std::array<std::pair<EventTypeBin, const char*>, kNEventTypeBins> EventTypeBinLabels{{
89-
{kINEL, "INEL"},
90-
{kINELgt0, "INEL>0"},
91-
{kINELgt1, "INEL>1"},
92-
}};
93-
9487
// Axes
9588
ConfigurableAxis ptAxis{"ptAxis", {200, 0.0f, 10.0f}, "#it{p}_{T} (GeV/#it{c})"};
9689
ConfigurableAxis rapidityAxis{"rapidityAxis", {200, -2.0f, 2.0f}, "y"};
@@ -112,6 +105,7 @@ struct Cascqaanalysis {
112105

113106
// Event selection criteria
114107
Configurable<float> cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"};
108+
Configurable<float> cutzvertexGen{"cutzvertexGen", -1.0f, "Accepted generated z-vertex range (cm); negative disables the cut"};
115109
Configurable<bool> isVertexITSTPC{"isVertexITSTPC", 0, "Select collisions with at least one ITS-TPC track"};
116110
Configurable<bool> isNoSameBunchPileup{"isNoSameBunchPileup", 0, "Same found-by-T0 bunch crossing rejection"};
117111
Configurable<bool> isGoodZvtxFT0vsPV{"isGoodZvtxFT0vsPV", 0, "z of PV by tracks and z of PV from FT0 A-C time difference cut"};
@@ -213,14 +207,6 @@ struct Cascqaanalysis {
213207
o2::constants::physics::MassOmegaMinus * decayLength * invMomentum};
214208
}
215209

216-
template <typename TAxisType>
217-
static void setEventTypeAxisLabels(TAxisType* axis)
218-
{
219-
for (const auto& [bin, label] : EventTypeBinLabels) {
220-
axis->SetBinLabel(static_cast<int>(bin) + 1, label);
221-
}
222-
}
223-
224210
void init(InitContext const&)
225211
{
226212
TString hCandidateCounterLabels[4] = {"All candidates", "passed topo cuts", "has associated MC particle", "associated with Xi(Omega)"};
@@ -255,17 +241,9 @@ struct Cascqaanalysis {
255241
registry.add("hNchFT0MGenEvType", "hNchFT0MGenEvType", {HistType::kTH2D, {nChargedFT0MGenAxis, eventTypeAxis}});
256242
registry.add("hNchFV0AGenEvType", "hNchFV0AGenEvType", {HistType::kTH2D, {nChargedFV0AGenAxis, eventTypeAxis}});
257243
registry.add("hCentFT0M_genMC", "hCentFT0M_genMC", {HistType::kTH2D, {centFT0MAxis, eventTypeAxis}});
258-
setEventTypeAxisLabels(registry.get<TH2>(HIST("hEventTypeRecVsGen"))->GetXaxis());
259-
setEventTypeAxisLabels(registry.get<TH2>(HIST("hEventTypeRecVsGen"))->GetYaxis());
260-
setEventTypeAxisLabels(registry.get<TH3>(HIST("hNchFT0MNAssocMCCollisions"))->GetZaxis());
261-
setEventTypeAxisLabels(registry.get<TH3>(HIST("hNchFT0MNAssocMCCollisionsSameType"))->GetZaxis());
262-
setEventTypeAxisLabels(registry.get<TH2>(HIST("hNchFT0MGenEvType"))->GetYaxis());
263-
setEventTypeAxisLabels(registry.get<TH2>(HIST("hNchFV0AGenEvType"))->GetYaxis());
264-
setEventTypeAxisLabels(registry.get<TH2>(HIST("hCentFT0M_genMC"))->GetYaxis());
265244
}
266245

267246
registry.add("hCentFT0M_rec", "hCentFT0M_rec", {HistType::kTH2D, {centFT0MAxis, eventTypeAxis}});
268-
setEventTypeAxisLabels(registry.get<TH2>(HIST("hCentFT0M_rec"))->GetYaxis());
269247

270248
if (candidateQA) {
271249
registry.add("hNcandidates", "hNcandidates", {HistType::kTH3D, {nCandidates, centFT0MAxis, {2, -0.5f, 1.5f}}});
@@ -279,21 +257,13 @@ struct Cascqaanalysis {
279257
registry.add("hNchFT0Mglobal", "hNchFT0Mglobal", {HistType::kTH3D, {nChargedFT0MGenAxis, multNTracksAxis, eventTypeAxis}});
280258
registry.add("hNchFT0MPVContr", "hNchFT0MPVContr", {HistType::kTH3D, {nChargedFT0MGenAxis, multNTracksAxis, eventTypeAxis}});
281259
registry.add("hNchFV0APVContr", "hNchFV0APVContr", {HistType::kTH3D, {nChargedFV0AGenAxis, multNTracksAxis, eventTypeAxis}});
282-
setEventTypeAxisLabels(registry.get<TH3>(HIST("hNchFT0Mglobal"))->GetZaxis());
283-
setEventTypeAxisLabels(registry.get<TH3>(HIST("hNchFT0MPVContr"))->GetZaxis());
284-
setEventTypeAxisLabels(registry.get<TH3>(HIST("hNchFV0APVContr"))->GetZaxis());
285260
}
286261
registry.add("hFT0MpvContr", "hFT0MpvContr", {HistType::kTH3D, {centFT0MAxis, multNTracksAxis, eventTypeAxis}});
287262
registry.add("hFV0ApvContr", "hFV0ApvContr", {HistType::kTH3D, {centFV0AAxis, multNTracksAxis, eventTypeAxis}});
288263
registry.add("hFT0Mglobal", "hFT0Mglobal", {HistType::kTH3D, {centFT0MAxis, multNTracksAxis, eventTypeAxis}});
289264
registry.add("hFV0AFT0M", "hFV0AFT0M", {HistType::kTH3D, {centFV0AAxis, centFT0MAxis, eventTypeAxis}});
290265
registry.add("hFT0MFV0Asignal", "hFT0MFV0Asignal", {HistType::kTH2D, {signalFT0MAxis, signalFV0AAxis}});
291266
registry.add("hFT0MsignalPVContr", "hFT0MsignalPVContr", {HistType::kTH3D, {signalFT0MAxis, multNTracksAxis, eventTypeAxis}});
292-
setEventTypeAxisLabels(registry.get<TH3>(HIST("hFT0MpvContr"))->GetZaxis());
293-
setEventTypeAxisLabels(registry.get<TH3>(HIST("hFV0ApvContr"))->GetZaxis());
294-
setEventTypeAxisLabels(registry.get<TH3>(HIST("hFT0Mglobal"))->GetZaxis());
295-
setEventTypeAxisLabels(registry.get<TH3>(HIST("hFV0AFT0M"))->GetZaxis());
296-
setEventTypeAxisLabels(registry.get<TH3>(HIST("hFT0MsignalPVContr"))->GetZaxis());
297267
}
298268

299269
rctChecker.init(cfgEvtRCTFlagCheckerLabel, cfgEvtRCTFlagCheckerZDCCheck, cfgEvtRCTFlagCheckerLimitAcceptAsBad, requireRCTFlagChecker || applyRCTOnGen);
@@ -464,7 +434,7 @@ struct Cascqaanalysis {
464434
registry.fill(HIST("hNEvents"), 8.5);
465435
}
466436

467-
// Z vertex selection
437+
// z-vertex selection
468438
if (std::fabs(collision.posZ()) > cutzvertex) {
469439
return false;
470440
}
@@ -711,8 +681,8 @@ struct Cascqaanalysis {
711681
// All generated collisions
712682
registry.fill(HIST("hNEventsMC"), 0.5);
713683

714-
// Generated with accepted z vertex
715-
if (std::fabs(mcCollision.posZ()) > cutzvertex) {
684+
// Generated z-vertex selection
685+
if (cutzvertexGen >= 0.f && std::fabs(mcCollision.posZ()) > cutzvertexGen) {
716686
return;
717687
}
718688
registry.fill(HIST("hNEventsMC"), 1.5);

PWGLF/TableProducer/Strangeness/v0qaanalysis.cxx

Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "PWGLF/Utils/inelGt.h"
2121

2222
#include "Common/CCDB/EventSelectionParams.h"
23+
#include "Common/CCDB/RCTSelectionFlags.h"
2324
#include "Common/DataModel/Centrality.h"
2425
#include "Common/DataModel/EventSelection.h"
2526
#include "Common/DataModel/Multiplicity.h"
@@ -43,12 +44,14 @@
4344

4445
#include <TH1.h>
4546

47+
#include <string>
4648
#include <utility>
4749
#include <vector>
4850

4951
using namespace o2;
5052
using namespace o2::framework;
5153
using namespace o2::framework::expressions;
54+
using namespace o2::aod::rctsel;
5255

5356
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
5457
{
@@ -61,6 +64,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
6164
using DauTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::pidTPCPi, aod::pidTPCKa, aod::pidTPCPr, aod::pidTOFPi, aod::pidTOFPr>;
6265
using DauTracksMC = soa::Join<DauTracks, aod::McTrackLabels>;
6366
using V0Collisions = soa::Join<aod::Collisions, aod::EvSels, aod::PVMults, aod::CentFT0Ms, aod::CentNGlobals>;
67+
using BCsWithBcSels = soa::Join<aod::BCsWithTimestamps, aod::BcSels>;
6468

6569
struct LfV0qaanalysis {
6670

@@ -106,10 +110,12 @@ struct LfV0qaanalysis {
106110
registry.add("hCentFT0M_GenRecoColl_MC_INELgt0", "hCentFT0M_GenRecoColl_MC_INELgt0", {HistType::kTH1F, {{1000, 0.f, 100.f}}});
107111
registry.add("hCentFT0M_GenColl_MC", "hCentFT0M_GenColl_MC", {HistType::kTH1F, {{1000, 0.f, 100.f}}});
108112
registry.add("hCentFT0M_GenColl_MC_INELgt0", "hCentFT0M_GenColl_MC_INELgt0", {HistType::kTH1F, {{1000, 0.f, 100.f}}});
109-
registry.add("hNEventsMCGen", "hNEventsMCGen", {HistType::kTH1D, {{4, 0.f, 4.f}}});
113+
registry.add("hNEventsMCGen", "hNEventsMCGen", {HistType::kTH1D, {{5, 0.f, 5.f}}});
110114
registry.get<TH1>(HIST("hNEventsMCGen"))->GetXaxis()->SetBinLabel(1, "all");
111115
registry.get<TH1>(HIST("hNEventsMCGen"))->GetXaxis()->SetBinLabel(2, "zvertex_true");
112-
registry.get<TH1>(HIST("hNEventsMCGen"))->GetXaxis()->SetBinLabel(3, "INELgt0_true");
116+
registry.get<TH1>(HIST("hNEventsMCGen"))->GetXaxis()->SetBinLabel(3, "BC TF/ITS ROF border");
117+
registry.get<TH1>(HIST("hNEventsMCGen"))->GetXaxis()->SetBinLabel(4, "RCTFlagsChecker");
118+
registry.get<TH1>(HIST("hNEventsMCGen"))->GetXaxis()->SetBinLabel(5, "INELgt0_true");
113119
registry.add("hNEventsMCGenReco", "hNEventsMCGenReco", {HistType::kTH1D, {{2, 0.f, 2.f}}});
114120
registry.get<TH1>(HIST("hNEventsMCGenReco"))->GetXaxis()->SetBinLabel(1, "INEL");
115121
registry.get<TH1>(HIST("hNEventsMCGenReco"))->GetXaxis()->SetBinLabel(2, "INELgt0");
@@ -153,6 +159,7 @@ struct LfV0qaanalysis {
153159
registry.add("Generated_MCGenColl_INELgt0_Lambda", "Generated_MCGenColl_INELgt0_Lambda", {HistType::kTH2F, {{250, 0.f, 25.f}, {1000, 0.f, 100.f}}});
154160
registry.add("Generated_MCGenColl_INELgt0_AntiLambda", "Generated_MCGenColl_INELgt0_AntiLambda", {HistType::kTH2F, {{250, 0.f, 25.f}, {1000, 0.f, 100.f}}});
155161
}
162+
rctChecker.init(cfgEvtRCTFlagCheckerLabel, cfgEvtRCTFlagCheckerZDCCheck, cfgEvtRCTFlagCheckerLimitAcceptAsBad, applyRCTOnGen);
156163
registry.print();
157164
}
158165

@@ -164,11 +171,18 @@ struct LfV0qaanalysis {
164171
Configurable<bool> isTriggerTVX{"isTriggerTVX", 1, "Is Trigger TVX"};
165172
Configurable<bool> isNoTimeFrameBorder{"isNoTimeFrameBorder", 1, "Is No Time Frame Border"};
166173
Configurable<bool> isNoITSROFrameBorder{"isNoITSROFrameBorder", 1, "Is No ITS Readout Frame Border"};
174+
Configurable<bool> applyBcBorderCutsOnGen{"applyBcBorderCutsOnGen", false, "Apply enabled BC-level TF and ITS ROF border cuts on generated-level MC collisions"};
175+
Configurable<bool> applyRCTOnGen{"applyRCTOnGen", false, "Apply enabled BC-level RCT run-condition selection on generated-level MC collisions"};
167176
Configurable<bool> isVertexTOFmatched{"isVertexTOFmatched", 0, "Is Vertex TOF matched"};
168177
Configurable<bool> isNoSameBunchPileup{"isNoSameBunchPileup", 0, "isNoSameBunchPileup"};
178+
Configurable<std::string> cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"};
179+
Configurable<bool> cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"};
180+
Configurable<bool> cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", false, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"};
169181
Configurable<int> v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"};
170182
Configurable<bool> NotITSAfterburner{"NotITSAfterburner", 0, "NotITSAfterburner"};
171183

184+
RCTFlagsChecker rctChecker;
185+
172186
// V0 selection criteria
173187
Configurable<double> v0cospa{"v0cospa", 0.97, "V0 CosPA"};
174188
Configurable<float> dcav0dau{"dcav0dau", 10, "DCA V0 Daughters"};
@@ -214,6 +228,27 @@ struct LfV0qaanalysis {
214228
return true;
215229
}
216230

231+
template <typename TBC>
232+
bool acceptGeneratedEventBcBorderCuts(TBC const& bc)
233+
{
234+
if (!applyBcBorderCutsOnGen) {
235+
return true;
236+
}
237+
if (isNoTimeFrameBorder && !bc.selection_bit(aod::evsel::kNoTimeFrameBorder)) {
238+
return false;
239+
}
240+
if (isNoITSROFrameBorder && !bc.selection_bit(aod::evsel::kNoITSROFrameBorder)) {
241+
return false;
242+
}
243+
return true;
244+
}
245+
246+
template <typename TBC>
247+
bool acceptGeneratedEventRCT(TBC const& bc)
248+
{
249+
return !applyRCTOnGen || rctChecker(bc);
250+
}
251+
217252
Filter preFilterV0 = nabs(aod::v0data::dcapostopv) > dcapostopv&&
218253
nabs(aod::v0data::dcanegtopv) > dcanegtopv&& aod::v0data::dcaV0daughters < dcav0dau;
219254

@@ -230,7 +265,7 @@ struct LfV0qaanalysis {
230265
registry.fill(HIST("hCentFT0M"), collision.centFT0M());
231266
registry.fill(HIST("hCentNGlobals"), collision.centNGlobal());
232267

233-
for (auto& v0 : V0s) { // loop over V0s
268+
for (const auto& v0 : V0s) { // loop over V0s
234269

235270
if (v0.v0Type() != v0TypeSelection) {
236271
continue;
@@ -323,7 +358,7 @@ struct LfV0qaanalysis {
323358
}
324359

325360
auto v0sThisCollision = V0s.sliceBy(perCol, collision.globalIndex());
326-
for (auto& v0 : v0sThisCollision) { // loop over V0s
361+
for (const auto& v0 : v0sThisCollision) { // loop over V0s
327362

328363
if (!v0.has_mcParticle()) {
329364
continue;
@@ -371,8 +406,8 @@ struct LfV0qaanalysis {
371406
lPDG = v0mcparticle.pdgCode();
372407
isprimary = v0mcparticle.isPhysicalPrimary();
373408
}
374-
for (auto& mcparticleDaughter0 : v0mcparticle.daughters_as<aod::McParticles>()) {
375-
for (auto& mcparticleDaughter1 : v0mcparticle.daughters_as<aod::McParticles>()) {
409+
for (const auto& mcparticleDaughter0 : v0mcparticle.daughters_as<aod::McParticles>()) {
410+
for (const auto& mcparticleDaughter1 : v0mcparticle.daughters_as<aod::McParticles>()) {
376411
if (mcparticleDaughter0.pdgCode() == 211 && mcparticleDaughter1.pdgCode() == -211) {
377412
isDauK0Short = true;
378413
}
@@ -389,7 +424,7 @@ struct LfV0qaanalysis {
389424
float pdgMother = 0.;
390425

391426
if (std::abs(v0mcparticle.pdgCode()) == 3122 && v0mcparticle.has_mothers()) {
392-
for (auto& mcparticleMother0 : v0mcparticle.mothers_as<aod::McParticles>()) {
427+
for (const auto& mcparticleMother0 : v0mcparticle.mothers_as<aod::McParticles>()) {
393428
if (std::abs(mcparticleMother0.pdgCode()) == 3312 || std::abs(mcparticleMother0.pdgCode()) == 3322) {
394429
ptMotherMC = mcparticleMother0.pt();
395430
pdgMother = mcparticleMother0.pdgCode();
@@ -435,7 +470,7 @@ struct LfV0qaanalysis {
435470
// Generated particles
436471
const auto particlesInCollision = mcParticles.sliceByCached(aod::mcparticle::mcCollisionId, mcCollision.globalIndex(), cache1);
437472

438-
for (auto& mcParticle : particlesInCollision) {
473+
for (const auto& mcParticle : particlesInCollision) {
439474
if (!mcParticle.isPhysicalPrimary()) {
440475
continue;
441476
}
@@ -469,7 +504,8 @@ struct LfV0qaanalysis {
469504

470505
void processMCGen(soa::Join<aod::McCollisions, aod::McCentFT0Ms>::iterator const& mcCollision,
471506
aod::McParticles const& mcParticles,
472-
soa::SmallGroups<soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::PVMults>> const& collisions)
507+
soa::SmallGroups<soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::PVMults>> const& collisions,
508+
BCsWithBcSels const&)
473509
{
474510
//====================================
475511
//===== Event Loss Denominator =======
@@ -481,21 +517,30 @@ struct LfV0qaanalysis {
481517
return;
482518
}
483519
registry.fill(HIST("hNEventsMCGen"), 1.5);
520+
const auto bc = mcCollision.bc_as<BCsWithBcSels>();
521+
if (!acceptGeneratedEventBcBorderCuts(bc)) {
522+
return;
523+
}
524+
registry.fill(HIST("hNEventsMCGen"), 2.5);
525+
if (!acceptGeneratedEventRCT(bc)) {
526+
return;
527+
}
528+
registry.fill(HIST("hNEventsMCGen"), 3.5);
484529
registry.fill(HIST("hCentFT0M_GenColl_MC"), mcCollision.centFT0M());
485530

486531
bool isINELgt0true = false;
487532

488533
if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) {
489534
isINELgt0true = true;
490-
registry.fill(HIST("hNEventsMCGen"), 2.5);
535+
registry.fill(HIST("hNEventsMCGen"), 4.5);
491536
registry.fill(HIST("hCentFT0M_GenColl_MC_INELgt0"), mcCollision.centFT0M());
492537
}
493538

494539
//=====================================
495540
//===== Signal Loss Denominator =======
496541
//=====================================
497542

498-
for (auto& mcParticle : mcParticles) {
543+
for (const auto& mcParticle : mcParticles) {
499544

500545
if (!mcParticle.isPhysicalPrimary()) {
501546
continue;
@@ -526,7 +571,7 @@ struct LfV0qaanalysis {
526571

527572
int recoCollIndex_INEL = 0;
528573
int recoCollIndex_INELgt0 = 0;
529-
for (auto& collision : collisions) { // loop on reconstructed collisions
574+
for (const auto& collision : collisions) { // loop on reconstructed collisions
530575

531576
//=====================================
532577
//====== Event Split Numerator ========
@@ -553,7 +598,7 @@ struct LfV0qaanalysis {
553598
//======== Sgn Split Numerator ========
554599
//=====================================
555600

556-
for (auto& mcParticle : mcParticles) {
601+
for (const auto& mcParticle : mcParticles) {
557602

558603
if (!mcParticle.isPhysicalPrimary()) {
559604
continue;
@@ -605,7 +650,7 @@ struct LfV0qaanalysis {
605650
//===== Signal Loss Numerator =========
606651
//=====================================
607652

608-
for (auto& mcParticle : mcParticles) {
653+
for (const auto& mcParticle : mcParticles) {
609654

610655
if (!mcParticle.isPhysicalPrimary()) {
611656
continue;
@@ -682,7 +727,7 @@ struct LfMyV0s {
682727

683728
void process(aod::MyV0Candidates const& myv0s)
684729
{
685-
for (auto& candidate : myv0s) {
730+
for (const auto& candidate : myv0s) {
686731

687732
registry.fill(HIST("hMassLambda"), candidate.masslambda());
688733
registry.fill(HIST("hPt"), candidate.v0pt());

0 commit comments

Comments
 (0)