Back to home page

EIC code displayed by LXR

 
 

    


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

0001 {
0002    gROOT->Reset();
0003 
0004    // Draw histogram filled by Geant4 TestEm2 simulation
0005    TFile f("./93ref0.root");
0006    TH1D* h1d = (TH1D*) f.Get("6");
0007    h1d->SetTitle("30 GeV e- on 20 X0 Fe : cumul longit energy dep");
0008    h1d->GetXaxis()->SetTitle("depth (X0)");
0009    h1d->GetYaxis()->SetTitle("100 Edep/E0");
0010    h1d->SetStats(kFALSE);  // Eliminate statistics box
0011    h1d->Draw("HIST");
0012 
0013    // pdg.ascii came from egs4 simulation
0014    ifstream in;
0015    in.open("sum.ascii");
0016 
0017    // Create a new histogram with sum.acsii values
0018    int nb_bins = 40;   
0019    float x_min = 0.25;
0020    float x_max = 20.25;
0021    TH1F* h1f = new TH1F("h1f","",nb_bins,x_min,x_max);
0022 
0023    Float_t x, y;
0024    while (1) {
0025       in >> x >> y ;
0026       if (!in.good()) break;
0027       h1f->Fill(x,y);
0028    }
0029    in.close();
0030 
0031    // Draw histogram fill by sum.acsii values
0032    h1f->SetLineColor(2);
0033    h1f->Draw("SAME");
0034 
0035    // Print the histograms legend
0036    TLegend *legend = new TLegend(0.65,0.55,0.85,0.68);
0037    legend->AddEntry(h1d,"93ref0","l");
0038    legend->AddEntry(h1f,"EGS4","L");
0039    legend->Draw();
0040 }