//------------------ // DrawModule //------------------ void DrawModule(void) { TColor::CreateColorWheel(); TCanvas *c1 = new TCanvas("c1", "", 600, 900); c1->Range( -10.0, 58.0, 10.0, 88.0); // Draw all cells for(int ilayer=1; ilayer<=10; ilayer++){ for(int isector=1; isector<=4; isector++){ DrawCell(ilayer, ilayer, isector, isector, kBlack); } } // Draw outline around whole module DrawCell(1, 10, 1, 4, kBlack); // Draw Label TLatex *lab = new TLatex(0.0, 62.5, "SiPM segmentation"); lab->SetTextAlign(22); lab->SetTextSize(0.06); lab->Draw(); c1->SaveAs("FINE.pdf"); c1->SaveAs("FINE.png"); } //------------------ // DrawCell //------------------ void DrawCell(int layer_start, int layer_end, int sector_start, int sector_end, int color=kGray, bool fill=false) { double Rmin = GetRmin(layer_start); double Rmax = GetRmin(layer_end+1); double Phimin = GetPhimin(sector_start); double Phimax = GetPhimin(sector_end+1); double X[5], Y[5]; X[0] = Rmin*tan(Phimin); X[1] = Rmin*tan(Phimax); X[2] = Rmax*tan(Phimax); X[3] = Rmax*tan(Phimin); Y[0] = Rmin; Y[1] = Rmin; Y[2] = Rmax; Y[3] = Rmax; // Close off polygon X[4] = X[0]; Y[4] = Y[0]; TPolyLine *pl = new TPolyLine(5, X, Y); pl->SetLineColor(color); pl->SetLineWidth(color==kBlack ? 5:3); pl->SetFillColor(color); pl->SetFillStyle(fill ? 1001:0); pl->Draw(fill ? "f":""); } //------------------ // GetRmin //------------------ double GetRmin(int layer) { switch(layer){ case 1: return 64.3; case 2: return 66.3; case 3: return 68.3; case 4: return 70.3; case 5: return 72.3; case 6: return 74.3; case 7: return 76.3; case 8: return 78.768; case 9: return 81.236; case 10: return 83.704; case 11: return 86.172; default: return 0.0; } return 0.0; } //------------------ // GetPhimin //------------------ double GetPhimin(int sector) { double dphi = TMath::TwoPi()/48.0/4.0; switch(sector){ case 1: return -2.0*dphi; case 2: return -1.0*dphi; case 3: return 0.0*dphi; case 4: return +1.0*dphi; case 5: return +2.0*dphi; default: return 0.0; } return 0.0; }