//#include"../DefineLabel.h" //#include //#include //#include #include //#include "TDirectory.h" #include //#include "Riostream.h" #include "TLine.h" #include "TAttMarker.h" #include "TLegend.h" #include "TLegendEntry.h" #include "TGraph.h" #include "TMultiGraph.h" #include "TCanvas.h" #include "TLatex.h" #include "TDirectory.h" #include "TAxis.h" //#include "TH1F.h" //#include "TH2F.h" //#include "TTree.h" #include "TFile.h" #include "TPaveText.h" //#include "TTree.h" //#include "TNtuple.h" #include "TObject.h" #include "TStyle.h" #include "TAttLine.h" #include "TAttFill.h" #include //#include "TNamed.h" #include "TPave.h" //#include "TString.h" #include void CreateLegend(std::string myinput0, TGraph*gr1); using namespace std; void CreateLegend(std::string myinput0, TGraph*gr1){ TLegend *leg = new TLegend() ; if(myinput0=="MAC") {leg = new TLegend(0.2, 0.65, 0.35, 0.88, "brNDC");} else cout <<"something went wrong!"<SetHeader(Form("%s Values",myinput0.c_str() )); TLegendEntry *entry = leg->AddEntry(gr1,Form("%s 1",myinput0.c_str()),"l"); leg->Draw("same"); } void PlotTest(){ TCanvas *c1 = new TCanvas("c1", "c1",153,156,723,444); c1->cd(1); std::string myinput0; std::string myinput; //TString myinput=Form("/home/ic00025/Dropbox/26Na/case%i/data.txt",caseNumber); cout<<"Please, put the inputfile name as MAC to plot: " << endl; cin >> myinput0; myinput= myinput0+".txt"; cout << "myinput file name: " << myinput.c_str() << endl; TGraph*gr1=new TGraph(myinput.c_str() ,"%lg%lg%*lg%*lg%*lg%*lg%*lg%*lg%*lg"); //1-2 ///////////////////////////////////////// TMultiGraph *mg = new TMultiGraph(); mg->SetTitle(); mg->Add(gr1); mg->Draw("AL"); if(myinput0=="MAC") mg->GetYaxis()->SetTitle(Form("%s (cm^{2}/g)", myinput0.c_str())); else cout <<"something went wrong!"<GetYaxis()->SetTitle(Form("%s (cm^{2}/g)", myinput0.c_str())); c1_1 = new TPad("c1_1", "newpad",0.33,0.39,0.84,0.85);} else cout <<"something went wrong!"<Draw(); c1_1->cd(); TMultiGraph *mg2 = new TMultiGraph(); mg2->SetTitle(); mg2->Add(gr1); if(myinput0=="MAC") {mg2->GetYaxis()->SetTitle(Form("%s (cm^{2}/g)", myinput0.c_str())); mg2->GetXaxis()->SetLimits(0.012,0.016); mg2->GetYaxis()->SetRangeUser(150.,170.);} else cout <<"something went wrong!"<GetXaxis()->SetTitle("Energy (MeV)"); //("#theta_{p CM} (deg)"); //mg2->GetXaxis()->SetTitleSize(1); mg2->GetXaxis()->SetLabelSize(0.05); mg2->GetYaxis()->SetLabelSize(0.05); mg2->GetXaxis()->SetLabelOffset(0.005); //The distance is expressed in per cent of the pad width mg2->GetYaxis()->SetLabelOffset(0.005); //Set distance between the axis and the labels. mg2->GetXaxis()->SetTitleOffset(1.); //Set distance between the axis and the axis title. 0, 1., 1.2 mg2->GetYaxis()->SetTitleOffset(0.); mg2->GetXaxis()->SetTitleSize(0.06); //The size is expressed in per cent of the pad size mg2->GetYaxis()->SetTitleSize(0.06); mg2->Draw("AL"); gPad->Update(); c1->Modified(); c1->cd(); c1->SetSelected(c1); c1->Update(); }