Skip to content
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
245 changes: 127 additions & 118 deletions PWGLF/Tasks/Nuspex/spectraTOF.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
} trkselOptions;

Configurable<bool> enableDcaGoodEvents{"enableDcaGoodEvents", true, "Enables the MC plots with the correct match between data and MC"};
Configurable<bool> enablePureDCAHistogram{"enablePureDCAHistogram", false, "Enables the pure DCA histograms"};
Configurable<bool> enableTrackCutHistograms{"enableTrackCutHistograms", true, "Enables track cut histograms, before and after the cut"};
Configurable<bool> enableDeltaHistograms{"enableDeltaHistograms", true, "Enables the delta TPC and TOF histograms"};
Configurable<bool> enableTPCTOFHistograms{"enableTPCTOFHistograms", true, "Enables TPC TOF histograms"};
Expand Down Expand Up @@ -1017,7 +1018,6 @@
}
}
}

if constexpr (fillFullInfo) {
if (enableDeltaHistograms) {
const auto& deltaTOF = o2::aod::pidutils::tofExpSignalDiff<id>(track);
Expand All @@ -1036,7 +1036,6 @@
}
}
}

// Filling DCA info with the TPC+TOF PID
bool isDCAPureSample = (std::sqrt(nsigmaTOF * nsigmaTOF + nsigmaTPC * nsigmaTPC) < 2.f);
if (track.pt() <= 0.4) {
Expand All @@ -1060,23 +1059,23 @@
}
}
}
} else {
if (track.sign() > 0) {
histos.fill(HIST(hdcaxy[id]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcaz[id]), track.pt(), track.dcaZ());
if (isInPtRangeForPhi) {
if (enableDCAxyphiHistograms) {
histos.fill(HIST(hdcaxyphi[id]), track.phi(), track.dcaXY());
}
}
} else {
histos.fill(HIST(hdcaxy[id + Np]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcaz[id + Np]), track.pt(), track.dcaZ());
if (isInPtRangeForPhi) {
if (enableDCAxyphiHistograms) {
histos.fill(HIST(hdcaxyphi[id + Np]), track.phi(), track.dcaXY());
}
}
}
}
const bool isInPtRangeForPhi = track.pt() < 1.1f && track.pt() > 0.9f;
if (track.sign() > 0) {
histos.fill(HIST(hdcaxy[id]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcaz[id]), track.pt(), track.dcaZ());
if (isInPtRangeForPhi) {
if (enableDCAxyphiHistograms) {
histos.fill(HIST(hdcaxyphi[id]), track.phi(), track.dcaXY());
}
}
} else {
histos.fill(HIST(hdcaxy[id + Np]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcaz[id + Np]), track.pt(), track.dcaZ());
if (isInPtRangeForPhi) {
if (enableDCAxyphiHistograms) {
histos.fill(HIST(hdcaxyphi[id + Np]), track.phi(), track.dcaXY());
}
}
}
Expand Down Expand Up @@ -1206,7 +1205,7 @@
return false;
}
}
return (std::abs(track.dcaXY()) <= (maxDcaXYFactor.value * (0.0105f + 0.0350f / pow(track.pt(), 1.1f))));

Check failure on line 1208 in PWGLF/Tasks/Nuspex/spectraTOF.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
}
return track.isGlobalTrack();
}
Expand Down Expand Up @@ -1491,9 +1490,9 @@
if (mcParticle.isPhysicalPrimary()) {
if (isTPCPion && rapidityPi <= trkselOptions.cfgCutY) {
if (usePDGcode) {
if (pdgCode == 211) {

Check failure on line 1493 in PWGLF/Tasks/Nuspex/spectraTOF.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("nsigmatpc/mc_closure/pos/pi"), track.pt(), nsigmaTPCPi, multiplicity);
} else if (pdgCode == -211) {

Check failure on line 1495 in PWGLF/Tasks/Nuspex/spectraTOF.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("nsigmatpc/mc_closure/neg/pi"), track.pt(), nsigmaTPCPi, multiplicity);
}
} else {
Expand All @@ -1503,9 +1502,9 @@
}
if (isTPCKaon && rapidityKa <= trkselOptions.cfgCutY) {
if (usePDGcode) {
if (pdgCode == 321) {

Check failure on line 1505 in PWGLF/Tasks/Nuspex/spectraTOF.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("nsigmatpc/mc_closure/pos/ka"), track.pt(), nsigmaTPCKa, multiplicity);
} else if (pdgCode == -321) {

Check failure on line 1507 in PWGLF/Tasks/Nuspex/spectraTOF.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("nsigmatpc/mc_closure/neg/ka"), track.pt(), nsigmaTPCKa, multiplicity);
}
} else {
Expand All @@ -1515,9 +1514,9 @@
}
if (isTPCProton && rapidityPr <= trkselOptions.cfgCutY) {
if (usePDGcode) {
if (pdgCode == 2212) {

Check failure on line 1517 in PWGLF/Tasks/Nuspex/spectraTOF.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("nsigmatpc/mc_closure/pos/pr"), track.pt(), nsigmaTPCPr, multiplicity);
} else if (pdgCode == -2212) {

Check failure on line 1519 in PWGLF/Tasks/Nuspex/spectraTOF.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("nsigmatpc/mc_closure/neg/pr"), track.pt(), nsigmaTPCPr, multiplicity);
}
} else {
Expand All @@ -1529,9 +1528,9 @@
// TOF Selection and Histogram Filling
if (isTOFPion && rapidityPi <= trkselOptions.cfgCutY) {
if (usePDGcode) {
if (pdgCode == 211) {

Check failure on line 1531 in PWGLF/Tasks/Nuspex/spectraTOF.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("nsigmatof/mc_closure/pos/pi"), track.pt(), nsigmaTOFPi, multiplicity);
} else if (pdgCode == -211) {

Check failure on line 1533 in PWGLF/Tasks/Nuspex/spectraTOF.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("nsigmatof/mc_closure/neg/pi"), track.pt(), nsigmaTOFPi, multiplicity);
}
} else {
Expand Down Expand Up @@ -1595,7 +1594,7 @@
for (const auto& track : tracks) {
// Track selection criteria
/* if (track.tpcNClsCrossedRows() < minNCrossedRowsTPC || track.tpcChi2NCl() > maxChi2PerClusterTPC || track.tpcChi2NCl() > maxChi2PerClusterTPC ||
track.itsChi2NCl() > maxChi2PerClusterITS || std::abs(track.dcaXY()) > maxDcaXYFactor.value * (0.0105f + 0.0350f / pow(track.pt(), 1.1f)) || std::abs(track.dcaZ()) > maxDcaZ.value || track.eta() < trkselOptions.cfgCutEtaMin || track.eta() > trkselOptions.cfgCutEtaMax || track.tpcCrossedRowsOverFindableCls() < minNCrossedRowsOverFindableClustersTPC || track.tpcNClsFound() < minTPCNClsFound ||

Check failure on line 1597 in PWGLF/Tasks/Nuspex/spectraTOF.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
!(o2::aod::track::ITSrefit) || !(o2::aod::track::TPCrefit)) {
continue;
}*/
Expand Down Expand Up @@ -1912,124 +1911,134 @@

const auto& nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3>(track);
const bool isKaonTOF = std::abs(nsigmaTOFKa) < trkselOptions.cfgCutNsigma;

// Filling DCA info with the TPC+TOF PID
bool isDCAPureSample = (std::sqrt(nsigmaTOFKa * nsigmaTOFKa + nsigmaTPCKa * nsigmaTPCKa) < 2.f);
if (track.pt() <= 0.4) {
isDCAPureSample = (nsigmaTPCKa < 1.f);
}

if (isDCAPureSample) {
if (enableDCAvsmotherHistograms) {
hDcaXYMC[i]->Fill(track.pt(), track.dcaXY());
hDcaZMC[i]->Fill(track.pt(), track.dcaZ());
if (enablePureDCAHistogram) {
// Filling DCA info with the TPC+TOF PID
bool isDCAPureSample = (std::sqrt(nsigmaTOFKa * nsigmaTOFKa + nsigmaTPCKa * nsigmaTPCKa) < 2.f);
if (track.pt() <= 0.4) {
isDCAPureSample = (nsigmaTPCKa < 1.f);
}
if (isDCAPureSample) {
if (enableDCAvsmotherHistograms) {
hDcaXYMC[i]->Fill(track.pt(), track.dcaXY());
hDcaZMC[i]->Fill(track.pt(), track.dcaZ());
}

if (!mcParticle.isPhysicalPrimary()) { // Secondaries (weak decays and material)
if (mcParticle.getProcess() == 4) { // Particles from decay
if (enableDCAxyzHistograms) {
hDcaXYZStr[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
} else {
histos.fill(HIST(hdcaxystr[i]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcazstr[i]), track.pt(), track.dcaZ());
}
if (!mcParticle.isPhysicalPrimary()) { // Secondaries (weak decays and material)
if (mcParticle.getProcess() == 4) { // Particles from decay
if (enableDCAxyzHistograms) {
hDcaXYZStr[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
} else {
histos.fill(HIST(hdcaxystr[i]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcazstr[i]), track.pt(), track.dcaZ());
}

if (mcParticle.has_mothers()) {
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
auto daughter0 = mother.template daughters_as<aod::McParticles>().begin();
double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()};
double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()};
auto decayLength = RecoDecay::distance(vertexMoth, vertexDau);
hDecayLengthStr[i]->Fill(track.pt(), decayLength);
if (mcParticle.has_mothers()) {
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
auto daughter0 = mother.template daughters_as<aod::McParticles>().begin();
double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()};
double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()};
auto decayLength = RecoDecay::distance(vertexMoth, vertexDau);
hDecayLengthStr[i]->Fill(track.pt(), decayLength);
}
}
} else { // Particles from the material
if (enableDCAxyzHistograms) {
hDcaXYZMat[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
} else {
histos.fill(HIST(hdcaxymat[i]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcazmat[i]), track.pt(), track.dcaZ());
}
}
} else { // Particles from the material
} else { // Primaries
if (enableDCAxyzHistograms) {
hDcaXYZMat[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
hDcaXYZPrm[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
if (enableDcaGoodEvents.value && collision.has_mcCollision()) {
histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY(), track.dcaZ());
}
} else {
histos.fill(HIST(hdcaxymat[i]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcazmat[i]), track.pt(), track.dcaZ());
// DCAxy for all primaries
histos.fill(HIST(hdcaxyprm[i]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcazprm[i]), track.pt(), track.dcaZ());
}
}
} else { // Primaries
if (enableDCAxyzHistograms) {
hDcaXYZPrm[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ());
if (enableDcaGoodEvents.value && collision.has_mcCollision()) {
histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY(), track.dcaZ());
histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcazprmgoodevs[i]), track.pt(), track.dcaZ());
}
} else {
// DCAxy for all primaries
histos.fill(HIST(hdcaxyprm[i]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcazprm[i]), track.pt(), track.dcaZ());
}
if (enableDcaGoodEvents.value && collision.has_mcCollision()) {
histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY());
histos.fill(HIST(hdcazprmgoodevs[i]), track.pt(), track.dcaZ());
}

if (enableDCAvsmotherHistograms) {
bool IsD0Mother = false;
bool IsCharmMother = false;
bool IsBeautyMother = false;
bool IsNotHFMother = false;
if (mcParticle.has_mothers()) {
const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, false);
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
const int motherPdgCode = std::abs(mother.pdgCode());
if (motherPdgCode == 421) {
IsD0Mother = true;
}
if (charmOrigin == RecoDecay::OriginType::NonPrompt) {
IsBeautyMother = true;
}
if (charmOrigin == RecoDecay::OriginType::Prompt) {
IsCharmMother = true;
}
if (charmOrigin == RecoDecay::OriginType::None) {
IsNotHFMother = true;
if (enableDCAvsmotherHistograms) {
bool IsD0Mother = false;
bool IsCharmMother = false;
bool IsBeautyMother = false;
bool IsNotHFMother = false;
if (mcParticle.has_mothers()) {
const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, false);
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
const int motherPdgCode = std::abs(mother.pdgCode());
if (motherPdgCode == 421) {
IsD0Mother = true;
}
if (charmOrigin == RecoDecay::OriginType::NonPrompt) {
IsBeautyMother = true;
}
if (charmOrigin == RecoDecay::OriginType::Prompt) {
IsCharmMother = true;
}
if (charmOrigin == RecoDecay::OriginType::None) {
IsNotHFMother = true;
}
}
}
}
if (IsD0Mother) {
hDcaXYMCD0[i]->Fill(track.pt(), track.dcaXY());
hDcaZMCD0[i]->Fill(track.pt(), track.dcaZ());
}
if (IsCharmMother) {
hDcaXYMCCharm[i]->Fill(track.pt(), track.dcaXY());
hdcaZMCCharm[i]->Fill(track.pt(), track.dcaZ());
}
if (IsBeautyMother) {
hDcaXYMCBeauty[i]->Fill(track.pt(), track.dcaXY());
hDcaZMCBeauty[i]->Fill(track.pt(), track.dcaZ());
}
if (IsNotHFMother) {
hDcaXYMCNotHF[i]->Fill(track.pt(), track.dcaXY());
hDcaZMCNotHF[i]->Fill(track.pt(), track.dcaZ());
}

if (mcParticle.has_mothers()) {
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
auto daughter0 = mother.template daughters_as<aod::McParticles>().begin();
double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()};
double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()};
auto decayLength = RecoDecay::distance(vertexMoth, vertexDau);
if (IsD0Mother) {
hDcaXYMCD0[i]->Fill(track.pt(), track.dcaXY());
hDcaZMCD0[i]->Fill(track.pt(), track.dcaZ());
}
if (IsCharmMother) {
hDcaXYMCCharm[i]->Fill(track.pt(), track.dcaXY());
hdcaZMCCharm[i]->Fill(track.pt(), track.dcaZ());
}
if (IsBeautyMother) {
hDcaXYMCBeauty[i]->Fill(track.pt(), track.dcaXY());
hDcaZMCBeauty[i]->Fill(track.pt(), track.dcaZ());
}
if (IsNotHFMother) {
hDcaXYMCNotHF[i]->Fill(track.pt(), track.dcaXY());
hDcaZMCNotHF[i]->Fill(track.pt(), track.dcaZ());
}

if (IsD0Mother) {
hDecayLengthMCD0[i]->Fill(track.pt(), decayLength);
}
if (IsCharmMother) {
hDecayLengthMCCharm[i]->Fill(track.pt(), decayLength);
}
if (IsBeautyMother) {
hDecayLengthMCBeauty[i]->Fill(track.pt(), decayLength);
}
if (IsNotHFMother) {
hDecayLengthMCNotHF[i]->Fill(track.pt(), decayLength);
if (mcParticle.has_mothers()) {
for (const auto& mother : mcParticle.template mothers_as<aod::McParticles>()) {
auto daughter0 = mother.template daughters_as<aod::McParticles>().begin();
double vertexDau[3] = {daughter0.vx(), daughter0.vy(), daughter0.vz()};
double vertexMoth[3] = {mother.vx(), mother.vy(), mother.vz()};
auto decayLength = RecoDecay::distance(vertexMoth, vertexDau);

if (IsD0Mother) {
hDecayLengthMCD0[i]->Fill(track.pt(), decayLength);
}
if (IsCharmMother) {
hDecayLengthMCCharm[i]->Fill(track.pt(), decayLength);
}
if (IsBeautyMother) {
hDecayLengthMCBeauty[i]->Fill(track.pt(), decayLength);
}
if (IsNotHFMother) {
hDecayLengthMCNotHF[i]->Fill(track.pt(), decayLength);
}
}
}
}
}
}
} else {
if (!mcParticle.isPhysicalPrimary()) {
if (mcParticle.getProcess() == 4) {
histos.fill(HIST(hdcaxystr[i]), track.pt(), track.dcaXY());
} else {
histos.fill(HIST(hdcaxymat[i]), track.pt(), track.dcaXY());
}
} else {
histos.fill(HIST(hdcaxyprm[i]), track.pt(), track.dcaXY());
}
}

if ((collision.has_mcCollision() && (mcParticle.mcCollisionId() != collision.mcCollisionId())) || !collision.has_mcCollision()) {
Expand Down
Loading