void plotMaker(std::string infile) { plotMaker(infile, 0); plotMaker(infile, 1); } void plotMaker(std::string infile, int mu) { // TFile *f1 = new TFile("mA130tb5.root","read"); TFile *f1 = new TFile(infile.c_str(),"read"); if (mu == 0) { TH2D* h_ = (TH2D*) f1->Get("corHistMu0"); //TH2D* h1_ = (TH2D*) f1->Get("corHist"); runPlots(h_, "correlations_mu0", 0); } else { TH2D* h_ = (TH2D*) f1->Get("corHist"); //TH2D* h_ = (TH2D*) f1->Get("corHistMu0"); runPlots(h_, "correlations_mufree", 1); } //runPlots(h1_, "correlations_mufree", 1); //runPlots(h_, "correlations_mu0", 0); } void runPlots(TH2D * h_, std::string basename, int mu) { TCanvas *c = new TCanvas("c", "c",1000,1000); gStyle->SetOptStat(0); if (mu == 0) h_->SetTitle("#mu = 0"); else h_->SetTitle("#mu free parameter"); h_->GetXaxis()->SetLabelSize(0.01); h_->GetYaxis()->SetLabelSize(0.01); h_->Draw("COLZ"); c->Print(string(basename+".png").c_str()); c->Print(string(basename+".eps").c_str()); // int count = 22; // int size = 152; int count = 25; int size = 200; if (mu == 0) size = 199; int len = (size/count) + 1; int lastx =1; int firstx =1; int firsty = 1; int lasty = 1; int countGoodLabels = 0; for (int xlen = 0; xlen < (size/count)+1; xlen++) { int ii = lastx; lasty = 1; firstx = lastx; for (int ylen = 0; ylen < (size/count)+1; ylen++) { TH2D* h_half = new TH2D ("test", "test", count, 0, count, count, 0, count); int i = 0; int jj = lasty; ii = firstx; firsty = lasty; while (ii <= size && i < count) { int j = 0; jj = firsty; std::string xaxis (h_->GetXaxis()->GetBinLabel(ii)); if (xaxis.find("gamma")!=-1 || xaxis=="") j = count+1; else { i++; //std::cout << xaxis << std::endl; } while (jj <= size && j < count) //for (int j = 1; j < count; j++) { double cont= h_->GetBinContent(ii,jj); std::string yaxis (h_->GetYaxis()->GetBinLabel(jj)); xaxis = "#bf{"+xaxis+"}"; if (yaxis.find("gamma")==-1 && yaxis!="") { j++; yaxis = "#bf{"+yaxis+"}"; h_half->GetXaxis()->SetBinLabel(i,xaxis.c_str()); h_half->GetYaxis()->SetBinLabel(j,yaxis.c_str()); h_half->SetBinContent(i,j,cont); } jj++; } ii++; } //lastx = ii; if ((i > 0 && j > 0) && (i == count || ii >= size) && (j == count || jj >= size)) { if (ylen == 0) countGoodLabels += i; h_half->SetMaximum(1.0); h_half->GetXaxis()->SetRange(0,i); h_half->GetYaxis()->SetRange(0,j); h_half->SetMinimum(-1.0); TCanvas *chalf = new TCanvas("chalf", "chalf",1000,1000); chalf->SetLeftMargin(0.2); chalf->SetRightMargin(0.15); gStyle->SetOptStat(0); stringstream iii, jjj; iii << xlen; jjj << ylen; if (mu == 0) h_half->SetTitle("#mu = 0"); else h_half->SetTitle("#mu free parameter"); h_half->GetXaxis()->SetLabelSize(0.02); h_half->GetYaxis()->SetLabelSize(0.02); h_half->Draw("COLZ"); std::string filename1 = basename+"X"+iii.str()+"Y"+jjj.str()+".png"; std::string filename2 = basename+"X"+iii.str()+"Y"+jjj.str()+".eps"; chalf->Print(filename1.c_str()); chalf->Print(filename2.c_str()); lastx = ii; lasty = jj; } } } int countwrd = 0; countGoodLabels = 0; int countAllLabels = 0; for (int good = 1; good <= size; good++) { std::string wrd (h_->GetXaxis()->GetBinLabel(good)); if (wrd.find("gamma")==-1 && wrd!="") { countGoodLabels++; } if (wrd!="") { countAllLabels++; } } countGoodLabels; TH2D* h_test = new TH2D ("nogamma", "nogamma", countGoodLabels, 0, countGoodLabels, countGoodLabels, 0, countGoodLabels); int xidx = 0; int yidx = 0; for (int b = 0; b <= size+10; b++) { std::string wrd (h_->GetXaxis()->GetBinLabel(b)); bool iOK = false; if (wrd.find("gamma")==-1 && wrd!="") { iOK = true; xidx++; } yidx = 0; for (int a = 0; a <= size+10; a ++) { std::string wrdy (h_->GetYaxis()->GetBinLabel(a)); if (wrdy.find("gamma")==-1 && wrdy!="" && iOK) { yidx++; wrdy = "#bf{"+wrdy+"}"; wrd = "#bf{"+wrd+"}"; double cont= h_->GetBinContent(b,a); h_test->GetXaxis()->SetBinLabel(xidx,wrd.c_str()); h_test->GetYaxis()->SetBinLabel(yidx,wrdy.c_str()); //std::cout << "x y " << xidx << yidx << std::endl; h_test->SetBinContent(xidx,yidx,cont); } } } h_test->SetMaximum(1.0); h_test->SetMinimum(-1.0); TCanvas *ctest = new TCanvas("nogamma", "nogamma",1000,1000); ctest->SetLeftMargin(0.2); ctest->SetRightMargin(0.15); gStyle->SetOptStat(0); stringstream iii, jjj; iii << xlen; jjj << ylen; if (mu == 0) h_test->SetTitle("#mu = 0"); else h_test->SetTitle("#mu free parameter"); h_test->GetXaxis()->SetLabelSize(0.02); h_test->GetYaxis()->SetLabelSize(0.02); h_test->Draw("COLZ"); std::string filename1 = basename+"nogamma.png"; std::string filename2 = basename+"nogamma.eps"; ctest->Print(filename1.c_str()); ctest->Print(filename2.c_str()); //std::cout <SetOptStat(0); // h1_->SetTitle("#mu free parameter"); // h1_->GetXaxis()->SetLabelSize(0.01); // h1_->GetYaxis()->SetLabelSize(0.01); // h1_->Draw("COLZ"); // c1->Print("correlations_mufree.png"); //c1->Print("correlations_mufree.eps"); }