Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
comparison.C
이 파일의 문서화 페이지로 가기
1 // G.A.P.Cirrone (2009)
2 
3 // Comparison beetwen experimental and simulated non modulated Bragg Peak
4 // Remember to run this file only if simulation has been run with the
5 // proton_therapy.mac file
6 
7 {
8 gROOT->Reset();
9 #include "Riostream.h"
10 
11  ifstream in;
12 
13 
14  // LOAD THE EXPERIMENTAL DATA FILE
15  // CONTAINED IN THE DIRECTORY
16  // hadrontherapy/experimentalData/proton/BraggPeak
17  TFile *experimentalFile = new TFile("../../../experimentalData/proton/BraggPeak/62MeVInWater.root","READ");
18 
19  // HERE THE ROOT FILE IS INTERPRETED AS A TREE
20  TTree *experimentalTree = (TTree*)experimentalFile -> Get("Experimental62MeVInWater");
21 
23  experimentalTree -> SetBranchAddress("EdepExp", &EdepExp);
24  experimentalTree -> SetBranchAddress("depthExp", &depthExp);
25 
26 
27  // CREATION AND NORMALISATION TO THE FIRST POINT OF AN NTUPLE CONTAINING THE EXPERIMENTAL DATA
28  TNtuple *ntupleExperimental = new TNtuple("ntupleExperimental","Protons, exp. data", "depthExp:EdepExp");
29  Int_t nentries = (Int_t)experimentalTree -> GetEntries();
30  for (Int_t i = 0; i<nentries; i++)
31  {
32  experimentalTree -> GetEntry(0);
34  experimentalTree -> GetEntry(i);
35  ntupleExperimental -> Fill(depthExp, EdepExp/normFactor);
36 
37  }
38 
39  // LOAD THE SIMULATION RESULT FILE
40  // CONTAINED IN THE DIRECTORY
41  // hadrontherapy/simulationResults/proton/BraggPeak
42  TFile *simulationFile = new TFile("../../../SimulationOutputs/proton/BraggPeak/protonBraggPeak.root","READ");
43 
44  // EXTRACTION, FROM THE SIMULATION FILE OF THE INTERESTING HISTOGRAMS
45  TH1D *simulatedPeak = (TH1D*) simulationFile -> Get("braggPeak");
46 
47  Float_t simulationNormalisationFactor = simulatedPeak -> GetBinContent(1);
48  simulatedPeak -> Scale(1/simulationNormalisationFactor);
49 
50 
51  TCanvas *c1 = new TCanvas ("c1","c1",200,10,600,400);
52 
53  // PLOT
54  ntupleExperimental -> SetMarkerStyle(4);
55  simulatedPeak -> SetMarkerSize(2);
56 
57  ntupleExperimental -> Draw("EdepExp:depthExp");
58  simulatedPeak-> Draw("same");
59 
60  // LEGEND
61  leg = new TLegend(0.50,0.60,0.20,0.70);
62  leg -> SetTextSize(0.035);
63  leg -> SetFillColor(0);
64  leg -> AddEntry(ntupleExperimental, "Experiment","P");
65  leg -> AddEntry(simulatedPeak, "Simulation");
66  leg -> Draw();
67 
68 
69 
70 
71 };
ntupleExperimental Fill(depthExp, EdepExp)
hipStyle SetTextSize(0.05)
gr2 SetMarkerSize(0.5)
hist1 Draw("HIST")
gr1 SetMarkerStyle(20)
TLegend * leg
Definition: compare.C:67
Float_t simulationNormalisationFactor
Definition: comparison.C:47
experimentalTree SetBranchAddress("EdepExp",&EdepExp)
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
Float_t normFactor
leg SetFillColor(0)
cout<< t1-> GetEntries()
Definition: plottest35.C:29
Float_t depthExp
Definition: comparison.C:22
TFile * simulationFile
Definition: comparison.C:42
G4float Float_t
TH1D * simulatedPeak
Definition: comparison.C:45
G4int Int_t
TFile * experimentalFile
Definition: comparison.C:17
Float_t EdepExp
Definition: comparison.C:22
Int_t nentries
Definition: comparison.C:29
TTree * experimentalTree
Definition: comparison.C:20
leg AddEntry(gr1,"Reference data","lp")
ifstream in
Definition: comparison.C:7
TNtuple * ntupleExperimental
Definition: comparison.C:28
simulatedPeak Scale(1/simulationNormalisationFactor)
ntupleExperimental GetEntry(0)