CbmRoot
Loading...
Searching...
No Matches
CbmLitClusteringQa.cxx
Go to the documentation of this file.
1/* Copyright (C) 2011-2021 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Andrey Lebedev [committer], Florian Uhlig */
4
12#include "CbmLitClusteringQa.h"
13
14#include "CbmCluster.h"
15#include "CbmDigiManager.h"
16#include "CbmHistManager.h"
17#include "CbmHit.h"
19#include "CbmMCDataArray.h"
20#include "CbmMCDataManager.h"
21#include "CbmMCTrack.h"
22#include "CbmMatch.h"
23#include "CbmMuchCluster.h"
24#include "CbmMuchDigi.h"
25#include "CbmMuchDigiMatch.h"
26#include "CbmMuchGeoScheme.h"
27#include "CbmMuchLayer.h"
28#include "CbmMuchLayerSide.h"
29#include "CbmMuchModule.h"
30#include "CbmMuchModuleGem.h"
32#include "CbmMuchPad.h"
33#include "CbmMuchPadRadial.h"
34#include "CbmMuchPixelHit.h"
35#include "CbmMuchPoint.h"
36#include "CbmMuchSector.h"
37#include "CbmMuchSectorRadial.h"
38#include "CbmMuchStation.h"
39#include "CbmStsAddress.h"
40#include "CbmStsDigi.h"
41#include "CbmStsSetup.h"
42#include "CbmTrdAddress.h"
43#include "CbmTrdDigi.h"
44#include "FairRootManager.h"
45#include "TClonesArray.h"
46#include "TF1.h"
47#include "TH1.h"
48#include "TH1D.h"
49#include "TH2.h"
50#include "TProfile.h"
51#include "TProfile2D.h"
52#include "TSystem.h"
53
54#include <TFile.h>
55
56#include <boost/assign/list_of.hpp>
57
58#include <cmath>
59#include <fstream>
60#include <set>
61#include <sstream>
62#include <utility>
63
64using boost::assign::list_of;
65using std::binary_search;
66using std::cout;
67using std::make_pair;
68using std::map;
69using std::pair;
70using std::set;
71using std::vector;
72
73CbmLitClusteringQa::CbmLitClusteringQa() : FairTask("LitClusteringQa") {}
74
79
81{
82 // Create histogram manager which is used throughout the program
83 fHM = new CbmHistManager();
84
87
88 // --- Get STS setup
90
91 if (!stsSetup->IsInit()) stsSetup->Init();
92
94
96
97 return kSUCCESS;
98}
99
101{
102 fHM->H1("hen_EventNo_ClusteringQa")->Fill(0.5);
103 Int_t eventNum = fHM->H1("hen_EventNo_ClusteringQa")->GetEntries() - 1;
104 std::cout << "CbmLitClusteringQa::Exec: event=" << eventNum << std::endl;
105
107
111
115
119
123
127
131}
132
134{
135 TDirectory* oldir = gDirectory;
136 TFile* outFile = FairRootManager::Instance()->GetOutFile();
137 if (outFile != NULL) {
138 outFile->cd();
139 fHM->WriteToFile();
140 }
141 gDirectory->cd(oldir->GetPath());
142
144 report->Create(fHM, fOutputDir);
145 delete report;
146}
147
148void CbmLitClusteringQa::InitMuchGeoScheme(const string& digiFileName)
149{
152 TFile* oldFile = gFile;
153 TDirectory* oldDir = gDirectory;
154
155 TFile* file = new TFile(digiFileName.c_str());
156 LOG_IF(fatal, !file) << "Could not open file " << digiFileName;
157 TObjArray* stations = file->Get<TObjArray>("stations");
158 LOG_IF(fatal, !stations) << "TObjArray stations could not be read from file " << digiFileName;
159 file->Close();
160 file->Delete();
161
163 gFile = oldFile;
164 gDirectory = oldDir;
165 CbmMuchGeoScheme::Instance()->Init(stations, 0);
166 }
167}
168
170{
171 FairRootManager* ioman = FairRootManager::Instance();
172 assert(ioman != NULL);
173
174 CbmMCDataManager* mcManager = (CbmMCDataManager*) ioman->GetObject("MCDataManager");
175
176 if (0 == mcManager) LOG(fatal) << "CbmMatchRecoToMC::ReadAndCreateDataBranches() NULL MCDataManager.";
177
178 fMCTracks = mcManager->InitBranch("MCTrack");
179
180 fMvdPoints = mcManager->InitBranch("MvdPoint");
181 fMvdHits = (TClonesArray*) ioman->GetObject("MvdHit");
182
183 fStsPoints = mcManager->InitBranch("StsPoint");
184 fStsClusters = (TClonesArray*) ioman->GetObject("StsCluster");
185 fStsHits = (TClonesArray*) ioman->GetObject("StsHit");
186 fStsClusterMatches = (TClonesArray*) ioman->GetObject("StsClusterMatch");
187 fStsHitMatches = (TClonesArray*) ioman->GetObject("StsHitMatch");
188
189 fRichHits = (TClonesArray*) ioman->GetObject("RichHit");
190 fRichPoints = mcManager->InitBranch("RichPoint");
191
192 fMuchPoints = mcManager->InitBranch("MuchPoint");
193 fMuchClusters = (TClonesArray*) ioman->GetObject("MuchCluster");
194 fMuchPixelHits = (TClonesArray*) ioman->GetObject("MuchPixelHit");
195 fMuchClusterMatches = (TClonesArray*) ioman->GetObject("MuchClusterMatch");
196 fMuchPixelHitMatches = (TClonesArray*) ioman->GetObject("MuchPixelHitMatch");
197
198 fTrdPoints = mcManager->InitBranch("TrdPoint");
199 fTrdClusters = (TClonesArray*) ioman->GetObject("TrdCluster");
200 fTrdHits = (TClonesArray*) ioman->GetObject("TrdHit");
201 fTrdClusterMatches = (TClonesArray*) ioman->GetObject("TrdClusterMatch");
202 fTrdHitMatches = (TClonesArray*) ioman->GetObject("TrdHitMatch");
203
204 fTofPoints = mcManager->InitBranch("TofPoint");
205 fTofHits = (TClonesArray*) ioman->GetObject("TofHit");
206
207 fTimeSlice = static_cast<CbmTimeSlice*>(ioman->GetObject("TimeSlice."));
208 fEventList = static_cast<CbmMCEventList*>(ioman->GetObject("MCEventList."));
209}
210
212{
213 assert(detId == ECbmModuleId::kSts || detId == ECbmModuleId::kTrd || detId == ECbmModuleId::kMuch);
214 if (detId == ECbmModuleId::kSts)
215 return CbmStsSetup::Instance()->GetStationNumber(address);
216 else if (detId == ECbmModuleId::kTrd)
217 return CbmTrdAddress::GetLayerId(address);
218 else if (detId == ECbmModuleId::kMuch)
219 return (CbmMuchGeoScheme::Instance()->GetLayerSideNr(address) - 1) / 2;
220 return 0;
221}
222
223void CbmLitClusteringQa::ProcessPoints(Int_t iEvent, CbmMCDataArray* points, const string& detName, ECbmModuleId detId)
224{
225 string histName = "hno_NofObjects_" + detName + "Points_Station";
226 if (NULL == points || !fHM->Exists(histName)) return;
227 Int_t evSize = points->Size(0, iEvent);
228
229 for (Int_t iP = 0; iP < evSize; iP++) {
230 const FairMCPoint* point = static_cast<const FairMCPoint*>(points->Get(0, iEvent, iP));
231 fHM->H1(histName)->Fill(GetStationId(point->GetDetectorID(), detId));
232 }
233}
234
235template<class Digi>
236void CbmLitClusteringQa::ProcessDigis(const string& detName)
237{
238 ECbmModuleId detId = Digi::GetSystem();
239 if (!(fDigiMan->IsPresent(detId) && fDigiMan->IsMatchPresent(detId))) return;
240 if (!fHM->Exists("hno_NofObjects_" + detName + "Digis_Station")) return;
241 for (Int_t i = 0; i < fDigiMan->GetNofDigis(detId); i++) {
242 const Digi* digi = fDigiMan->Get<Digi>(i);
243 const CbmMatch* digiMatch = fDigiMan->GetMatch(detId, i);
244 Int_t stationId = GetStationId(digi->GetAddress(), detId);
245 fHM->H1("hno_NofObjects_" + detName + "Digis_Station")->Fill(stationId);
246 fHM->H1("hpa_" + detName + "Digi_NofPointsInDigi_H1")->Fill(digiMatch->GetNofLinks());
247 fHM->H1("hpa_" + detName + "Digi_NofPointsInDigi_H2")->Fill(stationId, digiMatch->GetNofLinks());
248 }
249}
250
251void CbmLitClusteringQa::ProcessClusters(const TClonesArray* clusters, const TClonesArray* clusterMatches,
252 const string& detName, ECbmModuleId detId)
253{
254 if (NULL != clusters && fHM->Exists("hno_NofObjects_" + detName + "Clusters_Station")) {
255 for (Int_t i = 0; i < clusters->GetEntriesFast(); i++) {
256 const CbmCluster* cluster = static_cast<const CbmCluster*>(clusters->At(i));
257 const CbmMatch* clusterMatch = static_cast<const CbmMatch*>(clusterMatches->At(i));
258 Int_t stationId = GetStationId(cluster->GetAddress(), detId);
259 fHM->H1("hno_NofObjects_" + detName + "Clusters_Station")->Fill(stationId);
260 fHM->H1("hpa_" + detName + "Cluster_NofDigisInCluster_H1")->Fill(cluster->GetNofDigis());
261 fHM->H1("hpa_" + detName + "Cluster_NofDigisInCluster_H2")->Fill(stationId, cluster->GetNofDigis());
262 fHM->H1("hpa_" + detName + "Cluster_NofPointsInCluster_H1")->Fill(clusterMatch->GetNofLinks());
263 fHM->H1("hpa_" + detName + "Cluster_NofPointsInCluster_H2")->Fill(stationId, clusterMatch->GetNofLinks());
264 }
265 }
266}
267
268void CbmLitClusteringQa::ProcessHits(const TClonesArray* hits, const TClonesArray* hitMatches, const string& detName,
269 ECbmModuleId detId)
270{
271 if (NULL != hits && fHM->Exists("hno_NofObjects_" + detName + "Hits_Station")) {
272 for (Int_t i = 0; i < hits->GetEntriesFast(); i++) {
273 const CbmPixelHit* hit = static_cast<const CbmPixelHit*>(hits->At(i));
274 const CbmMatch* hitMatch = static_cast<const CbmMatch*>(hitMatches->At(i));
275 Int_t stationId = GetStationId(hit->GetAddress(), detId);
276 fHM->H1("hno_NofObjects_" + detName + "Hits_Station")->Fill(stationId);
277 fHM->H1("hpa_" + detName + "Hit_SigmaX_H1")->Fill(hit->GetDx());
278 fHM->H1("hpa_" + detName + "Hit_SigmaX_H2")->Fill(stationId, hit->GetDx());
279 fHM->H1("hpa_" + detName + "Hit_SigmaY_H1")->Fill(hit->GetDy());
280 fHM->H1("hpa_" + detName + "Hit_SigmaY_H2")->Fill(stationId, hit->GetDy());
281 fHM->H1("hpa_" + detName + "Hit_NofPointsInHit_H1")->Fill(hitMatch->GetNofLinks());
282 fHM->H1("hpa_" + detName + "Hit_NofPointsInHit_H2")->Fill(stationId, hitMatch->GetNofLinks());
283 }
284 }
285}
286
288{
289
290 if (NULL != fMvdPoints && fHM->Exists("hno_NofObjects_MvdPoints_Event"))
291 fHM->H1("hno_NofObjects_MvdPoints_Event")->Fill(fMvdPoints->Size(0, iEvent));
292 if (NULL != fStsPoints && fHM->Exists("hno_NofObjects_StsPoints_Event"))
293 fHM->H1("hno_NofObjects_StsPoints_Event")->Fill(fStsPoints->Size(0, iEvent));
294 if (NULL != fRichPoints && fHM->Exists("hno_NofObjects_RichPoints_Event"))
295 fHM->H1("hno_NofObjects_RichPoints_Event")->Fill(fRichPoints->Size(0, iEvent));
296 if (NULL != fTrdPoints && fHM->Exists("hno_NofObjects_TrdPoints_Event"))
297 fHM->H1("hno_NofObjects_TrdPoints_Event")->Fill(fTrdPoints->Size(0, iEvent));
298 if (NULL != fMuchPoints && fHM->Exists("hno_NofObjects_MuchPoints_Event"))
299 fHM->H1("hno_NofObjects_MuchPoints_Event")->Fill(fMuchPoints->Size(0, iEvent));
300 if (NULL != fTofPoints && fHM->Exists("hno_NofObjects_TofPoints_Event"))
301 fHM->H1("hno_NofObjects_TofPoints_Event")->Fill(fTofPoints->Size(0, iEvent));
302
303 if (fDigiMan->IsPresent(ECbmModuleId::kMvd) && fHM->Exists("hno_NofObjects_MvdDigis_Event"))
304 fHM->H1("hno_NofObjects_MvdDigis_Event")->Fill(fDigiMan->GetNofDigis(ECbmModuleId::kMvd));
305 if (NULL != fMvdClusters && fHM->Exists("hno_NofObjects_MvdClusters_Event"))
306 fHM->H1("hno_NofObjects_MvdClusters_Event")->Fill(fMvdClusters->GetEntriesFast());
307 if (NULL != fMvdHits && fHM->Exists("hno_NofObjects_MvdHits_Event"))
308 fHM->H1("hno_NofObjects_MvdHits_Event")->Fill(fMvdHits->GetEntriesFast());
309
310 if (fDigiMan->IsPresent(ECbmModuleId::kSts) && fHM->Exists("hno_NofObjects_StsDigis_Event"))
311 fHM->H1("hno_NofObjects_StsDigis_Event")->Fill(fDigiMan->GetNofDigis(ECbmModuleId::kSts));
312 if (NULL != fStsClusters && fHM->Exists("hno_NofObjects_StsClusters_Event"))
313 fHM->H1("hno_NofObjects_StsClusters_Event")->Fill(fStsClusters->GetEntriesFast());
314 if (NULL != fStsHits && fHM->Exists("hno_NofObjects_StsHits_Event"))
315 fHM->H1("hno_NofObjects_StsHits_Event")->Fill(fStsHits->GetEntriesFast());
316
317 if (NULL != fRichHits && fHM->Exists("hno_NofObjects_RichHits_Event"))
318 fHM->H1("hno_NofObjects_RichHits_Event")->Fill(fRichHits->GetEntriesFast());
319
320 if (fDigiMan->IsPresent(ECbmModuleId::kTrd) && fHM->Exists("hno_NofObjects_TrdDigis_Event"))
321 fHM->H1("hno_NofObjects_TrdDigis_Event")->Fill(fDigiMan->GetNofDigis(ECbmModuleId::kTrd));
322 if (NULL != fTrdClusters && fHM->Exists("hno_NofObjects_TrdClusters_Event"))
323 fHM->H1("hno_NofObjects_TrdClusters_Event")->Fill(fTrdClusters->GetEntriesFast());
324 if (NULL != fTrdHits && fHM->Exists("hno_NofObjects_TrdHits_Event"))
325 fHM->H1("hno_NofObjects_TrdHits_Event")->Fill(fTrdHits->GetEntriesFast());
326
327 if (fDigiMan->IsPresent(ECbmModuleId::kMuch) && fHM->Exists("hno_NofObjects_MuchDigis_Event"))
328 fHM->H1("hno_NofObjects_MuchDigis_Event")->Fill(fDigiMan->GetNofDigis(ECbmModuleId::kMuch));
329 if (NULL != fMuchClusters && fHM->Exists("hno_NofObjects_MuchClusters_Event"))
330 fHM->H1("hno_NofObjects_MuchClusters_Event")->Fill(fMuchClusters->GetEntriesFast());
331 if (NULL != fMuchPixelHits && fHM->Exists("hno_NofObjects_MuchPixelHits_Event"))
332 fHM->H1("hno_NofObjects_MuchPixelHits_Event")->Fill(fMuchPixelHits->GetEntriesFast());
333
334 if (NULL != fTofHits && fHM->Exists("hno_NofObjects_TofHits_Event"))
335 fHM->H1("hno_NofObjects_TofHits_Event")->Fill(fTofHits->GetEntriesFast());
336}
337
339 const TClonesArray* hitMatches, const string& detName,
340 ECbmModuleId detId)
341{
342 if (NULL == points || NULL == hits || NULL == hitMatches) return;
343 string nameResidualX = "hrp_" + detName + "_ResidualX_H2";
344 string nameResidualY = "hrp_" + detName + "_ResidualY_H2";
345 string nameResidualT = "hrp_" + detName + "_ResidualT_H2";
346 string namePullX = "hrp_" + detName + "_PullX_H2";
347 string namePullY = "hrp_" + detName + "_PullY_H2";
348 string namePullT = "hrp_" + detName + "_PullT_H2";
349 if (!fHM->Exists(nameResidualX) || !fHM->Exists(nameResidualY) || !fHM->Exists(nameResidualT)
350 || !fHM->Exists(namePullX) || !fHM->Exists(namePullY) || !fHM->Exists(namePullT))
351 return;
352
353 Int_t nofHits = hits->GetEntriesFast();
354 for (Int_t iHit = 0; iHit < nofHits; iHit++) {
355 const CbmPixelHit* hit = static_cast<const CbmPixelHit*>(hits->At(iHit));
356 const CbmMatch* match = static_cast<const CbmMatch*>(hitMatches->At(iHit));
357 if (std::isnan(static_cast<Float_t>(hit->GetX())) || (std::isnan(static_cast<Float_t>(hit->GetY())))) continue;
358 const FairMCPoint* point = static_cast<const FairMCPoint*>(
359 points->Get(0, match->GetMatchedLink().GetEntry(), match->GetMatchedLink().GetIndex()));
360 if (point == NULL) continue;
361 //Float_t xPoint = (muchPoint->GetXIn() + muchPoint->GetXOut()) / 2;
362 //Float_t yPoint = (muchPoint->GetYIn() + muchPoint->GetYOut()) / 2;
363 Float_t residualX = point->GetX() - hit->GetX();
364 Float_t residualY = point->GetY() - hit->GetY();
365 Float_t residualT;
366
367 if (0 == fTimeSlice || 0 == fEventList)
368 residualT = point->GetTime() - hit->GetTime();
369 else
370 residualT =
371 fEventList->GetEventTime(match->GetMatchedLink().GetEntry() + 1, 0) + point->GetTime() - hit->GetTime();
372
373 Int_t stationId = GetStationId(hit->GetAddress(), detId);
374 fHM->H2(nameResidualX)->Fill(stationId, residualX);
375 fHM->H2(nameResidualY)->Fill(stationId, residualY);
376 fHM->H2(nameResidualT)->Fill(stationId, residualT);
377 fHM->H2(namePullX)->Fill(stationId, residualX / hit->GetDx());
378 fHM->H2(namePullY)->Fill(stationId, residualY / hit->GetDy());
379 fHM->H2(namePullT)->Fill(stationId, residualT / hit->GetTimeError());
380 }
381}
382
384 const TClonesArray* hitMatches, const string& detName,
385 ECbmModuleId detId)
386{
387 if (NULL == points || NULL == hits || NULL == hitMatches) return;
388 string accName = "hhe_" + detName + "_All_Acc_Station";
389 if (NULL == points || !fHM->Exists(accName)) return;
390
391 Int_t evSize = points->Size(0, iEvent);
392 for (Int_t iP = 0; iP < evSize; iP++) {
393 const FairMCPoint* point = static_cast<const FairMCPoint*>(points->Get(0, iEvent, iP));
394 fHM->H1(accName)->Fill(GetStationId(point->GetDetectorID(), detId));
395 }
396
397 string recName = "hhe_" + detName + "_All_Rec_Station";
398 string cloneName = "hhe_" + detName + "_All_Clone_Station";
399 set<pair<Int_t, Int_t>> mcPointSet; // IDs of MC points
400 Int_t nofHits = hits->GetEntriesFast();
401 for (Int_t iHit = 0; iHit < nofHits; iHit++) {
402 const CbmPixelHit* hit = static_cast<const CbmPixelHit*>(hits->At(iHit));
403 const CbmMatch* match = static_cast<const CbmMatch*>(hitMatches->At(iHit));
404 if (mcPointSet.find(make_pair(match->GetMatchedLink().GetEntry(), match->GetMatchedLink().GetIndex()))
405 == mcPointSet.end()) {
406 fHM->H1(recName)->Fill(GetStationId(hit->GetAddress(), detId));
407 mcPointSet.insert(make_pair(match->GetMatchedLink().GetEntry(), match->GetMatchedLink().GetIndex()));
408 }
409 else {
410 fHM->H1(cloneName)->Fill(GetStationId(hit->GetAddress(), detId));
411 }
412 }
413}
414
416{
417 CreateNofObjectsHistograms(ECbmModuleId::kMvd, "Mvd", "Station", "Station number");
418 CreateNofObjectsHistograms(ECbmModuleId::kSts, "Sts", "Station", "Station number");
419 CreateNofObjectsHistograms(ECbmModuleId::kTrd, "Trd", "Station", "Station number");
420 CreateNofObjectsHistograms(ECbmModuleId::kMuch, "Much", "Station", "Station number");
421
428
432
433 CreateHitEfficiencyHistograms(ECbmModuleId::kSts, "Sts", "Station", "Station number", 100, -0.5, 99.5);
434 CreateHitEfficiencyHistograms(ECbmModuleId::kMuch, "Much", "Station", "Station number", 100, -0.5, 99.5);
435 CreateHitEfficiencyHistograms(ECbmModuleId::kTrd, "Trd", "Station", "Station number", 100, -0.5, 99.5);
436
437 // Histogram stores number of events
438 fHM->Create1<TH1F>("hen_EventNo_ClusteringQa", "hen_EventNo_ClusteringQa", 1, 0, 1.);
439}
440
442{
443 if (!fDet.GetDet(detId)) return;
444 assert(detId == ECbmModuleId::kMvd || detId == ECbmModuleId::kSts || detId == ECbmModuleId::kRich
445 || detId == ECbmModuleId::kMuch || detId == ECbmModuleId::kTrd || detId == ECbmModuleId::kTof);
446 Int_t nofBins = 100000;
447 Double_t minX = -0.5;
448 Double_t maxX = 99999.5;
449 string name = "hno_NofObjects_" + detName;
450 fHM->Create1<TH1F>(name + "Points_Event", name + "Points_Event;Points per event;Counter", nofBins, minX, maxX);
451 fHM->Create1<TH1F>(name + "Digis_Event", name + "Digis_Event;Digis per event;Counter", nofBins, minX, maxX);
452 fHM->Create1<TH1F>(name + "Clusters_Event", name + "Clusters_Event;Clusters per event;Counter", nofBins, minX, maxX);
453 if (detId == ECbmModuleId::kMuch) {
454 fHM->Create1<TH1F>(name + "PixelHits_Event", name + "PixelHits_Event;Hits per event;Counter", nofBins, minX, maxX);
455 }
456 else {
457 fHM->Create1<TH1F>(name + "Hits_Event", name + "Hits_Event;Hits per event;Counter", nofBins, minX, maxX);
458 }
459}
460
461void CbmLitClusteringQa::CreateNofObjectsHistograms(ECbmModuleId detId, const string& detName, const string& parameter,
462 const string& xTitle)
463{
464 if (!fDet.GetDet(detId)) return;
465 assert(detId == ECbmModuleId::kMvd || detId == ECbmModuleId::kSts || detId == ECbmModuleId::kRich
466 || detId == ECbmModuleId::kMuch || detId == ECbmModuleId::kTrd || detId == ECbmModuleId::kTof);
467 Int_t nofBins = 100;
468 Double_t minX = -0.5;
469 Double_t maxX = 99.5;
470 string name = "hno_NofObjects_" + detName;
471 fHM->Create1<TH1F>(name + "Points_" + parameter, name + "Points_" + parameter + ";" + xTitle + ";Points per event",
472 nofBins, minX, maxX);
473 fHM->Create1<TH1F>(name + "Digis_" + parameter, name + "Digis_" + parameter + ";" + xTitle + ";Digis per event",
474 nofBins, minX, maxX);
475 fHM->Create1<TH1F>(name + "Clusters_" + parameter,
476 name + "Clusters_" + parameter + ";" + xTitle + ";Clusters per event", nofBins, minX, maxX);
477 fHM->Create1<TH1F>(name + "Hits_" + parameter, name + "Hits_" + parameter + ";" + xTitle + ";Hits per event", nofBins,
478 minX, maxX);
479}
480
482{
483 if (!fDet.GetDet(detId)) return;
484 assert(detId == ECbmModuleId::kMvd || detId == ECbmModuleId::kSts || detId == ECbmModuleId::kRich
485 || detId == ECbmModuleId::kMuch || detId == ECbmModuleId::kTrd || detId == ECbmModuleId::kTof);
486 Int_t nofBinsStation = 100;
487 Double_t minStation = -0.5;
488 Double_t maxStation = 99.5;
489 Int_t nofBins = 100;
490 Double_t min = -0.5;
491 Double_t max = 99.5;
492 Int_t nofBinsSigma = 100;
493 Double_t minSigma = -0.5;
494 Double_t maxSigma = 9.5;
495 Int_t nofBinsResidual = 200;
496 Double_t minResidual = -10.0;
497 Double_t maxResidual = 10.0;
498 Double_t minResidualT = -100.0;
499 Double_t maxResidualT = 100.0;
500 Int_t nofBinsPull = 100;
501 Double_t minPull = -5.0;
502 Double_t maxPull = 5.0;
503
504 string nameH1 = "hpa_" + detName + "Cluster_NofDigisInCluster_H1";
505 fHM->Create1<TH1F>(nameH1, nameH1 + ";Number of digis;Yield", nofBins, min, max);
506 string nameH2 = "hpa_" + detName + "Cluster_NofDigisInCluster_H2";
507 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;Number of digis;Yield", nofBinsStation, minStation, max, nofBins, min,
508 max);
509 nameH1 = "hpa_" + detName + "Cluster_NofPointsInCluster_H1";
510 fHM->Create1<TH1F>(nameH1, nameH1 + ";Number of points;Yield", nofBins, min, max);
511 nameH2 = "hpa_" + detName + "Cluster_NofPointsInCluster_H2";
512 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;Number of points;Yield", nofBinsStation, minStation, max, nofBins, min,
513 max);
514 nameH1 = "hpa_" + detName + "Digi_NofPointsInDigi_H1";
515 fHM->Create1<TH1F>(nameH1, nameH1 + ";Number of points;Yield", nofBins, min, max);
516 nameH2 = "hpa_" + detName + "Digi_NofPointsInDigi_H2";
517 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;Number of points;Yield", nofBinsStation, minStation, maxStation,
518 nofBins, min, max);
519 nameH1 = "hpa_" + detName + "Hit_NofPointsInHit_H1";
520 fHM->Create1<TH1F>(nameH1, nameH1 + ";Number of points;Yield", nofBins, min, max);
521 nameH2 = "hpa_" + detName + "Hit_NofPointsInHit_H2";
522 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;Number of points;Yield", nofBinsStation, minStation, max, nofBins, min,
523 max);
524 nameH1 = "hpa_" + detName + "Hit_SigmaX_H1";
525 fHM->Create1<TH1F>(nameH1, nameH1 + ";#sigma_{X} [cm];Yield", nofBinsSigma, minSigma, maxSigma);
526 nameH2 = "hpa_" + detName + "Hit_SigmaX_H2";
527 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;#sigma_{X} [cm];Yield", nofBinsStation, minStation, maxStation,
528 nofBinsSigma, minSigma, maxSigma);
529 nameH1 = "hpa_" + detName + "Hit_SigmaY_H1";
530 fHM->Create1<TH1F>(nameH1, nameH1 + ";#sigma_{Y} [cm];Yield", nofBinsSigma, minSigma, maxSigma);
531 nameH2 = "hpa_" + detName + "Hit_SigmaY_H2";
532 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;#sigma_{Y} [cm];Yield", nofBinsStation, minStation, maxStation,
533 nofBinsSigma, minSigma, maxSigma);
534
535 // Residual and pull histograms
536 nameH2 = "hrp_" + detName + "_ResidualX_H2";
537 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;Residual X [cm];Yield", nofBinsStation, minStation, maxStation,
538 nofBinsResidual, minResidual, maxResidual);
539 nameH2 = "hrp_" + detName + "_ResidualY_H2";
540 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;Residual Y [cm];Yield", nofBinsStation, minStation, maxStation,
541 nofBinsResidual, minResidual, maxResidual);
542 nameH2 = "hrp_" + detName + "_ResidualT_H2";
543 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;Residual T [ns];Yield", nofBinsStation, minStation, maxStation,
544 nofBinsResidual, minResidualT, maxResidualT);
545 nameH2 = "hrp_" + detName + "_PullX_H2";
546 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;Pull X;Yield", nofBinsStation, minStation, maxStation, nofBinsPull,
547 minPull, maxPull);
548 nameH2 = "hrp_" + detName + "_PullY_H2";
549 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;Pull Y;Yield", nofBinsStation, minStation, maxStation, nofBinsPull,
550 minPull, maxPull);
551 nameH2 = "hrp_" + detName + "_PullT_H2";
552 fHM->Create2<TH2F>(nameH2, nameH2 + ";Station;Pull T;Yield", nofBinsStation, minStation, maxStation, nofBinsPull,
553 minPull, maxPull);
554}
555
557 const string& parameter, const string& xTitle, Int_t nofBins,
558 Double_t minBin, Double_t maxBin)
559{
560 if (!fDet.GetDet(detId)) return;
561 vector<string> types = list_of("Acc")("Rec")("Eff")("Clone")("CloneProb");
562 vector<string> cat = list_of("All");
563 for (UInt_t iCat = 0; iCat < cat.size(); iCat++) {
564 for (UInt_t iType = 0; iType < types.size(); iType++) {
565 string yTitle = (types[iType] == "Eff") ? "Efficiency [%]"
566 : (types[iType] == "CloneProb") ? "Probability [%]"
567 : "Counter";
568 string histName = "hhe_" + detName + "_" + cat[iCat] + "_" + types[iType] + "_" + parameter;
569 string histTitle = histName + ";" + xTitle + ";" + yTitle;
570 fHM->Add(histName, new TH1F(histName.c_str(), histTitle.c_str(), nofBins, minBin, maxBin));
571 }
572 }
573}
574
TClonesArray * points
Base class for cluster objects.
ECbmModuleId
Definition CbmDefs.h:39
@ kMvd
Micro-Vertex Detector.
@ kTrd
Transition Radiation Detector.
@ kTof
Time-of-flight Detector.
@ kSts
Silicon Tracking System.
@ kMuch
Muon detection system.
@ kRich
Ring-Imaging Cherenkov Detector.
Histogram manager.
Simulation report for clustering QA.
ClassImp(CbmLitClusteringQa)
FairTask for clustering performance calculation.
Data container for MUCH clusters.
Class for pixel hits in MUCH detector.
static vector< vector< QAHit > > hits
Helper class to convert unique channel ID back and forth.
friend fscal max(fscal x, fscal y)
friend fscal min(fscal x, fscal y)
Base class for cluster objects.
Definition CbmCluster.h:30
int32_t GetAddress() const
Definition CbmCluster.h:90
int32_t GetNofDigis() const
Number of digis in cluster.
Definition CbmCluster.h:69
static Int_t GetNofDigis(ECbmModuleId systemId)
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
static Bool_t IsMatchPresent(ECbmModuleId systemId)
Presence of a digi match branch.
const Digi * Get(Int_t index) const
Get a digi object.
const CbmMatch * GetMatch(ECbmModuleId systemId, UInt_t index) const
Get a match object.
Histogram manager.
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
void Create2(const std::string &name, const std::string &title, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY)
Helper function for creation of 2-dimensional histograms and profiles. Template argument is a real ob...
void WriteToFile()
Write all objects to current opened file.
Bool_t Exists(const std::string &name) const
Check existence of object in manager.
void Create1(const std::string &name, const std::string &title, Int_t nofBins, Double_t minBin, Double_t maxBin)
Helper function for creation of 1-dimensional histograms and profiles. Template argument is a real ob...
void Add(const std::string &name, TNamed *object)
Add new named object to manager.
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
double GetTimeError() const
Definition CbmHit.h:77
double GetTime() const
Definition CbmHit.h:76
int32_t GetAddress() const
Definition CbmHit.h:74
Simulation report for clustering QA.
void ProcessClusters(const TClonesArray *clusters, const TClonesArray *clusterMatches, const string &detName, ECbmModuleId detId)
virtual void Exec(Option_t *opt)
Derived from FairTask.
TClonesArray * fTrdClusters
CbmTrdPoint.
TClonesArray * fStsHits
CbmStsCluster.
CbmMCDataArray * fTrdPoints
CbmMatch (hit)
virtual ~CbmLitClusteringQa()
Destructor.
TClonesArray * fStsClusterMatches
CbmStsHit array.
TClonesArray * fRichHits
CbmRichPoint.
CbmMCDataArray * fStsPoints
CbmMvdHit.
CbmTimeSlice * fTimeSlice
void FillEventCounterHistograms(Int_t iEvent)
CbmMCDataArray * fMvdPoints
CbmMCTrack.
Int_t GetStationId(Int_t address, ECbmModuleId detId)
void ReadDataBranches()
Read data branches.
CbmMCDataArray * fMCTracks
Interface to digi data.
void FillHitEfficiencyHistograms(Int_t iEvent, CbmMCDataArray *points, const TClonesArray *hits, const TClonesArray *hitMatches, const string &detName, ECbmModuleId detId)
void ProcessDigis(const string &detName)
void InitMuchGeoScheme(const string &digiFileName)
CbmLitClusteringQa()
Constructor.
TClonesArray * fMvdClusters
CbmMvdPoint.
CbmMCDataArray * fRichPoints
CbmMatch (hit)
CbmMCDataArray * fTofPoints
CbmMatch (hit)
virtual void Finish()
Derived from FairTask.
TClonesArray * fStsHitMatches
CbmMatch (cluster)
TClonesArray * fMuchClusters
CbmMuchPoint.
CbmDigiManager * fDigiMan
void CreateNofObjectsHistograms(ECbmModuleId detId, const string &detName)
virtual InitStatus Init()
Derived from FairTask.
CbmMCEventList * fEventList
void CreateClusterParametersHistograms(ECbmModuleId detId, const string &detName)
void FillResidualAndPullHistograms(CbmMCDataArray *points, const TClonesArray *hits, const TClonesArray *hitMatches, const string &detName, ECbmModuleId detId)
void ProcessPoints(Int_t iEvent, CbmMCDataArray *points, const string &detName, ECbmModuleId detId)
TClonesArray * fMuchPixelHitMatches
CbmMatch array.
TClonesArray * fTrdHits
CbmTrdCluster.
TClonesArray * fMvdHits
CbmMvdCluster.
TClonesArray * fMuchClusterMatches
CbmMuchPixelHit.
string fMuchDigiFileName
CbmTofHit.
CbmLitDetectorSetup fDet
CbmMCDataArray * fMuchPoints
CbmRichHit.
void ProcessHits(const TClonesArray *hits, const TClonesArray *hitMatches, const string &detName, ECbmModuleId detId)
TClonesArray * fTrdClusterMatches
CbmTrdHit.
TClonesArray * fTofHits
CbmTofPoint.
TClonesArray * fStsClusters
CbmStsPoint.
TClonesArray * fTrdHitMatches
CbmMatch (cluster)
TClonesArray * fMuchPixelHits
CbmMuchCluster.
void CreateHitEfficiencyHistograms(ECbmModuleId detId, const string &detName, const string &parameter, const string &xTitle, Int_t nofBins, Double_t minBin, Double_t maxBin)
void DetermineSetup()
Determines detector presence using TGeoManager.
bool GetDet(ECbmModuleId detId) const
Return detector presence in setup.
Access to a MC data branch for time-based analysis.
Int_t Size(Int_t fileNumber, Int_t eventNumber)
Task class creating and managing CbmMCDataArray objects.
CbmMCDataObject * GetObject(const char *name)
CbmMCDataArray * InitBranch(const char *name)
Container class for MC events with number, file and start time.
double GetEventTime(uint32_t event, uint32_t file)
Event start time.
int32_t GetNofLinks() const
Definition CbmMatch.h:42
const CbmLink & GetMatchedLink() const
Definition CbmMatch.h:41
static CbmMuchGeoScheme * Instance()
void Init(TObjArray *stations, Int_t flag)
double GetDy() const
Definition CbmPixelHit.h:76
double GetDx() const
Definition CbmPixelHit.h:75
double GetY() const
Definition CbmPixelHit.h:74
double GetX() const
Definition CbmPixelHit.h:73
Base class for simulation reports.
void Create(CbmHistManager *histManager, const std::string &outputDir)
Main function which creates report data.
Class representing the top level of the STS setup.
Definition CbmStsSetup.h:43
Bool_t Init(const char *geometryFile=nullptr)
Initialise the setup.
static CbmStsSetup * Instance()
Int_t GetStationNumber(Int_t address)
Bool_t IsInit() const
Initialisation status for sensor parameters.
Bookkeeping of time-slice content.
static uint32_t GetLayerId(uint32_t address)
Return layer ID from address.