void drawFrame(TString nameU, TString nameV, Double_t minU, Double_t maxU, Double_t minV, Double_t maxV, Int_t canH){ TString name = generateRandomName(); TH2F *frame = new TH2F(name,name+";"+nameU+";"+nameV,1,minU,maxU,1,minV,maxV); frame->SetStats(0); frame->SetTitle(""); // frame->GetYaxis()->SetDecimals(1); // frame->GetXaxis()->SetNdivisions(520); //Default 510 // frame->GetYaxis()->SetNdivisions(510); //Default 510 // frame->GetXaxis()->SetMoreLogLabels(); // frame->GetXaxis()->SetNoExponent(); frame->GetYaxis()->SetTitleOffset(ComputeTitleOffset(25, 55)); // frame->GetXaxis()->SetTitleOffset(1.); frame->SetLabelSize(ComputeRelSize(25),"xy"); frame->SetTitleSize(ComputeRelSize(25),"xy"); frame->Draw(); }
TH2F* drawFrame(TString nameU, TString nameV, Double_t minU, Double_t maxU, Double_t minV, Double_t maxV){ TString name = generateRandomName(); TH2F *frame = new TH2F(name,name+";"+nameU+";"+nameV,1,minU,maxU,1,minV,maxV); frame->SetStats(0); frame->SetTitle(""); // frame->GetYaxis()->SetDecimals(1); // frame->GetXaxis()->SetNdivisions(520); //Default 510 // frame->GetYaxis()->SetNdivisions(510); //Default 510 // frame->GetXaxis()->SetMoreLogLabels(); // frame->GetXaxis()->SetNoExponent(); Int_t effCharSize = 50; frame->GetYaxis()->SetTitleOffset(ComputeTitleOffset(effCharSize, 2.1*effCharSize)); // frame->GetXaxis()->SetTitleOffset(1.); frame->SetLabelSize(ComputeRelSize(effCharSize),"xy"); frame->SetTitleSize(ComputeRelSize(effCharSize),"xy"); frame->Draw(); return frame; }
int main(int argc, char* argv[]) { string htitle = "Events rate, cloud "; htitle = htitle+string(argv[1]); string drootpath; if (strcmp(argv[2],"ttreecache")==0) { htitle = htitle + ", TTreeCache enabled, protocol: WebDAV"; drootpath = "../../../Histograms/TDavix/"; } else if (strcmp(argv[2],"xrootd")==0) { htitle = htitle + ", TTreeCache enabled xrootd"; drootpath = "../../../Histograms/xrootd/"; } else { htitle = htitle + ", TTreeCache disabled, protocol: WebDAV "; drootpath = "../../../Histograms/Davix/"; } string cloudpath = argv[1] ; cloudpath = cloudpath + "/"; DIR* dcloudrep = opendir(string2char(drootpath+cloudpath)); struct dirent* dcloudfichier = NULL; string allgrid; allgrid = string(argv[3]); vector<ratioMatrixValue> th2array; while ((dcloudfichier = readdir(dcloudrep))!=0) { if (dcloudfichier->d_name[0]=='.') continue; string dcloudpath = cloudpath + dcloudfichier->d_name + "/"; //DIR* drootfile = opendir(string2char(drootpath+dcloudpath)); //struct dirent* drootfichier = NULL; string dfilepath = drootpath + dcloudpath + allgrid + "/" + dcloudfichier->d_name + ".root"; ratioMatrixValue column; TFile *dfr = TFile::Open(string2char(dfilepath)); if (dfr==NULL) continue; column.analy = dcloudfichier->d_name; for (int i=0;i<dfr->GetListOfKeys()->GetEntries();i++) { string dstrRead = string2char(dfr->GetListOfKeys()->At(i)->GetName()); TH1F* dhist = (TH1F*)dfr->Get(string2char(dstrRead)); if (dhist==NULL) continue; string otherTitle = string(dhist->GetName()) + "No Zero"; TH1F* histSansZeros = new TH1F(string2char(otherTitle),dhist->GetTitle(),3000.,0,3000); for ( int l=2;l<3000;l++) for (int k=0;k<dhist->GetBinContent(l);k++) histSansZeros->Fill(l-1); column.datadisk.push_back(string2char(dstrRead)); column.ratio.push_back(histSansZeros->GetMean()); column.error.push_back(histSansZeros->GetRMSError()); } th2array.push_back(column); } TCanvas * c = new TCanvas("c", "c"); c->SetLeftMargin(0.20); c->SetBottomMargin(0.15); c->SetWindowSize(2100,1500); /*for (unsigned int i=0;i<th2array.size();i++) { cout << th2array[i].analy << "\t"; for (unsigned int j=0;j<th2array[i].datadisk.size();j++) cout << th2array[i].datadisk[j] << "\t" ; cout << endl; }*/ cout << "--------------------------" << endl; th2array = ordenate(th2array,string(argv[1])); cout << "--------------------------" << endl; /*for (unsigned int i=0;i<th2array.size();i++) { cout << th2array[i].analy << "\t"; for (unsigned int j=0;j<th2array[i].datadisk.size();j++) cout << th2array[i].datadisk[j] << "\t" ; cout << endl; }*/ unsigned int datadisk_number=0; unsigned int analy_number=0; for (unsigned int i=0;i<th2array.size();i++) { if (datadisk_number < th2array[i].datadisk.size()) { datadisk_number = th2array[i].datadisk.size(); } if (th2array[i].datadisk.size()!=0) analy_number++; } char *title = string2char(htitle); TH2F *h = new TH2F("eventMatrix",title,analy_number,0.,analy_number,datadisk_number,0.,datadisk_number); for (unsigned int i=0;i<th2array.size();i++) { //cout << "coucou " << th2array[i].analy << " " << th2array[i].datadisk.size() << endl; for (unsigned int j=0;j<th2array[i].datadisk.size();j++) { h->Fill(th2array[i].analy,th2array[i].datadisk[j],th2array[i].ratio[j]); //cout << i << " " << j << " " << th2array[i].error[j] << endl; h->SetCellError(i+1,j+1,th2array[i].error[j]); //cout << i << " " << j << " " << h->GetBinErrorLow(i+1,j+1) << " " << h->GetBinErrorUp(i+1,j+1) << endl; } } const Int_t Number = 5; Double_t Red[Number] = { 1.00, 0.75, 1.00, 0.25, 0.00 }; Double_t Green[Number] = { 0.00, 0.25, 0.50, 0.75, 1.00 }; Double_t Blue[Number] = { 0.00, 0.00, 0.00, 0.00, 0.00 }; Double_t Stops[Number] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Int_t nb=50; TColor::CreateGradientColorTable(Number,Stops,Red,Green,Blue,nb); h->GetXaxis()->SetTitle("Processing site"); h->GetXaxis()->CenterTitle(); h->GetYaxis()->SetTitle("Data source site"); h->GetYaxis()->CenterTitle(); h->SetLabelSize(0.03,"Y"); h->SetTitleOffset(2.3,"Y"); h->SetLabelSize(0.03,"X"); h->SetTitleOffset(2.0,"X"); h->GetYaxis()->SetTitle("Data source site"); h->Draw("COLZ"); h->Draw("TEXTE SAME"); gStyle->SetOptStat(0); //gStyle->SetTitleY(0.1f); h->SetMaximum(750); h->SetMinimum(0); c->Print(Form("canvas.eps")); return 0; }