47 {
48 cout <<
"JMarkovPathIntegrator" <<
endl
49 <<
"Written by Martijn Jongen" <<
endl
51
53
60
61 try {
69
71 return 1 ;
72 }
73 }
74 catch(const exception &error) {
76 cout <<
"Type '" <<
argv[0] <<
" -h!' to display the command-line options." <<
endl ;
77 exit(1) ;
78 }
79
88
90
91
92 cout <<
"Loading scattering model" <<
endl ;
94
96 if( f->IsZombie() ) {
98 exit(1) ;
99 }
102 cerr <<
"Could not read JScatteringModel from file!" <<
endl ;
103 exit(1) ;
104 }
105 cout <<
"JScatteringModel loaded" <<
endl
106 <<
" absorption length = " <<
sm->getAbsorptionLength() <<
" m" <<
endl
107 <<
" scattering length = " <<
sm->getScatteringLength() <<
" m" <<
endl
109
110
111
114 if( !reader.is_open() ) {
116 exit(1) ;
117 }
122 while( reader.hasNext() ) {
123 p = reader.next() ;
124 if( p->size() == (
unsigned int)
nvert )
125 paths.push_back(*p) ;
126 else
129 }
130 reader.close() ;
131
135 exit(1) ;
136 }
137 cout <<
"Done reading file. Selected " <<
npaths <<
" / " <<
nread <<
" JPhotonPaths." <<
endl ;
139
140
143 double INF = 1.0/0.0 ;
144 double MININF = -1.0/0.0 ;
145
146 for(
int i=0 ; i<
nvert ; ++i ) {
149 }
150
151
153
154 for(
int i=0; i<
nvert; ++i ) {
156 min(
minvals[i].getY(),p->at(i).getY()),
157 min(
minvals[i].getZ(),p->at(i).getZ()) ) ;
159 max(
maxvals[i].getY(),p->at(i).getY()),
160 max(
maxvals[i].getZ(),p->at(i).getZ()) ) ;
161 }
162 }
164
165 cout <<
"Allocating histograms." <<
endl ;
166
173
174
175
177
181
185
189 }
191
192
193 cout <<
"Filling histograms" <<
endl ;
195
197 hX[
n]->Fill( p->at(
n).getX() ) ;
198 hY[
n]->Fill( p->at(
n).getY() ) ;
199 hZ[
n]->Fill( p->at(
n).getZ() ) ;
200 }
201 }
203
204
205 cout <<
"Normalizing histograms." <<
endl ;
210 }
212
213
214
216 writer.
open(
"high_contribution_paths.paths") ;
217
218
219
220 cout <<
"Computing scattering probability" <<
endl ;
230
231
233
237
241
242
244 double w = 1 ;
245
247 double x =
hX[
n]->GetRandom() ;
248 double y =
hY[
n]->GetRandom() ;
249 double z =
hZ[
n]->GetRandom() ;
258 }
261 ws[i] = w ;
264
265 if( rho/w > 0.001 ) {
266
267
268
269
270
271
272
273
274
275
277 }
278 }
281
282
283 double sigma = 0 ;
284 {
285 double max ;
288
289
294
295
300
301
306
307
312
318 }
319
320
324 }
326
328 cout <<
"sigma = " << sigma <<
" (standard deviation of integral contributions)" <<
endl ;
329 }
332 cout <<
"Error estimate 1: sigma/sqrt(N) = "
333 << sigma <<
" / sqrt(" <<
nsamples <<
") = "
335
339
340
346
351
356 }
362 }
363
365 return 0 ;
366}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Data structure for position in three dimensions.
virtual void open(const char *file_name) override
Open file.
virtual void close()=0
Close device.
virtual bool put(const T &object)=0
Object output.
Virtual base class for a scattering model.
Template definition of a multi-dimensional oscillation probability interpolation table.
JReader & read(JReader &in) override final
Read from input.