-- $Id: entrance_ap_01.lua,v 1.2 2007/06/29 23:27:18 dj Exp $ -- -- Simple annulus entrance aperture, for use by raygen. -- -- reads from an rdb datbase which must have the columns -- shell, x, y, z, ri, ro AXAF_ROOT = getenv('AXAF_ROOT') if ( nil == AXAF_ROOT ) then error ( 'entrance_ap_XX.lua: unable to read environtmental variable AXAF_ROOT' ) end dofile( AXAF_ROOT .. '/simul/lib/lua/RDB.lua' ) function entrance_aperture( ) local rdb, i, match local errmsg -- this should define ea_db and shell override( ); if ( nil == ea_db ) then error( 'entrance_ap_XX.lua: ea_db not set' ) end if ( nil == shell ) then error( 'entrance_ap_XX.lua: shell not set' ) end rdb, errmsg = RDB:new( ea_db ) if ( nil == rdb ) then error ("entrance_ap_XX.lua: error opening " .. ea_db .. ": " .. errmsg ) end -- find the entry which corresponds to this shell match = nil local rec = rdb:read() while ( not match and rec ) do if ( tonumber(rec.shell) == shell ) then match = 1 else rec = rdb:read() end end rdb:close() if not match then error( "entrance_ap_XX.lua: couldn't find shell=" .. shell .. " in " .. ea_db ) end ea_define( "Entrance Aperture", 'annulus', rec.x, rec.y, rec.z, rec.ri, rec.ro ) end