CbmRoot
CbmTrdHitRateFastQa.cxx
Go to the documentation of this file.
1 #include "CbmTrdHitRateFastQa.h"
2 
3 #include "CbmTrdAddress.h"
4 #include "CbmTrdGeoHandler.h"
5 #include "CbmTrdParAsic.h"
6 #include "CbmTrdParModDigi.h"
7 #include "CbmTrdParModGeo.h"
8 #include "CbmTrdParSetAsic.h"
9 #include "CbmTrdParSetDigi.h"
10 #include "CbmTrdParSetGeo.h"
11 #include "CbmTrdRadiator.h"
12 
13 #include "CbmTrdUtils.h"
14 
15 #include "FairLogger.h"
16 #include "FairRootManager.h"
17 #include "FairRunAna.h"
18 #include "FairRuntimeDb.h"
19 
20 #include "TBox.h"
21 #include "TCanvas.h"
22 #include "TClonesArray.h"
23 #include "TColor.h"
24 #include "TGeoManager.h"
25 #include "TH2.h"
26 #include "TImage.h"
27 #include "TLine.h"
28 #include "TMath.h"
29 #include "TPRegexp.h"
30 #include "TPolyMarker.h"
31 #include "TStyle.h"
32 #include <TFile.h>
33 
34 #include "Riostream.h"
35 #include <cmath>
36 #include <fstream>
37 #include <iostream>
38 #include <vector>
39 
40 #define winsize 6000 // 1500 // 5500 // 6000
41 
42 using std::cin;
43 using std::cout;
44 using std::endl;
45 using std::flush;
46 using std::ios;
47 using std::pair;
48 using std::setfill;
49 using std::setiosflags;
50 using std::setprecision;
51 using std::setw;
52 using std::vector;
53 
54 // ---- Default constructor -------------------------------------------
56  : CbmTrdHitRateFastQa("TrdHitRateFastQa", "") {}
57 // --------------------------------------------------------------------
58 
59 // ---- Constructor ----------------------------------------------------
60 CbmTrdHitRateFastQa::CbmTrdHitRateFastQa(const char* name, const char*)
61  : FairTask(name)
62  , myfile()
63  , nTotalAsics(0)
64  , nTotalOptLinks(0)
65  , trdTotalDataRate(0)
66  , h1DataModule(NULL)
67  , h1OptLinksModule(NULL)
68  , Digicounter(-1)
69  , tFile(NULL)
70  , fDraw(kFALSE)
71  , fPlane(-1)
72  , fStation(-1)
73  , fLayer(-1)
74  , fCol_mean(-1)
75  , fCol_in(-1)
76  , fCol_out(-1)
77  , fRow_mean(-1)
78  , fRow_in(-1)
79  , fRow_out(-1)
80  , fModuleID(-1)
81  , fMCindex(-1)
82  , local_meanLL()
83  , local_meanC()
84  , global_meanLL()
85  , global_meanC()
86  , local_inLL()
87  , local_inC()
88  , global_inLL()
89  , global_inC()
90  , local_outLL()
91  , local_outC()
92  , global_outLL()
93  , global_outC()
94  , fx_in(0.)
95  , fx_out(0.)
96  , fy_in(0.)
97  , fy_out(0.)
98  , fz_in(0.)
99  , fz_out(0.)
100  , fx_mean(0.)
101  , fy_mean(0.)
102  , fz_mean(0.)
103  , fSector(-1)
104  , padsize()
105  , modulesize()
106  , fELoss(-1.)
107  , fELossdEdX(-1.)
108  , fELossTR(-1.)
109  , fPosXLL(0.)
110  , fPosYLL(0.)
111  , fPadPosxLL(0.)
112  , fPadPosyLL(0.)
113  , fPadPosxC(0.)
114  , fPadPosyC(0.)
115  , fDeltax(0.)
116  , fDeltay(0.)
117  , fPadCharge()
118  , fPRFHitPositionLL(0.)
119  , fPRFHitPositionC(0.)
120  , fEfficiency(1.)
121  , fTrdPoints(NULL)
122  , fDigiCollection(NULL)
123  , fDigiMatchCollection(NULL)
124  , fMCStacks(NULL)
125  , fAsicPar(NULL)
126  , fDigiPar(NULL)
127  , fGeoPar(NULL)
128  , fGeoHandler(new CbmTrdGeoHandler())
129  , fColors()
130  , fZLevel()
131  , fBitPerHit(0)
132  , fDigiMap()
133  , fDigiMapIt() {}
134 // --------------------------------------------------------------------
135 
136 // ---- Destructor ----------------------------------------------------
138  // FairRootManager *ioman =FairRootManager::Instance();
139  //ioman->Write();
140  //fDigiCollection->Clear("C");
141  //delete fDigiCollection;
142  //fDigiMatchCollection->Clear("C");
143  //delete fDigiMatchCollection;
144 }
145 // --------------------------------------------------------------------
146 
147 // ---- Initialisation ----------------------------------------------
149  cout << " * CbmTrdHitRateFastQa * :: SetParContainers() " << endl;
150 
151 
152  // Get Base Container
153  FairRunAna* ana = FairRunAna::Instance();
154  FairRuntimeDb* rtdb = ana->GetRuntimeDb();
155 
156  fAsicPar = (CbmTrdParSetAsic*) (rtdb->getContainer("CbmTrdParSetAsic"));
157  fDigiPar = (CbmTrdParSetDigi*) (rtdb->getContainer("CbmTrdParSetDigi"));
158  fGeoPar = (CbmTrdParSetGeo*) (rtdb->getContainer("CbmTrdParSetGeo"));
159 }
160 // --------------------------------------------------------------------
161 
162 // ---- ReInit -------------------------------------------------------
164 
165  cout << " * CbmTrdHitRateFastQa * :: ReInit() " << endl;
166 
167 
168  FairRunAna* ana = FairRunAna::Instance();
169  FairRuntimeDb* rtdb = ana->GetRuntimeDb();
170 
171  fAsicPar = (CbmTrdParSetAsic*) (rtdb->getContainer("CbmTrdParSetAsic"));
172  fDigiPar = (CbmTrdParSetDigi*) (rtdb->getContainer("CbmTrdParSetDigi"));
173  fGeoPar = (CbmTrdParSetGeo*) (rtdb->getContainer("CbmTrdParSetGeo"));
174 
175  return kSUCCESS;
176 }
177 // --------------------------------------------------------------------
178 
179 // ---- Init ----------------------------------------------------------
181 
182  cout << " * CbmTrdHitRate * :: Init() " << endl;
183 
184  FairRootManager* ioman = FairRootManager::Instance();
185  if (!ioman) Fatal("Init", "No FairRootManager");
186 
187  fTrdPoints = (TClonesArray*) ioman->GetObject("TrdPoint");
188  if (!fTrdPoints) {
189  cout << "-W CbmTrdCluster::Init: No TrdPoints array!" << endl;
190  cout << " Task will be inactive" << endl;
191  return kERROR;
192  }
193 
194  fMCStacks = (TClonesArray*) ioman->GetObject("MCTrack");
195  if (!fMCStacks) {
196  cout << "-W CbmTrdCluster::Init: No MCTrack array!" << endl;
197  cout << " Task will be inactive" << endl;
198  return kERROR;
199  }
200  /*
201  fDigiCollection = new TClonesArray("CbmTrdDigi", 100);
202  ioman->Register("TrdDigi","TRD Digis",fDigiCollection,IsOutputBranchPersistent("TrdDigi"));
203 
204  fDigiMatchCollection = new TClonesArray("CbmTrdDigiMatch", 100);
205  ioman->Register("TrdDigiMatch","TRD Digis",fDigiMatchCollection,IsOutputBranchPersistent("TrdDigiMatch"));
206  */
207  fGeoHandler->Init();
208 
209  //fRadiators->Init();
210 
211  return kSUCCESS;
212 }
213 // --------------------------------------------------------------------
214 
215 
216 // ---- Exec ----------------------------------------------------------
217 void CbmTrdHitRateFastQa::Exec(Option_t*) {
218  myfile.open("hits_per_asic.txt", std::fstream::out);
219  myfile << "#" << endl;
220  myfile << "## TRD data per ASIC" << endl;
221  myfile << "#" << endl;
222  myfile << "#" << endl;
223  myfile << "#--------------------------" << endl;
224 
225  fBitPerHit =
226  112
227  * 1.5; // (112 + 4*16) * 10 / 8.; // 6 time samples, 8b/10b encoding, CBMnet header
228  // fBitPerHit = 220; // (112 + 4*16) * 10 / 8.; // 6 time samples, 8b/10b encoding, CBMnet header
229  // fBitPerHit = 112; // 6 time samples 3 + (9 * 6 + 3) / 15 = 7 words = 7 * 16 bit = 112 bits
230 
231  //TStyle::SetNumberContours(99);
232  gStyle->SetNumberContours(99);
233  //TH2::SetContour(99);
234  /*
235  const Int_t Number = 11;
236  Double_t r[Number] = {1.00, 0.50, 0.00, 0.00, 0.00, 0.00, 0.00, 0.50, 1.00, 0.50, 1.00};
237  Double_t g[Number] = {0.00, 0.00, 0.00, 0.50, 1.00, 1.00, 1.00, 1.00, 1.00, 0.50, 1.00};
238  Double_t b[Number] = {1.00, 1.00, 1.00, 1.00, 1.00, 0.50, 0.00, 0.00, 0.00, 0.50, 1.00};
239  Double_t length[Number] = {0.00, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 1.00};
240  Int_t nb = 99;
241  Int_t a = TColor::CreateGradientColorTable(Number,length,r,g,b,nb);
242  */
243  printf("Introduction:\n");
244  // HitRateGeoPara2 *GeoPara = new HitRateGeoPara2;
245  // Bool_t Lines;
246  // Bool_t Fast = true; // false; // true; // false; // will not fill the root file (in Histo)!!
247  // Bool_t firstLayer = false;
248  fDraw = true; // false;
249  Double_t ZRangeL = 1;
250  Double_t ZRangeU = 1e05;
251  Double_t mm2bin = 2.5; // 20.0; // 10.0; // 5.0; // 2.5;
252 
253  fStation = 0;
254  fLayer = 0;
255  tFile = new TFile(
256  "CbmTrdHitRateFastQa.root", "RECREATE", " ROOT file with histograms");
257 
258  Char_t name[50];
259  Char_t title[50];
260 
261 
262  sprintf(name, "HA_S%d_L%d", fStation, fLayer);
263  // sprintf(title,"DataAsic_Station %d, Layer %d",fStation,fLayer);
264  sprintf(title, "Data_per_Asic");
265  // TH1F* h1HitAsic = new TH1F(name,title,50*fBitPerHit,1,10*fBitPerHit);
266  // TH1F* h1HitAsic = new TH1F(name,title,1000,1,2000); // Mbit
267 
268  // set even bin size on logx scale
269  const Int_t anbins = 100;
270  Double_t axmin = 1; // Mbit
271  Double_t axmax = 2000; // Mbit
272  Double_t alogxmin = TMath::Log10(axmin);
273  Double_t alogxmax = TMath::Log10(axmax);
274  Double_t abinwidth = (alogxmax - alogxmin) / anbins;
275  Double_t axbins[anbins + 1];
276  axbins[0] = axmin;
277  for (Int_t i = 1; i <= anbins; i++) {
278  axbins[i] = axmin + TMath::Power(10, alogxmin + i * abinwidth);
279  }
280  TH1F* h1HitAsic = new TH1F(name, title, anbins, axbins); // Mbit
281 
282  if (fBitPerHit == 1.)
283  h1HitAsic->SetXTitle("Hits/Asic [Hz]");
284  else
285  h1HitAsic->SetXTitle("Data/32ch Asic [Mbit/s]");
286  h1HitAsic->SetYTitle("count");
287  // h1HitAsic->GetYaxis()->SetRangeUser(0,20);
288 
289  sprintf(name, "HM_S%d_L%d", fStation, fLayer);
290  // sprintf(title,"DataModule_Station %d, Layer %d",fStation,fLayer);
291  sprintf(title, "Data_per_Module");
292  // h1DataModule = new TH1F(name,title,50*fBitPerHit,10,100*10*fBitPerHit);
293  // h1DataModule = new TH1F(name,title,1000,10,100*2000);
294 
295  // set even bin size on logx scale
296  const Int_t bnbins = 100;
297  Double_t bxmin = 10; // Mbit
298  Double_t bxmax = 100 * 2000; // Mbit
299  Double_t blogxmin = TMath::Log10(bxmin);
300  Double_t blogxmax = TMath::Log10(bxmax);
301  Double_t bbinwidth = (blogxmax - blogxmin) / bnbins;
302  Double_t bxbins[bnbins + 1];
303  bxbins[0] = bxmin;
304  for (Int_t i = 1; i <= bnbins; i++) {
305  bxbins[i] = bxmin + TMath::Power(10, blogxmin + i * bbinwidth);
306  }
307  h1DataModule = new TH1F(name, title, bnbins, bxbins); // Mbit
308 
309  if (fBitPerHit == 1.)
310  h1DataModule->SetXTitle("Hits/Module [Hz]");
311  else
312  h1DataModule->SetXTitle("Data/Module [Mbit/s]");
313  h1DataModule->SetYTitle("count");
314  // h1DataModule->GetYaxis()->SetRangeUser(0,20);
315 
316  sprintf(name, "HO_S%d_L%d", fStation, fLayer);
317  // sprintf(title,"OptLinksModule_Station %d, Layer %d",fStation,fLayer);
318  sprintf(title, "5_Gbps_optical_links_per_Module");
319  h1OptLinksModule = new TH1F(name, title, 20, 0.5, 20.5);
320  h1OptLinksModule->SetXTitle("optical links");
321  h1OptLinksModule->SetYTitle("count");
322  // h1OptLinksModule->GetYaxis()->SetRangeUser(0,20);
323 
324  TH1F* h1HitPad = NULL;
325  TH2F* h2Layer = NULL;
326  TH2F* h2Topview[3] = {NULL, NULL, NULL};
327  TCanvas* c1 = NULL;
328  TCanvas* c3 = NULL;
329  TCanvas* c2 = NULL;
330  TCanvas* c0 = NULL;
331  if (fDraw) {
332  c0 = new TCanvas("c0", "c0", 1800, 450);
333  c0->Divide(3, 1);
334  }
335  const Int_t z_cave = 12000;
336  h2Topview[0] = new TH2F("TopView",
337  "TopView",
338  int(2 * winsize / mm2bin),
339  -winsize,
340  winsize,
341  int(z_cave / mm2bin),
342  0,
343  z_cave);
344  h2Topview[0]->SetXTitle("x-Coordinate [mm]");
345  h2Topview[0]->SetYTitle("z-Coordinate [mm]");
346  h2Topview[0]->SetZTitle("#");
347  h2Topview[1] = new TH2F("FrontView",
348  "FrontView",
349  int(2 * winsize / mm2bin),
350  -winsize,
351  winsize,
352  int(2 * winsize / mm2bin),
353  -winsize,
354  winsize);
355  h2Topview[1]->SetXTitle("x-Coordinate [mm]");
356  h2Topview[1]->SetYTitle("y-Coordinate [mm]");
357  h2Topview[1]->SetZTitle("#");
358  h2Topview[2] = new TH2F("SideView",
359  "SideView",
360  int(z_cave / mm2bin),
361  0,
362  z_cave,
363  int(2 * winsize / mm2bin),
364  -winsize,
365  winsize);
366  h2Topview[2]->SetXTitle("z-Coordinate [mm]");
367  h2Topview[2]->SetYTitle("y-Coordinate [mm]");
368  h2Topview[2]->SetZTitle("#");
369  for (Int_t i = 0; i < 3; i++) {
370  h2Topview[i]->SetContour(99);
371  h2Topview[i]->SetStats(kFALSE);
372  h2Topview[i]->GetXaxis()->SetLabelSize(0.02);
373  h2Topview[i]->GetYaxis()->SetLabelSize(0.02);
374  h2Topview[i]->GetZaxis()->SetLabelSize(0.02);
375  h2Topview[i]->GetXaxis()->SetTitleSize(0.02);
376  h2Topview[i]->GetXaxis()->SetTitleOffset(1.5);
377  h2Topview[i]->GetYaxis()->SetTitleSize(0.02);
378  h2Topview[i]->GetYaxis()->SetTitleOffset(2);
379  h2Topview[i]->GetZaxis()->SetTitleSize(0.02);
380  h2Topview[i]->GetZaxis()->SetTitleOffset(-2);
381  if (fDraw) {
382  c0->cd(i + 1);
383  h2Topview[i]->Draw("colz");
384  }
385  }
386  /*
387  for (Int_t i = 0; i < 8; i++){
388  fColors.push_back(19-i);
389  fZLevel.push_back(ZRangeL + (i+1) * ((ZRangeU - ZRangeL) / 9));
390  printf("%2i %3i %f\n",i,fColors[i],fZLevel[i]);
391  }
392  fColors.push_back(1);
393  fZLevel.push_back(ZRangeL + (9) * ((ZRangeU - ZRangeL) / 9));
394  */
395  for (Int_t i = 0; i < TColor::GetNumberOfColors(); i++) {
396  fColors.push_back(TColor::GetColorPalette(i));
397  fZLevel.push_back(
398  ZRangeL
399  + TMath::Power(10,
400  TMath::Log10(ZRangeU) / TColor::GetNumberOfColors() * i));
401  //fZLevel.push_back(ZRangeL + (i+1) * ((ZRangeU - ZRangeL) / TColor::GetNumberOfColors()));
402  //printf("%2i %3i %f\n",i,TColor::GetColorPalette(i),ZRangeL + (i+1) * ((ZRangeU - ZRangeL) / TColor::GetNumberOfColors()));
403  }
404  //h2Topview->GetZaxis()->SetRangeUser(ZRangeL,ZRangeU);
405  // return;
406 
407  vector<int> Plane01;
408  vector<int> Plane02;
409  vector<int> Plane03;
410  vector<int> Plane04;
411  vector<int> Plane05;
412  vector<int> Plane06;
413  vector<int> Plane07;
414  vector<int> Plane08;
415  vector<int> Plane09;
416  vector<int> Plane10;
417 
418  Int_t ModuleID;
419  // Int_t Sector = 0;
420  const Int_t NofModules = fDigiPar->GetNrOfModules();
421 
422  //const Int_t NofModules = 10; // DE
423  //TH2F *Module[NofModules];
424 
425  for (Int_t i = 0; i < NofModules; i++) {
426 
427  ModuleID = fDigiPar->GetModuleId(i);
428  // CbmTrdParSetAsic *fModuleAsic = (CbmTrdParSetAsic*)fAsicPar->GetModuleSet(ModuleID);
429  // CbmTrdParModDigi *fModuleInfo = (CbmTrdParModDigi*)fDigiPar->GetModulePar(ModuleID);
430  // CbmTrdParModGeo *fModuleGeo = (CbmTrdParModGeo*)fGeoPar->GetModulePar(ModuleID);
431  //printf("%d:\n %.1f %.1f %.1f\n",ModuleID,fModuleInfo->GetX(), fModuleInfo->GetY(),fModuleInfo->GetZ());
432 
433  fPlane = CbmTrdAddress::GetLayerId(ModuleID);
434  fStation = fPlane / 4 + 1; // OK for SIS100 and SIS300
435  fLayer = fPlane % 4 + 1; // OK for SIS100 and SIS300
436 
437  //cout << "module " << i+1 << ": ID " << ModuleID << " - P" << fPlane << " S" << fStation << " L" << fLayer << endl;
438  //printf("module %4i: ID $6i - P%2i S%2i L%2i\n",i+1,ModuleID,fPlane,fStation,fLayer);
439  // fill plane vectors
440  if (fPlane == 0) Plane01.push_back(ModuleID);
441  if (fPlane == 1) Plane02.push_back(ModuleID);
442  if (fPlane == 2) Plane03.push_back(ModuleID);
443  if (fPlane == 3) Plane04.push_back(ModuleID);
444  if (fPlane == 4) Plane05.push_back(ModuleID);
445  if (fPlane == 5) Plane06.push_back(ModuleID);
446  if (fPlane == 6) Plane07.push_back(ModuleID);
447  if (fPlane == 7) Plane08.push_back(ModuleID);
448  if (fPlane == 8) Plane09.push_back(ModuleID);
449  if (fPlane == 9) Plane10.push_back(ModuleID);
450  }
451 
452  vector<vector<int>> LiSi;
453  //LiSi.push_back(Plane01);
454  //LiSi.push_back(Plane02);
455  //LiSi.push_back(Plane05);
456  //LiSi.push_back(Plane06);
457  //LiSi.push_back(Plane09);
458  //LiSi.push_back(Plane10);
459  LiSi.push_back(Plane01);
460  LiSi.push_back(Plane02);
461  LiSi.push_back(Plane03);
462  LiSi.push_back(Plane04);
463  LiSi.push_back(Plane05);
464  LiSi.push_back(Plane06);
465  LiSi.push_back(Plane07);
466  LiSi.push_back(Plane08);
467  LiSi.push_back(Plane09);
468  LiSi.push_back(Plane10);
469 
470  TString OutFile1;
471  TString OutFile2;
472 
473  TImage* Outimage1;
474  TImage* Outimage2;
475 
476  TLine* MaxHitRatePerPad =
477  new TLine(1e05, 0, 1e05, 1e04); // 100.000 hits per pad
478  MaxHitRatePerPad->SetLineColor(2); // make it red
479  MaxHitRatePerPad->SetLineWidth(8); // make it thick
480 
481  /*
482  h2Layer = new TH2F("dummy1","dummy1",1,-0.5,0.5,1,-0.5,0.5);
483  h1HitPad = new TH1F("dummy2","dummy2",1,-0.5,0.5);
484  c1 = new TCanvas("dummy3","dummy3",10,10);
485  c2 = new TCanvas("dummy4","dummy4",10,10);
486  */
487  //**************************************************************************************
488 
489  if ((Int_t) LiSi.size() > 0)
490  for (vector<vector<Int_t>>::size_type j = 0; j < LiSi.size(); j++) {
491  // fix layer number
492  UInt_t nModulesInThisLayer = LiSi[j].size();
493  if (nModulesInThisLayer == 0) break;
494  fPlane = CbmTrdAddress::GetLayerId(LiSi[j][0]);
495  fStation = fPlane / 4 + 1; // OK for SIS100 and SIS300
496  fLayer = fPlane % 4 + 1; // OK for SIS100 and SIS300
497 
498  printf("Station: %i Layer: %i nModules: %i\n",
499  fStation,
500  fLayer,
501  nModulesInThisLayer);
502 
503  h2Topview[0]->Reset();
504  h2Topview[1]->Reset();
505  h2Topview[2]->Reset();
506 
507  OutFile1.Form("pics/HitRateLayerPadView_S%d_L%d.png", fStation, fLayer);
508  OutFile2.Form("pics/HitRateLayerSpectrum_S%d_L%d.png", fStation, fLayer);
509 
510  HistoInit(c1, c2, c3, h2Layer, h1HitPad, ZRangeL, ZRangeU, mm2bin);
511 
512  if (fDraw) {
513  c2->cd(1);
514  MaxHitRatePerPad->Draw("same"); // draw red line
515  }
516  // generate HitPerPadSpectra
517  // generate png files
518  // Lines = false;
519  //c3 = (TCanvas*)c1->Clone("c3");
520  if (nModulesInThisLayer > 0)
521  for (vector<int>::size_type i = 0; i < nModulesInThisLayer; i++) {
522  printf(" ModuleAddress: %i\n", LiSi[j][i]);
523  myfile << "# ModuleAddress: " << LiSi[j][i] << endl;
524  ScanModulePlane(LiSi[j][i], c1, c3, h1HitPad, h1HitAsic);
525  }
526  /*
527  GetModuleInformationFromDigiPar(GeoPara, Fast, Lines, LiSi[j][i], h2Layer ,c1, h1HitPad, c2, h2Topview, c0, mm2bin);
528 
529  if(fDraw)
530  {
531  c1->cd(1)->SetLogz(1);
532  h2Layer->Draw("colz"); // draw layer view
533  }
534 
535  Lines = true;
536  for (vector<int>::size_type i = 0; i < nModulesInThisLayer; i++)
537  ScanModulePlane();
538  GetModuleInformationFromDigiPar(GeoPara, Fast, Lines, LiSi[j][i], h2Layer ,c1, h1HitPad, c2, h2Topview, c0, mm2bin);
539  */
540  if (fDraw) // dump png file for this layer
541  {
542  Outimage1 = TImage::Create();
543  Outimage1->FromPad(c1);
544  Outimage1->WriteImage(OutFile1);
545  OutFile1.ReplaceAll("png", "pdf");
546  c1->SaveAs(OutFile1);
547  OutFile1.ReplaceAll("Pad", "ASIC");
548  if (c1) delete c1;
549  c3->SaveAs(OutFile1);
550  OutFile1.ReplaceAll("pdf", "png");
551  c3->SaveAs(OutFile1);
552  if (c3) delete c3;
553 
554  c2->cd(1);
555  h1HitPad->Draw("same");
556 
557  c2->cd(2);
558  h1HitAsic->Draw();
559  h1HitAsic->Write("", TObject::kOverwrite);
560  c2->Update();
561  TLine* MaxDataRatePerUplink =
562  new TLine(500,
563  0.7 * gPad->GetUymax(),
564  500,
565  gPad->GetUymax()); // 500 Mbit per Uplink
566  // TLine* MaxDataRatePerUplink = new TLine(500,60,500,80); // 500 Mbit per Uplink
567  MaxDataRatePerUplink->SetLineColor(2); // make it red
568  MaxDataRatePerUplink->SetLineWidth(8); // make it thick
569  MaxDataRatePerUplink->Draw("same"); // draw red line
570 
571  c2->cd(3);
572  h1DataModule->Draw();
573  h1DataModule->Write("", TObject::kOverwrite);
574  c2->Update();
575 
576  TLine* MaxDataRatePerOptLink =
577  new TLine(5000,
578  0.7 * gPad->GetUymax(),
579  5000,
580  gPad->GetUymax()); // 500 Mbit per Uplink
581  // TLine* MaxDataRatePerOptLink = new TLine(5000,5,5000,8); // 500 Mbit per Uplink
582  MaxDataRatePerOptLink->SetLineColor(2); // make it red
583  MaxDataRatePerOptLink->SetLineWidth(8); // make it thick
584  MaxDataRatePerOptLink->Draw("same"); // draw red line
585 
586  c2->cd(4);
587  h1OptLinksModule->Draw();
588  h1OptLinksModule->Write("", TObject::kOverwrite);
589 
590  Outimage2 = TImage::Create();
591  Outimage2->FromPad(c2);
592  Outimage2->WriteImage(OutFile2);
593  OutFile1.ReplaceAll("png", "pdf");
594  c2->SaveAs(OutFile2);
595  OutFile1.ReplaceAll("Pad", "ASIC");
596  c2->SaveAs(OutFile2);
597 
598  h1HitAsic->Reset();
599  h1DataModule->Reset();
600  h1OptLinksModule->Reset();
601 
602  if (c2) delete c2;
603  if (Outimage1) delete Outimage1;
604  if (Outimage2) delete Outimage2;
605  }
606  if (h2Layer) delete h2Layer;
607  if (h1HitPad) delete h1HitPad;
608  if (fDraw) c0->Update();
609  }
610  if (fDraw) c0->Update();
611  h1HitAsic->Write("", TObject::kOverwrite);
612 
613  printf(" --------------------------\n");
614  printf(" total number of ASICs : %d\n", nTotalAsics);
615  printf(" total number of optical links: %d\n", nTotalOptLinks);
616  printf(" total TRD data rate : %.2f (Gbit/s)\n",
617  trdTotalDataRate * 1e-3);
618  printf(" --------------------------\n");
619  printf(" --------------------------\n");
620 
621  myfile << "# total number of ASICs: " << nTotalAsics << endl;
622  myfile << "#--------------------------" << endl;
623  myfile << "#--------------------------" << endl;
624  myfile.close();
625 }
626 
627 
628 void CbmTrdHitRateFastQa::ScanModulePlane(const Int_t moduleAddress,
629  TCanvas*& c1,
630  TCanvas*& c2,
631  TH1F*& HitPad,
632  TH1F*& HitAsic) {
633  c1->cd(1);
634  Double_t ratePerModule = 0; // sum of data from this module
635  TVector3 padPos;
636  TVector3 padSize;
637  CbmTrdParSetAsic* fModuleAsic =
638  (CbmTrdParSetAsic*) fAsicPar->GetModuleSet(moduleAddress);
639  CbmTrdParModDigi* fModuleInfo =
640  (CbmTrdParModDigi*) fDigiPar->GetModulePar(moduleAddress);
641  CbmTrdParModGeo* fModuleGeo =
642  (CbmTrdParModGeo*) fGeoPar->GetModulePar(moduleAddress);
643  gGeoManager->FindNode(
644  fModuleGeo->GetX(), fModuleGeo->GetY(), fModuleGeo->GetZ());
645  /*gGeoManager->FindNode(fModuleInfo->GetX(),
646  fModuleInfo->GetY(),
647  fModuleInfo->GetZ());
648  printf("%s\n",TString(gGeoManager->GetPath()).Data());
649  */
650  std::vector<Int_t> AsicAddresses;
651  fModuleAsic->GetAsicAddresses(&AsicAddresses);
652  Int_t nofAsics = fModuleAsic->GetNofAsics();
653  printf(" NofAsics: %3i\n", nofAsics);
654  myfile << "# NofAsics : " << nofAsics << endl;
655  myfile << "# moduleAddress / Asic ID / hits per 32ch Asic per second" << endl;
656  nTotalAsics += nofAsics;
657  std::map<Int_t, Double_t> ratePerAsicMap;
658  for (Int_t iAsic = 0; iAsic < nofAsics; iAsic++) {
659  ratePerAsicMap[AsicAddresses[iAsic]] = 0.;
660  }
661  const Int_t nSec = fModuleInfo->GetNofSectors();
662  for (Int_t s = 0; s < nSec; s++) {
663  const Int_t nRow = fModuleInfo->GetNofRowsInSector(s);
664  const Int_t nCol = fModuleInfo->GetNofColumnsInSector(s);
665  for (Int_t r = 0; r < nRow; r++) {
666  for (Int_t c = 0; c < nCol; c++) {
667  fModuleInfo->GetPosition(/*moduleAddress, */ s,
668  c,
669  r,
670  padPos,
671  padSize); // padPos local or global???
672  Int_t channelAddress =
674  CbmTrdAddress::GetModuleId(moduleAddress),
675  s,
676  r,
677  c);
678  Double_t local_min[3] = {padPos[0] - 0.5 * padSize[0],
679  padPos[1] - 0.5 * padSize[1],
680  padPos[2]};
681  Double_t local_max[3] = {padPos[0] + 0.5 * padSize[0],
682  padPos[1] + 0.5 * padSize[1],
683  padPos[2]};
684  //Double_t master_min[3];
685  //Double_t master_max[3];
686  //gGeoManager->LocalToMaster(local_min, master_min);
687  //gGeoManager->LocalToMaster(local_max, master_max);
688  if (
689  fModuleInfo->GetOrientation() == 1
690  || fModuleInfo->GetOrientation()
691  == 3) { // Pad size is in local coordinate system where position is in global coordinate system
692  local_min[0] = padPos[0] - 0.5 * padSize[1];
693  local_min[1] = padPos[1] - 0.5 * padSize[0];
694  local_max[0] = padPos[0] + 0.5 * padSize[1];
695  local_max[1] = padPos[1] + 0.5 * padSize[0];
696  }
697  //Double_t global_min[3];
698  //Double_t global_max[3];
699  //Double_t x_min(padPos[0]-0.5*padSize[0]), x_max(padPos[0]+0.5*padSize[0]), y_min(padPos[1]-0.5*padSize[1]), y_max(padPos[1]+0.5*padSize[1]);
700  //gGeoManager->LocalToMaster(local_min, global_min);
701  //gGeoManager->LocalToMaster(local_max, global_max);
702  //TBox *pad = new TBox(x_min, y_min, x_max, y_max);
703  for (Int_t i = 0; i < 3; i++) {
704  //master_min[i] *= 10.;
705  //master_max[i] *= 10.;
706  local_min[i] *= 10.;
707  local_max[i] *= 10.;
708  }
709  //Double_t rate = CalcHitRatePad(global_min[0], global_max[0], global_min[1], global_max[1], global_max[2]);
710  Double_t rate = CalcHitRatePad(
711  local_min[0], local_max[0], local_min[1], local_max[1], local_max[2]);
712  HitPad->Fill(rate);
713  ratePerModule += rate; // increase sum by rate of this asic
714 
715  //TBox *pad = new TBox(global_min[0], global_min[1], global_max[0], global_max[1]);
716  TBox* pad =
717  new TBox(local_min[0], local_min[1], local_max[0], local_max[1]);
718  //printf(" %i %i %i (%f, %f) (%f, %f) %f\n",s,r,c,local_min[0],local_min[1],global_min[0],global_min[1],rate);
719  pad->SetLineColor(0);
720  pad->SetLineWidth(0);
721  // Int_t color(0), j(0);
722  UInt_t j(0);
723  while ((rate > fZLevel[j]) && (j < fZLevel.size())) {
724  //printf (" %i<%i %i %E <= %E\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
725  j++;
726  }
727  //printf ("%i<%i %i %E <= %E\n\n",j,(Int_t)fZLevel.size(),fColors[j], rate, fZLevel[j]);
728  pad->SetFillColor(fColors[j]);
729  if (j >= fZLevel.size() || rate > 1E05) pad->SetFillColor(12);
730  pad->Draw("same");
731 
732  //delete pad;
733  Int_t AsicAddress = fModuleAsic->GetAsicAddress(channelAddress);
734  if (AsicAddress < 0)
735  LOG(error) << "CbmTrdHitRateFastQa::ScanModulePlane: Channel address:"
736  << channelAddress << " is not initialized in module "
737  << moduleAddress << "(s:" << s << ", r:" << r
738  << ", c:" << c << ")";
739  ratePerAsicMap[AsicAddress] += rate;
740  }
741  }
742  //TLine *sec = new TLine();
743  //sec->SetLineStyle(2);
744  //sec->Draw("same");
745  }
746  TBox* module =
747  new TBox(fModuleGeo->GetX() * 10 - fModuleInfo->GetSizeX() * 10,
748  fModuleGeo->GetY() * 10 - fModuleInfo->GetSizeY() * 10,
749  fModuleGeo->GetX() * 10 + fModuleInfo->GetSizeX() * 10,
750  fModuleGeo->GetY() * 10 + fModuleInfo->GetSizeY() * 10);
751  module->SetFillStyle(0);
752  module->Draw("same");
753  c1->Update();
754  c2->cd(1);
755  module->Draw("same");
756  c2->Update();
757  CbmTrdParAsic* Asic = NULL;
758  TBox* asic = NULL;
759  CbmTrdUtils* utils = new CbmTrdUtils();
760  utils->InitColorVector(true, 0., 4e6);
761  for (Int_t iAsic = 0; iAsic < nofAsics; iAsic++) {
762  Asic = fModuleAsic->GetAsicPar(AsicAddresses[iAsic]);
763 
764  Double_t local_min[3];
765  Double_t local_max[3];
766  Double_t master_min[3];
767  Double_t master_max[3];
768  local_min[0] = Asic->GetX() - 0.5 * Asic->GetSizeX();
769  local_min[1] = Asic->GetY() - 0.5 * Asic->GetSizeY();
770  local_min[2] = fModuleGeo->GetZ();
771  local_max[0] = Asic->GetX() + 0.5 * Asic->GetSizeX();
772  local_max[1] = Asic->GetY() + 0.5 * Asic->GetSizeY();
773  local_max[2] = fModuleGeo->GetZ();
774  gGeoManager->LocalToMaster(local_min, master_min);
775  gGeoManager->LocalToMaster(local_max, master_max);
776  //printf("moduleAddress:%10i O:%i Asic:%3i rate:%E\n",moduleAddress,fModuleInfo->GetOrientation(),AsicAddresses[iAsic],ratePerAsicMap[AsicAddresses[iAsic]]);
777  asic = new TBox(10. * master_min[0],
778  10. * master_min[1],
779  10. * master_max[0],
780  10. * master_max[1]);
781  c2->cd(1);
782  if (ratePerAsicMap[AsicAddresses[iAsic]] > 4e6)
783  asic->SetFillColor(kBlack);
784  else
785  asic->SetFillColor(
786  utils->GetColorCode(ratePerAsicMap[AsicAddresses[iAsic]]));
787 
788  // myfile << iAsic << " " << AsicAddresses[iAsic] << " " << ratePerAsicMap[AsicAddresses[iAsic]] << endl;
789  myfile << moduleAddress << " " << setfill('0') << setw(2) << iAsic << " "
790  << setiosflags(ios::fixed) << setprecision(0) << setfill(' ')
791  << setw(8) << ratePerAsicMap[AsicAddresses[iAsic]] << endl;
792 
793  Double_t dataPerAsic = ratePerAsicMap[AsicAddresses[iAsic]] * 3 * 1e-6
794  * fBitPerHit; // Mbit, incl. neighbor
795  HitAsic->Fill(dataPerAsic);
796  asic->Draw("same");
797  //c2->Update();
798  }
799 
800  Double_t dataPerModule =
801  ratePerModule * 3 * 1e-6 * fBitPerHit; // Mbit, incl. neighbor
802  Int_t nOptLinks =
803  1
804  + dataPerModule
805  / 4000.; // 5000.; // 1 link plus 1 for each 4 Gbps (fill links to 80% max)
806  h1DataModule->Fill(dataPerModule);
807  h1OptLinksModule->Fill(nOptLinks);
808 
809  // global statistics
810  nTotalOptLinks += nOptLinks;
811  trdTotalDataRate += dataPerModule;
812 
813  printf(" data rate: %11.4f (Gbit/s)\n", dataPerModule * 1e-3);
814  printf(" opt links: %6i\n", nOptLinks);
815  printf(" --------------------------\n");
816 
817  myfile << "#--------------------------" << endl;
818 }
819 
820 
822  TCanvas*& c2,
823  TCanvas*& c3,
824  TH2F*& Layer,
825  TH1F*& HitPad,
826  Double_t ZRangeL,
827  Double_t ZRangeU,
828  Double_t mm2bin) {
829  Char_t name[50];
830  Char_t title[50];
831 
832 
833  sprintf(name, "HP_S%d_L%d", fStation, fLayer);
834  sprintf(title, "HitPad_Station %d, Layer %d", fStation, fLayer);
835 
836  // set even bin size on logx scale
837  const Int_t cnbins = 200;
838  Double_t cxmin = 1e2;
839  Double_t cxmax = 1e6;
840  Double_t clogxmin = TMath::Log10(cxmin);
841  Double_t clogxmax = TMath::Log10(cxmax);
842  Double_t cbinwidth = (clogxmax - clogxmin) / cnbins;
843  Double_t cxbins[cnbins + 1];
844  cxbins[0] = cxmin;
845  for (Int_t i = 1; i <= cnbins; i++) {
846  cxbins[i] = cxmin + TMath::Power(10, clogxmin + i * cbinwidth);
847  }
848  HitPad = new TH1F(name, title, cnbins, cxbins);
849 
850  // HitPad = new TH1F(name,title,10000,1e02,1e06);
851  HitPad->SetXTitle("Hits/Pad [Hz]");
852  HitPad->SetYTitle("count");
853  HitPad->GetYaxis()->SetRangeUser(1, 1e04);
854 
855  sprintf(name, "c2_S%d_L%d", fStation, fLayer);
856  sprintf(title, "c2 Station %d, Layer %d", fStation, fLayer);
857  if (fDraw) {
858  c2 = new TCanvas(name, title, 1600, 900);
859  c2->Divide(2, 2); // (3,1);
860  c2->cd(1)->SetLogx(1);
861  c2->cd(1)->SetLogy(1);
862  c2->cd(1)->SetGridx(1);
863  c2->cd(1)->SetGridy(1);
864  HitPad->Draw();
865 
866  // h1HitAsic
867  c2->cd(2)->SetLogx(1); // Data per 32ch Asic lin/log scale
868  c2->cd(2)->SetLogy(0); // will be overwritten later
869  c2->cd(2)->SetGridx(1);
870  c2->cd(2)->SetGridy(1);
871 
872  // h1DataModule
873  c2->cd(3)->SetLogx(1); // Data per Module lin/log scale
874  c2->cd(3)->SetLogy(0); // will be overwritten later
875  c2->cd(3)->SetGridx(1);
876  c2->cd(3)->SetGridy(1);
877 
878  // h1OptLinksModule
879  c2->cd(4)->SetLogx(0); // Data per Module lin/log scale
880  c2->cd(4)->SetLogy(0); // will be overwritten later
881  c2->cd(4)->SetGridx(1);
882  c2->cd(4)->SetGridy(1);
883  }
884 
885  sprintf(name, "S%d_L%d", fStation, fLayer);
886  sprintf(title, "Station %d, Layer %d", fStation, fLayer);
887  printf("%s\n", title);
888 
889  Layer = new TH2F(name,
890  title,
891  int(2 * winsize / mm2bin),
892  -winsize,
893  winsize,
894  int(2 * winsize / mm2bin),
895  -winsize,
896  winsize);
897  Layer->SetContour(99);
898  Layer->SetXTitle("x-Coordinate [mm]");
899  Layer->SetYTitle("y-Coordinate [mm]");
900  Layer->SetZTitle("Hits/Pad [Hz]");
901  Layer->SetStats(kFALSE);
902  Layer->GetXaxis()->SetLabelSize(0.02);
903  Layer->GetYaxis()->SetLabelSize(0.02);
904  Layer->GetZaxis()->SetLabelSize(0.02);
905  Layer->GetXaxis()->SetTitleSize(0.02);
906  Layer->GetXaxis()->SetTitleOffset(1.5);
907  Layer->GetYaxis()->SetTitleSize(0.02);
908  Layer->GetYaxis()->SetTitleOffset(2);
909  Layer->GetZaxis()->SetTitleSize(0.02);
910  Layer->GetZaxis()->SetTitleOffset(-2);
911  Layer->GetZaxis()->SetRangeUser(ZRangeL, ZRangeU);
912  Layer->Fill(0., 0., 0.);
913 
914  sprintf(name, "c1_S%d_L%d", fStation, fLayer);
915  sprintf(title, "c1 Station %d, Layer %d", fStation, fLayer);
916  if (fDraw) {
917  c1 = new TCanvas(name, title, 1000, 900);
918  c1->Divide(1, 1);
919  c1->cd(1)->SetLogz(1);
920  Layer->DrawCopy("colz");
921  sprintf(name, "c3_S%d_L%d", fStation, fLayer);
922  sprintf(title, "c3 Station %d, Layer %d", fStation, fLayer);
923  c3 = new TCanvas(name, title, 1000, 900);
924  c3->Divide(1, 1);
925  c3->cd(1)->SetLogz(1);
926  Layer->GetZaxis()->SetRangeUser(1., 4e6);
927  Layer->SetZTitle("Hits/Asic [Hz]");
928  Layer->DrawCopy("colz");
929  }
930 }
931 
932 // --------------------------------------------------------------------
933 
934 // ---- FinishTask-----------------------------------------------------
936  fDigiMap.clear();
937  if (fDigiCollection) fDigiCollection->Clear();
939 }
940 
941 // --------------------------------------------------------------------
942 // ----GetModuleInformation ------------------------------------------
944  // Extract the information about station, layer, module type
945  // and cpoy number of the module from the full path to the
946  // node.
947  // The full path is tokenized at the "/" which diide the different
948  // levels of the geometry.
949  // Knowing the nameing scheme of the volumes one gets the required
950  // information with simple string manipulation.
951  // This is probably not the fastes way, but the speed has to be checked.
952  // The methode works only for versions of Root > 5.20.0, before the
953  // class TStringTocken is not implemented
954 
955  TString path = gGeoManager->GetPath();
956  cout << "Path: " << path << endl;
957  TStringToken* bla = new TStringToken(path, "/");
958 
959  while (bla->NextToken()) {
960  if (bla->Contains("layer")) {
961  TString bla3 = (TString) *bla;
962  Ssiz_t pos = bla3.Last('_');
963  Ssiz_t substringLength = bla3.Length() - pos - 1;
964  TString bla2 = bla3((bla3.Last('_') + 1), substringLength);
965  TString bla1 = bla3(3, 1);
966  fStation = bla1.Atoi();
967  fLayer = bla2.Atoi();
968  }
969  if (bla->Contains("mod")) {
970  TString bla3 = (TString) *bla;
971  Ssiz_t pos = bla3.Last('_');
972  Ssiz_t substringLength = bla3.Length() - pos - 1;
973  TString bla2 = bla3(pos + 1, substringLength);
974  substringLength = pos - 7;
975  TString bla1 = bla3(7, substringLength);
976  break;
977  }
978  }
979 }
980 
981 // --------------------------------------------------------------------
982 // ----GetModuleInformationFromDigiPar ------------------------------------------
984  HitRateGeoPara2* GeoPara,
985  Bool_t Fast,
986  Bool_t Lines,
987  Int_t VolumeID,
988  TH2F* Layer,
989  TCanvas* c1,
990  TH1F* HitPad,
991  TCanvas* c2,
992  TH2F* Topview[3],
993  TCanvas* c0,
994  Double_t mm2bin) {
995  // fPos is >0 for x and y and not rotated
996  // origin of the local coordinate system in
997  // the lower left corner of the chamber,
998  // x to the right (small side of the pads), y up
999  //cout << "GetModuleInformationFromDigiPar" << endl;
1000 
1001  CbmTrdParModDigi* fModuleInfo =
1002  (CbmTrdParModDigi*) fDigiPar->GetModulePar(VolumeID);
1003  CbmTrdParModGeo* fModuleGeo =
1004  (CbmTrdParModGeo*) fGeoPar->GetModulePar(VolumeID);
1005  if (fModuleInfo != NULL) {
1006 
1007  // fill GeoPara
1008  TVector3 padPos;
1009  TVector3 padSize;
1010 
1011  GeoPara->nSec = fModuleInfo->GetNofSectors(); // is always 3
1012  GeoPara->moduleId = VolumeID;
1013  GeoPara->layerId = fLayer;
1014  GeoPara->stationId = fStation;
1015 
1016  GeoPara->mPos[0] = fModuleGeo->GetX() * 10;
1017  GeoPara->mPos[1] = fModuleGeo->GetY() * 10;
1018  GeoPara->mPos[2] = fModuleGeo->GetZ() * 10; // == z(station) ??
1019 
1020  GeoPara->mSize[0] = fModuleInfo->GetSizeX() * 10;
1021  GeoPara->mSize[1] = fModuleInfo->GetSizeY() * 10;
1022  GeoPara->mSize[2] = 0;
1023 
1024  GeoPara->nCol = 0; // reset total number of columns
1025  GeoPara->nRow = 0; // reset total number of rows
1026 
1027  for (Int_t s = 0; s < GeoPara->nSec; s++) // for all (3) sectors
1028  {
1029  GeoPara->sCol[s] = 0; // reset number of columns in sector
1030  GeoPara->sRow[s] = 0; // reset number of rows in sector
1031 
1032  fModuleInfo->GetPosition(/*VolumeID, */ s, 0, 0, padPos, padSize);
1033  GeoPara->pSize[s][2] = 0;
1034 
1035  for (Int_t i = 0; i < 2; i++) // for x and y
1036  {
1037  GeoPara->pSize[s][i] = padSize[i] * 10; // convert to mm
1038 
1039  if (i == 0) // x direction
1040  {
1041  GeoPara->sSize[s][i] = fModuleInfo->GetSectorSizeX(s) * 10;
1042  if (GeoPara->sSize[s][i]
1043  < 2 * GeoPara->mSize[i]) // if sector smaller than module
1044  {
1045  GeoPara->sCol[s] =
1046  round(GeoPara->sSize[s][i]
1047  / GeoPara->pSize[s][i]); // calculate number of pads
1048  } else // only one sector
1049  {
1050  if (s == 0)
1051  GeoPara->sCol[s] =
1052  round(GeoPara->sSize[s][i]
1053  / GeoPara->pSize[s][i]); // calculate number of pads
1054  else
1055  GeoPara->sCol[s] = 0; // set other sectors 0
1056  }
1057  GeoPara->nCol += GeoPara->sCol[s]; // sum up columns
1058  }
1059 
1060  if (i == 1) // y direction
1061  {
1062  GeoPara->sSize[s][i] = fModuleInfo->GetSectorSizeY(s) * 10;
1063  if (GeoPara->sSize[s][i]
1064  < 2 * GeoPara->mSize[i]) // if sector smaller than module
1065  {
1066  GeoPara->sRow[s] =
1067  round(GeoPara->sSize[s][i] / GeoPara->pSize[s][i]);
1068  } else // only one sector
1069  {
1070  if (s == 0)
1071  GeoPara->sRow[s] =
1072  round(GeoPara->sSize[s][i]
1073  / GeoPara->pSize[s][i]); // calculate number of pads
1074  else
1075  GeoPara->sRow[s] = 0; // set other sectors 0
1076  }
1077  GeoPara->nRow += GeoPara->sRow[s]; // sum up columns
1078  }
1079  }
1080  }
1081 
1082  // swap, if required
1083  if (GeoPara->nRow > GeoPara->nCol) // if mofre rows than columns
1084  {
1085  Int_t itemp;
1086  Double_t dtemp;
1087 
1088  itemp = GeoPara->nRow;
1089  GeoPara->nRow = GeoPara->nCol;
1090  GeoPara->nCol = itemp;
1091 
1092  for (Int_t s = 0; s < GeoPara->nSec; s++) // for all (3) sectors
1093  {
1094  dtemp = GeoPara->sRow[s];
1095  GeoPara->sRow[s] = GeoPara->sCol[s];
1096  GeoPara->sCol[s] = dtemp;
1097 
1098  dtemp = GeoPara->sSize[s][0];
1099  GeoPara->sSize[s][0] = GeoPara->sSize[s][1];
1100  GeoPara->sSize[s][1] = dtemp;
1101 
1102  dtemp = GeoPara->pSize[s][0];
1103  GeoPara->pSize[s][0] = GeoPara->pSize[s][1];
1104  GeoPara->pSize[s][1] = dtemp;
1105  }
1106  cout << "swapped x and y" << endl;
1107  }
1108 
1109  // get origin
1110  fModuleInfo->GetPosition(/*VolumeID, */ 0, 0, 0, padPos, padSize);
1111  GeoPara->vOrigin[0] = padPos[0] * 10;
1112  GeoPara->vOrigin[1] = padPos[1] * 10;
1113  GeoPara->vOrigin[2] = padPos[2] * 10;
1114 
1115  // get col offset
1116  fModuleInfo->GetPosition(/*VolumeID, */ 0, 1, 0, padPos, padSize);
1117  GeoPara->vX[0] = padPos[0] * 10 - GeoPara->vOrigin[0];
1118  GeoPara->vX[1] = padPos[1] * 10 - GeoPara->vOrigin[1];
1119  GeoPara->vX[2] = padPos[2] * 10 - GeoPara->vOrigin[2];
1120 
1121  // get row offset
1122  // fModuleInfo->GetPosition(VolumeID, 0, 0, 1, padPos, padSize); // rather take next of 3 sectors
1123  fModuleInfo->GetPosition(/*VolumeID, */ 1, 0, 0, padPos, padSize);
1124  GeoPara->vY[0] = padPos[0] * 10 - GeoPara->vOrigin[0];
1125  GeoPara->vY[1] = padPos[1] * 10 - GeoPara->vOrigin[1];
1126  GeoPara->vY[2] = padPos[2] * 10 - GeoPara->vOrigin[2];
1127 
1128  // normal vector
1129  GeoPara->vN[0] =
1130  GeoPara->vX[1] * GeoPara->vY[2] - GeoPara->vX[2] * GeoPara->vY[1];
1131  GeoPara->vN[1] =
1132  GeoPara->vX[2] * GeoPara->vY[0] - GeoPara->vX[0] * GeoPara->vY[2];
1133  GeoPara->vN[2] =
1134  GeoPara->vX[0] * GeoPara->vY[1] - GeoPara->vX[1] * GeoPara->vY[0];
1135 
1136  // inclination angle
1137  GeoPara->lambda = (GeoPara->vOrigin[0] * GeoPara->vN[0]
1138  + GeoPara->vOrigin[1] * GeoPara->vN[1]
1139  + GeoPara->vOrigin[2] * GeoPara->vN[2]);
1140 
1141  /*x-direction*/
1142  GeoPara->cosX =
1143  (GeoPara->vX[0] * 1 + GeoPara->vX[1] * 0 + GeoPara->vX[2] * 0)
1144  / sqrt(pow(GeoPara->vX[0], 2) + pow(GeoPara->vX[1], 2)
1145  + pow(GeoPara->vX[2], 2));
1146  /*y-direction*/
1147  GeoPara->cosY =
1148  (GeoPara->vY[0] * 0 + GeoPara->vY[1] * 1 + GeoPara->vY[2] * 0)
1149  / sqrt(pow(GeoPara->vY[0], 2) + pow(GeoPara->vY[1], 2)
1150  + pow(GeoPara->vY[2], 2));
1151 
1152  // check and fix cos values (were larger than 1)
1153  // cout << "a cosX " << GeoPara->cosX << " cosY " << GeoPara->cosY << endl;
1154 
1155  if (GeoPara->cosX > 1) GeoPara->cosX = 1;
1156  if (GeoPara->cosX < -1) GeoPara->cosX = -1;
1157  if (GeoPara->cosY > 1) GeoPara->cosY = 1;
1158  if (GeoPara->cosY < -1) GeoPara->cosY = -1;
1159 
1160  // cout << "b cosX " << GeoPara->cosX << " cosY " << GeoPara->cosY << endl;
1161 
1162  if (GeoPara->vX[0] != 0)
1163  GeoPara->stepDirection[0] =
1164  fabs(GeoPara->vX[0])
1165  / (GeoPara
1166  ->vX[0]); // is the next pad (1,0,0) on the left or right side?
1167  else
1168  GeoPara->stepDirection[0] =
1169  -fabs(GeoPara->vX[1])
1170  / (GeoPara
1171  ->vX[1]); // is the next pad (1,0,0) on the left or right side?
1172 
1173  if (GeoPara->vY[1] != 0)
1174  GeoPara->stepDirection[1] =
1175  fabs(GeoPara->vY[1])
1176  / (GeoPara
1177  ->vY[1]); // is the next pad (0,1,0) on the upper or lower side?
1178  else
1179  GeoPara->stepDirection[1] =
1180  -fabs(GeoPara->vY[0])
1181  / (GeoPara
1182  ->vY[0]); // is the next pad (0,1,0) on the upper or lower side?
1183 
1184  // transfer values to old variables
1185  Double_t Mpos[3];
1186  Double_t Msize[3];
1187  for (Int_t i = 0; i < 3; i++) // for x, y and z
1188  {
1189  Mpos[i] = GeoPara->mPos[i]; // set module position
1190  Msize[i] = GeoPara->mSize[i]; // set module size
1191  }
1192 
1193  cout.setf(ios::fixed);
1194  cout.precision(0);
1195  if (Lines)
1196  cout << "pos " << setw(6) << Mpos[0] << setw(6) << Mpos[1] << setw(6)
1197  << Mpos[2] << " size " << setw(6) << Msize[0] << setw(6) << Msize[1]
1198  << setw(6) << Msize[2] << endl;
1199 
1200 
1201  const Int_t nSec = fModuleInfo->GetNofSectors(); // is always 3
1202  // cout << nSec << " nSec" << endl;
1203  Double_t Ssize[3 * nSec]; // sector size
1204  Double_t Psize[3 * nSec]; // pad size
1205  for (Int_t iSec = 0; iSec < nSec; iSec++) // iSec = Sector
1206  {
1207  Ssize[0 + iSec * nSec] = GeoPara->sSize[iSec][0];
1208  Ssize[1 + iSec * nSec] = GeoPara->sSize[iSec][1];
1209  Ssize[2 + iSec * nSec] = 0;
1210 
1211  Psize[0 + iSec * nSec] = GeoPara->pSize[iSec][0];
1212  Psize[1 + iSec * nSec] = GeoPara->pSize[iSec][1];
1213  Psize[2 + iSec * nSec] = 0;
1214  }
1215 
1216  if (Lines)
1217  cout << "sec " << setw(10) << Ssize[0] << setw(10) << Ssize[1]
1218  << setw(10) << Ssize[3] << setw(10) << Ssize[4] << setw(10)
1219  << Ssize[6] << setw(10) << Ssize[7] << endl;
1220 
1221  cout.precision(2);
1222  if (Lines)
1223  cout << "pad " << setw(10) << Psize[0] << setw(10) << Psize[1]
1224  << setw(10) << Psize[3] << setw(10) << Psize[4] << setw(10)
1225  << Psize[6] << setw(10) << Psize[7] << endl;
1226 
1227  // nCol and nRow
1228  Int_t nCol = GeoPara->nCol; // columns per module - or - pads per row
1229  Int_t nRow = GeoPara->nRow; // rows per module
1230 
1231  const Int_t mCol = fModuleInfo->GetNofColumns();
1232  const Int_t mRow = fModuleInfo->GetNofRows();
1233 
1234  if (Lines) {
1235  cout << "col0 " << setw(10) << GeoPara->sCol[0] << " row0 " << setw(10)
1236  << GeoPara->sRow[0] << endl;
1237  cout << "col1 " << setw(10) << GeoPara->sCol[1] << " row1 " << setw(10)
1238  << GeoPara->sRow[1] << endl;
1239  cout << "col2 " << setw(10) << GeoPara->sCol[2] << " row2 " << setw(10)
1240  << GeoPara->sRow[2] << endl;
1241  cout << "col " << setw(10) << nCol << " row " << setw(10) << nRow
1242  << endl;
1243 
1244  cout << "mcol " << setw(10) << mCol << " mrow " << setw(10) << mRow
1245  << endl;
1246  cout << "0col " << setw(10) << fModuleInfo->GetNofColumnsInSector(0)
1247  << " 0row " << setw(10) << fModuleInfo->GetNofRowsInSector(0)
1248  << endl;
1249  cout << "1col " << setw(10) << fModuleInfo->GetNofColumnsInSector(1)
1250  << " 1row " << setw(10) << fModuleInfo->GetNofRowsInSector(1)
1251  << endl;
1252  cout << "2col " << setw(10) << fModuleInfo->GetNofColumnsInSector(2)
1253  << " 2row " << setw(10) << fModuleInfo->GetNofRowsInSector(2)
1254  << endl;
1255  }
1256 
1257 
1259  // Int_t nCol = 0; // columns per module - or - pads per row
1260  // Int_t nRow = 0; // rows per module
1261  //
1262  // for (Int_t i = 0; i < fnSec; i++)
1263  // {
1264  // if (Ssize[0+i*nSec] < 2 * Msize[0] && Ssize[0+i*nSec] > 0) // sector size within module size
1265  // {
1266  // nCol += int(Ssize[0+i*nSec]/Psize[0+i*nSec]);
1267  // }
1268  // else
1269  // {
1270  // nCol = int(Ssize[0+i*nSec]/Psize[0+i*nSec]);
1271  // }
1272  //
1273  // if (Ssize[1+i*nSec] < 2 * Msize[1] && Ssize[1+i*nSec] > 0) // sector size within module size
1274  // {
1275  // nRow += int(Ssize[1+i*nSec]/Psize[1+i*nSec]);
1276  // }
1277  // else
1278  // {
1279  // nRow = int(Ssize[1+i*nSec]/Psize[1+i*nSec]);
1280  // }
1281  // }
1282  //
1283  // if (Lines)
1284  // cout << "nCol " << setw(10) << nCol << " nRow "<< setw(10) << nRow << endl;
1285 
1286  if (Lines) {
1287  cout << "vX0 " << setw(10) << GeoPara->vX[0] << endl;
1288  cout << "vX1 " << setw(10) << GeoPara->vX[1] << endl;
1289  cout << "vY0 " << setw(10) << GeoPara->vY[0] << endl;
1290  cout << "vY1 " << setw(10) << GeoPara->vY[1] << endl;
1291  cout << "step " << setw(10) << GeoPara->stepDirection[0] << setw(10)
1292  << GeoPara->stepDirection[1] << endl;
1293  cout << "cos " << setw(10) << GeoPara->cosX << setw(10) << GeoPara->cosY
1294  << endl;
1295  cout << "v00xy " << setw(10) << GeoPara->mPos[0] - GeoPara->vOrigin[0]
1296  << setw(10) << GeoPara->mPos[1] - GeoPara->vOrigin[1] << endl;
1297 
1298  // cout << "------------------------------------------------------" << endl;
1299  }
1300 
1301  // angles are relative to y direction
1302  if ((GeoPara->stepDirection[0] == 1)
1303  && (GeoPara->stepDirection[1] == 1)) // OK - vert up
1304  GeoPara->rot_angle = 0;
1305  if ((GeoPara->stepDirection[0] == -1)
1306  && (GeoPara->stepDirection[1] == 1)) // OK - hori left
1307  GeoPara->rot_angle = 1;
1308  if ((GeoPara->stepDirection[0] == -1)
1309  && (GeoPara->stepDirection[1] == -1)) // OK - vert down
1310  GeoPara->rot_angle = 2;
1311  if ((GeoPara->stepDirection[0] == 1)
1312  && (GeoPara->stepDirection[1] == -1)) // OK - hori right
1313  GeoPara->rot_angle = 3;
1314 
1315  // GeoPara->ori = fModuleInfo->GetOrientation(); // is 0,1,2,3
1316  if (Lines)
1317  cout << "ori " << setw(10) << fModuleInfo->GetOrientation()
1318  << " rot " << setw(10) << GeoPara->rot_angle << endl;
1319 
1320  // if (GeoPara->rot_angle == 3)
1321  // {
1322  // fModuleInfo->GetPosition(VolumeID, 2, GeoPara->sCol[0], GeoPara->sRow[2], padPos, padSize);
1323  // if (Lines)
1324  // {
1331  // cout << "v11xy " << setw(10) << padPos[0] * 10 - GeoPara->vOrigin[0]
1332  // << setw(10) << padPos[1] * 10 - GeoPara->vOrigin[1] << endl;
1333  // }
1334  // GeoPara->vOrigin[0] = padPos[0] * 10;
1335  // GeoPara->vOrigin[1] = padPos[1] * 10;
1336  // }
1337 
1338  if (Lines)
1339  cout << "------------------------------------------------------" << endl;
1340 
1341  Topview[0]->Fill(GeoPara->mPos[0], GeoPara->mPos[2]);
1342  Topview[1]->Fill(GeoPara->mPos[0], GeoPara->mPos[1]);
1343  Topview[2]->Fill(GeoPara->mPos[2], GeoPara->mPos[1]);
1344 
1345  if (Lines) {
1346  DrawPads(GeoPara, Layer, c1);
1347  DrawBorders(GeoPara, Layer, c1);
1348  } else {
1349  Histo(GeoPara, Fast, Layer, c1, HitPad, c2, Topview, c0, mm2bin);
1350  }
1351 
1352  if (Lines)
1353  for (Int_t s = 0; s < GeoPara->nSec; s++) // for all (3) sectors
1354  {
1355  fModuleInfo->GetPosition(/*VolumeID,*/ s, 0, 0, padPos, padSize);
1356 
1357  TPolyMarker* start = new TPolyMarker(1);
1358  start->SetPoint(0, padPos(0) * 10, padPos(1) * 10);
1359  start->SetMarkerStyle(22);
1360  start->SetMarkerSize(.8);
1361 
1362  if (fDraw) {
1363  c1->cd(1);
1364  start->Draw("same");
1365  }
1366 
1367  fModuleInfo->GetPosition(/*VolumeID,*/ s,
1368  GeoPara->sCol[0] - 1,
1369  GeoPara->sRow[s] - 1,
1370  padPos,
1371  padSize);
1372 
1373  TPolyMarker* end = new TPolyMarker(1);
1374  end->SetPoint(0, padPos(0) * 10, padPos(1) * 10);
1375  end->SetMarkerStyle(20);
1376  end->SetMarkerSize(.8);
1377 
1378  if (fDraw) {
1379  c1->cd(1);
1380  end->Draw("same");
1381  }
1382  }
1383 
1384  }
1385 
1386  else
1387  printf("fModuleInfo == NULL\n");
1388 }
1389 Double_t CbmTrdHitRateFastQa::CalcHitRatePad(const Double_t x_min,
1390  const Double_t x_max,
1391  const Double_t y_min,
1392  const Double_t y_max,
1393  const Double_t z) { //[mm]
1394  // Double_t a[3] = { 7.66582e+00, 6.97712e+00, 6.53780e+00};
1395  // Double_t b[3] = {-2.72375e-03, -1.85168e-03, -1.42673e-03};
1396  Double_t r(0), alpha(0), HitRate(0);
1397  Double_t xStepWidth(1), yStepWidth(1); // [mm]
1398  const Int_t xSteps = Int_t(fabs(x_max - x_min) / xStepWidth) - 1;
1399  const Int_t ySteps = Int_t(fabs(y_max - y_min) / yStepWidth) - 1;
1400  Double_t x(x_min + 0.5), y(y_min + 0.5);
1401  // const Double_t padArea = fabs(x_max - x_min) * fabs(y_max - y_min);
1402  for (Int_t yStep = 0; yStep < ySteps; yStep++) {
1403  x = x_min + 0.5;
1404  for (Int_t xStep = 0; xStep < xSteps; xStep++) {
1405  r = sqrt(pow(x, 2) + pow(y, 2));
1406  alpha = atan(r / z) * 1000.; //[mrad]
1407  HitRate += // fit including errors
1408  exp(4.536355e00 + -8.393716e-03 * alpha)
1409  + exp(2.400547e01 + -1.208306e-02 * alpha) / (z * z);
1410  x += xStepWidth;
1411  }
1412  y += yStepWidth;
1413  }
1414  return (HitRate); // [Hz/mm^2]
1415 }
1416 
1418  Double_t StartX,
1419  Double_t /*StopX*/,
1420  Int_t xSteps,
1421  Double_t StartY,
1422  Double_t /*StopY*/,
1423  Int_t ySteps,
1424  Double_t* /*Mpos*/,
1425  TH2F** /*Topview[3]*/,
1426  TCanvas* /*c0*/) {
1427  //cout << "CalcHitRate" << endl;
1428  Double_t HitRate = 0; //1. / sqrt( pow( StartX,2) + pow( StartY,2));
1429  Double_t r = 0;
1430  Double_t alpha = 0;
1431  // Int_t counter = 0;
1432  // Double_t a[3] = { 7.66582e+00, 6.97712e+00, 6.53780e+00};
1433  // Double_t b[3] = {-2.72375e-03, -1.85168e-03, -1.42673e-03};
1434 
1435  Double_t xStepWidth = GeoPara->cosX;
1436  Double_t yStepWidth = GeoPara->cosY;
1437  Double_t x =
1438  StartX + 0.5 * GeoPara->cosX; // don't start on the pad border line
1439  Double_t y = StartY + 0.5 * GeoPara->cosY;
1440 
1441  // Double_t xStepWidth = fabs(GeoPara->cosX);
1442  // Double_t yStepWidth = fabs(GeoPara->cosY);
1443  // Double_t x = StartX + 0.5 * fabs(GeoPara->cosX); // don't start on the pad border line
1444  // Double_t y = StartY + 0.5 * fabs(GeoPara->cosY);
1445  Double_t z = (GeoPara->lambda - (x * GeoPara->vN[0] + y * GeoPara->vN[1]))
1446  / GeoPara->vN[2];
1447  for (Int_t yStep = 0; yStep < ySteps; yStep++) {
1448  x = StartX + 0.5 * GeoPara->cosX;
1449  // x = StartX + 0.5 * fabs(GeoPara->cosX);
1450  for (Int_t xStep = 0; xStep < xSteps; xStep++) {
1451  z = (GeoPara->lambda - (x * GeoPara->vN[0] + y * GeoPara->vN[1]))
1452  / GeoPara->vN[2];
1453  r = sqrt(pow(x / 1.5, 2) + pow(y, 2));
1454  alpha = atan(r / z) * 1000.;
1455  /* //Fit without errors
1456  HitRate +=
1457  exp(4.54156e00 + -8.47377e-03 * alpha) +
1458  exp(2.40005e01 + -1.19541e-02 * alpha) /
1459  (z * z)
1460  ;
1461  */
1462  HitRate += // fit including errors
1463  exp(4.536355e00 + -8.393716e-03 * alpha)
1464  + exp(2.400547e01 + -1.208306e-02 * alpha) / (z * z);
1465  /*
1466  Topview[0]->Fill(x,z);
1467  Topview[1]->Fill(x,y);
1468  Topview[2]->Fill(z,y);
1469  */
1470  x += xStepWidth;
1471  }
1472  y += yStepWidth;
1473  }
1474  return (
1475  HitRate /*/(counter/100.)*/); /*Convertes Hits/Pad -> Hits/cm² on each Pad*/
1476 }
1477 
1478 
1480  Bool_t Fast,
1481  TH2F* h2Layer,
1482  TCanvas* /*c1*/,
1483  TH1F* h1HitPad,
1484  TCanvas* /*c2*/,
1485  TH2F* Topview[3],
1486  TCanvas* c0,
1487  Double_t mm2bin) {
1488  Double_t ZRangeL = 1e00; //1e05;
1489  Double_t ZRangeU = 1e05; //1e06;
1490  TString name;
1491 
1492  // show only current module name
1493  name.Form("ModuleID %5d", GeoPara->moduleId);
1494  // cout << " " << name << "\r" << flush;
1495  cout << " " << name << "\n" << flush;
1496 
1497  name.Form("Module%05d", GeoPara->moduleId);
1498  TH2F* h2Module;
1499  if (GeoPara->mSize[0] < 500) // small module
1500  h2Module = new TH2F(name,
1501  name,
1502  600 / mm2bin + 1,
1503  -300.5,
1504  300.5,
1505  600 / mm2bin + 1,
1506  -300.5,
1507  300.5); // 501 x 501 bins
1508  else // large module
1509  h2Module = new TH2F(name,
1510  name,
1511  1000 / mm2bin + 1,
1512  -500.5,
1513  500.5,
1514  1000 / mm2bin + 1,
1515  -500.5,
1516  500.5); // 1001 x 1001 bins
1517  // TH2F *h2Module = new TH2F(name,name,1500/mm2bin+1,-750.5,750.5,1500/mm2bin+1,-750.5,750.5);
1518  h2Module->GetZaxis()->SetRangeUser(ZRangeL, ZRangeU);
1519 
1520  name.Form("Module%05dHitPad", GeoPara->moduleId);
1521  TH1F* h1HitPadModule = new TH1F(name, name, 1200, 0, 120000);
1522  // TH1F* h1HitPadModule = new TH1F(name,name,10000,1e00,1e06);
1523 
1524  //cout << "Histo" << endl;
1525 
1526  // printf(" Xp %6d Xs %6d Yp %6d Ys %6d\n", (Int_t)GeoPara->mPos[0], (Int_t)GeoPara->mSize[0], (Int_t)GeoPara->mPos[1], (Int_t)GeoPara->mSize[1]);
1527  // cout << endl << "Xp " << GeoPara->mPos[0] << " Xs " << GeoPara->mSize[0] << " Yp " << GeoPara->mPos[1] << " Ys " << GeoPara->mSize[1] << endl;
1528 
1529  Double_t HiteRate = 0;
1530 
1531  Int_t iSecX = 0;
1532  Int_t iSecY = 0;
1533 
1534  Double_t planeStartX = GeoPara->mPos[0] - GeoPara->mSize[0];
1535  Double_t planeStopX = planeStartX + GeoPara->pSize[iSecX][0];
1536 
1537  Double_t planeStartY = GeoPara->mPos[1] - GeoPara->mSize[1];
1538  Double_t planeStopY = planeStartY + GeoPara->pSize[iSecY][1];
1539 
1540  Double_t StartX =
1541  GeoPara->vOrigin[0]
1542  + 0.5 * GeoPara->pSize[iSecX][0]
1543  * GeoPara->cosX; // vOrigin points to the center of pad (0,0,0)
1544  Double_t StopX = StartX + GeoPara->pSize[iSecX][0] * GeoPara->cosX;
1545 
1546  Double_t StartY =
1547  GeoPara->vOrigin[1] + 0.5 * GeoPara->pSize[iSecY][1] * GeoPara->cosY;
1548  Double_t StopY = StartY + GeoPara->pSize[iSecY][1] * GeoPara->cosY;
1549 
1550  Int_t xSteps = 0;
1551  Int_t ySteps = 0;
1552 
1553  // cout << "x " << GeoPara->pSize[iSecX][0] << " y " << GeoPara->pSize[iSecX][1] << endl;
1554 
1555  // printf("stX %6d spX %6d stY %6d spY %6d\n", (Int_t)StartX, (Int_t)StopX, (Int_t)StartY, (Int_t)StopY);
1556 
1557  //Int_t xStepDirection = GeoPara->vX[0] / fabs(GeoPara->vX[0]); // is the next pad (1,0,0) on the left or right side?
1558  //Int_t yStepDirection = GeoPara->vY[1] / fabs(GeoPara->vY[1]); // is the next pad (0,1,0) on the upper or lower side?
1559 
1560  //----------------------------------------------------------------------------------------
1561 
1562  //if (GeoPara->rot_angle == 1)
1563  //if (GeoPara->rot_angle != 3)
1564  for (Int_t iR = 0; iR < GeoPara->nRow; iR++) // rows
1565  {
1566  StartX =
1567  GeoPara->vOrigin[0]
1568  + 0.5 * GeoPara->pSize[iSecX][0] * GeoPara->cosX; // why to the left?
1569  StopX = StartX + GeoPara->pSize[iSecX][0] * GeoPara->cosX;
1570  planeStartX = GeoPara->mPos[0] - GeoPara->mSize[0];
1571  planeStopX = planeStartX + GeoPara->pSize[iSecX][0];
1572 
1573  for (Int_t iC = 0; iC < GeoPara->nCol; iC++) // for all columns
1574  {
1575  xSteps = GeoPara->pSize[iSecX][0] - 1; // 1 Step / mm
1576  ySteps = GeoPara->pSize[iSecY][1] - 1;
1577 
1578  if (Fast) {
1579  //DE
1580  // if (GeoPara->mPos[0] > -1 && GeoPara->mPos[1] > -1)
1581  if (GeoPara->mPos[0] < 1
1582  && GeoPara->mPos[1] < 1) // copy the bottom left quadrant
1583  {
1584  HiteRate = CalcHitRate(GeoPara,
1585  StartX,
1586  StopX,
1587  xSteps,
1588  StartY,
1589  StopY,
1590  ySteps,
1591  GeoPara->mPos,
1592  Topview,
1593  c0);
1594  h1HitPad->Fill(HiteRate, 4); // weight 4 for each quadrant
1595  }
1596  }
1597 
1598  else // slow, for each module
1599  {
1600  HiteRate = CalcHitRate(GeoPara,
1601  StartX,
1602  StopX,
1603  xSteps,
1604  StartY,
1605  StopY,
1606  ySteps,
1607  GeoPara->mPos,
1608  Topview,
1609  c0);
1610  h1HitPad->Fill(HiteRate);
1611  h1HitPadModule->Fill(HiteRate); // single module, goes into root file
1612  }
1613 
1614  // fill HitRate into h2Layer histo
1615 
1616  Int_t mStepX = Int_t((planeStartX - GeoPara->mPos[0]));
1617  Int_t mStepY = Int_t((planeStartY - GeoPara->mPos[1]));
1618 
1619  for (Int_t stepY = int(planeStartY / mm2bin);
1620  stepY < int(planeStopY / mm2bin);
1621  stepY++) {
1622  // mStepX = Int_t((planeStartX-GeoPara->mPos[0]));
1623 
1624  for (Int_t stepX = int(planeStartX / mm2bin);
1625  stepX < int(planeStopX / mm2bin);
1626  stepX++) {
1627 
1628  if (Fast) {
1629  //DE
1630  // if (GeoPara->mPos[0]/*GeoPara->mPos[0]*/ > -1 && GeoPara->mPos[1]/*GeoPara->mPos[1]*/ > -1)
1631  if (GeoPara->mPos[0] /*GeoPara->mPos[0]*/ < 1
1632  && GeoPara->mPos[1] /*GeoPara->mPos[1]*/ < 1) {
1633 
1634  h2Layer->SetBinContent(stepX + int(winsize / mm2bin),
1635  stepY + int(winsize / mm2bin),
1636  HiteRate); // bin coordiantes
1637  h2Layer->SetBinContent(-1 * stepX + int(winsize / mm2bin),
1638  stepY + int(winsize / mm2bin),
1639  HiteRate); // bin coordiantes
1640  h2Layer->SetBinContent(stepX + int(winsize / mm2bin),
1641  -1 * stepY + int(winsize / mm2bin),
1642  HiteRate); // bin coordiantes
1643  h2Layer->SetBinContent(-1 * stepX + int(winsize / mm2bin),
1644  -1 * stepY + int(winsize / mm2bin),
1645  HiteRate); // bin coordiantes
1646 
1647  if (GeoPara->moduleId == 5) {
1648  // cout << "filling 5 " << mStepX << " " << mStepY << " " << HiteRate << endl;
1649  h2Module->Fill(mStepX,
1650  mStepY,
1651  HiteRate); // single module, goes into root file
1652  }
1653  }
1654  }
1655 
1656  else // slow
1657  {
1658 
1659  h2Layer->SetBinContent(stepX + int(winsize / mm2bin),
1660  stepY + int(winsize / mm2bin),
1661  HiteRate); // bin coordinates
1662 
1663  // cout << "StepX " << stepX << " StepY " << stepY << endl;
1664 
1665  if (GeoPara->moduleId == 5) {
1666  cout << "filling 5 " << mStepX << " " << mStepY << " " << HiteRate
1667  << endl;
1668  h2Module->Fill(mStepX,
1669  mStepY,
1670  HiteRate); // single module, goes into root file
1671  }
1672  // cout << "mStepX " << mStepX << " mStepY " << mStepY << endl;
1673  }
1674 
1675  mStepX += mm2bin;
1676  }
1677 
1678  mStepY += mm2bin;
1679  }
1680 
1681  //printf("Sx Sy (%d,%d) nC nR (%d,%d) iC iR (%d,%d) SC SR (%d,%d) Px Py (%.1f,%.1f) StartX StartY (%.1f,%.1f)\n",iSecX,iSecY,nC,nR,iC,iR,SecCol,SecRow,Psize[0+iSecX*nSec],Psize[1+iSecY*nSec],StartX,StartY);
1682 
1683  // if (iC == GeoPara->sCol[iSecX]-1) // why -1 ??
1684  if (iC == GeoPara->sCol[iSecX]) {
1685  // cout << "iC " << iC << " " << GeoPara->nCol << " " << iSecX << endl;
1686  iSecX++;
1687  }
1688  StartX +=
1689  GeoPara->stepDirection[0] * GeoPara->pSize[iSecX][0] * GeoPara->cosX;
1690  StopX +=
1691  GeoPara->stepDirection[0] * GeoPara->pSize[iSecX][0] * GeoPara->cosX;
1692  planeStartX += GeoPara->stepDirection[0] * GeoPara->pSize[iSecX][0];
1693  planeStopX += GeoPara->stepDirection[0] * GeoPara->pSize[iSecX][0];
1694  // StartX += GeoPara->pSize[iSecX][0] * GeoPara->cosX;
1695  // StopX += GeoPara->pSize[iSecX][0] * GeoPara->cosX;
1696  // planeStartX += GeoPara->pSize[iSecX][0];
1697  // planeStopX += GeoPara->pSize[iSecX][0];
1698  }
1699 
1700  iSecX = 0;
1701 
1702  // if (iR == GeoPara->sRow[iSecY]-1) // why -1 ??
1703  if (iR == GeoPara->sRow[iSecY]) {
1704  // cout << "iR " << iR << " " << GeoPara->nRow << " " << iSecY << endl;
1705  iSecY++;
1706  }
1707 
1708  StartY +=
1709  GeoPara->stepDirection[1] * GeoPara->pSize[iSecY][1] * GeoPara->cosY;
1710  StopY +=
1711  GeoPara->stepDirection[1] * GeoPara->pSize[iSecY][1] * GeoPara->cosY;
1712  planeStartY += GeoPara->stepDirection[1] * GeoPara->pSize[iSecY][1];
1713  planeStopY += GeoPara->stepDirection[1] * GeoPara->pSize[iSecY][1];
1714  // StartY += GeoPara->pSize[iSecY][1] * GeoPara->cosY;
1715  // StopY += GeoPara->pSize[iSecY][1] * GeoPara->cosY;
1716  // planeStartY += GeoPara->pSize[iSecY][1];
1717  // planeStopY += GeoPara->pSize[iSecY][1];
1718  }
1719 
1720  //----------------------------------------------------------------------------------------
1721 
1722  for (Int_t i = 0; i < 3; i++)
1723  Topview[i]->Write("", TObject::kOverwrite);
1724 
1725  h2Layer->Write("", TObject::kOverwrite);
1726  h1HitPad->Write("", TObject::kOverwrite);
1727 
1728  h2Module->Write("", TObject::kOverwrite);
1729  h1HitPadModule->Write("", TObject::kOverwrite);
1730  if (h2Module) delete h2Module;
1731  if (h1HitPadModule) delete h1HitPadModule;
1732 }
1733 
1734 
1736  TH2F* /*Layer*/,
1737  TCanvas* c1) {
1738  //----------------------Sector--------------------------------------
1739  Double_t SecXStart = 0.0;
1740  Double_t SecYStart = 0.0;
1741  Double_t SecXStop = 0.0;
1742  Double_t SecYStop = 0.0;
1743 
1744  for (Int_t iSec = 0; iSec < GeoPara->nSec - 1;
1745  iSec++) // would be enough to iterate up to nSec-1
1746  {
1747 
1748  if (GeoPara->sSize[iSec][0] < 2 * GeoPara->mSize[0]
1749  && GeoPara->sSize[iSec][0] > 0) // in x direction
1750  {
1751  SecXStart += GeoPara->sSize[iSec][0];
1752  SecXStop = SecXStart;
1753  } else {
1754  SecXStart = 0.0;
1755  SecXStop = GeoPara->sSize[iSec][0];
1756  }
1757 
1758  if (GeoPara->sSize[iSec][1] < 2 * GeoPara->mSize[1]
1759  && GeoPara->sSize[iSec][1] > 0) // in x direction
1760  {
1761  SecYStart += GeoPara->sSize[iSec][1];
1762  SecYStop = SecYStart;
1763  } else {
1764  SecYStart = 0.0;
1765  SecYStop = GeoPara->sSize[iSec][1];
1766  }
1767 
1768 
1769  TLine* sector = new TLine(GeoPara->mPos[0] - GeoPara->mSize[0] + SecXStart,
1770  GeoPara->mPos[1] - GeoPara->mSize[1] + SecYStart,
1771  GeoPara->mPos[0] - GeoPara->mSize[0] + SecXStop,
1772  GeoPara->mPos[1] - GeoPara->mSize[1] + SecYStop);
1773  sector->SetLineColor(15);
1774  sector->SetLineStyle(2);
1775 
1776  TPolyMarker* corner = new TPolyMarker(1);
1777  corner->SetPoint(
1778  0,
1779  GeoPara->mPos[0] - GeoPara->stepDirection[0] * GeoPara->mSize[0],
1780  GeoPara->mPos[1] - GeoPara->stepDirection[1] * GeoPara->mSize[1]);
1781  corner->SetMarkerStyle(21);
1782  corner->SetMarkerSize(.8);
1783 
1784  if (fDraw) {
1785  c1->cd(1);
1786  sector->Draw("same");
1787  corner->Draw("same");
1788  }
1789  }
1790 
1791 
1792  //----------------------Module--------------------------------------
1793  TBox* module = new TBox(GeoPara->mPos[0] - GeoPara->mSize[0],
1794  GeoPara->mPos[1] - GeoPara->mSize[1],
1795  GeoPara->mPos[0] + GeoPara->mSize[0],
1796  GeoPara->mPos[1] + GeoPara->mSize[1]);
1797  module->SetFillStyle(0);
1798  module->SetLineColor(1);
1799 
1800  TBox* M_inner = new TBox(GeoPara->mPos[0] - 100,
1801  GeoPara->mPos[1] - 100,
1802  GeoPara->mPos[0] + 100,
1803  GeoPara->mPos[1] + 100);
1804  // M_inner->SetUniqueID(ModuleId);
1805  M_inner->SetFillColor(kWhite);
1806 
1807  if (fDraw) {
1808  c1->cd(1);
1809  module->Draw("same"); // black module frame
1810  // M_inner->Draw("same"); // white box in module center // do not draw fot the time being
1811  c1->Write("", TObject::kOverwrite);
1812  }
1813 }
1814 // --------------------------------------------------------------------
1815 
1816 
1818  TH2F* /*Layer*/,
1819  TCanvas* c1) {
1820  //----------------------Pad--------------------------------------
1821  // const Int_t nR = GeoPara->nRow;
1822  // const Int_t nC = GeoPara->nCol;
1823 
1824  Int_t iSecX = 0;
1825  Int_t iSecY = 0;
1826 
1827  Double_t StartX = GeoPara->mPos[0] - GeoPara->mSize[0];
1828  Double_t StartY = GeoPara->mPos[1] - GeoPara->mSize[1];
1829 
1830  Int_t SecCol = GeoPara->sCol[iSecX];
1831  Int_t SecRow = GeoPara->sRow[iSecY];
1832 
1833  for (Int_t iR = 0; iR < GeoPara->nRow; iR++) // rows
1834  {
1835  StartX = GeoPara->mPos[0] - GeoPara->mSize[0];
1836  for (Int_t iC = 0; iC < GeoPara->nCol; iC++) // cols
1837  {
1838  TLine* Pa = new TLine(StartX, // - low
1839  StartY,
1840  StartX + GeoPara->pSize[iSecX][0],
1841  StartY);
1842  TLine* Pb = new TLine(StartX, // - high
1843  StartY + GeoPara->pSize[iSecY][1],
1844  StartX + GeoPara->pSize[iSecX][0],
1845  StartY + GeoPara->pSize[iSecY][1]);
1846  TLine* Pc = new TLine(StartX, // | left
1847  StartY,
1848  StartX,
1849  StartY + GeoPara->pSize[iSecY][1]);
1850  TLine* Pd = new TLine(StartX + GeoPara->pSize[iSecX][0], // | right
1851  StartY,
1852  StartX + GeoPara->pSize[iSecX][0],
1853  StartY + GeoPara->pSize[iSecY][1]);
1854  c1->cd(1);
1855  Pa->SetLineColor(17);
1856  //Pa->SetLineStyle(3);
1857  Pa->Draw("same");
1858 
1859  Pb->SetLineColor(17);
1860  //Pb->SetLineStyle(3);
1861  Pb->Draw("same");
1862 
1863  Pc->SetLineColor(17);
1864  //Pc->SetLineStyle(3);
1865  Pc->Draw("same");
1866 
1867  Pd->SetLineColor(17);
1868  //Pd->SetLineStyle(3);
1869  Pd->Draw("same");
1870 
1871  //printf("Sx Sy (%d,%d) nC nR (%d,%d) iC iR (%d,%d) SC SR (%d,%d) Px Py (%.1f,%.1f) StartX StartY (%.1f,%.1f)\n",iSecX,iSecY,GeoPara->nCol,GeoPara->nRow,iC,iR,SecCol,SecRow,GeoPara->pSize[iSecX][0],GeoPara->pSize[iSecY][1],StartX,StartY);
1872 
1873  if (iC == SecCol - 1) {
1874  iSecX++;
1875  SecCol += GeoPara->sCol[iSecX];
1876  }
1877  StartX += GeoPara->pSize[iSecX][0];
1878  }
1879  iSecX = 0;
1880  if (iR == SecRow - 1) {
1881  iSecY++;
1882  SecRow += GeoPara->sRow[iSecY];
1883  }
1884  StartY += GeoPara->pSize[iSecY][1];
1885  }
1886 }
1887 // --------------------------------------------------------------------
1888 
1889 
1890 // ------DrawDigi------------------------------------------------------
1892 // --------------------------------------------------------------------
1893 
1894 
1895 // ---- Register ------------------------------------------------------
1897  //FairRootManager::Instance()->Register("TrdDigi","Trd Digi", fDigiCollection, IsOutputBranchPersistent("TrdDigi"));
1898  //FairRootManager::Instance()->Register("TrdDigiMatch","Trd Digi Match", fDigiMatchCollection, IsOutputBranchPersistent("TrdDigiMatch"));
1899 }
1900 // --------------------------------------------------------------------
1901 
CbmTrdParModDigi::GetSectorSizeY
Double_t GetSectorSizeY(Int_t i) const
Definition: CbmTrdParModDigi.h:41
exp
friend F32vec4 exp(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:134
CbmTrdParSetAsic::GetModuleSet
virtual const CbmTrdParSet * GetModuleSet(Int_t detId) const
Definition: CbmTrdParSetAsic.cxx:238
CbmTrdHitRateFastQa::fDigiMatchCollection
TClonesArray * fDigiMatchCollection
TRD digis.
Definition: CbmTrdHitRateFastQa.h:236
CbmTrdHitRateFastQa::fGeoPar
CbmTrdParSetGeo * fGeoPar
Definition: CbmTrdHitRateFastQa.h:241
CbmTrdHitRateFastQa::fDraw
Bool_t fDraw
Definition: CbmTrdHitRateFastQa.h:164
HitRateGeoPara2::vY
Double_t vY[3]
Definition: CbmTrdHitRateFastQa.h:43
CbmTrdParAsic
Definition of ASIC parameters.
Definition: CbmTrdParAsic.h:15
HitRateGeoPara2::sRow
Int_t sRow[3]
Definition: CbmTrdHitRateFastQa.h:39
CbmTrdAddress::GetAddress
static UInt_t GetAddress(Int_t layerId, Int_t moduleId, Int_t sectorId, Int_t rowId, Int_t columnId)
Return address from system ID, layer, module, sector, column and row IDs.
Definition: CbmTrdAddress.h:38
CbmTrdUtils.h
CbmTrdHitRateFastQa::GetModuleInformationFromDigiPar
void GetModuleInformationFromDigiPar(HitRateGeoPara2 *GeoPara, Bool_t Fast, Bool_t Lines, Int_t VolumeID, TH2F *Layer, TCanvas *c1, TH1F *HitPad, TCanvas *c2, TH2F *Topview[3], TCanvas *c0, Double_t mm2bin)
Definition: CbmTrdHitRateFastQa.cxx:983
CbmTrdAddress.h
Helper class to convert unique channel ID back and forth.
CbmTrdHitRateFastQa::DrawBorders
void DrawBorders(HitRateGeoPara2 *GeoPara, TH2F *Layer, TCanvas *c1)
Definition: CbmTrdHitRateFastQa.cxx:1735
CbmTrdHitRateFastQa::fZLevel
std::vector< Double_t > fZLevel
Definition: CbmTrdHitRateFastQa.h:246
HitRateGeoPara2::pSize
Double_t pSize[3][3]
Definition: CbmTrdHitRateFastQa.h:31
CbmTrdParSetAsic::GetNofAsics
virtual Int_t GetNofAsics() const
Definition: CbmTrdParSetAsic.h:48
CbmTrdUtils
Definition: CbmTrdUtils.h:19
CbmTrdHitRateFastQa::CalcHitRate
Double_t CalcHitRate(HitRateGeoPara2 *GeoPara, Double_t StartX, Double_t StopX, Int_t xSteps, Double_t StartY, Double_t StopY, Int_t ySteps, Double_t *Mpos, TH2F *Topview[3], TCanvas *c0)
Definition: CbmTrdHitRateFastQa.cxx:1417
CbmTrdParModDigi::GetNofRowsInSector
Int_t GetNofRowsInSector(Int_t i) const
Definition: CbmTrdParModDigi.cxx:366
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmTrdParSetGeo.h
CbmTrdParModDigi::GetNofRows
Int_t GetNofRows() const
Definition: CbmTrdParModDigi.cxx:340
CbmTrdParSetAsic::GetAsicPar
virtual const CbmTrdParAsic * GetAsicPar(Int_t address) const
Definition: CbmTrdParSetAsic.h:40
CbmTrdParModDigi::GetNofColumnsInSector
Int_t GetNofColumnsInSector(Int_t i) const
Definition: CbmTrdParModDigi.cxx:359
HitRateGeoPara2
Definition: CbmTrdHitRateFastQa.h:22
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmTrdHitRateFastQa::nTotalOptLinks
Int_t nTotalOptLinks
Definition: CbmTrdHitRateFastQa.h:91
CbmTrdParSetAsic
Describe TRD module ASIC settings (electronic gain, delays, etc)
Definition: CbmTrdParSetAsic.h:18
CbmTrdParSetAsic::GetAsicAddress
virtual Int_t GetAsicAddress(Int_t chAddress) const
Look for the ASIC which operates on a specific channel.
Definition: CbmTrdParSetAsic.cxx:209
CbmTrdHitRateFastQa::fDigiPar
CbmTrdParSetDigi * fDigiPar
Definition: CbmTrdHitRateFastQa.h:240
CbmTrdAddress::GetLayerId
static UInt_t GetLayerId(UInt_t address)
Return layer ID from address.
Definition: CbmTrdAddress.h:69
CbmTrdAddress::GetModuleId
static UInt_t GetModuleId(UInt_t address)
Return module ID from address.
Definition: CbmTrdAddress.h:78
CbmTrdHitRateFastQa::fDigiCollection
TClonesArray * fDigiCollection
Trd MC points.
Definition: CbmTrdHitRateFastQa.h:235
HitRateGeoPara2::vX
Double_t vX[3]
Definition: CbmTrdHitRateFastQa.h:42
CbmTrdHitRateFastQa::HistoInit
void HistoInit(TCanvas *&c1, TCanvas *&c2, TCanvas *&c3, TH2F *&Layer, TH1F *&HitPad, Double_t ZRangeL, Double_t ZRangeU, Double_t mm2bin)
Definition: CbmTrdHitRateFastQa.cxx:821
CbmTrdHitRateFastQa::Init
virtual InitStatus Init()
Definition: CbmTrdHitRateFastQa.cxx:180
CbmTrdParModDigi::GetSizeX
Double_t GetSizeX() const
Definition: CbmTrdParModDigi.h:109
CbmTrdRadiator.h
CbmTrdParModGeo.h
HitRateGeoPara2::nRow
Int_t nRow
Definition: CbmTrdHitRateFastQa.h:37
CbmTrdParAsic.h
HitRateGeoPara2::mPos
Double_t mPos[3]
Definition: CbmTrdHitRateFastQa.h:27
CbmTrdHitRateFastQa::SetParContainers
virtual void SetParContainers()
Definition: CbmTrdHitRateFastQa.cxx:148
HitRateGeoPara2::sSize
Double_t sSize[3][3]
Definition: CbmTrdHitRateFastQa.h:30
CbmTrdParSetAsic.h
CbmTrdHitRateFastQa::Histo
void Histo(HitRateGeoPara2 *GeoPara, Bool_t Fast, TH2F *Layer, TCanvas *c1, TH1F *HitPad, TCanvas *c2, TH2F *Topview[3], TCanvas *c0, Double_t mm2bin)
Definition: CbmTrdHitRateFastQa.cxx:1479
CbmTrdGeoHandler
Definition: CbmTrdGeoHandler.h:29
CbmTrdParAsic::GetSizeY
virtual Double_t GetSizeY() const =0
CbmTrdHitRateFastQa::trdTotalDataRate
Double_t trdTotalDataRate
Definition: CbmTrdHitRateFastQa.h:92
CbmTrdHitRateFastQa::fColors
std::vector< Int_t > fColors
Definition: CbmTrdHitRateFastQa.h:245
CbmTrdParSet::GetNrOfModules
virtual Int_t GetNrOfModules() const
Definition: CbmTrdParSet.h:34
CbmTrdParAsic::GetX
virtual Double_t GetX() const
Definition: CbmTrdParAsic.h:37
CbmTrdHitRateFastQa::~CbmTrdHitRateFastQa
virtual ~CbmTrdHitRateFastQa()
Definition: CbmTrdHitRateFastQa.cxx:137
HitRateGeoPara2::layerId
Int_t layerId
Definition: CbmTrdHitRateFastQa.h:24
CbmTrdParModDigi::GetSectorSizeX
Double_t GetSectorSizeX(Int_t i) const
Definition: CbmTrdParModDigi.h:40
CbmTrdHitRateFastQa::fTrdPoints
TClonesArray * fTrdPoints
Definition: CbmTrdHitRateFastQa.h:234
CbmTrdHitRateFastQa::Register
void Register()
Definition: CbmTrdHitRateFastQa.cxx:1896
CbmTrdHitRateFastQa::ReInit
virtual InitStatus ReInit()
Definition: CbmTrdHitRateFastQa.cxx:163
CbmTrdParModGeo
Definition of geometry for one TRD module.
Definition: CbmTrdParModGeo.h:12
CbmTrdParModDigi::GetNofSectors
Int_t GetNofSectors() const
Definition: CbmTrdParModDigi.h:49
CbmTrdParSet::GetModuleId
virtual Int_t GetModuleId(Int_t i) const
Definition: CbmTrdParSet.cxx:32
winsize
#define winsize
Definition: CbmTrdHitRateFastQa.cxx:40
CbmTrdGeoHandler.h
Helper class to extract information from the GeoManager.
CbmTrdHitRateFastQa
Definition: CbmTrdHitRateFastQa.h:53
CbmTrdParModDigi::GetOrientation
Int_t GetOrientation() const
Definition: CbmTrdParModDigi.h:35
CbmTrdHitRateFastQa::nTotalAsics
Int_t nTotalAsics
Definition: CbmTrdHitRateFastQa.h:90
CbmTrdHitRateFastQa::FinishEvent
virtual void FinishEvent()
Definition: CbmTrdHitRateFastQa.cxx:935
CbmTrdParModDigi
Definition of chamber gain conversion for one TRD module.
Definition: CbmTrdParModDigi.h:14
CbmTrdGeoHandler::Init
void Init(Bool_t isSimulation=kFALSE)
Definition: CbmTrdGeoHandler.cxx:45
CbmTrdUtils::InitColorVector
void InitColorVector(Bool_t logScale, Double_t min, Double_t max)
Definition: CbmTrdUtils.cxx:38
CbmTrdParModDigi.h
HitRateGeoPara2::cosY
Double_t cosY
Definition: CbmTrdHitRateFastQa.h:48
CbmTrdHitRateFastQa::fMCStacks
TClonesArray * fMCStacks
Corresponding MCPoints to TRD digis.
Definition: CbmTrdHitRateFastQa.h:237
CbmTrdParAsic::GetSizeX
virtual Double_t GetSizeX() const =0
CbmTrdParSet::GetModulePar
virtual const CbmTrdParMod * GetModulePar(Int_t detId) const
Definition: CbmTrdParSet.cxx:45
HitRateGeoPara2::nSec
Int_t nSec
Definition: CbmTrdHitRateFastQa.h:33
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmTrdHitRateFastQa::fStation
Int_t fStation
Definition: CbmTrdHitRateFastQa.h:167
CbmTrdHitRateFastQa::CalcHitRatePad
Double_t CalcHitRatePad(const Double_t x_min, const Double_t x_max, const Double_t y_min, const Double_t y_max, const Double_t z)
Definition: CbmTrdHitRateFastQa.cxx:1389
CbmTrdParSetGeo
Definition: CbmTrdParSetGeo.h:9
CbmTrdHitRateFastQa::tFile
TFile * tFile
Definition: CbmTrdHitRateFastQa.h:162
CbmTrdHitRateFastQa::h1DataModule
TH1F * h1DataModule
Definition: CbmTrdHitRateFastQa.h:94
CbmTrdHitRateFastQa::GetModuleInformation
void GetModuleInformation()
Definition: CbmTrdHitRateFastQa.cxx:943
CbmTrdHitRateFastQa::fGeoHandler
CbmTrdGeoHandler * fGeoHandler
Definition: CbmTrdHitRateFastQa.h:243
CbmTrdParSetDigi.h
CbmTrdParModDigi::GetPosition
void GetPosition(Int_t sectorId, Int_t columnId, Int_t rowId, TVector3 &padPos, TVector3 &padSize) const
Definition: CbmTrdParModDigi.cxx:806
HitRateGeoPara2::lambda
Double_t lambda
Definition: CbmTrdHitRateFastQa.h:46
CbmTrdHitRateFastQa::fPlane
Int_t fPlane
Definition: CbmTrdHitRateFastQa.h:166
CbmTrdHitRateFastQa::h1OptLinksModule
TH1F * h1OptLinksModule
Definition: CbmTrdHitRateFastQa.h:95
CbmTrdHitRateFastQa::Exec
virtual void Exec(Option_t *option)
Definition: CbmTrdHitRateFastQa.cxx:217
CbmTrdHitRateFastQa::DrawDigi
void DrawDigi()
Definition: CbmTrdHitRateFastQa.cxx:1891
CbmTrdParModDigi::GetSizeY
Double_t GetSizeY() const
Definition: CbmTrdParModDigi.h:110
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTrdHitRateFastQa.h
fabs
friend F32vec4 fabs(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:60
CbmTrdHitRateFastQa::fAsicPar
CbmTrdParSetAsic * fAsicPar
MC Track information.
Definition: CbmTrdHitRateFastQa.h:239
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
HitRateGeoPara2::stepDirection
Int_t stepDirection[3]
Definition: CbmTrdHitRateFastQa.h:49
CbmTrdParModGeo::GetZ
virtual Double_t GetZ() const
Definition: CbmTrdParModGeo.h:32
pos
TVector3 pos
Definition: CbmMvdSensorDigiToHitTask.cxx:60
CbmTrdParSetDigi
Definition: CbmTrdParSetDigi.h:15
CbmTrdParAsic::GetY
virtual Double_t GetY() const
Definition: CbmTrdParAsic.h:38
CbmTrdHitRateFastQa::DrawPads
void DrawPads(HitRateGeoPara2 *GeoPara, TH2F *Layer, TCanvas *c1)
Definition: CbmTrdHitRateFastQa.cxx:1817
CbmTrdHitRateFastQa::fLayer
Int_t fLayer
Definition: CbmTrdHitRateFastQa.h:168
HitRateGeoPara2::vOrigin
Double_t vOrigin[3]
Definition: CbmTrdHitRateFastQa.h:41
CbmTrdParModGeo::GetX
virtual Double_t GetX() const
Definition: CbmTrdParModGeo.h:22
HitRateGeoPara2::moduleId
Int_t moduleId
Definition: CbmTrdHitRateFastQa.h:23
CbmTrdHitRateFastQa::myfile
std::ofstream myfile
Definition: CbmTrdHitRateFastQa.h:88
CbmTrdParSetAsic::GetAsicAddresses
virtual void GetAsicAddresses(std::vector< Int_t > *a) const
Definition: CbmTrdParSetAsic.cxx:224
CbmTrdParModGeo::GetY
virtual Double_t GetY() const
Definition: CbmTrdParModGeo.h:27
HitRateGeoPara2::rot_angle
Int_t rot_angle
Definition: CbmTrdHitRateFastQa.h:34
CbmTrdHitRateFastQa::ScanModulePlane
void ScanModulePlane(const Int_t moduleId, TCanvas *&c1, TCanvas *&c2, TH1F *&HitPad, TH1F *&HitAsic)
Definition: CbmTrdHitRateFastQa.cxx:628
CbmTrdHitRateFastQa::fDigiMap
std::map< std::pair< Int_t, std::pair< Int_t, Int_t > >, CbmTrdDigi * > fDigiMap
Definition: CbmTrdHitRateFastQa.h:250
HitRateGeoPara2::mSize
Double_t mSize[3]
Definition: CbmTrdHitRateFastQa.h:28
HitRateGeoPara2::stationId
Int_t stationId
Definition: CbmTrdHitRateFastQa.h:25
HitRateGeoPara2::nCol
Int_t nCol
Definition: CbmTrdHitRateFastQa.h:36
CbmTrdUtils::GetColorCode
Int_t GetColorCode(Double_t value)
Definition: CbmTrdUtils.cxx:54
HitRateGeoPara2::sCol
Int_t sCol[3]
Definition: CbmTrdHitRateFastQa.h:38
CbmTrdParModDigi::GetNofColumns
Int_t GetNofColumns() const
Definition: CbmTrdParModDigi.cxx:321
CbmTrdHitRateFastQa::CbmTrdHitRateFastQa
CbmTrdHitRateFastQa()
Definition: CbmTrdHitRateFastQa.cxx:55
CbmTrdHitRateFastQa::fBitPerHit
Double_t fBitPerHit
Definition: CbmTrdHitRateFastQa.h:247
HitRateGeoPara2::vN
Double_t vN[3]
Definition: CbmTrdHitRateFastQa.h:44
HitRateGeoPara2::cosX
Double_t cosX
Definition: CbmTrdHitRateFastQa.h:47