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
62 changes: 45 additions & 17 deletions PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <TFile.h>
#include <TH2D.h>
#include <TProfile.h>
#include <TLorentzVector.h>

Check failure on line 43 in PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
#include <TPDGCode.h>

#include "Framework/runDataProcessing.h"
Expand Down Expand Up @@ -83,6 +83,14 @@
#define BITSET(var, nbit) ((var) |= (static_cast<uint64_t>(1) << static_cast<uint64_t>(nbit)))
#define BITCHECK(var, nbit) ((var) & (static_cast<uint64_t>(1) << static_cast<uint64_t>(nbit)))

enum CentEstimator {
kCentFT0C = 0,
kCentFT0M,
kCentFT0CVariant1,
kCentMFT,
kCentNGlobal
};

struct derivedlambdakzeroanalysis {
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};

Expand All @@ -96,6 +104,7 @@

Configurable<bool> doPPAnalysis{"doPPAnalysis", false, "if in pp, set to true"};
Configurable<std::string> irSource{"irSource", "T0VTX", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
Configurable<int> centralityEstimator{"centralityEstimator", kCentFT0C, "Run 3 centrality estimator (0:CentFT0C, 1:CentFT0M, 3:CentFT0CVariant1, 4:CentMFT, 5:CentNGlobal)"};

struct : ConfigurableGroup {
Configurable<bool> requireSel8{"requireSel8", true, "require sel8 event selection"};
Expand Down Expand Up @@ -273,7 +282,7 @@
ConfigurableAxis axisPtCoarse{"axisPtCoarse", {VARIABLE_WIDTH, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 7.0f, 10.0f, 15.0f}, "pt axis for QA"};
ConfigurableAxis axisK0Mass{"axisK0Mass", {200, 0.4f, 0.6f}, ""};
ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, ""};
ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, "Centrality"};
ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, "Centrality (%)"};
ConfigurableAxis axisNch{"axisNch", {500, 0.0f, +5000.0f}, "Number of charged particles"};
ConfigurableAxis axisIRBinning{"axisIRBinning", {500, 0, 50}, "Binning for the interaction rate (kHz)"};

Expand Down Expand Up @@ -971,6 +980,25 @@
histos.print();
}

// ______________________________________________________
// Return slicing output
template <typename TCollision>
auto getCentralityRun3(TCollision const& collision)
{
if (centralityEstimator == kCentFT0C)
return collision.centFT0C();
else if (centralityEstimator == kCentFT0M)
return collision.centFT0M();
else if (centralityEstimator == kCentFT0CVariant1)
return collision.centFT0CVariant1();
else if (centralityEstimator == kCentMFT)
return collision.centMFT();
else if (centralityEstimator == kCentNGlobal)
return collision.centNGlobal();

return -1.f;
}

// ______________________________________________________
// Return slicing output
template <bool run3, typename TCollisions>
Expand Down Expand Up @@ -1073,34 +1101,34 @@

// TOF PID in DeltaT
// Positive track
if (std::fabs(v0.posTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton)
if (!posTrackExtra.hasTOF() || std::fabs(v0.posTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton)
BITSET(bitMap, selTOFDeltaTPositiveProtonLambda);
if (std::fabs(v0.posTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion)
if (!posTrackExtra.hasTOF() || std::fabs(v0.posTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion)
BITSET(bitMap, selTOFDeltaTPositivePionLambda);
if (std::fabs(v0.posTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion)
if (!posTrackExtra.hasTOF() || std::fabs(v0.posTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion)
BITSET(bitMap, selTOFDeltaTPositivePionK0Short);
// Negative track
if (std::fabs(v0.negTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton)
if (!negTrackExtra.hasTOF() || std::fabs(v0.negTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton)
BITSET(bitMap, selTOFDeltaTNegativeProtonLambda);
if (std::fabs(v0.negTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion)
if (!negTrackExtra.hasTOF() || std::fabs(v0.negTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion)
BITSET(bitMap, selTOFDeltaTNegativePionLambda);
if (std::fabs(v0.negTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion)
if (!negTrackExtra.hasTOF() || std::fabs(v0.negTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion)
BITSET(bitMap, selTOFDeltaTNegativePionK0Short);

// TOF PID in NSigma
// Positive track
if (std::fabs(v0.tofNSigmaLaPr()) < v0Selections.tofPidNsigmaCutLaPr)
if (!posTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaLaPr()) < v0Selections.tofPidNsigmaCutLaPr)
BITSET(bitMap, selTOFNSigmaPositiveProtonLambda);
if (std::fabs(v0.tofNSigmaALaPi()) < v0Selections.tofPidNsigmaCutLaPi)
if (!posTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaALaPi()) < v0Selections.tofPidNsigmaCutLaPi)
BITSET(bitMap, selTOFNSigmaPositivePionLambda);
if (std::fabs(v0.tofNSigmaK0PiPlus()) < v0Selections.tofPidNsigmaCutK0Pi)
if (!posTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaK0PiPlus()) < v0Selections.tofPidNsigmaCutK0Pi)
BITSET(bitMap, selTOFNSigmaPositivePionK0Short);
// Negative track
if (std::fabs(v0.tofNSigmaALaPr()) < v0Selections.tofPidNsigmaCutLaPr)
if (!negTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaALaPr()) < v0Selections.tofPidNsigmaCutLaPr)
BITSET(bitMap, selTOFNSigmaNegativeProtonLambda);
if (std::fabs(v0.tofNSigmaLaPi()) < v0Selections.tofPidNsigmaCutLaPi)
if (!negTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaLaPi()) < v0Selections.tofPidNsigmaCutLaPi)
BITSET(bitMap, selTOFNSigmaNegativePionLambda);
if (std::fabs(v0.tofNSigmaK0PiMinus()) < v0Selections.tofPidNsigmaCutK0Pi)
if (!negTrackExtra.hasTOF() || std::fabs(v0.tofNSigmaK0PiMinus()) < v0Selections.tofPidNsigmaCutK0Pi)
BITSET(bitMap, selTOFNSigmaNegativePionK0Short);

// ITS only tag
Expand Down Expand Up @@ -1133,22 +1161,22 @@
// precalculate this information so that a check is one mask operation, not many
{
uint64_t bitMap = 0;
bool isPositiveProton = v0.pdgCodePositive() == 2212;

Check failure on line 1164 in PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
bool isPositivePion = v0.pdgCodePositive() == 211 || (doTreatPiToMuon && v0.pdgCodePositive() == -13);

Check failure on line 1165 in PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
bool isNegativeProton = v0.pdgCodeNegative() == -2212;

Check failure on line 1166 in PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
bool isNegativePion = v0.pdgCodeNegative() == -211 || (doTreatPiToMuon && v0.pdgCodeNegative() == 13);

Check failure on line 1167 in PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.

if (v0.pdgCode() == 310 && isPositivePion && isNegativePion) {

Check failure on line 1169 in PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
BITSET(bitMap, selConsiderK0Short);
if (v0.isPhysicalPrimary())
BITSET(bitMap, selPhysPrimK0Short);
}
if (v0.pdgCode() == 3122 && isPositiveProton && isNegativePion) {

Check failure on line 1174 in PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
BITSET(bitMap, selConsiderLambda);
if (v0.isPhysicalPrimary())
BITSET(bitMap, selPhysPrimLambda);
}
if (v0.pdgCode() == -3122 && isPositivePion && isNegativeProton) {

Check failure on line 1179 in PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
BITSET(bitMap, selConsiderAntiLambda);
if (v0.isPhysicalPrimary())
BITSET(bitMap, selPhysPrimAntiLambda);
Expand Down Expand Up @@ -1709,11 +1737,11 @@

// __________________________________________
if (verifyMask(selMap, secondaryMaskSelectionLambda) && analyseLambda) {
if (v0mother.pdgCode() == 3312 && v0mother.isPhysicalPrimary())

Check failure on line 1740 in PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
histos.fill(HIST("h3dLambdaFeeddown"), centrality, pt, std::hypot(v0mother.px(), v0mother.py()));
}
if (verifyMask(selMap, secondaryMaskSelectionAntiLambda) && analyseAntiLambda) {
if (v0mother.pdgCode() == -3312 && v0mother.isPhysicalPrimary())

Check failure on line 1744 in PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
histos.fill(HIST("h3dAntiLambdaFeeddown"), centrality, pt, std::hypot(v0mother.px(), v0mother.py()));
}
}
Expand Down Expand Up @@ -2016,7 +2044,7 @@
void fillReconstructedEventProperties(TCollision const& collision, float& centrality, float& collisionOccupancy, double& interactionRate, int& gapSide, int& selGapSide)
{
if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3
centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C();
centrality = getCentralityRun3(collision);
collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange();
// Fetch interaction rate only if required (in order to limit ccdb calls)
interactionRate = !irSource.value.empty() ? rateFetcher.fetch(ccdb.service, collision.timestamp(), collision.runNumber(), irSource) * 1.e-3 : -1;
Expand Down Expand Up @@ -2098,7 +2126,7 @@
if constexpr (run3) { // check if we are in Run 3
if (biggestNContribs < collision.multPVTotalContributors()) {
biggestNContribs = collision.multPVTotalContributors();
centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C();
centrality = getCentralityRun3(collision);
}
} else { // we are in Run 2: there should be only one collision in groupedCollisions
centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M();
Expand Down Expand Up @@ -2337,7 +2365,7 @@
if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) {
auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]);
if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3
centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C();
centrality = getCentralityRun3(collision);
} else { // no, we are in Run 2
centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M();
}
Expand Down Expand Up @@ -2402,7 +2430,7 @@
if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) {
auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]);
if constexpr (requires { collision.centFT0C(); }) { // check if we are in Run 3
centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C();
centrality = getCentralityRun3(collision);
} else { // no, we are in Run 2
centrality = eventSelections.useSPDTrackletsCent ? collision.centRun2SPDTracklets() : collision.centRun2V0M();
}
Expand Down
Loading