CbmRoot
CbmLitClusteringQa.cxx
Go to the documentation of this file.
1 
8 #include "CbmLitClusteringQa.h"
9 #include "CbmCluster.h"
10 #include "CbmDigiManager.h"
11 #include "CbmHistManager.h"
12 #include "CbmHit.h"
14 #include "CbmMCDataManager.h"
15 #include "CbmMCTrack.h"
16 #include "CbmMatch.h"
17 #include "CbmMuchCluster.h"
18 #include "CbmMuchDigi.h"
19 #include "CbmMuchDigiMatch.h"
20 #include "CbmMuchGeoScheme.h"
21 #include "CbmMuchLayer.h"
22 #include "CbmMuchLayerSide.h"
23 #include "CbmMuchModule.h"
24 #include "CbmMuchModuleGem.h"
25 #include "CbmMuchModuleGemRadial.h"
26 #include "CbmMuchPad.h"
27 #include "CbmMuchPadRadial.h"
28 #include "CbmMuchPixelHit.h"
29 #include "CbmMuchPoint.h"
30 #include "CbmMuchSector.h"
31 #include "CbmMuchSectorRadial.h"
32 #include "CbmMuchStation.h"
33 #include "CbmStsAddress.h"
34 #include "CbmStsDigi.h"
35 #include "CbmStsSetup.h"
36 #include "CbmTrdAddress.h"
37 #include "CbmTrdDigi.h"
38 #include "FairRootManager.h"
39 
40 #include "CbmMCDataArray.h"
41 #include "TClonesArray.h"
42 #include "TF1.h"
43 #include "TH1.h"
44 #include "TH1D.h"
45 #include "TH2.h"
46 #include "TProfile.h"
47 #include "TProfile2D.h"
48 #include "TSystem.h"
49 #include <TFile.h>
50 
51 #include <boost/assign/list_of.hpp>
52 #include <cmath>
53 #include <fstream>
54 #include <set>
55 #include <sstream>
56 #include <utility>
57 
58 using boost::assign::list_of;
59 using std::binary_search;
60 using std::cout;
61 using std::make_pair;
62 using std::map;
63 using std::pair;
64 using std::set;
65 using std::vector;
66 
67 CbmLitClusteringQa::CbmLitClusteringQa() : FairTask("LitClusteringQa") {}
68 
70  if (fHM) delete fHM;
71 }
72 
74  // Create histogram manager which is used throughout the program
75  fHM = new CbmHistManager();
76 
79 
80  // --- Get STS setup
81  CbmStsSetup* stsSetup = CbmStsSetup::Instance();
82 
83  if (!stsSetup->IsInit()) stsSetup->Init();
84 
86 
88 
89  return kSUCCESS;
90 }
91 
92 void CbmLitClusteringQa::Exec(Option_t* opt) {
93  fHM->H1("hen_EventNo_ClusteringQa")->Fill(0.5);
94  Int_t eventNum = fHM->H1("hen_EventNo_ClusteringQa")->GetEntries() - 1;
95  std::cout << "CbmLitClusteringQa::Exec: event=" << eventNum << std::endl;
96 
98 
99  ProcessPoints(eventNum, fStsPoints, "Sts", ECbmModuleId::kSts);
100  ProcessPoints(eventNum, fTrdPoints, "Trd", ECbmModuleId::kTrd);
101  ProcessPoints(eventNum, fMuchPoints, "Much", ECbmModuleId::kMuch);
102 
103  ProcessDigis<CbmStsDigi>("Sts");
104  ProcessDigis<CbmTrdDigi>("Trd");
105  ProcessDigis<CbmMuchDigi>("Much");
106 
111 
114  ProcessHits(
116 
124  "Much",
126 
132  fMuchPoints,
135  "Much",
137 }
138 
140  TDirectory* oldir = gDirectory;
141  TFile* outFile = FairRootManager::Instance()->GetOutFile();
142  if (outFile != NULL) {
143  outFile->cd();
144  fHM->WriteToFile();
145  }
146  gDirectory->cd(oldir->GetPath());
147 
149  report->Create(fHM, fOutputDir);
150  delete report;
151 }
152 
153 void CbmLitClusteringQa::InitMuchGeoScheme(const string& digiFileName) {
155  TFile* oldfile = gFile;
156  TFile* file = new TFile(digiFileName.c_str());
157  TObjArray* stations = (TObjArray*) file->Get("stations");
158  file->Close();
159  file->Delete();
160  gFile = oldfile;
161  CbmMuchGeoScheme::Instance()->Init(stations, 0);
162  }
163 }
164 
166  FairRootManager* ioman = FairRootManager::Instance();
167  assert(ioman != NULL);
168 
169  CbmMCDataManager* mcManager =
170  (CbmMCDataManager*) ioman->GetObject("MCDataManager");
171 
172  if (0 == mcManager)
173  LOG(fatal)
174  << "CbmMatchRecoToMC::ReadAndCreateDataBranches() NULL MCDataManager.";
175 
176  fMCTracks = mcManager->InitBranch("MCTrack");
177 
178  fMvdPoints = mcManager->InitBranch("MvdPoint");
179  fMvdHits = (TClonesArray*) ioman->GetObject("MvdHit");
180 
181  fStsPoints = mcManager->InitBranch("StsPoint");
182  fStsClusters = (TClonesArray*) ioman->GetObject("StsCluster");
183  fStsHits = (TClonesArray*) ioman->GetObject("StsHit");
184  fStsClusterMatches = (TClonesArray*) ioman->GetObject("StsClusterMatch");
185  fStsHitMatches = (TClonesArray*) ioman->GetObject("StsHitMatch");
186 
187  fRichHits = (TClonesArray*) ioman->GetObject("RichHit");
188  fRichPoints = mcManager->InitBranch("RichPoint");
189 
190  fMuchPoints = mcManager->InitBranch("MuchPoint");
191  fMuchClusters = (TClonesArray*) ioman->GetObject("MuchCluster");
192  fMuchPixelHits = (TClonesArray*) ioman->GetObject("MuchPixelHit");
193  fMuchClusterMatches = (TClonesArray*) ioman->GetObject("MuchClusterMatch");
194  fMuchPixelHitMatches = (TClonesArray*) ioman->GetObject("MuchPixelHitMatch");
195 
196  fTrdPoints = mcManager->InitBranch("TrdPoint");
197  fTrdClusters = (TClonesArray*) ioman->GetObject("TrdCluster");
198  fTrdHits = (TClonesArray*) ioman->GetObject("TrdHit");
199  fTrdClusterMatches = (TClonesArray*) ioman->GetObject("TrdClusterMatch");
200  fTrdHitMatches = (TClonesArray*) ioman->GetObject("TrdHitMatch");
201 
202  fTofPoints = mcManager->InitBranch("TofPoint");
203  fTofHits = (TClonesArray*) ioman->GetObject("TofHit");
204 
205  fTimeSlice = static_cast<CbmTimeSlice*>(ioman->GetObject("TimeSlice."));
206  fEventList = static_cast<CbmMCEventList*>(ioman->GetObject("MCEventList."));
207 }
208 
209 Int_t CbmLitClusteringQa::GetStationId(Int_t address, ECbmModuleId detId) {
210  assert(detId == ECbmModuleId::kSts || detId == ECbmModuleId::kTrd
211  || detId == ECbmModuleId::kMuch);
212  if (detId == ECbmModuleId::kSts)
213  return CbmStsSetup::Instance()->GetStationNumber(address);
214  else if (detId == ECbmModuleId::kTrd)
215  return CbmTrdAddress::GetLayerId(address);
216  else if (detId == ECbmModuleId::kMuch)
217  return (CbmMuchGeoScheme::Instance()->GetLayerSideNr(address) - 1) / 2;
218  return 0;
219 }
220 
223  const string& detName,
224  ECbmModuleId detId) {
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 =
231  static_cast<const FairMCPoint*>(points->Get(0, iEvent, iP));
232  fHM->H1(histName)->Fill(GetStationId(point->GetDetectorID(), detId));
233  }
234 }
235 
236 template<class Digi>
237 void CbmLitClusteringQa::ProcessDigis(const string& detName) {
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")
247  ->Fill(digiMatch->GetNofLinks());
248  fHM->H1("hpa_" + detName + "Digi_NofPointsInDigi_H2")
249  ->Fill(stationId, digiMatch->GetNofLinks());
250  }
251 }
252 
253 void CbmLitClusteringQa::ProcessClusters(const TClonesArray* clusters,
254  const TClonesArray* clusterMatches,
255  const string& detName,
256  ECbmModuleId detId) {
257  if (NULL != clusters
258  && fHM->Exists("hno_NofObjects_" + detName + "Clusters_Station")) {
259  for (Int_t i = 0; i < clusters->GetEntriesFast(); i++) {
260  const CbmCluster* cluster =
261  static_cast<const CbmCluster*>(clusters->At(i));
262  const CbmMatch* clusterMatch =
263  static_cast<const CbmMatch*>(clusterMatches->At(i));
264  Int_t stationId = GetStationId(cluster->GetAddress(), detId);
265  fHM->H1("hno_NofObjects_" + detName + "Clusters_Station")
266  ->Fill(stationId);
267  fHM->H1("hpa_" + detName + "Cluster_NofDigisInCluster_H1")
268  ->Fill(cluster->GetNofDigis());
269  fHM->H1("hpa_" + detName + "Cluster_NofDigisInCluster_H2")
270  ->Fill(stationId, cluster->GetNofDigis());
271  fHM->H1("hpa_" + detName + "Cluster_NofPointsInCluster_H1")
272  ->Fill(clusterMatch->GetNofLinks());
273  fHM->H1("hpa_" + detName + "Cluster_NofPointsInCluster_H2")
274  ->Fill(stationId, clusterMatch->GetNofLinks());
275  }
276  }
277 }
278 
279 void CbmLitClusteringQa::ProcessHits(const TClonesArray* hits,
280  const TClonesArray* hitMatches,
281  const string& detName,
282  ECbmModuleId detId) {
283  if (NULL != hits
284  && fHM->Exists("hno_NofObjects_" + detName + "Hits_Station")) {
285  for (Int_t i = 0; i < hits->GetEntriesFast(); i++) {
286  const CbmPixelHit* hit = static_cast<const CbmPixelHit*>(hits->At(i));
287  const CbmMatch* hitMatch =
288  static_cast<const CbmMatch*>(hitMatches->At(i));
289  Int_t stationId = GetStationId(hit->GetAddress(), detId);
290  fHM->H1("hno_NofObjects_" + detName + "Hits_Station")->Fill(stationId);
291  fHM->H1("hpa_" + detName + "Hit_SigmaX_H1")->Fill(hit->GetDx());
292  fHM->H1("hpa_" + detName + "Hit_SigmaX_H2")
293  ->Fill(stationId, hit->GetDx());
294  fHM->H1("hpa_" + detName + "Hit_SigmaY_H1")->Fill(hit->GetDy());
295  fHM->H1("hpa_" + detName + "Hit_SigmaY_H2")
296  ->Fill(stationId, hit->GetDy());
297  fHM->H1("hpa_" + detName + "Hit_NofPointsInHit_H1")
298  ->Fill(hitMatch->GetNofLinks());
299  fHM->H1("hpa_" + detName + "Hit_NofPointsInHit_H2")
300  ->Fill(stationId, hitMatch->GetNofLinks());
301  }
302  }
303 }
304 
306 
307  if (NULL != fMvdPoints && fHM->Exists("hno_NofObjects_MvdPoints_Event"))
308  fHM->H1("hno_NofObjects_MvdPoints_Event")
309  ->Fill(fMvdPoints->Size(0, iEvent));
310  if (NULL != fStsPoints && fHM->Exists("hno_NofObjects_StsPoints_Event"))
311  fHM->H1("hno_NofObjects_StsPoints_Event")
312  ->Fill(fStsPoints->Size(0, iEvent));
313  if (NULL != fRichPoints && fHM->Exists("hno_NofObjects_RichPoints_Event"))
314  fHM->H1("hno_NofObjects_RichPoints_Event")
315  ->Fill(fRichPoints->Size(0, iEvent));
316  if (NULL != fTrdPoints && fHM->Exists("hno_NofObjects_TrdPoints_Event"))
317  fHM->H1("hno_NofObjects_TrdPoints_Event")
318  ->Fill(fTrdPoints->Size(0, iEvent));
319  if (NULL != fMuchPoints && fHM->Exists("hno_NofObjects_MuchPoints_Event"))
320  fHM->H1("hno_NofObjects_MuchPoints_Event")
321  ->Fill(fMuchPoints->Size(0, iEvent));
322  if (NULL != fTofPoints && fHM->Exists("hno_NofObjects_TofPoints_Event"))
323  fHM->H1("hno_NofObjects_TofPoints_Event")
324  ->Fill(fTofPoints->Size(0, iEvent));
325 
327  && fHM->Exists("hno_NofObjects_MvdDigis_Event"))
328  fHM->H1("hno_NofObjects_MvdDigis_Event")
330  if (NULL != fMvdClusters && fHM->Exists("hno_NofObjects_MvdClusters_Event"))
331  fHM->H1("hno_NofObjects_MvdClusters_Event")
332  ->Fill(fMvdClusters->GetEntriesFast());
333  if (NULL != fMvdHits && fHM->Exists("hno_NofObjects_MvdHits_Event"))
334  fHM->H1("hno_NofObjects_MvdHits_Event")->Fill(fMvdHits->GetEntriesFast());
335 
337  && fHM->Exists("hno_NofObjects_StsDigis_Event"))
338  fHM->H1("hno_NofObjects_StsDigis_Event")
340  if (NULL != fStsClusters && fHM->Exists("hno_NofObjects_StsClusters_Event"))
341  fHM->H1("hno_NofObjects_StsClusters_Event")
342  ->Fill(fStsClusters->GetEntriesFast());
343  if (NULL != fStsHits && fHM->Exists("hno_NofObjects_StsHits_Event"))
344  fHM->H1("hno_NofObjects_StsHits_Event")->Fill(fStsHits->GetEntriesFast());
345 
346  if (NULL != fRichHits && fHM->Exists("hno_NofObjects_RichHits_Event"))
347  fHM->H1("hno_NofObjects_RichHits_Event")->Fill(fRichHits->GetEntriesFast());
348 
350  && fHM->Exists("hno_NofObjects_TrdDigis_Event"))
351  fHM->H1("hno_NofObjects_TrdDigis_Event")
353  if (NULL != fTrdClusters && fHM->Exists("hno_NofObjects_TrdClusters_Event"))
354  fHM->H1("hno_NofObjects_TrdClusters_Event")
355  ->Fill(fTrdClusters->GetEntriesFast());
356  if (NULL != fTrdHits && fHM->Exists("hno_NofObjects_TrdHits_Event"))
357  fHM->H1("hno_NofObjects_TrdHits_Event")->Fill(fTrdHits->GetEntriesFast());
358 
360  && fHM->Exists("hno_NofObjects_MuchDigis_Event"))
361  fHM->H1("hno_NofObjects_MuchDigis_Event")
363  if (NULL != fMuchClusters && fHM->Exists("hno_NofObjects_MuchClusters_Event"))
364  fHM->H1("hno_NofObjects_MuchClusters_Event")
365  ->Fill(fMuchClusters->GetEntriesFast());
366  if (NULL != fMuchPixelHits
367  && fHM->Exists("hno_NofObjects_MuchPixelHits_Event"))
368  fHM->H1("hno_NofObjects_MuchPixelHits_Event")
369  ->Fill(fMuchPixelHits->GetEntriesFast());
370 
371  if (NULL != fTofHits && fHM->Exists("hno_NofObjects_TofHits_Event"))
372  fHM->H1("hno_NofObjects_TofHits_Event")->Fill(fTofHits->GetEntriesFast());
373 }
374 
377  const TClonesArray* hits,
378  const TClonesArray* hitMatches,
379  const string& detName,
380  ECbmModuleId detId) {
381  if (NULL == points || NULL == hits || NULL == hitMatches) return;
382  string nameResidualX = "hrp_" + detName + "_ResidualX_H2";
383  string nameResidualY = "hrp_" + detName + "_ResidualY_H2";
384  string nameResidualT = "hrp_" + detName + "_ResidualT_H2";
385  string namePullX = "hrp_" + detName + "_PullX_H2";
386  string namePullY = "hrp_" + detName + "_PullY_H2";
387  string namePullT = "hrp_" + detName + "_PullT_H2";
388  if (!fHM->Exists(nameResidualX) || !fHM->Exists(nameResidualY)
389  || !fHM->Exists(nameResidualT) || !fHM->Exists(namePullX)
390  || !fHM->Exists(namePullY) || !fHM->Exists(namePullT))
391  return;
392 
393  Int_t nofHits = hits->GetEntriesFast();
394  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
395  const CbmPixelHit* hit = static_cast<const CbmPixelHit*>(hits->At(iHit));
396  const CbmMatch* match = static_cast<const CbmMatch*>(hitMatches->At(iHit));
397  if (isnan(static_cast<Float_t>(hit->GetX()))
398  || (isnan(static_cast<Float_t>(hit->GetY()))))
399  continue;
400  const FairMCPoint* point = static_cast<const FairMCPoint*>(
401  points->Get(0,
402  match->GetMatchedLink().GetEntry(),
403  match->GetMatchedLink().GetIndex()));
404  if (point == NULL) continue;
405  //Float_t xPoint = (muchPoint->GetXIn() + muchPoint->GetXOut()) / 2;
406  //Float_t yPoint = (muchPoint->GetYIn() + muchPoint->GetYOut()) / 2;
407  Float_t residualX = point->GetX() - hit->GetX();
408  Float_t residualY = point->GetY() - hit->GetY();
409  Float_t residualT;
410 
411  if (0 == fTimeSlice || 0 == fEventList)
412  residualT = point->GetTime() - hit->GetTime();
413  else
414  residualT =
415  fEventList->GetEventTime(match->GetMatchedLink().GetEntry() + 1, 0)
416  + point->GetTime() - hit->GetTime();
417 
418  Int_t stationId = GetStationId(hit->GetAddress(), detId);
419  fHM->H2(nameResidualX)->Fill(stationId, residualX);
420  fHM->H2(nameResidualY)->Fill(stationId, residualY);
421  fHM->H2(nameResidualT)->Fill(stationId, residualT);
422  fHM->H2(namePullX)->Fill(stationId, residualX / hit->GetDx());
423  fHM->H2(namePullY)->Fill(stationId, residualY / hit->GetDy());
424  fHM->H2(namePullT)->Fill(stationId, residualT / hit->GetTimeError());
425  }
426 }
427 
429  Int_t iEvent,
431  const TClonesArray* hits,
432  const TClonesArray* hitMatches,
433  const string& detName,
434  ECbmModuleId detId) {
435  if (NULL == points || NULL == hits || NULL == hitMatches) return;
436  string accName = "hhe_" + detName + "_All_Acc_Station";
437  if (NULL == points || !fHM->Exists(accName)) return;
438 
439  Int_t evSize = points->Size(0, iEvent);
440  for (Int_t iP = 0; iP < evSize; iP++) {
441  const FairMCPoint* point =
442  static_cast<const FairMCPoint*>(points->Get(0, iEvent, iP));
443  fHM->H1(accName)->Fill(GetStationId(point->GetDetectorID(), detId));
444  }
445 
446  string recName = "hhe_" + detName + "_All_Rec_Station";
447  string cloneName = "hhe_" + detName + "_All_Clone_Station";
448  set<pair<Int_t, Int_t>> mcPointSet; // IDs of MC points
449  Int_t nofHits = hits->GetEntriesFast();
450  for (Int_t iHit = 0; iHit < nofHits; iHit++) {
451  const CbmPixelHit* hit = static_cast<const CbmPixelHit*>(hits->At(iHit));
452  const CbmMatch* match = static_cast<const CbmMatch*>(hitMatches->At(iHit));
453  if (mcPointSet.find(make_pair(match->GetMatchedLink().GetEntry(),
454  match->GetMatchedLink().GetIndex()))
455  == mcPointSet.end()) {
456  fHM->H1(recName)->Fill(GetStationId(hit->GetAddress(), detId));
457  mcPointSet.insert(make_pair(match->GetMatchedLink().GetEntry(),
458  match->GetMatchedLink().GetIndex()));
459  } else {
460  fHM->H1(cloneName)->Fill(GetStationId(hit->GetAddress(), detId));
461  }
462  }
463 }
464 
467  ECbmModuleId::kMvd, "Mvd", "Station", "Station number");
469  ECbmModuleId::kSts, "Sts", "Station", "Station number");
471  ECbmModuleId::kTrd, "Trd", "Station", "Station number");
473  ECbmModuleId::kMuch, "Much", "Station", "Station number");
474 
481 
485 
487  ECbmModuleId::kSts, "Sts", "Station", "Station number", 100, -0.5, 99.5);
489  ECbmModuleId::kMuch, "Much", "Station", "Station number", 100, -0.5, 99.5);
491  ECbmModuleId::kTrd, "Trd", "Station", "Station number", 100, -0.5, 99.5);
492 
493  // Histogram stores number of events
494  fHM->Create1<TH1F>(
495  "hen_EventNo_ClusteringQa", "hen_EventNo_ClusteringQa", 1, 0, 1.);
496 }
497 
499  const string& detName) {
500  if (!fDet.GetDet(detId)) return;
501  assert(detId == ECbmModuleId::kMvd || detId == ECbmModuleId::kSts
502  || detId == ECbmModuleId::kRich || detId == ECbmModuleId::kMuch
503  || detId == ECbmModuleId::kTrd || detId == ECbmModuleId::kTof);
504  Int_t nofBins = 100000;
505  Double_t minX = -0.5;
506  Double_t maxX = 99999.5;
507  string name = "hno_NofObjects_" + detName;
508  fHM->Create1<TH1F>(name + "Points_Event",
509  name + "Points_Event;Points per event;Counter",
510  nofBins,
511  minX,
512  maxX);
513  fHM->Create1<TH1F>(name + "Digis_Event",
514  name + "Digis_Event;Digis per event;Counter",
515  nofBins,
516  minX,
517  maxX);
518  fHM->Create1<TH1F>(name + "Clusters_Event",
519  name + "Clusters_Event;Clusters per event;Counter",
520  nofBins,
521  minX,
522  maxX);
523  if (detId == ECbmModuleId::kMuch) {
524  fHM->Create1<TH1F>(name + "PixelHits_Event",
525  name + "PixelHits_Event;Hits per event;Counter",
526  nofBins,
527  minX,
528  maxX);
529  } else {
530  fHM->Create1<TH1F>(name + "Hits_Event",
531  name + "Hits_Event;Hits per event;Counter",
532  nofBins,
533  minX,
534  maxX);
535  }
536 }
537 
539  const string& detName,
540  const string& parameter,
541  const string& xTitle) {
542  if (!fDet.GetDet(detId)) return;
543  assert(detId == ECbmModuleId::kMvd || detId == ECbmModuleId::kSts
544  || detId == ECbmModuleId::kRich || detId == ECbmModuleId::kMuch
545  || detId == ECbmModuleId::kTrd || detId == ECbmModuleId::kTof);
546  Int_t nofBins = 100;
547  Double_t minX = -0.5;
548  Double_t maxX = 99.5;
549  string name = "hno_NofObjects_" + detName;
550  fHM->Create1<TH1F>(name + "Points_" + parameter,
551  name + "Points_" + parameter + ";" + xTitle
552  + ";Points per event",
553  nofBins,
554  minX,
555  maxX);
556  fHM->Create1<TH1F>(name + "Digis_" + parameter,
557  name + "Digis_" + parameter + ";" + xTitle
558  + ";Digis per event",
559  nofBins,
560  minX,
561  maxX);
562  fHM->Create1<TH1F>(name + "Clusters_" + parameter,
563  name + "Clusters_" + parameter + ";" + xTitle
564  + ";Clusters per event",
565  nofBins,
566  minX,
567  maxX);
568  fHM->Create1<TH1F>(name + "Hits_" + parameter,
569  name + "Hits_" + parameter + ";" + xTitle
570  + ";Hits per event",
571  nofBins,
572  minX,
573  maxX);
574 }
575 
577  ECbmModuleId detId,
578  const string& detName) {
579  if (!fDet.GetDet(detId)) return;
580  assert(detId == ECbmModuleId::kMvd || detId == ECbmModuleId::kSts
581  || detId == ECbmModuleId::kRich || detId == ECbmModuleId::kMuch
582  || detId == ECbmModuleId::kTrd || detId == ECbmModuleId::kTof);
583  Int_t nofBinsStation = 100;
584  Double_t minStation = -0.5;
585  Double_t maxStation = 99.5;
586  Int_t nofBins = 100;
587  Double_t min = -0.5;
588  Double_t max = 99.5;
589  Int_t nofBinsSigma = 100;
590  Double_t minSigma = -0.5;
591  Double_t maxSigma = 9.5;
592  Int_t nofBinsResidual = 200;
593  Double_t minResidual = -10.0;
594  Double_t maxResidual = 10.0;
595  Double_t minResidualT = -100.0;
596  Double_t maxResidualT = 100.0;
597  Int_t nofBinsPull = 100;
598  Double_t minPull = -5.0;
599  Double_t maxPull = 5.0;
600 
601  string nameH1 = "hpa_" + detName + "Cluster_NofDigisInCluster_H1";
602  fHM->Create1<TH1F>(
603  nameH1, nameH1 + ";Number of digis;Yield", nofBins, min, max);
604  string nameH2 = "hpa_" + detName + "Cluster_NofDigisInCluster_H2";
605  fHM->Create2<TH2F>(nameH2,
606  nameH2 + ";Station;Number of digis;Yield",
607  nofBinsStation,
608  minStation,
609  max,
610  nofBins,
611  min,
612  max);
613  nameH1 = "hpa_" + detName + "Cluster_NofPointsInCluster_H1";
614  fHM->Create1<TH1F>(
615  nameH1, nameH1 + ";Number of points;Yield", nofBins, min, max);
616  nameH2 = "hpa_" + detName + "Cluster_NofPointsInCluster_H2";
617  fHM->Create2<TH2F>(nameH2,
618  nameH2 + ";Station;Number of points;Yield",
619  nofBinsStation,
620  minStation,
621  max,
622  nofBins,
623  min,
624  max);
625  nameH1 = "hpa_" + detName + "Digi_NofPointsInDigi_H1";
626  fHM->Create1<TH1F>(
627  nameH1, nameH1 + ";Number of points;Yield", nofBins, min, max);
628  nameH2 = "hpa_" + detName + "Digi_NofPointsInDigi_H2";
629  fHM->Create2<TH2F>(nameH2,
630  nameH2 + ";Station;Number of points;Yield",
631  nofBinsStation,
632  minStation,
633  maxStation,
634  nofBins,
635  min,
636  max);
637  nameH1 = "hpa_" + detName + "Hit_NofPointsInHit_H1";
638  fHM->Create1<TH1F>(
639  nameH1, nameH1 + ";Number of points;Yield", nofBins, min, max);
640  nameH2 = "hpa_" + detName + "Hit_NofPointsInHit_H2";
641  fHM->Create2<TH2F>(nameH2,
642  nameH2 + ";Station;Number of points;Yield",
643  nofBinsStation,
644  minStation,
645  max,
646  nofBins,
647  min,
648  max);
649  nameH1 = "hpa_" + detName + "Hit_SigmaX_H1";
650  fHM->Create1<TH1F>(nameH1,
651  nameH1 + ";#sigma_{X} [cm];Yield",
652  nofBinsSigma,
653  minSigma,
654  maxSigma);
655  nameH2 = "hpa_" + detName + "Hit_SigmaX_H2";
656  fHM->Create2<TH2F>(nameH2,
657  nameH2 + ";Station;#sigma_{X} [cm];Yield",
658  nofBinsStation,
659  minStation,
660  maxStation,
661  nofBinsSigma,
662  minSigma,
663  maxSigma);
664  nameH1 = "hpa_" + detName + "Hit_SigmaY_H1";
665  fHM->Create1<TH1F>(nameH1,
666  nameH1 + ";#sigma_{Y} [cm];Yield",
667  nofBinsSigma,
668  minSigma,
669  maxSigma);
670  nameH2 = "hpa_" + detName + "Hit_SigmaY_H2";
671  fHM->Create2<TH2F>(nameH2,
672  nameH2 + ";Station;#sigma_{Y} [cm];Yield",
673  nofBinsStation,
674  minStation,
675  maxStation,
676  nofBinsSigma,
677  minSigma,
678  maxSigma);
679 
680  // Residual and pull histograms
681  nameH2 = "hrp_" + detName + "_ResidualX_H2";
682  fHM->Create2<TH2F>(nameH2,
683  nameH2 + ";Station;Residual X [cm];Yield",
684  nofBinsStation,
685  minStation,
686  maxStation,
687  nofBinsResidual,
688  minResidual,
689  maxResidual);
690  nameH2 = "hrp_" + detName + "_ResidualY_H2";
691  fHM->Create2<TH2F>(nameH2,
692  nameH2 + ";Station;Residual Y [cm];Yield",
693  nofBinsStation,
694  minStation,
695  maxStation,
696  nofBinsResidual,
697  minResidual,
698  maxResidual);
699  nameH2 = "hrp_" + detName + "_ResidualT_H2";
700  fHM->Create2<TH2F>(nameH2,
701  nameH2 + ";Station;Residual T [ns];Yield",
702  nofBinsStation,
703  minStation,
704  maxStation,
705  nofBinsResidual,
706  minResidualT,
707  maxResidualT);
708  nameH2 = "hrp_" + detName + "_PullX_H2";
709  fHM->Create2<TH2F>(nameH2,
710  nameH2 + ";Station;Pull X;Yield",
711  nofBinsStation,
712  minStation,
713  maxStation,
714  nofBinsPull,
715  minPull,
716  maxPull);
717  nameH2 = "hrp_" + detName + "_PullY_H2";
718  fHM->Create2<TH2F>(nameH2,
719  nameH2 + ";Station;Pull Y;Yield",
720  nofBinsStation,
721  minStation,
722  maxStation,
723  nofBinsPull,
724  minPull,
725  maxPull);
726  nameH2 = "hrp_" + detName + "_PullT_H2";
727  fHM->Create2<TH2F>(nameH2,
728  nameH2 + ";Station;Pull T;Yield",
729  nofBinsStation,
730  minStation,
731  maxStation,
732  nofBinsPull,
733  minPull,
734  maxPull);
735 }
736 
738  const string& detName,
739  const string& parameter,
740  const string& xTitle,
741  Int_t nofBins,
742  Double_t minBin,
743  Double_t maxBin) {
744  if (!fDet.GetDet(detId)) return;
745  vector<string> types = list_of("Acc")("Rec")("Eff")("Clone")("CloneProb");
746  vector<string> cat = list_of("All");
747  for (Int_t iCat = 0; iCat < cat.size(); iCat++) {
748  for (Int_t iType = 0; iType < types.size(); iType++) {
749  string yTitle =
750  (types[iType] == "Eff")
751  ? "Efficiency [%]"
752  : (types[iType] == "CloneProb") ? "Probability [%]" : "Counter";
753  string histName = "hhe_" + detName + "_" + cat[iCat] + "_" + types[iType]
754  + "_" + parameter;
755  string histTitle = histName + ";" + xTitle + ";" + yTitle;
756  fHM->Add(
757  histName,
758  new TH1F(histName.c_str(), histTitle.c_str(), nofBins, minBin, maxBin));
759  }
760  }
761 }
762 
CbmMuchLayerSide.h
CbmMuchModule.h
CbmMatch::GetMatchedLink
const CbmLink & GetMatchedLink() const
Definition: CbmMatch.h:37
CbmHistManager::Exists
Bool_t Exists(const std::string &name) const
Check existence of histogram in manager.
Definition: CbmHistManager.h:303
CbmMCDataManager::GetObject
CbmMCDataObject * GetObject(const char *name)
Definition: CbmMCDataManager.cxx:137
CbmLitClusteringQa::fTrdClusters
TClonesArray * fTrdClusters
CbmTrdPoint.
Definition: CbmLitClusteringQa.h:163
CbmMatch
Definition: CbmMatch.h:22
CbmMCDataManager.h
CbmMuchDigi.h
CbmLitClusteringQa::fMuchPixelHits
TClonesArray * fMuchPixelHits
CbmMuchCluster.
Definition: CbmLitClusteringQa.h:158
CbmLitClusteringQa::ProcessDigis
void ProcessDigis(const string &detName)
Definition: CbmLitClusteringQa.cxx:237
CbmLitClusteringQa::fDet
CbmLitDetectorSetup fDet
Definition: CbmLitClusteringQa.h:135
CbmHistManager::WriteToFile
void WriteToFile()
Write all histograms to current opened file.
Definition: core/base/CbmHistManager.cxx:103
CbmTrdAddress.h
Helper class to convert unique channel ID back and forth.
CbmPixelHit::GetX
Double_t GetX() const
Definition: CbmPixelHit.h:83
CbmMatch::GetNofLinks
Int_t GetNofLinks() const
Definition: CbmMatch.h:38
CbmLitClusteringQa::CbmLitClusteringQa
CbmLitClusteringQa()
Constructor.
Definition: CbmLitClusteringQa.cxx:67
CbmPixelHit::GetY
Double_t GetY() const
Definition: CbmPixelHit.h:84
CbmLitClusteringQa::CreateNofObjectsHistograms
void CreateNofObjectsHistograms(ECbmModuleId detId, const string &detName)
Definition: CbmLitClusteringQa.cxx:498
CbmStsSetup.h
CbmPixelHit::GetDx
Double_t GetDx() const
Definition: CbmPixelHit.h:85
CbmMCDataArray::Size
Int_t Size(Int_t fileNumber, Int_t eventNumber)
Definition: CbmMCDataArray.cxx:133
CbmLitClusteringQa::fTrdHitMatches
TClonesArray * fTrdHitMatches
CbmMatch (cluster)
Definition: CbmLitClusteringQa.h:166
CbmLitClusteringQa::fHM
CbmHistManager * fHM
Definition: CbmLitClusteringQa.h:133
CbmLitClusteringQa::fStsHits
TClonesArray * fStsHits
CbmStsCluster.
Definition: CbmLitClusteringQa.h:149
CbmHistManager::Create2
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...
Definition: CbmHistManager.h:104
CbmLitClusteringQaReport
Simulation report for clustering QA.
Definition: CbmLitClusteringQaReport.h:21
CbmLitClusteringQa::CreateClusterParametersHistograms
void CreateClusterParametersHistograms(ECbmModuleId detId, const string &detName)
Definition: CbmLitClusteringQa.cxx:576
CbmLitClusteringQa::fTrdClusterMatches
TClonesArray * fTrdClusterMatches
CbmTrdHit.
Definition: CbmLitClusteringQa.h:165
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmLitClusteringQa::~CbmLitClusteringQa
virtual ~CbmLitClusteringQa()
Destructor.
Definition: CbmLitClusteringQa.cxx:69
CbmLitClusteringQa::ProcessPoints
void ProcessPoints(Int_t iEvent, CbmMCDataArray *points, const string &detName, ECbmModuleId detId)
Definition: CbmLitClusteringQa.cxx:221
CbmMCDataManager::InitBranch
CbmMCDataArray * InitBranch(const char *name)
Definition: CbmMCDataManager.cxx:106
CbmLitClusteringQa::fMuchClusters
TClonesArray * fMuchClusters
CbmMuchPoint.
Definition: CbmLitClusteringQa.h:157
CbmStsSetup::Instance
static CbmStsSetup * Instance()
Definition: CbmStsSetup.cxx:293
CbmLitClusteringQa::GetStationId
Int_t GetStationId(Int_t address, ECbmModuleId detId)
Definition: CbmLitClusteringQa.cxx:209
CbmHistManager::H2
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
Definition: CbmHistManager.h:190
CbmMCDataArray.h
ECbmModuleId::kMvd
@ kMvd
Micro-Vertex Detector.
CbmLitClusteringQa::ReadDataBranches
void ReadDataBranches()
Read data branches.
Definition: CbmLitClusteringQa.cxx:165
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmTrdAddress::GetLayerId
static UInt_t GetLayerId(UInt_t address)
Return layer ID from address.
Definition: CbmTrdAddress.h:69
CbmMCDataArray
Access to a MC data branch for time-based analysis.
Definition: CbmMCDataArray.h:35
CbmDigiManager::GetNofDigis
static Int_t GetNofDigis(ECbmModuleId systemId)
Definition: CbmDigiManager.cxx:62
CbmMuchGeoScheme::Init
void Init(TObjArray *stations, Int_t flag)
Definition: CbmMuchGeoScheme.cxx:121
CbmLitClusteringQa::fEventList
CbmMCEventList * fEventList
Definition: CbmLitClusteringQa.h:174
ECbmModuleId::kTof
@ kTof
Time-of-flight Detector.
CbmLitClusteringQa::FillEventCounterHistograms
void FillEventCounterHistograms(Int_t iEvent)
Definition: CbmLitClusteringQa.cxx:305
CbmMatch.h
CbmPixelHit::GetDy
Double_t GetDy() const
Definition: CbmPixelHit.h:86
CbmHistManager.h
Histogram manager.
CbmDigiManager::IsPresent
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
Definition: CbmDigiManager.cxx:112
CbmHit::GetTimeError
Double_t GetTimeError() const
Definition: CbmHit.h:76
CbmMuchModuleGemRadial.h
CbmLitClusteringQa::fMvdClusters
TClonesArray * fMvdClusters
CbmMvdPoint.
Definition: CbmLitClusteringQa.h:142
CbmCluster::GetNofDigis
Int_t GetNofDigis() const
Number of digis in cluster.
Definition: CbmCluster.h:69
CbmDigiManager::IsMatchPresent
static Bool_t IsMatchPresent(ECbmModuleId systemId)
Presence of a digi match branch.
Definition: CbmDigiManager.cxx:104
min
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:33
CbmMuchCluster.h
Data container for MUCH clusters.
CbmLitClusteringQa::CreateHistograms
void CreateHistograms()
Definition: CbmLitClusteringQa.cxx:465
CbmLitClusteringQa.h
FairTask for clustering performance calculation.
CbmLitClusteringQa::fStsHitMatches
TClonesArray * fStsHitMatches
CbmMatch (cluster)
Definition: CbmLitClusteringQa.h:151
CbmTrdDigi.h
CbmStsDigi.h
CbmLitClusteringQa::fTrdHits
TClonesArray * fTrdHits
CbmTrdCluster.
Definition: CbmLitClusteringQa.h:164
CbmHit.h
CbmHistManager
Histogram manager.
Definition: CbmHistManager.h:41
CbmMuchPoint.h
CbmLitClusteringQa::fStsPoints
CbmMCDataArray * fStsPoints
CbmMvdHit.
Definition: CbmLitClusteringQa.h:145
CbmLitClusteringQa::fStsClusters
TClonesArray * fStsClusters
CbmStsPoint.
Definition: CbmLitClusteringQa.h:147
CbmLitClusteringQa::fMvdHits
TClonesArray * fMvdHits
CbmMvdCluster.
Definition: CbmLitClusteringQa.h:143
ClassImp
ClassImp(CbmLitClusteringQa)
CbmDigiManager::Get
const Digi * Get(Int_t index) const
Get a digi object.
Definition: CbmDigiManager.h:52
CbmLitClusteringQa::fTrdPoints
CbmMCDataArray * fTrdPoints
CbmMatch (hit)
Definition: CbmLitClusteringQa.h:162
CbmStsSetup::GetStationNumber
Int_t GetStationNumber(Int_t address)
Definition: CbmStsSetup.cxx:187
CbmHit::GetTime
Double_t GetTime() const
Definition: CbmHit.h:75
CbmMuchGeoScheme::Instance
static CbmMuchGeoScheme * Instance()
Definition: CbmMuchGeoScheme.cxx:113
CbmLitClusteringQa
Definition: CbmLitClusteringQa.h:25
CbmLitClusteringQa::Init
virtual InitStatus Init()
Derived from FairTask.
Definition: CbmLitClusteringQa.cxx:73
CbmHit::GetAddress
Int_t GetAddress() const
Definition: CbmHit.h:73
CbmMCEventList::GetEventTime
Double_t GetEventTime(UInt_t event, UInt_t file)
Event start time.
Definition: CbmMCEventList.cxx:86
CbmLitDetectorSetup::GetDet
bool GetDet(ECbmModuleId detId) const
Return detector presence in setup.
Definition: CbmLitDetectorSetup.cxx:27
CbmSimulationReport::Create
void Create(CbmHistManager *histManager, const std::string &outputDir)
Main function which creates report data.
CbmDigiManager::GetMatch
const CbmMatch * GetMatch(ECbmModuleId systemId, UInt_t index) const
Get a match object.
Definition: CbmDigiManager.cxx:54
CbmMuchSector.h
CbmHistManager::Create1
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...
Definition: CbmHistManager.h:81
CbmCluster::GetAddress
Int_t GetAddress() const
Definition: CbmCluster.h:90
ECbmModuleId::kRich
@ kRich
Ring-Imaging Cherenkov Detector.
CbmMCEventList
Container class for MC events with number, file and start time.
Definition: CbmMCEventList.h:38
CbmLitClusteringQa::InitMuchGeoScheme
void InitMuchGeoScheme(const string &digiFileName)
Definition: CbmLitClusteringQa.cxx:153
CbmLitClusteringQa::fMvdPoints
CbmMCDataArray * fMvdPoints
CbmMCTrack.
Definition: CbmLitClusteringQa.h:141
CbmStsSetup::Init
Bool_t Init(const char *geometryFile=nullptr)
Initialise the setup.
Definition: CbmStsSetup.cxx:201
CbmHistManager::H1
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
Definition: CbmHistManager.h:170
CbmMuchSectorRadial.h
CbmMuchLayer.h
CbmStsSetup
Class representing the top level of the STS setup.
Definition: CbmStsSetup.h:39
CbmLitClusteringQa::ProcessHits
void ProcessHits(const TClonesArray *hits, const TClonesArray *hitMatches, const string &detName, ECbmModuleId detId)
Definition: CbmLitClusteringQa.cxx:279
CbmLitClusteringQa::CreateHitEfficiencyHistograms
void CreateHitEfficiencyHistograms(ECbmModuleId detId, const string &detName, const string &parameter, const string &xTitle, Int_t nofBins, Double_t minBin, Double_t maxBin)
Definition: CbmLitClusteringQa.cxx:737
CbmMCDataManager
Task class creating and managing CbmMCDataArray objects.
Definition: CbmMCDataManager.h:27
ECbmModuleId::kTrd
@ kTrd
Transition Radiation Detector.
CbmMuchPad.h
points
TClonesArray * points
Definition: Analyze_matching.h:18
CbmMCTrack.h
CbmTimeSlice
Bookkeeping of time-slice content.
Definition: CbmTimeSlice.h:29
CbmDigiManager.h
CbmCluster
Base class for cluster objects.
Definition: CbmCluster.h:26
CbmMuchPadRadial.h
CbmLitClusteringQaReport.h
Simulation report for clustering QA.
CbmLitClusteringQa::fTimeSlice
CbmTimeSlice * fTimeSlice
Definition: CbmLitClusteringQa.h:173
CbmMuchPixelHit.h
Class for pixel hits in MUCH detector.
CbmLitClusteringQa::fMuchClusterMatches
TClonesArray * fMuchClusterMatches
CbmMuchPixelHit.
Definition: CbmLitClusteringQa.h:159
hits
static vector< vector< QAHit > > hits
Definition: CbmTofHitFinderTBQA.cxx:114
CbmPixelHit
Definition: CbmPixelHit.h:21
CbmStsAddress.h
CbmSimulationReport
Base class for simulation reports.
Definition: CbmSimulationReport.h:28
ECbmModuleId::kMuch
@ kMuch
Muon detection system.
CbmMuchDigiMatch.h
CbmLitClusteringQa::fRichHits
TClonesArray * fRichHits
CbmRichPoint.
Definition: CbmLitClusteringQa.h:154
CbmCluster.h
Base class for cluster objects.
CbmMuchGeoScheme.h
CbmLitClusteringQa::Exec
virtual void Exec(Option_t *opt)
Derived from FairTask.
Definition: CbmLitClusteringQa.cxx:92
CbmLitClusteringQa::fStsClusterMatches
TClonesArray * fStsClusterMatches
CbmStsHit array.
Definition: CbmLitClusteringQa.h:150
CbmLitClusteringQa::fMuchPoints
CbmMCDataArray * fMuchPoints
CbmRichHit.
Definition: CbmLitClusteringQa.h:156
max
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:36
CbmLitClusteringQa::fMuchPixelHitMatches
TClonesArray * fMuchPixelHitMatches
CbmMatch array.
Definition: CbmLitClusteringQa.h:160
CbmLitClusteringQa::FillResidualAndPullHistograms
void FillResidualAndPullHistograms(CbmMCDataArray *points, const TClonesArray *hits, const TClonesArray *hitMatches, const string &detName, ECbmModuleId detId)
Definition: CbmLitClusteringQa.cxx:375
ECbmModuleId::kSts
@ kSts
Silicon Tracking System.
CbmLitClusteringQa::fRichPoints
CbmMCDataArray * fRichPoints
CbmMatch (hit)
Definition: CbmLitClusteringQa.h:153
CbmMuchStation.h
CbmLitClusteringQa::fTofHits
TClonesArray * fTofHits
CbmTofPoint.
Definition: CbmLitClusteringQa.h:169
CbmLitClusteringQa::Finish
virtual void Finish()
Derived from FairTask.
Definition: CbmLitClusteringQa.cxx:139
CbmLitClusteringQa::ProcessClusters
void ProcessClusters(const TClonesArray *clusters, const TClonesArray *clusterMatches, const string &detName, ECbmModuleId detId)
Definition: CbmLitClusteringQa.cxx:253
CbmLitClusteringQa::fMCTracks
CbmMCDataArray * fMCTracks
Interface to digi data.
Definition: CbmLitClusteringQa.h:139
CbmLitClusteringQa::FillHitEfficiencyHistograms
void FillHitEfficiencyHistograms(Int_t iEvent, CbmMCDataArray *points, const TClonesArray *hits, const TClonesArray *hitMatches, const string &detName, ECbmModuleId detId)
Definition: CbmLitClusteringQa.cxx:428
CbmLitClusteringQa::fMuchDigiFileName
string fMuchDigiFileName
CbmTofHit.
Definition: CbmLitClusteringQa.h:171
CbmStsSetup::IsInit
Bool_t IsInit() const
Initialisation status for sensor parameters.
Definition: CbmStsSetup.h:124
CbmLitClusteringQa::fTofPoints
CbmMCDataArray * fTofPoints
CbmMatch (hit)
Definition: CbmLitClusteringQa.h:168
CbmMuchModuleGem.h
CbmLitClusteringQa::fOutputDir
std::string fOutputDir
Definition: CbmLitClusteringQa.h:134
CbmLitClusteringQa::fDigiMan
CbmDigiManager * fDigiMan
Definition: CbmLitClusteringQa.h:136
CbmLitDetectorSetup::DetermineSetup
void DetermineSetup()
Determines detector presence using TGeoManager.
Definition: CbmLitDetectorSetup.cxx:79
CbmHistManager::Add
void Add(const std::string &name, TNamed *object)
Add new named object to manager.
Definition: CbmHistManager.h:58