Skip to content

Commit 7c564bb

Browse files
authored
[DPG] Add plots for TOF match qa (#14248)
1 parent 91b5ec3 commit 7c564bb

File tree

4 files changed

+82
-48
lines changed

4 files changed

+82
-48
lines changed

ALICE3/Core/FastTracker.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <fairlogger/Logger.h>
2121

22+
#include <map>
2223
#include <string>
2324
#include <vector>
2425

DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFBetaImp.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#include "Common/DataModel/TrackSelectionTables.h"
2222
#include "Common/TableProducer/PID/pidTOFBase.h"
2323

24-
#include "Framework/AnalysisTask.h"
25-
#include "Framework/HistogramRegistry.h"
26-
#include "Framework/StaticFor.h"
27-
#include "Framework/runDataProcessing.h"
24+
#include <Framework/AnalysisTask.h>
25+
#include <Framework/HistogramRegistry.h>
26+
#include <Framework/StaticFor.h>
27+
#include <Framework/runDataProcessing.h>
2828

2929
using namespace o2;
3030
using namespace o2::framework;

DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFMC.cxx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
/// \brief Task to produce QA output of the PID with TOF running on the MC e.g. to compute purity.
1616
///
1717

18-
// O2 includes
1918
#include "Common/DataModel/EventSelection.h"
2019
#include "Common/DataModel/PIDResponseTOF.h"
2120

22-
#include "Framework/AnalysisTask.h"
23-
#include "Framework/HistogramRegistry.h"
24-
#include "Framework/StaticFor.h"
25-
#include "Framework/runDataProcessing.h"
21+
#include <Framework/AnalysisTask.h>
22+
#include <Framework/HistogramRegistry.h>
23+
#include <Framework/StaticFor.h>
24+
#include <Framework/runDataProcessing.h>
2625

2726
using namespace o2;
2827
using namespace o2::framework;
@@ -55,6 +54,7 @@ std::array<std::shared_ptr<TH2>, NpNp> hNSigmaMC;
5554
std::array<std::shared_ptr<TH2>, NpNp> hNSigmaMCprm;
5655
std::array<std::shared_ptr<TH2>, NpNp> hNSigmaMCstr;
5756
std::array<std::shared_ptr<TH2>, NpNp> hNSigmaMCmat;
57+
std::array<std::shared_ptr<TH2>, NpNp> hNSigmaMCgoodmatch;
5858

5959
std::array<std::shared_ptr<TH2>, NpNp> hDeltaMCEvTime;
6060
std::array<std::shared_ptr<TH2>, NpNp> hDeltaMCEvTimeTrueGoodEv;
@@ -278,6 +278,7 @@ struct pidTofQaMc {
278278
const AxisSpec nSigmaAxis{binsNsigma, Form("N_{#sigma}^{TOF}(%s)", pT[massID])};
279279

280280
hNSigmaMC[mcID * Np + massID] = histos.add<TH2>(Form("nsigmaMC/%s/%s", pName[mcID], pName[massID]), pT[mcID], HistType::kTH2F, {ptAxis, nSigmaAxis});
281+
hNSigmaMCgoodmatch[mcID * Np + massID] = histos.add<TH2>(Form("nsigmaMCgoodmatch/%s/%s", pName[mcID], pName[massID]), pT[mcID], HistType::kTH2F, {ptAxis, nSigmaAxis});
281282
if (checkPrimaries) {
282283
hNSigmaMCprm[mcID * Np + massID] = histos.add<TH2>(Form("nsigmaMCprm/%s/%s", pName[mcID], pName[massID]), pT[mcID], HistType::kTH2F, {ptAxis, nSigmaAxis});
283284
hNSigmaMCstr[mcID * Np + massID] = histos.add<TH2>(Form("nsigmaMCstr/%s/%s", pName[mcID], pName[massID]), pT[mcID], HistType::kTH2F, {ptAxis, nSigmaAxis});
@@ -648,6 +649,12 @@ struct pidTofQaMc {
648649
const float nsigmaMassID = o2::aod::pidutils::tofNSigma<massID>(track);
649650

650651
hNSigmaMC[mcID * Np + massID]->Fill(track.pt(), nsigmaMassID);
652+
if (track.hasTOF() && track.mcMask() & (0x1 << 15)) {
653+
// Bad match
654+
} else {
655+
// Good match
656+
hNSigmaMCgoodmatch[mcID * Np + massID]->Fill(track.pt(), nsigmaMassID);
657+
}
651658
if (checkPrimaries) {
652659
if (!particle.isPhysicalPrimary()) {
653660
if (particle.getProcess() == 4) {

DPG/Tasks/AOTTrack/qaFakeHits.cxx

Lines changed: 65 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,19 @@
1616
/// \brief Task to analyze the fraction of the true and fake hits depending on where the fake hits are picked
1717
///
1818

19-
// O2 includes
20-
#include "Framework/AnalysisTask.h"
21-
#include "Framework/runDataProcessing.h"
22-
#include "Framework/HistogramRegistry.h"
23-
#include "Framework/StaticFor.h"
24-
#include "ReconstructionDataFormats/DCA.h"
25-
#include "ReconstructionDataFormats/Track.h"
19+
#include "PWGLF/DataModel/LFParticleIdentification.h"
20+
2621
#include "Common/Core/TrackSelection.h"
27-
#include "Common/DataModel/EventSelection.h"
2822
#include "Common/Core/TrackSelectionDefaults.h"
23+
#include "Common/DataModel/EventSelection.h"
2924
#include "Common/DataModel/TrackSelectionTables.h"
30-
#include "PWGLF/DataModel/LFParticleIdentification.h"
25+
26+
#include <Framework/AnalysisTask.h>
27+
#include <Framework/HistogramRegistry.h>
28+
#include <Framework/StaticFor.h>
29+
#include <Framework/runDataProcessing.h>
30+
#include <ReconstructionDataFormats/DCA.h>
31+
#include <ReconstructionDataFormats/Track.h>
3132

3233
using namespace o2::framework;
3334
// Particle information
@@ -38,12 +39,16 @@ static constexpr const char* particleTitle[nParticles] = {"e", "#mu", "#pi", "K"
3839
"e", "#mu", "#pi", "K", "p", "d", "t", "^{3}He", "#alpha"};
3940
static constexpr int PDGs[nParticles] = {11, 13, 211, 321, 2212, 1000010020, 1000010030, 1000020030, 1000020040,
4041
-11, -13, -211, -321, -2212, -1000010020, -1000010030, -1000020030, -1000020040};
41-
std::array<std::shared_ptr<TH1>, nParticles> hPtAll;
42-
std::array<std::shared_ptr<TH1>, nParticles> hPtITS;
43-
std::array<std::shared_ptr<TH1>, nParticles> hPtTPC;
44-
std::array<std::shared_ptr<TH1>, nParticles> hPtTRD;
45-
std::array<std::shared_ptr<TH1>, nParticles> hPtTOF;
46-
std::array<std::shared_ptr<TH1>, nParticles> hPtOverall;
42+
std::array<std::shared_ptr<TH2>, nParticles> hPtAll;
43+
std::array<std::shared_ptr<TH2>, nParticles> hPtITS;
44+
std::array<std::shared_ptr<TH2>, nParticles> hPtITSAB;
45+
std::array<std::shared_ptr<TH2>, nParticles> hPtITSTPC;
46+
std::array<std::shared_ptr<TH2>, nParticles> hPtTPC;
47+
std::array<std::shared_ptr<TH2>, nParticles> hPtTRD;
48+
std::array<std::shared_ptr<TH2>, nParticles> hPtTOF;
49+
std::array<std::shared_ptr<TH2>, nParticles> hPtOverall;
50+
std::array<std::shared_ptr<TH2>, nParticles> hPtNoise;
51+
std::array<std::shared_ptr<TH2>, nParticles> hPtNoMismatch;
4752

4853
struct QaFakeHits {
4954
// Charge selection
@@ -103,23 +108,24 @@ struct QaFakeHits {
103108
LOG(fatal) << "Can't interpret pdgSign " << pdgSign;
104109
}
105110

106-
const AxisSpec axisPt{ptBins, "#it{p}_{T} (GeV/#it{c})"};
107-
// const AxisSpec axisP{ptBins, "#it{p} (GeV/#it{c})"};
108-
// const AxisSpec axisEta{etaBins, "#it{#eta}"};
109-
// const AxisSpec axisY{yBins, "#it{y}"};
110-
// const AxisSpec axisPhi{phiBins, "#it{#varphi} (rad)"};
111+
const AxisSpec axisPt{ptBins, "#it{p}_{T}^{gen} (GeV/#it{c})"};
112+
const AxisSpec axisPtDiff{100, -1, 1, "#it{p}_{T}^{gen} - #it{p}_{T}^{rec} (GeV/#it{c})"};
111113

112114
const char* partName = particleName(pdgSign, id);
113115
LOG(info) << "Preparing histograms for particle: " << partName << " pdgSign " << pdgSign;
114116
const int histogramIndex = id + pdgSign * nSpecies;
115117

116118
const TString tagPt = Form("%s ", partName);
117-
hPtAll[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/all", PDGs[histogramIndex]), "All tracks " + tagPt, kTH1D, {axisPt});
118-
hPtITS[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/mismatched/its", PDGs[histogramIndex]), "ITS mismatch " + tagPt, kTH1D, {axisPt});
119-
hPtTPC[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/mismatched/tpc", PDGs[histogramIndex]), "TPC mismatch " + tagPt, kTH1D, {axisPt});
120-
hPtTRD[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/mismatched/trd", PDGs[histogramIndex]), "TRD mismatch " + tagPt, kTH1D, {axisPt});
121-
hPtTOF[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/mismatched/tof", PDGs[histogramIndex]), "TOF mismatch " + tagPt, kTH1D, {axisPt});
122-
hPtOverall[histogramIndex] = histos.add<TH1>(Form("MC/pdg%i/pt/mismatched/overall", PDGs[histogramIndex]), "Overall mismatch " + tagPt, kTH1D, {axisPt});
119+
hPtAll[histogramIndex] = histos.add<TH2>(Form("MC/pdg%i/pt/all", PDGs[histogramIndex]), "All tracks " + tagPt, kTH2D, {axisPt, axisPtDiff});
120+
hPtITS[histogramIndex] = histos.add<TH2>(Form("MC/pdg%i/pt/mismatched/its", PDGs[histogramIndex]), "ITS mismatch " + tagPt, kTH2D, {axisPt, axisPtDiff});
121+
hPtITSAB[histogramIndex] = histos.add<TH2>(Form("MC/pdg%i/pt/mismatched/itsab", PDGs[histogramIndex]), "ITSAB mismatch " + tagPt, kTH2D, {axisPt, axisPtDiff});
122+
hPtTPC[histogramIndex] = histos.add<TH2>(Form("MC/pdg%i/pt/mismatched/tpc", PDGs[histogramIndex]), "TPC mismatch " + tagPt, kTH2D, {axisPt, axisPtDiff});
123+
hPtITSTPC[histogramIndex] = histos.add<TH2>(Form("MC/pdg%i/pt/mismatched/itstpc", PDGs[histogramIndex]), "ITSTPC mismatch " + tagPt, kTH2D, {axisPt, axisPtDiff});
124+
hPtTRD[histogramIndex] = histos.add<TH2>(Form("MC/pdg%i/pt/mismatched/trd", PDGs[histogramIndex]), "TRD mismatch " + tagPt, kTH2D, {axisPt, axisPtDiff});
125+
hPtTOF[histogramIndex] = histos.add<TH2>(Form("MC/pdg%i/pt/mismatched/tof", PDGs[histogramIndex]), "TOF mismatch " + tagPt, kTH2D, {axisPt, axisPtDiff});
126+
hPtOverall[histogramIndex] = histos.add<TH2>(Form("MC/pdg%i/pt/mismatched/overall", PDGs[histogramIndex]), "Overall mismatch " + tagPt, kTH2D, {axisPt, axisPtDiff});
127+
hPtNoise[histogramIndex] = histos.add<TH2>(Form("MC/pdg%i/pt/mismatched/noise", PDGs[histogramIndex]), "Noise " + tagPt, kTH2D, {axisPt, axisPtDiff});
128+
hPtNoMismatch[histogramIndex] = histos.add<TH2>(Form("MC/pdg%i/pt/mismatched/no", PDGs[histogramIndex]), "No mismatch " + tagPt, kTH2D, {axisPt, axisPtDiff});
123129

124130
LOG(info) << "Done with particle: " << partName;
125131
}
@@ -185,14 +191,18 @@ struct QaFakeHits {
185191
if (!track.isGlobalTrack()) {
186192
return;
187193
}
188-
hPtAll[histogramIndex]->Fill(mcParticle.pt());
194+
const float ptDiff = mcParticle.pt() - track.pt();
195+
hPtAll[histogramIndex]->Fill(mcParticle.pt(), ptDiff);
189196
bool mismatchInITS = false;
190197
for (int i = 0; i < 7; i++) {
191198
if (isMismatched(track, i)) {
192199
mismatchInITS = true;
193200
break;
194201
}
195202
}
203+
if (mismatchInITS) {
204+
hPtITS[histogramIndex]->Fill(mcParticle.pt(), ptDiff);
205+
}
196206

197207
bool mismatchInTPC = false;
198208
for (int i = 7; i < 10; i++) {
@@ -201,24 +211,36 @@ struct QaFakeHits {
201211
break;
202212
}
203213
}
204-
const bool mismatchInTRD = isMismatched(track, 10);
205-
const bool mismatchInTOF = isMismatched(track, 11);
206-
const bool overallMismatch = isMismatched(track, 15);
207-
208-
if (mismatchInITS) {
209-
hPtITS[histogramIndex]->Fill(mcParticle.pt());
210-
}
211214
if (mismatchInTPC) {
212-
hPtTPC[histogramIndex]->Fill(mcParticle.pt());
215+
hPtTPC[histogramIndex]->Fill(mcParticle.pt(), ptDiff);
213216
}
217+
218+
if (track.mcMask() == 0) {
219+
hPtNoMismatch[histogramIndex]->Fill(mcParticle.pt(), ptDiff);
220+
}
221+
const bool mismatchInTRD = isMismatched(track, 10); // Not set
214222
if (mismatchInTRD) {
215-
hPtTRD[histogramIndex]->Fill(mcParticle.pt());
223+
hPtTRD[histogramIndex]->Fill(mcParticle.pt(), ptDiff);
216224
}
225+
const bool mismatchInTOF = isMismatched(track, 15) && track.hasTOF();
217226
if (mismatchInTOF) {
218-
hPtTOF[histogramIndex]->Fill(mcParticle.pt());
227+
hPtTOF[histogramIndex]->Fill(mcParticle.pt(), ptDiff);
228+
}
229+
const bool itsAfterBurnerMismatch = isMismatched(track, 12);
230+
if (itsAfterBurnerMismatch) {
231+
hPtITSAB[histogramIndex]->Fill(mcParticle.pt(), ptDiff);
219232
}
233+
const bool itstpcMismatch = isMismatched(track, 13);
234+
if (itstpcMismatch) {
235+
hPtITSTPC[histogramIndex]->Fill(mcParticle.pt(), ptDiff);
236+
}
237+
const bool isNoise = isMismatched(track, 14);
238+
if (isNoise) {
239+
hPtNoise[histogramIndex]->Fill(mcParticle.pt(), ptDiff);
240+
}
241+
const bool overallMismatch = isMismatched(track, 15);
220242
if (overallMismatch) {
221-
hPtOverall[histogramIndex]->Fill(mcParticle.pt());
243+
hPtOverall[histogramIndex]->Fill(mcParticle.pt(), ptDiff);
222244
}
223245
}
224246

@@ -227,12 +249,16 @@ struct QaFakeHits {
227249

228250
// MC process
229251
void process(o2::aod::Collision const& /*collision*/,
230-
o2::soa::Join<TrackCandidates, o2::aod::McTrackLabels> const& tracks,
252+
TrackCandidatesMC const& tracks,
231253
o2::aod::McCollisions const&,
232254
o2::aod::McParticles const&)
233255
{
234256
// Track loop
235257
for (const auto& track : tracks) {
258+
259+
LOG(debug) << "Processing track with global index " << track.globalIndex() << " and mask " << track.mcMask();
260+
LOG(debug) << "mcMask bits: " << std::bitset<16>(track.mcMask());
261+
236262
static_for<0, 1>([&](auto pdgSign) {
237263
fillMCTrackHistograms<pdgSign, o2::track::PID::Electron>(track, doEl);
238264
fillMCTrackHistograms<pdgSign, o2::track::PID::Muon>(track, doMu);

0 commit comments

Comments
 (0)