Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:00

0001 {
0002    gROOT->Reset();
0003 
0004    // Draw histograms fill by Geant4 TestEm5 simulation
0005    TFile f1("./opt3.root");
0006    TH1D* h1 = (TH1D*) f1.Get("10");
0007    h1->SetTitle("1 TeV muon in 3 m iron : kinetic energy at exit (GeV)");
0008    h1->GetXaxis()->SetTitle("Ekine (GeV)");
0009    h1->GetYaxis()->SetTitle("nb/GeV");
0010    h1->SetStats(kFALSE);  // Eliminate statistics box
0011    h1->SetLineColor(kBlue);
0012    h1->Draw("HIST");
0013 /*   
0014    TFile f2("./local.root");
0015    TH1D* h2 = (TH1D*) f2.Get("10");
0016    h2->SetStats(kFALSE);  // Eliminate statistics box
0017    h2->SetLineColor(kRed); 
0018    h2->Draw("SAME HIST");
0019 */     
0020 /*
0021 * muon 1 TeV/c in 3 m Iron
0022 * Particle Data Group. Physics Letters B 592 (2004) page 251
0023 * distribution of the muon kinetic energy
0024 * (from 950 GeV to 1000 GeV by bin of 0.5 GeV --> 100 bins) 
0025 */
0026 
0027    ifstream in;
0028    in.open("mars14.ascii");
0029 
0030    // Create a new histogram with mars14.acsii values
0031    int nb_bins = 100;   
0032    float x_min = 950.;
0033    float x_max = 1000.;
0034    TH1F* h1f = new TH1F("h1f","",nb_bins,x_min,x_max);
0035 
0036    Float_t x, y;
0037    while (1) {
0038       in >> x >> y ;
0039       if (!in.good()) break;
0040       h1f->Fill(x,y);
0041    }
0042    in.close();
0043 
0044    // Draw histogram fill by mars14.acsii values
0045    h1f->SetLineColor(kRed); 
0046    h1f->Draw("SAME");
0047 
0048    // Print the histograms legend
0049    TLegend* legend = new TLegend(0.2,0.55,0.45,0.70);
0050    legend->AddEntry(h1,"local (Urban90)","l");
0051    //legend->AddEntry(h2,"local (msc90)","l");   
0052    legend->AddEntry(h1f,"Mars14 simul ","L");
0053    legend->Draw();
0054 
0055 
0056 }