SimpleEventBuilder/BandwidthVsFragSize.C

141 lines
4.3 KiB
C++
Raw Normal View History

2023-09-27 15:47:46 +00:00
void BandwidthVsFragSize() {
gROOT->SetBatch(kTRUE);
auto f1000 = "./mean_1k_std_400_meantime_20ms_stddevtime_10ms.csv";
auto f1000_df = ROOT::RDF::MakeCsvDataFrame(f1000, true, ';');
auto f1000_nc = f1000_df.Define("bandwidth", "( tot_bytes/static_cast<double>(1024) ) / tot_time_taken");
auto f500 = "./mean_500_std_200_meantime_10ms_stddevtime_5ms.csv";
auto f500_df = ROOT::RDF::MakeCsvDataFrame(f500, true, ';');
auto f500_nc = f500_df.Define("bandwidth", "( tot_bytes/static_cast<double>(1024) ) / tot_time_taken");
auto f200 = "./mean_200_std_80_meantime_4ms_stddevtime_2ms.csv";
auto f200_df = ROOT::RDF::MakeCsvDataFrame(f200, true, ';');
auto f200_nc = f200_df.Define("bandwidth", "( tot_bytes/static_cast<double>(1024) ) / tot_time_taken");
auto f100 = "./mean_100_std_40_meantime_2ms_stddevtime_1ms.csv";
auto f100_df = ROOT::RDF::MakeCsvDataFrame(f100, true, ';');
auto f100_nc = f100_df.Define("bandwidth", "( tot_bytes/static_cast<double>(1024) ) / tot_time_taken");
auto f40 = "./mean_40_std_16_meantime_1ms_stddevtime_0ms.csv";
auto f40_df = ROOT::RDF::MakeCsvDataFrame(f40, true, ';');
auto f40_nc = f40_df.Define("bandwidth", "( tot_bytes/static_cast<double>(1024) ) / tot_time_taken");
auto f4 = "./mean_4_std_0_meantime_0ms_stddevtime_0ms.csv";
auto f4_df = ROOT::RDF::MakeCsvDataFrame(f4, true, ';');
auto f4_nc = f4_df.Define("bandwidth", "( tot_bytes/static_cast<double>(1024) ) / tot_time_taken");
auto canvas = new TCanvas("c", "c", 2800, 1000);
//canvas->SetLogx();
//canvas->SetGrid();
//canvas->SetLogy();
canvas->Divide(2,1);
gStyle->SetPalette(1);
canvas->cd(1);
gPad->SetRightMargin(0.05);
gPad->SetLeftMargin(0.15);
gPad->SetGrid();
auto g1000 = f1000_nc.Graph("timeout_ms", "bandwidth");
g1000->SetTitle("Bandwidth vs Timeout: Linear;Timeout [ms];Bandwidth [kB/s]");
g1000->SetName("g1000");
g1000->SetMarkerStyle(55);
g1000->SetMarkerSize(2);
g1000->SetLineWidth(2);
//sel_g->GetXaxis()->SetLimits(-50,1000);
g1000->GetHistogram()->SetMinimum(0);
g1000->GetHistogram()->SetMaximum(15000);
g1000->DrawClone("ALP PLC PMC");
auto g500 = f500_nc.Graph("timeout_ms", "bandwidth");
g500->SetName("g500");
g500->SetMarkerStyle(55);
g500->SetMarkerSize(2);
g500->SetLineWidth(2);
g500->DrawClone("LP PLC PMC");
auto g200 = f200_nc.Graph("timeout_ms", "bandwidth");
g200->SetName("g200");
g200->SetMarkerStyle(55);
g200->SetMarkerSize(2);
g200->SetLineWidth(2);
g200->DrawClone("LP PLC PMC");
auto g100 = f100_nc.Graph("timeout_ms", "bandwidth");
g100->SetName("g100");
g100->SetMarkerStyle(55);
g100->SetMarkerSize(2);
g100->SetLineWidth(2);
g100->DrawClone("LP PLC PMC");
auto g40 = f40_nc.Graph("timeout_ms", "bandwidth");
g40->SetName("g40");
g40->SetMarkerStyle(55);
g40->SetMarkerSize(2);
g40->SetLineWidth(2);
g40->DrawClone("LP PLC PMC");
auto g4 = f4_nc.Graph("timeout_ms", "bandwidth");
g4->SetName("g4");
g4->SetMarkerStyle(55);
g4->SetMarkerSize(2);
g4->SetLineWidth(2);
g4->DrawClone("LP PLC PMC");
auto leg = new TLegend(0.55,0.15,0.86,0.37);
leg->SetHeader("Mean Fragment Size", "c");
leg->AddEntry("g1000","1 kB","lp");
leg->AddEntry("g500","500 B","lp");
leg->AddEntry("g200","200 B","lp");
leg->AddEntry("g100","100 B","lp");
leg->AddEntry("g40","40 B","lp");
leg->AddEntry("g4","4 B","lp");
leg->Draw();
canvas->cd(2);
gPad->SetRightMargin(0.1);
gPad->SetLeftMargin(0.1);
gPad->SetLogy();
gPad->SetGrid();
g1000->SetTitle("Bandwidth vs Timeout: Log;Timeout [ms];Bandwidth [kB/s]");
g1000->GetHistogram()->SetMinimum(1);
g1000->GetHistogram()->SetMaximum(20000);
g1000->DrawClone("ALP PLC PMC");
g500->DrawClone("LP PLC PMC");
g200->DrawClone("LP PLC PMC");
g100->DrawClone("LP PLC PMC");
g40->DrawClone("LP PLC PMC");
g4->DrawClone("LP PLC PMC");
leg->Draw();
//gStyle->SetLegendTextSize(0.01);
//canvas->BuildLegend(0.65,0.2,0.86,0.32, "Connection Method");
canvas->Print("TimeoutVsBandwidth.png");
gROOT->SetBatch(kFALSE);
gApplication->Terminate(0);
}