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
73 changes: 37 additions & 36 deletions DPG/Tasks/AOTTrack/qaMatchEff.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,27 @@
//
// Internal version number: 6.3
//
#include "Common/Core/RecoDecay.h"
#include "Common/Core/TrackSelection.h"
#include "Common/Core/TrackSelectionDefaults.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/Centrality.h"
#include "Common/DataModel/TrackSelectionTables.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/PIDResponse.h"
#include "CommonConstants/MathConstants.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include "CCDB/BasicCCDBManager.h"
#include "Common/Core/RecoDecay.h"
#include "CommonConstants/MathConstants.h"
//
#include "Framework/AnalysisTask.h"
#include "Framework/RunningWorkflowInfo.h"
#include "Framework/runDataProcessing.h"
//
#include <TPDGCode.h>

#include <cmath>
#include <set>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <TPDGCode.h>
//
namespace extConfPar
{
Expand Down Expand Up @@ -147,21 +149,21 @@
// TRD presence
Configurable<int> isTRDThere{"isTRDThere", 2, "Integer to turn the presence of TRD off, on, don't care (0,1,anything else)"};
Configurable<int> isTOFThere{"isTOFThere", 2, "Integer to turn the presence of TOF off, on, don't care (0,1,anything else)"};

Configurable<bool> isitMC{"isitMC", false, "Reading MC files, data if false"};
Configurable<bool> doDebug{"doDebug", false, "Flag of debug information"};
// Histogram configuration

// histos bins
Configurable<int> etaBins{"eta-bins", 40, "Number of eta bins"};
Configurable<int> phiBins{"phi-bins", 18, "Number of phi bins"};
Configurable<int> qoptBins{"qopt-bins", 500, "Number of Q/pt bins"};

// special histo, few particles explicitly stored, then pdg>3000
Configurable<int> pdgBins{"pdg-bins", 14, "Number of pdg values counted"};

// histo axes

ConfigurableAxis ptBins{"ptBins", {100, 0.f, 20.f}, "pT binning"};
ConfigurableAxis XBins{"XBins", {400, -2.f, 2.f}, "X binning"};
ConfigurableAxis ZBins{"ZBins", {400, -20.f, 20.f}, "Z binning"};
Expand Down Expand Up @@ -1602,16 +1604,16 @@
auto mcpart = track.mcParticle();
siPDGCode = mcpart.pdgCode();
tpPDGCode = std::abs(siPDGCode);
//if (mcpart.isPhysicalPrimary()) {
// histos.get<TH1>(HIST("MC/control/etahist_diff"))->Fill(mcpart.eta() - track.eta());
// auto delta = RecoDecay::constrainAngle(mcpart.phi() - track.phi());
// if (delta > o2::constants::math::PI) {
// delta -= o2::constants::math::TwoPI;
// }
// if (delta < o2::constants::math::PI) {
// delta += o2::constants::math::TwoPI;
// }
// histos.get<TH1>(HIST("MC/control/phihist_diff"))->Fill(delta);
// if (mcpart.isPhysicalPrimary()) {
// histos.get<TH1>(HIST("MC/control/etahist_diff"))->Fill(mcpart.eta() - track.eta());
// auto delta = RecoDecay::constrainAngle(mcpart.phi() - track.phi());
// if (delta > o2::constants::math::PI) {
// delta -= o2::constants::math::TwoPI;
// }
// if (delta < o2::constants::math::PI) {
// delta += o2::constants::math::TwoPI;
// }
// histos.get<TH1>(HIST("MC/control/phihist_diff"))->Fill(delta);
//}

/// MC info for THnSparse filling
Expand All @@ -1619,7 +1621,7 @@
specind = -9999;
if (mcpart.isPhysicalPrimary())
sayPrim = 0;
else if (mcpart.getProcess() == 4)

Check failure on line 1624 in DPG/Tasks/AOTTrack/qaMatchEff.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
sayPrim = 1;
else
sayPrim = 2;
Expand Down Expand Up @@ -1685,11 +1687,11 @@
if (makethn) {
if constexpr (IS_MC) {
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together
if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
} else {
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (specind == 2 || specind == 3 || specind == 5) // pions and kaons together

Check failure on line 1694 in DPG/Tasks/AOTTrack/qaMatchEff.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
}
}
Expand All @@ -1702,11 +1704,11 @@
if (makethn) {
if constexpr (IS_MC) {
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together
if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
} else {
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (specind == 2 || specind == 3 || specind == 5) // pions and kaons together

Check failure on line 1711 in DPG/Tasks/AOTTrack/qaMatchEff.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
}
}
Expand All @@ -1719,11 +1721,11 @@
if (makethn) {
if constexpr (IS_MC) {
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together
if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
} else {
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (specind == 2 || specind == 3 || specind == 5) // pions and kaons together

Check failure on line 1728 in DPG/Tasks/AOTTrack/qaMatchEff.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
}
}
Expand All @@ -1736,11 +1738,11 @@
if (makethn) {
if constexpr (IS_MC) {
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together
if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
} else {
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (specind == 2 || specind == 3 || specind == 5) // pions and kaons together

Check failure on line 1745 in DPG/Tasks/AOTTrack/qaMatchEff.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
}
}
Expand All @@ -1753,11 +1755,11 @@
if (makethn) {
if constexpr (IS_MC) {
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together
if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
} else {
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (specind == 2 || specind == 3 || specind == 5) // pions and kaons together

Check failure on line 1762 in DPG/Tasks/AOTTrack/qaMatchEff.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
}
}
Expand All @@ -1770,11 +1772,11 @@
if (makethn) {
if constexpr (IS_MC) {
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together
if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
} else {
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (specind == 2 || specind == 3 || specind == 5) // pions and kaons together

Check failure on line 1779 in DPG/Tasks/AOTTrack/qaMatchEff.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
}
}
Expand All @@ -1787,11 +1789,11 @@
if (makethn) {
if constexpr (IS_MC) {
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together
if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
} else {
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (specind == 2 || specind == 3 || specind == 5) // pions and kaons together

Check failure on line 1796 in DPG/Tasks/AOTTrack/qaMatchEff.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
}
}
Expand All @@ -1804,11 +1806,11 @@
if (makethn) {
if constexpr (IS_MC) {
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together
if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
} else {
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (specind == 2 || specind == 3 || specind == 5) // pions and kaons together

Check failure on line 1813 in DPG/Tasks/AOTTrack/qaMatchEff.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
}
}
Expand All @@ -1821,7 +1823,7 @@
if (makethn) {
if constexpr (IS_MC) {
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together
if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
} else {
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
Expand All @@ -1838,7 +1840,7 @@
if (makethn) {
if constexpr (IS_MC) {
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together
if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
} else {
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
Expand All @@ -1855,7 +1857,7 @@
if (makethn) {
if constexpr (IS_MC) {
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
if (siPDGCode == PDG_t::kPiPlus|| siPDGCode == PDG_t::kKPlus) // pions and kaons together
if (siPDGCode == PDG_t::kPiPlus || siPDGCode == PDG_t::kKPlus) // pions and kaons together
histos.fill(HIST("MC/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), 10, signOfTrack, hasdet);
} else {
histos.fill(HIST("data/sparse/thnsforfrac"), track.dcaXY(), track.dcaZ(), trackPt, track.eta(), sayPrim, track.phi(), specind, signOfTrack, hasdet);
Expand Down Expand Up @@ -3129,7 +3131,7 @@
// 0.5 not needed but just not to sit in the edge)
pdg_fill = static_cast<float>(std::distance(pdgChoice.begin(), itr_pdg)) + 1.5;
else
pdg_fill = -10.0;

Check failure on line 3134 in DPG/Tasks/AOTTrack/qaMatchEff.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 (trkWTPC && isTrackSelectedTPCCuts(track)) {
histos.get<TH1>(HIST("MC/PID/pthist_tpc_nopi"))->Fill(trackPt);
Expand Down Expand Up @@ -3359,7 +3361,7 @@
if (doDebug)
LOGF(info, "Event selection not passed, skipping...");
return;
}
}
fillHistograms<true>(tracks, mcParticles, mcParticles); /// 3rd argument non-sense in this case
fillGeneralHistos<true>(collision);
}
Expand Down Expand Up @@ -3462,7 +3464,7 @@
if (doDebug)
LOGF(info, "Event selection not passed, skipping...");
return;
}
}
fillHistograms<false>(tracks, tracks, tracks); // 2nd and 3rd arguments not used in this case
fillGeneralHistos<false>(collision);
}
Expand All @@ -3486,4 +3488,3 @@
return WorkflowSpec{
adaptAnalysisTask<qaMatchEff>(cfgc, TaskName{"qa-match-eff"})};
}

Loading