Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-13 08:28:03

0001 // -------------------------------------------------------------------
0002 // -------------------------------------------------------------------
0003 //
0004 // *********************************************************************
0005 // To execute this macro under ROOT after your simulation ended,
0006 //   1 - launch ROOT (usually type 'root' at your machine's prompt)
0007 //   2 - type '.X plot.C' at the ROOT session prompt
0008 // *********************************************************************
0009 
0010 void SetLeafAddress(TNtuple* ntuple, const char* name, void* address);
0011 
0012 void plot()
0013 {
0014   gROOT->Reset();
0015   gStyle->SetPalette(1);
0016   gROOT->SetStyle("Plain");
0017 
0018   TCanvas* c1 = new TCanvas ("c1","",20,20,800,800);
0019   c1->Divide(1,1);
0020 
0021   TFile* f = new TFile("radial.root");
0022 
0023   TNtuple* ntuple;
0024   ntuple = (TNtuple*)f->Get("radial");
0025   bool rowWise = true;
0026   TBranch* eventBranch = ntuple->FindBranch("row_wise_branch");
0027   if ( ! eventBranch ) rowWise = false;
0028 
0029   c1->cd(1);
0030   gStyle->SetOptStat(000000);
0031   gPad->SetLogy();
0032 
0033   ntuple->SetLineWidth(5);
0034   ntuple->Draw("dose:radius","","L");
0035 
0036   TH1* hist = (TH1*)gPad->GetPrimitive("htemp");
0037   hist->SetTitle("Absorbed dose VS radius");
0038   hist->GetXaxis()->SetLabelSize(0.03);
0039   hist->GetYaxis()->SetLabelSize(0.03);
0040   hist->GetXaxis()->SetTitleSize(0.03);
0041   hist->GetYaxis()->SetTitleSize(0.03);
0042   hist->GetXaxis()->SetTitleOffset(1.4);
0043   hist->GetYaxis()->SetTitleOffset(1.8);
0044   hist->GetXaxis()->CenterTitle();
0045   hist->GetYaxis()->CenterTitle();
0046   hist->GetXaxis()->SetTitle("Radius (nm)");
0047   hist->GetYaxis()->SetTitle("Dose (Gy)");
0048   gPad->SetTicks(1, 1);
0049   gPad->Modified();
0050 }
0051 
0052 void SetLeafAddress(TNtuple* ntuple, const char* name, void* address) {
0053   TLeaf* leaf = ntuple->FindLeaf(name);
0054   if ( ! leaf ) {
0055     std::cerr << "Error in <SetLeafAddress>: unknown leaf --> " << name << std::endl;
0056     return;
0057   }
0058   leaf->SetAddress(address);
0059 }