15 #include "FairLogger.h"
16 #include "FairRootManager.h"
17 #include "FairRunAna.h"
18 #include "FairRuntimeDb.h"
22 #include "TClonesArray.h"
24 #include "TGeoManager.h"
30 #include "TPolyMarker.h"
34 #include "Riostream.h"
40 #define winsize 6000 // 1500 // 5500 // 6000
49 using std::setiosflags;
50 using std::setprecision;
67 , h1OptLinksModule(NULL)
118 , fPRFHitPositionLL(0.)
119 , fPRFHitPositionC(0.)
122 , fDigiCollection(NULL)
123 , fDigiMatchCollection(NULL)
149 cout <<
" * CbmTrdHitRateFastQa * :: SetParContainers() " << endl;
153 FairRunAna* ana = FairRunAna::Instance();
154 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
165 cout <<
" * CbmTrdHitRateFastQa * :: ReInit() " << endl;
168 FairRunAna* ana = FairRunAna::Instance();
169 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
182 cout <<
" * CbmTrdHitRate * :: Init() " << endl;
184 FairRootManager* ioman = FairRootManager::Instance();
185 if (!ioman) Fatal(
"Init",
"No FairRootManager");
187 fTrdPoints = (TClonesArray*) ioman->GetObject(
"TrdPoint");
189 cout <<
"-W CbmTrdCluster::Init: No TrdPoints array!" << endl;
190 cout <<
" Task will be inactive" << endl;
194 fMCStacks = (TClonesArray*) ioman->GetObject(
"MCTrack");
196 cout <<
"-W CbmTrdCluster::Init: No MCTrack array!" << endl;
197 cout <<
" Task will be inactive" << endl;
218 myfile.open(
"hits_per_asic.txt", std::fstream::out);
220 myfile <<
"## TRD data per ASIC" << endl;
223 myfile <<
"#--------------------------" << endl;
232 gStyle->SetNumberContours(99);
243 printf(
"Introduction:\n");
249 Double_t ZRangeL = 1;
250 Double_t ZRangeU = 1e05;
251 Double_t mm2bin = 2.5;
256 "CbmTrdHitRateFastQa.root",
"RECREATE",
" ROOT file with histograms");
264 sprintf(title,
"Data_per_Asic");
269 const Int_t anbins = 100;
271 Double_t axmax = 2000;
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];
277 for (Int_t
i = 1;
i <= anbins;
i++) {
278 axbins[
i] = axmin + TMath::Power(10, alogxmin +
i * abinwidth);
280 TH1F* h1HitAsic =
new TH1F(name, title, anbins, axbins);
283 h1HitAsic->SetXTitle(
"Hits/Asic [Hz]");
285 h1HitAsic->SetXTitle(
"Data/32ch Asic [Mbit/s]");
286 h1HitAsic->SetYTitle(
"count");
291 sprintf(title,
"Data_per_Module");
296 const Int_t bnbins = 100;
298 Double_t bxmax = 100 * 2000;
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];
304 for (Int_t
i = 1;
i <= bnbins;
i++) {
305 bxbins[
i] = bxmin + TMath::Power(10, blogxmin +
i * bbinwidth);
318 sprintf(title,
"5_Gbps_optical_links_per_Module");
324 TH1F* h1HitPad = NULL;
325 TH2F* h2Layer = NULL;
326 TH2F* h2Topview[3] = {NULL, NULL, NULL};
332 c0 =
new TCanvas(
"c0",
"c0", 1800, 450);
335 const Int_t z_cave = 12000;
336 h2Topview[0] =
new TH2F(
"TopView",
341 int(z_cave / mm2bin),
344 h2Topview[0]->SetXTitle(
"x-Coordinate [mm]");
345 h2Topview[0]->SetYTitle(
"z-Coordinate [mm]");
346 h2Topview[0]->SetZTitle(
"#");
347 h2Topview[1] =
new TH2F(
"FrontView",
355 h2Topview[1]->SetXTitle(
"x-Coordinate [mm]");
356 h2Topview[1]->SetYTitle(
"y-Coordinate [mm]");
357 h2Topview[1]->SetZTitle(
"#");
358 h2Topview[2] =
new TH2F(
"SideView",
360 int(z_cave / mm2bin),
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);
383 h2Topview[
i]->Draw(
"colz");
395 for (Int_t
i = 0;
i < TColor::GetNumberOfColors();
i++) {
396 fColors.push_back(TColor::GetColorPalette(
i));
400 TMath::Log10(ZRangeU) / TColor::GetNumberOfColors() *
i));
425 for (Int_t
i = 0;
i < NofModules;
i++) {
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);
452 vector<vector<int>> LiSi;
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);
476 TLine* MaxHitRatePerPad =
477 new TLine(1e05, 0, 1e05, 1e04);
478 MaxHitRatePerPad->SetLineColor(2);
479 MaxHitRatePerPad->SetLineWidth(8);
489 if ((Int_t) LiSi.size() > 0)
490 for (vector<vector<Int_t>>::size_type j = 0; j < LiSi.size(); j++) {
492 UInt_t nModulesInThisLayer = LiSi[j].size();
493 if (nModulesInThisLayer == 0)
break;
498 printf(
"Station: %i Layer: %i nModules: %i\n",
501 nModulesInThisLayer);
503 h2Topview[0]->Reset();
504 h2Topview[1]->Reset();
505 h2Topview[2]->Reset();
507 OutFile1.Form(
"pics/HitRateLayerPadView_S%d_L%d.png",
fStation,
fLayer);
508 OutFile2.Form(
"pics/HitRateLayerSpectrum_S%d_L%d.png",
fStation,
fLayer);
510 HistoInit(c1, c2, c3, h2Layer, h1HitPad, ZRangeL, ZRangeU, mm2bin);
514 MaxHitRatePerPad->Draw(
"same");
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;
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");
549 c3->SaveAs(OutFile1);
550 OutFile1.ReplaceAll(
"pdf",
"png");
551 c3->SaveAs(OutFile1);
555 h1HitPad->Draw(
"same");
559 h1HitAsic->Write(
"", TObject::kOverwrite);
561 TLine* MaxDataRatePerUplink =
563 0.7 * gPad->GetUymax(),
567 MaxDataRatePerUplink->SetLineColor(2);
568 MaxDataRatePerUplink->SetLineWidth(8);
569 MaxDataRatePerUplink->Draw(
"same");
576 TLine* MaxDataRatePerOptLink =
578 0.7 * gPad->GetUymax(),
582 MaxDataRatePerOptLink->SetLineColor(2);
583 MaxDataRatePerOptLink->SetLineWidth(8);
584 MaxDataRatePerOptLink->Draw(
"same");
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);
603 if (Outimage1)
delete Outimage1;
604 if (Outimage2)
delete Outimage2;
606 if (h2Layer)
delete h2Layer;
607 if (h1HitPad)
delete h1HitPad;
608 if (
fDraw) c0->Update();
610 if (
fDraw) c0->Update();
611 h1HitAsic->Write(
"", TObject::kOverwrite);
613 printf(
" --------------------------\n");
614 printf(
" total number of ASICs : %d\n",
nTotalAsics);
616 printf(
" total TRD data rate : %.2f (Gbit/s)\n",
618 printf(
" --------------------------\n");
619 printf(
" --------------------------\n");
622 myfile <<
"#--------------------------" << endl;
623 myfile <<
"#--------------------------" << endl;
634 Double_t ratePerModule = 0;
643 gGeoManager->FindNode(
644 fModuleGeo->
GetX(), fModuleGeo->
GetY(), fModuleGeo->
GetZ());
650 std::vector<Int_t> AsicAddresses;
653 printf(
" NofAsics: %3i\n", nofAsics);
654 myfile <<
"# NofAsics : " << nofAsics << endl;
655 myfile <<
"# moduleAddress / Asic ID / hits per 32ch Asic per second" << endl;
657 std::map<Int_t, Double_t> ratePerAsicMap;
658 for (Int_t iAsic = 0; iAsic < nofAsics; iAsic++) {
659 ratePerAsicMap[AsicAddresses[iAsic]] = 0.;
662 for (Int_t s = 0; s < nSec; s++) {
665 for (Int_t r = 0; r < nRow; r++) {
666 for (Int_t c = 0; c < nCol; c++) {
672 Int_t channelAddress =
678 Double_t local_min[3] = {padPos[0] - 0.5 * padSize[0],
679 padPos[1] - 0.5 * padSize[1],
681 Double_t local_max[3] = {padPos[0] + 0.5 * padSize[0],
682 padPos[1] + 0.5 * padSize[1],
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];
703 for (Int_t
i = 0;
i < 3;
i++) {
711 local_min[0], local_max[0], local_min[1], local_max[1], local_max[2]);
713 ratePerModule += rate;
717 new TBox(local_min[0], local_min[1], local_max[0], local_max[1]);
719 pad->SetLineColor(0);
720 pad->SetLineWidth(0);
729 if (j >=
fZLevel.size() || rate > 1E05) pad->SetFillColor(12);
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;
747 new TBox(fModuleGeo->
GetX() * 10 - fModuleInfo->
GetSizeX() * 10,
750 fModuleGeo->
GetY() * 10 + fModuleInfo->
GetSizeY() * 10);
751 module->SetFillStyle(0);
752 module->Draw(
"same");
755 module->Draw(
"same");
761 for (Int_t iAsic = 0; iAsic < nofAsics; iAsic++) {
762 Asic = fModuleAsic->
GetAsicPar(AsicAddresses[iAsic]);
764 Double_t local_min[3];
765 Double_t local_max[3];
766 Double_t master_min[3];
767 Double_t master_max[3];
770 local_min[2] = fModuleGeo->
GetZ();
773 local_max[2] = fModuleGeo->
GetZ();
774 gGeoManager->LocalToMaster(local_min, master_min);
775 gGeoManager->LocalToMaster(local_max, master_max);
777 asic =
new TBox(10. * master_min[0],
780 10. * master_max[1]);
782 if (ratePerAsicMap[AsicAddresses[iAsic]] > 4e6)
783 asic->SetFillColor(kBlack);
786 utils->
GetColorCode(ratePerAsicMap[AsicAddresses[iAsic]]));
789 myfile << moduleAddress <<
" " << setfill(
'0') << setw(2) << iAsic <<
" "
790 << setiosflags(ios::fixed) << setprecision(0) << setfill(
' ')
791 << setw(8) << ratePerAsicMap[AsicAddresses[iAsic]] << endl;
793 Double_t dataPerAsic = ratePerAsicMap[AsicAddresses[iAsic]] * 3 * 1e-6
795 HitAsic->Fill(dataPerAsic);
800 Double_t dataPerModule =
813 printf(
" data rate: %11.4f (Gbit/s)\n", dataPerModule * 1e-3);
814 printf(
" opt links: %6i\n", nOptLinks);
815 printf(
" --------------------------\n");
817 myfile <<
"#--------------------------" << endl;
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];
845 for (Int_t
i = 1;
i <= cnbins;
i++) {
846 cxbins[
i] = cxmin + TMath::Power(10, clogxmin +
i * cbinwidth);
848 HitPad =
new TH1F(name, title, cnbins, cxbins);
851 HitPad->SetXTitle(
"Hits/Pad [Hz]");
852 HitPad->SetYTitle(
"count");
853 HitPad->GetYaxis()->SetRangeUser(1, 1e04);
858 c2 =
new TCanvas(name, title, 1600, 900);
860 c2->cd(1)->SetLogx(1);
861 c2->cd(1)->SetLogy(1);
862 c2->cd(1)->SetGridx(1);
863 c2->cd(1)->SetGridy(1);
867 c2->cd(2)->SetLogx(1);
868 c2->cd(2)->SetLogy(0);
869 c2->cd(2)->SetGridx(1);
870 c2->cd(2)->SetGridy(1);
873 c2->cd(3)->SetLogx(1);
874 c2->cd(3)->SetLogy(0);
875 c2->cd(3)->SetGridx(1);
876 c2->cd(3)->SetGridy(1);
879 c2->cd(4)->SetLogx(0);
880 c2->cd(4)->SetLogy(0);
881 c2->cd(4)->SetGridx(1);
882 c2->cd(4)->SetGridy(1);
887 printf(
"%s\n", title);
889 Layer =
new TH2F(name,
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.);
917 c1 =
new TCanvas(name, title, 1000, 900);
919 c1->cd(1)->SetLogz(1);
920 Layer->DrawCopy(
"colz");
923 c3 =
new TCanvas(name, title, 1000, 900);
925 c3->cd(1)->SetLogz(1);
926 Layer->GetZaxis()->SetRangeUser(1., 4e6);
927 Layer->SetZTitle(
"Hits/Asic [Hz]");
928 Layer->DrawCopy(
"colz");
955 TString path = gGeoManager->GetPath();
956 cout <<
"Path: " << path << endl;
957 TStringToken* bla =
new TStringToken(path,
"/");
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);
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);
1005 if (fModuleInfo != NULL) {
1016 GeoPara->
mPos[0] = fModuleGeo->
GetX() * 10;
1017 GeoPara->
mPos[1] = fModuleGeo->
GetY() * 10;
1018 GeoPara->
mPos[2] = fModuleGeo->
GetZ() * 10;
1022 GeoPara->
mSize[2] = 0;
1027 for (Int_t s = 0; s < GeoPara->
nSec; s++)
1029 GeoPara->
sCol[s] = 0;
1030 GeoPara->
sRow[s] = 0;
1032 fModuleInfo->
GetPosition( s, 0, 0, padPos, padSize);
1033 GeoPara->
pSize[s][2] = 0;
1035 for (Int_t
i = 0;
i < 2;
i++)
1037 GeoPara->
pSize[s][
i] = padSize[
i] * 10;
1046 round(GeoPara->
sSize[s][
i]
1052 round(GeoPara->
sSize[s][
i]
1055 GeoPara->
sCol[s] = 0;
1072 round(GeoPara->
sSize[s][
i]
1075 GeoPara->
sRow[s] = 0;
1088 itemp = GeoPara->
nRow;
1090 GeoPara->
nCol = itemp;
1092 for (Int_t s = 0; s < GeoPara->
nSec; s++)
1094 dtemp = GeoPara->
sRow[s];
1095 GeoPara->
sRow[s] = GeoPara->
sCol[s];
1096 GeoPara->
sCol[s] = dtemp;
1098 dtemp = GeoPara->
sSize[s][0];
1100 GeoPara->
sSize[s][1] = dtemp;
1102 dtemp = GeoPara->
pSize[s][0];
1104 GeoPara->
pSize[s][1] = dtemp;
1106 cout <<
"swapped x and y" << endl;
1110 fModuleInfo->
GetPosition( 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;
1116 fModuleInfo->
GetPosition( 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];
1123 fModuleInfo->
GetPosition( 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];
1130 GeoPara->
vX[1] * GeoPara->
vY[2] - GeoPara->
vX[2] * GeoPara->
vY[1];
1132 GeoPara->
vX[2] * GeoPara->
vY[0] - GeoPara->
vX[0] * GeoPara->
vY[2];
1134 GeoPara->
vX[0] * GeoPara->
vY[1] - GeoPara->
vX[1] * GeoPara->
vY[0];
1139 + GeoPara->
vOrigin[2] * GeoPara->
vN[2]);
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));
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));
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;
1162 if (GeoPara->
vX[0] != 0)
1173 if (GeoPara->
vY[1] != 0)
1187 for (Int_t
i = 0;
i < 3;
i++)
1189 Mpos[
i] = GeoPara->
mPos[
i];
1193 cout.setf(ios::fixed);
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;
1203 Double_t Ssize[3 * nSec];
1204 Double_t Psize[3 * nSec];
1205 for (Int_t iSec = 0; iSec < nSec; iSec++)
1207 Ssize[0 + iSec * nSec] = GeoPara->
sSize[iSec][0];
1208 Ssize[1 + iSec * nSec] = GeoPara->
sSize[iSec][1];
1209 Ssize[2 + iSec * nSec] = 0;
1211 Psize[0 + iSec * nSec] = GeoPara->
pSize[iSec][0];
1212 Psize[1 + iSec * nSec] = GeoPara->
pSize[iSec][1];
1213 Psize[2 + iSec * nSec] = 0;
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;
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;
1228 Int_t nCol = GeoPara->
nCol;
1229 Int_t nRow = GeoPara->
nRow;
1232 const Int_t mRow = fModuleInfo->
GetNofRows();
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
1244 cout <<
"mcol " << setw(10) << mCol <<
" mrow " << setw(10) << mRow
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)
1293 cout <<
"cos " << setw(10) << GeoPara->
cosX << setw(10) << GeoPara->
cosY
1295 cout <<
"v00xy " << setw(10) << GeoPara->
mPos[0] - GeoPara->
vOrigin[0]
1296 << setw(10) << GeoPara->
mPos[1] - GeoPara->
vOrigin[1] << endl;
1318 <<
" rot " << setw(10) << GeoPara->
rot_angle << endl;
1339 cout <<
"------------------------------------------------------" << endl;
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]);
1349 Histo(GeoPara, Fast, Layer, c1, HitPad, c2, Topview, c0, mm2bin);
1353 for (Int_t s = 0; s < GeoPara->
nSec; s++)
1355 fModuleInfo->
GetPosition( s, 0, 0, padPos, padSize);
1357 TPolyMarker* start =
new TPolyMarker(1);
1358 start->SetPoint(0, padPos(0) * 10, padPos(1) * 10);
1359 start->SetMarkerStyle(22);
1360 start->SetMarkerSize(.8);
1364 start->Draw(
"same");
1368 GeoPara->
sCol[0] - 1,
1369 GeoPara->
sRow[s] - 1,
1373 TPolyMarker* end =
new TPolyMarker(1);
1374 end->SetPoint(0, padPos(0) * 10, padPos(1) * 10);
1375 end->SetMarkerStyle(20);
1376 end->SetMarkerSize(.8);
1387 printf(
"fModuleInfo == NULL\n");
1390 const Double_t x_max,
1391 const Double_t y_min,
1392 const Double_t y_max,
1396 Double_t r(0), alpha(0), HitRate(0);
1397 Double_t xStepWidth(1), yStepWidth(1);
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);
1402 for (Int_t yStep = 0; yStep < ySteps; yStep++) {
1404 for (Int_t xStep = 0; xStep < xSteps; xStep++) {
1405 r =
sqrt(pow(
x, 2) + pow(
y, 2));
1406 alpha = atan(r / z) * 1000.;
1408 exp(4.536355e00 + -8.393716e-03 * alpha)
1409 +
exp(2.400547e01 + -1.208306e-02 * alpha) / (z * z);
1428 Double_t HitRate = 0;
1435 Double_t xStepWidth = GeoPara->
cosX;
1436 Double_t yStepWidth = GeoPara->
cosY;
1438 StartX + 0.5 * GeoPara->
cosX;
1439 Double_t
y = StartY + 0.5 * GeoPara->
cosY;
1445 Double_t z = (GeoPara->
lambda - (
x * GeoPara->
vN[0] +
y * GeoPara->
vN[1]))
1447 for (Int_t yStep = 0; yStep < ySteps; yStep++) {
1448 x = StartX + 0.5 * GeoPara->
cosX;
1450 for (Int_t xStep = 0; xStep < xSteps; xStep++) {
1451 z = (GeoPara->
lambda - (
x * GeoPara->
vN[0] +
y * GeoPara->
vN[1]))
1453 r =
sqrt(pow(
x / 1.5, 2) + pow(
y, 2));
1454 alpha = atan(r / z) * 1000.;
1463 exp(4.536355e00 + -8.393716e-03 * alpha)
1464 +
exp(2.400547e01 + -1.208306e-02 * alpha) / (z * z);
1488 Double_t ZRangeL = 1e00;
1489 Double_t ZRangeU = 1e05;
1493 name.Form(
"ModuleID %5d", GeoPara->
moduleId);
1495 cout <<
" " << name <<
"\n" << flush;
1497 name.Form(
"Module%05d", GeoPara->
moduleId);
1499 if (GeoPara->
mSize[0] < 500)
1500 h2Module =
new TH2F(name,
1509 h2Module =
new TH2F(name,
1518 h2Module->GetZaxis()->SetRangeUser(ZRangeL, ZRangeU);
1520 name.Form(
"Module%05dHitPad", GeoPara->
moduleId);
1521 TH1F* h1HitPadModule =
new TH1F(name, name, 1200, 0, 120000);
1529 Double_t HiteRate = 0;
1534 Double_t planeStartX = GeoPara->
mPos[0] - GeoPara->
mSize[0];
1535 Double_t planeStopX = planeStartX + GeoPara->
pSize[iSecX][0];
1537 Double_t planeStartY = GeoPara->
mPos[1] - GeoPara->
mSize[1];
1538 Double_t planeStopY = planeStartY + GeoPara->
pSize[iSecY][1];
1542 + 0.5 * GeoPara->
pSize[iSecX][0]
1544 Double_t StopX = StartX + GeoPara->
pSize[iSecX][0] * GeoPara->
cosX;
1548 Double_t StopY = StartY + GeoPara->
pSize[iSecY][1] * GeoPara->
cosY;
1564 for (Int_t iR = 0; iR < GeoPara->
nRow; iR++)
1568 + 0.5 * GeoPara->
pSize[iSecX][0] * GeoPara->
cosX;
1569 StopX = StartX + GeoPara->
pSize[iSecX][0] * GeoPara->
cosX;
1570 planeStartX = GeoPara->
mPos[0] - GeoPara->
mSize[0];
1571 planeStopX = planeStartX + GeoPara->
pSize[iSecX][0];
1573 for (Int_t iC = 0; iC < GeoPara->
nCol; iC++)
1575 xSteps = GeoPara->
pSize[iSecX][0] - 1;
1576 ySteps = GeoPara->
pSize[iSecY][1] - 1;
1581 if (GeoPara->
mPos[0] < 1
1582 && GeoPara->
mPos[1] < 1)
1594 h1HitPad->Fill(HiteRate, 4);
1610 h1HitPad->Fill(HiteRate);
1611 h1HitPadModule->Fill(HiteRate);
1616 Int_t mStepX = Int_t((planeStartX - GeoPara->
mPos[0]));
1617 Int_t mStepY = Int_t((planeStartY - GeoPara->
mPos[1]));
1619 for (Int_t stepY =
int(planeStartY / mm2bin);
1620 stepY < int(planeStopY / mm2bin);
1624 for (Int_t stepX =
int(planeStartX / mm2bin);
1625 stepX < int(planeStopX / mm2bin);
1631 if (GeoPara->
mPos[0] < 1
1632 && GeoPara->
mPos[1] < 1) {
1634 h2Layer->SetBinContent(stepX +
int(
winsize / mm2bin),
1635 stepY + int(
winsize / mm2bin),
1637 h2Layer->SetBinContent(-1 * stepX +
int(
winsize / mm2bin),
1638 stepY + int(
winsize / mm2bin),
1640 h2Layer->SetBinContent(stepX +
int(
winsize / mm2bin),
1641 -1 * stepY + int(
winsize / mm2bin),
1643 h2Layer->SetBinContent(-1 * stepX +
int(
winsize / mm2bin),
1644 -1 * stepY + int(
winsize / mm2bin),
1649 h2Module->Fill(mStepX,
1659 h2Layer->SetBinContent(stepX +
int(
winsize / mm2bin),
1660 stepY + int(
winsize / mm2bin),
1666 cout <<
"filling 5 " << mStepX <<
" " << mStepY <<
" " << HiteRate
1668 h2Module->Fill(mStepX,
1684 if (iC == GeoPara->
sCol[iSecX]) {
1703 if (iR == GeoPara->
sRow[iSecY]) {
1722 for (Int_t
i = 0;
i < 3;
i++)
1723 Topview[
i]->Write(
"", TObject::kOverwrite);
1725 h2Layer->Write(
"", TObject::kOverwrite);
1726 h1HitPad->Write(
"", TObject::kOverwrite);
1728 h2Module->Write(
"", TObject::kOverwrite);
1729 h1HitPadModule->Write(
"", TObject::kOverwrite);
1730 if (h2Module)
delete h2Module;
1731 if (h1HitPadModule)
delete h1HitPadModule;
1739 Double_t SecXStart = 0.0;
1740 Double_t SecYStart = 0.0;
1741 Double_t SecXStop = 0.0;
1742 Double_t SecYStop = 0.0;
1744 for (Int_t iSec = 0; iSec < GeoPara->
nSec - 1;
1748 if (GeoPara->
sSize[iSec][0] < 2 * GeoPara->
mSize[0]
1749 && GeoPara->
sSize[iSec][0] > 0)
1751 SecXStart += GeoPara->
sSize[iSec][0];
1752 SecXStop = SecXStart;
1755 SecXStop = GeoPara->
sSize[iSec][0];
1758 if (GeoPara->
sSize[iSec][1] < 2 * GeoPara->
mSize[1]
1759 && GeoPara->
sSize[iSec][1] > 0)
1761 SecYStart += GeoPara->
sSize[iSec][1];
1762 SecYStop = SecYStart;
1765 SecYStop = GeoPara->
sSize[iSec][1];
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);
1776 TPolyMarker* corner =
new TPolyMarker(1);
1781 corner->SetMarkerStyle(21);
1782 corner->SetMarkerSize(.8);
1786 sector->Draw(
"same");
1787 corner->Draw(
"same");
1793 TBox* module =
new TBox(GeoPara->
mPos[0] - GeoPara->
mSize[0],
1797 module->SetFillStyle(0);
1798 module->SetLineColor(1);
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);
1805 M_inner->SetFillColor(kWhite);
1809 module->Draw(
"same");
1811 c1->Write(
"", TObject::kOverwrite);
1827 Double_t StartX = GeoPara->
mPos[0] - GeoPara->
mSize[0];
1828 Double_t StartY = GeoPara->
mPos[1] - GeoPara->
mSize[1];
1830 Int_t SecCol = GeoPara->
sCol[iSecX];
1831 Int_t SecRow = GeoPara->
sRow[iSecY];
1833 for (Int_t iR = 0; iR < GeoPara->
nRow; iR++)
1835 StartX = GeoPara->
mPos[0] - GeoPara->
mSize[0];
1836 for (Int_t iC = 0; iC < GeoPara->
nCol; iC++)
1838 TLine* Pa =
new TLine(StartX,
1840 StartX + GeoPara->
pSize[iSecX][0],
1842 TLine* Pb =
new TLine(StartX,
1843 StartY + GeoPara->
pSize[iSecY][1],
1844 StartX + GeoPara->
pSize[iSecX][0],
1845 StartY + GeoPara->
pSize[iSecY][1]);
1846 TLine* Pc =
new TLine(StartX,
1849 StartY + GeoPara->
pSize[iSecY][1]);
1850 TLine* Pd =
new TLine(StartX + GeoPara->
pSize[iSecX][0],
1852 StartX + GeoPara->
pSize[iSecX][0],
1853 StartY + GeoPara->
pSize[iSecY][1]);
1855 Pa->SetLineColor(17);
1859 Pb->SetLineColor(17);
1863 Pc->SetLineColor(17);
1867 Pd->SetLineColor(17);
1873 if (iC == SecCol - 1) {
1875 SecCol += GeoPara->
sCol[iSecX];
1877 StartX += GeoPara->
pSize[iSecX][0];
1880 if (iR == SecRow - 1) {
1882 SecRow += GeoPara->
sRow[iSecY];
1884 StartY += GeoPara->
pSize[iSecY][1];