/////////////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////////// #include "TFile.h" #include "TTree.h" #include "TPave.h" #include "TBranch.h" #include "TGraph.h" #include "TText.h" #include "THStack.h" #include "CompModel/TCompModel.hh" namespace { }; //_____________________________________________________________________________ int TCompModel::PlotEventSize(int LastYear) { TH1F* h1; float x; int nbins = LastYear-2002+1; h1 = new TH1F("event_size","event size, KBytes",nbins,2001.5,LastYear+0.5); h1->SetMinimum(0); h1->GetXaxis()->SetTitle("Year"); for (int year=2002; year<=LastYear; year++) { x = CslEventSize(year); if (x > 0) h1->Fill(year,x); } h1->SetMarkerSize (1); h1->SetMarkerStyle(20); h1->Draw("p"); return 0; } //_____________________________________________________________________________ int TCompModel::PlotInstLumi(int LastYear) { TH1F* h1; float x; int nbins = LastYear-2002+1; h1 = new TH1F("inst_lumi","Average Instantaneous luminosity",nbins,2001.5,LastYear+.5); h1->GetXaxis()->SetTitle("Year"); h1->GetYaxis()->SetTitle("Lumi/1.e32"); for (int year=2002; year<=LastYear; year++) { x = fTev->AverageInstLumi(year); if (x > 0) h1->Fill(year,x); } h1->SetMarkerSize(1); h1->SetMarkerStyle(20); h1->Draw("p"); return 0; } //_____________________________________________________________________________ int TCompModel::PlotDiskProjections(int LastYear) { return 0; } //_____________________________________________________________________________ int TCompModel::PlotCpuNeeds(int LastYear, int PlotOnsiteCpu) { TH1F *h_pr, *h_nt, *h_an, *h_mc, *h_pr_nt, *h_pr_nt_an, *h_pr_an_mc, *h_onsite; float x_pr, x_nt, x_an, x_mc, x4; int nbins = LastYear-2002+1; //----------------------------------------------------------------------------- // default: model = 2: scale analysis CPU with the dataset //----------------------------------------------------------------------------- h_pr = new TH1F("prod_cpu_needs","Offline Reconstruction CPU Needs, [THz]", nbins,2001.5,LastYear+0.5); h_pr->GetYaxis()->SetTitle("CPU needs, [THz]"); h_pr->SetStats(0); h_an = new TH1F("ana_cpu_needs","Analysis CPU Needs, [THz]",nbins,2001.5,LastYear+0.5); h_an->GetYaxis()->SetTitle("CPU needs, [THz]"); h_mc = new TH1F("mc_cpu_needs","MC CPU Needs, [THz]",nbins,2001.5,LastYear+0.5); h_mc->GetYaxis()->SetTitle("CPU needs, [THz]"); h_pr_nt = new TH1F("prod_plus_nt_cpu_needs", "Offline Reconstruction+Ntuplint CPU Needs, [THz]", nbins,2001.5,LastYear+0.5); h_pr_nt->GetYaxis()->SetTitle("CPU needs, [THz]"); h_pr_nt->SetStats(0); h_pr_nt_an = new TH1F("prod_ana_cpu_needs","CDF Prod+Ana Needs",nbins,2001.5,LastYear+0.5); h_pr_nt_an->SetStats(0); h_pr_nt_an->GetXaxis()->SetTitle("Fiscal Year"); h_pr_nt_an->GetYaxis()->SetTitle("CPU needs, [THz]"); hTotalCpuNeeds = new TH1F("cdf_cpu_needs","CDF CPU Needs",nbins,2001.5,LastYear+0.5); hTotalCpuNeeds->SetStats(0); hTotalCpuNeeds->SetMaximum(30.); hTotalCpuNeeds->GetXaxis()->SetTitle("Fiscal Year"); hTotalCpuNeeds->GetYaxis()->SetTitle("CPU needs, [THz]"); hOnsiteCpu = new TH1F("onsite_cpu","CDF onsite CPU",nbins,2001.5,LastYear+0.5); hOnsiteCpu->SetStats(0); hOnsiteCpu->SetMarkerStyle(20); hOnsiteCpu->SetMarkerSize(1); hOnsiteCpu->GetXaxis()->SetTitle("Fiscal Year"); hOnsiteCpu->GetYaxis()->SetTitle("CPU needs, [THz]"); for (int year=2002; year<=LastYear; year++) { x_pr = ReconstructionCpuNeeds(year); x_nt = NtuplingCpuNeeds (year); x_an = AnalysisCpuNeeds (year); x_mc = McCpuNeeds (year); x4 = OnsiteCpu (year); h_pr->Fill(year,x_pr); h_an->Fill(year,x_an); h_mc->Fill(year,x_mc); h_pr_nt->Fill(year,x_pr+x_nt); h_pr_nt_an->Fill(year,x_pr+x_nt+x_an); hTotalCpuNeeds->Fill(year,x_pr+x_nt+x_an+x_mc); hOnsiteCpu->Fill(year,x4); } h_pr->SetFillStyle(3001); h_pr->SetFillColor(4); h_pr_nt->SetFillStyle(3005); h_pr_nt->SetFillColor(4); h_pr_nt_an->SetFillStyle(3004); h_pr_nt_an->SetFillColor(4); hTotalCpuNeeds->SetMinimum(0); hTotalCpuNeeds->Draw(); h_pr_nt_an->Draw ("same"); h_pr_nt->Draw ("same"); h_pr->Draw ("same"); if (PlotOnsiteCpu != 0) { hOnsiteCpu->SetLineColor(4); hOnsiteCpu->Draw("same"); } //----------------------------------------------------------------------------- // labels //----------------------------------------------------------------------------- TPave* p; TText* txt; double xmax = hTotalCpuNeeds->GetMaximum(); double xx1, xx2; //----------------------------------------------------------------------------- // MC: empty //----------------------------------------------------------------------------- xx1 = xmax-3; xx2 = xx1+1; p = new TPave(2003,xx1,2003.5,xx2); p->SetFillColor(4); p->SetFillStyle(0); p->SetBorderSize(1); p->Draw(); txt = new TText(2003.8,xx1,"Monte Carlo"); txt->Draw(); //----------------------------------------------------------------------------- // analysis //----------------------------------------------------------------------------- xx1 = xx1-2; xx2 = xx1+1; p = new TPave(2003,xx1,2003.5,xx2); p->SetFillColor(4); p->SetFillStyle(3004); p->SetBorderSize(1); p->Draw(); txt = new TText(2003.8,xx1,"Analysis"); txt->Draw(); //----------------------------------------------------------------------------- // ntupling //----------------------------------------------------------------------------- xx1 = xx1-2; xx2 = xx1+1; p = new TPave(2003,xx1,2003.5,xx2); p->SetFillColor(4); p->SetFillStyle(3005); p->SetBorderSize(1); p->Draw(); p = new TPave(2003,xx1,2003.5,xx2); p->SetFillColor(4); p->SetFillStyle(3004); p->SetBorderSize(1); p->Draw(); txt = new TText(2003.8,xx1,"Ntupling"); txt->Draw(); //----------------------------------------------------------------------------- // production //----------------------------------------------------------------------------- xx1 = xx1-2; xx2 = xx1+1; p = new TPave(2003,xx1,2003.5,xx2); p->SetFillColor(4); p->SetFillStyle(3001); p->SetBorderSize(1); p->Draw(); txt = new TText(2003.8,xx1,"Production"); txt->Draw(); return 0; } //_____________________________________________________________________________ int TCompModel::PlotDataSizeVsLumi(int LastYear) { float x[100], y0[100]; int n(0); for (int year=2002; year<=LastYear; year++) { x [n] = fTev->TotalDeliveredLumi(year); y0[n] = TotalDataSize(year)/1.e6; n++; } fGraph = new TGraph(n,x,y0); fGraph->SetTitle("Estimated CDF Data Volume vs Delivered Luminosity"); fGraph->SetMarkerStyle(20); int nbins = LastYear-2002+1; fH2 = new TH2F("","",1,0,7,1,0,8); fH2->SetStats(0); fH2->GetXaxis()->SetTitle("IntegratedLuminosity, fb^{-1}"); fH2->GetYaxis()->SetTitle("Data Volume, PBytes"); fH2->Draw(); fGraph->Draw("lp"); TText* text; for (int i=0; i 2003) { text = new TText(x[i]+0.2,y0[i]-0.02,Form("%i",i+2002)); text->SetTextSize(0.035); text->SetTextAlign(11); text->Draw(); } } return 0; } //_____________________________________________________________________________ int TCompModel::PlotDataSize(int LastYear) { float x[100], y0[100]; int n(0); TH1F *h1, *h2, *h3, *h4, *h5, *h12, *h123, *h1234; double x1, x2, x3, x4, x5, x12, x123, x1234; int first_year=2002; int nbins = LastYear-2002+1; h1 = new TH1F("total_data_volume","CDF Data Volume, PBytes",nbins,first_year-0.5,LastYear+0.5); h1->GetYaxis()->SetTitle("Data Volume, [PBytes]"); h1->GetXaxis()->SetTitle("Fiscal Year"); h1->SetStats(0); h1->SetFillColor(4); h1->SetFillStyle(3001); h1->SetLineWidth(2); h2 = new TH1F("raw_data_volume" ,"Raw Data Volume" ,nbins,first_year-0.5,LastYear+0.5); h3 = new TH1F("prod_data_volume" ,"Production Data Volume",nbins,first_year-0.5,LastYear+0.5); h4 = new TH1F("ntup_data_volume" ,"Ntuple Data Volume" ,nbins,first_year-0.5,LastYear+0.5); h5 = new TH1F("total_data_volume","CDF Data Volume, PBytes",nbins,first_year-0.5,LastYear+0.5); h5->GetYaxis()->SetTitle("Data Volume, [PBytes]"); h5->GetXaxis()->SetTitle("Fiscal Year"); h5->SetStats(0); h12 = new TH1F("h12" ,"" ,nbins,first_year-0.5,LastYear+0.5); h12->SetStats(0); h12->SetFillColor(4); h12->SetFillStyle(3004); h12->SetLineWidth(2); h123 = new TH1F("h123" ,"" ,nbins,first_year-0.5,LastYear+0.5); h123->SetStats(0); h123->SetFillColor(4); h123->SetFillStyle(3005); h123->SetLineWidth(2); h1234 = new TH1F("h1234" ,"" ,nbins,first_year-0.5,LastYear+0.5); h1234->SetStats(0); h1234->SetLineWidth(2); for (int year=first_year; year<=LastYear; year++) { x1 = TotalRawDataSize (year)/1e6; x2 = TotalRecoDataSize (year)/1e6; x3 = TotalMcDataSize (year)/1e6; x4 = TotalNtupleDataSize (year)/1e6; x5 = TotalDataSize (year)/1e6; x12 = x1+x2; x123 = x1+x2+x3; x1234 = x1+x2+x3+x4; h1->Fill(year,x1); h12->Fill(year,x12); h123->Fill(year,x123); h1234->Fill(year,x1234); h5->Fill(year,x5); } h5->Draw(); h1234->Draw("same"); h123->Draw("same"); h12->Draw("same"); h1->Draw("same"); //----------------------------------------------------------------------------- // labels //----------------------------------------------------------------------------- TPave* p; TText* txt; float dx1, dx2; x1 = 10.2; // 5.4; dx1 = 0.8; // 0.4; dx2 = 0.4; // 0.2; //----------------------------------------------------------------------------- // label: Ntuples //----------------------------------------------------------------------------- x1 = x1-dx1; x2 = x1+dx2; p = new TPave(2002,x1,2002.5,x2); p->SetFillColor(4); p->SetFillStyle(0); p->SetBorderSize(1); p->Draw(); txt = new TText(2002.8,x1,"Ntuples"); txt->Draw(); //----------------------------------------------------------------------------- // label: "MC data" //----------------------------------------------------------------------------- x1 = x1-dx1; x2 = x1+dx2; p = new TPave(2002,x1,2002.5,x2); p->SetFillColor(4); p->SetFillStyle(3004); p->SetBorderSize(1); p->Draw(); txt = new TText(2002.8,x1,"MC Data"); txt->Draw(); //----------------------------------------------------------------------------- // label: "Reconstructed data" //----------------------------------------------------------------------------- x1 = x1-dx1; x2 = x1+dx2; p = new TPave(2002,x1,2002.5,x2); p->SetFillColor(4); p->SetFillStyle(3004); p->SetBorderSize(1); p->Draw(); p = new TPave(2002,x1,2002.5,x2); p->SetFillColor(4); p->SetFillStyle(3005); p->SetBorderSize(1); p->Draw(); txt = new TText(2002.8,x1,"Reconstructed Data"); txt->Draw(); //----------------------------------------------------------------------------- // label: "Raw data" //----------------------------------------------------------------------------- x1 = x1-dx1; x2 = x1+dx2; p = new TPave(2002,x1,2002.5,x2); p->SetFillColor(4); p->SetFillStyle(3001); p->SetBorderSize(1); p->Draw(); txt = new TText(2002.8,x1,"Raw Data"); txt->Draw(); return 0; } //_____________________________________________________________________________ int TCompModel::PlotHist(const char* Name, int Model, int LastYear) { float x, x1, x2, x3; TH1F *h1, *h2, *h3; TString name = Name; name.ToUpper(); if (name == "CPU_NEEDS" ) PlotCpuNeeds (LastYear); else if (name == "DATA_SIZE_VS_INT_LUMI") PlotDataSizeVsLumi(LastYear); else if (name == "DATA_SIZE_VS_TIME" ) PlotDataSize (LastYear); else if (name == "EVENT_SIZE" ) PlotEventSize (LastYear); else if (name == "INST_LUMI" ) PlotInstLumi (LastYear); return 0; }