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