1818// /
1919
2020// O2 includes
21+
2122#include < string>
2223#include < vector>
2324#include " ReconstructionDataFormats/Track.h"
@@ -97,6 +98,7 @@ struct tofSpectra {
9798 } trkselOptions;
9899
99100 Configurable<bool > enableDcaGoodEvents{" enableDcaGoodEvents" , true , " Enables the MC plots with the correct match between data and MC" };
101+ Configurable<bool > enablePureDCAHistogram{" enablePureDCAHistogram" , false , " Enables the pure DCA histograms" };
100102 Configurable<bool > enableTrackCutHistograms{" enableTrackCutHistograms" , true , " Enables track cut histograms, before and after the cut" };
101103 Configurable<bool > enableDeltaHistograms{" enableDeltaHistograms" , true , " Enables the delta TPC and TOF histograms" };
102104 Configurable<bool > enableTPCTOFHistograms{" enableTPCTOFHistograms" , true , " Enables TPC TOF histograms" };
@@ -1017,7 +1019,6 @@ struct tofSpectra {
10171019 }
10181020 }
10191021 }
1020-
10211022 if constexpr (fillFullInfo) {
10221023 if (enableDeltaHistograms) {
10231024 const auto & deltaTOF = o2::aod::pidutils::tofExpSignalDiff<id>(track);
@@ -1036,7 +1037,6 @@ struct tofSpectra {
10361037 }
10371038 }
10381039 }
1039-
10401040 // Filling DCA info with the TPC+TOF PID
10411041 bool isDCAPureSample = (std::sqrt (nsigmaTOF * nsigmaTOF + nsigmaTPC * nsigmaTPC) < 2 .f );
10421042 if (track.pt () <= 0.4 ) {
@@ -1906,130 +1906,138 @@ struct tofSpectra {
19061906 if (std::abs (mcParticle.y ()) > trkselOptions.cfgCutY ) {
19071907 return ;
19081908 }
1909+ if (enablePureDCAHistogram) {
1910+ const auto & nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3 >(track);
1911+ const auto & nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3 >(track);
19091912
1910- const auto & nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3 >(track);
1911- const bool isKaonTPC = std::abs (nsigmaTPCKa) < trkselOptions.cfgCutNsigma ;
1912-
1913- const auto & nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3 >(track);
1914- const bool isKaonTOF = std::abs (nsigmaTOFKa) < trkselOptions.cfgCutNsigma ;
1915-
1916- // Filling DCA info with the TPC+TOF PID
1917- bool isDCAPureSample = (std::sqrt (nsigmaTOFKa * nsigmaTOFKa + nsigmaTPCKa * nsigmaTPCKa) < 2 .f );
1918- if (track.pt () <= 0.4 ) {
1919- isDCAPureSample = (nsigmaTPCKa < 1 .f );
1920- }
1921-
1922- if (isDCAPureSample) {
1923- if (enableDCAvsmotherHistograms) {
1924- hDcaXYMC[i]->Fill (track.pt (), track.dcaXY ());
1925- hDcaZMC[i]->Fill (track.pt (), track.dcaZ ());
1913+ // Filling DCA info with the TPC+TOF PID
1914+ bool isDCAPureSample = (std::sqrt (nsigmaTOFKa * nsigmaTOFKa + nsigmaTPCKa * nsigmaTPCKa) < 2 .f );
1915+ if (track.pt () <= 0.4 ) {
1916+ isDCAPureSample = (nsigmaTPCKa < 1 .f );
19261917 }
19271918
1928- if (!mcParticle.isPhysicalPrimary ()) { // Secondaries (weak decays and material)
1929- if (mcParticle.getProcess () == 4 ) { // Particles from decay
1930- if (enableDCAxyzHistograms) {
1931- hDcaXYZStr[i]->Fill (track.pt (), track.dcaXY (), track.dcaZ ());
1932- } else {
1933- histos.fill (HIST (hdcaxystr[i]), track.pt (), track.dcaXY ());
1934- histos.fill (HIST (hdcazstr[i]), track.pt (), track.dcaZ ());
1935- }
1919+ if (isDCAPureSample) {
1920+ if (enableDCAvsmotherHistograms) {
1921+ hDcaXYMC[i]->Fill (track.pt (), track.dcaXY ());
1922+ hDcaZMC[i]->Fill (track.pt (), track.dcaZ ());
1923+ }
19361924
1937- if (mcParticle.has_mothers ()) {
1938- for (const auto & mother : mcParticle.template mothers_as <aod::McParticles>()) {
1939- auto daughter0 = mother.template daughters_as <aod::McParticles>().begin ();
1940- double vertexDau[3 ] = {daughter0.vx (), daughter0.vy (), daughter0.vz ()};
1941- double vertexMoth[3 ] = {mother.vx (), mother.vy (), mother.vz ()};
1942- auto decayLength = RecoDecay::distance (vertexMoth, vertexDau);
1943- hDecayLengthStr[i]->Fill (track.pt (), decayLength);
1925+ if (!mcParticle.isPhysicalPrimary ()) { // Secondaries (weak decays and material)
1926+ if (mcParticle.getProcess () == 4 ) { // Particles from decay
1927+ if (enableDCAxyzHistograms) {
1928+ hDcaXYZStr[i]->Fill (track.pt (), track.dcaXY (), track.dcaZ ());
1929+ } else {
1930+ histos.fill (HIST (hdcaxystr[i]), track.pt (), track.dcaXY ());
1931+ histos.fill (HIST (hdcazstr[i]), track.pt (), track.dcaZ ());
1932+ }
1933+
1934+ if (mcParticle.has_mothers ()) {
1935+ for (const auto & mother : mcParticle.template mothers_as <aod::McParticles>()) {
1936+ auto daughter0 = mother.template daughters_as <aod::McParticles>().begin ();
1937+ double vertexDau[3 ] = {daughter0.vx (), daughter0.vy (), daughter0.vz ()};
1938+ double vertexMoth[3 ] = {mother.vx (), mother.vy (), mother.vz ()};
1939+ auto decayLength = RecoDecay::distance (vertexMoth, vertexDau);
1940+ hDecayLengthStr[i]->Fill (track.pt (), decayLength);
1941+ }
1942+ }
1943+ } else { // Particles from the material
1944+ if (enableDCAxyzHistograms) {
1945+ hDcaXYZMat[i]->Fill (track.pt (), track.dcaXY (), track.dcaZ ());
1946+ } else {
1947+ histos.fill (HIST (hdcaxymat[i]), track.pt (), track.dcaXY ());
1948+ histos.fill (HIST (hdcazmat[i]), track.pt (), track.dcaZ ());
19441949 }
19451950 }
1946- } else { // Particles from the material
1951+ } else { // Primaries
19471952 if (enableDCAxyzHistograms) {
1948- hDcaXYZMat[i]->Fill (track.pt (), track.dcaXY (), track.dcaZ ());
1953+ hDcaXYZPrm[i]->Fill (track.pt (), track.dcaXY (), track.dcaZ ());
1954+ if (enableDcaGoodEvents.value && collision.has_mcCollision ()) {
1955+ histos.fill (HIST (hdcaxyprmgoodevs[i]), track.pt (), track.dcaXY (), track.dcaZ ());
1956+ }
19491957 } else {
1950- histos.fill (HIST (hdcaxymat[i]), track.pt (), track.dcaXY ());
1951- histos.fill (HIST (hdcazmat[i]), track.pt (), track.dcaZ ());
1958+ // DCAxy for all primaries
1959+ histos.fill (HIST (hdcaxyprm[i]), track.pt (), track.dcaXY ());
1960+ histos.fill (HIST (hdcazprm[i]), track.pt (), track.dcaZ ());
19521961 }
1953- }
1954- } else { // Primaries
1955- if (enableDCAxyzHistograms) {
1956- hDcaXYZPrm[i]->Fill (track.pt (), track.dcaXY (), track.dcaZ ());
19571962 if (enableDcaGoodEvents.value && collision.has_mcCollision ()) {
1958- histos.fill (HIST (hdcaxyprmgoodevs[i]), track.pt (), track.dcaXY (), track.dcaZ ());
1963+ histos.fill (HIST (hdcaxyprmgoodevs[i]), track.pt (), track.dcaXY ());
1964+ histos.fill (HIST (hdcazprmgoodevs[i]), track.pt (), track.dcaZ ());
19591965 }
1960- } else {
1961- // DCAxy for all primaries
1962- histos.fill (HIST (hdcaxyprm[i]), track.pt (), track.dcaXY ());
1963- histos.fill (HIST (hdcazprm[i]), track.pt (), track.dcaZ ());
1964- }
1965- if (enableDcaGoodEvents.value && collision.has_mcCollision ()) {
1966- histos.fill (HIST (hdcaxyprmgoodevs[i]), track.pt (), track.dcaXY ());
1967- histos.fill (HIST (hdcazprmgoodevs[i]), track.pt (), track.dcaZ ());
1968- }
19691966
1970- if (enableDCAvsmotherHistograms) {
1971- bool IsD0Mother = false ;
1972- bool IsCharmMother = false ;
1973- bool IsBeautyMother = false ;
1974- bool IsNotHFMother = false ;
1975- if (mcParticle.has_mothers ()) {
1976- const int charmOrigin = RecoDecay::getCharmHadronOrigin (mcParticles, mcParticle, false );
1977- for (const auto & mother : mcParticle.template mothers_as <aod::McParticles>()) {
1978- const int motherPdgCode = std::abs (mother.pdgCode ());
1979- if (motherPdgCode == 421 ) {
1980- IsD0Mother = true ;
1981- }
1982- if (charmOrigin == RecoDecay::OriginType::NonPrompt) {
1983- IsBeautyMother = true ;
1984- }
1985- if (charmOrigin == RecoDecay::OriginType::Prompt) {
1986- IsCharmMother = true ;
1987- }
1988- if (charmOrigin == RecoDecay::OriginType::None) {
1989- IsNotHFMother = true ;
1967+ if (enableDCAvsmotherHistograms) {
1968+ bool IsD0Mother = false ;
1969+ bool IsCharmMother = false ;
1970+ bool IsBeautyMother = false ;
1971+ bool IsNotHFMother = false ;
1972+ if (mcParticle.has_mothers ()) {
1973+ const int charmOrigin = RecoDecay::getCharmHadronOrigin (mcParticles, mcParticle, false );
1974+ for (const auto & mother : mcParticle.template mothers_as <aod::McParticles>()) {
1975+ const int motherPdgCode = std::abs (mother.pdgCode ());
1976+ if (motherPdgCode == 421 ) {
1977+ IsD0Mother = true ;
1978+ }
1979+ if (charmOrigin == RecoDecay::OriginType::NonPrompt) {
1980+ IsBeautyMother = true ;
1981+ }
1982+ if (charmOrigin == RecoDecay::OriginType::Prompt) {
1983+ IsCharmMother = true ;
1984+ }
1985+ if (charmOrigin == RecoDecay::OriginType::None) {
1986+ IsNotHFMother = true ;
1987+ }
19901988 }
19911989 }
1992- }
1993- if (IsD0Mother) {
1994- hDcaXYMCD0[i]->Fill (track.pt (), track.dcaXY ());
1995- hDcaZMCD0[i]->Fill (track.pt (), track.dcaZ ());
1996- }
1997- if (IsCharmMother) {
1998- hDcaXYMCCharm[i]->Fill (track.pt (), track.dcaXY ());
1999- hdcaZMCCharm[i]->Fill (track.pt (), track.dcaZ ());
2000- }
2001- if (IsBeautyMother) {
2002- hDcaXYMCBeauty[i]->Fill (track.pt (), track.dcaXY ());
2003- hDcaZMCBeauty[i]->Fill (track.pt (), track.dcaZ ());
2004- }
2005- if (IsNotHFMother) {
2006- hDcaXYMCNotHF[i]->Fill (track.pt (), track.dcaXY ());
2007- hDcaZMCNotHF[i]->Fill (track.pt (), track.dcaZ ());
2008- }
2009-
2010- if (mcParticle.has_mothers ()) {
2011- for (const auto & mother : mcParticle.template mothers_as <aod::McParticles>()) {
2012- auto daughter0 = mother.template daughters_as <aod::McParticles>().begin ();
2013- double vertexDau[3 ] = {daughter0.vx (), daughter0.vy (), daughter0.vz ()};
2014- double vertexMoth[3 ] = {mother.vx (), mother.vy (), mother.vz ()};
2015- auto decayLength = RecoDecay::distance (vertexMoth, vertexDau);
1990+ if (IsD0Mother) {
1991+ hDcaXYMCD0[i]->Fill (track.pt (), track.dcaXY ());
1992+ hDcaZMCD0[i]->Fill (track.pt (), track.dcaZ ());
1993+ }
1994+ if (IsCharmMother) {
1995+ hDcaXYMCCharm[i]->Fill (track.pt (), track.dcaXY ());
1996+ hdcaZMCCharm[i]->Fill (track.pt (), track.dcaZ ());
1997+ }
1998+ if (IsBeautyMother) {
1999+ hDcaXYMCBeauty[i]->Fill (track.pt (), track.dcaXY ());
2000+ hDcaZMCBeauty[i]->Fill (track.pt (), track.dcaZ ());
2001+ }
2002+ if (IsNotHFMother) {
2003+ hDcaXYMCNotHF[i]->Fill (track.pt (), track.dcaXY ());
2004+ hDcaZMCNotHF[i]->Fill (track.pt (), track.dcaZ ());
2005+ }
20162006
2017- if (IsD0Mother) {
2018- hDecayLengthMCD0[i]->Fill (track.pt (), decayLength);
2019- }
2020- if (IsCharmMother) {
2021- hDecayLengthMCCharm[i]->Fill (track.pt (), decayLength);
2022- }
2023- if (IsBeautyMother) {
2024- hDecayLengthMCBeauty[i]->Fill (track.pt (), decayLength);
2025- }
2026- if (IsNotHFMother) {
2027- hDecayLengthMCNotHF[i]->Fill (track.pt (), decayLength);
2007+ if (mcParticle.has_mothers ()) {
2008+ for (const auto & mother : mcParticle.template mothers_as <aod::McParticles>()) {
2009+ auto daughter0 = mother.template daughters_as <aod::McParticles>().begin ();
2010+ double vertexDau[3 ] = {daughter0.vx (), daughter0.vy (), daughter0.vz ()};
2011+ double vertexMoth[3 ] = {mother.vx (), mother.vy (), mother.vz ()};
2012+ auto decayLength = RecoDecay::distance (vertexMoth, vertexDau);
2013+
2014+ if (IsD0Mother) {
2015+ hDecayLengthMCD0[i]->Fill (track.pt (), decayLength);
2016+ }
2017+ if (IsCharmMother) {
2018+ hDecayLengthMCCharm[i]->Fill (track.pt (), decayLength);
2019+ }
2020+ if (IsBeautyMother) {
2021+ hDecayLengthMCBeauty[i]->Fill (track.pt (), decayLength);
2022+ }
2023+ if (IsNotHFMother) {
2024+ hDecayLengthMCNotHF[i]->Fill (track.pt (), decayLength);
2025+ }
20282026 }
20292027 }
20302028 }
20312029 }
20322030 }
2031+ } else {
2032+ if (!mcParticle.isPhysicalPrimary ()) {
2033+ if (mcParticle.getProcess () == 4 ) {
2034+ histos.fill (HIST (hdcaxystr[i]), track.pt (), track.dcaXY ());
2035+ } else {
2036+ histos.fill (HIST (hdcaxymat[i]), track.pt (), track.dcaXY ());
2037+ }
2038+ } else {
2039+ histos.fill (HIST (hdcaxyprm[i]), track.pt (), track.dcaXY ());
2040+ }
20332041 }
20342042
20352043 if ((collision.has_mcCollision () && (mcParticle.mcCollisionId () != collision.mcCollisionId ())) || !collision.has_mcCollision ()) {
@@ -2049,15 +2057,19 @@ struct tofSpectra {
20492057 }
20502058 const int pdgCode = mcParticle.pdgCode ();
20512059 const auto & nsigmaTPCPi = o2::aod::pidutils::tpcNSigma<2 >(track);
2060+ const auto & nsigmaTPCKa = o2::aod::pidutils::tpcNSigma<3 >(track);
20522061 const auto & nsigmaTPCPr = o2::aod::pidutils::tpcNSigma<4 >(track);
20532062
20542063 const bool isPionTPC = std::abs (nsigmaTPCPi) < trkselOptions.cfgCutNsigma ;
2064+ const bool isKaonTPC = std::abs (nsigmaTPCKa) < trkselOptions.cfgCutNsigma ;
20552065 const bool isProtonTPC = std::abs (nsigmaTPCPr) < trkselOptions.cfgCutNsigma ;
20562066
20572067 const auto & nsigmaTOFPi = o2::aod::pidutils::tofNSigma<2 >(track);
2068+ const auto & nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3 >(track);
20582069 const auto & nsigmaTOFPr = o2::aod::pidutils::tofNSigma<4 >(track);
20592070
20602071 const bool isPionTOF = std::abs (nsigmaTOFPi) < trkselOptions.cfgCutNsigma ;
2072+ const bool isKaonTOF = std::abs (nsigmaTOFKa) < trkselOptions.cfgCutNsigma ;
20612073 const bool isProtonTOF = std::abs (nsigmaTOFPr) < trkselOptions.cfgCutNsigma ;
20622074
20632075 if (!mcParticle.isPhysicalPrimary ()) { // Is not physical primary
0 commit comments