File indexing completed on 2025-11-03 09:05:14
0001 
0002 
0003 
0004 
0005 
0006 {
0007   gROOT->Reset();
0008   gStyle->SetPalette(1);
0009   gROOT->SetStyle("Plain");
0010 
0011   auto c1 = new TCanvas ("c1","",20,20,800,800);
0012   c1->Divide(1,1);
0013 
0014   TFile f("slowing.root");
0015 
0016   TH1F* h1 ;
0017   h1 = (TH1F*)f.Get("1");
0018   auto h2 = (TH1F*)f.Get("2");
0019   auto h3 = (TH1F*)f.Get("3");
0020 
0021   
0022 
0023   Int_t nbinsx = h1->GetXaxis()->GetNbins();
0024   
0025 
0026   Double_t y = 0;
0027   Double_t mini = 0;
0028   Double_t maxi = 0;
0029   Double_t largeur = 0;
0030 
0031   Double_t sum = 0;
0032 
0033   
0034   
0035   
0036   
0037   
0038   
0039   
0040 
0041   for (Int_t i=1; i<=nbinsx; i++)
0042   {
0043     sum = sum + h1->GetBinContent(i);
0044 
0045     mini = h1->GetBinLowEdge(i);
0046     maxi = mini + h1->GetBinWidth(i);
0047     largeur = std::pow(10,maxi)-std::pow(10,mini);
0048     
0049     
0050     h1->SetBinContent(i,h1->GetBinContent(i)*(1E9/1.6)/largeur);
0051     h2->SetBinContent(i,h2->GetBinContent(i)*(1E9/1.6)/largeur);
0052     h3->SetBinContent(i,h3->GetBinContent(i)*(1E9/1.6)/largeur);
0053   }
0054 
0055   gStyle->SetOptStat(000000);
0056 
0057   cout << endl;
0058   cout << "--> Integral of Phi (nm/eV) = " << sum << endl;
0059   cout << endl;
0060 
0061   c1->cd(1);
0062 
0063   TH2F *ht = new TH2F("","",2,1,6,2,1E2,1E8);
0064   ht->Draw();
0065   ht->GetXaxis()->SetTitle("Log(E (eV))");
0066   ht->GetYaxis()->SetTitle("#phi/D (/cm^{2}/eV/Gy)");
0067   ht->GetXaxis()->SetTitleSize(0.03);
0068   ht->GetYaxis()->SetTitleSize(0.03);
0069   ht->GetXaxis()->SetTitleOffset(1.7);
0070   ht->GetYaxis()->SetTitleOffset(1.7);
0071 
0072   gPad->SetLogy();
0073   h1->SetLineColor(2);
0074   h1->Draw("HSAME");
0075   h2->SetLineColor(3);
0076   h2->Draw("HSAME");
0077   h3->SetLineColor(4);
0078   h3->Draw("HSAME");
0079   h1->Draw("HSAME");
0080 
0081   TLegend *legend=new TLegend(0.6,0.65,0.88,0.85);
0082   legend->AddEntry(h1,"All e-","L");
0083   legend->AddEntry(h2,"Primaries","L");
0084   legend->AddEntry(h3,"Secondaries","L");
0085   legend->Draw();
0086 
0087 end:
0088 }