Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions PWGLF/TableProducer/Nuspex/deuteronInTriggeredEvents.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
// same as Data and o2-analysis-mccollision-converter

#include "PWGLF/DataModel/LFSlimNucleiTables.h"
#include "PWGLF/Utils/inelGt.h"
//
#include "PWGJE/Core/JetBkgSubUtils.h"
#include "PWGJE/Core/JetUtilities.h"
Expand Down Expand Up @@ -57,6 +58,7 @@
#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisTask.h>
#include <Framework/HistogramRegistry.h>
#include <Framework/O2DatabasePDGPlugin.h>
#include <Framework/runDataProcessing.h>
#include <MathUtils/BetheBlochAleph.h>
#include <ReconstructionDataFormats/Track.h>
Expand Down Expand Up @@ -205,14 +207,15 @@
kIsGoodZvtxFT0vsPV,
kIsGoodITSLayersAll,
kIsEPtriggered,
kINELgt0,
kIsJetTriggered, // Check: evSel for event with at least one jet over pT-threshold
kNevSels
};

static const std::vector<std::string> eventSelectionTitle{"Event selections"};
static const std::vector<std::string> eventSelectionLabels{"TVX", "TF border", "ITS ROF border", "Z vtx", "No same-bunch pile-up", "kIsGoodZvtxFT0vsPV", "isGoodITSLayersAll", "isEPtriggered", "IsJetTriggered"};
static const std::vector<std::string> eventSelectionLabels{"TVX", "TF border", "ITS ROF border", "Z vtx", "No same-bunch pile-up", "kIsGoodZvtxFT0vsPV", "isGoodITSLayersAll", "isEPtriggered", "IsINELgt0", "IsJetTriggered"};

constexpr int EvSelDefault[9][1]{
constexpr int EvSelDefault[10][1]{
{1},
{1},
{1}, // Default: sel8
Expand All @@ -221,11 +224,13 @@
{0},
{0},
{0},
{0}, // INEL > 0
{1}}; // Triggered on jets

enum evGenSel : uint8_t {
kGenIsJetTriggered = 1 << 0,
kGenHasRecoEv = 1 << 1
kGenIsINELgt0 = 1 << 0,
kGenIsJetTriggered = 1 << 1,
kGenHasRecoEv = 1 << 2
};

enum triggerListName {
Expand Down Expand Up @@ -254,7 +259,8 @@
Produces<o2::aod::NucleiTableMCExtension> nucleiTableMCExtension; // For MC analysis
Produces<o2::aod::GenEventMCSel> GenEventMCSel; // For MC reco events
Service<o2::ccdb::BasicCCDBManager> ccdb;
Zorro zorro; // Definition of Zorro: helpful for skimmed data
Service<o2::framework::O2DatabasePDG> pdgDB; // For INELgt0 gen MC selection
Zorro zorro; // Definition of Zorro: helpful for skimmed data
OutputObj<ZorroSummary> zorroSummary{"zorroSummary"};

Configurable<bool> cfgCompensatePIDinTracking{"cfgCompensatePIDinTracking", false, "If true, divide tpcInnerParam by the electric charge"};
Expand All @@ -280,7 +286,7 @@
Configurable<float> cfgCutPtMaxTree{"cfgCutPtMaxTree", 15.0f, "Maximum track transverse momentum for tree saving"};

// Event selections
Configurable<LabeledArray<int>> cfgEventSelections{"cfgEventSelections", {nuclei::EvSelDefault[0], 9, 1, nuclei::eventSelectionLabels, nuclei::eventSelectionTitle}, "Event selections"};
Configurable<LabeledArray<int>> cfgEventSelections{"cfgEventSelections", {nuclei::EvSelDefault[0], 10, 1, nuclei::eventSelectionLabels, nuclei::eventSelectionTitle}, "Event selections"};
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};

Configurable<LabeledArray<double>> cfgMomentumScalingBetheBloch{"cfgMomentumScalingBetheBloch", {nuclei::bbMomScalingDefault[0], 5, 2, nuclei::names, nuclei::chargeLabelNames}, "TPC Bethe-Bloch momentum scaling for light nuclei"};
Expand Down Expand Up @@ -409,6 +415,11 @@
spectra.fill(HIST("hEventSelections"), nuclei::evSel::kIsEPtriggered + 1);
}

if (cfgEventSelections->get(nuclei::evSel::kINELgt0) && !collision.selection_bit(aod::kINELgtZERO)) {
return false;
}
spectra.fill(HIST("hEventSelections"), nuclei::evSel::kINELgt0 + 1);

auto bc = collision.template bc_as<aod::BCsWithTimestamps>();
initCCDB(bc);

Expand Down Expand Up @@ -494,6 +505,7 @@
spectra.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(nuclei::evSel::kIsGoodZvtxFT0vsPV + 2, "isGoodZvtxFT0vsPV");
spectra.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(nuclei::evSel::kIsGoodITSLayersAll + 2, "IsGoodITSLayersAll");
spectra.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(nuclei::evSel::kIsEPtriggered + 2, "IsEPtriggered");
spectra.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(nuclei::evSel::kINELgt0 + 2, "IsINELgt0");
spectra.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(nuclei::evSel::kIsJetTriggered + 2, "IsJetTriggered");

// Distribution of z-vertex of selected events
Expand Down Expand Up @@ -943,8 +955,11 @@
auto mcParticlesPerColl = particlesMC.sliceBy(perMcCollision, c.globalIndex());
auto& mask = eventMask[c.globalIndex()];

if (o2::pwglf::isINELgt0mc(mcParticlesPerColl, pdgDB))
mask |= nuclei::kGenIsINELgt0;

if (isMCJetTriggered(mcParticlesPerColl, particlesMC, trigger))
mask |= nuclei::kIsJetTriggered;
mask |= nuclei::kGenIsJetTriggered;
}

for (const auto& collision : collisions) {
Expand All @@ -971,12 +986,15 @@
auto& mask = eventMask[mcId];
mask |= nuclei::kGenHasRecoEv;

GenEventMCSel(mask);
fillDataInfo(collision, slicedTracks);
}

for (const auto& c : mcCollisions) {
GenEventMCSel(eventMask[c.globalIndex()]);
}

std::vector<bool> isReconstructed(particlesMC.size(), false);
for (auto& c : nuclei::candidates) {

Check failure on line 997 in PWGLF/TableProducer/Nuspex/deuteronInTriggeredEvents.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
auto label = tracks.iteratorAt(c.globalIndex);
if (label.mcParticleId() < -1 || label.mcParticleId() >= particlesMC.size()) {
continue;
Expand Down
Loading