File indexing completed on 2025-02-23 09:20:59
0001 {
0002 gROOT->Reset();
0003
0004
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);
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);
0017 h2->SetLineColor(kRed);
0018 h2->Draw("SAME HIST");
0019
0020
0021
0022
0023
0024
0025
0026 ifstream in;
0027 in.open("530um.ascii");
0028
0029 TMarker *pt;
0030 Double_t x, y;
0031
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);
0038 pt->SetMarkerColor(kGreen);
0039 pt->Draw();
0040 }
0041 in.close();
0042
0043
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 }