Background source (night sky)#
Header obdeect/sources/background.hpp. Photons start on the sphere of one telescope on the hemisphere
facing their own direction, travel inwards, with directions uniform in solid angle inside a
cone about a viewing axis.
BackgroundSource{centre, radius_m, pointing (default (0,0,-1)), viewcone_rad (default pi/2), spectrum (Fixed 400), pulse_width_ns=0, pulse_delay_ns=0}.
background_count(mean_bunches, seed, event, telescope): rounding rule of conventions.sample_background(s, seed, event, telescope, index):direction stream:
cos_theta = 1 - u0 (1 - cos(viewcone)),phi = 2 pi u1; directiond = pointing_unit cos_theta + (e1 cos phi + e2 sin phi) sin_theta(basis ofpointing).target stream:
ri = sqrt(u0)(area-uniform over the disc perpendicular tod, sori^2is uniform in[0, 1]),phi' = 2 pi u1,zi = sqrt(max(0, 1 - ri^2)); the local point(ri cos phi', ri sin phi', zi)is rotated so that its z axis is-d:za = acos(clamp(-d.z,-1,1)),az = atan2(-d.y, -d.x),unit = rotate_z(rotate_y(local, za), az). Positioncentre + unit * radius. Thendot(unit, d) <= 0for every photon (tested), andE[zi] = mean over u of sqrt(1 - u) = 2/3.time
= pulse_delay_ns - zi radius/c + w, withw = pulse_width_ns/2.35482004503095 * (pulse_u0 - 0.5)ifpulse_width_ns > 0, else 0 (pulse stream).wavelength from the spectrum (wavelength stream).
emit_background(s, seed, event, telescope, first, rows, weight, chunk): requiresradius > 0and0 < viewcone <= pi(elseinvalid_argument) androws <= 65536; frame sky; every row weightfloat(weight)(the bunch size); columnssource_columns.