Changeset 553
 Timestamp:
 Sep 10, 2009 3:53:23 PM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sans/XOP_Dev/MonteCarlo/MonteCarlo2.c
r458 r553 70 70 long NSingleIncoherent,NSingleCoherent,NScatterEvents,incoherentEvent,coherentEvent; 71 71 long NDoubleCoherent,NMultipleScatter,isOn,xCtr_long,yCtr_long; 72 long NMultipleCoherent,NCoherentEvents; 73 72 74 73 75 // for accessing the 2D wave data, direct method (see the WaveAccess example XOP) … … 219 221 NMultipleScatter = 0; 220 222 NScatterEvents = 0; 223 NMultipleCoherent = 0; 224 NCoherentEvents = 0; 225 221 226 isOn = 0; 222 227 … … 283 288 //sprintf(buf,"neutron scatters coherently\r"); 284 289 //XOPNotice(buf); 285 coherentEvent = 1;290 coherentEvent += 1; 286 291 find_theta = 0; //false 287 292 do { … … 307 312 //sprintf(buf,"neutron scatters incoherent\r"); 308 313 //XOPNotice(buf); 309 incoherentEvent = 1;314 incoherentEvent += 1; 310 315 // phi and theta are random over the entire sphere of scattering 311 316 // !can't just choose random theta and phi, won't be random over sphere solid angle … … 392 397 NMultipleScatter += 1; 393 398 } 399 if(coherentEvent >= 1 && incoherentEvent == 0) { 400 NCoherentEvents += 1; 401 } 402 if(coherentEvent > 1 && incoherentEvent == 0) { 403 NMultipleCoherent += 1; 404 } 405 394 406 } else { // index was zero, neutron must be transmitted, so just increment the proper counters and data 395 407 isOn += 1; 396 408 nt[0] += 1; 397 409 MemClear(indices, sizeof(indices)); // Must be 0 for unused dimensions. 398 indices[0] = xCtr_long; 399 indices[1] = yCtr_long; 410 //indices[0] = xCtr_long; //don't put everything in one pixel 411 //indices[1] = yCtr_long; 412 indices[0] = (long)round(xCtr+xx/pixSize); 413 indices[1] = (long)round(yCtr+yy/pixSize); 414 // check for valid indices  got an XOP error, probably from here 415 if(indices[0] > 127) indices[0] = 127; 416 if(indices[0] < 0) indices[0] = 0; 417 if(indices[1] > 127) indices[1] = 127; 418 if(indices[1] < 0) indices[1] = 0; 419 400 420 if (result = MDGetNumericWavePointValue(wavH, indices, value)) 401 421 return result; … … 431 451 if (result = MDSetNumericWavePointValue(p>resultsH, indices, value)) 432 452 return result; 433 value[0] = (double)N DoubleCoherent;453 value[0] = (double)NMultipleCoherent; 434 454 indices[0] = 5; 435 455 if (result = MDSetNumericWavePointValue(p>resultsH, indices, value)) … … 439 459 if (result = MDSetNumericWavePointValue(p>resultsH, indices, value)) 440 460 return result; 441 461 value[0] = (double)NCoherentEvents; 462 indices[0] = 7; 463 if (result = MDSetNumericWavePointValue(p>resultsH, indices, value)) 464 return result; 442 465 443 466 // HSetState((Handle)wavH, hState); //release the handle of the 2D data wave
Note: See TracChangeset
for help on using the changeset viewer.