// Basic root programme to get the data from the tree created after the run in geant4 void analysis() { TFile *input=new TFile("test.root","read"); TTree *tree=(TTree*)input->Get("B4"); int entries=tree->GetEntries(); double Esil,Esci,Lsil,Lsci; tree->SetBranchAddress("Esil",&Esil); tree->SetBranchAddress("Esci",&Esci); tree->SetBranchAddress("Lsil",&Lsil); tree->SetBranchAddress("Lsci",&Lsci); //Drawing the Energy deposition in silicon TH1F*hist=new TH1F("hist","Energy Deposition in Silicon",500,0,7); for(int i=0;iGetEntry(i); hist->Fill(Esil); } TCanvas *t1=new TCanvas(); //hist->GetYaxis()->SetRangeUser(0,1000); hist->Draw(); t1->SetLogy(); hist->SetFillColor(kBlue -8); hist->GetXaxis()->SetTitle("Energy Deposition (MeV)"); hist->GetYaxis()->SetTitle("Count"); t1->SetGridx(); t1->SetGridy(); //Drawing the Energy Deposition in Germanium TH1F*hist1=new TH1F("hist1","Energy Deposition in Germanium",1000,0,30); for(int i=0;iGetEntry(i); hist1->Fill(Esci); } TCanvas *t2=new TCanvas(); hist1->Draw(); t2->SetLogy(); hist1->SetFillColor(kGreen -8); hist1->SetLineColor(kGreen -12); hist1->GetXaxis()->SetTitle("Energy Deposition (MeV)"); hist1->GetYaxis()->SetTitle("Count"); t2->SetGridx(); t2->SetGridy(); // Drawing the ranges in Silicon TH1F*hist2=new TH1F("hist2","Track in silicon",1000,0,0.3); for(int i=0;iGetEntry(i); hist2->Fill(Lsil); } TCanvas *t3=new TCanvas(); hist2->Draw(); t3->SetLogy(); hist2->SetFillColor(kRed -8); hist2->SetLineColor(kRed -12); hist2->GetXaxis()->SetTitle("Track (mm)"); hist2->GetYaxis()->SetTitle("Count"); t3->SetGridx(); t3->SetGridy(); // Drawing the ranges in Germanium TH1F*hist3=new TH1F("hist3","Track in Germanium",1000,0,10); for(int i=0;iGetEntry(i); hist3->Fill(Lsci); } TCanvas *t4=new TCanvas(); hist3->Draw(); t4->SetLogy(); hist3->SetFillColor(kPink -8); hist3->SetLineColor(kPink -9); hist3->GetXaxis()->SetTitle("Track (mm)"); hist3->GetYaxis()->SetTitle("Count"); t4->SetGridx(); t4->SetGridy(); }