36 #include "../include/G4DNASmoluchowskiDiffusion.hh"
72 double time_test = 1
e-6 ;
74 double test_distance = 1
e-9;
76 double Plot(
double*
x,
double* )
84 return TMath::ErfcInverse(x);
87 Axis_t* BinLogX(
Int_t bins, Axis_t from, Axis_t to)
89 Axis_t
width = (to - from) / bins;
90 Axis_t *new_bins =
new Axis_t[bins + 1];
92 for (
int i = 0; i <= bins; i++) {
93 new_bins[i] = TMath::Power(10, from + i * width);
99 int main(
int argc,
char **argv)
103 TRint* root =
new TRint(
"G4DNASmoluchowskiDiffusion",&argc, argv);
104 double interval = 1
e-5;
113 std::cout << diff->
fInverse.size() << std::endl;
115 TCanvas* canvas =
new TCanvas();
125 TH1D*
h1 =
new TH1D(
"h1",
"h1", 100, 0., 1
e-6);
126 double distance = -1;
130 for(
size_t i = 0 ; i <
N ; ++i)
140 int integral_h1 = h1->Integral();
141 h1->Scale(1./integral_h1);
142 scalf=h1->GetBinWidth ( 1 ) ;
144 h1->GetXaxis()->SetTitle(
"distance");
147 TH1D*
h2 =
new TH1D(
"h2",
"h2", 100, 0., 1
e-6);
148 TH1D* h_irt_distance =
new TH1D(
"h2",
"h2", 100, 0., 1
e-6);
150 for(
size_t i = 0 ; i <
N ; ++i)
152 double x = std::sqrt(2*
D*time_test)*root_random.Gaus();
153 double y = std::sqrt(2*
D*time_test)*root_random.Gaus();
154 double z = std::sqrt(2*
D*time_test)*root_random.Gaus();
156 distance = std::sqrt(x*x+y*y+z*z);
160 double proba = root_random.Rndm();
161 double irt_distance =
InvErfc(proba)*2*std::sqrt(
D*time_test);
162 h_irt_distance->Fill(irt_distance);
166 int integral_h2 = h2->Integral();
167 h2->Scale(1./integral_h2);
168 scalf=h2->GetBinWidth ( 1 ) ;
173 int integral_h_irt_distance = h_irt_distance->Integral();
174 h_irt_distance->Scale(1./integral_h_irt_distance);
175 scalf = h_irt_distance->GetBinWidth ( 1 ) ;
176 h_irt_distance->Scale(1./scalf);
177 h_irt_distance->GetXaxis()->SetTitle(
"distance");
181 TF1 *
f2 =
new TF1(
"f2",&
Plot,0,1
e-6,0,
"Plot");
187 h_irt_distance->Draw(
"SAME");
188 double integral = f2->Integral(0., 1
e-6);
189 std::cout <<
"integral = " << integral << std::endl;
190 std::cout <<
"integral h1 = " << h1->Integral() << std::endl;
193 std::vector<double> rdm(3);
195 Axis_t* bins = BinLogX(nbins, -12, -1);
197 TH1D*
h3 =
new TH1D(
"h3",
"h3", 100, bins);
198 TH1D* h4 =
new TH1D(
"h4",
"h4", 100, bins);
199 TH1D* h_irt =
new TH1D(
"h_irt",
"h_irt", 100, bins);
201 for(
size_t i = 0 ; i <
N ; ++i)
203 for(
size_t j = 0 ; j < 3 ; ++j)
204 rdm[j] = root_random.Gaus();
206 double denum = 1./(rdm[0]*rdm[0] + rdm[1]*rdm[1] + rdm[2]*rdm[2]);
208 double t = ((test_distance*test_distance)*denum)*1./(2*
D);
215 double proba = root_random.Rndm();
216 double t_irt = 1./(4*
D)*std::pow((test_distance)/
InvErfc(proba),2);
221 TCanvas*
c1 =
new TCanvas();
223 int integral_h3 = h3->Integral();
224 h3->Scale(1./integral_h3);
225 scalf=h3->GetBinWidth ( 1 ) ;
228 h3->GetXaxis()->SetTitle(
"time");;
235 int integral_h4 = h4->Integral();
236 h4->Scale(1./integral_h4);
237 scalf=h4->GetBinWidth ( 1 ) ;
247 int integral_h_irt = h_irt->Integral();
248 h_irt->Scale(1./integral_h_irt);
249 scalf=h_irt->GetBinWidth ( 1 ) ;
250 h_irt->Scale(1./scalf);
251 h_irt->SetLineColor(4);