00001 void LoadXS() 00002 { 00003 gSystem->Load("libNdb"); 00004 NdbMTReactionXS pb(1,"Total Cross Section"); 00005 00006 pb.LoadENDF("8200.endf"); 00007 00008 const Int_t npoint=1000; 00009 00010 Double_t e=1.0E-3; 00011 00012 const Double_t fact = TMath::Exp(TMath::Log(2.0E7/e)/(Double_t)(npoint-1)); 00013 00014 Float_t *x=new Float_t[npoint]; 00015 Float_t *y=new Float_t[npoint]; 00016 00017 00018 for (Int_t i=0; i<npoint; ++i) { 00019 x[i]=e; 00020 y[i]=pb.Interpolate(e); 00021 e*=fact; 00022 } 00023 00024 c1 = new TCanvas("c1","Lead Cross section",200,10,700,500); 00025 00026 c1->SetFillColor(42); 00027 c1->SetGridx(); 00028 c1->SetGridy(); 00029 c1->GetFrame()->SetFillColor(21); 00030 c1->GetFrame()->SetBorderSize(12); 00031 c1->SetLogx(); 00032 c1->SetLogy(); 00033 00034 TGraph *gr = new TGraph(npoint,x,y); 00035 gr->SetFillColor(19); 00036 gr->SetLineColor(2); 00037 gr->SetLineWidth(2); 00038 gr->SetMarkerColor(4); 00039 gr->SetMarkerStyle(21); 00040 gr->SetMarkerSize(0.2); 00041 gr->SetTitle("Lead Total Cross section"); 00042 gr->Draw("AWLP"); 00043 00044 //Add axis titles. 00045 //A graph is drawn using the services of the TH1F histogram class. 00046 //The histogram is created by TGraph::Paint. 00047 //TGraph::Paint is called by TCanvas::Update. This function is called by default 00048 //when typing <CR> at the keyboard. In a macro, one must force TCanvas::Update. 00049 00050 c1->Update(); 00051 gr->GetHistogram()->SetXTitle("Energy in eV"); 00052 gr->GetHistogram()->SetYTitle("Cross Section in Barns"); 00053 }