Changeset 2914 for trunk/nlib/monitors/Monitor_nD.comp
- Timestamp:
- 08/26/10 14:43:05 (21 months ago)
- Files:
-
- 1 modified
-
trunk/nlib/monitors/Monitor_nD.comp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/nlib/monitors/Monitor_nD.comp
r2883 r2914 196 196 * restore_neutron: [0|1] If set, the monitor does not influence the neutron state. 197 197 * Equivalent to setting the 'parallel' option. 198 * geometry: [str] Name of an OFF file to specify a complex geometry detector 198 199 * 199 200 * OUTPUT PARAMETERS: … … 208 209 ******************************************************************************/ 209 210 DEFINE COMPONENT Monitor_nD 210 DEFINITION PARAMETERS (string options=0, string filename=0, user1=FLT_MAX, user2=FLT_MAX, user3=FLT_MAX, username1=0, username2=0,username3=0) 211 DEFINITION PARAMETERS (string options=0, string filename=0,string geometry=0, 212 user1=FLT_MAX, user2=FLT_MAX, user3=FLT_MAX, username1=0, username2=0,username3=0) 211 213 SETTING PARAMETERS (xwidth=0, yheight=0, zdepth=0, xmin=0, xmax=0, ymin=0, ymax=0, zmin=0, zmax=0, bins=0, min=-1e40, max=1e40, restore_neutron=0, radius=0) 212 214 /* these are protected C variables */ … … 216 218 SHARE 217 219 %{ 218 %include "monitor_nd-lib" 220 %include "monitor_nd-lib" 221 %include "interoff-lib" 219 222 %} 220 223 … … 224 227 MonitornD_Variables_type Vars; 225 228 MCDETECTOR detector; 229 off_struct offdata; 226 230 %} 227 231 228 232 INITIALIZE 229 233 %{ 230 char tmp[ 256];234 char tmp[CHAR_BUF_LENGTH]; 231 235 strcpy(Vars.compcurname, NAME_CURRENT_COMP); 232 236 if (options != NULL) 233 strncpy(Vars.option, options, 1024);237 strncpy(Vars.option, options, CHAR_BUF_LENGTH); 234 238 else { 235 239 strcpy(Vars.option, "x y"); … … 258 262 } 259 263 264 if (geometry && strlen(geometry)) 265 if (!off_init( geometry, xwidth, yheight, zdepth, 0, &offdata )) { 266 printf("Monitor_nD: %s could not initiate the OFF geometry. \n" 267 " Defaulting to normal Monitor dimensions.\n", NAME_CURRENT_COMP); 268 strcpy(geometry, ""); 269 } 270 260 271 if (!radius && !xwidth && !yheight && !zdepth && !xmin && !xmax && !ymin && !ymax && !strstr(Vars.option, "previous")) 261 exit(printf("Monitor_nD: %s has no dimension specified. Aborting (radius, xwidth, yheight, zdepth, previous).\n", NAME_CURRENT_COMP));272 exit(printf("Monitor_nD: %s has no dimension specified. Aborting (radius, xwidth, yheight, zdepth, previous).\n", NAME_CURRENT_COMP)); 262 273 263 274 Monitor_nD_Init(&DEFS, &Vars, xwidth, yheight, zdepth, xmin,xmax,ymin,ymax,zmin,zmax); … … 295 306 STORE_NEUTRON(INDEX_CURRENT_COMP, x, y, z, vx, vy, vz, t, sx, sy, sz, p); 296 307 */ 297 298 if (abs(Vars.Flag_Shape) == DEFS.SHAPE_SQUARE) /* square xy */ 308 309 if (geometry && strlen(geometry)) 310 { 311 Coords n0, n1, n={0,0,0}; 312 /* determine intersections with object */ 313 intersect = off_intersect(&t0, &t1, &n0, &n1, 314 x,y,z, vx, vy, vz, offdata ); 315 } 316 else if (abs(Vars.Flag_Shape) == DEFS.SHAPE_SQUARE) /* square xy */ 299 317 { 300 318 PROP_Z0; … … 325 343 if (intersect) 326 344 { 327 if ((abs(Vars.Flag_Shape) == DEFS.SHAPE_SPHERE) || (abs(Vars.Flag_Shape) == DEFS.SHAPE_CYLIND) || (abs(Vars.Flag_Shape) == DEFS.SHAPE_BOX) || (abs(Vars.Flag_Shape) == DEFS.SHAPE_BANANA)) 345 if ((abs(Vars.Flag_Shape) == DEFS.SHAPE_SPHERE) || (abs(Vars.Flag_Shape) == DEFS.SHAPE_CYLIND) 346 || (abs(Vars.Flag_Shape) == DEFS.SHAPE_BOX) || (abs(Vars.Flag_Shape) == DEFS.SHAPE_BANANA) 347 || (geometry && strlen(geometry)) ) 328 348 { 329 349 if (t0 < 0 && t1 > 0)
