Skip to content
Merged
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
95 changes: 93 additions & 2 deletions PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,31 @@
};

static const std::vector<std::string> centDetectorNames{"FV0A", "FT0M", "FT0A", "FT0C"};

enum evSel {
kTVX = 0,
kZvtx,
kTFborder,
kITSROFborder,
kNoSameBunchPileup,
kIsGoodZvtxFT0vsPV,
kIsGoodITSLayersAll,
kIsEPtriggered,
kNevSels
};

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

constexpr int EvSelDefault[8][1]{
{1},
{1},
{0},
{0},
{0},
{0},
{0},
{0}};
} // namespace nuclei

struct nucleiSpectra {
Expand Down Expand Up @@ -263,6 +288,8 @@
Configurable<float> cfgCutPtMinTree{"cfgCutPtMinTree", 0.2f, "Minimum track transverse momentum for tree saving"};
Configurable<float> cfgCutPtMaxTree{"cfgCutPtMaxTree", 15.0f, "Maximum track transverse momentum for tree saving"};

Configurable<LabeledArray<int>> cfgEventSelections{"cfgEventSelections", {nuclei::EvSelDefault[0], 8, 1, nuclei::eventSelectionLabels, nuclei::eventSelectionTitle}, "Event selections"};

Configurable<LabeledArray<double>> cfgMomentumScalingBetheBloch{"cfgMomentumScalingBetheBloch", {nuclei::bbMomScalingDefault[0], 5, 2, nuclei::names, nuclei::chargeLabelNames}, "TPC Bethe-Bloch momentum scaling for light nuclei"};
Configurable<LabeledArray<double>> cfgBetheBlochParams{"cfgBetheBlochParams", {nuclei::betheBlochDefault[0], 5, 6, nuclei::names, nuclei::betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"};
Configurable<LabeledArray<double>> cfgNsigmaTPC{"cfgNsigmaTPC", {nuclei::nSigmaTPCdefault[0], 5, 2, nuclei::names, nuclei::nSigmaConfigName}, "TPC nsigma selection for light nuclei"};
Expand Down Expand Up @@ -333,7 +360,7 @@
float dauVtx[3]{0.f, 0.f, 0.f};
auto daughters = particle.daughters_as<aod::McParticles>();
for (const auto& dau : daughters) {
if (abs(dau.pdgCode()) != 22 && abs(dau.pdgCode()) != 11) {

Check warning on line 363 in PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
dauVtx[0] = dau.vx();
dauVtx[1] = dau.vy();
dauVtx[2] = dau.vz();
Expand All @@ -354,6 +381,59 @@
return collision.selection_bit(aod::evsel::kIsTriggerTVX) && collision.posZ() > -cfgCutVertex && collision.posZ() < cfgCutVertex && collision.selection_bit(aod::evsel::kNoTimeFrameBorder);
}

template <class Tcoll>
bool eventSelectionWithHisto(Tcoll& collision)
{
spectra.fill(HIST("hEventSelections"), 0);

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

if (cfgEventSelections->get(nuclei::evSel::kZvtx) && std::abs(collision.posZ()) > cfgCutVertex) {
return false;
}
spectra.fill(HIST("hEventSelections"), nuclei::evSel::kZvtx + 1);

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

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

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

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

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

if constexpr (
requires {
collision.triggereventep();
}) {
if (cfgEventSelections->get(nuclei::evSel::kIsEPtriggered) && !collision.triggereventep()) {
return false;
}
spectra.fill(HIST("hEventSelections"), nuclei::evSel::kIsEPtriggered + 1);
}

return true;
}

void initCCDB(aod::BCsWithTimestamps::iterator const& bc)
{
if (mRunNumber == bc.runNumber()) {
Expand Down Expand Up @@ -414,6 +494,17 @@
{cfgDCAxyBinsAlpha, "DCA_{z} (cm)"}};
const AxisSpec etaAxis{40, -1., 1., "#eta"};

spectra.add("hEventSelections", "hEventSelections", {HistType::kTH1I, {{nuclei::evSel::kNevSels + 1, -0.5f, float(nuclei::evSel::kNevSels) + 0.5f}}});
spectra.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(1, "all");
spectra.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(nuclei::evSel::kTVX + 2, "TVX");
spectra.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(nuclei::evSel::kZvtx + 2, "Zvtx");
spectra.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(nuclei::evSel::kTFborder + 2, "TFborder");
spectra.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(nuclei::evSel::kITSROFborder + 2, "ITSROFborder");
spectra.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(nuclei::evSel::kNoSameBunchPileup + 2, "kNoSameBunchPileup");
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.add("hRecVtxZData", "collision z position", HistType::kTH1F, {{200, -20., +20., "z position (cm)"}});
if (doprocessMC) {
spectra.add("hGenVtxZ", " generated collision z position", HistType::kTH1F, {{200, -20., +20., "z position (cm)"}});
Expand Down Expand Up @@ -523,7 +614,7 @@
{nuclei::charges[4] * cfgMomentumScalingBetheBloch->get(3u, 0u) / nuclei::masses[4], nuclei::charges[4] * cfgMomentumScalingBetheBloch->get(3u, 1u) / nuclei::masses[4]}};

int nGloTracks[2]{0, 0}, nTOFTracks[2]{0, 0};
for (auto& track : tracks) { // start loop over tracks

Check warning on line 617 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
if (std::abs(track.eta()) > cfgCutEta ||
track.tpcInnerParam() < cfgCutTpcMom ||
track.itsNCls() < cfgCutNclusITS ||
Expand Down Expand Up @@ -741,7 +832,7 @@
}

fillDataInfo(collision, tracks);
for (auto& c : nuclei::candidates) {

Check warning on line 835 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
if (c.fillTree) {
nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS);
}
Expand All @@ -760,14 +851,14 @@
{
nuclei::candidates.clear();
nuclei::candidates_flow.clear();
if (!eventSelection(collision)) {
if (!eventSelectionWithHisto(collision)) {
return;
}
if (!collision.triggereventep() || !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) {
return;
}
fillDataInfo(collision, tracks);
for (auto& c : nuclei::candidates) {

Check warning on line 861 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
if (c.fillTree) {
nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS);
}
Expand All @@ -779,7 +870,7 @@
}
}
}
for (auto& c : nuclei::candidates_flow) {

Check warning on line 873 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
nucleiTableFlow(c.centFV0A, c.centFT0M, c.centFT0A, c.centFT0C, c.psiFT0A, c.psiFT0C, c.psiTPC, c.psiTPCl, c.psiTPCr, c.qFT0A, c.qFT0C, c.qTPC, c.qTPCl, c.qTPCr);
}
}
Expand All @@ -789,14 +880,14 @@
{
nuclei::candidates.clear();
nuclei::candidates_flow.clear();
if (!eventSelection(collision)) {
if (!eventSelectionWithHisto(collision)) {
return;
}
if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) {
return;
}
fillDataInfo(collision, tracks);
for (auto& c : nuclei::candidates) {

Check warning on line 890 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
if (c.fillTree) {
nucleiTable(c.pt, c.eta, c.phi, c.tpcInnerParam, c.beta, c.zVertex, c.DCAxy, c.DCAz, c.TPCsignal, c.ITSchi2, c.TPCchi2, c.TOFchi2, c.flags, c.TPCfindableCls, c.TPCcrossedRows, c.ITSclsMap, c.TPCnCls, c.TPCnClsShared, c.clusterSizesITS);
}
Expand All @@ -808,7 +899,7 @@
}
}
}
for (auto& c : nuclei::candidates_flow) {

Check warning on line 902 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
nucleiTableFlow(c.centFV0A, c.centFT0M, c.centFT0A, c.centFT0C, c.psiFT0A, c.psiFT0C, c.psiTPC, c.psiTPCl, c.psiTPCr, c.qFT0A, c.qFT0C, c.qTPC, c.qTPCl, c.qTPCr);
}
}
Expand All @@ -818,11 +909,11 @@
void processMC(soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels> const& collisions, aod::McCollisions const& mcCollisions, soa::Join<TrackCandidates, aod::McTrackLabels> const& tracks, aod::McParticles const& particlesMC, aod::BCsWithTimestamps const&)
{
nuclei::candidates.clear();
for (auto& c : mcCollisions) {

Check warning on line 912 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
spectra.fill(HIST("hGenVtxZ"), c.posZ());
}
std::vector<bool> goodCollisions(mcCollisions.size(), false);
for (auto& collision : collisions) {

Check warning on line 916 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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.
if (!eventSelection(collision)) {
continue;
}
Expand All @@ -831,7 +922,7 @@
fillDataInfo(collision, slicedTracks);
}
std::vector<bool> isReconstructed(particlesMC.size(), false);
for (auto& c : nuclei::candidates) {

Check warning on line 925 in PWGLF/TableProducer/Nuspex/nucleiSpectra.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