-
Notifications
You must be signed in to change notification settings - Fork 499
Expand file tree
/
Copy pathtrackqa.cxx
More file actions
192 lines (164 loc) · 8.49 KB
/
trackqa.cxx
File metadata and controls
192 lines (164 loc) · 8.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
//
// Task producing basic tracking qa histograms
//
#include "Framework/AnalysisDataModel.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "AnalysisCore/MC.h"
#include "AnalysisDataModel/TrackSelectionTables.h"
#include "AnalysisCore/TrackSelection.h"
#include "AnalysisCore/TrackSelectionDefaults.h"
using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{
std::vector<ConfigParamSpec> options{
{"mc", VariantType::Bool, false, {"Add MC QA histograms."}},
{"add-cut-qa", VariantType::Int, 0, {"Add track cut QA histograms."}}};
std::swap(workflowOptions, options);
}
#include "Framework/runDataProcessing.h"
//****************************************************************************************
/**
* QA histograms for track quantities.
*/
//****************************************************************************************
struct TrackQATask {
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::QAObject};
Configurable<int> selectedTracks{"select", 1, "Choice of track selection. 0 = no selection, 1 = globalTracks, 2 = globalTracksSDD"};
Filter trackFilter = aod::track::isGlobalTrack == (uint8_t) true;
void init(o2::framework::InitContext&)
{
std::vector<double> ptBinning = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
1.1, 1.2, 1.3, 1.4, 1.5, 2.0, 5.0, 10.0, 20.0, 50.0};
// kine histograms
histos.add("Kine/pt", "#it{p}_{T};#it{p}_{T} [GeV/c]", kTH1D, {{ptBinning}});
histos.add("Kine/eta", "#eta;#eta", kTH1D, {{180, -0.9, 0.9}});
histos.add("Kine/phi", "#phi;#phi [rad]", kTH1D, {{180, 0., 2 * M_PI}});
// track histograms
histos.add("TrackPar/x", "track #it{x} position at dca in local coordinate system;#it{x} [cm]", kTH1D, {{200, -0.36, 0.36}});
histos.add("TrackPar/y", "track #it{y} position at dca in local coordinate system;#it{y} [cm]", kTH1D, {{200, -0.5, 0.5}});
histos.add("TrackPar/z", "track #it{z} position at dca in local coordinate system;#it{z} [cm]", kTH1D, {{200, -11., 11.}});
histos.add("TrackPar/alpha", "rotation angle of local wrt. global coordinate system;#alpha [rad]", kTH1D, {{36, -M_PI, M_PI}});
histos.add("TrackPar/signed1Pt", "track signed 1/#it{p}_{T};#it{q}/#it{p}_{T}", kTH1D, {{200, -8, 8}});
histos.add("TrackPar/snp", "sinus of track momentum azimuthal angle;snp", kTH1D, {{11, -0.1, 0.1}});
histos.add("TrackPar/tgl", "tangent of the track momentum dip angle;tgl;", kTH1D, {{200, -1., 1.}});
histos.add("TrackPar/flags", "track flag;flag bit", kTH1D, {{64, -0.5, 63.5}});
histos.add("TrackPar/dcaXY", "distance of closest approach in #it{xy} plane;#it{dcaXY} [cm];", kTH1D, {{200, -0.15, 0.15}});
histos.add("TrackPar/dcaZ", "distance of closest approach in #it{z};#it{dcaZ} [cm];", kTH1D, {{200, -0.15, 0.15}});
histos.add("TrackPar/length", "track length in cm;#it{Length} [cm];", kTH1D, {{400, 0, 1000}});
// its histograms
histos.add("ITS/itsNCls", "number of found ITS clusters;# clusters ITS", kTH1D, {{8, -0.5, 7.5}});
histos.add("ITS/itsChi2NCl", "chi2 per ITS cluster;chi2 / cluster ITS", kTH1D, {{100, 0, 40}});
histos.add("ITS/itsHits", "hitmap ITS;layer ITS", kTH1D, {{7, -0.5, 6.5}});
// tpc histograms
histos.add("TPC/tpcNClsFindable", "number of findable TPC clusters;# findable clusters TPC", kTH1D, {{165, -0.5, 164.5}});
histos.add("TPC/tpcNClsFound", "number of found TPC clusters;# clusters TPC", kTH1D, {{165, -0.5, 164.5}});
histos.add("TPC/tpcNClsShared", "number of shared TPC clusters;# shared clusters TPC", kTH1D, {{165, -0.5, 164.5}});
histos.add("TPC/tpcNClsCrossedRows", "number of crossed TPC rows;# crossed rows TPC", kTH1D, {{165, -0.5, 164.5}});
histos.add("TPC/tpcFractionSharedCls", "fraction of shared TPC clusters;fraction shared clusters TPC", kTH1D, {{100, 0., 1.}});
histos.add("TPC/tpcCrossedRowsOverFindableCls", "crossed TPC rows over findable clusters;crossed rows / findable clusters TPC", kTH1D, {{120, 0.0, 1.2}});
histos.add("TPC/tpcChi2NCl", "chi2 per cluster in TPC;chi2 / cluster TPC", kTH1D, {{100, 0, 10}});
histos.print();
}
void process(soa::Filtered<soa::Join<aod::FullTracks, aod::TracksExtended, aod::TrackSelection>>::iterator const& track)
{
// fill kinematic variables
histos.fill(HIST("Kine/pt"), track.pt());
histos.fill(HIST("Kine/eta"), track.eta());
histos.fill(HIST("Kine/phi"), track.phi());
// fill track parameters
histos.fill(HIST("TrackPar/alpha"), track.alpha());
histos.fill(HIST("TrackPar/x"), track.x());
histos.fill(HIST("TrackPar/y"), track.y());
histos.fill(HIST("TrackPar/z"), track.z());
histos.fill(HIST("TrackPar/signed1Pt"), track.signed1Pt());
histos.fill(HIST("TrackPar/snp"), track.snp());
histos.fill(HIST("TrackPar/tgl"), track.tgl());
for (unsigned int i = 0; i < 64; i++) {
if (track.flags() & (1 << i)) {
histos.fill(HIST("TrackPar/flags"), i);
}
}
histos.fill(HIST("TrackPar/dcaXY"), track.dcaXY());
histos.fill(HIST("TrackPar/dcaZ"), track.dcaZ());
histos.fill(HIST("TrackPar/length"), track.length());
// fill ITS variables
histos.fill(HIST("ITS/itsNCls"), track.itsNCls());
histos.fill(HIST("ITS/itsChi2NCl"), track.itsChi2NCl());
for (unsigned int i = 0; i < 7; i++) {
if (track.itsClusterMap() & (1 << i)) {
histos.fill(HIST("ITS/itsHits"), i);
}
}
// fill TPC variables
histos.fill(HIST("TPC/tpcNClsFindable"), track.tpcNClsFindable());
histos.fill(HIST("TPC/tpcNClsFound"), track.tpcNClsFound());
histos.fill(HIST("TPC/tpcNClsShared"), track.tpcNClsShared());
histos.fill(HIST("TPC/tpcNClsCrossedRows"), track.tpcNClsCrossedRows());
histos.fill(HIST("TPC/tpcCrossedRowsOverFindableCls"), track.tpcCrossedRowsOverFindableCls());
histos.fill(HIST("TPC/tpcFractionSharedCls"), track.tpcFractionSharedCls());
histos.fill(HIST("TPC/tpcChi2NCl"), track.tpcChi2NCl());
}
};
struct TrackCutQATask {
HistogramRegistry cuts{"Cuts", {}, OutputObjHandlingPolicy::QAObject};
TrackSelection selectedTracks = getGlobalTrackSelection();
static constexpr int ncuts = static_cast<int>(TrackSelection::TrackCuts::kNCuts);
void init(InitContext&)
{
cuts.add("single_cut", ";Cut;Tracks", kTH1D, {{ncuts, 0, ncuts}});
for (int i = 0; i < ncuts; i++) {
cuts.get<TH1>(HIST("single_cut"))->GetXaxis()->SetBinLabel(1 + i, TrackSelection::mCutNames[i].data());
}
}
void process(soa::Join<aod::FullTracks, aod::TracksExtended>::iterator const& track)
{
for (int i = 0; i < ncuts; i++) {
if (selectedTracks.IsSelected(track, static_cast<TrackSelection::TrackCuts>(i))) {
cuts.fill(HIST("single_cut"), i);
}
}
}
};
//****************************************************************************************
/**
* QA task including MC truth info.
*/
//****************************************************************************************
struct TrackQATaskMC {
HistogramRegistry resolution{"Resolution", {}, OutputObjHandlingPolicy::QAObject};
void init(o2::framework::InitContext&){
};
void process(soa::Join<aod::FullTracks, aod::McTrackLabels>::iterator const& track){
};
};
//****************************************************************************************
/**
* Workflow definition.
*/
//****************************************************************************************
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
const bool isMC = cfgc.options().get<bool>("mc");
const int add_cut_qa = cfgc.options().get<int>("add-cut-qa");
WorkflowSpec workflow;
workflow.push_back(adaptAnalysisTask<TrackQATask>(cfgc, TaskName{"track-qa-histograms"}));
if (add_cut_qa) {
workflow.push_back(adaptAnalysisTask<TrackCutQATask>(cfgc, TaskName{"track-cut-qa-histograms"}));
}
if (isMC) {
workflow.push_back(adaptAnalysisTask<TrackQATaskMC>(cfgc, TaskName{"track-qa-histograms-mc"}));
}
return workflow;
}