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 @@ struct tofSpectra {
} 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 @@ struct tofSpectra {
}
}
}

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

// 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 @@ struct tofSpectra {
}
}
}
} 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 @@ -1912,124 +1911,134 @@ struct tofSpectra {

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