|
Line
Link Here
|
| 0 |
-- geometry/navigation/src/G4PhantomParameterisation.cc 2007-12-13 09:35:05.000000000 -0600 |
0 |
++ /Users/marcus/Documents/GeantProjects/GeneralGeant/G4PhantomParameterisation.cc 2008-01-03 11:52:31.000000000 -0600 |
|
Lines 251-264
Link Here
|
| 251 |
// Add +kCarTolerance so that they are first placed on voxel N, and then |
251 |
// Add +kCarTolerance so that they are first placed on voxel N, and then |
| 252 |
// if the direction is negative substract 1 |
252 |
// if the direction is negative substract 1 |
| 253 |
|
253 |
|
|
|
254 |
// modifications by Marcus H. Mendenhall, Vanderbilt University |
| 255 |
// because of the way rounding is done by adding the kCarTolerance, |
| 256 |
// the only error is in the positive direction, and these can slightly overflow |
| 257 |
// to the next bin, so clip them here |
| 254 |
G4double fx = (localPoint.x()+fContainerWallX+kCarTolerance)/fVoxelHalfX/2.; |
258 |
G4double fx = (localPoint.x()+fContainerWallX+kCarTolerance)/fVoxelHalfX/2.; |
| 255 |
G4int nx = G4int(fx); |
259 |
size_t nx = std::min(fNoVoxelX-1, size_t(fx)); |
| 256 |
|
260 |
|
| 257 |
G4double fy = (localPoint.y()+fContainerWallY+kCarTolerance)/fVoxelHalfY/2.; |
261 |
G4double fy = (localPoint.y()+fContainerWallY+kCarTolerance)/fVoxelHalfY/2.; |
| 258 |
G4int ny = G4int(fy); |
262 |
size_t ny = std::min(fNoVoxelY-1, size_t(fy)); |
| 259 |
|
263 |
|
| 260 |
G4double fz = (localPoint.z()+fContainerWallZ+kCarTolerance)/fVoxelHalfZ/2.; |
264 |
G4double fz = (localPoint.z()+fContainerWallZ+kCarTolerance)/fVoxelHalfZ/2.; |
| 261 |
G4int nz = G4int(fz); |
265 |
size_t nz = std::min(fNoVoxelZ-1, size_t(fz)); |
| 262 |
|
266 |
|
| 263 |
// If it is on the surface side, check the direction: if direction is |
267 |
// If it is on the surface side, check the direction: if direction is |
| 264 |
// negative place it on the previous voxel (if direction is positive it is |
268 |
// negative place it on the previous voxel (if direction is positive it is |
|
Lines 309-314
Link Here
|
| 309 |
|
313 |
|
| 310 |
G4int copyNo = nx + fNoVoxelX*ny + fNoVoxelXY*nz; |
314 |
G4int copyNo = nx + fNoVoxelX*ny + fNoVoxelXY*nz; |
| 311 |
|
315 |
|
|
|
316 |
// modifications by Marcus H. Mendenhall, Vanderbilt University |
| 317 |
// this is dangerous as implemented, since it checks the combined index instead |
| 318 |
// of each term individually. |
| 319 |
// This could result in edge cases getting wrapped crazy places in the volume without detection. |
| 320 |
// Since the terms were assured to be in bounds above by my other change, this is not needed. |
| 321 |
#if 0 |
| 312 |
// Correct precision problems |
322 |
// Correct precision problems |
| 313 |
// |
323 |
// |
| 314 |
if( copyNo < 0 || copyNo >= G4int(fNoVoxel) ) |
324 |
if( copyNo < 0 || copyNo >= G4int(fNoVoxel) ) |
|
Lines 356-361
Link Here
|
| 356 |
copyNo = nx + fNoVoxelX*ny + fNoVoxelXY*nz; |
366 |
copyNo = nx + fNoVoxelX*ny + fNoVoxelXY*nz; |
| 357 |
} |
367 |
} |
| 358 |
} |
368 |
} |
|
|
369 |
#endif |
| 359 |
|
370 |
|
| 360 |
CheckCopyNo( copyNo ); // not needed, just for debugging code |
371 |
CheckCopyNo( copyNo ); // not needed, just for debugging code |
| 361 |
|
372 |
|