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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/medical/dna/slowing/plot.C (Version 11.3.0) and /examples/extended/medical/dna/slowing/plot.C (Version 9.6.p4)


  1 // *******************************************      1 
  2 // To execute this macro under ROOT after your    
  3 //   1 - launch ROOT (usually type 'root' at y    
  4 //   2 - type '.X plot.C' at the ROOT session     
  5 // *******************************************    
  6 {                                                 
  7   gROOT->Reset();                                 
  8   gStyle->SetPalette(1);                          
  9   gROOT->SetStyle("Plain");                       
 10                                                   
 11   auto c1 = new TCanvas ("c1","",20,20,800,800    
 12   c1->Divide(1,1);                                
 13                                                   
 14   TFile f("slowing.root");                        
 15                                                   
 16   TH1F* h1 ;                                      
 17   h1 = (TH1F*)f.Get("1");                         
 18   h2 = (TH1F*)f.Get("2");                         
 19   h3 = (TH1F*)f.Get("3");                         
 20                                                   
 21   //goto end;                                     
 22                                                   
 23   Int_t nbinsx = h1->GetXaxis()->GetNbins();      
 24   //cout << nbinsx << endl;                       
 25                                                   
 26   Double_t y = 0;                                 
 27   Double_t mini = 0;                              
 28   Double_t maxi = 0;                              
 29   Double_t largeur = 0;                           
 30                                                   
 31   Double_t sum = 0;                               
 32                                                   
 33   // Division by bin width to get y axis          
 34   // in nm/eV                                     
 35   //                                              
 36   // Scaling by 1E9/1.6 to get correct unit       
 37   // for Phi/D in (/cm2/eV/Gy)                    
 38   // when histogram (in nm/eV) is                 
 39   // multiplied by density(=1g/cm3)/E(eV)         
 40                                                   
 41   for (Int_t i=1; i<=nbinsx; i++)                 
 42   {                                               
 43     sum = sum + h1->GetBinContent(i);             
 44                                                   
 45     mini = h1->GetBinLowEdge(i);                  
 46     maxi = mini + h1->GetBinWidth(i);             
 47     largeur = std::pow(10,maxi)-std::pow(10,mi    
 48     // cout << mini << " " << std::pow(10,mini    
 49     // << " " << maxi << " " << std::pow(10,ma    
 50     h1->SetBinContent(i,h1->GetBinContent(i)*(    
 51     h2->SetBinContent(i,h2->GetBinContent(i)*(    
 52     h3->SetBinContent(i,h3->GetBinContent(i)*(    
 53   }                                               
 54                                                   
 55   gStyle->SetOptStat(000000);                     
 56                                                   
 57   cout << endl;                                   
 58   cout << "--> Integral of Phi (nm/eV) = " <<     
 59   cout << endl;                                   
 60                                                   
 61   c1->cd(1);                                      
 62                                                   
 63   TH2F *ht = new TH2F("","",2,1,6,2,1E2,1E8);     
 64   ht->Draw();                                     
 65   ht->GetXaxis()->SetTitle("Log(E (eV))");        
 66   ht->GetYaxis()->SetTitle("#phi/D (/cm^{2}/eV    
 67   ht->GetXaxis()->SetTitleSize(0.03);             
 68   ht->GetYaxis()->SetTitleSize(0.03);             
 69   ht->GetXaxis()->SetTitleOffset(1.7);            
 70   ht->GetYaxis()->SetTitleOffset(1.7);            
 71                                                   
 72   gPad->SetLogy();                                
 73   h1->SetLineColor(2);                            
 74   h1->Draw("HSAME");                              
 75   h2->SetLineColor(3);                            
 76   h2->Draw("HSAME");                              
 77   h3->SetLineColor(4);                            
 78   h3->Draw("HSAME");                              
 79   h1->Draw("HSAME");                              
 80                                                   
 81   TLegend *legend=new TLegend(0.6,0.65,0.88,0.    
 82   legend->AddEntry(h1,"All e-","L");              
 83   legend->AddEntry(h2,"Primaries","L");           
 84   legend->AddEntry(h3,"Secondaries","L");         
 85   legend->Draw();                                 
 86                                                   
 87 end:                                              
 88 }                                                 
 89