Geant4 Cross Reference |
1 // ------------------------------------------------------------------- 2 // ------------------------------------------------------------------- 3 // 4 // ********************************************************************* 5 // To execute this macro under ROOT after your simulation ended, 6 // 1 - launch ROOT (usually type 'root' at your machine's prompt) 7 // 2 - type '.X plot.C' at the ROOT session prompt 8 // ********************************************************************* 9 10 void plot() 11 { 12 gROOT->Reset(); 13 gStyle->SetPalette(1); 14 gROOT->SetStyle("Plain"); 15 16 TCanvas* c1 = new TCanvas ("c1","",20,20,1000,500); 17 c1->Divide(2,1); 18 19 // Uncomment if merging should be done 20 //system ("rm -rf dna.root"); 21 //system ("hadd dna.root dna_*.root"); 22 23 TFile* f = new TFile("dna.root"); 24 25 TNtuple* ntuple; 26 ntuple = (TNtuple*)f->Get("dna"); 27 bool rowWise = true; 28 TBranch* eventBranch = ntuple->FindBranch("row_wise_branch"); 29 if ( ! eventBranch ) rowWise = false; 30 // std::cout << "rowWise: " << rowWise << std::endl; 31 32 // Canvas tab 1 33 c1->cd(1); 34 gStyle->SetOptStat(000000); 35 36 // All 37 ntuple->SetFillStyle(1001); 38 ntuple->SetFillColor(2); 39 ntuple->Draw("flagProcess","","B"); 40 41 // Excitation 42 ntuple->SetFillStyle(1001); 43 ntuple->SetFillColor(3); 44 ntuple->Draw("flagProcess","flagProcess==12||flagProcess==15||flagProcess==22||flagProcess==32||flagProcess==42||flagProcess==52||flagProcess==62","Bsame"); 45 46 // Elastic 47 ntuple->SetFillStyle(1001); 48 ntuple->SetFillColor(4); 49 ntuple->Draw("flagProcess","flagProcess==11||flagProcess==21||flagProcess==31||flagProcess==41||flagProcess==51||flagProcess==61||flagProcess==110||flagProcess==210||flagProcess==410||flagProcess==510||flagProcess==710||flagProcess==120||flagProcess==220||flagProcess==420||flagProcess==520||flagProcess==720","Bsame"); 50 51 // Ionisation 52 ntuple->SetFillStyle(1001); 53 ntuple->SetFillColor(5); 54 ntuple->Draw("flagProcess","flagProcess==13||flagProcess==23||flagProcess==33||flagProcess==43||flagProcess==53||flagProcess==63||flagProcess==73||flagProcess==130||flagProcess==230||flagProcess==430||flagProcess==530||flagProcess==730","Bsame"); 55 56 // Charge decrease 57 //ntuple->SetFillStyle(1001); 58 //ntuple->SetFillColor(6); 59 //ntuple->Draw("flagProcess","flagProcess==24||flagProcess==44||flagProcess==54","Bsame"); 60 61 // Charge increase 62 //ntuple->SetFillStyle(1001); 63 //ntuple->SetFillColor(7); 64 //ntuple->Draw("flagProcess","flagProcess==35||flagProcess==55||flagProcess==65","Bsame"); 65 66 gPad->SetLogy(); 67 68 // Canvas tab 2 69 c1->cd(2); 70 71 // Electrons 72 ntuple->SetMarkerColor(2); 73 ntuple->SetMarkerStyle(20); 74 ntuple->SetMarkerSize(.2); 75 ntuple->Draw("x:y:z","flagParticle==1"); 76 77 // Protons, hydrogen 78 ntuple->SetMarkerColor(4); 79 ntuple->Draw("x:y:z","flagParticle==2 || flagParticle==3 ","same"); 80 } 81