|
9 | 9 | // or submit itself to any jurisdiction. |
10 | 10 |
|
11 | 11 | // O2 includes |
| 12 | +#include "ReconstructionDataFormats/Track.h" |
12 | 13 | #include "Framework/runDataProcessing.h" |
13 | 14 | #include "Framework/AnalysisTask.h" |
14 | 15 | #include "Framework/AnalysisDataModel.h" |
15 | | -#include "ReconstructionDataFormats/Track.h" |
16 | | -#include "PID/PIDResponse.h" |
17 | 16 | #include "Framework/ASoAHelpers.h" |
18 | | - |
19 | | -// ROOT includes |
20 | | -#include <TH1F.h> |
21 | | - |
22 | | -#define DOTH1F(OBJ, ...) \ |
23 | | - OutputObj<TH1F> OBJ{TH1F(#OBJ, __VA_ARGS__)}; |
24 | | -#define DOTH2F(OBJ, ...) \ |
25 | | - OutputObj<TH2F> OBJ{TH2F(#OBJ, __VA_ARGS__)}; |
| 17 | +#include "PID/PIDResponse.h" |
| 18 | +#include "Analysis/TrackSelectionTables.h" |
26 | 19 |
|
27 | 20 | using namespace o2; |
28 | 21 | using namespace o2::framework; |
29 | 22 | using namespace o2::framework::expressions; |
30 | 23 |
|
31 | | -#define TRACKSELECTION \ |
32 | | - UChar_t clustermap = i.itsClusterMap(); \ |
33 | | - bool issel = (i.tpcNClsFindable() > 70) && (i.flags() & 0x4) && (TESTBIT(clustermap, 0) || TESTBIT(clustermap, 1)); \ |
34 | | - issel = issel && (i.flags() & 0x2000); \ |
35 | | - issel = issel && (i.flags() & 0x80000000); \ |
36 | | - if (!issel) \ |
37 | | - continue; |
38 | | - |
39 | | -// #define TRACKSELECTION 1; |
40 | | - |
41 | | -struct TOFQATask { |
42 | | - // Event quantities |
43 | | - DOTH1F(hvtxz, ";Vertex Z position;Events", 300, -15, 15); |
44 | | - DOTH1F(hevtime, ";Event time (ns);Tracks", 100, -2, 2); |
45 | | - // Track quantities |
46 | | - DOTH1F(heta, ";#eta;Tracks", 100, -1, 1); |
47 | | - DOTH1F(hp, ";#it{p} (GeV/#it{c});Tracks", 100, 0, 20); |
48 | | - DOTH1F(hpt, ";#it{p}_{T} (GeV/#it{c});Tracks", 100, 0, 20); |
49 | | - DOTH1F(hlength, ";Track Length (cm);Tracks", 100, 0, 1000); |
50 | | - DOTH1F(htime, ";TOF Time (ns);Tracks", 1000, 0, 600); |
51 | | - // Beta |
52 | | - DOTH2F(hp_beta, ";#it{p} (GeV/#it{c});TOF #beta;Tracks", 100, 0, 20, 100, 0, 2); |
53 | | - |
54 | | - void process(aod::Collision const& collision, soa::Join<aod::Tracks, aod::TracksExtra, aod::pidRespTOF, aod::pidRespTOFbeta> const& tracks) |
55 | | - { |
56 | | - hvtxz->Fill(collision.posZ()); |
57 | | - for (auto i : tracks) { |
58 | | - // Track selection |
59 | | - TRACKSELECTION; |
60 | | - // |
61 | | - hevtime->Fill(collision.collisionTime() / 1000); |
62 | | - // hevtime->Fill(collision.collisionTime0() / 1000); |
63 | | - const float psq = sqrt(i.px() * i.px() + i.py() * i.py() + i.pz() * i.pz()); |
64 | | - heta->Fill(i.eta()); |
65 | | - hp->Fill(i.p()); |
66 | | - hpt->Fill(i.pt()); |
67 | | - // |
68 | | - hlength->Fill(i.length()); |
69 | | - htime->Fill(i.tofSignal() / 1000); |
70 | | - // Beta |
71 | | - hp_beta->Fill(i.p(), i.beta()); |
72 | | - } |
73 | | - } |
74 | | -}; |
75 | | - |
76 | | -struct TOFExpTimeQATask { |
77 | | - // T-Texp |
78 | | -#define TIT(part) Form(";#it{p} (GeV/#it{c});(t-t_{evt}-t_{exp %s});Tracks", part) |
79 | | - DOTH2F(htimediffEl, TIT("e"), 100, 0, 5, 100, -1000, 1000); |
80 | | - DOTH2F(htimediffMu, TIT("#mu"), 100, 0, 5, 100, -1000, 1000); |
81 | | - DOTH2F(htimediffPi, TIT("#pi"), 100, 0, 5, 100, -1000, 1000); |
82 | | - DOTH2F(htimediffKa, TIT("K"), 100, 0, 5, 100, -1000, 1000); |
83 | | - DOTH2F(htimediffPr, TIT("p"), 100, 0, 5, 100, -1000, 1000); |
84 | | - DOTH2F(htimediffDe, TIT("d"), 100, 0, 5, 100, -1000, 1000); |
85 | | - DOTH2F(htimediffTr, TIT("t"), 100, 0, 5, 100, -1000, 1000); |
86 | | - DOTH2F(htimediffHe, TIT("^{3}He"), 100, 0, 5, 100, -1000, 1000); |
87 | | - DOTH2F(htimediffAl, TIT("#alpha"), 100, 0, 5, 100, -1000, 1000); |
88 | | -#undef TIT |
89 | | - |
90 | | - void process(aod::Collision const& collision, soa::Join<aod::Tracks, aod::TracksExtra, aod::pidRespTOF, aod::pidRespTOFbeta> const& tracks) |
91 | | - { |
92 | | - for (auto i : tracks) { |
93 | | - // Track selection |
94 | | - TRACKSELECTION; |
95 | | - // |
96 | | - const float tof = i.tofSignal() - collision.collisionTime(); |
97 | | - htimediffEl->Fill(i.p(), tof - i.tofExpSignalEl()); |
98 | | - htimediffMu->Fill(i.p(), tof - i.tofExpSignalMu()); |
99 | | - htimediffPi->Fill(i.p(), tof - i.tofExpSignalPi()); |
100 | | - htimediffKa->Fill(i.p(), tof - i.tofExpSignalKa()); |
101 | | - htimediffPr->Fill(i.p(), tof - i.tofExpSignalPr()); |
102 | | - htimediffDe->Fill(i.p(), tof - i.tofExpSignalDe()); |
103 | | - htimediffTr->Fill(i.p(), tof - i.tofExpSignalTr()); |
104 | | - htimediffHe->Fill(i.p(), tof - i.tofExpSignalHe()); |
105 | | - htimediffAl->Fill(i.p(), tof - i.tofExpSignalAl()); |
106 | | - } |
107 | | - } |
108 | | -}; |
109 | | - |
110 | | -struct TOFNSigmaQATask { |
111 | | - // NSigma |
112 | | -#define TIT(part) Form(";#it{p} (GeV/#it{c});(t-t_{evt}-t_{exp %s})/N_{sigma %s};Tracks", part, part) |
113 | | - DOTH2F(hnsigmaEl, TIT("e"), 100, 0, 5, 100, -10, 10); |
114 | | - DOTH2F(hnsigmaMu, TIT("#mu"), 100, 0, 5, 100, -10, 10); |
115 | | - DOTH2F(hnsigmaPi, TIT("#pi"), 100, 0, 5, 100, -10, 10); |
116 | | - DOTH2F(hnsigmaKa, TIT("K"), 100, 0, 5, 100, -10, 10); |
117 | | - DOTH2F(hnsigmaPr, TIT("p"), 100, 0, 5, 100, -10, 10); |
118 | | - DOTH2F(hnsigmaDe, TIT("d"), 100, 0, 5, 100, -10, 10); |
119 | | - DOTH2F(hnsigmaTr, TIT("t"), 100, 0, 5, 100, -10, 10); |
120 | | - DOTH2F(hnsigmaHe, TIT("^{3}He"), 100, 0, 5, 100, -10, 10); |
121 | | - DOTH2F(hnsigmaAl, TIT("#alpha"), 100, 0, 5, 100, -10, 10); |
122 | | -#undef TIT |
| 24 | +const int Np = 9; |
| 25 | +const TString pN[Np] = {"El", "Mu", "Pi", "Ka", "Pr", "De", "Tr", "He", "Al"}; |
| 26 | +const TString pT[Np] = {"#mu", "#pi", "K", "p", "d", "t", "^{3}He", "#alpha"}; |
| 27 | +struct TOFSpectraTask { |
| 28 | + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; |
123 | 29 |
|
124 | | - void process(aod::Collision const& collision, soa::Join<aod::Tracks, aod::TracksExtra, aod::pidRespTOF, aod::pidRespTOFbeta> const& tracks) |
| 30 | + void init(o2::framework::InitContext&) |
125 | 31 | { |
126 | | - for (auto i : tracks) { |
127 | | - // Track selection |
128 | | - TRACKSELECTION; |
129 | | - // |
130 | | - hnsigmaEl->Fill(i.p(), i.tofNSigmaEl()); |
131 | | - hnsigmaMu->Fill(i.p(), i.tofNSigmaMu()); |
132 | | - hnsigmaPi->Fill(i.p(), i.tofNSigmaPi()); |
133 | | - hnsigmaKa->Fill(i.p(), i.tofNSigmaKa()); |
134 | | - hnsigmaPr->Fill(i.p(), i.tofNSigmaPr()); |
135 | | - hnsigmaDe->Fill(i.p(), i.tofNSigmaDe()); |
136 | | - hnsigmaTr->Fill(i.p(), i.tofNSigmaTr()); |
137 | | - hnsigmaHe->Fill(i.p(), i.tofNSigmaHe()); |
138 | | - hnsigmaAl->Fill(i.p(), i.tofNSigmaAl()); |
| 32 | + histos.add("p/Unselected", "Unselected;#it{p} (GeV/#it{c})", kTH1F, {{100, 0, 20}}); |
| 33 | + histos.add("pt/Unselected", "Unselected;#it{p}_{T} (GeV/#it{c})", kTH1F, {{100, 0, 20}}); |
| 34 | + for (int i = 0; i < Np; i++) { |
| 35 | + histos.add(Form("p/%s", pN[i].Data()), Form("%s;#it{p} (GeV/#it{c})", pT[i].Data()), kTH1F, {{100, 0, 20}}); |
| 36 | + histos.add(Form("pt/%s", pN[i].Data()), Form("%s;#it{p}_{T} (GeV/#it{c})", pT[i].Data()), kTH1F, {{100, 0, 20}}); |
139 | 37 | } |
| 38 | + histos.add("electronbeta/hp_El", ";#it{p} (GeV/#it{c})", kTH1F, {{100, 0, 20}}); |
| 39 | + histos.add("electronbeta/hpt_El", ";#it{p}_{T} (GeV/#it{c})", kTH1F, {{100, 0, 20}}); |
| 40 | + histos.add("electronbeta/hlength_El", ";Track Length (cm);Tracks", kTH1D, {{100, 0, 1000}}); |
| 41 | + histos.add("electronbeta/htime_El", ";TOF Time (ns);Tracks", kTH1D, {{1000, 0, 600}}); |
| 42 | + histos.add("electronbeta/hp_beta_El", ";#it{p} (GeV/#it{c});#beta - #beta_{e};Tracks", kTH2D, {{100, 0, 20}, {100, -0.01, 0.01}}); |
| 43 | + histos.add("electronbeta/hp_betasigma_El", ";#it{p} (GeV/#it{c});(#beta - #beta_{e})/#sigma;Tracks", kTH2D, {{100, 0, 20}, {100, -5, 5}}); |
140 | 44 | } |
141 | | -}; |
142 | 45 |
|
143 | | -struct TOFSpectraTask { |
144 | | - // Pt |
145 | | -#define TIT ";#it{p}_{T} (GeV/#it{c});Tracks" |
146 | | - DOTH1F(hpt_El, TIT, 100, 0, 20); |
147 | | - DOTH1F(hpt_Pi, TIT, 100, 0, 20); |
148 | | - DOTH1F(hpt_Ka, TIT, 100, 0, 20); |
149 | | - DOTH1F(hpt_Pr, TIT, 100, 0, 20); |
150 | | -#undef TIT |
151 | | - // P |
152 | | -#define TIT ";#it{p} (GeV/#it{c});Tracks" |
153 | | - DOTH1F(hp_El, TIT, 100, 0, 20); |
154 | | - DOTH1F(hp_Pi, TIT, 100, 0, 20); |
155 | | - DOTH1F(hp_Ka, TIT, 100, 0, 20); |
156 | | - DOTH1F(hp_Pr, TIT, 100, 0, 20); |
157 | | -#undef TIT |
158 | | - // |
159 | | - DOTH1F(hlength_El, ";Track Length (cm);Tracks", 100, 0, 1000); |
160 | | - DOTH1F(htime_El, ";TOF Time (ns);Tracks", 1000, 0, 600); |
161 | | - // DOTH1F(hevtime_El, ";Event time (ns);Tracks", 100, -2, 2); |
162 | | - // |
163 | | - DOTH2F(hp_beta_El, ";#it{p} (GeV/#it{c});#beta - #beta_{el};Tracks", 100, 0, 20, 100, -0.01, 0.01); |
164 | | - DOTH2F(hp_betasigma_El, ";#it{p} (GeV/#it{c});(#beta - #beta_{el})/#sigma;Tracks", 100, 0, 20, 100, -5, 5); |
| 46 | + Configurable<float> nsigmacut{"nsigmacut", 3, "Value of the Nsigma cut"}; |
165 | 47 |
|
166 | | - // Filter trk_filter = (aod::track::tpcNClsFindable > 70); |
| 48 | + Filter trackFilter = aod::track::isGlobalTrack == true; |
167 | 49 |
|
168 | | - void process(soa::Join<aod::Tracks, aod::TracksExtra, aod::pidRespTOF, aod::pidRespTOFbeta> const& tracks) |
| 50 | + using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::pidRespTOF, aod::pidRespTOFbeta, aod::TrackSelection>>; |
| 51 | + void process(TrackCandidates::iterator const& track) |
169 | 52 | { |
170 | | - for (auto i : tracks) { |
171 | | - // Track selection |
172 | | - TRACKSELECTION; |
173 | | - // |
174 | | - if (TMath::Abs(i.tofNSigmaPi()) < 3) { |
175 | | - hp_Pi->Fill(i.p()); |
176 | | - hpt_Pi->Fill(i.pt()); |
177 | | - } else if (TMath::Abs(i.tofNSigmaKa()) < 3) { |
178 | | - hp_Ka->Fill(i.p()); |
179 | | - hpt_Ka->Fill(i.pt()); |
180 | | - } else if (TMath::Abs(i.tofNSigmaPr()) < 3) { |
181 | | - hp_Pr->Fill(i.p()); |
182 | | - hpt_Pr->Fill(i.pt()); |
183 | | - } |
184 | | - if (TMath::Abs(i.separationbetael() < 1.f)) { |
185 | | - hp_El->Fill(i.p()); |
186 | | - hpt_El->Fill(i.pt()); |
187 | | - // |
188 | | - hlength_El->Fill(i.length()); |
189 | | - htime_El->Fill(i.tofSignal() / 1000); |
190 | | - // |
191 | | - hp_beta_El->Fill(i.p(), i.diffbetael()); |
192 | | - hp_betasigma_El->Fill(i.p(), i.separationbetael()); |
| 53 | + const float nsigma[Np] = {track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), |
| 54 | + track.tofNSigmaKa(), track.tofNSigmaPr(), track.tofNSigmaDe(), |
| 55 | + track.tofNSigmaTr(), track.tofNSigmaHe(), track.tofNSigmaAl()}; |
| 56 | + histos.fill("p/Unselected", track.p()); |
| 57 | + histos.fill("pt/Unselected", track.pt()); |
| 58 | + for (int i = 0; i < Np; i++) { |
| 59 | + if (abs(nsigma[i]) > nsigmacut.value) { |
| 60 | + continue; |
193 | 61 | } |
| 62 | + histos.fill(Form("p/%s", pN[i].Data()), track.p()); |
| 63 | + histos.fill(Form("pt/%s", pN[i].Data()), track.pt()); |
| 64 | + } |
| 65 | + // |
| 66 | + if (TMath::Abs(track.separationbetael() < 1.f)) { |
| 67 | + histos.fill("electronbeta/hp_El", track.p()); |
| 68 | + histos.fill("electronbeta/hpt_El", track.pt()); |
| 69 | + histos.fill("electronbeta/hlength_El", track.length()); |
| 70 | + histos.fill("electronbeta/htime_El", track.tofSignal() / 1000); |
| 71 | + histos.fill("electronbeta/hp_beta_El", track.p(), track.diffbetael()); |
| 72 | + histos.fill("electronbeta/hp_betasigma_El", track.p(), track.separationbetael()); |
194 | 73 | } |
195 | 74 | } |
196 | 75 | }; |
197 | 76 |
|
198 | 77 | WorkflowSpec defineDataProcessing(ConfigContext const&) |
199 | 78 | { |
200 | | - return WorkflowSpec{ |
201 | | - adaptAnalysisTask<TOFQATask>("tofqa-task"), |
202 | | - adaptAnalysisTask<TOFExpTimeQATask>("tofexptime-task"), |
203 | | - adaptAnalysisTask<TOFNSigmaQATask>("tofnsigma-task"), |
204 | | - adaptAnalysisTask<TOFSpectraTask>("tofspectra-task")}; |
| 79 | + WorkflowSpec workflow{adaptAnalysisTask<TOFSpectraTask>("tofspectra-task")}; |
| 80 | + return workflow; |
205 | 81 | } |
206 | | - |
207 | | -#undef TRACKSELECTION |
0 commit comments