CbmRoot
Loading...
Searching...
No Matches
CbmMvdQa.cxx
Go to the documentation of this file.
1/* Copyright (C) 2015-2019 Institut fuer Kernphysik, Goethe-Universitaet Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Philipp Sitzmann [committer] */
4
5// -------------------------------------------------------------------------
6// ----- CbmMvdQa source file -----
7// ----- Created 12/01/15 by P. Sitzmann -----
8// ------------------------------------------------------------------------
9#include "CbmMvdQa.h"
10
11#include "CbmGlobalTrack.h" // for CbmGlobalTrack
12#include "CbmLink.h" // for CbmLink
13#include "CbmMCTrack.h" // for CbmMCTrack
14#include "CbmMatch.h" // for CbmMatch
15#include "CbmMvdCluster.h" // for CbmMvdCluster
16#include "CbmMvdDetector.h" // for CbmMvdDetector
17#include "CbmMvdDigi.h" // for CbmMvdDigi
18#include "CbmMvdHit.h" // for CbmMvdHit
19#include "CbmMvdPoint.h" // for CbmMvdPoint
20#include "CbmMvdSensor.h" // for CbmMvdSensor
21#include "CbmMvdStationPar.h" // for CbmMvdStationPar
22#include "CbmStsTrack.h" // for CbmStsTrack
23#include "CbmTrackMatchNew.h" // for CbmTrackMatchNew
24#include "CbmTrackParam.h" // for CbmTrackParam
25#include "CbmVertex.h" // for CbmVertex
26
27#include <FairRootManager.h> // for FairRootManager
28#include <FairTask.h> // for InitStatus, FairTask
29#include <FairTrackParam.h> // for FairTrackParam
30#include <Logger.h> // for Logger, LOG
31
32#include <TAxis.h> // for TAxis
33#include <TCanvas.h> // for TCanvas
34#include <TClonesArray.h> // for TClonesArray
35#include <TFile.h> // for TFile
36#include <TH1.h> // for TH1F
37#include <TH2.h> // for TH2F
38#include <TObject.h> // for TObject
39#include <TStyle.h> // for TStyle, gStyle
40
41#include <cmath> // for sqrt, fabs
42
43using std::flush;
44
45// ----- Default constructor -------------------------------------------
46CbmMvdQa::CbmMvdQa() : CbmMvdQa("MvdQa", 0, 0) {}
47// -------------------------------------------------------------------------
48
49
50// ----- Standard constructor ------------------------------------------
51CbmMvdQa::CbmMvdQa(const char* name, Int_t iMode, Int_t iVerbose)
52 : FairTask(name, iVerbose)
53 , foutFile(nullptr)
54 , fNHitsOfLongTracks(0)
55 , fEventNumber(0)
56 , fminHitReq(0)
57 , fMvdRecoRatio(0.)
58 , fBadTrack(0)
59 , fUsedTracks(0)
60 , fnrOfMergedHits(0)
61 , fFirstMvdPos(0)
62 , fnrTrackslowP(0)
63 , fnrTracksHighP(0)
64 , flow(0)
65 , fmid(0)
66 , fhigh(0)
67 , fStsTrackArray(nullptr)
68 , fStsTrackArrayP(nullptr)
69 , fStsTrackArrayN(nullptr)
70 , fStsTrackMatches(nullptr)
71 , fGlobalTrackArray(nullptr)
72 , fListMCTracks(nullptr)
73 , fMCTrackArrayP(nullptr)
74 , fMCTrackArrayN(nullptr)
75 , fMcPoints(nullptr)
76 , fMvdDigis(nullptr)
77 , fMvdCluster(nullptr)
78 , fMvdHits(nullptr)
79 , fMvdHitMatchArray(nullptr)
80 , fMvdDigiMatchArray(nullptr)
81 , fBadTracks(nullptr)
82 , fInfoArray(nullptr)
83 , fMC1F()
84 , fMC2F()
85 , fDigi1F()
86 , fDigi2F()
87 , fHits1F()
88 , fHits2F()
89 , fTracks1F()
90 , fTracks2F()
91 , fPrimVtx(nullptr)
92 , fSecVtx(nullptr)
93 , fDetector(nullptr)
94 , useMcQa(kFALSE)
95 , useDigiQa(kFALSE)
96 , useHitQa(kFALSE)
97 , useTrackQa(kFALSE)
98 , fMode(iMode)
99 , fdraw(kFALSE)
100{
101}
102// -------------------------------------------------------------------------
103
104
105// ----- Destructor ----------------------------------------------------
107// -------------------------------------------------------------------------
108
109// -------------------------------------------------------------------------
110InitStatus CbmMvdQa::Init()
111{
112 LOG(info) << GetName() << "::Init: Start Initilisation ";
113
114 FairRootManager* ioman = FairRootManager::Instance();
115 if (!ioman) {
116 LOG(error) << GetName() << "::Init: RootManager not instantised!";
117 return kFATAL;
118 }
119 fBadTracks = new TClonesArray("CbmStsTrack", 5000);
120 ioman->Register("BadTracks", "sts", fBadTracks, IsOutputBranchPersistent("BadTracks"));
121
122 if (useTrackQa) {
123 fStsTrackMatches = (TClonesArray*) ioman->GetObject("StsTrackMatch");
124 fStsTrackArray = (TClonesArray*) ioman->GetObject("StsTrack");
125 fGlobalTrackArray = (TClonesArray*) ioman->GetObject("GlobalTrack");
126
127 if (!fStsTrackArray) {
128 Fatal("CbmMvdQa: StsTrackArray not found (!)", " That's bad. ");
129 }
130
131 // fPrimVtx = (CbmVertex*) ioman->GetObject("PrimaryVertex");
132 // Get pointer to PrimaryVertex object from IOManager if it exists
133 // The old name for the object is "PrimaryVertex" the new one
134 // "PrimaryVertex." Check first for the new name
135 fPrimVtx = dynamic_cast<CbmVertex*>(ioman->GetObject("PrimaryVertex."));
136 if (nullptr == fPrimVtx) {
137 fPrimVtx = dynamic_cast<CbmVertex*>(ioman->GetObject("PrimaryVertex"));
138 }
139 if (nullptr == fPrimVtx) {
140 // LOG(fatal) << "No primary vertex";
141 }
142 }
143
144 fMcPoints = (TClonesArray*) ioman->GetObject("MvdPoint"); // PileUp Mc points
145 fMvdDigis = (TClonesArray*) ioman->GetObject("MvdDigi");
146 fMvdCluster = (TClonesArray*) ioman->GetObject("MvdCluster");
147 fMvdHits = (TClonesArray*) ioman->GetObject("MvdHit");
148 fMvdHitMatchArray = (TClonesArray*) ioman->GetObject("MvdHitMatch");
149 fMvdDigiMatchArray = (TClonesArray*) ioman->GetObject("MvdDigiMatch");
150
151 if (fMvdHits->GetEntriesFast() != fMvdHitMatchArray->GetEntriesFast())
152 LOG(error) << "MvdHit and MvdHitMatch Arrays do not have the same size";
153
154 fListMCTracks = (TClonesArray*) ioman->GetObject("MCTrack");
155
156 if (!fMcPoints) {
157 LOG(error) << "Mvd Pile Up Mc array missing";
158 return kFATAL;
159 }
161 fDetector->Init();
162
164 fFirstMvdPos = fPar->GetZPosition(0);
165
166 fnrTrackslowP = 0;
167 fnrTracksHighP = 0;
168 flow = 0;
169 fmid = 0;
170 fhigh = 0;
171
173
174 LOG(info) << GetName() << "::Init: Finished Initialisation ";
175 return kSUCCESS;
176}
177
178// -------------------------------------------------------------------------
186// -------------------------------------------------------------------------
187
188// -------------------------------------------------------------------------
190{
191 // fMC1F[] = new TH1F("fMC1F[]","",100, 0, 100);
192 // fMC1F[]->GetXaxis()->SetTitle("");
193 // fMC1F[]->GetYaxis()->SetTitle("");
194
195 fMC1F[0] = new TH1F("fMC1F[0]", "Matching efficientcy in the mvd", 100, 0, 1.5);
196 fMC1F[0]->GetXaxis()->SetTitle(" 1 - (Incorrect / Total) ");
197 fMC1F[0]->GetYaxis()->SetTitle("Entries");
198
199 // fMC2F[] = new TH2F("fMC2F[]","",100, 0, 100, 100, 0, 100);
200 // fMC2F[]->GetXaxis()->SetTitle("");
201 // fMC2F[]->GetYaxis()->SetTitle("");
202
203 fMC2F[0] = new TH2F("fMC2F[0]", "MC-Distribution on the first Station", 100, 0, 10, 100, 0, 10);
204 fMC2F[0]->GetXaxis()->SetTitle("X-Pos[cm]");
205 fMC2F[0]->GetYaxis()->SetTitle("Y-Pos[cm]");
206}
207// -------------------------------------------------------------------------
208
209// -------------------------------------------------------------------------
211{
212 // fDigi1F[] = new TH1F("fDigi1F[]","",100, 0, 100);
213 // fDigi1F[]->GetXaxis()->SetTitle("");
214 // fDigi1F[]->GetYaxis()->SetTitle("");
215
216 fDigi1F[0] = new TH1F("fDigi1F[0]", "Number of digis per MC-Point", 100, 0, 30);
217 fDigi1F[0]->GetXaxis()->SetTitle("number of digis");
218 fDigi1F[0]->GetYaxis()->SetTitle("entries");
219
220 fDigi1F[1] = new TH1F("fDigi1F[1]", "Number of MC-Point per Digi", 100, 0, 10);
221 fDigi1F[1]->GetXaxis()->SetTitle("number of MC-Points");
222 fDigi1F[1]->GetYaxis()->SetTitle("entries");
223
224 // fDigi2F[] = new TH2F("fDigi2F[]","",100, 0, 100, 100, 0, 100);
225 // fDigi2F[]->GetXaxis()->SetTitle("");
226 // fDigi2F[]->GetYaxis()->SetTitle("");
227
228 fDigi2F[0] =
229 new TH2F("fDigi2F[0]", "Distribution of digis on worst spot on the first MVD statio", 100, -4, 0, 100, -2, 5);
230 fDigi2F[0]->GetXaxis()->SetTitle("x [cm]");
231 fDigi2F[0]->GetYaxis()->SetTitle("y [cm]");
232
233 fDigi2F[1] = new TH2F("fDigi2F[1]", "Distribution of digis on first MVD station", 100, -4, 4, 100, -4, 4);
234 fDigi2F[1]->GetXaxis()->SetTitle("x [cm]");
235 fDigi2F[1]->GetYaxis()->SetTitle("y [cm]");
236
237 fDigi2F[2] = new TH2F("fDigi2F[2]", "Distribution of digis on second MVD station", 100, -8, 8, 100, 8, 8);
238 fDigi2F[2]->GetXaxis()->SetTitle("x [cm]");
239 fDigi2F[2]->GetYaxis()->SetTitle("y [cm]");
240
241 fDigi2F[3] = new TH2F("fDigi2F[3]", "Distribution of digis on third MVD station", 100, -12, 12, 100, -12, 12);
242 fDigi2F[3]->GetXaxis()->SetTitle("x [cm]");
243 fDigi2F[3]->GetYaxis()->SetTitle("y [cm]");
244
245 fDigi2F[4] = new TH2F("fDigi2F[4]", "Distribution of digis on fourth MVD station", 100, -16, 16, 100, -16, 16);
246 fDigi2F[4]->GetXaxis()->SetTitle("x [cm]");
247 fDigi2F[4]->GetYaxis()->SetTitle("y [cm]");
248}
249// -------------------------------------------------------------------------
250
251// -------------------------------------------------------------------------
253{
254 // fHits1F[] = new TH1F("fHits1F[]","",100, 0, 100);
255 // fHits1F[]->GetXaxis()->SetTitle("");
256 // fHits1F[]->GetYaxis()->SetTitle("");
257
258 fHits1F[0] = new TH1F("fHits1F[0]", "Hit per Digi", 100, 0, 3);
259 fHits1F[0]->GetXaxis()->SetTitle("number of hits");
260 fHits1F[0]->GetYaxis()->SetTitle("entries");
261
262 fHits1F[1] = new TH1F("fHits1F[1]", "Digis Per Hit", 100, 0, 12);
263 fHits1F[1]->GetXaxis()->SetTitle("number of digis");
264 fHits1F[1]->GetYaxis()->SetTitle("entries");
265
266 fHits1F[2] = new TH1F("fHits1F[2]", "Error in x position of reconstructed hit", 1000, -100, 100);
267 fHits1F[2]->GetXaxis()->SetTitle("x_hit - x_mc [mu m]");
268 fHits1F[2]->GetYaxis()->SetTitle("entries");
269
270 fHits1F[3] = new TH1F("fHits1F[3]", "Error in y position of reconstructed hit", 1000, -100, 100);
271 fHits1F[3]->GetXaxis()->SetTitle("y_hit - y_mc [mu m]");
272 fHits1F[3]->GetYaxis()->SetTitle("entries");
273
274 fHits1F[4] = new TH1F("fHits1F[4]", "Pull in x position of reconstructed hit", 1000, -20, 20);
275 fHits1F[4]->GetXaxis()->SetTitle("x_error / xRes");
276 fHits1F[4]->GetYaxis()->SetTitle("entries");
277
278 fHits1F[5] = new TH1F("fHits1F[5]", "Pull in y position of reconstructed hit", 1000, -20, 20);
279 fHits1F[5]->GetXaxis()->SetTitle("y_error / yRes");
280 fHits1F[5]->GetYaxis()->SetTitle("entries");
281
282
283 fHits2F[0] =
284 new TH2F("fHits2F[0]", "Distribution of Hits in worst spot on the first Station", 100, -2.1, -0.4, 100, -1.5, 1.5);
285 fHits2F[0]->GetXaxis()->SetTitle("x [cm]");
286 fHits2F[0]->GetYaxis()->SetTitle("y [cm]");
287
288 // fHits2F[] = new TH2F("fHits2F[]","",100, 0, 100, 100, 0, 100);
289 // fHits2F[]->GetXaxis()->SetTitle("");
290 // fHits2F[]->GetYaxis()->SetTitle("");
291}
292// -------------------------------------------------------------------------
293
294// -------------------------------------------------------------------------
296{
297
298 fTracks1F[0] = new TH1F("fTracks1F[0]", "reconstructed tracks in bins of p", 300, 0, 3);
299 fTracks1F[0]->GetXaxis()->SetTitle("Momentum [GeV]");
300 fTracks1F[0]->GetYaxis()->SetTitle("Entries");
301
302 fTracks1F[1] = new TH1F("fTracks1F[1]", "track reconstruction efficiency in bins of p", 300, 0, 3);
303 fTracks1F[1]->GetXaxis()->SetTitle("Momentum [GeV]");
304 fTracks1F[1]->GetYaxis()->SetTitle("correct reco / all reco");
305
306 fTracks1F[2] = new TH1F("fTracks1F[2]", "tracks with 4 hits in the mvd", 200, 0, 15);
307 fTracks1F[2]->GetXaxis()->SetTitle("Momentum [GeV]");
308 fTracks1F[2]->GetYaxis()->SetTitle("Entries");
309
310 fTracks1F[3] = new TH1F("fTracks1F[3]", "tracks with 4 correct hits in the mvd", 200, 0, 15);
311 fTracks1F[3]->GetXaxis()->SetTitle("Momentum [GeV]");
312 fTracks1F[3]->GetYaxis()->SetTitle("Entries");
313
314 fTracks1F[4] = new TH1F("fTracks1F[4]", "correct reconstructed tracks with 4 hits in the mvd", 200, 0, 15);
315 fTracks1F[4]->GetXaxis()->SetTitle("Momentum [GeV]");
316 fTracks1F[4]->GetYaxis()->SetTitle("Entries");
317
318 fTracks1F[5] = new TH1F("fTracks1F[5]", "Resolution in x at z = z Mc Vertex", 1000, -0.02, 0.02);
319 fTracks1F[5]->GetXaxis()->SetTitle("x [cm]");
320 fTracks1F[5]->GetYaxis()->SetTitle("Entries");
321
322 fTracks1F[6] = new TH1F("fTracks1F[6]", "Resolution in y at z = z Mc Vertex", 1000, -0.02, 0.02);
323 fTracks1F[6]->GetXaxis()->SetTitle("y [cm]");
324 fTracks1F[6]->GetYaxis()->SetTitle("Entries");
325
326 fTracks1F[7] = new TH1F("fTracks1F[7]", "Resolution in x at z = z Mc Vertex, 4 mvd hits", 1000, -0.02, 0.02);
327 fTracks1F[7]->GetXaxis()->SetTitle("x [cm]");
328 fTracks1F[7]->GetYaxis()->SetTitle("Entries");
329
330 fTracks1F[8] = new TH1F("fTracks1F[8]", "Resolution in y at z = z Mc Vertex, 4 mvd hits", 1000, -0.02, 0.02);
331 fTracks1F[8]->GetXaxis()->SetTitle("y [cm]");
332 fTracks1F[8]->GetYaxis()->SetTitle("Entries");
333
334 fTracks1F[9] = new TH1F("fTracks1F[9]", "Resolution in x at z = z Mc Vertex, hit in first mvd", 1000, -0.02, 0.02);
335 fTracks1F[9]->GetXaxis()->SetTitle("x [cm]");
336 fTracks1F[9]->GetYaxis()->SetTitle("Entries");
337
338 fTracks1F[10] = new TH1F("fTracks1F[10]", "Resolution in y at z = z Mc Vertex, hit in first mvd", 1000, -0.02, 0.02);
339 fTracks1F[10]->GetXaxis()->SetTitle("y [cm]");
340 fTracks1F[10]->GetYaxis()->SetTitle("Entries");
341
342 fTracks1F[11] =
343 new TH1F("fTracks1F[11]", "Resolution in x at z = z Mc Vertex, no hit in first mvd", 1000, -0.02, 0.02);
344 fTracks1F[11]->GetXaxis()->SetTitle("x [cm]");
345 fTracks1F[11]->GetYaxis()->SetTitle("Entries");
346
347 fTracks1F[12] =
348 new TH1F("fTracks1F[12]", "Resolution in y at z = z Mc Vertex, no hit in first mvd", 1000, -0.02, 0.02);
349 fTracks1F[12]->GetXaxis()->SetTitle("y [cm]");
350 fTracks1F[12]->GetYaxis()->SetTitle("Entries");
351
352 fTracks1F[13] =
353 new TH1F("fTracks1F[13]", "Resolution in x at z = z Mc Vertex, true hit in first mvd", 1000, -0.02, 0.02);
354 fTracks1F[13]->GetXaxis()->SetTitle("x [cm]");
355 fTracks1F[13]->GetYaxis()->SetTitle("Entries");
356
357 fTracks1F[14] =
358 new TH1F("fTracks1F[14]", "Resolution in y at z = z Mc Vertex, true hit in first mvd", 1000, -0.02, 0.02);
359 fTracks1F[14]->GetXaxis()->SetTitle("y [cm]");
360 fTracks1F[14]->GetYaxis()->SetTitle("Entries");
361
362 fTracks1F[15] =
363 new TH1F("fTracks1F[15]", "Resolution in x at z = z Mc Vertex, wrong hit in first mvd", 1000, -0.02, 0.02);
364 fTracks1F[15]->GetXaxis()->SetTitle("x [cm]");
365 fTracks1F[15]->GetYaxis()->SetTitle("Entries");
366
367 fTracks1F[16] =
368 new TH1F("fTracks1F[16]", "Resolution in y at z = z Mc Vertex, wrong hit in first mvd", 1000, -0.02, 0.02);
369 fTracks1F[16]->GetXaxis()->SetTitle("y [cm]");
370 fTracks1F[16]->GetYaxis()->SetTitle("Entries");
371
372 fTracks1F[17] =
373 new TH1F("fTracks1F[17]", "Chi Squard over NDF of Tracks with wrong attached hit in first Mvd", 100, 0, 10);
374 fTracks1F[17]->GetXaxis()->SetTitle("chi^2 / NDF");
375 fTracks1F[17]->GetYaxis()->SetTitle("Entries");
376
377 fTracks1F[18] = new TH1F("fTracks1F[18]", "Chi Squard over NDF of Tracks with correct hit in first Mvd", 100, 0, 10);
378 fTracks1F[18]->GetXaxis()->SetTitle("chi^2 / NDF");
379 fTracks1F[18]->GetYaxis()->SetTitle("Entries");
380
381 fTracks1F[19] = new TH1F("fTracks1F[19]", "Chi Squard over NDF of all Tracks with hit in first Mvd", 100, 0, 10);
382 fTracks1F[19]->GetXaxis()->SetTitle("chi^2 / NDF");
383 fTracks1F[19]->GetYaxis()->SetTitle("Entries");
384
385 fTracks1F[20] = new TH1F("fTracks1F[20]", "Impactparam Tracks with ChiSq/NDF > 1", 100, 0, 0.10);
386 fTracks1F[20]->GetXaxis()->SetTitle("impactparam R [cm]");
387 fTracks1F[20]->GetYaxis()->SetTitle("Entries");
388
389 fTracks1F[21] = new TH1F("fTracks1F[21]", "Impactparam Tracks with ChiSq/NDF <= 1", 100, 0, 0.1);
390 fTracks1F[21]->GetXaxis()->SetTitle("impactparam R [cm]");
391 fTracks1F[21]->GetYaxis()->SetTitle("Entries");
392
393 fTracks1F[22] = new TH1F("fTracks1F[22]",
394 "Resolution in x at z = z Mc Vertex, wrong hit in "
395 "first mvd, Positive Tracks",
396 100, -0.1, 0.1);
397 fTracks1F[22]->GetXaxis()->SetTitle("x [cm]");
398 fTracks1F[22]->GetYaxis()->SetTitle("Entries");
399
400 fTracks1F[23] = new TH1F("fTracks1F[23]",
401 "Resolution in x at z = z Mc Vertex, wrong hit in "
402 "first mvd, Negative Tracks",
403 100, -0.1, 0.1);
404 fTracks1F[23]->GetXaxis()->SetTitle("x [cm]");
405 fTracks1F[23]->GetYaxis()->SetTitle("Entries");
406
407 fTracks1F[24] =
408 new TH1F("fTracks1F[24]", "Impactparam X Tracks with ChiSq/NDF > 1, wrong hit in first station", 100, -0.10, 0.10);
409 fTracks1F[24]->GetXaxis()->SetTitle("x [cm]");
410 fTracks1F[24]->GetYaxis()->SetTitle("Entries");
411
412 fTracks1F[25] =
413 new TH1F("fTracks1F[25]", "Impactparam x Tracks with ChiSq/NDF <= 1, wrong hit in first station", 100, -0.10, 0.10);
414 fTracks1F[25]->GetXaxis()->SetTitle("x [cm]");
415 fTracks1F[25]->GetYaxis()->SetTitle("Entries");
416
417 fTracks1F[26] = new TH1F("fTracks1F[26]",
418 "Impactparam X Tracks with momentum >= 1 GeV, wrong "
419 "hit in first station, p Tracks",
420 100, -0.10, 0.10);
421 fTracks1F[26]->GetXaxis()->SetTitle("x [cm]");
422 fTracks1F[26]->GetYaxis()->SetTitle("Entries");
423
424 fTracks1F[27] = new TH1F("fTracks1F[27]",
425 "Impactparam X Tracks with momentum < 1 GeV, wrong "
426 "hit in first station, p Tracks",
427 100, -0.10, 0.10);
428 fTracks1F[27]->GetXaxis()->SetTitle("x [cm]");
429 fTracks1F[27]->GetYaxis()->SetTitle("Entries");
430
431 fTracks1F[28] = new TH1F("fTracks1F[28]",
432 "Impactparam X Tracks with momentum >= 1 GeV, wrong "
433 "hit in first station, n Tracks",
434 100, -0.10, 0.10);
435 fTracks1F[28]->GetXaxis()->SetTitle("x [cm]");
436 fTracks1F[28]->GetYaxis()->SetTitle("Entries");
437
438 fTracks1F[29] = new TH1F("fTracks1F[29]",
439 "Impactparam X Tracks with momentum < 1 GeV, wrong "
440 "hit in first station, n Tracks",
441 100, -0.10, 0.10);
442 fTracks1F[29]->GetXaxis()->SetTitle("x [cm]");
443 fTracks1F[29]->GetYaxis()->SetTitle("Entries");
444
445 fTracks1F[30] =
446 new TH1F("fTracks1F[30]", "mc x position of correct hit - x pos of wrongly attached hit", 100, -0.01, 0.01);
447 fTracks1F[30]->GetXaxis()->SetTitle("x [mu m]");
448 fTracks1F[30]->GetYaxis()->SetTitle("Entries");
449
450 fTracks1F[31] =
451 new TH1F("fTracks1F[31]", "mc y position of correct hit - y pos of wrongly attached hit", 100, -0.01, 0.01);
452 fTracks1F[31]->GetXaxis()->SetTitle("y [mu m]");
453 fTracks1F[31]->GetYaxis()->SetTitle("Entries");
454
455 fTracks1F[32] =
456 new TH1F("fTracks1F[32]", "Resolution in x at z = z Mc Vertex, 4 mvd hits, trueOverAll == 1", 1000, -0.02, 0.02);
457 fTracks1F[32]->GetXaxis()->SetTitle("x [cm]");
458 fTracks1F[32]->GetYaxis()->SetTitle("Entries");
459
460 fTracks1F[33] =
461 new TH1F("fTracks1F[33]", "Resolution in y at z = z Mc Vertex, 4 mvd hits, trueOverAll == 1", 1000, -0.02, 0.02);
462 fTracks1F[33]->GetXaxis()->SetTitle("y [cm]");
463 fTracks1F[33]->GetYaxis()->SetTitle("Entries");
464
465
466 fTracks2F[0] = new TH2F("fTracks2F[0]", "Momentumresolution all Tracks", 200, 0, 15, 100, -0.2, 0.2);
467 fTracks2F[0]->GetXaxis()->SetTitle("MC-Momentum [GeV]");
468 fTracks2F[0]->GetYaxis()->SetTitle("MC-Momentum - Reco-Momentum [GeV]");
469
470 fTracks2F[1] =
471 new TH2F("fTracks2F[1]", "Momentumresolution correct reconstructed Tracks", 200, 0, 15, 100, -0.2, 0.2);
472 fTracks2F[1]->GetXaxis()->SetTitle("MC-Momentum [GeV]");
473 fTracks2F[1]->GetYaxis()->SetTitle("MC-Momentum - Reco-Momentum [GeV]");
474
475 fTracks2F[2] =
476 new TH2F("fTracks2F[2]", "Momentumresolution Tracks with 4 hits in the mvd", 200, 0, 15, 100, -0.2, 0.2);
477 fTracks2F[2]->GetXaxis()->SetTitle("MC-Momentum [GeV]");
478 fTracks2F[2]->GetYaxis()->SetTitle("MC-Momentum - Reco-Momentum [GeV]");
479
480 fTracks2F[3] =
481 new TH2F("fTracks2F[3]", "Momentumresolution Tracks with 4 correct hits in the mvd", 200, 0, 15, 100, -0.2, 0.2);
482 fTracks2F[3]->GetXaxis()->SetTitle("MC-Momentum [GeV]");
483 fTracks2F[3]->GetYaxis()->SetTitle("MC-Momentum - Reco-Momentum [GeV]");
484
485 fTracks2F[4] = new TH2F("fTracks2F[4]", "Momentumresolution correct reconstructed Tracks with 4 hits in the mvd", 200,
486 0, 15, 100, -0.2, 0.2);
487 fTracks2F[4]->GetXaxis()->SetTitle("MC-Momentum [GeV]");
488 fTracks2F[4]->GetYaxis()->SetTitle("MC-Momentum - Reco-Momentum [GeV]");
489
490 fTracks2F[5] =
491 new TH2F("fTracks2F[5]", "Momentumresolution Tracks with hit in the first mvd station", 200, 0, 15, 100, -0.2, 0.2);
492 fTracks2F[5]->GetXaxis()->SetTitle("MC-Momentum [GeV]");
493 fTracks2F[5]->GetYaxis()->SetTitle("MC-Momentum - Reco-Momentum [GeV]");
494
495 fTracks2F[6] = new TH2F("fTracks2F[6]", "Momentumresolution Tracks with no hit in the first mvd station", 200, 0, 15,
496 100, -0.2, 0.2);
497 fTracks2F[6]->GetXaxis()->SetTitle("MC-Momentum [GeV]");
498 fTracks2F[6]->GetYaxis()->SetTitle("MC-Momentum - Reco-Momentum [GeV]");
499
500 fTracks2F[7] =
501 new TH2F("fTracks2F[7]", "Position of wrong attached Hit in first Mvd Station", 200, -3, 3, 200, -3, 3);
502 fTracks2F[7]->GetXaxis()->SetTitle("x [cm]");
503 fTracks2F[7]->GetYaxis()->SetTitle("y [cm]");
504
505 fTracks2F[8] = new TH2F("fTracks2F[8]",
506 "Position of wrong attached Hit in first Mvd "
507 "Station, with good ChiSq over NDF",
508 200, -3, 3, 200, -3, 3);
509 fTracks2F[8]->GetXaxis()->SetTitle("x [cm]");
510 fTracks2F[8]->GetYaxis()->SetTitle("y [cm]");
511
512 fTracks2F[9] = new TH2F("fTracks2F[9]",
513 "Propability to pick up the wrong hit on the first "
514 "MVD Station 2 bins cut at 1.5 GeV",
515 2, 0, 1, 2, 0, 1);
516 fTracks2F[9]->GetXaxis()->SetBinLabel(1, "0 - 1 GeV");
517 fTracks2F[9]->GetXaxis()->SetBinLabel(2, "1 - 1.5 GeV");
518 fTracks2F[9]->GetYaxis()->SetBinLabel(1, "wrong Hit");
519 fTracks2F[9]->GetYaxis()->SetBinLabel(2, "correct Hit");
520
521 fTracks2F[10] = new TH2F("fTracks2F[10]", "Vertexresolution of wrong attached Hit in first Mvd Station", 200, -0.04,
522 0.04, 200, -0.01, 0.01);
523 fTracks2F[10]->GetXaxis()->SetTitle("X at glVertex [cm]");
524 fTracks2F[10]->GetYaxis()->SetTitle("Y at glVertex [cm] ");
525
526 fTracks2F[11] = new TH2F("fTracks2F[11]",
527 "Propability to pick up the wrong hit on the first "
528 "MVD Station 2 bins cut at 0.5 , 1 GeV",
529 3, 0, 1.5, 2, 0, 1);
530 fTracks2F[11]->GetXaxis()->SetBinLabel(1, "0 - 0.5 GeV");
531 fTracks2F[11]->GetXaxis()->SetBinLabel(2, "0.5 - 1 GeV");
532 fTracks2F[11]->GetXaxis()->SetBinLabel(3, "1 - 1.5 GeV");
533 fTracks2F[11]->GetYaxis()->SetBinLabel(1, "wrong Hit");
534 fTracks2F[11]->GetYaxis()->SetBinLabel(2, "correct Hit");
535}
536// -------------------------------------------------------------------------
537
538// -------------------------------------------------------------------------
539void CbmMvdQa::Exec(Option_t* /*opt*/)
540{
541 fEventNumber++;
542 if (fEventNumber % 10 == 0) LOG(info) << "CbmMvdQa is running Event " << fEventNumber;
543
544 if (useMcQa) ExecMCQa();
545 if (useDigiQa) ExecDigiQa();
546 if (useHitQa) ExecHitQa();
547 if (useTrackQa) ExecTrackQa();
548}
549// -------------------------------------------------------------------------
550
551// -------------------------------------------------------------------------
553{
554 Int_t nrMcPoints = fMcPoints->GetEntriesFast();
555
556 for (Int_t i = 0; i < nrMcPoints; ++i) {
557 CbmMvdPoint* curMc = (CbmMvdPoint*) fMcPoints->At(i);
558 if (curMc->GetZ() < fFirstMvdPos + 1) {
559 fMC2F[0]->Fill(curMc->GetX(), curMc->GetY());
560 }
561 }
562}
563// -------------------------------------------------------------------------
564
565// -------------------------------------------------------------------------
567{
568 Int_t nrDigis = fMvdDigis->GetEntriesFast();
569 Int_t nrSensor = fDetector->GetSensorArraySize();
570 Int_t nrMcPoints = fMcPoints->GetEntriesFast();
571
572 Int_t digisPerMcPoints[nrMcPoints]; // = {0};
573 Int_t McPointsPerDigi[nrDigis]; // = {0};
574
575 for (Int_t i = 0; i < nrDigis; i++) {
576 CbmMvdDigi* curDigi = (CbmMvdDigi*) fMvdDigis->At(i);
577 CbmMatch* curMatch = (CbmMatch*) fMvdDigiMatchArray->At(i);
578 Int_t nrOfContributors = curMatch->GetNofLinks();
579 for (Int_t j = 0; j < nrOfContributors; j++) {
580 digisPerMcPoints[curMatch->GetLink(j).GetIndex()]++;
581 }
582 McPointsPerDigi[i] = nrOfContributors;
583
584 for (Int_t n = 0; n < nrSensor; n++) {
585 CbmMvdSensor* curSens = fDetector->GetSensor(n);
586 Double_t lab[3] = {0., 0., 0.};
587 if (curSens->GetDetectorID() == curDigi->GetDetectorId()) {
588 curSens->PixelToTop(curDigi->GetPixelX(), curDigi->GetPixelY(), lab);
589 if (curSens->GetZ() < 6)
590 fDigi2F[1]->Fill(lab[0], lab[1]);
591 else if (curSens->GetZ() < 11)
592 fDigi2F[2]->Fill(lab[0], lab[1]);
593 else if (curSens->GetZ() < 16)
594 fDigi2F[3]->Fill(lab[0], lab[1]);
595 else
596 fDigi2F[4]->Fill(lab[0], lab[1]);
597
598 if (lab[0] > -2 && lab[0] <= -0.5 && lab[1] >= -1.5 && lab[1] <= 1.5) {
599 fDigi2F[0]->Fill(lab[0], lab[1]);
600 }
601 }
602 }
603 }
604
605 for (Int_t i = 0; i < nrMcPoints; i++)
606 fDigi1F[0]->Fill(digisPerMcPoints[i]);
607
608 for (Int_t i = 0; i < nrDigis; i++)
609 fDigi1F[1]->Fill(McPointsPerDigi[i]);
610}
611// -------------------------------------------------------------------------
612
613// -------------------------------------------------------------------------
615{
616 Int_t nrHits = fMvdHits->GetEntriesFast();
617 // Int_t nrDigis = fMvdDigis->GetEntriesFast();
618
619 Int_t DigisPerHit[nrHits];
620
621 Float_t xRes = 3.8;
622 Float_t yRes = 4.8;
623
624 for (Int_t k = 0; k < nrHits; k++) {
625 CbmMvdHit* curHit = (CbmMvdHit*) fMvdHits->At(k);
626 CbmMatch* curMatch = (CbmMatch*) fMvdHitMatchArray->At(k);
627 CbmMvdPoint* curMc = (CbmMvdPoint*) fMcPoints->At(curMatch->GetMatchedLink().GetIndex());
628 Float_t xErr = 10000 * (curHit->GetX() - curMc->GetX());
629 Float_t yErr = 10000 * (curHit->GetY() - curMc->GetY());
630
631
632 CbmMvdCluster* curCluster = (CbmMvdCluster*) fMvdCluster->At(curHit->GetClusterIndex());
633 DigisPerHit[k] = curCluster->GetTotalDigisInCluster();
634
635 if (curHit->GetX() > -2 && curHit->GetX() <= -0.5 && curHit->GetY() >= -1.5 && curHit->GetY() <= 1.5) {
636 fHits2F[0]->Fill(curHit->GetX(), curHit->GetY());
637 }
638
639 fHits1F[2]->Fill(xErr);
640 fHits1F[3]->Fill(yErr);
641 fHits1F[4]->Fill(xErr / xRes);
642 fHits1F[5]->Fill(yErr / yRes);
643 }
644
645 for (Int_t i = 0; i < nrHits; i++)
646 fHits1F[1]->Fill(DigisPerHit[i]);
647}
648// -------------------------------------------------------------------------
649
650// -------------------------------------------------------------------------
652{
653
654 CbmStsTrack* stsTrack;
655
656 Int_t nTracks = fStsTrackArray->GetEntriesFast();
657 Int_t nMcTracks = fListMCTracks->GetEntriesFast();
658 Int_t nGlobalTracks = fGlobalTrackArray->GetEntriesFast();
659 Int_t mcMatchId;
660 Int_t nHitsMvd;
661
662 CbmTrackMatchNew* trackMatch;
663 CbmMCTrack* mcTrack;
664 CbmGlobalTrack* glTrack;
665
666 Bool_t hasHitFirst, hasHitFirstTrue;
667
668 Float_t glX, glY, ChiSqOverNDF, glP, mcP, trueOverAll, glQP;
669 Float_t mcPosFirst[3] = {0};
670 Float_t hitFirst[2];
671
672 LOG(debug) << " CbmMvdQa: Entries: " << nTracks << " StsTracks from " << nMcTracks << " McTracks";
673
674 // --- Loop over reconstructed tracks ---
675 for (Int_t itr = 0; itr < nGlobalTracks; itr++) {
676 glTrack = (CbmGlobalTrack*) fGlobalTrackArray->At(itr);
677
678 stsTrack = (CbmStsTrack*) fStsTrackArray->At(glTrack->GetStsTrackIndex());
679 trackMatch = (CbmTrackMatchNew*) fStsTrackMatches->At(glTrack->GetStsTrackIndex());
680 mcMatchId = trackMatch->GetMatchedLink().GetIndex();
681 if (mcMatchId > -1)
682 mcTrack = (CbmMCTrack*) fListMCTracks->At(mcMatchId);
683 else
684 continue;
685
686 SetMatches(mcMatchId, stsTrack);
687 hasHitFirst = HasHitFirstMvd(stsTrack);
688 hasHitFirstTrue = HasHitFirstTrue(mcMatchId, stsTrack);
689
690 glX = glTrack->GetParamVertex()->GetX();
691 glY = glTrack->GetParamVertex()->GetY();
692 ChiSqOverNDF = stsTrack->GetChiSq() / stsTrack->GetNDF();
693 glQP = stsTrack->GetParamFirst()->GetQp();
694 glP = fabs(1 / glQP);
695 mcP = mcTrack->GetP();
696 GetFirstMCPos(stsTrack, mcPosFirst);
697 GetFirstMvdHitPos(stsTrack, hitFirst);
698
699 trueOverAll = trackMatch->GetTrueOverAllHitsRatio();
700 nHitsMvd = stsTrack->GetNofMvdHits();
701
702 if (hasHitFirst) {
703 if (mcP < 1.5) {
705 if (mcP >= 1)
706 fhigh++;
707 else if (mcP >= 0.5)
708 fmid++;
709 else
710 flow++;
711 }
712 else
714 }
715
716
717 fTracks1F[0]->Fill(glP, 1);
718 if (trueOverAll == 1.) fTracks1F[1]->Fill(glP, 1);
719
720 if (nHitsMvd == 4) {
721 fTracks1F[2]->Fill(glP, 1);
722 if (fMvdRecoRatio == 1.) fTracks1F[3]->Fill(glP, 1);
723 if (trueOverAll == 1.) {
724 fTracks1F[4]->Fill(glP, 1);
725 fTracks1F[32]->Fill(glX);
726 fTracks1F[33]->Fill(glY);
727 }
728 }
729
730 fTracks1F[5]->Fill(glX);
731 fTracks1F[6]->Fill(glY);
732
733 if (nHitsMvd == 4) {
734 fTracks1F[7]->Fill(glX);
735 fTracks1F[8]->Fill(glY);
736 }
737
738 if (hasHitFirst) {
739 fTracks1F[9]->Fill(glX);
740 fTracks1F[10]->Fill(glY);
741 fTracks1F[19]->Fill(ChiSqOverNDF);
742 }
743 else {
744 fTracks1F[11]->Fill(glX);
745 fTracks1F[12]->Fill(glY);
746 }
747
748 if (hasHitFirstTrue) {
749 fTracks1F[13]->Fill(glX);
750 fTracks1F[14]->Fill(glY);
751 fTracks1F[18]->Fill(ChiSqOverNDF);
752 }
753
754 if (!hasHitFirstTrue && hasHitFirst) {
755 fTracks1F[15]->Fill(glX);
756 fTracks1F[16]->Fill(glY);
757 fTracks2F[10]->Fill(glX, glY);
758 fTracks1F[17]->Fill(ChiSqOverNDF);
759
760 fTracks1F[30]->Fill(mcPosFirst[0] - hitFirst[0]);
761 fTracks1F[31]->Fill(mcPosFirst[1] - hitFirst[1]);
762
763 if (glQP >= 0) {
764 fTracks1F[22]->Fill(glX);
765 if (mcP >= 1)
766 fTracks1F[26]->Fill(glX);
767 else
768 fTracks1F[27]->Fill(glX);
769 }
770 if (glQP < 0) {
771 fTracks1F[23]->Fill(glX);
772 if (mcP >= 1)
773 fTracks1F[28]->Fill(glX);
774 else
775 fTracks1F[29]->Fill(glX);
776 }
777 if (ChiSqOverNDF > 1)
778 fTracks1F[24]->Fill(glX);
779 else
780 fTracks1F[25]->Fill(glX);
781 }
782
783 if (ChiSqOverNDF > 1) {
784 fTracks1F[20]->Fill(sqrt((glX * glX) + (glY * glY)));
785 }
786 else {
787 fTracks1F[21]->Fill(sqrt((glX * glX) + (glY * glY)));
788 }
789
790
791 fTracks2F[0]->Fill(mcP, mcP - glP);
792 if (trueOverAll == 1.) fTracks2F[1]->Fill(mcP, mcP - glP);
793
794 if (nHitsMvd == 4) {
795 fTracks2F[2]->Fill(mcP, mcP - glP);
796 if (fMvdRecoRatio == 1.) fTracks2F[3]->Fill(mcP, mcP - glP);
797 if (trueOverAll == 1.) fTracks2F[4]->Fill(mcP, mcP - glP);
798 }
799
800 if (hasHitFirst)
801 fTracks2F[5]->Fill(mcP, mcP - glP);
802 else
803 fTracks2F[6]->Fill(mcP, mcP - glP);
804
805 if (!hasHitFirstTrue && hasHitFirst) {
806 fTracks2F[7]->Fill(hitFirst[0], hitFirst[1]);
807 if (ChiSqOverNDF <= 1) fTracks2F[8]->Fill(hitFirst[0], hitFirst[1]);
808 if (mcP < 1.5) {
809 fTracks2F[9]->Fill(0.1, 0.1);
810 if (mcP >= 1)
811 fTracks2F[11]->Fill(1.25, 0.1);
812 else if (mcP >= 0.5)
813 fTracks2F[11]->Fill(0.75, 0.1);
814 else
815 fTracks2F[11]->Fill(0.25, 0.1);
816 }
817 else
818 fTracks2F[9]->Fill(0.70, 0.1);
819 }
820
821 if (hasHitFirstTrue) {
822 if (mcP < 1.5) {
823 fTracks2F[9]->Fill(0.1, 0.70);
824 if (mcP >= 1)
825 fTracks2F[11]->Fill(1.25, 0.7);
826 else if (mcP >= 0.5)
827 fTracks2F[11]->Fill(0.75, 0.7);
828 else
829 fTracks2F[11]->Fill(0.25, 0.7);
830 }
831 else
832 fTracks2F[9]->Fill(0.70, 0.70);
833 }
834 }
835}
836// -------------------------------------------------------------------------
837void CbmMvdQa::GetFirstMvdHitPos(CbmStsTrack* stsTrack, Float_t* hitPos)
838{
839 Int_t nrMvdHits = stsTrack->GetNofMvdHits();
840 for (Int_t itr = 0; itr < nrMvdHits; itr++) {
841 CbmMvdHit* curHit = (CbmMvdHit*) fMvdHits->At(stsTrack->GetMvdHitIndex(itr));
842 if (curHit->GetZ() < fFirstMvdPos + 1) {
843 hitPos[0] = curHit->GetX();
844 hitPos[1] = curHit->GetY();
845 return;
846 }
847 }
848}
849// -------------------------------------------------------------------------
851{
852 Int_t nrMvdHits = stsTrack->GetNofMvdHits();
853 for (Int_t itr = 0; itr < nrMvdHits; itr++) {
854 CbmMvdHit* curHit = (CbmMvdHit*) fMvdHits->At(stsTrack->GetMvdHitIndex(itr));
855 if (curHit->GetZ() < fFirstMvdPos + 1) return kTRUE;
856 }
857
858 return kFALSE;
859}
860// -------------------------------------------------------------------------
861
862// -------------------------------------------------------------------------
863Bool_t CbmMvdQa::HasHitFirstTrue(Int_t MCtrackID, CbmStsTrack* stsTrack)
864{
865 Int_t nrOfMvdHits = stsTrack->GetNofMvdHits();
866 Int_t nrOfLinks = 0;
867 Int_t mcTrackId = 0;
868 const CbmMvdPoint* point = nullptr;
869 for (Int_t iHit = 0; iHit < nrOfMvdHits; iHit++) {
870 CbmMatch* mvdMatch = (CbmMatch*) fMvdHitMatchArray->At(stsTrack->GetMvdHitIndex(iHit));
871 if (mvdMatch) {
872 nrOfLinks = mvdMatch->GetNofLinks();
873 }
874 else {
875 continue; // any kind of error in the matching
876 }
877 for (Int_t iLink = 0; iLink < nrOfLinks; iLink++) {
878 Int_t pointIndex = mvdMatch->GetLink(iLink).GetIndex();
879 if (pointIndex < fMcPoints->GetEntriesFast()) point = (CbmMvdPoint*) fMcPoints->At(pointIndex);
880 if (nullptr == point) {
881 continue; //delta or background event
882 }
883 else
884 mcTrackId = point->GetTrackID();
885 if (mcTrackId == MCtrackID && point->GetZOut() < fFirstMvdPos + 1) {
886 return kTRUE;
887 }
888 }
889 }
890
891 return kFALSE;
892}
893// -------------------------------------------------------------------------
894
895// -------------------------------------------------------------------------
896void CbmMvdQa::GetFirstMCPos(CbmStsTrack* stsTrack, Float_t* pos)
897{
898 Int_t nrOfMvdHits = stsTrack->GetNofMvdHits();
899 Int_t nrOfLinks = 0;
900 const CbmMvdPoint* point = nullptr;
901 for (Int_t iHit = 0; iHit < nrOfMvdHits; iHit++) {
902 CbmMatch* mvdMatch = (CbmMatch*) fMvdHitMatchArray->At(stsTrack->GetMvdHitIndex(iHit));
903 if (mvdMatch) {
904 nrOfLinks = mvdMatch->GetNofLinks();
905 }
906 else {
907 continue; // any kind of error in the matching
908 }
909 for (Int_t iLink = 0; iLink < nrOfLinks; iLink++) {
910 Int_t pointIndex = mvdMatch->GetLink(iLink).GetIndex();
911 if (pointIndex < fMcPoints->GetEntriesFast()) point = (CbmMvdPoint*) fMcPoints->At(pointIndex);
912 if (nullptr == point) {
913 continue; //delta or background event
914 }
915 else if (point->GetZOut() < fFirstMvdPos + 1) {
916 pos[0] = point->GetX();
917 pos[1] = point->GetY();
918 pos[2] = point->GetZOut();
919 return;
920 }
921 }
922 }
923}
924// -------------------------------------------------------------------------
925
926
927// -------------------------------------------------------------------------
928void CbmMvdQa::SetMatches(Int_t MCtrackID, CbmStsTrack* stsTrack)
929{
930
931 Int_t nrOfMvdHits = stsTrack->GetNofMvdHits();
932 Int_t mcTrackId = 0;
933 Float_t falseCounter = 0;
934 Bool_t hasTrack;
935 Int_t nrOfLinks = 0;
936 fMvdRecoRatio = 0.;
937 const CbmMvdPoint* point = nullptr;
938 for (Int_t iHit = 0; iHit < nrOfMvdHits; iHit++) {
939 hasTrack = kFALSE;
940 CbmMatch* mvdMatch = (CbmMatch*) fMvdHitMatchArray->At(stsTrack->GetMvdHitIndex(iHit));
941 if (mvdMatch) {
942 nrOfLinks = mvdMatch->GetNofLinks();
943 if (nrOfLinks > 1) fnrOfMergedHits++;
944 }
945 else {
946 continue; // any kind of error in the matching
947 }
948 for (Int_t iLink = 0; iLink < nrOfLinks; iLink++) {
949 Int_t pointIndex = mvdMatch->GetLink(iLink).GetIndex();
950 if (pointIndex < fMcPoints->GetEntriesFast()) point = (CbmMvdPoint*) fMcPoints->At(pointIndex);
951 if (nullptr == point) {
952 continue; //delta or background event
953 }
954 else
955 mcTrackId = point->GetTrackID();
956 if (mcTrackId == MCtrackID) {
957 hasTrack = kTRUE;
958 }
959 }
960 if (!hasTrack) falseCounter++;
961 }
962 Float_t counter = (Float_t) falseCounter / (Float_t) nrOfMvdHits;
963 fMvdRecoRatio = (Float_t) 1.0 - (Float_t) counter;
964
965
966 if (useMcQa) fMC1F[0]->Fill(fMvdRecoRatio);
967}
968// -------------------------------------------------------------------------
969
970//-----------------------------------------------------------------------------------------
972{
973
974 // foutFile->cd();
975
976 if (useMcQa) FinishMCQa();
977 if (useDigiQa) FinishDigiQa();
978 if (useHitQa) FinishHitQa();
980
981 // foutFile->Write();
982}
983//-----------------------------------------------------------------------------------------
984
985//-----------------------------------------------------------------------------------------
987{
988 if (fdraw) {
989 TCanvas* mcCanvas1 = new TCanvas();
990 mcCanvas1->cd();
991 fMC1F[0]->Draw();
992 }
993
994 fMC1F[0]->Write();
995}
996//-----------------------------------------------------------------------------------------
997
998//-----------------------------------------------------------------------------------------
1000{
1001 if (fdraw) {
1002 TCanvas* digiCanvas1a = new TCanvas();
1003 digiCanvas1a->cd();
1004 fDigi1F[0]->Draw();
1005
1006 TCanvas* digiCanvas1b = new TCanvas();
1007 digiCanvas1b->cd();
1008 fDigi1F[1]->Draw();
1009 }
1010
1011 fDigi1F[0]->Write();
1012 fDigi1F[1]->Write();
1013}
1014//-----------------------------------------------------------------------------------------
1015
1016//-----------------------------------------------------------------------------------------
1018{
1019 if (fdraw) {
1020 // TCanvas* hitCanvas1a = new TCanvas();
1021 // fHits1F[0]->Draw();
1022
1023 TCanvas* hitCanvas1b = new TCanvas();
1024 hitCanvas1b->cd();
1025 fHits1F[1]->Draw();
1026
1027 TCanvas* hitCanvas1c = new TCanvas();
1028 hitCanvas1c->cd();
1029 fHits1F[2]->Draw();
1030
1031 TCanvas* hitCanvas1d = new TCanvas();
1032 hitCanvas1d->cd();
1033 fHits1F[3]->Draw("COL");
1034
1035 TCanvas* hitCanvas1e = new TCanvas();
1036 hitCanvas1e->cd();
1037 fHits1F[4]->Draw();
1038
1039 TCanvas* hitCanvas1f = new TCanvas();
1040 hitCanvas1f->cd();
1041 fHits1F[5]->Draw();
1042
1043
1044 TCanvas* hitCanvas2a = new TCanvas();
1045 hitCanvas2a->cd();
1046 fHits2F[0]->Draw("COL");
1047 }
1048
1049 for (Int_t i = 0; i < 6; i++) {
1050 fHits1F[i]->Write();
1051 }
1052
1053
1054 fHits2F[0]->Write();
1055}
1056//-----------------------------------------------------------------------------------------
1057
1058//-----------------------------------------------------------------------------------------
1060{
1061
1062 fTracks1F[1]->Divide(fTracks1F[0]);
1063
1064 if (fdraw) {
1065 TCanvas* TrackCanvas1 = new TCanvas();
1066 TrackCanvas1->Divide(3, 2);
1067 TrackCanvas1->cd(1);
1068 fTracks1F[0]->Draw();
1069 TrackCanvas1->cd(2);
1070 fTracks1F[1]->Draw();
1071 TrackCanvas1->cd(3);
1072 fTracks1F[2]->Draw();
1073 TrackCanvas1->cd(4);
1074 fTracks1F[3]->Draw();
1075 TrackCanvas1->cd(5);
1076 fTracks1F[4]->Draw();
1077
1078 TCanvas* TrackCanvas1b = new TCanvas();
1079 TrackCanvas1b->Divide(2, 2);
1080 TrackCanvas1b->cd(1);
1081 fTracks1F[5]->Draw();
1082 TrackCanvas1b->cd(2);
1083 fTracks1F[6]->Draw();
1084 TrackCanvas1b->cd(3);
1085 fTracks1F[7]->Draw();
1086 TrackCanvas1b->cd(4);
1087 fTracks1F[8]->Draw();
1088
1089 TCanvas* TrackCanvas1c = new TCanvas();
1090 TrackCanvas1c->Divide(2, 2);
1091 TrackCanvas1c->cd(1);
1092 fTracks1F[9]->Draw();
1093 TrackCanvas1c->cd(2);
1094 fTracks1F[10]->Draw();
1095 TrackCanvas1c->cd(3);
1096 fTracks1F[11]->Draw();
1097 TrackCanvas1c->cd(4);
1098 fTracks1F[12]->Draw();
1099
1100 TCanvas* TrackCanvas1d = new TCanvas();
1101 TrackCanvas1d->Divide(2, 2);
1102 TrackCanvas1d->cd(1);
1103 fTracks1F[13]->Draw();
1104 TrackCanvas1d->cd(2);
1105 fTracks1F[14]->Draw();
1106 TrackCanvas1d->cd(3);
1107 fTracks1F[15]->Draw();
1108 TrackCanvas1d->cd(4);
1109 fTracks1F[16]->Draw();
1110
1111 TCanvas* TrackCanvas1e = new TCanvas();
1112 TrackCanvas1e->Divide(2, 2);
1113 TrackCanvas1e->cd(1);
1114 fTracks1F[17]->Draw();
1115 TrackCanvas1e->cd(2);
1116 fTracks1F[18]->Draw();
1117 TrackCanvas1e->cd(3);
1118 fTracks1F[19]->Draw();
1119 TrackCanvas1e->cd(4);
1120 //fTracks1F[16]->Draw();
1121
1122 TCanvas* TrackCanvas1f = new TCanvas();
1123 TrackCanvas1f->Divide(2, 2);
1124 TrackCanvas1f->cd(1);
1125 fTracks1F[20]->Draw();
1126 TrackCanvas1f->cd(2);
1127 fTracks1F[21]->Draw();
1128 TrackCanvas1f->cd(3);
1129 //fTracks1F[19]->Draw();
1130 TrackCanvas1f->cd(4);
1131 //fTracks1F[16]->Draw();
1132
1133 TCanvas* TrackCanvas1g = new TCanvas();
1134 TrackCanvas1g->Divide(2, 2);
1135 TrackCanvas1g->cd(1);
1136 fTracks1F[22]->Draw();
1137 TrackCanvas1g->cd(2);
1138 fTracks1F[23]->Draw();
1139 TrackCanvas1g->cd(3);
1140 fTracks1F[24]->Draw();
1141 TrackCanvas1g->cd(4);
1142 fTracks1F[25]->Draw();
1143
1144 TCanvas* TrackCanvas1h = new TCanvas();
1145 TrackCanvas1h->Divide(2, 2);
1146 TrackCanvas1h->cd(1);
1147 fTracks1F[26]->Draw();
1148 TrackCanvas1h->cd(2);
1149 fTracks1F[27]->Draw();
1150 TrackCanvas1h->cd(3);
1151 fTracks1F[28]->Draw();
1152 TrackCanvas1h->cd(4);
1153 fTracks1F[29]->Draw();
1154
1155 TCanvas* TrackCanvas1i = new TCanvas();
1156 TrackCanvas1i->Divide(2, 2);
1157 TrackCanvas1i->cd(1);
1158 fTracks1F[30]->Draw();
1159 TrackCanvas1i->cd(2);
1160 fTracks1F[31]->Draw();
1161 }
1162
1163 for (Int_t k = 0; k < f1FSize; k++) {
1164 fTracks1F[k]->Write();
1165 }
1166
1167 fTracks2F[9]->SetBinContent(1, 1, 100 * (fTracks2F[9]->GetBinContent(1, 1) / fnrTrackslowP));
1168 fTracks2F[9]->SetBinContent(1, 2, 100 * (fTracks2F[9]->GetBinContent(1, 2) / fnrTrackslowP));
1169 fTracks2F[9]->SetBinContent(2, 1, 100 * (fTracks2F[9]->GetBinContent(2, 1) / fnrTracksHighP));
1170 fTracks2F[9]->SetBinContent(2, 2, 100 * (fTracks2F[9]->GetBinContent(2, 2) / fnrTracksHighP));
1171
1172 fTracks2F[11]->SetBinContent(1, 1, 100 * (fTracks2F[11]->GetBinContent(1, 1) / flow));
1173 fTracks2F[11]->SetBinContent(1, 2, 100 * (fTracks2F[11]->GetBinContent(1, 2) / flow));
1174 fTracks2F[11]->SetBinContent(2, 1, 100 * (fTracks2F[11]->GetBinContent(2, 1) / fmid));
1175 fTracks2F[11]->SetBinContent(2, 2, 100 * (fTracks2F[11]->GetBinContent(2, 2) / fmid));
1176 fTracks2F[11]->SetBinContent(3, 1, 100 * (fTracks2F[11]->GetBinContent(3, 1) / fhigh));
1177 fTracks2F[11]->SetBinContent(3, 2, 100 * (fTracks2F[11]->GetBinContent(3, 2) / fhigh));
1178
1179 if (fdraw) {
1180 TCanvas* TrackCanvas2 = new TCanvas();
1181 TrackCanvas2->Divide(3, 2);
1182 TrackCanvas2->cd(1);
1183 fTracks2F[0]->Draw("colz");
1184 TrackCanvas2->cd(2);
1185 fTracks2F[1]->Draw("colz");
1186 TrackCanvas2->cd(3);
1187 fTracks2F[2]->Draw("colz");
1188 TrackCanvas2->cd(4);
1189 fTracks2F[3]->Draw("colz");
1190 TrackCanvas2->cd(5);
1191 fTracks2F[4]->Draw("colz");
1192
1193
1194 TCanvas* TrackCanvas2b = new TCanvas();
1195 TrackCanvas2b->Divide(2, 2);
1196 TrackCanvas2b->cd(1);
1197 fTracks2F[5]->Draw("colz");
1198 TrackCanvas2b->cd(2);
1199 fTracks2F[6]->Draw("colz");
1200
1201
1202 TCanvas* BadTracks = new TCanvas();
1203 BadTracks->Divide(2, 2);
1204 BadTracks->cd(1);
1205 fTracks2F[7]->Draw("colz");
1206 BadTracks->cd(2);
1207 fTracks2F[8]->Draw("colz");
1208 BadTracks->cd(3);
1209 fTracks2F[9]->DrawCopy("TEXT");
1210 BadTracks->cd(4);
1211 fTracks2F[10]->Draw("colz");
1212
1213 fTracks2F[9]->SetContour(10);
1214 fTracks2F[11]->SetContour(10);
1215
1216 gStyle->SetPaintTextFormat("4.1f %");
1217
1218 TCanvas* asd = new TCanvas();
1219 asd->cd();
1220 fTracks2F[9]->SetMarkerSize(4);
1221 fTracks2F[9]->Draw("TEXT COLZ");
1222 TCanvas* asd2 = new TCanvas();
1223 asd2->cd();
1224 fTracks2F[11]->SetMarkerSize(4);
1225 fTracks2F[11]->Draw("TEXT COLZ");
1226 }
1227
1228
1229 for (Int_t i = 0; i < f2FSize; i++) {
1230 fTracks2F[i]->Write();
1231 }
1232}
1233//-----------------------------------------------------------------------------------------
1234
1235
1236/*
1237// -------------------------------------------------------------------------
1238Double_t CbmMvdQa::GetImpactParameterRadius( CbmLitTrackParam t ){
1239
1240 Double_t imx = t.GetX();
1241 Double_t imy = t.GetY();
1242 Double_t imr = sqrt(imx*imx + imy*imy);
1243
1244 return imr;
1245}
1246// -------------------------------------------------------------------------
1247
1248
1249//--------------------------------------------------------------------------
1250Double_t CbmMvdQa::GetImpactParameterX( CbmLitTrackParam t ){
1251
1252Double_t imx = t.GetX();
1253
1254 return imx;
1255}
1256// -------------------------------------------------------------------------
1257
1258
1259//--------------------------------------------------------------------------
1260Double_t CbmMvdQa::GetImpactParameterY( CbmLitTrackParam t ){
1261
1262 Double_t imy = t.GetY();
1263
1264 return imy;
1265}
1266// -------------------------------------------------------------------------
1267
1268
1269
1270//-----------------------------------------------------------------------------------------
1271Double_t CbmMvdQa::GetTransverseMomentum( CbmLitTrackParam t ){
1272
1273const std::vector<double> state= t.GetStateVector();
1274
1275Float_t pz = GetMomentumZ(t);
1276Float_t px = state[2] * pz;
1277Float_t py = state[3] * pz;
1278
1279Double_t pt = sqrt(px * px + py * py);
1280
1281 return pt;
1282}
1283//-----------------------------------------------------------------------------------------
1284
1285
1286//-----------------------------------------------------------------------------------------
1287Double_t CbmMvdQa::GetMomentum( CbmLitTrackParam t ){
1288
1289 Float_t p = fabs(1.F / t.GetQp());
1290
1291 return p;
1292}
1293//-----------------------------------------------------------------------------------------
1294
1295//-----------------------------------------------------------------------------------------
1296Double_t CbmMvdQa::GetMomentumZ( CbmLitTrackParam t ){
1297
1298 const std::vector<double> state= t.GetStateVector();
1299
1300Float_t pz = sqrt(GetMomentum(t) * GetMomentum(t) / (state[2] * state[2] + state[3] * state[3] + 1));
1301
1302 return pz;
1303}
1304//-----------------------------------------------------------------------------------------
1305
1306
1307//-----------------------------------------------------------------------------------------
1308Double_t CbmMvdQa::GetAngle( CbmLitTrackParam t ){
1309
1310 Float_t angle_rad = std::atan(GetTransverseMomentum(t) / GetMomentumZ(t));
1311 Float_t rad_to_grad = ( 180 / TMath::Pi() );
1312 Float_t angle_grad = angle_rad * rad_to_grad;
1313 //LOG(debug) << "calc angle of " << angle_grad << " from rad angle " << angle_rad;
1314 return angle_grad;
1315}
1316//-----------------------------------------------------------------------------------------
1317 */
1318//-----------------------------------------------------------------------------------------
ClassImp(CbmMvdQa)
Double_t lab[3]
Data class for STS tracks.
friend fvec sqrt(const fvec &a)
int32_t GetStsTrackIndex() const
const CbmTrackParam * GetParamVertex() const
double GetZ() const
Definition CbmHit.h:71
double GetP() const
Definition CbmMCTrack.h:98
const CbmLink & GetLink(int32_t i) const
Definition CbmMatch.h:39
int32_t GetNofLinks() const
Definition CbmMatch.h:42
const CbmLink & GetMatchedLink() const
Definition CbmMatch.h:41
int16_t GetTotalDigisInCluster()
static CbmMvdDetector * Instance()
CbmMvdSensor * GetSensor(Int_t nSensor)
CbmMvdStationPar * GetParameterFile()
Int_t GetSensorArraySize()
int32_t GetDetectorId()
Definition CbmMvdDigi.h:55
int32_t GetPixelY()
int32_t GetPixelX()
int32_t GetClusterIndex() const
Definition CbmMvdHit.h:63
double GetZOut() const
Definition CbmMvdPoint.h:69
void SetMatches(Int_t MCtrackID, CbmStsTrack *stsTrack)
Definition CbmMvdQa.cxx:928
Bool_t useTrackQa
Definition CbmMvdQa.h:129
static const Int_t f2FSize
Definition CbmMvdQa.h:107
TH1F * fHits1F[30]
Definition CbmMvdQa.h:115
TClonesArray * fMvdDigis
Definition CbmMvdQa.h:97
void FinishDigiQa()
Definition CbmMvdQa.cxx:999
Bool_t fdraw
Definition CbmMvdQa.h:133
Int_t fFirstMvdPos
Definition CbmMvdQa.h:76
TClonesArray * fMcPoints
Definition CbmMvdQa.h:96
void SetupMCHistograms()
Definition CbmMvdQa.cxx:189
void Exec(Option_t *opt)
Definition CbmMvdQa.cxx:539
Bool_t useDigiQa
Definition CbmMvdQa.h:127
TH1F * fMC1F[30]
Definition CbmMvdQa.h:109
Int_t fnrTrackslowP
Definition CbmMvdQa.h:79
void ExecDigiQa()
Definition CbmMvdQa.cxx:566
void FinishHitQa()
TClonesArray * fBadTracks
Definition CbmMvdQa.h:102
TH1F * fDigi1F[30]
Definition CbmMvdQa.h:112
Bool_t useHitQa
Definition CbmMvdQa.h:128
void ExecHitQa()
Definition CbmMvdQa.cxx:614
void ExecTrackQa()
Definition CbmMvdQa.cxx:651
Int_t fnrTracksHighP
Definition CbmMvdQa.h:80
Int_t fhigh
Definition CbmMvdQa.h:83
void SetupDigiHistograms()
Definition CbmMvdQa.cxx:210
TClonesArray * fStsTrackMatches
Definition CbmMvdQa.h:88
TClonesArray * fMvdCluster
Definition CbmMvdQa.h:98
Int_t fEventNumber
Definition CbmMvdQa.h:69
TClonesArray * fListMCTracks
Definition CbmMvdQa.h:92
TH2F * fDigi2F[30]
Definition CbmMvdQa.h:113
void FinishMCQa()
Definition CbmMvdQa.cxx:986
TClonesArray * fMvdHitMatchArray
Definition CbmMvdQa.h:100
TClonesArray * fMvdDigiMatchArray
Definition CbmMvdQa.h:101
Int_t flow
Definition CbmMvdQa.h:81
void Finish()
Definition CbmMvdQa.cxx:971
void GetFirstMvdHitPos(CbmStsTrack *stsTrack, Float_t *hitPos)
Definition CbmMvdQa.cxx:837
void SetupHistograms()
Definition CbmMvdQa.cxx:179
void GetFirstMCPos(CbmStsTrack *stsTrack, Float_t *pos)
Definition CbmMvdQa.cxx:896
TH1F * fTracks1F[f1FSize]
Definition CbmMvdQa.h:118
CbmMvdDetector * fDetector
Definition CbmMvdQa.h:124
Bool_t HasHitFirstMvd(CbmStsTrack *stsTrack)
Definition CbmMvdQa.cxx:850
TClonesArray * fStsTrackArray
Definition CbmMvdQa.h:85
Bool_t useMcQa
Definition CbmMvdQa.h:126
Int_t fnrOfMergedHits
Definition CbmMvdQa.h:74
void SetupHitHistograms()
Definition CbmMvdQa.cxx:252
TH2F * fTracks2F[f2FSize]
Definition CbmMvdQa.h:119
InitStatus Init()
Definition CbmMvdQa.cxx:110
void FinishTrackQa()
void ExecMCQa()
Definition CbmMvdQa.cxx:552
TClonesArray * fMvdHits
Definition CbmMvdQa.h:99
TClonesArray * fGlobalTrackArray
Definition CbmMvdQa.h:89
CbmVertex * fPrimVtx
Definition CbmMvdQa.h:121
Int_t fmid
Definition CbmMvdQa.h:82
TH2F * fHits2F[30]
Definition CbmMvdQa.h:116
Bool_t HasHitFirstTrue(Int_t MCtrackID, CbmStsTrack *stsTrack)
Definition CbmMvdQa.cxx:863
void SetupTrackHistograms()
Definition CbmMvdQa.cxx:295
static const Int_t f1FSize
Definition CbmMvdQa.h:106
TH2F * fMC2F[30]
Definition CbmMvdQa.h:110
Float_t fMvdRecoRatio
Definition CbmMvdQa.h:71
void PixelToTop(Int_t pixelNumberX, Int_t pixelNumberY, Double_t *lab)
Int_t GetDetectorID() const
Double_t GetZ() const
Double_t GetZPosition(Int_t stationNumber) const
double GetY() const
Definition CbmPixelHit.h:74
double GetX() const
Definition CbmPixelHit.h:73
int32_t GetNofMvdHits() const
Definition CbmStsTrack.h:87
int32_t GetMvdHitIndex(int32_t iHit) const
Definition CbmStsTrack.h:75
double GetTrueOverAllHitsRatio() const
int32_t GetNDF() const
Definition CbmTrack.h:64
const FairTrackParam * GetParamFirst() const
Definition CbmTrack.h:68
double GetChiSq() const
Definition CbmTrack.h:63