Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
extended/medical/dna/microyz/plot.C
이 파일의 문서화 페이지로 가기
1 // *********************************************************************
2 // To execute this macro under ROOT after your simulation ended,
3 // 1 - launch ROOT (usually type 'root' at your machine's prompt)
4 // 2 - type '.X plot.C' at the ROOT session prompt
5 //
6 // Author: Sebastien Incerti, CNRS, France
7 // Date: 25 Feb. 2015
8 // The Geant4-DNA collaboration
9 // *********************************************************************
10 {
11 gROOT->Reset();
12 gStyle->SetPalette(1);
13 gROOT->SetStyle("Plain");
14 gStyle->SetOptStat(00000);
15 
16 //***************************************
17 //***************************************
18 // MAKE YOUR SELECTIONS
19 // for histograms
20 //***************************************
21 //***************************************
22 
23 Int_t linB=100; // linear histo: nb of bins in x - 1000 is best for integration
24 Double_t ymin=1; // minimum x-axis value
25 Double_t ymax=300; // maximum x-axis value
26 
27 //***************************************
28 //***************************************
29 
30 system ("rm -rf yz.root");
31 system ("hadd yz.root yz_*.root");
32 
33 c1 = new TCanvas ("c1","",60,60,800,800);
35 
36 TFile f("yz.root");
37 mycolor=4;
38 
39 TNtuple* ntuple;
40 ntuple = (TNtuple*)f.Get("yz");
41 
43 ntuple->SetBranchAddress("radius",&radius);
44 ntuple->SetBranchAddress("eventID",&eventID);
45 ntuple->SetBranchAddress("nbHits",&nofHits);
46 ntuple->SetBranchAddress("nbScoredHits",&nbEdep);
47 ntuple->SetBranchAddress("y",&y);
48 ntuple->SetBranchAddress("z",&z);
49 ntuple->SetBranchAddress("Einc",&Einc);
50 
51 //plot f(y)
52 
53 c1->cd(1);
54 
55 TH1F *hfyw = new TH1F ("hfyw","hfyw",linB,0,ymax);
56 
57 Int_t nentries = (Int_t)ntuple->GetEntries();
61 
64 
65 for (Int_t i=0; i<nentries; i++)
66 {
67  ntuple->GetEntry(i);
68 
69  hfyw->Fill(y,nofHits/nbEdep);
70  if (yLocalMin>y) yLocalMin=y;
71  if (yLocalMax<y) yLocalMax=y;
72  population=population+nofHits/nbEdep;
73  yF_anal = yF_anal + (nofHits/nbEdep)*y;
74  yD_anal = yD_anal + (nofHits/nbEdep)*y*y;
75 }
76 
77 cout << "**** Results ****" << endl;
78 cout << endl;
79 cout << "---> yF =" << yF_anal/population << " keV/um" << endl;
80 cout << "---> yD =" << (yD_anal/population)/(yF_anal/population) << " keV/um" << endl;
81 cout << endl;
82 cout << "---> Limits: " << endl;
83 cout << " * min value of y = " << yLocalMin << " keV/um" << endl;
84 cout << " * max value of y = " << yLocalMax << " keV/um" << endl;
85 
86 if ( (yLocalMax>ymax) || (yLocalMin<ymin) )
87 {
88  cout << "WARNING: please check your histogram limits ! " << endl;
89 }
90 
91 gPad->SetLogy();
92 hfyw->Scale (1./(population*hfyw->GetBinWidth(1)));
93 hfyw->SetTitle("f(y) (um/keV)");
94 hfyw->GetXaxis()->SetTitle("y (keV/um)");
95 hfyw->SetFillColor(2);
96 hfyw->SetLineColor(2);
97 hfyw->Draw("HIST");
98 }
99 
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 radius
Int_t nentries
Definition: comparison.C:29