#include "TFile.h" #include "TCanvas.h" #include "TH1.h" #include void angle_pair(){ Int_t phiBins = 24; Int_t thetaBins = 18; TH2F *hlcc = new TH2F("hlcc","",phiBins,0,1,thetaBins,0,1); gStyle->SetPalette(1); gStyle->SetOptStat(0); gStyle->SetHistMinimumZero(); gStyle->SetCanvasPreferGL(true); float elevation[10][25] = { {0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5} { 0.360, 0.360, 0.369, 0.388, 0.416, 0.453, 0.5, 0.547, 0.584, 0.612, 0.631, 0.640, 0.640, 0.640, 0.631, 0.612, 0.584, 0.547, 0.5, 0.453, 0.416, 0.388, 0.369, 0.360, 0.360} {0.236, 0.236, 0.254, 0.289, 0.342, 0.412, 0.5, 0.588, 0.658, 0.711, 0.746, 0.764, 0.764, 0.764, 0.746, 0.711, 0.658, 0.588, 0.5, 0.412, 0.342, 0.289, 0.254, 0.236, 0.236} {0.138, 0.138, 0.162, 0.210, 0.283, 0.379, 0.5, 0.621, 0.717, 0.790, 0.838, 0.862, 0.862, 0.862, 0.838, 0.790, 0.717, 0.621, 0.5, 0.379, 0.283, 0.210, 0.162, 0.138, 0.138} {0.070, 0.070, 0.099, 0.156, 0.242, 0.357, 0.5, 0.643, 0.758, 0.844, 0.901, 0.930, 0.930, 0.930, 0.901, 0.844, 0.758, 0.643, 0.5, 0.357, 0.242, 0.156, 0.099, 0.070, 0.070} {0.030, 0.030, 0.061, 0.124, 0.218, 0.343, 0.5, 0.657, 0.782, 0.876, 0.939, 0.970, 0.970, 0.970, 0.939, 0.876, 0.782, 0.657, 0.5, 0.343, 0.218, 0.124, 0.061, 0.030, 0.030} {0.010, 0.010, 0.043, 0.108, 0.206, 0.337, 0.5, 0.663, 0.794, 0.892, 0.957, 0.990, 0.990, 0.990, 0.957, 0.892, 0.794, 0.663, 0.5, 0.337, 0.206, 0.108, 0.043, 0.010, 0.010} {0.002, 0.002, 0.035, 0.102, 0.201, 0.334, 0.5, 0.666, 0.799, 0.898, 0.965, 0.998, 1, 0.998, 0.965, 0.898, 0.799, 0.666, 0.5, 0.334, 0.201, 0.102, 0.035, 0.002, 0.002} {0, 0, 0.033, 0.100, 0.200, 0.333, 0.5, 0.667, 0.800, 0.900, 0.967, 1, 1, 1, 0.967, 0.900, 0.800, 0.667, 0.5,0.333, 0.200, 0.100, 0.033, 0, 0} {0, 0, 0.033, 0.100, 0.200, 0.333, 0.5, 0.667, 0.800, 0.900, 0.967, 1, 1, 1, 0.967, 0.900, 0.800, 0.667, 0.5,0.333, 0.200, 0.100, 0.033, 0, 0} }; for (int i = 1; i<=phiBins; i++) { for (int j = 1; j<=thetaBins/2; j++) { hlcc->SetBinContent(i,j,(elevation[j-1][i-1]+elevation[j][i])/2.); } } //hlcc->SetBinContent(12,5,0); //hlcc->Draw("LEGO2 SPH"); //c4->cd(2); Int_t phiBins1 = 24; Int_t thetaBins1 = 17; TH2F *h2cc = new TH2F("h2cc","",phiBins1,0,1,thetaBins1,0,1); gStyle->SetPalette(1); gStyle->SetOptStat(0); gStyle->SetHistMinimumZero(); gStyle->SetCanvasPreferGL(true); float elevation1[18][25] = { { 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5} {0.640, 0.640, 0.631, 0.612, 0.584, 0.547, 0.5, 0.453, 0.416, 0.388, 0.369, 0.360, 0.360, 0.360, 0.369, 0.388, 0.416, 0.453, 0.5, 0.547, 0.584, 0.612, 0.631, 0.640, 0.640} {0.764, 0.764, 0.746, 0.711, 0.658, 0.588, 0.5, 0.412, 0.342, 0.289, 0.254, 0.236, 0.236, 0.236, 0.254, 0.289, 0.342, 0.412, 0.5, 0.588, 0.658, 0.711, 0.746, 0.764, 0.764} {0.862, 0.862, 0.838, 0.790, 0.717, 0.621, 0.5, 0.379, 0.283, 0.210, 0.162, 0.138, 0.138, 0.138, 0.162, 0.210, 0.283, 0.379, 0.5, 0.621, 0.717, 0.790, 0.838, 0.862, 0.862} {0.930, 0.930, 0.901, 0.844, 0.758, 0.643, 0.5, 0.357, 0.242, 0.156, 0.099, 0.070, 0.070, 0.070, 0.099, 0.156, 0.242, 0.357, 0.5, 0.643, 0.758, 0.844, 0.901, 0.930, 0.930} {0.970, 0.970, 0.939, 0.876, 0.782, 0.657, 0.5, 0.343, 0.218, 0.124, 0.061, 0.030, 0.030, 0.030, 0.061, 0.124, 0.218, 0.343, 0.5, 0.657, 0.782, 0.876, 0.939, 0.970, 0.970} {0.990, 0.990, 0.957, 0.892, 0.794, 0.663, 0.5, 0.337, 0.206, 0.108, 0.043, 0.010, 0.010, 0.010, 0.043, 0.108, 0.206, 0.337, 0.5, 0.663, 0.794, 0.892, 0.957, 0.990, 0.990} {0.998, 0.998, 0.965, 0.898, 0.799, 0.666, 0.5, 0.334, 0.201, 0.102, 0.035, 0.002, 0, 0.002, 0.035, 0.102, 0.201, 0.334, 0.5, 0.666, 0.799, 0.898, 0.965, 0.998, 0.998} {1, 1, 0.967, 0.900, 0.800, 0.667, 0.5, 0.333, 0.200, 0.100, 0.033, 0, 0, 0, 0.033, 0.100, 0.200, 0.333, 0.5, 0.667, 0.800, 0.900, 0.967, 1, 1} {1, 1, 0.967, 0.900, 0.800, 0.667, 0.5, 0.333, 0.200, 0.100, 0.033, 0, 0, 0, 0.033, 0.100, 0.200, 0.333, 0.5, 0.667, 0.800, 0.900, 0.967, 1, 1} {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} }; for (int i = 1; i<=phiBins1; i++) { for (int j = 1; j<=thetaBins1; j++) { h2cc->SetBinContent(i,j,(elevation1[j-1][i-1]+elevation1[j][i])/2.); } } //h2cc->SetBinContent(12,5,1); //h2cc->Draw("LEGO2 SPH "); TCanvas *c4 = new TCanvas("c4","c4",1200,600); c4->Divide(2,1); c4->cd(1); h2cc->Draw("SURF1 SPH "); c4->cd(2); h2cc->Draw("LEGO2 SPH"); c4->Update(); }