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
47 changes: 47 additions & 0 deletions PWGLF/Tasks/Nuspex/spectraTOF.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@

std::array<std::shared_ptr<TH2>, NpCharge> hPtNumTOFMatchWithPIDSignalPrm; // Pt distribution of particles with a hit in the TOF and a compatible signal

std::array<std::array<std::shared_ptr<TH3>, NpCharge>, 3> hMCpdg_nsigmaTPC; // 2D array of nsigmaTPC histograms [Selection: pi,K,p][True PDG: 18 species]

// Spectra task
struct tofSpectra {
struct : ConfigurableGroup {
Expand Down Expand Up @@ -585,6 +587,13 @@
histos.add("MC/MultiplicityMCINELgt0", "MC multiplicity", kTH1D, {multAxis});
histos.add("MC/MultiplicityMCINELgt1", "MC multiplicity", kTH1D, {multAxis});
}
if (doprocessTrackMCLabels) {
for (int par = 2; par <= 4; par++) {
for (int i = 0; i < NpCharge; i++) {
hMCpdg_nsigmaTPC[par - 2][i] = histos.add<TH3>(Form("test_mclabels/nsigmatpc/%s/%s/pdg_%i", (i < Np) ? "pos" : "neg", pN[par], PDGs[i % Np]), Form("True %s (%i) in %s selection", pTCharge[i], PDGs[i], (i < Np) ? pTCharge[par] : pTCharge[par + Np]), kTH3D, {ptAxis, nsigmaTPCAxisOccupancy, multAxis});
}
}
}

hMultiplicityvsPercentile = histos.add<TH2>("Mult/vsPercentile", "Multiplicity vs percentile", HistType::kTH2D, {{150, 0, 150}, {100, 0, 100, "Track multiplicity"}});

Expand Down Expand Up @@ -1497,9 +1506,9 @@
if (mcParticle.isPhysicalPrimary()) {
if (isTPCPion && rapidityPi <= trkselOptions.cfgCutY) {
if (usePDGcode) {
if (pdgCode == 211) {

Check failure on line 1509 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 1511 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 @@ -1509,9 +1518,9 @@
}
if (isTPCKaon && rapidityKa <= trkselOptions.cfgCutY) {
if (usePDGcode) {
if (pdgCode == 321) {

Check failure on line 1521 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 1523 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 @@ -1521,9 +1530,9 @@
}
if (isTPCProton && rapidityPr <= trkselOptions.cfgCutY) {
if (usePDGcode) {
if (pdgCode == 2212) {

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("nsigmatpc/mc_closure/pos/pr"), track.pt(), nsigmaTPCPr, multiplicity);
} else if (pdgCode == -2212) {

Check failure on line 1535 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 @@ -1535,9 +1544,9 @@
// TOF Selection and Histogram Filling
if (isTOFPion && rapidityPi <= trkselOptions.cfgCutY) {
if (usePDGcode) {
if (pdgCode == 211) {

Check failure on line 1547 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 1549 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 All @@ -1547,7 +1556,7 @@
}
if (isTOFKaon && rapidityKa <= trkselOptions.cfgCutY) {
if (usePDGcode) {
if (pdgCode == 321) {

Check failure on line 1559 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/ka"), track.pt(), nsigmaTOFKa, multiplicity);
} else if (pdgCode == -321) {
histos.fill(HIST("nsigmatof/mc_closure/neg/ka"), track.pt(), nsigmaTOFKa, multiplicity);
Expand Down Expand Up @@ -1601,7 +1610,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 1613 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 @@ -2785,6 +2794,44 @@
}
}
PROCESS_SWITCH(tofSpectra, processMCgen_RecoEvs, "process generated MC (reconstructed events)", false);
void processTrackMCLabels(CollisionCandidates::iterator const& collisions,
soa::Join<TrackCandidates,
aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr,
aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr> const& tracks,
aod::McTrackLabels const& mcTrackLabels, aod::McParticles const& mcParticles)
{
const float multiplicity = getMultiplicity(collisions);
for (const auto& track : tracks) {
if (!track.has_collision()) {
continue;
}
const auto& collision = track.collision_as<CollisionCandidates>();
if (!isEventSelected<false, false>(collision)) {
continue;
}
if (!isTrackSelected<true>(track, collision)) {
continue;
}
const auto& mcLabel = mcTrackLabels.iteratorAt(track.globalIndex());
const auto& mcParticle = mcParticles.iteratorAt(mcLabel.mcParticleId());
int pdgCode = mcParticle.pdgCode();
static_for<2, 4>([&](auto par) {
const auto& nsigmaTPCpar = o2::aod::pidutils::tpcNSigma<par>(track);
bool isTPCpar = std::abs(nsigmaTPCpar) < trkselOptions.cfgCutNsigma;
// Precompute rapidity values to avoid redundant calculations
double rapiditypar = std::abs(track.rapidity(PID::getMass(par)));
// TPC Selection and histogram filling
if (isTPCpar && rapiditypar <= trkselOptions.cfgCutY) {
static_for<0, 17>([&](auto i) {
if (pdgCode == PDGs[i]) {
hMCpdg_nsigmaTPC[par - 2][i]->Fill(track.pt(), nsigmaTPCpar, multiplicity);
}
});
}
});
}
}
PROCESS_SWITCH(tofSpectra, processTrackMCLabels, "Fill track histograms using MC matched PDG labels", false);

}; // end of spectra task

Expand Down
Loading