Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
extended/medical/dna/dnaphysics/plot.C
이 파일의 문서화 페이지로 가기
1 // -------------------------------------------------------------------
2 // $Id: plot.C 70323 2013-05-29 07:57:44Z gcosmo $
3 // -------------------------------------------------------------------
4 //
5 // *********************************************************************
6 // To execute this macro under ROOT after your simulation ended,
7 // 1 - launch ROOT (usually type 'root' at your machine's prompt)
8 // 2 - type '.X plot.C' at the ROOT session prompt
9 // *********************************************************************
10 {
11 gROOT->Reset();
12 gStyle->SetPalette(1);
13 gROOT->SetStyle("Plain");
14 
15 c1 = new TCanvas ("c1","",20,20,1500,500);
16 c1->Divide(3,1);
17 
18 system ("rm -rf dna.root");
19 system ("hadd dna.root dna_*.root");
20 
21 TFile f("dna.root");
22 
23 TNtuple* ntuple;
24 ntuple = (TNtuple*)f.Get("dna");
25 
26 c1->cd(1);
27  gStyle->SetOptStat(000000);
28 
29  // All
30  ntuple->SetFillStyle(1001);
31  ntuple->SetFillColor(2);
32  ntuple->Draw("flagProcess","","B");
33 
34  // Excitation
35  ntuple->SetFillStyle(1001);
36  ntuple->SetFillColor(3);
37  ntuple->Draw("flagProcess","flagProcess==12||flagProcess==15||flagProcess==22||flagProcess==32||flagProcess==42||flagProcess==52||flagProcess==62","Bsame");
38 
39  // Elastic
40  ntuple->SetFillStyle(1001);
41  ntuple->SetFillColor(4);
42  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");
43 
44  // Ionisation
45  ntuple->SetFillStyle(1001);
46  ntuple->SetFillColor(5);
47  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");
48 
49  // Charge decrease
50  //ntuple->SetFillStyle(1001);
51  //ntuple->SetFillColor(6);
52  //ntuple->Draw("flagProcess","flagProcess==24||flagProcess==44||flagProcess==54","Bsame");
53 
54  // Charge increase
55  //ntuple->SetFillStyle(1001);
56  //ntuple->SetFillColor(7);
57  //ntuple->Draw("flagProcess","flagProcess==35||flagProcess==55||flagProcess==65","Bsame");
58 
59  gPad->SetLogy();
60 
61 c1->cd(2);
62 
63  ntuple->SetMarkerColor(2);
64 
65  ntuple->Draw("x:y:z","flagParticle==1");
66 
67  //ntuple->SetMarkerColor(4);
68  //ntuple->SetMarkerSize(4);
69  //ntuple->Draw("x:y:z/1000","flagParticle==4 || flagParticle==5 || flagParticle==6","same");
70 
71 c1->cd(3);
72 
87 
88  ntuple->SetBranchAddress("flagParticle",&flagParticle);
89  ntuple->SetBranchAddress("flagProcess",&flagProcess);
90  ntuple->SetBranchAddress("x",&x);
91  ntuple->SetBranchAddress("y",&y);
92  ntuple->SetBranchAddress("z",&z);
93  ntuple->SetBranchAddress("totalEnergyDeposit",&totalEnergyDeposit);
94  ntuple->SetBranchAddress("stepLength",&stepLength);
95  ntuple->SetBranchAddress("kineticEnergyDifference",&kineticEnergyDifference);
96  ntuple->SetBranchAddress("kineticEnergy",&kineticEnergy);
97  ntuple->SetBranchAddress("cosTheta",&angle);
98  ntuple->SetBranchAddress("eventID",&eventID);
99  ntuple->SetBranchAddress("trackID",&trackID);
100  ntuple->SetBranchAddress("parentID",&parentID);
101  ntuple->SetBranchAddress("stepID",&stepID);
102 
103  TH1F* hsolvE = new TH1F ("hsolvE","solvE",100,0,2000);
104  TH1F* helastE = new TH1F ("helastE","elastE",100,0,2000);
105  TH1F* hexcitE = new TH1F ("hexcitE","excitE",100,0,2000);
106  TH1F* hioniE = new TH1F ("hiioniE","ioniE",100,0,2000);
107  TH1F* hattE = new TH1F ("hattE","attE",100,0,2000);
108  TH1F* hvibE = new TH1F ("hvibE","vibE",100,0,2000);
109 
110  for (Int_t j=0;j<ntuple->GetEntries(); j++)
111  {
112 
113  ntuple->GetEntry(j);
114  if (flagProcess==10) hsolvE->Fill(x);
115  if (flagProcess==11) helastE->Fill(x);
116  if (flagProcess==12) hexcitE->Fill(x);
117  if (flagProcess==13) hioniE->Fill(x);
118  if (flagProcess==14) hattE->Fill(x);
119  if (flagProcess==15) hvibE->Fill(x);
120 
121  }
122 
123  helastE->GetXaxis()->SetTitle("x (nm)");
124  helastE->SetLineColor(2);
125 
126  hexcitE->SetLineColor(3);
127  hioniE->SetLineColor(4);
128  hattE->SetLineColor(5);
129  hvibE->SetLineColor(6);
130  hsolvE->SetLineColor(7);
131 
132  gPad->SetLogy();
133 
134  helastE->Draw("");
135  hexcitE->Draw("SAME");
136  hioniE->Draw("SAME");
137  hattE->Draw("SAME");
138  hvibE->Draw("SAME");
139  hsolvE->Draw("SAME");
140 
141 
142 end:
143 }
Float_t x
Definition: compare.C:6
G4double Double_t
system("rm -rf microbeam.root")
TTree * ntuple
Float_t y
Definition: compare.C:6
Double_t z
G4int Int_t
Double_t kineticEnergyDifference