1 #ifndef _UCORRELATOR_TRIGCACHE_H 2 #define _UCORRELATOR_TRIGCACHE_H 4 #include "AntennaPositions.h" 8 #define DEG2RAD (M_PI / 180.) 20 TrigCache(
int n_phi,
double dphi,
double phi_start,
int ntheta,
double dtheta,
double theta_start,
const AntennaPositions * aps,
bool use_bin_center=
false,
int nant2use = 0,
const int * ants = 0)
21 : nphi(n_phi) ,ap(aps)
24 phi =
new double[nphi];
25 int num_ants = nant2use == 0 ? NUM_SEAVEYS : nant2use;
26 cos_phi =
new double[nphi * NUM_SEAVEYS * 2];
27 theta =
new double[ntheta];
28 tan_theta =
new double[ntheta];
29 cos_theta =
new double[ntheta];
31 for (
int i = 0; i < nphi; i++)
33 double current_phi = phi_start + dphi * i;
34 if (use_bin_center) current_phi += 0.5 * dphi;
37 for (
int j = 0; j < num_ants; j++)
39 int ant = nant2use ? ants[j] : j;
40 cos_phi[2 * (i + ant * nphi)] = cos( DEG2RAD * ( current_phi - ap->
phiAnt[0][ant] ));
41 cos_phi[2 * (i + ant * nphi) + 1] = cos( DEG2RAD * ( current_phi - ap->
phiAnt[1][ant] ));
45 for (
int i = 0; i < ntheta; i++)
47 double current_theta = theta_start + dtheta * i;
48 if (use_bin_center) current_theta += 0.5 * dphi;
49 theta[i] = -current_theta;
50 cos_theta[i] = cos(theta[i] * DEG2RAD);
51 tan_theta[i] = tan(theta[i] * DEG2RAD);
76 double cosPhi(
int phibin,
int ant,
int pol) {
return cos_phi[ 2 * (phibin + ant * nphi) + pol]; }
double phiAnt[2][NUM_SEAVEYS]