#if 1 #include #include #include #include #include #include #include #include #include //#include "RootHeader.h" #include "TTree.h" #include "TProfile.h" #include "TH1F.h" #include "TFile.h" #endif void plot_bcal(){ Float_t pi = 3.1415926; TPolyLine *cell_cont[49]; TPolyLine *cell[49][5][5]; TCanvas *c3 = new TCanvas("c3","c3",700,700); gPad->Range(-120,-120,120,120); Float_t rad_min = 60; Float_t rad_max = 90; Float_t dphi = 7.5*pi/180; for(Int_t module = 1; module <= 48; module++){ Float_t phi_min = pi - (module - 1)*dphi + dphi/2.; Float_t phi_max = phi_min - dphi; Float_t x_cell[5]; Float_t y_cell[5]; x_cell[0] = rad_min*cos(phi_min); y_cell[0] = rad_min*sin(phi_min); x_cell[1] = rad_max*cos(phi_min); y_cell[1] = rad_max*sin(phi_min); x_cell[3] = rad_min*cos(phi_max); y_cell[3] = rad_min*sin(phi_max); x_cell[2] = rad_max*cos(phi_max); y_cell[2] = rad_max*sin(phi_max); x_cell[4] = rad_min*cos(phi_min); y_cell[4] = rad_min*sin(phi_min); cout << " phi_min = " << phi_min << " phi_max = " << phi_max << endl; cell_cont[module] = new TPolyLine(5, x_cell, y_cell); cell_cont[module]->SetLineColor(2); cell_cont[module]->SetLineWidth(3); cell_cont[module]->Draw(); } Float_t dr = (rad_max - rad_min)/10.; Float_t dr_step[5]; dr_step[0] = 0; dr_step[1] = dr; dr_step[2] = 3*dr; dr_step[3] = 6*dr; dr_step[4] = 10*dr; Float_t X_IN1, Y_IN1, X_IN2, Y_IN2, X_OUT1, Y_OUT1, X_OUT2, Y_OUT2; for(Int_t module = 1; module <= 48; module++){ Float_t phi_min = pi - (module - 1)*dphi + dphi/2.; Float_t phi_max = phi_min - dphi; for(Int_t layer = 1; layer <= 4; layer++){ X_IN1 = (rad_min + dr_step[layer-1])*cos(phi_min); Y_IN1 = (rad_min + dr_step[layer-1])*sin(phi_min); X_IN2 = (rad_min + dr_step[layer-1])*cos(phi_max); Y_IN2 = (rad_min + dr_step[layer-1])*sin(phi_max); X_OUT1 = (rad_min + dr_step[layer])*cos(phi_min); Y_OUT1 = (rad_min + dr_step[layer])*sin(phi_min); X_OUT2 = (rad_min + dr_step[layer])*cos(phi_max); Y_OUT2 = (rad_min + dr_step[layer])*sin(phi_max); Float_t L_IN = sqrt( pow(X_IN2 - X_IN1,2) + pow(Y_IN2 - Y_IN1,2)); Float_t L_OUT = sqrt( pow(X_OUT2 - X_OUT1,2) + pow(Y_OUT2 - Y_OUT1,2)); // cout << L_IN << " " << L_OUT << endl; Float_t sin1 = (Y_IN2 - Y_IN1)/L_IN; Float_t cos1 = (X_IN2 - X_IN1)/L_IN; for(Int_t column = 1; column <= 4; column++){ x_cell[0] = X_IN1 + (column - 1)*L_IN*cos1/4; y_cell[0] = Y_IN1 + (column - 1)*L_IN*sin1/4; x_cell[1] = X_OUT1 + (column - 1)*L_OUT*cos1/4; y_cell[1] = Y_OUT1 + (column - 1)*L_OUT*sin1/4; x_cell[2] = X_OUT1 + column*L_OUT*cos1/4; y_cell[2] = Y_OUT1 + column*L_OUT*sin1/4; x_cell[3] = X_IN1 + column*L_IN*cos1/4; y_cell[3] = Y_IN1 + column*L_IN*sin1/4; x_cell[4] = X_IN1 + (column - 1)*L_IN*cos1/4; y_cell[4] = Y_IN1 + (column - 1)*L_IN*sin1/4; cell[module][layer][column] = new TPolyLine(5, x_cell, y_cell); cell[module][layer][column]->SetLineColor(1); cell[module][layer][column]->SetLineWidth(0.1); cell[module][layer][column]->Draw(); } } } cell[28][1][1]->SetFillColor(4); cell[28][2][1]->SetFillColor(4); cell[28][3][1]->SetFillColor(4); cell[28][4][1]->SetFillColor(4); cell[28][1][1]->Draw("f"); cell[28][2][1]->Draw("f"); cell[28][3][1]->Draw("f"); cell[28][4][1]->Draw("f"); // gPad->Modified(); }