Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:59

0001 {
0002    gROOT->Reset();
0003 
0004    // Draw histograms fill by Geant4 TestEm5 simulation
0005    TFile f1("./local.root");
0006    TH1D* h1 = (TH1D*) f1.Get("h1");
0007    h1->SetTitle("Energy deposited in 530 um of Si by 1 MeV e-");
0008    h1->GetXaxis()->SetTitle("Ekine (MeV)");
0009    h1->GetYaxis()->SetTitle("nb / MeV");
0010    h1->SetStats(kFALSE);  // Eliminate statistics box
0011    h1->SetLineColor(kBlue);
0012    h1->Draw("HIST");
0013    
0014    TFile f2("./opt4.root");
0015    TH1D* h2 = (TH1D*) f2.Get("h1");
0016    h2->SetStats(kFALSE);  // Eliminate statistics box
0017    h2->SetLineColor(kRed);
0018    h2->Draw("SAME HIST");
0019 /*
0020 * e- 1 MeV in Silicon 530 um 
0021 * M.J. Berger et al. NIM 69 (p.181) 1969
0022 * distribution of energy deposition
0023 * (from 110 keV to 1.03 MeV by bin of 10 keV --> 93 bins) 
0024 */
0025 
0026   ifstream in;
0027   in.open("530um.ascii");
0028    
0029   TMarker *pt;
0030   Double_t x, y;   
0031   // First indicate number of data
0032   int nbdata = 0;
0033   in >> nbdata;
0034   for ( int i = 0 ; i < nbdata ; i++ ) {
0035       in >> x >> y ;
0036       if (!in.good()) break;
0037       pt = new TMarker(x,y,32); // 32 for open triangle-down
0038       pt->SetMarkerColor(kGreen);
0039       pt->Draw();
0040   }   
0041   in.close();
0042 
0043   // Print the histograms legend
0044   TLegend *legend = new TLegend(0.6,0.6,0.8,0.8);
0045   legend->AddEntry(h1,"local","l");
0046   legend->AddEntry(h2,"opt4 ","l");   
0047   legend->AddEntry(pt,"Berger data","P");
0048   legend->Draw();
0049 }