5 TFile *
file =
new TFile(
"Dose.root",
"RECREATE");
11 TNtuple *
ntupleExperimental =
new TNtuple(
"ntupleExperimental",
"Protons, exp. data",
"depthExp:EdepExp");
15 TString
doseFileExp =
"../../../experimentalData/proton/BraggPeak/62MeVInWater.out";
17 cout <<
"Reading file \" " << doseFileExp <<
"\" ... ";
18 Long64_t
nlines = ntupleExperimental ->
ReadFile(doseFileExp,
"depthExp:EdepExp");
19 if (nlines <=0){cout <<
"Error: Check file \"" << doseFileExp <<
"\"\n";
return;}
21 printf(
"%d Experimental points found\n", nlines);
35 vec_dose.push_back(EdepExp);
36 vec_iX.push_back(depthExp);
39 ntupleExperimental->Reset();
41 for (
Int_t l=0;l<vec_dose.size();l++)
45 ntupleExperimental ->
Fill(depthExp, EdepExp);
50 TString
doseFileSim =
"../../../SimulationOutputs/proton/BraggPeak/Dose.out";
51 TNtuple *
TNtupleSim =
new TNtuple(
"SimTree",
"dose from ascii file",
"iX:jY:kZ:dose");
54 if (!in.is_open()){cout <<
"Error: Check file \"" << doseFileSim <<
"\"\n";
return;}
58 cout <<
"Reading file \" " << doseFileSim <<
"\" ... ";
60 in >> n >> n >> n >>
n;
62 in >> f1 >> f2 >> f3 >>
f4;
64 TNtupleSim ->
Fill(f1, f2, f3, f4);
68 if (nlines <= 0){cout <<
"\nNo data found! Check file \"" << doseFileSim <<
"\"\n";
return;}
86 if (iX==oldX){ sumDose+=
dose;}
89 vec_dose.push_back(sumDose);
90 vec_iX.push_back(oldX);
95 printf(
"%d Simulated points found\n", vec_iX.size());
97 for (
Int_t l=0; l<5; l++)
103 TNtupleSim ->
Reset();
105 for (
Int_t l=0;l<vec_dose.size();l++)
108 iX = 0.1 + (vec_iX[l]*0.2);
109 dose = vec_dose[l]/
norm;
110 TNtupleSim ->
Fill(iX, 0, 0, dose);
113 TCanvas *
c1 =
new TCanvas (
"c1",
"c1",200,10,600,400);
126 ntupleExperimental ->
Draw(
"EdepExp:depthExp");
127 TNtupleSim ->
Draw(
"dose:iX",
"",
"same");
131 leg =
new TLegend(0.50,0.60,0.20,0.70);
134 leg ->
AddEntry(ntupleExperimental,
"Experiment",
"P");
ntupleExperimental Fill(depthExp, EdepExp)
hipStyle SetTextSize(0.05)
experimentalTree SetBranchAddress("EdepExp",&EdepExp)
cout<< "Reading file \" "<< doseFileExp<< "\" ... ";Long64_t nlines=ntupleExperimental-> ReadFile(doseFileExp,"depthExp:EdepExp")
ntupleExperimental Reset()
printf("%d Experimental points found\n", nlines)
leg AddEntry(gr1,"Reference data","lp")
vector< Float_t > vec_dose
TNtuple * ntupleExperimental
ntupleExperimental GetEntry(0)