/// \file /// \ingroup tutorial_hist /// \notebook -js /// Illustrate use of the TH1::GetCumulative method. /// /// \macro_image /// \macro_code /// /// \author M. Schiller #include #include #include "TH1.h" #include "TH1D.h" #include "TCanvas.h" #include "TRandom.h" #include #include #include #include #include #include #include TCanvas *original() { TCanvas* c = new TCanvas(); Float_t Min[4]; Float_t Mean[4] = {0.0,0.0,0.0,0.0}; Float_t X[4] = {100,1000,2000,4000}; Float_t y; Int_t t =0; //Read File 100_stats ifstream inp; inp.open("100_stats.txt"); TNtuple *stats100 = new TNtuple("stats100","data from ascii file","x:y"); while (1) { inp >> y; if (!inp.good()) break; stats100->Fill(100,y); } inp.close(); //Read File 1000_stats inp.open("1000_stats.txt"); TNtuple *stats1000 = new TNtuple("stats1000","data from ascii file","x:y"); while (1) { inp >> y; if (!inp.good()) break; stats1000->Fill(1000,y); } inp.close(); //Read File 2000_stats inp.open("2000_stats.txt"); TNtuple *stats2000 = new TNtuple("stats2000","data from ascii file","x:y"); while (1) { inp >> y; if (!inp.good()) break; stats2000->Fill(2000,y); } inp.close(); //Read File 4000_stats inp.open("4000_stats.txt"); TNtuple *stats4000 = new TNtuple("stats4000","data from ascii file","x:y"); while (1) { inp >> y; if (!inp.good()) break; stats4000->Fill(4000,y); } inp.close(); stats100->SetBranchAddress("y",&y); stats1000->SetBranchAddress("y",&y); stats2000->SetBranchAddress("y",&y); stats4000->SetBranchAddress("y",&y); t = stats100->GetEntries(); for (Int_t i=0; iGetEntry(i); if (i == 0) Min[0] = y; else if (Min[0] > y) Min[0] = y; Mean[0] += y; //Stats_1000 stats1000->GetEntry(i); if (i == 0) Min[1] = y; else if (Min[1] > y) Min[1] = y; Mean[1] += y; //Stats_2000 stats2000->GetEntry(i); if (i == 0) Min[2] = y; else if (Min[2] > y) Min[2] = y; Mean[2] += y; //Stats_4000 stats4000->GetEntry(i); if (i == 0) Min[3] = y; else if (Min[3] > y) Min[3] = y; Mean[3] += y; } Mean[0] /= t; Mean[1] /= t; Mean[2] /= t; Mean[3] /= t; TGraph *G1 = new TGraph(4,X,Mean); //TGraph *G2 = new TGraph(5,X,Min); //TAxis* XAxis = G1->GetXaxis(); //XAxis->SetNdivisions(201); //G1->SetMarkerStyle(20); G1->SetTitle(""); //G1->GetXaxis()->SetRangeUser(0,4100); G1->GetXaxis()->SetTitle("Amount of samples"); G1->GetXaxis()->SetTitleSize(0.025); G1->GetXaxis()->SetTickLength(0.02); G1->GetXaxis()->SetLabelSize(0.02); G1->GetXaxis()->SetLabelOffset(0.02); G1->GetXaxis()->CenterTitle(); G1->GetXaxis()->SetTitleOffset(1.7); G1->GetYaxis()->SetRangeUser(4,27); G1->GetYaxis()->SetTitle("Penalty Value"); G1->GetYaxis()->SetTitleSize(0.025); G1->GetYaxis()->SetTickLength(0.02); G1->GetYaxis()->SetLabelSize(0.02); G1->GetYaxis()->SetLabelOffset(0.001); G1->GetYaxis()->CenterTitle(); G1->GetYaxis()->SetTitleOffset(1.4); G1->SetLineWidth(2); G1->SetLineColor(38); G1->Draw("APL"); //G2->SetMarkerStyle(21); //G2->Draw("same"); gPad->SetGrid(1,1); for (Int_t i=0; iGetEntry(i); TMarker *m = new TMarker(100,y, 7); m->SetMarkerStyle(29); //m->SetMarkerSize(2); m->SetMarkerColor(30); if (y == Min[0]) m->SetMarkerColor(46); m->Draw("same"); stats1000->GetEntry(i); TMarker *m = new TMarker(1000,y, 7); m->SetMarkerStyle(29); //m->SetMarkerSize(2); m->SetMarkerColor(30); if (y == Min[1]) m->SetMarkerColor(46); m->Draw("same"); stats2000->GetEntry(i); TMarker *m = new TMarker(2000,y, 7); m->SetMarkerStyle(29); //m->SetMarkerSize(2); m->SetMarkerColor(30); if (y == Min[2]) m->SetMarkerColor(46); m->Draw("same"); stats4000->GetEntry(i); TMarker *m = new TMarker(4000,y, 7); m->SetMarkerStyle(29); //m->SetMarkerSize(2); m->SetMarkerColor(30); if (y == Min[3]) m->SetMarkerColor(46); m->Draw("same"); } //c.SetLogx(); c->Update(); gPad->Print("Stats.tex"); gPad->Print("Stats.pdf"); }