CbmRoot
Loading...
Searching...
No Matches
CbmTrdQa.cxx
Go to the documentation of this file.
1/* Copyright (C) 2012-2021 Institut fuer Kernphysik, Westfaelische Wilhelms-Universitaet Muenster, Muenster
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Cyrano Bergmann [committer] */
4
5#include "CbmTrdQa.h"
6
7#include "CbmDigiManager.h"
8#include "CbmMCTrack.h"
9#include "CbmTrdCluster.h"
10#include "CbmTrdDigi.h"
11#include "CbmTrdGeoHandler.h"
12#include "CbmTrdHit.h"
13#include "CbmTrdParModDigi.h"
14#include "CbmTrdParModGeo.h"
15#include "CbmTrdParSetDigi.h"
16#include "CbmTrdParSetGeo.h"
17#include "CbmTrdPoint.h"
18#include "FairRootManager.h"
19#include "FairRunAna.h"
20#include "FairRuntimeDb.h"
21#include "TBox.h"
22#include "TCanvas.h"
23#include "TClonesArray.h"
24#include "TColor.h"
25#include "TF1.h"
26#include "TFile.h"
27#include "TGeoManager.h"
28#include "TH1.h"
29#include "TH2.h"
30#include "TLegend.h"
31#include "TMath.h"
32#include "TPaveText.h"
33#include "TPolyLine.h"
34#include "TProfile.h"
35#include "TProfile2D.h"
36#include "TStopwatch.h"
37
38#include <cmath>
39#include <iostream>
40
41//#include "CbmTrdDigitizer.h"
42// #include "CbmTrdDigitizerPRF.h"
43// #include "CbmTrdClusterFinderFast.h"
44// #include "CbmTrdHitProducerCluster.h"
45#include "CbmTrdRadiator.h"
46#include "CbmTrdUtils.h"
47
48using std::cout;
49using std::endl;
50using std::fabs;
51
52
53CbmTrdQa::CbmTrdQa(CbmTrdRadiator* radiator) : CbmTrdQa("TrdQa", "", "", 1e-6, radiator) {}
54
55CbmTrdQa::CbmTrdQa(const char* name, const char* title, const char* geo, Double_t triggerThreshold,
56 CbmTrdRadiator* radiator)
57 : CbmTrdQa(name, title, geo, triggerThreshold, std::make_shared<CbmTrdRadiator>(radiator)){};
58
59CbmTrdQa::CbmTrdQa(std::shared_ptr<CbmTrdRadiator> radiator) : CbmTrdQa("TrdQa", "", "", 1e-6, radiator) {}
60
61CbmTrdQa::CbmTrdQa(const char* /*name*/, const char* /*title*/, const char* geo, Double_t triggerThreshold,
62 std::shared_ptr<CbmTrdRadiator> radiator)
63 : FairTask("TrdQa")
64 , fMCTracks(NULL)
65 , fPoints(NULL)
66 , fClusters(NULL)
67 , fHits(NULL)
68 , fDigiPar(NULL)
69 , fGeoPar(NULL)
70 , fGeoHandler(new CbmTrdGeoHandler())
71 , fLayerMap()
72 , fLayerMapIt()
73 , fLayerPointMap()
74 , fLayerPointMapIt()
75 , fLayerHitMap()
76 , fLayerHitMapIt()
77 , fModulePointMap()
78 , fModulePointMapIt()
79 , fModuleDigiMap()
80 , fModuleDigiMapIt()
81 , fModuleClusterMap()
82 , fModuleClusterMapIt()
83 , fModuleHitMap()
84 , fModuleHitMapIt()
85 , fModuleAveragePointsMap()
86 , fModuleAveragePointsMapIt()
87 , fModuleTrackableMap2()
88 , fModuleTrackableMap2It()
89 , fModuleTrackableMap()
90 , fModuleTrackableMapIt()
91 , fModuleClusterSizeMap()
92 , fModuleClusterSizeMapIt()
93 , fModuledEdxMap()
94 , fModuledEdxMapIt()
95 , fModuleTracklengthMap()
96 , fModuleTracklengthMapIt()
97 , fModuleMultiPointMap()
98 , fModuleMultiPointMapIt()
99 , fModuleDeltaEMap()
100 , fModuleDeltaEMapIt()
101 , fModuleGhostMap()
102 , fModuleGhostMapIt()
103 , fModuleLostMap()
104 , fModuleLostMapIt()
105 , fModuleEfficiencyMap()
106 , fModuleEfficiencyMapIt()
107 , fTriggerThreshold(triggerThreshold)
108 , fGeo(geo)
109 , fD(true)
110 , fT(true)
111 , fP(true)
112 , fC(true)
113 , fH(true)
114 , fTrianglePads(false)
115 , fLayerDummy(NULL)
116 , fStsTrdPoints(NULL)
117 , fStsMuchPoints(NULL)
118 , fStsTofPoints(NULL)
119 , fStsTrdPointsTrackable(NULL)
120 , fTrdPointsPerMcTrack_PID(NULL)
121 , fTrdPointsPerMcTrack_PT(NULL)
122 , fTrdPointsPerMcTrack_P(NULL)
123 , fTrdTrackCrossedRadiator(NULL)
124 , fMultiHitSamePadPerMcTrack(NULL)
125 , fMultiHitSamePadPerMcTrack_angle(NULL)
126 , fMultiHitSamePadPerMcTrack_zBirth(NULL)
127 , fMultiHitSamePadPerMcTrack_PID(NULL)
128 , fMultiHitSamePadPerMcTrack_motherPID(NULL)
129 , fMultiHitSamePadPerMcTrack_motherzBirth(NULL)
130 , fMultiHitAdjacentPadPerMcTrack(NULL)
131 , fMultiHitAdjacentPadPerMcTrack_angle(NULL)
132 , fMultiHitAdjacentPadPerMcTrack_zBirth(NULL)
133 , fMultiHitAdjacentPadPerMcTrack_PID(NULL)
134 , fMultiHitAdjacentPadPerMcTrack_motherzBirth(NULL)
135 , fMultiHitAdjacentPadPerMcTrack_motherPID(NULL)
136 , fDistanceMcToHit(NULL)
137 , fDistanceMcToHitAll(NULL)
138 , fPositionResolutionShort(NULL)
139 , fPositionResolutionLong(NULL)
140 , fdEdxPoint(NULL)
141 , fdEdxDigi(NULL)
142 , fdEdxCluster(NULL)
143 , fdEdxHit(NULL)
144 , fdEdxPionMc(NULL)
145 , fdEdxPionHit(NULL)
146 , fdEdxPionGhost(NULL)
147 , fdEdxElectronMc(NULL)
148 , fdEdxElectronHit(NULL)
149 , fdEdxElectronGhost(NULL)
150 , fClusterSize(NULL)
151 , fPointsPerDigi(NULL)
152 , fDigiPerCluster(NULL)
153 , fClusterPerHit(NULL)
154 , fMultiPointssVsR(NULL)
155 , fGhostPointsVsR(NULL)
156 , fMultiHitsVsR(NULL)
157 , fGhostHitVsR(NULL)
158 , fLostPointVsR(NULL)
159 , fHitToPointEfficiencyVsR(NULL)
160 , fMultiHitsVsAlpha(NULL)
161 , fGhostHitVsAlpha(NULL)
162 , fLostPointVsAlpha(NULL)
163 , fHitToPointEfficiencyVsAlpha(NULL)
164 , fPRF_1D(NULL)
165 , fPRF_2D(NULL)
166 , fRadiator(radiator)
167{
168}
169
171{
172 FairRootManager* ioman = FairRootManager::Instance();
173 ioman->Write();
174 if (fMCTracks) {
175 fMCTracks->Clear("C");
176 fMCTracks->Delete();
177 delete fMCTracks;
178 }
179 if (fPoints) {
180 fPoints->Delete();
181 delete fPoints;
182 }
183 if (fHits) {
184 fHits->Delete();
185 delete fHits;
186 }
187 if (fDigiPar) delete fDigiPar;
188
189 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
190 delete fLayerMapIt->second;
191 }
194 delete fLayerPointMapIt->second;
195 }
196 fLayerPointMap.clear();
198 delete fLayerHitMapIt->second;
199 }
200 fLayerHitMap.clear();
202 fModulePointMapIt->second.clear();
203 }
204 fModulePointMap.clear();
205
207 fModuleDigiMapIt->second.clear();
208 }
209 fModuleDigiMap.clear();
210
213 fModuleClusterMapIt->second.clear();
214 }
215 fModuleClusterMap.clear();
216
218 fModuleHitMapIt->second.clear();
219 }
220 fModuleHitMap.clear();
221
223 delete fModuleGhostMapIt->second;
224 }
225 fModuleGhostMap.clear();
226
228 delete fModuleLostMapIt->second;
229 }
230 fModuleLostMap.clear();
231
234 delete fModuleEfficiencyMapIt->second;
235 }
236 fModuleEfficiencyMap.clear();
237
240 delete fModuleMultiPointMapIt->second;
241 }
242 fModuleMultiPointMap.clear();
243
244
247 delete fModuleDeltaEMapIt->second;
248 }
249 fModuleDeltaEMap.clear();
250
253 delete fModuleTracklengthMapIt->second;
254 }
255 fModuleTracklengthMap.clear();
256
258 delete fModuledEdxMapIt->second;
259 }
260 fModuledEdxMap.clear();
261
264 delete fModuleClusterSizeMapIt->second;
265 }
266 fModuleClusterSizeMap.clear();
267
268
273
286
287 delete fDistanceMcToHit;
288 delete fDistanceMcToHitAll;
289 delete fdEdxPionMc;
290 delete fdEdxPionHit;
291 delete fdEdxPionGhost;
292 delete fdEdxElectronMc;
293 delete fdEdxElectronHit;
294 delete fdEdxElectronGhost;
295 delete fdEdxPoint;
296 delete fdEdxDigi;
297 delete fdEdxCluster;
298 delete fdEdxHit;
299 delete fMultiHitsVsR;
300 delete fGhostHitVsR;
301 delete fLostPointVsR;
305 delete fMultiHitsVsAlpha;
306 delete fGhostHitVsAlpha;
307 delete fLostPointVsAlpha;
309 delete fClusterSize;
310 delete fPointsPerDigi;
311 delete fDigiPerCluster;
312 delete fClusterPerHit;
313 delete fPRF_1D;
314 delete fPRF_2D;
315 //delete fLayerDummy;
316}
318{
319 cout << " * CbmTrdQa * :: SetParContainers() " << endl;
320 // Get Base Container
321 FairRunAna* ana = FairRunAna::Instance();
322 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
323 fDigiPar = (CbmTrdParSetDigi*) (rtdb->getContainer("CbmTrdParSetDigi"));
324 fGeoPar = (CbmTrdParSetGeo*) (rtdb->getContainer("CbmTrdParSetGeo"));
325}
327{
328 FairRunAna* ana = FairRunAna::Instance();
329 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
330 fDigiPar = (CbmTrdParSetDigi*) (rtdb->getContainer("CbmTrdParSetDigi"));
331 fGeoPar = (CbmTrdParSetGeo*) (rtdb->getContainer("CbmTrdParSetGeo"));
332
333 return kSUCCESS;
334}
335InitStatus CbmTrdQa::Init()
336{
337 FairRootManager* ioman = FairRootManager::Instance();
338 fMCTracks = (TClonesArray*) ioman->GetObject("MCTrack");
339 if (!fMCTracks) {
340 cout << "-W CbmTrdQa::Init: No MCTrack array!" << endl;
341 cout << " Task will be inactive" << endl;
342 //return kERROR;
343 fT = false;
344 }
345 fPoints = (TClonesArray*) ioman->GetObject("TrdPoint");
346 if (!fPoints) {
347 cout << "-W CbmTrdQa::Init: No TrdPoint array!" << endl;
348 cout << " Task will be inactive" << endl;
349 //return kERROR;
350 fP = false;
351 }
353 if (!CbmDigiManager::Instance()->IsPresent(ECbmModuleId::kTrd)) LOG(fatal) << GetName() << "Missing Trd digi branch.";
354
355 fClusters = (TClonesArray*) ioman->GetObject("TrdCluster");
356 if (!fClusters) {
357 cout << "-W CbmTrdQa::Init: No TrdCluster array!" << endl;
358 cout << " Task will be inactive" << endl;
359 //return kERROR;
360 fC = false;
361 }
362 fHits = (TClonesArray*) ioman->GetObject("TrdHit");
363 if (!fHits) {
364 cout << "-W CbmTrdQa::Init: No TrdHits array!" << endl;
365 cout << " Task will be inactive" << endl;
366 //return kERROR;
367 fH = false;
368 }
369 fGeoHandler->Init();
370
371 fLayerDummy = new TH2I("LayerDummy", "", 1, -600, 600, 1, -500, 500);
372 fLayerDummy->SetXTitle("x-coordinate [cm]");
373 fLayerDummy->SetYTitle("y-coordinate [cm]");
374 fLayerDummy->GetXaxis()->SetLabelSize(0.02);
375 fLayerDummy->GetYaxis()->SetLabelSize(0.02);
376 fLayerDummy->GetZaxis()->SetLabelSize(0.02);
377 fLayerDummy->GetXaxis()->SetTitleSize(0.02);
378 fLayerDummy->GetXaxis()->SetTitleOffset(1.5);
379 fLayerDummy->GetYaxis()->SetTitleSize(0.02);
380 fLayerDummy->GetYaxis()->SetTitleOffset(2);
381 fLayerDummy->GetZaxis()->SetTitleSize(0.02);
382 fLayerDummy->GetZaxis()->SetTitleOffset(-2);
383 fLayerDummy->SetStats(kFALSE);
384 fLayerDummy->SetContour(99);
385 fLayerDummy->Fill(0., 0., 0.);
386
387 fStsTrdPoints = new TH2F("fStsTrdPoints", "fStsTrdPoints", 12, -0.5, 11.5, 21, -0.5, 20.5);
388 fStsTrdPoints->SetStats(kFALSE);
389 fStsTrdPoints->SetXTitle("TRD points / track");
390 fStsTrdPoints->SetYTitle("STS points / track");
391 fStsTrdPoints->SetContour(99);
392
393 fStsMuchPoints = new TH2F("fStsMuchPoints", "fStsMuchPoints", 12, -0.5, 11.5, 21, -0.5, 20.5);
394 fStsMuchPoints->SetStats(kFALSE);
395 fStsMuchPoints->SetXTitle("MUCH points / track");
396 fStsMuchPoints->SetYTitle("STS points / track");
397 fStsMuchPoints->SetContour(99);
398
399 fStsTofPoints = new TH2F("fStsTofPoints", "fStsTofPoints", 12, -0.5, 11.5, 21, -0.5, 20.5);
400 fStsTofPoints->SetStats(kFALSE);
401 fStsTofPoints->SetXTitle("TOF points / track");
402 fStsTofPoints->SetYTitle("STS points / track");
403 fStsTofPoints->SetContour(99);
404
405 TString name;
406 for (Int_t iStsPoints = 0; iStsPoints < 11; iStsPoints++) {
407 name.Form("_%02iStsPoints", iStsPoints);
408
409 fMuchTrdPoints[iStsPoints] =
410 new TH2F("fMuchTrdPoints" + name, "fMuchTrdPoints" + name, 12, -0.5, 11.5, 21, -0.5, 20.5);
411 fMuchTrdPoints[iStsPoints]->SetStats(kFALSE);
412 fMuchTrdPoints[iStsPoints]->SetXTitle("TRD points / track");
413 fMuchTrdPoints[iStsPoints]->SetYTitle("MUCH points / track");
414 fMuchTrdPoints[iStsPoints]->SetContour(99);
415
416 fMuchTofPoints[iStsPoints] =
417 new TH2F("fMuchTofPoints" + name, "fMuchTofPoints" + name, 12, -0.5, 11.5, 21, -0.5, 20.5);
418 fMuchTofPoints[iStsPoints]->SetStats(kFALSE);
419 fMuchTofPoints[iStsPoints]->SetXTitle("TOF points / track");
420 fMuchTofPoints[iStsPoints]->SetYTitle("MUCH points / track");
421 fMuchTofPoints[iStsPoints]->SetContour(99);
422
423 fTrdTofPoints[iStsPoints] =
424 new TH2F("fTrdTofPoints" + name, "fTrdTofPoints" + name, 12, -0.5, 11.5, 21, -0.5, 20.5);
425 fTrdTofPoints[iStsPoints]->SetStats(kFALSE);
426 fTrdTofPoints[iStsPoints]->SetXTitle("TOF points / track");
427 fTrdTofPoints[iStsPoints]->SetYTitle("TRD points / track");
428 fTrdTofPoints[iStsPoints]->SetContour(99);
429 }
430
431 fStsTrdPointsTrackable = new TH2F("fStsTrdPointsTrackable", "fStsTrdPointsTrackable", 12, -0.5, 11.5, 21, -0.5, 20.5);
432 fStsTrdPointsTrackable->SetStats(kFALSE);
433 fStsTrdPointsTrackable->SetXTitle("TRD points / track");
434 fStsTrdPointsTrackable->SetYTitle("STS points / track");
435 fStsTrdPointsTrackable->SetContour(99);
436
437
439 new TH2F("fTrdPointsPerMcTrack_PID", "fTrdPointsPerMcTrack_PID", 12, -0.5, 11.5, 49, 0.5, 49.5);
440 fTrdPointsPerMcTrack_PID->SetContour(99);
441 fTrdPointsPerMcTrack_PID->SetXTitle("n TRD Points");
442 fTrdPointsPerMcTrack_PID->SetYTitle("");
443 for (Int_t bin = 1; bin <= 49; bin++) {
444 fTrdPointsPerMcTrack_PID->GetYaxis()->SetBinLabel(bin, CbmTrdUtils::GetGeantName(bin));
445 }
446 fTrdPointsPerMcTrack_PT = new TH2F("fTrdPointsPerMcTrack_PT", "fTrdPointsPerMcTrack_PT", 12, -0.5, 11.5, 30, 0, 3);
447 fTrdPointsPerMcTrack_PT->SetContour(99);
448 fTrdPointsPerMcTrack_PT->SetXTitle("n TRD Points");
449 fTrdPointsPerMcTrack_PT->SetYTitle("p_{T} (GeV/c)");
450
451 fTrdPointsPerMcTrack_P = new TH2F("fTrdPointsPerMcTrack_P", "fTrdPointsPerMcTrack_P", 12, -0.5, 11.5, 100, 0, 10);
452 fTrdPointsPerMcTrack_P->SetContour(99);
453 fTrdPointsPerMcTrack_P->SetXTitle("n TRD Points");
454 fTrdPointsPerMcTrack_P->SetYTitle("p (GeV/c)");
455
457 new TH2F("fTrdTrackCrossedRadiator", "fTrdTrackCrossedRadiator", 12, -0.5, 11.5, 15, -3.5, 11.5);
458 fTrdTrackCrossedRadiator->SetStats(kFALSE);
459 fTrdTrackCrossedRadiator->SetContour(99);
460 fTrdTrackCrossedRadiator->SetXTitle("n TRD Points");
461 fTrdTrackCrossedRadiator->SetYTitle("n Radiator crossings");
462
463 fDistanceMcToHit = new TH1I("DistanceMcToHit", "DistanceMcToHit", 1500, 0, 150);
464 fDistanceMcToHit->SetStats(kFALSE);
465 fDistanceMcToHit->SetXTitle("#Delta r (MC-Hit) pairs [cm]");
466 fDistanceMcToHit->SetYTitle("#");
467 fDistanceMcToHit->SetMarkerStyle(24);
468 fDistanceMcToHitAll = new TH1I("DistanceMcToHitAll", "DistanceMcToHitAll", 1500, 0, 150);
469 fDistanceMcToHitAll->SetStats(kFALSE);
470 fDistanceMcToHitAll->SetXTitle("#Delta r (MC-Hit) all [cm]");
471 fDistanceMcToHitAll->SetYTitle("#");
472 fDistanceMcToHitAll->SetMarkerStyle(24);
473 fdEdxPionMc = new TH1F("dEdxPionMc", "dEdxPionMc", 250, 0, 30.0e-6);
474 fdEdxPionMc->SetStats(kFALSE);
475 fdEdxPionMc->SetXTitle("dE/dx MC [GeV]");
476 fdEdxPionMc->SetYTitle("#");
477 fdEdxPionMc->SetLineColor(1);
478 fdEdxPionMc->SetLineStyle(1);
479 fdEdxPionHit = new TH1F("dEdxPionHit", "dEdxPionHit", 250, 0, 30.0e-6);
480 fdEdxPionHit->SetStats(kFALSE);
481 fdEdxPionHit->SetXTitle("dE/dx Hit [GeV]");
482 fdEdxPionHit->SetYTitle("#");
483 fdEdxPionHit->SetLineColor(1);
484 fdEdxPionHit->SetLineStyle(2);
485 fdEdxPionGhost = new TH1F("dEdxPionGhost", "dEdxPionGhost", 250, 0, 30.0e-6);
486 fdEdxPionGhost->SetStats(kFALSE);
487 fdEdxPionGhost->SetXTitle("dE/dx Ghost [GeV]");
488 fdEdxPionGhost->SetYTitle("#");
489 fdEdxPionGhost->SetLineColor(1);
490 fdEdxPionGhost->SetLineStyle(3);
491 fdEdxElectronMc = new TH1F("dEdxElectronMc", "dEdxElectronMc", 250, 0, 30.0e-6);
492 fdEdxElectronMc->SetStats(kFALSE);
493 fdEdxElectronMc->SetXTitle("dE/dx MC [GeV]");
494 fdEdxElectronMc->SetYTitle("#");
495 fdEdxElectronMc->SetLineColor(2);
496 fdEdxElectronMc->SetLineStyle(1);
497 fdEdxElectronHit = new TH1F("dEdxElectronHit", "dEdxElectronHit", 250, 0, 30.0e-6);
498 fdEdxElectronHit->SetStats(kFALSE);
499 fdEdxElectronHit->SetXTitle("dE/dx Hit [GeV]");
500 fdEdxElectronHit->SetYTitle("#");
501 fdEdxElectronHit->SetLineColor(2);
502 fdEdxElectronHit->SetLineStyle(2);
503 fdEdxElectronGhost = new TH1F("dEdxElectronGhost", "dEdxElectronGhost", 250, 0, 30.0e-6);
504 fdEdxElectronGhost->SetStats(kFALSE);
505 fdEdxElectronGhost->SetXTitle("dE/dx Ghost [GeV]");
506 fdEdxElectronGhost->SetYTitle("#");
507 fdEdxElectronGhost->SetLineColor(2);
508 fdEdxElectronGhost->SetLineStyle(3);
509 fdEdxPoint = new TH1F("dEdxPoint", "dEdxPoint", 1.0e3, 0, 30.0e-6);
510 fdEdxPoint->SetStats(kFALSE);
511 fdEdxPoint->SetXTitle("dE/dx Hit [GeV]");
512 fdEdxPoint->SetYTitle("#");
513 fdEdxDigi = new TH1F("dEdxDigi", "dEdxDigi", 1.0e3, 0, 30.0e-6);
514 fdEdxDigi->SetStats(kFALSE);
515 fdEdxDigi->SetXTitle("dE/dx Hit [GeV]");
516 fdEdxDigi->SetYTitle("#");
517 fdEdxCluster = new TH1F("dEdxCluster", "dEdxCluster", 1.0e3, 0, 30.0e-6);
518 fdEdxCluster->SetStats(kFALSE);
519 fdEdxCluster->SetXTitle("dE/dx Hit [GeV]");
520 fdEdxCluster->SetYTitle("#");
521 fdEdxHit = new TH1F("dEdxHit", "dEdxHit", 1.0e3, 0, 30.0e-6);
522 fdEdxHit->SetStats(kFALSE);
523 fdEdxHit->SetXTitle("dE/dx Hit [GeV]");
524 fdEdxHit->SetYTitle("#");
525 fMultiHitsVsR = new TProfile("MultiHitVsR", "MultiHitVsR", 785, 0, 785);
526 fMultiHitsVsR->SetStats(kFALSE);
527 fMultiHitsVsR->SetXTitle("r [cm]");
528 fMultiHitsVsR->SetYTitle("hits per point on same pad/ all points per module [%]");
529 fMultiHitsVsR->SetMarkerStyle(24);
530 fMultiHitsVsR->SetMarkerColor(4);
531 fMultiHitsVsR->SetLineColor(4);
532 fGhostHitVsR = new TProfile("GhostHitVsR", "GhostHitVsR", 785, 0, 785);
533 fGhostHitVsR->SetStats(kFALSE);
534 fGhostHitVsR->SetXTitle("r [cm]");
535 fGhostHitVsR->SetYTitle("left over hits / all points per module [%]");
536 fGhostHitVsR->SetMarkerStyle(24);
537 fGhostHitVsR->SetMarkerColor(2);
538 fGhostHitVsR->SetLineColor(2);
539 fLostPointVsR = new TProfile("LostPointVsR", "LostPointVsR", 785, 0, 785);
540 fLostPointVsR->SetStats(kFALSE);
541 fLostPointVsR->SetXTitle("r [cm]");
542 fLostPointVsR->SetYTitle("left over points / all points per module [%]");
543 fLostPointVsR->SetMarkerStyle(24);
544 fLostPointVsR->SetMarkerColor(3);
545 fLostPointVsR->SetLineColor(3);
546 fHitToPointEfficiencyVsR = new TProfile("fHitToPointEfficiencyVsR", "fHitToPointEfficiencyVsR", 785, 0, 785);
547 fHitToPointEfficiencyVsR->SetStats(kFALSE);
548 fHitToPointEfficiencyVsR->SetXTitle("r [cm]");
549 fHitToPointEfficiencyVsR->SetYTitle("point hit pairs / all points per module [%]");
550 fHitToPointEfficiencyVsR->SetMarkerStyle(24);
551 fHitToPointEfficiencyVsR->SetMarkerColor(1);
552 fHitToPointEfficiencyVsR->SetLineColor(1);
554 new TProfile("MultiHitsVsAlpha", "MultiHitsVsAlpha", TMath::Pi() / 3. * 100, 0, TMath::Pi() / 3. * 1000);
555 fMultiHitsVsAlpha->SetStats(kFALSE);
556 fMultiHitsVsAlpha->SetXTitle("#alpha [mrad]");
557 fMultiHitsVsAlpha->SetYTitle("hits per point on same pad/ all points per module [%]");
558 fMultiHitsVsAlpha->SetMarkerStyle(24);
559 fMultiHitsVsAlpha->SetMarkerColor(4);
560 fMultiHitsVsAlpha->SetLineColor(4);
562 new TProfile("GhostHitVsAlpha", "GhostHitVsAlpha", TMath::Pi() / 3. * 100, 0, TMath::Pi() / 3. * 1000);
563 fGhostHitVsAlpha->SetStats(kFALSE);
564 fGhostHitVsAlpha->SetXTitle("#alpha [mrad]");
565 fGhostHitVsAlpha->SetYTitle("left over hits / all points per module [%]");
566 fGhostHitVsAlpha->SetMarkerStyle(24);
567 fGhostHitVsAlpha->SetMarkerColor(2);
568 fGhostHitVsAlpha->SetLineColor(2);
570 new TProfile("LostPointVsAlpha", "LostPointVsAlpha", TMath::Pi() / 3. * 100, 0, TMath::Pi() / 3. * 1000);
571 fLostPointVsAlpha->SetStats(kFALSE);
572 fLostPointVsAlpha->SetXTitle("#alpha [mrad]");
573 fLostPointVsAlpha->SetYTitle("left over points / all points per module [%]");
574 fLostPointVsAlpha->SetMarkerStyle(24);
575 fLostPointVsAlpha->SetMarkerColor(3);
576 fLostPointVsAlpha->SetLineColor(3);
577 fHitToPointEfficiencyVsAlpha = new TProfile("fHitToPointEfficiencyVsAlpha", "fHitToPointEfficiencyVsAlpha",
578 TMath::Pi() / 3. * 100, 0, TMath::Pi() / 3. * 1000);
579 fHitToPointEfficiencyVsAlpha->SetStats(kFALSE);
580 fHitToPointEfficiencyVsAlpha->SetXTitle("#alpha [mrad]");
581 fHitToPointEfficiencyVsAlpha->SetYTitle("point hit pairs / all points per module [%]");
582 fHitToPointEfficiencyVsAlpha->SetMarkerStyle(24);
583 fHitToPointEfficiencyVsAlpha->SetMarkerColor(1);
584 fHitToPointEfficiencyVsAlpha->SetLineColor(1);
585 fPositionResolutionShort = new TH1I("fPositionResolutionShort", "fPositionResolutionShort", 20000, -10, 10);
586 fPositionResolutionShort->SetStats(kFALSE);
587 fPositionResolutionShort->SetXTitle("position deviation along short pad side [cm]");
588 fPositionResolutionShort->SetYTitle("#");
589 fPositionResolutionLong = new TH1I("fPositionResolutionLong", "fPositionResolutionLong", 20000, -10, 10);
590 fPositionResolutionLong->SetStats(kFALSE);
591 fPositionResolutionLong->SetXTitle("position deviation along long pad side [cm]");
592 fPositionResolutionLong->SetYTitle("#");
593 fClusterSize = new TH1I("fClusterSize", "fClusterSize", 21, -0.5, 20.5);
594 fClusterSize->SetStats(kFALSE);
595 fClusterSize->SetXTitle("cluster size [pads]");
596 fClusterSize->SetYTitle("#");
597 fPointsPerDigi = new TH1I("fPointsPerDigi", "fPointsPerDigi", 101, -0.5, 100.5);
598 fPointsPerDigi->SetStats(kFALSE);
599 fPointsPerDigi->SetXTitle("point per digi");
600 fPointsPerDigi->SetYTitle("#");
601 fDigiPerCluster = new TH1I("fDigiPerCluster", "fDigiPerCluster", 101, -0.5, 100.5);
602 fDigiPerCluster->SetStats(kFALSE);
603 fDigiPerCluster->SetXTitle("digi per cluster");
604 fDigiPerCluster->SetYTitle("#");
605 fClusterPerHit = new TH1I("fClusterPerHit", "fClusterPerHit", 101, -0.5, 100.5);
606 fClusterPerHit->SetStats(kFALSE);
607 fClusterPerHit->SetXTitle("cluster per hit");
608 fClusterPerHit->SetYTitle("#");
609 fPRF_1D = new TProfile("fPRF_1D", "fPRF_1D", 30, -1.5, 1.5);
610 fPRF_2D = new TH2I("fPRF_2D", "fPRF_2D", 30, -1.5, 1.5, 10, 0, 1);
611 fMultiHitSamePadPerMcTrack = new TH1I("fMultiHitSamePadPerMcTrack", "fMultiHitSamePadPerMcTrack", 21, -0.5, 20.5);
612 fMultiHitSamePadPerMcTrack->SetStats(kFALSE);
613 fMultiHitSamePadPerMcTrack->SetXTitle("Multihits per MC-track");
614 fMultiHitSamePadPerMcTrack->SetYTitle("#");
616 new TH1I("fMultiHitSamePadPerMcTrack_angle", "fMultiHitSamePadPerMcTrack_angle", 3600, 0, 360);
617 fMultiHitSamePadPerMcTrack_angle->SetStats(kFALSE);
618 fMultiHitSamePadPerMcTrack_angle->SetXTitle("angle [deg]");
619 fMultiHitSamePadPerMcTrack_angle->SetYTitle("#");
620 fMultiHitSamePadPerMcTrack_zBirth = new TH2I("fMultiHitSamePadPerMcTrack_zBirth", "fMultiHitSamePadPerMcTrack_zBirth",
621 10000, -50, 1000, 10000, -50, 1000);
622 fMultiHitSamePadPerMcTrack_zBirth->SetStats(kFALSE);
623 fMultiHitSamePadPerMcTrack_zBirth->SetContour(99);
624 fMultiHitSamePadPerMcTrack_zBirth->SetXTitle("z_{Birth} multihits track a [cm]");
625 fMultiHitSamePadPerMcTrack_zBirth->SetYTitle("z_{Birth} multihits track b [cm]");
627 new TH2I("fMultiHitSamePadPerMcTrack_PID", "fMultiHitSamePadPerMcTrack_PID", 49, 0.5, 49.5, 49, 0.5, 49.5);
628 fMultiHitSamePadPerMcTrack_PID->SetStats(kFALSE);
629 for (Int_t bin = 1; bin <= 49; bin++) {
630 fMultiHitSamePadPerMcTrack_PID->GetYaxis()->SetBinLabel(bin, CbmTrdUtils::GetGeantName(bin));
631 fMultiHitSamePadPerMcTrack_PID->GetXaxis()->SetBinLabel(bin, CbmTrdUtils::GetGeantName(bin));
632 }
633 fMultiHitSamePadPerMcTrack_PID->GetXaxis()->SetRangeUser(0, 15);
634 fMultiHitSamePadPerMcTrack_PID->GetYaxis()->SetRangeUser(0, 15);
635 fMultiHitSamePadPerMcTrack_PID->SetContour(99);
636 fMultiHitSamePadPerMcTrack_PID->SetXTitle("MC PID track a");
637 fMultiHitSamePadPerMcTrack_PID->SetYTitle("MC PID track b");
639 new TH2I("fMultiHitSamePadPerMcTrack_motherzBirth", "fMultiHitSamePadPerMcTrack_motherzBirth", 10000, -50, 1000,
640 10000, -50, 1000);
643 fMultiHitSamePadPerMcTrack_motherzBirth->SetXTitle("z_{Birth} multihits track a [cm]");
644 fMultiHitSamePadPerMcTrack_motherzBirth->SetYTitle("z_{Birth} multihits track b [cm]");
645 fMultiHitSamePadPerMcTrack_motherPID = new TH2I("fMultiHitSamePadPerMcTrack_motherPID",
646 "fMultiHitSamePadPerMcTrack_motherPID", 49, 0.5, 49.5, 49, 0.5, 49.5);
647 fMultiHitSamePadPerMcTrack_motherPID->SetStats(kFALSE);
648 for (Int_t bin = 1; bin <= 49; bin++) {
649 fMultiHitSamePadPerMcTrack_motherPID->GetYaxis()->SetBinLabel(bin, CbmTrdUtils::GetGeantName(bin));
650 fMultiHitSamePadPerMcTrack_motherPID->GetXaxis()->SetBinLabel(bin, CbmTrdUtils::GetGeantName(bin));
651 }
652 fMultiHitSamePadPerMcTrack_motherPID->GetXaxis()->SetRangeUser(0, 15);
653 fMultiHitSamePadPerMcTrack_motherPID->GetYaxis()->SetRangeUser(0, 15);
655 fMultiHitSamePadPerMcTrack_motherPID->SetXTitle("MC PID track a");
656 fMultiHitSamePadPerMcTrack_motherPID->SetYTitle("MC PID track b");
657
659 new TH1I("fMultiHitAdjacentPadPerMcTrack", "fMultiHitAdjacentPadPerMcTrack", 21, -0.5, 20.5);
660 fMultiHitAdjacentPadPerMcTrack->SetStats(kFALSE);
661 fMultiHitAdjacentPadPerMcTrack->SetXTitle("Multihits per MC-track");
662 fMultiHitAdjacentPadPerMcTrack->SetYTitle("#");
664 new TH1I("fMultiHitAdjacentPadPerMcTrack_angle", "fMultiHitAdjacentPadPerMcTrack_angle", 3600, 0, 360);
665 fMultiHitAdjacentPadPerMcTrack_angle->SetStats(kFALSE);
666 fMultiHitAdjacentPadPerMcTrack_angle->SetXTitle("angle [deg]");
669 new TH2I("fMultiHitAdjacentPadPerMcTrack_zBirth", "fMultiHitAdjacentPadPerMcTrack_zBirth", 10000, -50, 1000, 10000,
670 -50, 1000);
673 fMultiHitAdjacentPadPerMcTrack_zBirth->SetXTitle("z_{Birth} multihits track a [cm]");
674 fMultiHitAdjacentPadPerMcTrack_zBirth->SetYTitle("z_{Birth} multihits track b [cm]");
676 new TH2I("fMultiHitAdjacentPadPerMcTrack_PID", "fMultiHitAdjacentPadPerMcTrack_PID", 49, 0.5, 49.5, 49, 0.5, 49.5);
677 fMultiHitAdjacentPadPerMcTrack_PID->SetStats(kFALSE);
678 for (Int_t bin = 1; bin <= 49; bin++) {
679 fMultiHitAdjacentPadPerMcTrack_PID->GetYaxis()->SetBinLabel(bin, CbmTrdUtils::GetGeantName(bin));
680 fMultiHitAdjacentPadPerMcTrack_PID->GetXaxis()->SetBinLabel(bin, CbmTrdUtils::GetGeantName(bin));
681 }
682 fMultiHitAdjacentPadPerMcTrack_PID->GetXaxis()->SetRangeUser(0, 15);
683 fMultiHitAdjacentPadPerMcTrack_PID->GetYaxis()->SetRangeUser(0, 15);
685 fMultiHitAdjacentPadPerMcTrack_PID->SetXTitle("MC PID track a");
686 fMultiHitAdjacentPadPerMcTrack_PID->SetYTitle("MC PID track b");
688 new TH2I("fMultiHitAdjacentPadPerMcTrack_motherzBirth", "fMultiHitAdjacentPadPerMcTrack_motherzBirth", 10000, -50,
689 1000, 10000, -50, 1000);
692 fMultiHitAdjacentPadPerMcTrack_motherzBirth->SetXTitle("z_{Birth} multihits track a [cm]");
693 fMultiHitAdjacentPadPerMcTrack_motherzBirth->SetYTitle("z_{Birth} multihits track b [cm]");
695 new TH2I("fMultiHitAdjacentPadPerMcTrack_motherPID", "fMultiHitAdjacentPadPerMcTrack_motherPID", 49, 0.5, 49.5, 49,
696 0.5, 49.5);
698 for (Int_t bin = 1; bin <= 49; bin++) {
701 }
702 fMultiHitAdjacentPadPerMcTrack_motherPID->GetXaxis()->SetRangeUser(0, 15);
703 fMultiHitAdjacentPadPerMcTrack_motherPID->GetYaxis()->SetRangeUser(0, 15);
705 fMultiHitAdjacentPadPerMcTrack_motherPID->SetXTitle("MC PID track a");
706 fMultiHitAdjacentPadPerMcTrack_motherPID->SetYTitle("MC PID track b");
707
708
709 return kSUCCESS;
710}
712{
713 return TMath::Sqrt((point->GetXOut() - point->GetXIn()) * (point->GetXOut() - point->GetXIn())
714 + (point->GetYOut() - point->GetYIn()) * (point->GetYOut() - point->GetYIn())
715 + (point->GetZOut() - point->GetZIn()) * (point->GetZOut() - point->GetZIn()));
716}
717
718void CbmTrdQa::SetTriggerThreshold(Double_t triggerthreshold) { fTriggerThreshold = triggerthreshold; }
719
720TPolyLine* CbmTrdQa::CreateTriangularPad(Int_t column, Int_t row, Double_t content)
721{
722 const Int_t nCoordinates = 4;
723 Double_t x[nCoordinates] = {column - 0.5, column + 0.5, column + 0.5, column - 0.5};
724 Double_t y[nCoordinates] = {row - 0.5, row - 0.5, row + 0.5, row - 0.5};
725 if (row % 2 != 0) {
726 y[1] = row + 0.5;
727 y[2] = row + 0.5;
728 }
729 TPolyLine* pad = new TPolyLine(nCoordinates, x, y);
730 pad->SetFillColor(content);
731 return pad;
732}
733
734void CbmTrdQa::Exec(Option_t*)
735{
736 Bool_t samePadMerge = false; //true;
737 //fTriggerThreshold = CbmTrdClusterFinderFast::GetTriggerThreshold();
738 TStopwatch timer;
739 timer.Start();
740 cout << endl << "==================CbmTrdQa===================" << endl;
741 Int_t nEntries(0), iTrack(-1), mother_iTrack(-1), moduleAddress(-1), Station(-1), Layer(-1), combiId(-1),
742 /*dEdx(0), rPos(0), PDG(-1), ghostCount(0), lostCount(0),*/ nStsPoints(0);
743 TString title;
744 // Bool_t debug = false;
745 CbmMCTrack* track = NULL;
746 CbmMCTrack* track2 = NULL;
747 CbmMCTrack* track_mother = NULL;
748 CbmMCTrack* track2_mother = NULL;
749 CbmTrdPoint* point = NULL;
750 CbmTrdPoint* point2 = NULL;
751 const CbmTrdDigi* digi = NULL;
752 CbmTrdCluster* cluster = NULL;
753 CbmTrdHit* hit = NULL;
754 // CbmTrdPoint *point_temp = NULL;
755 std::map<Int_t, Int_t> deltaEMap;
756 std::map<Int_t, Int_t> TrackableMap;
757 std::map<Int_t, std::map<Int_t, Int_t>> doubleHitSinglePadMap; // digiAddress, std::map[MC_track_ID]
758 std::map<Int_t, Int_t> channelAddressMap;
759 std::map<Int_t, Int_t> McTrackDoubleHitMap;
760 std::map<Int_t, Int_t> neighbourChannelAddressMap;
761 std::map<Int_t, Int_t> McTrackNeighbourHitMap;
762 // MC-points
763 if (fP && fT) {
764 nEntries = fPoints->GetEntriesFast();
765 printf("%02i Points\n", nEntries);
766
767 std::map<Int_t, Int_t> hasBeenUsedTrack;
768 for (Int_t iPoint = 0; iPoint < nEntries; iPoint++) {
769 point = (CbmTrdPoint*) fPoints->At(iPoint);
770 fdEdxPoint->Fill(point->GetEnergyLoss());
771 moduleAddress = point->GetDetectorID();
772 Station = CbmTrdAddress::GetLayerId(moduleAddress) / 4 + 1; //fGeoHandler->GetStation(moduleId);
773 Layer = CbmTrdAddress::GetLayerId(moduleAddress) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
774 //Station = 0;//fGeoHandler->GetStation(moduleId);
775 //Layer = CbmTrdAddress::GetLayerId(moduleAddress);//fGeoHandler->GetLayer(moduleId);
776 //printf ("P det: %i S%i L%i \n",moduleId,Station,Layer);//GetDetId());
777 combiId = 10 * Station + Layer;
778 iTrack = point->GetTrackID();
779 track = (CbmMCTrack*) fMCTracks->At(iTrack);
780 //PDG = track->GetPdgCode();
781 nStsPoints = track->GetNPoints(ECbmModuleId::kSts);
782 //fStsTrdPoints->Fill(track->GetNPoints(ECbmModuleId::kTrd),track->GetNPoints(ECbmModuleId::kSts));
783 CbmTrdParModDigi* fModuleInfo = (CbmTrdParModDigi*) fDigiPar->GetModulePar(moduleAddress);
784 CbmTrdParModGeo* fModuleGeo = (CbmTrdParModGeo*) fGeoPar->GetModulePar(moduleAddress);
785 if (fModuleGhostMap.find(moduleAddress) == fModuleGhostMap.end()) {
786 title.Form("G%i_S%i_L%i_(%.2f, %.2f, %.2f)", moduleAddress, Station, Layer, fModuleGeo->GetX(),
787 fModuleGeo->GetY(), fModuleGeo->GetZ());
788 fModuleGhostMap[moduleAddress] = new TH1I(title, title, 200, 0, 200);
789 fModuleGhostMap[moduleAddress]->SetXTitle("left over points / all points [%]");
790 fModuleGhostMap[moduleAddress]->SetYTitle("#");
791 title.Form("L%i_S%i_L%i_(%.2f, %.2f, %.2f)", moduleAddress, Station, Layer, fModuleGeo->GetX(),
792 fModuleGeo->GetY(), fModuleGeo->GetZ());
793 fModuleLostMap[moduleAddress] = new TH1I(title, title, 200, 0, 200);
794 fModuleLostMap[moduleAddress]->SetXTitle("left over hits / all points [%]");
795 fModuleLostMap[moduleAddress]->SetYTitle("#");
796 title.Form("E%i_S%i_L%i_(%.2f, %.2f, %.2f)", moduleAddress, Station, Layer, fModuleGeo->GetX(),
797 fModuleGeo->GetY(), fModuleGeo->GetZ());
798 fModuleEfficiencyMap[moduleAddress] = new TH1I(title, title, 200, 0, 200);
799 fModuleEfficiencyMap[moduleAddress]->SetXTitle("found point hit pairs / all points [%]");
800 fModuleEfficiencyMap[moduleAddress]->SetYTitle("#");
801 title.Form("M%i_S%i_L%i_(%.2f, %.2f, %.2f)", moduleAddress, Station, Layer, fModuleGeo->GetX(),
802 fModuleGeo->GetY(), fModuleGeo->GetZ());
803 fModuleMultiPointMap[moduleAddress] = new TH1I(title, title, 200, 0, 200);
804 fModuleMultiPointMap[moduleAddress]->SetXTitle("multi point per channel / all points [%]");
805 fModuleMultiPointMap[moduleAddress]->SetYTitle("#");
806 title.Form("D%i_S%i_L%i_(%.2f, %.2f, %.2f)", moduleAddress, Station, Layer, fModuleGeo->GetX(),
807 fModuleGeo->GetY(), fModuleGeo->GetZ());
808 fModuleDeltaEMap[moduleAddress] = new TH1I(title, title, 200, 0, 200);
809 fModuleDeltaEMap[moduleAddress]->SetXTitle("#delta-electrons [%]");
810 fModuleDeltaEMap[moduleAddress]->SetYTitle("#");
811 title.Form("TL%i_S%i_L%i_(%.2f, %.2f, %.2f)", moduleAddress, Station, Layer, fModuleGeo->GetX(),
812 fModuleGeo->GetY(), fModuleGeo->GetZ());
813 fModuleTracklengthMap[moduleAddress] = new TH1I(title, title, 200, 0, 10);
814 fModuleTracklengthMap[moduleAddress]->SetXTitle("track length [cm]");
815 fModuleTracklengthMap[moduleAddress]->SetYTitle("#");
816 title.Form("dE%i_S%i_L%i_(%.2f, %.2f, %.2f)", moduleAddress, Station, Layer, fModuleGeo->GetX(),
817 fModuleGeo->GetY(), fModuleGeo->GetZ());
818 fModuledEdxMap[moduleAddress] = new TH1I(title, title, 200, 0, 50);
819 fModuledEdxMap[moduleAddress]->SetXTitle("#LTdEdx#GT [keV]");
820 fModuledEdxMap[moduleAddress]->SetYTitle("#");
821 title.Form("CS%i_S%i_L%i_(%.2f, %.2f, %.2f)", moduleAddress, Station, Layer, fModuleGeo->GetX(),
822 fModuleGeo->GetY(), fModuleGeo->GetZ());
823 fModuleClusterSizeMap[moduleAddress] = new TH1I(title, title, 200, 0, 200);
824 fModuleClusterSizeMap[moduleAddress]->SetXTitle("cluster size [channel]");
825 fModuleClusterSizeMap[moduleAddress]->SetYTitle("#");
826 title.Form("TA%i_S%i_L%i_(%.2f, %.2f, %.2f)", moduleAddress, Station, Layer, fModuleGeo->GetX(),
827 fModuleGeo->GetY(), fModuleGeo->GetZ());
828 fModuleTrackableMap[moduleAddress] = new TH1I(title, title, 200, 0, 200);
829 fModuleTrackableMap[moduleAddress]->SetXTitle("min. 5 STS points [%]");
830 fModuleTrackableMap[moduleAddress]->SetYTitle("#");
831 title.Form("TA2%i_S%i_L%i_(%.2f, %.2f, %.2f)", moduleAddress, Station, Layer, fModuleGeo->GetX(),
832 fModuleGeo->GetY(), fModuleGeo->GetZ());
833 fModuleTrackableMap2[moduleAddress] = new TH1I(title, title, 200, 0, 200);
834 fModuleTrackableMap2[moduleAddress]->SetXTitle("min. 5 STS points [#]");
835 fModuleTrackableMap2[moduleAddress]->SetYTitle("#");
836 title.Form("AP%i_S%i_L%i_(%.2f, %.2f, %.2f)", moduleAddress, Station, Layer, fModuleGeo->GetX(),
837 fModuleGeo->GetY(), fModuleGeo->GetZ());
838 fModuleAveragePointsMap[moduleAddress] = new TH1I(title, title, 500, 0, 500);
839 fModuleAveragePointsMap[moduleAddress]->SetXTitle("average points per event");
840 fModuleAveragePointsMap[moduleAddress]->SetYTitle("#");
841
842 deltaEMap[moduleAddress] = 0;
843 TrackableMap[moduleAddress] = 0;
844 }
845
846 Double_t p_global[3] = {0.5 * (point->GetXOut() + point->GetXIn()), 0.5 * (point->GetYOut() + point->GetYIn()),
847 0.5 * (point->GetZOut() + point->GetZIn())};
848
849 gGeoManager->FindNode(p_global[0], p_global[1], p_global[2]);
850 if (!TString(gGeoManager->GetPath()).Contains("gas")) {
851 cout << gGeoManager->GetPath() << endl;
852 continue;
853 }
854 iTrack = point->GetTrackID();
855 track = (CbmMCTrack*) fMCTracks->At(iTrack);
856
857 Int_t Pdg_code = track->GetPdgCode();
858 if (hasBeenUsedTrack.find(iTrack) != hasBeenUsedTrack.end()) {
859 //hasBeenUsedTrack[iTrack] += 1;//continue;
860 if (NULL != fRadiator)
861 if (fRadiator->LatticeHit(point)) hasBeenUsedTrack[iTrack] -= 1;
862 }
863 else {
864 hasBeenUsedTrack[iTrack] = track->GetNPoints(ECbmModuleId::kTrd);
868 }
869
870
871 Double_t trackLength = GetTrackLength(point);
872 /*
873 TMath::Sqrt(
874 (point->GetXOut() - point->GetXIn()) * (point->GetXOut() - point->GetXIn()) +
875 (point->GetYOut() - point->GetYIn()) * (point->GetYOut() - point->GetYIn()) +
876 (point->GetZOut() - point->GetZIn()) * (point->GetZOut() - point->GetZIn())
877 );
878 */
879 if (Int_t(trackLength / 1.0 + 0.9) < 1) { // Track length threshold of minimum 0.1cm track length in gas volume
880 deltaEMap[moduleAddress] += 1;
881 continue;
882 }
883 if (nStsPoints >= 5) TrackableMap[moduleAddress] += 1;
884
885 //track = (CbmMCTrack*) fMCTracks->At(point->GetTrackID());
886 Int_t sectorId(0), columnId(0), rowId(0);
887 fModuleInfo->GetPadInfo(point, sectorId, columnId, rowId);
888 //printf("L:%i, MA:%i, S:%i R:%i, C:%i\n",CbmTrdAddress::GetLayerId(moduleAddress),CbmTrdAddress::GetModuleId(moduleAddress),sectorId,rowId,columnId);
889 Int_t channelAddress = CbmTrdAddress::GetAddress(
890 CbmTrdAddress::GetLayerId(moduleAddress), CbmTrdAddress::GetModuleId(moduleAddress), sectorId, rowId, columnId);
891
892 if (channelAddressMap.find(channelAddress) == channelAddressMap.end()) {
893 channelAddressMap[channelAddress] = 0;
894 neighbourChannelAddressMap[channelAddress] = 0;
895 }
896 channelAddressMap[channelAddress] += 1;
897 //neighbourChannelAddressMap[channelAddress] += 1;
898
899 if (McTrackDoubleHitMap.find(point->GetTrackID()) == McTrackDoubleHitMap.end()) {
900 McTrackDoubleHitMap[point->GetTrackID()] = 0;
901 McTrackNeighbourHitMap[point->GetTrackID()] = 0;
902 }
903 if (channelAddressMap[channelAddress] > 1) {
904 McTrackDoubleHitMap[point->GetTrackID()] += 1;
905 }
906
907 Int_t neighbourRow(-1), neighbourColumn(-1), neighbourSector(-1), neighbourChannelAddress(0);
908 //printf("\nS:%3i C:%3i R:%3i\n",sectorId,columnId,rowId);
909 for (Int_t r = -1; r <= 1; r++) {
910 for (Int_t c = -1; c <= 1; c++) {
911 if (r == 0 && c == 0) continue;
912 if (r != 0 && c != 0) continue;
913 if (rowId < fModuleInfo->GetNofRowsInSector(sectorId) - 1 && rowId > 0) {
914 neighbourSector = sectorId;
915 neighbourRow = rowId + r;
916 }
917 else if (rowId + r < 0 && sectorId > 0) {
918 neighbourSector = sectorId - 1;
919 neighbourRow = fModuleInfo->GetNofRowsInSector(neighbourSector) - 1;
920 }
921 else if (rowId == fModuleInfo->GetNofRowsInSector(sectorId) - 1
922 && sectorId < fModuleInfo->GetNofSectors() - 1) {
923 neighbourSector = sectorId + 1;
924 neighbourRow = 0;
925 }
926 if (columnId + c >= 0 && columnId + c <= fModuleInfo->GetNofColumnsInSector(sectorId) - 1)
927 neighbourColumn = columnId + c;
928 //printf (" S:%3i C:%3i R:%3i\n",neighbourSector,neighbourColumn,neighbourRow);
929 if (neighbourSector > -1 && neighbourRow > -1 && neighbourColumn > -1) {
930 neighbourChannelAddress = CbmTrdAddress::GetAddress(CbmTrdAddress::GetLayerId(moduleAddress),
931 CbmTrdAddress::GetModuleId(moduleAddress),
932 neighbourSector, neighbourRow, neighbourColumn);
933 if (channelAddressMap.find(neighbourChannelAddress) != channelAddressMap.end()) {
934 //if (neighbourChannelAddressMap.find(neighbourChannelAddress) != neighbourChannelAddressMap.end()){
935 neighbourChannelAddressMap[channelAddress] += 1;
936 neighbourChannelAddressMap[neighbourChannelAddress] += 1;
937 //if (neighbourChannelAddressMap[neighbourChannelAddress] > 1){
938 //if (McTrackNeighbourHitMap.find(neighbourChannelAddress) == McTrackNeighbourHitMap.end())
939 //McTrackNeighbourHitMap[point->GetTrackID()] = 0;
940 McTrackNeighbourHitMap[point->GetTrackID()] += 1;
941 //}
942 }
943 }
944 }
945 }
946 Double_t ELoss = point->GetEnergyLoss();
947 //if (ELoss < 1E-9){
948 //continue;
949 //}
950 fModulePointMap[moduleAddress].push_back(iPoint);
951 fModuledEdxMap[moduleAddress]->Fill(ELoss * 1E6);
952 fModuleTracklengthMap[moduleAddress]->Fill(trackLength);
953
954 if (fLayerMap.find(combiId) == fLayerMap.end()) {
955 title.Form("Station%i_Layer%i", Station, Layer);
956 fLayerMap[combiId] = new TCanvas(title, title, 1200, 1000);
957 fLayerDummy->Draw("colz");
958 }
959 }
960 for (std::map<Int_t, Int_t>::iterator it = hasBeenUsedTrack.begin(); it != hasBeenUsedTrack.end(); it++) {
961 track = (CbmMCTrack*) fMCTracks->At(it->first);
962 fTrdTrackCrossedRadiator->Fill(track->GetNPoints(ECbmModuleId::kTrd), it->second);
963 }
964 }
965
966
967 // Digis
968 if (fD) {
970 // nEntries = fDigis->GetEntries();
971 printf("%i Digis \n", nEntries);
972 for (Int_t iDigi = 0; iDigi < nEntries; iDigi++) {
973 digi = CbmDigiManager::Instance()->Get<CbmTrdDigi>(iDigi);
974 //fPointsPerDigi->Fill((Int_t)digi->GetMCIndex().size());
975 fdEdxDigi->Fill(digi->GetCharge());
976 moduleAddress = CbmTrdAddress::GetModuleAddress(digi->GetAddress()); //digi->GetDetId();
977 Station = CbmTrdAddress::GetLayerId(moduleAddress) / 4 + 1; //fGeoHandler->GetStation(moduleId);
978 Layer = CbmTrdAddress::GetLayerId(moduleAddress) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
979 //printf ("D det: %i S%i L%i \n",moduleAddress,Station,Layer);//GetDetId());
980 combiId = 10 * Station + Layer;
981 // CbmTrdParModDigi* fModuleInfo = (CbmTrdParModDigi*)fDigiPar->GetModulePar(moduleAddress);
982 if (fModuleDigiMap.find(moduleAddress) == fModuleDigiMap.end()) {
983 }
984 fModuleDigiMap[moduleAddress].push_back(iDigi);
985 if (fLayerMap.find(combiId) == fLayerMap.end()) {
986 title.Form("Station%i_Layer%i", Station, Layer);
987 fLayerMap[combiId] = new TCanvas(title, title, 1200, 1000);
988 fLayerDummy->Draw("colz");
989 }
990 }
991 }
992
993 //Clusters
994 if (fC) {
995 nEntries = fClusters->GetEntriesFast();
996 printf("%i\n", nEntries);
997 for (Int_t iCluster = 0; iCluster < nEntries; iCluster++) {
998 cluster = (CbmTrdCluster*) fClusters->At(iCluster);
999 Double_t charge = 0;
1001 CbmDigiManager::Instance()->Get<CbmTrdDigi>(cluster->GetDigi(0))->GetAddress())]
1002 ->Fill(Int_t(cluster->GetNofDigis()));
1003 //fModuleClusterSizeMap[CbmTrdAddress::GetModuleAddress(((CbmTrdDigi*)fDigis->At(cluster->GetDigi(0)))->GetAddress())]->Fill(Int_t(cluster->GetNofDigis()));
1004 for (Int_t iDigi = 0; iDigi < cluster->GetNofDigis(); iDigi++) {
1005 digi = CbmDigiManager::Instance()->Get<CbmTrdDigi>(cluster->GetDigi(iDigi));
1006 // digi = (CbmTrdDigi*)fDigis->At(cluster->GetDigi(iDigi));
1007 charge += digi->GetCharge();
1008 }
1009 fdEdxCluster->Fill(charge);
1010 fClusterSize->Fill(cluster->GetNofDigis());
1011 fDigiPerCluster->Fill(cluster->GetNofDigis());
1012 if (cluster->GetNofDigis() >= 3) {
1013 // Double_t qLeft(0.0), qCenter(.0), qRight(0.0);
1014 for (Int_t i = 0; i < cluster->GetNofDigis(); i++) {
1015 digi = CbmDigiManager::Instance()->Get<CbmTrdDigi>(cluster->GetDigi(i));
1016 // digi = (CbmTrdDigi*) fDigis->At(cluster->GetDigi(i));
1017 }
1018 //fPRF_2D->Fill();
1019 //fPRF_1D->Fill();
1020 }
1021 //moduleAddress = cluster->GetDetId();
1022 //Station = fGeoHandler->GetStation(moduleAddress);
1023 //Layer = fGeoHandler->GetLayer(moduleAddress);
1024 //printf ("det: %i S%i L%i \n",moduleAddress,Station,Layer);//GetDetId());
1025 //combiId = 10 * Station + Layer;
1026 //CbmTrdParModDigi* fModuleInfo = (CbmTrdParModDigi*)fDigiPar->GetModulePar(moduleAddress);
1027 //if (fModuleClusterMap.find(moduleAddress) == fModuleClusterMap.end()){
1028 //fModuleClusterMap[moduleAddress].push_back(iCluster);
1029 //}
1030 }
1031 }
1032
1033 //Hits
1034 if (fH) {
1035 nEntries = fHits->GetEntriesFast();
1036 printf("%i Hits\n", nEntries);
1037 for (Int_t iHit = 0; iHit < nEntries; iHit++) {
1038 hit = (CbmTrdHit*) fHits->At(iHit);
1039 fdEdxHit->Fill(hit->GetELoss());
1040 moduleAddress = hit->GetAddress(); //hit->GetDetId();
1041 Station = CbmTrdAddress::GetLayerId(moduleAddress) / 4 + 1; //fGeoHandler->GetStation(moduleId);
1042 Layer = CbmTrdAddress::GetLayerId(moduleAddress) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
1043 combiId = 10 * Station + Layer;
1044 // CbmTrdParModDigi* fModuleInfo = (CbmTrdParModDigi*)fDigiPar->GetModulePar(moduleAddress);
1045 if (fModuleHitMap.find(moduleAddress) == fModuleHitMap.end()) {
1046 }
1047 fModuleHitMap[moduleAddress].push_back(iHit);
1048 if (fLayerMap.find(combiId) == fLayerMap.end()) {
1049 title.Form("Station%i_Layer%i", Station, Layer);
1050 fLayerMap[combiId] = new TCanvas(title, title, 1200, 1000);
1051 fLayerMap[combiId]->cd();
1052 fLayerDummy->Draw("colz");
1053 }
1054 }
1055 }
1056 for (std::map<Int_t, Int_t>::iterator McTrackDoubleHitMapIt =
1057 McTrackDoubleHitMap.begin(); // Loop for all module ids which have mc points
1058 McTrackDoubleHitMapIt != McTrackDoubleHitMap.end(); McTrackDoubleHitMapIt++) {
1059 fMultiHitSamePadPerMcTrack->Fill(McTrackDoubleHitMapIt->second);
1060 }
1061
1062 for (std::map<Int_t, Int_t>::iterator McTrackNeighbourHitMapIt = McTrackNeighbourHitMap.begin();
1063 McTrackNeighbourHitMapIt != McTrackNeighbourHitMap.end(); McTrackNeighbourHitMapIt++) {
1064 fMultiHitAdjacentPadPerMcTrack->Fill(McTrackNeighbourHitMapIt->second);
1065 }
1066 //printf(Int_t(fModulePointMapIt->second.size()),Int_t(->second.size()),Int_t(->second.size()));
1067 std::map<Int_t, Int_t> notMultiPointTRDPoints;
1068 Int_t allPoints(0); //, allHits(0);//, notMultiPointTRDPoints(0);
1069 for (fModulePointMapIt = fModulePointMap.begin(); // Loop for all module ids which have mc points
1071 if (fModuleHitMap.find(fModulePointMapIt->first) == fModuleHitMap.end()) {
1072 printf("module %i not found in hit map\n", fModulePointMapIt->first);
1073 }
1074 else {
1075 std::map<Int_t, Int_t> hasBeenUsed;
1076 moduleAddress = fModulePointMapIt->first;
1077 CbmTrdParModDigi* fModuleInfo = (CbmTrdParModDigi*) fDigiPar->GetModulePar(moduleAddress);
1078 CbmTrdParModGeo* fModuleGeo = (CbmTrdParModGeo*) fGeoPar->GetModulePar(moduleAddress);
1079 allPoints = Int_t(fModulePointMapIt->second.size());
1080 fModuleAveragePointsMap[moduleAddress]->Fill(allPoints);
1081 // allHits = Int_t(fModuleHitMap[moduleAddress].size());
1082 fModuleDeltaEMap[moduleAddress]->Fill(100. * deltaEMap[moduleAddress] / allPoints);
1083 fModuleTrackableMap[moduleAddress]->Fill(100. * TrackableMap[moduleAddress] / allPoints);
1084 fModuleTrackableMap2[moduleAddress]->Fill(TrackableMap[moduleAddress]);
1085 //fModuleHitMapIt = fModuleHitMap[fModulePointMapIt->first];
1086 //cout << "Module: " << moduleAddress << " Points: "<< fModulePointMapIt->second.size() << endl;
1087
1088 Double_t multiHitCounterModule = 0;
1089 Double_t r = sqrt(fModuleGeo->GetX() * fModuleGeo->GetX()
1090 + fModuleGeo->GetY() * fModuleGeo->GetY()); // radial position of the module center
1091 Double_t alpha = atan(r / fModuleGeo->GetZ()) * 1000.; //[mrad]
1092 //printf("%.2f %.2f %.2f %.2f %.2f\n",fModuleGeo->GetX(), fModuleGeo->GetY(), fModuleGeo->GetZ(), r, alpha);
1093 //for (Int_t iPoint = 0; iPoint < Int_t(fModulePointMapIt->second.size()); iPoint++) {
1094 for (
1095 Int_t iPoint = Int_t(fModulePointMapIt->second.size()) - 1; iPoint >= 0;
1096 iPoint--) { // its better to go backwards since found point and hit pairs are erased -> vector sice is dynamic
1097 //hasBeenUsed[fModulePointMapIt->second[iPoint]] = 0;
1098 point = (CbmTrdPoint*) fPoints->At(fModulePointMapIt->second[iPoint]);
1099 iTrack = point->GetTrackID();
1100
1101
1102 track = (CbmMCTrack*) fMCTracks->At(iTrack);
1103 mother_iTrack = track->GetMotherId();
1104 if (mother_iTrack >= 0)
1105 track_mother = (CbmMCTrack*) fMCTracks->At(mother_iTrack);
1106 else
1107 track_mother = NULL;
1108 if (notMultiPointTRDPoints.find(iTrack) == notMultiPointTRDPoints.end()) {
1109 //if (track->GetNPoints(ECbmModuleId::kSts) > 0)
1110 {
1111 Int_t nStsPoint = track->GetNPoints(ECbmModuleId::kSts);
1115 if (nStsPoint < 11) {
1116 fMuchTrdPoints[nStsPoint]->Fill(track->GetNPoints(ECbmModuleId::kTrd),
1118 fMuchTofPoints[nStsPoint]->Fill(track->GetNPoints(ECbmModuleId::kTof),
1120 fTrdTofPoints[nStsPoint]->Fill(track->GetNPoints(ECbmModuleId::kTof),
1122 }
1123 notMultiPointTRDPoints[iTrack] = track->GetNPoints(ECbmModuleId::kTrd);
1124 }
1125 }
1126 Int_t Pdg_code = track->GetPdgCode();
1127
1128 /*
1129 Double_t p_global[3] = {0.5 * (point->GetXIn() + point->GetXOut()),
1130 0.5 * (point->GetYIn() + point->GetYOut()),
1131 0.5 * (point->GetZIn() + point->GetZOut())};
1132 */
1133
1134 Double_t p_global[3] = {0.5 * (point->GetXOut() + point->GetXIn()), 0.5 * (point->GetYOut() + point->GetYIn()),
1135 0.5 * (point->GetZOut() + point->GetZIn())};
1136
1137 gGeoManager->FindNode(p_global[0], p_global[1], p_global[2]);
1138 // const Double_t *global_point = gGeoManager->GetCurrentPoint();
1139 Double_t p_local[3] = {0.0};
1140 gGeoManager->MasterToLocal(p_global, p_local);
1141 //p_local[0] = p_global[0] - fModuleInfo->GetX();
1142 //p_local[1] = p_global[1] - fModuleInfo->GetY();
1143
1144 Int_t xPpad(0), yPpad(0),
1145 pSectorId(-1); // correspoondig digi from point point of view
1146
1147 fModuleInfo->GetPadInfo(p_local, pSectorId, xPpad, yPpad);
1148 yPpad = fModuleInfo->GetModuleRow(pSectorId, yPpad);
1149
1150 for (Int_t jPoint = 0; jPoint < iPoint; jPoint++) {
1151 point2 = (CbmTrdPoint*) fPoints->At(fModulePointMapIt->second[jPoint]);
1152 Int_t jTrack = point2->GetTrackID();
1153 track2 = (CbmMCTrack*) fMCTracks->At(jTrack);
1154 Int_t mother_jTrack = track2->GetMotherId();
1155 if (mother_jTrack >= 0)
1156 track2_mother = (CbmMCTrack*) fMCTracks->At(mother_jTrack);
1157 else
1158 track2_mother = NULL;
1159 if (notMultiPointTRDPoints.find(jTrack) == notMultiPointTRDPoints.end()) {
1160 //if (track2->GetNPoints(ECbmModuleId::kSts) > 0)
1161 {
1162 Int_t nStsPoint = track2->GetNPoints(ECbmModuleId::kSts);
1166 if (nStsPoint < 11) {
1167 fMuchTrdPoints[nStsPoint]->Fill(track2->GetNPoints(ECbmModuleId::kTrd),
1169 fMuchTofPoints[nStsPoint]->Fill(track2->GetNPoints(ECbmModuleId::kTof),
1171 fTrdTofPoints[nStsPoint]->Fill(track2->GetNPoints(ECbmModuleId::kTof),
1173 }
1174 notMultiPointTRDPoints[jTrack] = track2->GetNPoints(ECbmModuleId::kTrd);
1175 }
1176 }
1177
1178 Double_t p_global2[3] = {0.5 * (point2->GetXOut() + point2->GetXIn()),
1179 0.5 * (point2->GetYOut() + point2->GetYIn()),
1180 0.5 * (point2->GetZOut() + point2->GetZIn())};
1181
1182 gGeoManager->FindNode(p_global2[0], p_global2[1], p_global2[2]);
1183 // const Double_t *global_point2 = gGeoManager->GetCurrentPoint();
1184 Double_t p_local2[3] = {0.0};
1185 gGeoManager->MasterToLocal(p_global2, p_local2);
1186 Int_t xPpad2(0), yPpad2(0),
1187 pSectorId2(-1); // correspoondig digi from point point of view
1188
1189 fModuleInfo->GetPadInfo(p_local2, pSectorId2, xPpad2, yPpad2);
1190 yPpad2 = fModuleInfo->GetModuleRow(pSectorId2, yPpad2);
1191
1192 if ((xPpad2 == xPpad) && (yPpad2 == yPpad)) { // identical pad
1193 //Double_t angle = CalcAngle(point, point2);
1194 //cout << angle*1000. << "mrad " << angle / TMath::Pi() * 180. << "deg" << endl;
1195 fMultiHitSamePadPerMcTrack_angle->Fill(CalcAngle(point, point2));
1196 fMultiHitSamePadPerMcTrack_zBirth->Fill(track->GetStartZ(), track2->GetStartZ());
1199 if (NULL != track_mother && NULL != track2_mother) {
1200 fMultiHitSamePadPerMcTrack_motherzBirth->Fill(track_mother->GetStartZ(), track2_mother->GetStartZ());
1202 CbmTrdUtils::PdgToGeant(track2_mother->GetPdgCode()));
1203 }
1204 if (hasBeenUsed.find(fModulePointMapIt->second[iPoint]) == hasBeenUsed.end()) {
1205 hasBeenUsed[fModulePointMapIt->second[iPoint]] = 1;
1206 multiHitCounterModule++;
1207 if (notMultiPointTRDPoints.find(iTrack) != notMultiPointTRDPoints.end())
1208 if (notMultiPointTRDPoints[iTrack] > 0) notMultiPointTRDPoints[iTrack]--;
1209 }
1210 if (hasBeenUsed.find(fModulePointMapIt->second[jPoint]) == hasBeenUsed.end()) {
1211 hasBeenUsed[fModulePointMapIt->second[jPoint]] += 1;
1212 multiHitCounterModule++;
1213 if (notMultiPointTRDPoints.find(jTrack) != notMultiPointTRDPoints.end())
1214 if (notMultiPointTRDPoints[jTrack] > 0) notMultiPointTRDPoints[jTrack]--;
1215 }
1216 }
1217 else if ((fabs(xPpad - xPpad2) <= 1 && fabs(yPpad - yPpad2) <= 1)) { // surrounding neighbour pads
1218 if ((xPpad2 == xPpad) || (yPpad2 == yPpad)) { // exclude diagonal
1219 fMultiHitAdjacentPadPerMcTrack_angle->Fill(CalcAngle(point, point2));
1223 if (NULL != track_mother && NULL != track2_mother) {
1225 track2_mother->GetStartZ());
1227 CbmTrdUtils::PdgToGeant(track2_mother->GetPdgCode()));
1228 }
1229 if (hasBeenUsed.find(fModulePointMapIt->second[iPoint]) == hasBeenUsed.end()) {
1230 hasBeenUsed[fModulePointMapIt->second[iPoint]] = 1;
1231 multiHitCounterModule++;
1232 }
1233 if (hasBeenUsed.find(fModulePointMapIt->second[jPoint]) == hasBeenUsed.end()) {
1234 hasBeenUsed[fModulePointMapIt->second[jPoint]] += 1;
1235 multiHitCounterModule++;
1236 }
1237 }
1238 else {
1239 //fStsTrdPointsTrackable->Fill(track->GetNPoints(ECbmModuleId::kTrd),track->GetNPoints(ECbmModuleId::kSts));
1240 }
1241 }
1242 else {
1243 //fStsTrdPointsTrackable->Fill(track->GetNPoints(ECbmModuleId::kTrd),track->GetNPoints(ECbmModuleId::kSts));
1244 }
1245 }
1246 Double_t xPPadSize(fModuleInfo->GetPadSizeX(pSectorId)),
1247 yPPadSize(fModuleInfo->GetPadSizeY(pSectorId)); // correspoondig pad sizes from point point of view
1248 //GetPadInfos( moduleAddress, p_local[0], p_local[1], xPpad, yPpad, xPPadSize, yPPadSize);
1249 if (point->GetEnergyLoss() > 0.0) {
1250 if (Pdg_code == 211 || Pdg_code == -211) fdEdxPionMc->Fill(point->GetEnergyLoss());
1251 if (Pdg_code == 11 || Pdg_code == -11) fdEdxElectronMc->Fill(point->GetEnergyLoss());
1252 }
1253 Double_t minimumDistance = sqrt(xPPadSize * xPPadSize + yPPadSize * yPPadSize);
1254 Double_t xDiviation(0), yDiviation(0);
1255 Int_t minDHitId = -1;
1256 Double_t mergedELoss = 0.0;
1257 Double_t hitELoss = 0.0;
1258 // Int_t multiHitCounter = 0;
1259 for (Int_t iHit = 0; iHit < Int_t(fModuleHitMap[moduleAddress].size()); iHit++) {
1260 hit = (CbmTrdHit*) fHits->At(fModuleHitMap[moduleAddress][iHit]);
1261 Double_t h_global[3] = {hit->GetX(), hit->GetY(), hit->GetZ()};
1262 gGeoManager->FindNode(h_global[0], h_global[1], h_global[2]);
1263 // const Double_t *global_hit = gGeoManager->GetCurrentPoint();
1264 Double_t h_local[3] = {0.0};
1265 gGeoManager->MasterToLocal(h_global, h_local);
1266 //h_local[0] = h_global[0] - fModuleInfo->GetX();
1267 //h_local[1] = h_global[1] - fModuleInfo->GetY();
1268 Int_t xHpad(0), yHpad(0),
1269 hSectorId(-1); // correspoondig digi from hit point of view
1270 fModuleInfo->GetPadInfo(h_local, hSectorId, xHpad, yHpad);
1271 yHpad = fModuleInfo->GetModuleRow(hSectorId, yHpad);
1272 // Double_t xHPadSize(fModuleInfo->GetPadSizeX(hSectorId)), yHPadSize(fModuleInfo->GetPadSizeY(hSectorId)); // correspoondig pad sizes from point point of view
1273 //Double_t xHPadSize(0), yHPadSize(0); // correspoondig pad sizes from hit point of view
1274 //GetPadInfos( moduleAddress, h_local[0], h_local[1], xHpad, yHpad, xHPadSize, yHPadSize);
1275 //point_temp = new CbmTrdPoint(iTrack, hit->GetDetId(), );
1276 //r = sqrt(h_global[0] * h_global[0] + h_global[1] * h_global[1]);
1277 //r = sqrt(hit->GetX() * hit->GetX() + hit->GetY() * hit->GetY());
1278 Double_t distance = sqrt((p_local[0] - h_local[0]) * (p_local[0] - h_local[0])
1279 + (p_local[1] - h_local[1]) * (p_local[1] - h_local[1]));
1280 fDistanceMcToHitAll->Fill(distance);
1281 //if (xHpad == xPpad && yHpad == yPpad) {
1282 if (distance < minimumDistance
1283 || (xHpad == xPpad
1284 && yHpad
1285 == yPpad)) { // distance between point and hit is smaller one pad diagonal or on the same pad
1286 //if (distance < minimumDistance){
1287 minimumDistance = distance;
1288 minDHitId = iHit;
1289 xDiviation = p_local[0] - h_local[0];
1290 yDiviation = p_local[1] - h_local[1];
1291 hitELoss = hit->GetELoss();
1292 /*
1293 if (xHpad == xPpad && yHpad == yPpad){
1294 multiHitCounter++;
1295 if (samePadMerge)
1296 mergedELoss += hit->GetELoss();
1297 }
1298 */
1299 }
1300 }
1301
1302 if (minDHitId > -1) { // If minimumDistance < pad diagonal -> delete point and hit from map
1303 //multiHitCounterModule += multiHitCounter / Float_t(fModulePointMapIt->second.size());
1304 fModuleHitMap[moduleAddress].erase(fModuleHitMap[moduleAddress].begin() + minDHitId);
1305 fModulePointMapIt->second.erase(fModulePointMapIt->second.begin() + iPoint);
1306 if (samePadMerge) {
1307 //if (mergedELoss == 0.0)
1308 //printf("(%02i, %02i) (%02i, %02i) %.2e %.2e\n",xPpad, yPpad, fModuleInfo->GetnCol(), fModuleInfo->GetnRow(), mergedELoss, point->GetEnergyLoss());
1309 if (Pdg_code == 211 || Pdg_code == -211) // pdg code from associated point is used
1310 fdEdxPionHit->Fill(mergedELoss);
1311 if (Pdg_code == 11 || Pdg_code == -11) fdEdxElectronHit->Fill(mergedELoss);
1312 }
1313 else {
1314 if (Pdg_code == 211 || Pdg_code == -211) // pdg code from associated point is used
1315 fdEdxPionHit->Fill(hitELoss);
1316 if (Pdg_code == 11 || Pdg_code == -11) fdEdxElectronHit->Fill(hitELoss);
1317 }
1318 fDistanceMcToHit->Fill(minimumDistance);
1319 if (
1320 xPPadSize
1321 > yPPadSize) { // ok to use here only the pad size of the point because the sapect ration does not change within one module
1322 fPositionResolutionShort->Fill(yDiviation);
1323 fPositionResolutionLong->Fill(xDiviation);
1324 }
1325 else {
1326 fPositionResolutionShort->Fill(xDiviation);
1327 fPositionResolutionLong->Fill(yDiviation);
1328 }
1329 }
1330 }
1331
1332 fMultiHitsVsAlpha->Fill(alpha, 100. * multiHitCounterModule / Float_t(allPoints));
1333 fMultiHitsVsR->Fill(r, 100. * multiHitCounterModule / Float_t(allPoints));
1334 // left over points == lost
1335 fModuleLostMap[moduleAddress]->Fill(100. * Float_t(fModulePointMapIt->second.size()) / Float_t(allPoints));
1336 fLostPointVsR->Fill(r, 100. * Float_t(fModulePointMapIt->second.size()) / Float_t(allPoints));
1337 fLostPointVsAlpha->Fill(alpha, 100. * Float_t(fModulePointMapIt->second.size()) / Float_t(allPoints));
1338 // left over hits == ghosts
1339 fModuleGhostMap[moduleAddress]->Fill(100. * Float_t(fModuleHitMap[fModulePointMapIt->first].size())
1340 / Float_t(allPoints));
1341 fGhostHitVsR->Fill(r, 100. * Float_t(fModuleHitMap[fModulePointMapIt->first].size()) / Float_t(allPoints));
1342 fGhostHitVsAlpha->Fill(alpha,
1343 100. * Float_t(fModuleHitMap[fModulePointMapIt->first].size()) / Float_t(allPoints));
1344 // found point hit pairs / all points == detection efficiency
1345 fModuleEfficiencyMap[moduleAddress]->Fill(100. * (allPoints - Float_t(fModulePointMapIt->second.size()))
1346 / Float_t(allPoints));
1347 fHitToPointEfficiencyVsR->Fill(r, 100. * (allPoints - Float_t(fModulePointMapIt->second.size()))
1348 / Float_t(allPoints));
1349 fHitToPointEfficiencyVsAlpha->Fill(alpha, 100. * (allPoints - Float_t(fModulePointMapIt->second.size()))
1350 / Float_t(allPoints));
1351
1352 fModuleMultiPointMap[moduleAddress]->Fill(100. * (Float_t(multiHitCounterModule)) / Float_t(allPoints));
1353 }
1354 }
1355 for (std::map<Int_t, Int_t>::iterator notMultiPointTRDPointsIt = notMultiPointTRDPoints.begin();
1356 notMultiPointTRDPointsIt != notMultiPointTRDPoints.end(); notMultiPointTRDPointsIt++) {
1357 track = (CbmMCTrack*) (fMCTracks->At(notMultiPointTRDPointsIt->first));
1358 fStsTrdPointsTrackable->Fill(notMultiPointTRDPointsIt->second, track->GetNPoints(ECbmModuleId::kSts));
1359 }
1360 timer.Stop();
1361 Double_t rtime = timer.RealTime();
1362 Double_t ctime = timer.CpuTime();
1363
1364 printf("\n\n******************** Reading Test **********************\n");
1365 printf(" RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime);
1366 printf("*********************************************************\n\n");
1367}
1368void CbmTrdQa::SetTriangularPads(Bool_t triangles) { fTrianglePads = triangles; }
1369
1370
1372{
1374 TFile* oldFile = gFile;
1375 TString origpath = gDirectory->GetPath();
1376 printf("\n%s\n", origpath.Data());
1377
1378 TString newpath = origpath;
1379 newpath.ReplaceAll("eds", "trd_qa");
1380 newpath.ReplaceAll(":/", "");
1381 TFile* tempFile = new TFile(newpath, "recreate");
1382 gDirectory->pwd();
1383
1384 TString title;
1385 title.Form("_TH_%.2EGeV_", fTriggerThreshold);
1386 gDirectory->pwd();
1387 if (!gDirectory->Cd("TrdQa")) gDirectory->mkdir("TrdQa");
1388 gDirectory->Cd("TrdQa");
1389 TCanvas* c = new TCanvas("c", "c", 800, 600);
1390 c->cd();
1391 TLegend* l = new TLegend(0.65, 0.65, 0.85, 0.85);
1392 l->SetTextSize(0.025);
1393 l->SetTextColor(1);
1394 l->SetFillStyle(0);
1395 l->SetLineStyle(0);
1396 l->SetLineColor(0);
1397 fdEdxPionMc->DrawCopy();
1398 l->AddEntry(fdEdxElectronMc, "MC electron", "l");
1399 fdEdxElectronMc->DrawCopy("same");
1400 l->AddEntry(fdEdxElectronHit, "Hit electron", "l");
1401 fdEdxElectronHit->DrawCopy("same");
1402 l->AddEntry(fdEdxPionMc, "MC pion", "l");
1403 fdEdxPionMc->DrawCopy("same");
1404 l->AddEntry(fdEdxPionHit, "Hit pion", "l");
1405 fdEdxPionHit->DrawCopy("same");
1406 l->Draw("same");
1407 c->SaveAs("pics/TrdQadEdx" + title + ".pdf");
1408 c->SaveAs("pics/TrdQadEdx" + title + ".png");
1409 /*
1410 delete l;
1411 TLegend *l = new TLegend(0.65,0.65,0.85,0.85);
1412 l->SetTextSize(0.025);
1413 l->SetTextColor(1);
1414 l->SetFillStyle(0);
1415 l->SetLineStyle(0);
1416 l->SetLineColor(0);
1417 */
1418 l->Clear();
1419 l->AddEntry(fHitToPointEfficiencyVsR, "Hit to point efficiency", "p");
1420 fHitToPointEfficiencyVsR->DrawCopy();
1421 l->AddEntry(fGhostHitVsR, "Ghost hits", "p");
1422 fGhostHitVsR->DrawCopy("same");
1423 l->AddEntry(fLostPointVsR, "Lost points", "p");
1424 fLostPointVsR->DrawCopy("same");
1425 l->AddEntry(fMultiHitsVsR, "Multi points", "p");
1426 fMultiHitsVsR->DrawCopy("same");
1427 l->Draw("same");
1428 c->SaveAs("pics/TrdQaStatisticVsR" + title + ".pdf");
1429 c->SaveAs("pics/TrdQaStatisticVsR" + title + ".png");
1430 fHitToPointEfficiencyVsAlpha->DrawCopy();
1431 fGhostHitVsAlpha->DrawCopy("same");
1432 fLostPointVsAlpha->DrawCopy("same");
1433 fMultiHitsVsAlpha->DrawCopy("same");
1434 l->Draw("same");
1435 c->SaveAs("pics/TrdQaStatisticVsAlpha" + title + ".pdf");
1436 c->SaveAs("pics/TrdQaStatisticVsAlpha" + title + ".png");
1437 gDirectory->pwd();
1438 fdEdxPoint->Write("", TObject::kOverwrite);
1439 fdEdxDigi->Write("", TObject::kOverwrite);
1440 c->cd()->SetLogx(1);
1441 c->cd()->SetLogy(1);
1442 fdEdxDigi->Draw();
1443 c->SaveAs("pics/TrdQadEdxDigi.pdf");
1444 c->SaveAs("pics/TrdQadEdxDigi.png");
1445 fdEdxCluster->Write("", TObject::kOverwrite);
1446 fdEdxCluster->Draw();
1447 c->SaveAs("pics/TrdQadEdxCluster" + title + ".pdf");
1448 c->SaveAs("pics/TrdQadEdxCluster" + title + ".png");
1449 c->cd()->SetLogx(0);
1450 c->cd()->SetLogy(0);
1451 fdEdxHit->Write("", TObject::kOverwrite);
1452 fdEdxPionMc->Write("", TObject::kOverwrite);
1453 fdEdxPionHit->Write("", TObject::kOverwrite);
1454 fdEdxPionGhost->Write("", TObject::kOverwrite);
1455 fdEdxElectronMc->Write("", TObject::kOverwrite);
1456 fdEdxElectronHit->Write("", TObject::kOverwrite);
1457 fdEdxElectronGhost->Write("", TObject::kOverwrite);
1458 fDistanceMcToHit->Write("", TObject::kOverwrite);
1459 fDistanceMcToHitAll->Write("", TObject::kOverwrite);
1460 fMultiHitsVsR->Write("", TObject::kOverwrite);
1461 fGhostHitVsR->Write("", TObject::kOverwrite);
1462 fLostPointVsR->Write("", TObject::kOverwrite);
1463 fHitToPointEfficiencyVsR->Write("", TObject::kOverwrite);
1464 fMultiHitsVsAlpha->Write("", TObject::kOverwrite);
1465 fGhostHitVsAlpha->Write("", TObject::kOverwrite);
1466 fLostPointVsAlpha->Write("", TObject::kOverwrite);
1467 fHitToPointEfficiencyVsAlpha->Write("", TObject::kOverwrite);
1468 fPositionResolutionShort->Write("", TObject::kOverwrite);
1469 fPositionResolutionShort->DrawCopy();
1470 c->SaveAs("pics/TrdQaPositionResolutionShort" + title + ".pdf");
1471 c->SaveAs("pics/TrdQaPositionResolutionShort" + title + ".png");
1472 fPositionResolutionLong->Write("", TObject::kOverwrite);
1473 fPositionResolutionLong->DrawCopy();
1474 c->SaveAs("pics/TrdQaPositionResolutionLong" + title + ".pdf");
1475 c->SaveAs("pics/TrdQaPositionResolutionLong" + title + ".png");
1476 fClusterSize->Write("", TObject::kOverwrite);
1477 fPointsPerDigi->Write("", TObject::kOverwrite);
1478 fDigiPerCluster->Write("", TObject::kOverwrite);
1479 fClusterPerHit->Write("", TObject::kOverwrite);
1480 fPRF_1D->Write("", TObject::kOverwrite);
1481 fPRF_2D->Write("", TObject::kOverwrite);
1482 c->SetLogy(1);
1483 fMultiHitSamePadPerMcTrack->DrawCopy();
1484 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack" + title + ".pdf");
1485 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack" + title + ".png");
1486 fMultiHitSamePadPerMcTrack->Write("", TObject::kOverwrite);
1487 c->SetLogx(1);
1489 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack_angle" + title + ".pdf");
1490 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack_angle" + title + ".png");
1491 fMultiHitSamePadPerMcTrack_angle->Write("", TObject::kOverwrite);
1492 c->SetLogx(0);
1493 c->SetLogy(0);
1494 c->SetLogz(1);
1495 fMultiHitSamePadPerMcTrack_zBirth->DrawCopy("colz");
1496 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack_zBirth" + title + ".pdf");
1497 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack_zBirth" + title + ".png");
1498 fMultiHitSamePadPerMcTrack_zBirth->Write("", TObject::kOverwrite);
1500 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack_motherzBirth" + title + ".pdf");
1501 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack_motherzBirth" + title + ".png");
1502 fMultiHitSamePadPerMcTrack_motherzBirth->Write("", TObject::kOverwrite);
1503 c->SetLogz(0);
1504 fMultiHitSamePadPerMcTrack_PID->DrawCopy("colz");
1505 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack_PID" + title + ".pdf");
1506 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack_PID" + title + ".png");
1507 fMultiHitSamePadPerMcTrack_PID->Write("", TObject::kOverwrite);
1508 fMultiHitSamePadPerMcTrack_motherPID->DrawCopy("colz");
1509 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack_motherPID" + title + ".pdf");
1510 c->SaveAs("pics/TrdQaMultiHitSamePadPerMcTrack_motherPID" + title + ".png");
1511 fMultiHitSamePadPerMcTrack_motherPID->Write("", TObject::kOverwrite);
1512 c->SetLogz(1);
1513 c->SetLogy(1);
1515 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack" + title + ".pdf");
1516 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack" + title + ".png");
1517 fMultiHitAdjacentPadPerMcTrack->Write("", TObject::kOverwrite);
1518 c->SetLogx(1);
1520 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack_angle" + title + ".pdf");
1521 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack_angle" + title + ".png");
1522 fMultiHitAdjacentPadPerMcTrack_angle->Write("", TObject::kOverwrite);
1523 c->SetLogx(0);
1524 c->SetLogy(0);
1525 c->SetLogz(1);
1526 fMultiHitAdjacentPadPerMcTrack_zBirth->DrawCopy("colz");
1527 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack_zBirth" + title + ".pdf");
1528 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack_zBirth" + title + ".png");
1529 fMultiHitAdjacentPadPerMcTrack_zBirth->Write("", TObject::kOverwrite);
1531 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack_motherzBirth" + title + ".pdf");
1532 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack_motherzBirth" + title + ".png");
1533 fMultiHitAdjacentPadPerMcTrack_motherzBirth->Write("", TObject::kOverwrite);
1534 c->SetLogz(0);
1536 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack_motherPID" + title + ".pdf");
1537 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack_motherPID" + title + ".png");
1538 fMultiHitAdjacentPadPerMcTrack_motherPID->Write("", TObject::kOverwrite);
1539 fMultiHitAdjacentPadPerMcTrack_PID->DrawCopy("colz");
1540 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack_PID" + title + ".pdf");
1541 c->SaveAs("pics/TrdQaMultiHitAdjacentPadPerMcTrack_PID" + title + ".png");
1542 fMultiHitAdjacentPadPerMcTrack_PID->Write("", TObject::kOverwrite);
1543 c->SetLogz(1);
1544 printf("------------->>>>>> TRD tracks:%i TRD tracks "
1545 "trackable:%i <<<<<<-------------\n",
1546 (Int_t) fStsTrdPoints->GetEntries(), (Int_t) fStsTrdPointsTrackable->GetEntries());
1547 fStsTrdPoints->Scale(100. / fStsTrdPoints->GetEntries());
1548 fStsTrdPoints->GetZaxis()->SetRangeUser(
1549 0,
1550 100); //100./fStsTrdPoints->GetEntries(),fStsTrdPoints->GetBinContent(fStsTrdPoints->GetMaximumBin()));
1551 fStsTrdPoints->DrawCopy("colz,text");
1552 c->SaveAs("pics/TrdQaStsTrdPoints" + title + ".pdf");
1553 c->SaveAs("pics/TrdQaStsTrdPoints" + title + ".png");
1554 fStsTrdPoints->Write("", TObject::kOverwrite);
1555
1556 fStsMuchPoints->Scale(100. / fStsMuchPoints->GetEntries());
1557 fStsMuchPoints->GetZaxis()->SetRangeUser(
1558 0,
1559 100); //100./fStsMuchPoints->GetEntries(),fStsMuchPoints->GetBinContent(fStsMuchPoints->GetMaximumBin()));
1560 fStsMuchPoints->DrawCopy("colz,text");
1561 c->SaveAs("pics/TrdQaStsMuchPoints" + title + ".pdf");
1562 c->SaveAs("pics/TrdQaStsMuchPoints" + title + ".png");
1563 fStsMuchPoints->Write("", TObject::kOverwrite);
1564
1565 fStsTofPoints->Scale(100. / fStsTofPoints->GetEntries());
1566 fStsTofPoints->GetZaxis()->SetRangeUser(
1567 0,
1568 100); //100./fStsTofPoints->GetEntries(),fStsTofPoints->GetBinContent(fStsTofPoints->GetMaximumBin()));
1569 fStsTofPoints->DrawCopy("colz,text");
1570 c->SaveAs("pics/TrdQaStsTofPoints" + title + ".pdf");
1571 c->SaveAs("pics/TrdQaStsTofPoints" + title + ".png");
1572 fStsTofPoints->Write("", TObject::kOverwrite);
1573 TString name;
1574 for (Int_t iStsPoints = 0; iStsPoints < 11; iStsPoints++) {
1575 name.Form("_%02iStsPoints", iStsPoints);
1576 fMuchTrdPoints[iStsPoints]->Scale(100. / fMuchTrdPoints[iStsPoints]->GetEntries());
1577 fMuchTrdPoints[iStsPoints]->GetZaxis()->SetRangeUser(0, 100); //100./fMuchTrdPoints[iStsPoints]->GetEntries(),
1578 fMuchTrdPoints[iStsPoints]->DrawCopy("colz,text");
1579 c->SaveAs("pics/TrdQaMuchTrdPoints" + name + title + ".pdf");
1580 c->SaveAs("pics/TrdQaMuchTrdPoints" + name + title + ".png");
1581 fMuchTrdPoints[iStsPoints]->Write("", TObject::kOverwrite);
1582
1583 name.Form("_%iStsPoints", iStsPoints);
1584 fMuchTofPoints[iStsPoints]->Scale(100. / fMuchTofPoints[iStsPoints]->GetEntries());
1585 fMuchTofPoints[iStsPoints]->GetZaxis()->SetRangeUser(0, 100); //100./fMuchTofPoints[iStsPoints]->GetEntries(),
1586 fMuchTofPoints[iStsPoints]->DrawCopy("colz,text");
1587 c->SaveAs("pics/TrdQaMuchTofPoints" + name + title + ".pdf");
1588 c->SaveAs("pics/TrdQaMuchTofPoints" + name + title + ".png");
1589 fMuchTofPoints[iStsPoints]->Write("", TObject::kOverwrite);
1590
1591 name.Form("_%iStsPoints", iStsPoints);
1592 fTrdTofPoints[iStsPoints]->Scale(100. / fTrdTofPoints[iStsPoints]->GetEntries());
1593 fTrdTofPoints[iStsPoints]->GetZaxis()->SetRangeUser(0, 100); //100./fTrdTofPoints[iStsPoints]->GetEntries(),
1594 fTrdTofPoints[iStsPoints]->DrawCopy("colz,text");
1595 c->SaveAs("pics/TrdQaTrdTofPoints" + name + title + ".pdf");
1596 c->SaveAs("pics/TrdQaTrdTofPoints" + name + title + ".png");
1597 fTrdTofPoints[iStsPoints]->Write("", TObject::kOverwrite);
1598 }
1599
1600
1601 fStsTrdPointsTrackable->Scale(100. / fStsTrdPointsTrackable->GetEntries());
1602 fStsTrdPointsTrackable->GetZaxis()->SetRangeUser(
1603 100. / fStsTrdPoints->GetEntries(),
1604 fStsTrdPoints->GetBinContent(fStsTrdPoints->GetMaximumBin())); // same scale for both histos
1605 fStsTrdPointsTrackable->DrawCopy("colz,text");
1606 c->SaveAs("pics/TrdQaStsTrdPointsTrackable" + title + ".pdf");
1607 c->SaveAs("pics/TrdQaStsTrdPointsTrackable" + title + ".png");
1608 fStsTrdPointsTrackable->Write("", TObject::kOverwrite);
1609
1610 fTrdPointsPerMcTrack_PID->Write("", TObject::kOverwrite);
1611 fTrdPointsPerMcTrack_PID->DrawCopy("colz");
1612 c->SaveAs("pics/TrdQaPointsPerMcTrack_PID" + title + ".pdf");
1613 c->SaveAs("pics/TrdQaPointsPerMcTrack_PID" + title + ".png");
1614 fTrdPointsPerMcTrack_PT->Write("", TObject::kOverwrite);
1615 fTrdPointsPerMcTrack_PT->DrawCopy("colz");
1616 c->SaveAs("pics/TrdQaPointsPerMcTrack_PT" + title + ".pdf");
1617 c->SaveAs("pics/TrdQaPointsPerMcTrack_PT" + title + ".png");
1618 fTrdPointsPerMcTrack_P->Write("", TObject::kOverwrite);
1619 fTrdPointsPerMcTrack_P->DrawCopy("colz");
1620 c->SaveAs("pics/TrdQaPointsPerMcTrack_P" + title + ".pdf");
1621 c->SaveAs("pics/TrdQaPointsPerMcTrack_P" + title + ".png");
1622 fTrdTrackCrossedRadiator->Scale(100. / fTrdTrackCrossedRadiator->GetEntries());
1623 fTrdTrackCrossedRadiator->Write("", TObject::kOverwrite);
1624 fTrdTrackCrossedRadiator->DrawCopy("colz,text");
1625 c->SaveAs("pics/TrdQaTrackCrossedRadiator" + title + ".pdf");
1626 c->SaveAs("pics/TrdQaTrackCrossedRadiator" + title + ".png");
1627 c->SetLogz(0);
1628 delete l;
1629 gDirectory->Cd("..");
1630 tempFile->Close();
1631
1633 gFile = oldFile;
1634 gDirectory->Cd(origpath);
1635 gDirectory->pwd();
1636}
1638{
1639 if (fT) {
1640 fMCTracks->Clear();
1641 fMCTracks->Delete();
1642 }
1643 if (fP) {
1644 fPoints->Clear();
1645 fPoints->Delete();
1647 fModulePointMapIt->second.clear();
1648 }
1649 fModulePointMap.clear();
1650 }
1651 if (fD) {
1653 fModuleDigiMapIt->second.clear();
1654 }
1655 fModuleDigiMap.clear();
1656 }
1657 if (fC) {
1658 fClusters->Clear();
1659 fClusters->Delete();
1662 fModuleClusterMapIt->second.clear();
1663 }
1664 fModuleClusterMap.clear();
1665 }
1666 if (fH) {
1667 fHits->Clear();
1668 fHits->Delete();
1670 fModuleHitMapIt->second.clear();
1671 }
1672 fModuleHitMap.clear();
1673 }
1674}
1675void CbmTrdQa::GetPadInfos(Int_t moduleAddress, Double_t x, Double_t y, Int_t& iCol, Int_t& iRow, Double_t& padSizeX,
1676 Double_t& padSizeY)
1677{
1678 CbmTrdParModDigi* fModuleInfo = (CbmTrdParModDigi*) fDigiPar->GetModulePar(moduleAddress);
1679 x += fModuleInfo->GetSizeX(); // move origin from module center to lower right corner
1680 y += fModuleInfo->GetSizeY(); // move origin from module center to lower right corner
1681 Int_t nSector = fModuleInfo->GetNofSectors();
1682 Int_t iSectorX(0), iSectorY(0);
1683 Double_t iSectorSizeX = fModuleInfo->GetSectorSizeX(iSectorX);
1684 Double_t iSectorSizeY = fModuleInfo->GetSectorSizeY(iSectorY);
1685 Double_t iPadSizeX = fModuleInfo->GetPadSizeX(iSectorX);
1686 Double_t iPadSizeY = fModuleInfo->GetPadSizeY(iSectorY);
1687 Int_t iPadX = 0;
1688 Int_t iPadY = 0;
1689 if (x > 2 * fModuleInfo->GetSizeX() || y > 2 * fModuleInfo->GetSizeY() || x < 0 || y < 0) {
1690 printf("point out of module::\n module %i (%.2f, %.2f) (%.2f, %.2f)\n", moduleAddress, x, y,
1691 2 * fModuleInfo->GetSizeX(), 2 * fModuleInfo->GetSizeY());
1692 }
1693 else {
1694 while (x > iSectorSizeX && iSectorX < nSector) {
1695 x -= iSectorSizeX;
1696 iPadX += iSectorSizeX / iPadSizeX;
1697 iSectorX++;
1698 iSectorSizeX = fModuleInfo->GetSectorSizeX(iSectorX);
1699 iPadSizeX = fModuleInfo->GetPadSizeX(iSectorX);
1700 }
1701 padSizeX = iPadSizeX;
1702 iPadX += Int_t((x / padSizeX) + 0.5);
1703 iCol = iPadX;
1704 while (y > iSectorSizeY && iSectorY < nSector) {
1705 y -= iSectorSizeY;
1706 iPadY += iSectorSizeY / iPadSizeY;
1707 iSectorY++;
1708 iSectorSizeY = fModuleInfo->GetSectorSizeY(iSectorY);
1709 iPadSizeY = fModuleInfo->GetPadSizeY(iSectorY);
1710 }
1711 padSizeY = iPadSizeY;
1712 iPadY += Int_t((x / padSizeX) + 0.5);
1713 iRow = iPadY;
1714 }
1715}
1716void CbmTrdQa::CreateLayerView(std::map<Int_t, TH1*>& Map, TString folder, TString pics, TString zAxisTitle,
1717 Double_t fmax, Double_t fmin, Bool_t logScale)
1718{
1720 TFile* oldFile = gFile;
1721 TString origpath = gDirectory->GetPath();
1722 printf("\n%s\n", origpath.Data());
1723
1724 TString newpath = origpath;
1725 newpath.ReplaceAll("eds", "trd_qa");
1726 newpath.ReplaceAll(":/", "");
1727 TFile* tempFile = new TFile(newpath, "recreate");
1728 gDirectory->pwd();
1729 TString title(""), name("");
1730 name.Form("_TH_%.2EGeV_", fTriggerThreshold);
1731 TPaveText* text = NULL;
1732 std::map<Int_t, TH1*>::iterator MapIt;
1733 std::vector<Int_t> fColors;
1734 std::vector<Double_t> fZLevel;
1735 //Double_t fmax(20), fmin(0);
1736 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
1737 fColors.push_back(TColor::GetColorPalette(i));
1738 if (logScale)
1739 fZLevel.push_back(fmin + TMath::Power(10,
1740 TMath::Log10(fmax) / TColor::GetNumberOfColors() * i)); // log scale
1741 else
1742 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
1743 }
1744
1745 gDirectory->pwd();
1746 if (!gDirectory->Cd(folder)) gDirectory->mkdir(folder);
1747 gDirectory->Cd(folder);
1748
1749 for (MapIt = Map.begin(); MapIt != Map.end(); MapIt++) {
1750 Double_t value = MapIt->second->GetMean(1);
1751 Double_t valueE = MapIt->second->GetRMS(1);
1752 CbmTrdParModDigi* fModuleInfo = (CbmTrdParModDigi*) fDigiPar->GetModulePar(MapIt->first);
1753 CbmTrdParModGeo* fModuleGeo = (CbmTrdParModGeo*) fGeoPar->GetModulePar(MapIt->first);
1754 Int_t Station = CbmTrdAddress::GetLayerId(MapIt->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
1755 Int_t Layer = CbmTrdAddress::GetLayerId(MapIt->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
1756 Int_t combiId = 10 * Station + Layer;
1757 fLayerMap[combiId]->cd();
1758 if (MapIt == Map.begin()) {
1759 fLayerDummy->SetZTitle(zAxisTitle);
1760 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
1761 }
1762 fLayerMap[combiId]->cd()->Update();
1763 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
1764 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
1765 text->SetFillStyle(1001);
1766 text->SetLineColor(1);
1767
1768 Int_t j = 0;
1769 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
1770 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
1771 j++;
1772 }
1773 text->SetFillColor(fColors[j]);
1774 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
1775
1776 if (fColors[j] < 65) text->SetTextColor(kWhite);
1777 title.Form("%.1f#pm%.1f", value, valueE);
1778 text->AddText(title);
1779 text->Draw("same");
1780 }
1781 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
1782 fLayerMapIt->second->Write("", TObject::kOverwrite);
1783 title.Form("pics/TrdQa%s_S%i_L%i_%s%s.pdf", pics.Data(), fLayerMapIt->first / 10,
1784 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(), name.Data());
1785 fLayerMapIt->second->SaveAs(title);
1786 title.ReplaceAll("pdf", "png");
1787 fLayerMapIt->second->SaveAs(title);
1788 }
1789 for (MapIt = Map.begin(); MapIt != Map.end(); MapIt++) {
1790 MapIt->second->Write("", TObject::kOverwrite);
1791 }
1792 gDirectory->Cd("..");
1793
1794 tempFile->Close();
1795
1797 gFile = oldFile;
1798 gDirectory->Cd(origpath);
1799 gDirectory->pwd();
1800}
1801
1803{
1805 TFile* oldFile = gFile;
1806 TString origpath = gDirectory->GetPath();
1807 printf("\n%s\n", origpath.Data());
1808
1809 TString newpath = origpath;
1810 newpath.ReplaceAll("eds", "trd_qa");
1811 newpath.ReplaceAll(":/", "");
1812 TFile* tempFile = new TFile(newpath, "recreate");
1813 gDirectory->pwd();
1814 TString title(""), name("");
1815 TPaveText* text = NULL;
1816 {
1817 std::vector<Int_t> fColors;
1818 std::vector<Double_t> fZLevel;
1819 Double_t fmax(20), fmin(0);
1820 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
1821 fColors.push_back(TColor::GetColorPalette(i));
1822 //fZLevel.push_back(min + TMath::Power(10, TMath::Log10(max) / TColor::GetNumberOfColors() * i));// log scale
1823 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
1824 }
1825
1826 gDirectory->pwd();
1827 if (!gDirectory->Cd("TrdQa")) gDirectory->mkdir("TrdQa");
1828 gDirectory->Cd("TrdQa");
1829 /*
1830 if (fLayerMap.find(combiId) == fLayerMap.end()){
1831 title.Form("Station%i_Layer%i",Station,Layer);
1832 fLayerMap[combiId] = new TCanvas(title,title,1200,1000);
1833 fLayerDummy->Draw("colz");
1834 }
1835 */
1836 printf("fModuleGhostMap: %i\n", (Int_t) fModuleGhostMap.size());
1838 Double_t value = fModuleGhostMapIt->second->GetMean(1);
1839 Double_t valueE = fModuleGhostMapIt->second->GetRMS(1);
1842 Int_t Station = CbmTrdAddress::GetLayerId(fModuleGhostMapIt->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
1843 Int_t Layer = CbmTrdAddress::GetLayerId(fModuleGhostMapIt->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
1844 Int_t combiId = 10 * Station + Layer;
1845 fLayerMap[combiId]->cd();
1846 if (fModuleGhostMapIt == fModuleGhostMap.begin()) {
1847 //fLayerDummy->SetZTitle("left over hits / all points [%]");
1848 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
1849 //fLayerDummy->DrawCopy("colz");
1850 }
1851 fLayerMap[combiId]->cd()->Update();
1852 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
1853 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
1854 text->SetFillStyle(1001);
1855 text->SetLineColor(1);
1856
1857 Int_t j = 0;
1858 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
1859 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
1860 j++;
1861 }
1862 text->SetFillColor(fColors[j]);
1863 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
1864
1865 if (fColors[j] < 65) text->SetTextColor(kWhite);
1866 title.Form("%.1f#pm%.1f", value, valueE);
1867 text->AddText(title);
1868 text->Draw("same");
1869 }
1870 }
1871 {
1872 std::vector<Int_t> fColors;
1873 std::vector<Double_t> fZLevel;
1874 Double_t fmax(20), fmin(0);
1875 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
1876 fColors.push_back(TColor::GetColorPalette(i));
1877 //fZLevel.push_back(min + TMath::Power(10, TMath::Log10(max) / TColor::GetNumberOfColors() * i));// log scale
1878 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
1879 }
1880 gDirectory->pwd();
1881 if (!gDirectory->Cd("Ghost")) gDirectory->mkdir("Ghost");
1882 gDirectory->Cd("Ghost");
1883 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
1884 fLayerMapIt->second->Write("", TObject::kOverwrite);
1885 title.Form("pics/TrdQaGhost_S%i_L%i_%s%s.pdf", fLayerMapIt->first / 10,
1886 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(),
1887 name.Data()); //(fLayerMapIt->first)/10,(fLayerMapIt->first)-(fLayerMapIt->first)/10*10,fGeo.Data());
1888 fLayerMapIt->second->SaveAs(title);
1889 title.ReplaceAll("pdf", "png");
1890 fLayerMapIt->second->SaveAs(title);
1891 }
1893 fModuleGhostMapIt->second->Write("", TObject::kOverwrite);
1894 }
1895 gDirectory->Cd("..");
1896 printf("fModuleLostMap: %i\n", (Int_t) fModuleLostMap.size());
1898 Double_t value = fModuleLostMapIt->second->GetMean(1);
1899 Double_t valueE = fModuleLostMapIt->second->GetRMS(1);
1902 Int_t Station = CbmTrdAddress::GetLayerId(fModuleLostMapIt->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
1903 Int_t Layer = CbmTrdAddress::GetLayerId(fModuleLostMapIt->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
1904 Int_t combiId = 10 * Station + Layer;
1905 fLayerMap[combiId]->cd();
1906 if (fModuleLostMapIt == fModuleLostMap.begin()) {
1907 //fLayerDummy->SetZTitle("left over points / all points [%]");
1908 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
1909 //fLayerDummy->DrawCopy("colz");
1910 }
1911 fLayerMap[combiId]->cd()->Update();
1912 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
1913 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
1914 text->SetFillStyle(1001);
1915 text->SetLineColor(1);
1916 Int_t j = 0;
1917 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
1918 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
1919 j++;
1920 }
1921 text->SetFillColor(fColors[j]);
1922 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
1923
1924 if (fColors[j] < 65) text->SetTextColor(kWhite);
1925 title.Form("%.1f#pm%.1f", value, valueE);
1926 text->AddText(title);
1927 text->Draw("same");
1928 }
1929 }
1930
1931 {
1932 gDirectory->pwd();
1933 if (!gDirectory->Cd("Lost")) gDirectory->mkdir("Lost");
1934 gDirectory->Cd("Lost");
1935
1936 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
1937 fLayerMapIt->second->Write("", TObject::kOverwrite);
1938 title.Form("pics/TrdQaLost_S%i_L%i_%s%s.pdf", fLayerMapIt->first / 10,
1939 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(),
1940 name.Data()); //(fLayerMapIt->first)/10,(fLayerMapIt->first)-(fLayerMapIt->first)/10*10,fGeo.Data());
1941 fLayerMapIt->second->SaveAs(title);
1942 title.ReplaceAll("pdf", "png");
1943 fLayerMapIt->second->SaveAs(title);
1944 }
1946 fModuleLostMapIt->second->Write("", TObject::kOverwrite);
1947 }
1948 gDirectory->Cd("..");
1949
1950 std::vector<Int_t> fColors;
1951 std::vector<Double_t> fZLevel;
1952 Double_t fmax(100), fmin(0);
1953 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
1954 fColors.push_back(TColor::GetColorPalette(i));
1955 //fZLevel.push_back(min + TMath::Power(10, TMath::Log10(max) / TColor::GetNumberOfColors() * i));// log scale
1956 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
1957 }
1958 printf("fModuleEfficiencyMap: %i\n", (Int_t) fModuleEfficiencyMap.size());
1961 Double_t value = fModuleEfficiencyMapIt->second->GetMean(1);
1962 Double_t valueE = fModuleEfficiencyMapIt->second->GetRMS(1);
1965 Int_t Station =
1966 CbmTrdAddress::GetLayerId(fModuleEfficiencyMapIt->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
1967 Int_t Layer =
1968 CbmTrdAddress::GetLayerId(fModuleEfficiencyMapIt->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
1969 Int_t combiId = 10 * Station + Layer;
1970 fLayerMap[combiId]->cd();
1972 //fLayerDummy->SetZTitle("found point hit pairs / all points [%]");
1973 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
1974 //fLayerDummy->DrawCopy("colz");
1975 }
1976 fLayerMap[combiId]->cd()->Update();
1977 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
1978 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
1979 text->SetFillStyle(1001);
1980 text->SetLineColor(1);
1981 Int_t j = 0;
1982 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
1983 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], value, fZLevel[j]);
1984 j++;
1985 }
1986 //printf (" %2i<%2i %2i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j]-50, value, fZLevel[j]);
1987 text->SetFillColor(fColors[j]);
1988 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
1989
1990 if (fColors[j] < 65) text->SetTextColor(kWhite);
1991
1992 title.Form("%.1f#pm%.1f", value, valueE);
1993 text->AddText(title);
1994 text->Draw("same");
1995 }
1996 }
1997
1998 gDirectory->pwd();
1999 if (!gDirectory->Cd("Efficiency")) gDirectory->mkdir("Efficiency");
2000 gDirectory->Cd("Efficiency");
2001
2002 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
2003 fLayerMapIt->second->Write("", TObject::kOverwrite);
2004 title.Form("pics/TrdQaEfficiency_S%i_L%i_%s%s.pdf", fLayerMapIt->first / 10,
2005 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(),
2006 name.Data()); //(fLayerMapIt->first)/10,(fLayerMapIt->first)-(fLayerMapIt->first)/10*10,fGeo.Data());
2007 fLayerMapIt->second->SaveAs(title);
2008 title.ReplaceAll("pdf", "png");
2009 fLayerMapIt->second->SaveAs(title);
2010 }
2013 fModuleEfficiencyMapIt->second->Write("", TObject::kOverwrite);
2014 }
2015 gDirectory->Cd("..");
2016
2017
2018 {
2019 std::vector<Int_t> fColors;
2020 std::vector<Double_t> fZLevel;
2021 Double_t fmax(20), fmin(0);
2022 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
2023 fColors.push_back(TColor::GetColorPalette(i));
2024 //fZLevel.push_back(min + TMath::Power(10, TMath::Log10(max) / TColor::GetNumberOfColors() * i));// log scale
2025 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
2026 }
2027
2028 printf("fModuleMultiPointMap: %i\n", (Int_t) fModuleMultiPointMap.size());
2031 Double_t value = fModuleMultiPointMapIt->second->GetMean(1);
2032 Double_t valueE = fModuleMultiPointMapIt->second->GetRMS(1);
2035 Int_t Station =
2036 CbmTrdAddress::GetLayerId(fModuleMultiPointMapIt->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
2037 Int_t Layer =
2038 CbmTrdAddress::GetLayerId(fModuleMultiPointMapIt->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
2039 Int_t combiId = 10 * Station + Layer;
2040 fLayerMap[combiId]->cd();
2042 //fLayerDummy->SetZTitle("multi points per channel / all points [%]");
2043 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
2044 //fLayerDummy->DrawCopy("colz");
2045 }
2046 fLayerMap[combiId]->cd()->Update();
2047 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
2048 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
2049 text->SetFillStyle(1001);
2050 text->SetLineColor(1);
2051 Int_t j = 0;
2052 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
2053 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
2054 j++;
2055 }
2056 text->SetFillColor(fColors[j]);
2057 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
2058
2059 if (fColors[j] < 65) text->SetTextColor(kWhite);
2060
2061 title.Form("%.1f#pm%.1f", value, valueE);
2062 text->AddText(title);
2063 text->Draw("same");
2064 }
2065 }
2066
2067 gDirectory->pwd();
2068 if (!gDirectory->Cd("MultiPoint")) gDirectory->mkdir("MultiPoint");
2069 gDirectory->Cd("MultiPoint");
2070
2071 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
2072 fLayerMapIt->second->Write("", TObject::kOverwrite);
2073 title.Form("pics/TrdQaMultiPoint_S%i_L%i_%s%s.pdf", fLayerMapIt->first / 10,
2074 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(),
2075 name.Data()); //(fLayerMapIt->first)/10,(fLayerMapIt->first)-(fLayerMapIt->first)/10*10,fGeo.Data());
2076 fLayerMapIt->second->SaveAs(title);
2077 title.ReplaceAll("pdf", "png");
2078 fLayerMapIt->second->SaveAs(title);
2079 }
2082 fModuleMultiPointMapIt->second->Write("", TObject::kOverwrite);
2083 }
2084 gDirectory->Cd("..");
2085
2086 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2087 {
2088 std::vector<Int_t> fColors;
2089 std::vector<Double_t> fZLevel;
2090 Double_t fmax(10), fmin(0);
2091 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
2092 fColors.push_back(TColor::GetColorPalette(i));
2093 //fZLevel.push_back(min + TMath::Power(10, TMath::Log10(max) / TColor::GetNumberOfColors() * i));// log scale
2094 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
2095 }
2096
2097 printf("fModuledEdxMap: %i\n", (Int_t) fModuledEdxMap.size());
2099 Double_t value = fModuledEdxMapIt->second->GetMean(1);
2100 Double_t valueE = fModuledEdxMapIt->second->GetRMS(1);
2103 Int_t Station = CbmTrdAddress::GetLayerId(fModuledEdxMapIt->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
2104 Int_t Layer = CbmTrdAddress::GetLayerId(fModuledEdxMapIt->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
2105 Int_t combiId = 10 * Station + Layer;
2106 fLayerMap[combiId]->cd();
2107 if (fModuledEdxMapIt == fModuledEdxMap.begin()) {
2108 //fLayerDummy->SetZTitle("dE/dx [keV]");
2109 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
2110 //fLayerDummy->DrawCopy("colz");
2111 }
2112 fLayerMap[combiId]->cd()->Update();
2113 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
2114 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
2115 text->SetFillStyle(1001);
2116 text->SetLineColor(1);
2117 Int_t j = 0;
2118 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
2119 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
2120 j++;
2121 }
2122 text->SetFillColor(fColors[j]);
2123 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
2124
2125 if (fColors[j] < 65) text->SetTextColor(kWhite);
2126
2127 title.Form("%.1f#pm%.1f", value, valueE);
2128 text->AddText(title);
2129 text->Draw("same");
2130 }
2131 }
2132
2133 gDirectory->pwd();
2134 if (!gDirectory->Cd("dEdx")) gDirectory->mkdir("dEdx");
2135 gDirectory->Cd("dEdx");
2136
2137 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
2138 fLayerMapIt->second->Write("", TObject::kOverwrite);
2139 title.Form("pics/TrdQadEdx_S%i_L%i_%s%s.pdf", fLayerMapIt->first / 10,
2140 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(),
2141 name.Data()); //(fLayerMapIt->first)/10,(fLayerMapIt->first)-(fLayerMapIt->first)/10*10,fGeo.Data());
2142 fLayerMapIt->second->SaveAs(title);
2143 title.ReplaceAll("pdf", "png");
2144 fLayerMapIt->second->SaveAs(title);
2145 }
2147 fModuledEdxMapIt->second->Write("", TObject::kOverwrite);
2148 }
2149 gDirectory->Cd("..");
2150
2151 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2152 {
2153 std::vector<Int_t> fColors;
2154 std::vector<Double_t> fZLevel;
2155 Double_t fmax(2), fmin(0);
2156 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
2157 fColors.push_back(TColor::GetColorPalette(i));
2158 //fZLevel.push_back(min + TMath::Power(10, TMath::Log10(max) / TColor::GetNumberOfColors() * i));// log scale
2159 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
2160 }
2161
2162 printf("fModuleTracklengthMap: %i\n", (Int_t) fModuleTracklengthMap.size());
2165 Double_t value = fModuleTracklengthMapIt->second->GetMean(1);
2166 Double_t valueE = fModuleTracklengthMapIt->second->GetRMS(1);
2169 Int_t Station =
2170 CbmTrdAddress::GetLayerId(fModuleTracklengthMapIt->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
2171 Int_t Layer =
2172 CbmTrdAddress::GetLayerId(fModuleTracklengthMapIt->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
2173 Int_t combiId = 10 * Station + Layer;
2174 fLayerMap[combiId]->cd();
2176 //fLayerDummy->SetZTitle("track length [cm]");
2177 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
2178 //fLayerDummy->DrawCopy("colz");
2179 }
2180 fLayerMap[combiId]->cd()->Update();
2181 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
2182 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
2183 text->SetFillStyle(1001);
2184 text->SetLineColor(1);
2185 Int_t j = 0;
2186 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
2187 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
2188 j++;
2189 }
2190 text->SetFillColor(fColors[j]);
2191 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
2192
2193 if (fColors[j] < 65) text->SetTextColor(kWhite);
2194
2195 title.Form("%.1f#pm%.1f", value, valueE);
2196 text->AddText(title);
2197 text->Draw("same");
2198 }
2199 }
2200
2201 gDirectory->pwd();
2202 if (!gDirectory->Cd("Tracklength")) gDirectory->mkdir("Tracklength");
2203 gDirectory->Cd("Tracklength");
2204
2205 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
2206 fLayerMapIt->second->Write("", TObject::kOverwrite);
2207 title.Form("pics/TrdQaTracklength_S%i_L%i_%s%s.pdf", fLayerMapIt->first / 10,
2208 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(),
2209 name.Data()); //(fLayerMapIt->first)/10,(fLayerMapIt->first)-(fLayerMapIt->first)/10*10,fGeo.Data());
2210 fLayerMapIt->second->SaveAs(title);
2211 title.ReplaceAll("pdf", "png");
2212 fLayerMapIt->second->SaveAs(title);
2213 }
2216 fModuleTracklengthMapIt->second->Write("", TObject::kOverwrite);
2217 }
2218 gDirectory->Cd("..");
2219
2220 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2221 {
2222 std::vector<Int_t> fColors;
2223 std::vector<Double_t> fZLevel;
2224 Double_t fmax(1), fmin(0);
2225 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
2226 fColors.push_back(TColor::GetColorPalette(i));
2227 //fZLevel.push_back(min + TMath::Power(10, TMath::Log10(max) / TColor::GetNumberOfColors() * i));// log scale
2228 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
2229 }
2230
2231 printf("fModuleDeltaEMap: %i\n", (Int_t) fModuleDeltaEMap.size());
2234 Double_t value = fModuleDeltaEMapIt->second->GetMean(1);
2235 Double_t valueE = fModuleDeltaEMapIt->second->GetRMS(1);
2238 Int_t Station =
2239 CbmTrdAddress::GetLayerId(fModuleDeltaEMapIt->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
2240 Int_t Layer = CbmTrdAddress::GetLayerId(fModuleDeltaEMapIt->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
2241 Int_t combiId = 10 * Station + Layer;
2242 fLayerMap[combiId]->cd();
2243 if (fModuleDeltaEMapIt == fModuleDeltaEMap.begin()) {
2244 //fLayerDummy->SetZTitle("#delta-electrons / all points [%]");
2245 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
2246 //fLayerDummy->DrawCopy("colz");
2247 }
2248 fLayerMap[combiId]->cd()->Update();
2249 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
2250 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
2251 text->SetFillStyle(1001);
2252 text->SetLineColor(1);
2253 Int_t j = 0;
2254 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
2255 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
2256 j++;
2257 }
2258 text->SetFillColor(fColors[j]);
2259 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
2260
2261 if (fColors[j] < 65) text->SetTextColor(kWhite);
2262
2263 title.Form("%.1f#pm%.1f", value, valueE);
2264 text->AddText(title);
2265 text->Draw("same");
2266 }
2267 }
2268
2269 gDirectory->pwd();
2270 if (!gDirectory->Cd("DeltaE")) gDirectory->mkdir("DeltaE");
2271 gDirectory->Cd("DeltaE");
2272
2273 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
2274 fLayerMapIt->second->Write("", TObject::kOverwrite);
2275 title.Form("pics/TrdQaDeltaE_S%i_L%i_%s%s.pdf", fLayerMapIt->first / 10,
2276 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(),
2277 name.Data()); //(fLayerMapIt->first)/10,(fLayerMapIt->first)-(fLayerMapIt->first)/10*10,fGeo.Data());
2278 fLayerMapIt->second->SaveAs(title);
2279 title.ReplaceAll("pdf", "png");
2280 fLayerMapIt->second->SaveAs(title);
2281 }
2284 fModuleDeltaEMapIt->second->Write("", TObject::kOverwrite);
2285 }
2286 gDirectory->Cd("..");
2287
2288 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2289 {
2290 std::vector<Int_t> fColors;
2291 std::vector<Double_t> fZLevel;
2292 Double_t fmax(15), fmin(0);
2293 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
2294 fColors.push_back(TColor::GetColorPalette(i));
2295 //fZLevel.push_back(min + TMath::Power(10, TMath::Log10(max) / TColor::GetNumberOfColors() * i));// log scale
2296 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
2297 }
2298
2299 printf("fModuleClusterSizeMap: %i\n", (Int_t) fModuleClusterSizeMap.size());
2302 Double_t value = fModuleClusterSizeMapIt->second->GetMean(1);
2303 Double_t valueE = fModuleClusterSizeMapIt->second->GetRMS(1);
2306 Int_t Station =
2307 CbmTrdAddress::GetLayerId(fModuleClusterSizeMapIt->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
2308 Int_t Layer =
2309 CbmTrdAddress::GetLayerId(fModuleClusterSizeMapIt->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
2310 Int_t combiId = 10 * Station + Layer;
2311 fLayerMap[combiId]->cd();
2313 //fLayerDummy->SetZTitle("#delta-electrons / all points [%]");
2314 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
2315 //fLayerDummy->DrawCopy("colz");
2316 }
2317 fLayerMap[combiId]->cd()->Update();
2318 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
2319 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
2320 text->SetFillStyle(1001);
2321 text->SetLineColor(1);
2322 Int_t j = 0;
2323 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
2324 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
2325 j++;
2326 }
2327 text->SetFillColor(fColors[j]);
2328 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
2329
2330 if (fColors[j] < 65) text->SetTextColor(kWhite);
2331
2332 title.Form("%.1f#pm%.1f", value, valueE);
2333 text->AddText(title);
2334 text->Draw("same");
2335 //printf("ModuleAddress:%8i cluster size: %5.2f+-%5.2f\n",fModuleClusterSizeMapIt->first,value,valueE);
2336 }
2337 }
2338
2339 gDirectory->pwd();
2340 if (!gDirectory->Cd("ClusterSize")) gDirectory->mkdir("ClusterSize");
2341 gDirectory->Cd("ClusterSize");
2342
2343 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
2344 fLayerMapIt->second->Write("", TObject::kOverwrite);
2345 title.Form("pics/TrdQaClusterSize_S%i_L%i_%s%s.pdf", fLayerMapIt->first / 10,
2346 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(),
2347 name.Data()); //(fLayerMapIt->first)/10,(fLayerMapIt->first)-(fLayerMapIt->first)/10*10,fGeo.Data());
2348 fLayerMapIt->second->SaveAs(title);
2349 title.ReplaceAll("pdf", "png");
2350 fLayerMapIt->second->SaveAs(title);
2351 }
2354 fModuleClusterSizeMapIt->second->Write("", TObject::kOverwrite);
2355 }
2356 gDirectory->Cd("..");
2357
2358 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2359 {
2360 std::vector<Int_t> fColors;
2361 std::vector<Double_t> fZLevel;
2362 Double_t fmax(100), fmin(0);
2363 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
2364 fColors.push_back(TColor::GetColorPalette(i));
2365 //fZLevel.push_back(min + TMath::Power(10, TMath::Log10(max) / TColor::GetNumberOfColors() * i));// log scale
2366 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
2367 }
2368
2369 printf("fModuleTrackableMap: %i\n", (Int_t) fModuleTrackableMap.size());
2372 Double_t value = fModuleTrackableMapIt->second->GetMean(1);
2373 Double_t valueE = fModuleTrackableMapIt->second->GetRMS(1);
2376 Int_t Station =
2377 CbmTrdAddress::GetLayerId(fModuleTrackableMapIt->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
2378 Int_t Layer = CbmTrdAddress::GetLayerId(fModuleTrackableMapIt->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
2379 Int_t combiId = 10 * Station + Layer;
2380 fLayerMap[combiId]->cd();
2382 //fLayerDummy->SetZTitle("#delta-electrons / all points [%]");
2383 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
2384 //fLayerDummy->DrawCopy("colz");
2385 }
2386 fLayerMap[combiId]->cd()->Update();
2387 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
2388 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
2389 text->SetFillStyle(1001);
2390 text->SetLineColor(1);
2391 Int_t j = 0;
2392 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
2393 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
2394 j++;
2395 }
2396 text->SetFillColor(fColors[j]);
2397 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
2398
2399 if (fColors[j] < 65) text->SetTextColor(kWhite);
2400
2401 title.Form("%.1f#pm%.1f", value, valueE);
2402 text->AddText(title);
2403 text->Draw("same");
2404 }
2405 }
2406
2407 gDirectory->pwd();
2408 if (!gDirectory->Cd("TrackableRatio")) gDirectory->mkdir("TrackableRatio");
2409 gDirectory->Cd("TrackableRatio");
2410
2411 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
2412 fLayerMapIt->second->Write("", TObject::kOverwrite);
2413 title.Form("pics/TrdQaTrackableRatio_S%i_L%i_%s%s.pdf", fLayerMapIt->first / 10,
2414 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(),
2415 name.Data()); //(fLayerMapIt->first)/10,(fLayerMapIt->first)-(fLayerMapIt->first)/10*10,fGeo.Data());
2416 fLayerMapIt->second->SaveAs(title);
2417 title.ReplaceAll("pdf", "png");
2418 fLayerMapIt->second->SaveAs(title);
2419 }
2422 fModuleTrackableMapIt->second->Write("", TObject::kOverwrite);
2423 }
2424 gDirectory->Cd("..");
2425
2426 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2427 {
2428 std::vector<Int_t> fColors;
2429 std::vector<Double_t> fZLevel;
2430 Double_t fmax(50), fmin(0);
2431 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
2432 fColors.push_back(TColor::GetColorPalette(i));
2433 //fZLevel.push_back(min + TMath::Power(10, TMath::Log10(max) / TColor::GetNumberOfColors() * i));// log scale
2434 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
2435 }
2436
2437 printf("fModuleTrackableMap2: %i\n", (Int_t) fModuleTrackableMap2.size());
2440 Double_t value = fModuleTrackableMap2It->second->GetMean(1);
2441 Double_t valueE = fModuleTrackableMap2It->second->GetRMS(1);
2444 Int_t Station =
2445 CbmTrdAddress::GetLayerId(fModuleTrackableMap2It->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
2446 Int_t Layer =
2447 CbmTrdAddress::GetLayerId(fModuleTrackableMap2It->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
2448 Int_t combiId = 10 * Station + Layer;
2449 fLayerMap[combiId]->cd();
2451 //fLayerDummy->SetZTitle("#delta-electrons / all points [%]");
2452 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
2453 //fLayerDummy->DrawCopy("colz");
2454 }
2455 fLayerMap[combiId]->cd()->Update();
2456 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
2457 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
2458 text->SetFillStyle(1001);
2459 text->SetLineColor(1);
2460 Int_t j = 0;
2461 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
2462 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
2463 j++;
2464 }
2465 text->SetFillColor(fColors[j]);
2466 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
2467
2468 if (fColors[j] < 65) text->SetTextColor(kWhite);
2469
2470 title.Form("%.1f#pm%.1f", value, valueE);
2471 text->AddText(title);
2472 text->Draw("same");
2473 }
2474 }
2475
2476 gDirectory->pwd();
2477 if (!gDirectory->Cd("Trackable")) gDirectory->mkdir("Trackable");
2478 gDirectory->Cd("Trackable");
2479
2480 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
2481 fLayerMapIt->second->Write("", TObject::kOverwrite);
2482 title.Form("pics/TrdQaTrackable_S%i_L%i_%s%s.pdf", fLayerMapIt->first / 10,
2483 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(),
2484 name.Data()); //(fLayerMapIt->first)/10,(fLayerMapIt->first)-(fLayerMapIt->first)/10*10,fGeo.Data());
2485 fLayerMapIt->second->SaveAs(title);
2486 title.ReplaceAll("pdf", "png");
2487 fLayerMapIt->second->SaveAs(title);
2488 }
2491 fModuleTrackableMap2It->second->Write("", TObject::kOverwrite);
2492 }
2493 gDirectory->Cd("..");
2494 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2495 {
2496 std::vector<Int_t> fColors;
2497 std::vector<Double_t> fZLevel;
2498 Double_t fmax(100), fmin(0);
2499 for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
2500 fColors.push_back(TColor::GetColorPalette(i));
2501 //fZLevel.push_back(min + TMath::Power(10, TMath::Log10(max) / TColor::GetNumberOfColors() * i));// log scale
2502 fZLevel.push_back(fmin + (fmax / TColor::GetNumberOfColors() * i)); // lin scale
2503 }
2504
2505 printf("fModuleAveragePointsMap: %i\n", (Int_t) fModuleAveragePointsMap.size());
2508 Double_t value = fModuleAveragePointsMapIt->second->GetMean(1);
2509 Double_t valueE = fModuleAveragePointsMapIt->second->GetRMS(1);
2512 Int_t Station =
2513 CbmTrdAddress::GetLayerId(fModuleAveragePointsMapIt->first) / 4 + 1; //fGeoHandler->GetStation(moduleId);
2514 Int_t Layer =
2515 CbmTrdAddress::GetLayerId(fModuleAveragePointsMapIt->first) % 4 + 1; //fGeoHandler->GetLayer(moduleId);
2516 Int_t combiId = 10 * Station + Layer;
2517 fLayerMap[combiId]->cd();
2519 //fLayerDummy->SetZTitle("#delta-electrons / all points [%]");
2520 fLayerDummy->GetZaxis()->SetRangeUser(fmin, fmax);
2521 //fLayerDummy->DrawCopy("colz");
2522 }
2523 fLayerMap[combiId]->cd()->Update();
2524 text = new TPaveText(fModuleGeo->GetX() - fModuleInfo->GetSizeX(), fModuleGeo->GetY() - fModuleInfo->GetSizeY(),
2525 fModuleGeo->GetX() + fModuleInfo->GetSizeX(), fModuleGeo->GetY() + fModuleInfo->GetSizeY());
2526 text->SetFillStyle(1001);
2527 text->SetLineColor(1);
2528 Int_t j = 0;
2529 while ((value > fZLevel[j]) && (j < (Int_t) fZLevel.size())) {
2530 //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
2531 j++;
2532 }
2533 text->SetFillColor(fColors[j]);
2534 if (j >= (Int_t) fZLevel.size()) text->SetFillColor(2);
2535
2536 if (fColors[j] < 65) text->SetTextColor(kWhite);
2537
2538 title.Form("%.1f#pm%.1f", value, valueE);
2539 text->AddText(title);
2540 text->Draw("same");
2541 }
2542 }
2543
2544 gDirectory->pwd();
2545 if (!gDirectory->Cd("Trackable")) gDirectory->mkdir("Trackable");
2546 gDirectory->Cd("Trackable");
2547
2548 for (fLayerMapIt = fLayerMap.begin(); fLayerMapIt != fLayerMap.end(); fLayerMapIt++) {
2549 fLayerMapIt->second->Write("", TObject::kOverwrite);
2550 title.Form("pics/TrdQaAveragePoints_S%i_L%i_%s%s.pdf", fLayerMapIt->first / 10,
2551 fLayerMapIt->first - (fLayerMapIt->first / 10) * 10, fGeo.Data(),
2552 name.Data()); //(fLayerMapIt->first)/10,(fLayerMapIt->first)-(fLayerMapIt->first)/10*10,fGeo.Data());
2553 fLayerMapIt->second->SaveAs(title);
2554 title.ReplaceAll("pdf", "png");
2555 fLayerMapIt->second->SaveAs(title);
2556 }
2559 fModuleAveragePointsMapIt->second->Write("", TObject::kOverwrite);
2560 }
2561 gDirectory->Cd("..");
2562 gDirectory->Cd("..");
2563
2564 tempFile->Close();
2565
2567 gFile = oldFile;
2568 gDirectory->Cd(origpath);
2569 gDirectory->pwd();
2570}
2571Double_t CbmTrdQa::CalcAngle(const CbmTrdPoint* pointA, const CbmTrdPoint* pointB)
2572{
2573 return TMath::ACos(((pointA->GetXOut() - pointA->GetXIn()) * (pointB->GetXOut() - pointB->GetXIn())
2574 + (pointA->GetYOut() - pointA->GetYIn()) * (pointB->GetYOut() - pointB->GetYIn())
2575 + (pointA->GetZOut() - pointA->GetZIn()) * (pointB->GetZOut() - pointB->GetZIn()))
2576 / (TMath::Sqrt((pointA->GetXOut() - pointA->GetXIn()) * (pointA->GetXOut() - pointA->GetXIn())
2577 + (pointA->GetYOut() - pointA->GetYIn()) * (pointA->GetYOut() - pointA->GetYIn())
2578 + (pointA->GetZOut() - pointA->GetZIn()) * (pointA->GetZOut() - pointA->GetZIn()))
2579 * TMath::Sqrt((pointB->GetXOut() - pointB->GetXIn()) * (pointB->GetXOut() - pointB->GetXIn())
2580 + (pointB->GetYOut() - pointB->GetYIn()) * (pointB->GetYOut() - pointB->GetYIn())
2581 + (pointB->GetZOut() - pointB->GetZIn()) * (pointB->GetZOut() - pointB->GetZIn()))
2582
2583 ));
2584}
2586{
2587 Double_t Entries = fdEdxPoint->GetEntries();
2588 fdEdxPoint->Scale(1. / Entries);
2589 Entries = fdEdxDigi->GetEntries();
2590 fdEdxDigi->Scale(1. / Entries);
2591 Entries = fdEdxCluster->GetEntries();
2592 fdEdxCluster->Scale(1. / Entries);
2593 Entries = fdEdxHit->GetEntries();
2594 fdEdxHit->Scale(1. / Entries);
2595 Entries = fdEdxPionMc->GetEntries();
2596 fdEdxPionMc->Scale(1. / Entries);
2597 Entries = fdEdxPionHit->GetEntries();
2598 fdEdxPionHit->Scale(1. / Entries);
2599 Entries = fdEdxElectronMc->GetEntries();
2600 fdEdxElectronMc->Scale(1. / Entries);
2601 Entries = fdEdxElectronHit->GetEntries();
2602 fdEdxElectronHit->Scale(1. / Entries);
2603}
2605{
2607 SaveHistos();
2609}
2611{
2612 //FairRootManager::Instance()->Register("TrdDigi","Trd Digi", fDigiCollection, IsOutputBranchPersistent("TrdDigi"));
2613 //FairRootManager::Instance()->Register("TrdDigiMatch","Trd Digi Match", fDigiMatchCollection, IsOutputBranchPersistent("TrdDigiMatch"));
2614}
ClassImp(CbmConverterManager)
@ kTrd
Transition Radiation Detector.
@ kTof
Time-of-flight Detector.
@ kSts
Silicon Tracking System.
@ kMuch
Muon detection system.
Data Container for TRD clusters.
Helper class to extract information from the GeoManager.
Class for hits in TRD detector.
friend fvec sqrt(const fvec &a)
static constexpr size_t size()
Definition KfSimdPseudo.h:2
int32_t GetDigi(int32_t index) const
Get digi at position index.
Definition CbmCluster.h:76
int32_t GetNofDigis() const
Number of digis in cluster.
Definition CbmCluster.h:69
static Int_t GetNofDigis(ECbmModuleId systemId)
InitStatus Init()
Initialisation.
const Digi * Get(Int_t index) const
Get a digi object.
static CbmDigiManager * Instance()
Static instance.
int32_t GetAddress() const
Definition CbmHit.h:74
double GetZ() const
Definition CbmHit.h:71
double GetPt() const
Definition CbmMCTrack.h:97
double GetP() const
Definition CbmMCTrack.h:98
double GetStartZ() const
Definition CbmMCTrack.h:75
int32_t GetMotherId() const
Definition CbmMCTrack.h:69
int32_t GetPdgCode() const
Definition CbmMCTrack.h:68
int32_t GetNPoints(ECbmModuleId detId) const
double GetY() const
Definition CbmPixelHit.h:74
double GetX() const
Definition CbmPixelHit.h:73
static uint32_t GetModuleId(uint32_t address)
Return module ID from address.
static uint32_t GetLayerId(uint32_t address)
Return layer ID from address.
static uint32_t GetModuleAddress(uint32_t address)
Return unique module ID from address.
static uint32_t GetAddress(int32_t layerId, int32_t moduleId, int32_t sectorId, int32_t rowId, int32_t columnId)
Return address from system ID, layer, module, sector, column and row IDs.
Data Container for TRD clusters.
int32_t GetAddress() const
Address getter for module in the format defined by CbmTrdDigi (format of CbmTrdAddress can be accesse...
Definition CbmTrdDigi.h:112
double GetCharge() const
Common purpose charge getter.
void Init(Bool_t isSimulation=kFALSE)
data class for a reconstructed Energy-4D measurement in the TRD
Definition CbmTrdHit.h:40
double GetELoss() const
Definition CbmTrdHit.h:79
Definition of chamber gain conversion for one TRD module.
Double_t GetSectorSizeX(Int_t i) const
Bool_t GetPadInfo(const Double_t *local_point, Int_t &sectorId, Int_t &columnId, Int_t &rowId) const
Int_t GetNofSectors() const
Double_t GetSizeY() const
Double_t GetPadSizeY(Int_t i) const
Double_t GetSectorSizeY(Int_t i) const
Int_t GetNofRowsInSector(Int_t i) const
Double_t GetPadSizeX(Int_t i) const
Double_t GetSizeX() const
Int_t GetModuleRow(Int_t &sectorId, Int_t &rowId) const
Definition of geometry for one TRD module.
virtual Double_t GetZ() const
virtual Double_t GetY() const
virtual Double_t GetX() const
virtual void clear()
Reset all parameters.
virtual const CbmTrdParMod * GetModulePar(Int_t detId) const
double GetYOut() const
Definition CbmTrdPoint.h:69
double GetXIn() const
Definition CbmTrdPoint.h:65
double GetZIn() const
Definition CbmTrdPoint.h:67
double GetXOut() const
Definition CbmTrdPoint.h:68
double GetYIn() const
Definition CbmTrdPoint.h:66
double GetZOut() const
Definition CbmTrdPoint.h:70
TH1I * fDistanceMcToHit
Definition CbmTrdQa.h:153
Bool_t fC
Definition CbmTrdQa.h:119
std::map< Int_t, TH1I * > fModuleEfficiencyMap
Definition CbmTrdQa.h:108
TH2I * fMultiHitAdjacentPadPerMcTrack_motherzBirth
Definition CbmTrdQa.h:150
void SetTriggerThreshold(Double_t triggerthreshold)
Definition CbmTrdQa.cxx:718
CbmTrdParSetGeo * fGeoPar
Definition CbmTrdQa.h:69
TH2I * fMultiHitAdjacentPadPerMcTrack_zBirth
Definition CbmTrdQa.h:148
virtual ~CbmTrdQa()
Definition CbmTrdQa.cxx:170
std::map< Int_t, TH1I * > fModuleTracklengthMap
Definition CbmTrdQa.h:98
std::map< Int_t, TCanvas * >::iterator fLayerMapIt
Definition CbmTrdQa.h:72
TH1I * fMultiHitAdjacentPadPerMcTrack_angle
Definition CbmTrdQa.h:147
std::map< Int_t, TH1I * >::iterator fModuleDeltaEMapIt
Definition CbmTrdQa.h:103
std::map< Int_t, TH2I * >::iterator fLayerHitMapIt
Definition CbmTrdQa.h:76
std::map< Int_t, TH1I * >::iterator fModuleAveragePointsMapIt
Definition CbmTrdQa.h:89
std::map< Int_t, TH1I * >::iterator fModuleLostMapIt
Definition CbmTrdQa.h:107
void SaveHistos()
TH2F * fTrdPointsPerMcTrack_PID
Definition CbmTrdQa.h:133
TProfile * fPRF_1D
Definition CbmTrdQa.h:186
TH1I * fMultiHitSamePadPerMcTrack
Definition CbmTrdQa.h:139
std::map< Int_t, std::vector< Int_t > >::iterator fModulePointMapIt
Definition CbmTrdQa.h:79
std::map< Int_t, TH1I * > fModuleGhostMap
Definition CbmTrdQa.h:104
TH1I * fClusterPerHit
Definition CbmTrdQa.h:174
TProfile * fHitToPointEfficiencyVsR
Definition CbmTrdQa.h:181
std::map< Int_t, TH2I * > fLayerPointMap
Definition CbmTrdQa.h:73
Double_t GetTrackLength(CbmTrdPoint *point)
Definition CbmTrdQa.cxx:711
TProfile * fGhostHitVsR
Definition CbmTrdQa.h:179
TH2I * fMultiHitSamePadPerMcTrack_PID
Definition CbmTrdQa.h:142
TH2F * fMuchTrdPoints[11]
Definition CbmTrdQa.h:128
std::map< Int_t, std::vector< Int_t > >::iterator fModuleDigiMapIt
Definition CbmTrdQa.h:81
TH1I * fClusterSize
Definition CbmTrdQa.h:171
TH1F * fdEdxHit
Definition CbmTrdQa.h:162
TClonesArray * fMCTracks
Definition CbmTrdQa.h:63
Double_t fTriggerThreshold
Definition CbmTrdQa.h:111
TH1I * fDigiPerCluster
Definition CbmTrdQa.h:173
Bool_t fP
Definition CbmTrdQa.h:118
CbmTrdGeoHandler * fGeoHandler
Definition CbmTrdQa.h:70
void Register()
std::map< Int_t, TH1I * >::iterator fModuledEdxMapIt
Definition CbmTrdQa.h:97
TH2F * fStsTrdPoints
Definition CbmTrdQa.h:125
TH1F * fdEdxElectronMc
Definition CbmTrdQa.h:167
virtual void FinishTask()
void NormalizeHistos()
TH2I * fMultiHitSamePadPerMcTrack_motherzBirth
Definition CbmTrdQa.h:144
TClonesArray * fPoints
Definition CbmTrdQa.h:64
std::map< Int_t, TH1I * >::iterator fModuleGhostMapIt
Definition CbmTrdQa.h:105
TProfile * fLostPointVsAlpha
Definition CbmTrdQa.h:184
TProfile * fMultiHitsVsR
Definition CbmTrdQa.h:178
TH1F * fdEdxPoint
Definition CbmTrdQa.h:159
std::map< Int_t, TH1I * > fModuleAveragePointsMap
Definition CbmTrdQa.h:88
TH1I * fPointsPerDigi
Definition CbmTrdQa.h:172
void GetPadInfos(Int_t moduleAddress, Double_t x, Double_t y, Int_t &iCol, Int_t &iRow, Double_t &padSizeX, Double_t &padSizeY)
void CreateLayerView()
std::map< Int_t, TH1I * > fModuleLostMap
Definition CbmTrdQa.h:106
TH1I * fMultiHitSamePadPerMcTrack_angle
Definition CbmTrdQa.h:140
TH1F * fdEdxPionMc
Definition CbmTrdQa.h:164
TClonesArray * fClusters
Definition CbmTrdQa.h:66
TH1F * fdEdxDigi
Definition CbmTrdQa.h:160
Bool_t fT
Definition CbmTrdQa.h:117
TH2F * fTrdPointsPerMcTrack_P
Definition CbmTrdQa.h:135
virtual void FinishEvent()
std::map< Int_t, TCanvas * > fLayerMap
Definition CbmTrdQa.h:71
TH2F * fTrdTofPoints[11]
Definition CbmTrdQa.h:130
std::map< Int_t, TH1I * > fModuleDeltaEMap
Definition CbmTrdQa.h:102
std::map< Int_t, TH1I * >::iterator fModuleTrackableMapIt
Definition CbmTrdQa.h:93
std::map< Int_t, TH1I * >::iterator fModuleMultiPointMapIt
Definition CbmTrdQa.h:101
std::map< Int_t, TH1I * > fModuleTrackableMap
Definition CbmTrdQa.h:92
CbmTrdParSetDigi * fDigiPar
Definition CbmTrdQa.h:68
std::map< Int_t, std::vector< Int_t > > fModuleClusterMap
Definition CbmTrdQa.h:82
TProfile * fHitToPointEfficiencyVsAlpha
Definition CbmTrdQa.h:185
TH2I * fMultiHitAdjacentPadPerMcTrack_motherPID
Definition CbmTrdQa.h:151
std::shared_ptr< CbmTrdRadiator > fRadiator
Definition CbmTrdQa.h:190
Double_t CalcAngle(const CbmTrdPoint *pointA, const CbmTrdPoint *pointB)
std::map< Int_t, TH2I * >::iterator fLayerPointMapIt
Definition CbmTrdQa.h:74
std::map< Int_t, std::vector< Int_t > > fModulePointMap
Definition CbmTrdQa.h:78
CbmTrdQa(std::shared_ptr< CbmTrdRadiator > radiator=nullptr)
Definition CbmTrdQa.cxx:59
Bool_t fTrianglePads
Definition CbmTrdQa.h:122
TH1F * fdEdxElectronHit
Definition CbmTrdQa.h:168
virtual InitStatus ReInit()
Definition CbmTrdQa.cxx:326
std::map< Int_t, TH1I * >::iterator fModuleTracklengthMapIt
Definition CbmTrdQa.h:99
std::map< Int_t, TH1I * >::iterator fModuleEfficiencyMapIt
Definition CbmTrdQa.h:109
std::map< Int_t, TH1I * >::iterator fModuleClusterSizeMapIt
Definition CbmTrdQa.h:95
TH2F * fTrdPointsPerMcTrack_PT
Definition CbmTrdQa.h:134
std::map< Int_t, TH1I * > fModuleClusterSizeMap
Definition CbmTrdQa.h:94
TH1F * fdEdxCluster
Definition CbmTrdQa.h:161
TH1F * fdEdxPionGhost
Definition CbmTrdQa.h:166
TString fGeo
Definition CbmTrdQa.h:112
Bool_t fD
Definition CbmTrdQa.h:116
TH2F * fStsMuchPoints
Definition CbmTrdQa.h:126
TH2F * fStsTofPoints
Definition CbmTrdQa.h:127
virtual void Exec(Option_t *option)
Definition CbmTrdQa.cxx:734
TH2F * fStsTrdPointsTrackable
Definition CbmTrdQa.h:132
TH2I * fPRF_2D
Definition CbmTrdQa.h:187
TProfile * fLostPointVsR
Definition CbmTrdQa.h:180
std::map< Int_t, std::vector< Int_t > > fModuleHitMap
Definition CbmTrdQa.h:84
TH1I * fDistanceMcToHitAll
Definition CbmTrdQa.h:154
std::map< Int_t, TH1I * > fModuleTrackableMap2
Definition CbmTrdQa.h:90
TH2F * fTrdTrackCrossedRadiator
Definition CbmTrdQa.h:137
TH2I * fMultiHitSamePadPerMcTrack_zBirth
Definition CbmTrdQa.h:141
std::map< Int_t, TH1I * > fModuledEdxMap
Definition CbmTrdQa.h:96
TProfile * fMultiHitsVsAlpha
Definition CbmTrdQa.h:182
TPolyLine * CreateTriangularPad(Int_t column, Int_t row, Double_t content)
Definition CbmTrdQa.cxx:720
TClonesArray * fHits
Definition CbmTrdQa.h:67
std::map< Int_t, std::vector< Int_t > >::iterator fModuleClusterMapIt
Definition CbmTrdQa.h:83
TH2F * fMuchTofPoints[11]
Definition CbmTrdQa.h:129
TH1F * fdEdxPionHit
Definition CbmTrdQa.h:165
TH1I * fPositionResolutionShort
Definition CbmTrdQa.h:156
virtual InitStatus Init()
Definition CbmTrdQa.cxx:335
Bool_t fH
Definition CbmTrdQa.h:120
TH1I * fMultiHitAdjacentPadPerMcTrack
Definition CbmTrdQa.h:146
TH2I * fLayerDummy
Definition CbmTrdQa.h:124
TH1I * fPositionResolutionLong
Definition CbmTrdQa.h:157
TH2I * fMultiHitAdjacentPadPerMcTrack_PID
Definition CbmTrdQa.h:149
std::map< Int_t, TH2I * > fLayerHitMap
Definition CbmTrdQa.h:75
TH2I * fMultiHitSamePadPerMcTrack_motherPID
Definition CbmTrdQa.h:143
std::map< Int_t, TH1I * > fModuleMultiPointMap
Definition CbmTrdQa.h:100
std::map< Int_t, TH1I * >::iterator fModuleTrackableMap2It
Definition CbmTrdQa.h:91
TH1F * fdEdxElectronGhost
Definition CbmTrdQa.h:169
virtual void SetParContainers()
Definition CbmTrdQa.cxx:317
std::map< Int_t, std::vector< Int_t > >::iterator fModuleHitMapIt
Definition CbmTrdQa.h:85
std::map< Int_t, std::vector< Int_t > > fModuleDigiMap
Definition CbmTrdQa.h:80
void SetTriangularPads(Bool_t triangles)
TProfile * fGhostHitVsAlpha
Definition CbmTrdQa.h:183
static Int_t PdgToGeant(Int_t PdgCode)
static TString GetGeantName(Int_t GeantId)
Definition CbmTrdUtils.h:43
Hash for CbmL1LinkKey.