// Online C++ compiler to run C++ program online #include #include #include "TAttMarker.h" #include "TLegend.h" #include "TLegendEntry.h" #include "TVectorD.h" #include "TGraph.h" #include "TMultiGraph.h" #include "TCanvas.h" #include "TLatex.h" #include "TDirectory.h" #include "TAxis.h" #include "TFile.h" #include "TPaveText.h" #include "TObject.h" #include "TStyle.h" #include "TAttLine.h" #include "TAttFill.h" #include #include "TPave.h" #include #include #include #include #include using namespace std; //int main(){ // for C++ code int teststatement() { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TCanvas *c6 = new TCanvas("c6", "c6", 1024,0,1440,900); //0,132,1024,768); // = new TCanvas("c1", "c1",153,156,723,444); c6->Divide(2,2); c6->cd(1); /* TPad *pad7 =new TPad(); pad7->Draw(); pad7->SetFillColor(kWhite); pad7->cd(); pad7->SetLogy(); */ std::string myinput2= "/Users/spyhunter0066/OneDrive - harran.edu.tr/Online Derslerin Sunumları/Veri analizi kodlar/AlphaData_Si.txt"; cout << "myinput file name: " << myinput2.c_str() << endl; //Used for calculations and data storage TGraph* AlphaData_Si =new TGraph(myinput2.c_str() ,"%lg%*lg%*lg%*lg%lg%*lg%*lg"); // MeV //AlphaData_Si->Draw("alp"); int number2 = AlphaData_Si->GetN(); //get the line number in the datafile cout<<"number!!!!: "<< number2 << endl; double x_AlphaData_Si[number2]; //All graphes share the same X values as gamma-ray energyies. double y_AlphaData_Si[number2]; for(int i=0; iGetX()[i] ; y_AlphaData_Si[i]= (AlphaData_Si->GetY()[i] * 10. )/ 10.e-6 ; // in micro meters cout <Draw("alp"); gr17->SetTitle(" Alpha Range in Si via CSDA method ; T_particle (MeV); CSDA Range (m) "); gr17->GetYaxis()->SetTitleSize(0.04); gr17->GetYaxis()->SetLabelSize(0.03); gr17->GetYaxis()->SetTitleOffset(1.3); //gr17->GetXaxis()->SetLimits(0., 200.); //gr17->GetYaxis()->SetRangeUser(0., 80.); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// c6->cd(2); cout << endl; vector x_AlphaCalculated_Si; vector y_AlphaCalculated_Si; for(int i=0; i 1 && x_AlphaData_Si[i] <=4 ) { x_AlphaCalculated_Si.push_back(x_AlphaData_Si[i]) ; y_AlphaCalculated_Si.push_back( exp(1.61*sqrt(x_AlphaData_Si[i] )) ) ; } else if(x_AlphaData_Si[i] >4 && x_AlphaData_Si[i] <= 10) { x_AlphaCalculated_Si.push_back(x_AlphaData_Si[i]) ; y_AlphaCalculated_Si.push_back( ( (0.05*x_AlphaData_Si[i] ) + 2.85)* pow(x_AlphaData_Si[i], 1.5) ) ; } else cout << "sucks!" << endl; cout << "x: "<< x_AlphaData_Si[i] << " y_data: " << y_AlphaData_Si[i] << " y_calculated: " << y_AlphaCalculated_Si[i] <Draw("ap"); gr18->SetTitle(" Alpha Range in air ; T_particle (MeV) ; Alpha range in air (m) "); gr18->GetYaxis()->SetTitleSize(0.04); gr18->GetYaxis()->SetLabelSize(0.03); gr18->GetYaxis()->SetTitleOffset(1.3); gr18->SetMarkerStyle(20); gr18->SetMarkerColor(kRed); gr18->SetMarkerSize(0.5); //gr18->GetXaxis()->SetLimits(1., 10.); //gr18->GetYaxis()->SetRangeUser(0., 14.); return 0; //root -l -b -q macro.cpp }