anita.hh
1 //class Anita:
4 #ifndef ICEMC_ANITA_HH
5 #define ICEMC_ANITA_HH
6 
7 
8 #include "rx.hpp"
9 #include <array>
10 
11 #ifdef ANITA_UTIL_EXISTS
12 #include "FFTtools.h"
13 #endif
14 
15 #include "TF1.h"
16 
17 class RX;
18 class TGraph;
19 class TFile;
20 class TTree;
21 class TH1F;
22 class Vector;
23 class Position;
24 class Balloon;
25 class IceModel;
26 class Settings;
27 
28 using std::ofstream;
29 using std::vector;
30 using std::array;
32 class Anita {
33 
34 private:
35 
36  std::string stemp;
37 
38  double GaintoHeight(double gain,double freq,double nmedium_receiver);
39  TGraph *gshort[4];
40  void setTrigRequirement(int WHICH);
41 
42 
43 public:
44 
45 
46 
47  int tuffIndex; // keith edits
49 
50  static const int NBANDS_MAX=100;
51  static const int NPOL=2;
52  //static const int NFREQ=128; ///< number of frequency bins
53  static const int NFREQ=128;
54  //const int NFREQ=4096;
55 
56 
57  static const int NTRIG=5;
58  static const int NANTENNAS_MAX=2000;
59  static const int NLAYERS_MAX=5;
60  static const int NTRIGGERLAYERS_MAX=3;
61  static const int NPHI_MAX=400;
66 
67  Vector antenna_positions[2][NLAYERS_MAX * NPHI_MAX];
68 
71 
72  //before correcting for offset for the layer.
73  //only used if it is cylindrically symmetric (radians)
76  // 0=horizontal,+90=down
77 
78  int inu;
79  // what the payload looks like
80 
82  // anita proposal "says that the separation between upper and lower
83  // 2 layers of antennas is just under 4m.
84  // for anita hill, consider the positions of the "layers" of the "payload" (the stations) to be sitting on the horizontal grid defined by polar coordinates
89 
91 
92  double additionalDt;
93 
94  Anita(); // constructor
95  ~Anita();
96  void Initialize(Settings *settings1,ofstream &foutput,int inu, TString outputdir);
97  void initializeFixedPowerThresholds(ofstream &foutput);
98  void readVariableThresholds(Settings *settings1);
99  void readAmplification();
100  void getDiodeDataAndAttenuation(Settings *settings1, TString outputdir);
101  void getPulserData();
102 
103  // takes arrays that span NFREQ and turn them into arrays that span HALFNFOUR
104  void MakeArrayforFFT(double *vsignalarray_e,double *vsignal_e_forfft, double phasedelay, bool useconstantdelay);
105 
106  void GetArrayFromFFT(double *tmp_fftvhz, double *vhz_rx);
107 
108  int Match(int ilayer,int ifold,int rx_minarrivaltime);
109  int getLabAttn(int NPOINTS_LAB,double *freqlab,double *labattn);
110 
111  void labAttn(double *vhz);
112  void SetNoise(Settings *settings1,Balloon *bn1,IceModel *antarctica);
113  void calculate_antenna_positions(Settings *settings1,double pitch, double roll, double phi_spin,Vector n_north,Vector n_east);// this calculates the above
114 
115  TFile *fnoise;
116  TTree *tdiode;
117 
118  static const int NFOUR=1024;
119  static const int HALFNFOUR=512;
120 
121  // these are used for the satellite thing
122  int NBANDS;
123 
124  int PERCENTBW;
125 
126  // these variables are for filling the tsignals tree
127  double signal_vpol_inanita[5][HALFNFOUR];
128  //double noise_vpol_inanita[5][HALFNFOUR]; ///< this is the noise waveform in the vertical polarization, before converting to LCP, RCP where applicable
129  double total_vpol_inanita[5][HALFNFOUR];
130 
131  double timedomainsignal_rfcm[HALFNFOUR];
132  double timedomainsignal_lab[HALFNFOUR];
133 
134  TTree *turfratechain;
135  TTree *surfchain;
136  TFile *fturf;
137  TFile *fsurf;
138 
139  UShort_t phiTrigMask;
140  UShort_t phiTrigMaskH;
141  UShort_t l1TrigMask;
142  UShort_t l1TrigMaskH;
143  Double_t deadTime;
144  unsigned int realTime_turfrate;
145  unsigned int realTime_tr_min;
146  unsigned int realTime_tr_max;
147  unsigned int realTime_surf;
148  unsigned int realTime_surf_min;
149  unsigned int realTime_surf_max;
150  UShort_t thresholds[2][48];
151  UShort_t scalers[2][48];
152  Double_t fakeThresholds[2][48];
153  Double_t fakeThresholds2[2][48];
154  Double_t fakeScalers[2][48];
155 
156  int iturf;// for indexing
157  int isurf;
158  int iturfevent;
159 
160  static const int npointThresh = 1640;
161  Float_t threshScanThresh[2][48][npointThresh];
162  Float_t threshScanScaler[2][48][npointThresh];
163  Float_t minadcthresh[2][48];
164  Float_t maxadcthresh[2][48];
165 
166  void setphiTrigMaskAnita3(UInt_t realTime_flightdata);
167  void setphiTrigMask(UInt_t realTime_flightdata);
168  void setTimeDependentThresholds(UInt_t realTime_flightdata);
169 
170  double total_diodeinput_1_inanita[5][HALFNFOUR];
171  double total_diodeinput_2_inanita[5][HALFNFOUR];
172 
173  double total_diodeinput_1_allantennas[48][HALFNFOUR];
174  double total_diodeinput_2_allantennas[48][HALFNFOUR];
175 
176  // these are just for the antenna that receives the signal first
177  double timedomain_output_inanita[2][5][HALFNFOUR];
178 
179  double time_trig[HALFNFOUR];
180  double weight_inanita; // weight of the event
181  int arrayofhits_inanita[3][16][2][HALFNFOUR];
182 
183  //std::array< std::array< std::array< std::array<std::vector<int>,5>, 2>, 16>, 3> arrayofhits_inanita;
184 
185 
186 
187  // same as arrayofhits_inanita but it's time reversed
188  int arrayofhits_forgaryanderic[3][16][2][HALFNFOUR];
189  //std::array< std::array< std::array< std::array<std::vector<int>,5>, 2>, 16>, 3> arrayofhits_inanita;
190 
191  int l1trig_anita3and4_inanita[2][16][HALFNFOUR];
192 
193 
194 
195  int l1trig_anita4lr_inanita[3][16][HALFNFOUR];
196 
197  int l1trig_anita4lr_forgaryanderic[3][16][HALFNFOUR];
198 
199 
200  int l2trig_anita4lr_inanita[16][3][HALFNFOUR];
201 
202  int l2trig_anita4lr_forgaryanderic[16][HALFNFOUR];
203 
204  int l3type0trig_anita4lr_inanita[16][HALFNFOUR];
205  int l3trig_anita4lr_inanita[16][HALFNFOUR];
206 
207  int l3type0trig_anita4lr_forgaryanderic[16][HALFNFOUR];
208  int l3type1trig_anita4lr_forgaryanderic[16][HALFNFOUR];
209 
210 
211 
212 
213  double timedomain_output_corrected_forplotting[2][6][HALFNFOUR];
214 
215 
216  double timedomain_output_allantennas[2][48][HALFNFOUR];
217 
218 
219 
220  int flag_e_inanita[5][HALFNFOUR];
221  int flag_h_inanita[5][HALFNFOUR];
222  double dangle_inanita,emfrac_inanita,hadfrac_inanita;
223  double ston[5];
224 
225  int iminbin[5];
226  int imaxbin[5];
228 
229  double peak_v_banding_rfcm[2][5];
230  double peak_rx_signalonly[2];
231  double peak_rx_rfcm[2];
232 
234 
235  double peak_rx_rfcm_lab[2];
236  //I think this is the numerator of the vertical axis on Matt's plot
237 
238 
239 
240 
241  int channels_passing[2][5];
243  int l1_passing; // l1 passing
244  int l1_passing_allantennas[48]; // l1 passing
245 
246  int irx;
247  void BoxAverageComplex(double *array,const int n,int navg);
248  void BoxAverage(double *array,const int n,int navg);
249  int GetRx(int ilayer, int ifold);
250  int GetRxTriggerNumbering(int ilayer, int ifold);
251 
252 
253  double avgfreq_rfcm[NFREQ];
254  double avgfreq_rfcm_lab[NFREQ];
255 
256 
257 
258  double vmmhz_banding[NFREQ];
259  double vmmhz_banding_rfcm[NFREQ];
260 
262 
263  // Note: The following 4 RMS noise variables are for all antennas of all events.
264  // In fact, they don't represent RMS until after all events are finished!
265  double rms_rfcm[2];
266  double rms_lab[2];
267 
268 
269  TFile *fsignals;
270  TTree *tsignals;
271 
272  TFile *fdata;
273  TTree *tdata;
274  TTree *tgaryanderic;
275 
276  TTree *tglob;
277 
278  TH1F *hsignals[5];
279 
280  double f_pulser[NFOUR/4];
281  double f_phases[NFOUR/4];
282  double f_noise[NFOUR/4];
283  double v_pulser[NFOUR/4];
284  double v_phases[NFOUR/4];
285  double v_noise[NFOUR/4];
286 
287 
288 
289  double cumulat_prob[9];
290  double cumulat_prob_plus1[9];
291 
292 
293  // for filling tsignals tree
294  double timedomainnoise_rfcm_banding[2][5][HALFNFOUR];
295  double timedomainnoise_rfcm_banding_long[2][5][HALFNFOUR];
296  double timedomainnoise_rfcm[2][HALFNFOUR];
297  double timedomainnoise_lab[2][HALFNFOUR];
298  double timedomainnoise_rfcm_long[2][HALFNFOUR];
299  double timedomainnoise_lab_long[2][HALFNFOUR];
300 
301  double phases[5][HALFNFOUR];
302 
303  // for filling tglob
304  // for each polarization
305  int passglobtrig[2];
306  double integral_vmmhz_foranita;
307 
308 
311 
312  double FREQ_LOW;
313  double FREQ_HIGH;
314 
315  double NOTCH_MIN;
316  double NOTCH_MAX; // upper edge of notch filter
317 
318  int BANDING;// set in the input file
319  // whether or not you set your own banding (1)
320  // or use anita-1 banding
321 
322  double freq[NFREQ]; // frequency for each bin
323  double freq_forfft[NFOUR]; // frequencies for taking fft of signal
324  double freq_forplotting[NFOUR/4]; // just one entry for frequency, unlike the above.
325  double freq_forfft_long[2*NFOUR]; // frequencies for taking fft of signal
326  double freq_forplotting_long[NFOUR/2]; // just one entry for frequency, unlike the above.
327  double time[NFOUR/2];
328  double time_long[NFOUR];
329 
330  double time_centered[NFOUR/2];
331  double freqdomain_rfcm_banding[5][HALFNFOUR/2]; // average noise in frequency domain
332  double freqdomain_rfcm_banding_long[5][HALFNFOUR]; // average noise in frequency domain
333 
334  double freqdomain_rfcm[HALFNFOUR/2]; // average noise in frequency domain
335  double freqdomain_rfcm_long[HALFNFOUR]; // average noise in frequency domain
336 
337  double freqdomain_rfcm_theory[HALFNFOUR/2]; // average noise in frequency domain
338  double avgfreqdomain_lab[HALFNFOUR/2]; // average noise in frequency domain
339  double avgfreqdomain_lab_long[HALFNFOUR]; // average noise in frequency domain
340 
341  double phases_rfcm_banding[2][5][HALFNFOUR/2];
342  double phases_rfcm_banding_long[2][5][HALFNFOUR];
343  double phases_rfcm[2][HALFNFOUR/2];
344  double phases_rfcm_long[2][HALFNFOUR];
345  double phases_lab[2][HALFNFOUR];
346  double phases_lab_long[2][HALFNFOUR];
347 
348 
349  // this goes from 0 to Fmax, and represents both real and imaginary components
350 
351 
352 
353 
354  void getDiodeModel();
355  void setDiodeRMS(Settings *settings1, TString outputdir);
356 
357  TF1 fdiode;
358  double maxt_diode;
359  int idelaybeforepeak[5];
360  int iwindow[5];
361  double diode_real[5][NFOUR]; // This is the time domain of the diode response. (actually NFOUR/2 array is used.)
362  double fdiode_real[5][NFOUR]; // This is the fft of the diode response. (use all NFOUR array. This is for doubling array size for zero padding)
363 
364 
365  void myconvlv(double *timedomain_forconvl,const int NFOUR,double *fdiode,double &maxdiodeconvl,double &onediodeconvl,double *power_noise,double *diodeconv);
366 
367  void GetArrivalTimes(const Vector& rf_direction,Balloon *bn1,Settings *settings1);
368  void GetArrivalTimesBoresights(const Vector rf_direction[NLAYERS_MAX][NPHI_MAX]);
369 
370  void GetArrivalTimesBoresights(const Vector rf_direction[NLAYERS_MAX][NPHI_MAX],Balloon *bn1, Settings *settings1);
371 
372  int rx_minarrivaltime;
373  double arrival_times[2][NLAYERS_MAX*NPHI_MAX];
374 
375  static int SurfChanneltoBand(int isurf);
376  int AntennaWaveformtoSurf(int ilayer,int ifold); // find surf that generates this antenna's waveform
377  static int AntennaNumbertoSurfNumber(int ilayer,int ifold); // find surf where this antenna is triggered
378  static int GetAntennaNumber(int ilayer,int ifold); // given icemc indices ilayer, ifold, find antenna number as defined officially on anita
379  static int GetLayer(int rx);
380  static int GetIfold(int rx);
381  static int GetSurfChannel(int antenna, int ibw,int ipol); // which channel on the surf this channel on this antenna corresponds to.
382  static int WhichBand(int ibw,int ipol); // which band, 1-8, in order as they are on the surf
383  void Banding(int j,double *freq_noise,double *powerperfreq,int NPOINTS_NOISE);
384  void Banding(int iband,double *vmmhz);
385  void RFCMs(int ilayer,int ifold,double *vmmhz);
386  void normalize_for_nsamples(double *spectrum, double nsamples, double nsamp);
387  void convert_power_spectrum_to_voltage_spectrum_for_fft(int length,double *spectrum, double domain[], double phase[]);
388  void GetNoiseWaveforms(); // make time domain noise waveform based on avgnoise being the v^2
389  //void GetNoiseWaveform(int iband); // make time domain noise waveform based on avgnoise being the v^2
390  void GetPhases();
391  int count_getnoisewaveforms; //count how many times we're in GetNoiseWaveforms for calculating rms voltages
392 
393  // each of the above graphs has 601 bins in it
394  static const int NPOINTS_BANDS=601;
395 
396  double freq_bands[5][NPOINTS_BANDS]; // a frequency array for each of the four bands
397  double attn_bands[5][NPOINTS_BANDS]; // attn array for each of the four bands in dB
398  double bandsattn[5][NPOINTS_BANDS]; // as a fraction
399  //double correl[4][NPOINTS_BANDS]; // correlation between each band and the fullband
400  double correl_banding[5][NPOINTS_BANDS]; // correlation between each band and the fullband
401  double correl_lab[NPOINTS_BANDS]; // correlation between each band and the fullband
402  //double correl[5][NPOINTS_BANDS]; // correlation between each band and the fullband
403 
404 
405  static const int NPOINTS_AMPL=58;// bins in amplification
406  double freq_ampl[NANTENNAS_MAX][NPOINTS_AMPL]; // frequencies for each amp bin
407  double ampl[NANTENNAS_MAX][NPOINTS_AMPL]; // amplification
408  double ampl_notdb[NANTENNAS_MAX][NPOINTS_AMPL];// amplification again, but as a fraction
409  double noisetemp[NANTENNAS_MAX][NPOINTS_AMPL]; // noise temp each amp bin
410 
411 
412  static const int NPOINTS_NOISE=2000;
413 
414 
415  //double bwslice_thresholds[4]={2.319,2.308,2.300,2.290}; // this allows you to set different thresholds for each band
416  double bwslice_vnoise[NLAYERS_MAX][5]; // expected noise voltage for antenna layer and
417  //each slice in bandwidth
418 
419  double probability[5];
420  double bwslice_enoise[5]; // average integrated power in each band
421  double bwslice_fwhmnoise[5]; // 1/2 of fwhm of hnoise
422  double bwslice_rmsdiode[2][5]; // average rms diode output across noise waveforms in each band
423  double bwslice_meandiode[5]; // mean diode output across all samples in a sample of noise waveforms generated for each band
424  double bwslice_vrms[5]; // rms noise voltage for this bandwidth slice
425  double bwslice_dioderms_fullband_allchan[2][48][7]; // diode rms for noise read from flight last elements are tuffs
426  double bwslice_diodemean_fullband_allchan[2][48][7]; // diode rms for noise read from flight
427  double freq_noise[5][NPOINTS_NOISE]; // frequency array that goes with vnoise array
428 
429 
430  double impedence;
431  double phase;
432  double powerthreshold[5];
433  double powerthreshold_nadir[5];
434  int NCH_PASS; // for ANITA 3 trigger - requires some number of channels pass
435 
436  double l1window; // time window where we require coincidences at L1
437 
438  double minsignalstrength; // minimum signal strength (measured as output of the diode) that a signal has to be for it to be worth adding to noise and performing the diode integration (each time we do this is uses up a noise waveform)
439 
440  double INTEGRATIONTIME; // integration time of the tunnel diode
441  static const int nsamp=100; // number of samples that were used to measure the noise data
442  double TIMESTEP; // time step between samples for digitization
443 
444 
445  double DEADTIME;
446 
447  double TRIG_TIMESTEP; // this is the l1 trigger window for the anita 3 trigger.
448  unsigned N_STEPS_PHI;
449  unsigned N_STEPS_THETA;
450 
451  static const unsigned N_SUMMED_PHI_SECTORS = 4;
452  static const unsigned N_SUMMED_LAYERS = 3;
453 
454 
455 
456  double energythreshold; // relative to expected energy from noise
457  double MIN_PHI_HYPOTHESIS;
458  double MAX_PHI_HYPOTHESIS;
459  double MIN_THETA_HYPOTHESIS;
460  double MAX_THETA_HYPOTHESIS;
461 
462  int USEPHASES;
463 
464  int NTRIGGERLAYERS; // number of layers considered by the trigger. may be different from nlayers, the number of physical layers on the payload.
465  // In Anita 1 and Anita 2, the number of physical layers were 3 while the number of trigger layers were 2.
466  int PHITRIG[NLAYERS_MAX]; // number of positions in phi for each trigger layer
467  int REQUIRE_CENTRE; // require centre antenna in clump to be one of those hit
468  static const int NTRIGPHISECTORS=16; // number of phi sectors in the trigger
469 
470  int GAINS;// whether to use constant gains as entered in GetBeamWidths (0) or to use Ped's measurements as entered in ReadGains (1)
471  static const int NPOINTS_GAIN =131; // number of pointqs within bandwidth that gain is measured. from 200 MHz to 1.5 GHz with step size of 10 MHz
472  double gainv_measured[NPOINTS_GAIN]; // may way of making the program use 3994760 fewer bytes than if these five arrays had still had 100000 elements
473  double gainh_measured[NPOINTS_GAIN];
474  double gainhv_measured[NPOINTS_GAIN];
475  double gainvh_measured[NPOINTS_GAIN];
476  double frequency_forgain_measured[NPOINTS_GAIN];
477 
478  double gain_angle[4][NPOINTS_GAIN][7]; /* first term: 0 = v polarization channel, a angle
479  1 = h polarization channel, a angle
480  2 = h polarization channel, e angle
481  3 = v polarization channel, e angle
482  second term: frequency
483  third term: angle */
484 
485  // frequency binning
486  // anita proposal says frequency range is 0.2-1.2 GHz.
487  // specs for the quad ridge antenna Model 0312-810 say 0.3-1.5 GHz
488  double flare[4][NFREQ]; // for coarse antenna models: beam width: e-plane: vp/hp, h-plane: vp/hp
489  double gain[2][NFREQ]; // for coarse antenna models: gain vert pol,h pol
490 
491  int GetBeamWidths(Settings *settings1); // for getting beam widths using coarse models (horn specs or simple model for EeVA)
492  void Set_gain_angle(Settings *settings1,double nmedium_receiver);
493  double Get_gain_angle(int gain_type, int k, double hitangle);
494  void ReadGains();
495  void AntennaGain(Settings *settings1,double hitangle_e,double hitangle_h,double e_component,double h_component,int k,double &vsignalarray_e,double &vsignalarray_h);
496 
497 
498  double reference_angle[7]; // reference angles for finding gains of antenna
499 
500  double inv_angle_bin_size[6];
501  int whichbin[NFREQ]; // these are for finding gains as a function of frequency
502  double scalef2[NFREQ], scalef1[NFREQ]; // they are set in Set_gain_angle
503  double vvGaintoHeight[NFREQ], hhGaintoHeight[NFREQ], hvGaintoHeight[NFREQ], vhGaintoHeight[NFREQ]; // holds results of the function double GaintoHeight
504 
505  double diffraction[2][89][NFREQ];
506  void SetDiffraction();
507  double GetDiffraction(int ilayer, double zenith_angle, int ifreq);
508 
509 
510 
511  static const int NPOINTS_LAB=272; // from note 137
512 
513  double freqlab[NPOINTS_LAB]; // frequency for each lab attn. bin
514 
515  double labattn[NPOINTS_LAB]; // lab attenuation
516 
517 
518  double VNOISE[NLAYERS_MAX]; // noise calculated for each antenna layer depending on cant angle- this is only used right now for the chance in hell cuts
519 
520 
521  int trigRequirements[NLAYERS_MAX];// 0th element - L1 - how many channels per antenna should pass
522  // 1st element- L2 - how many antennas on a layer
523  // 2nd element - L3 - how many L2 triggers should be coincident
524 
525  int antennatosurf[32];
526 
527  double maxthreshold;
528  double bwslice_thresholds[5]; // thresholds for each band -- this is just an initialization- this is set in the input file
529  int bwslice_allowed[5]; // these bands are allowed to contribute to the trigger sum -- this is set in the input file
530  int bwslice_required[5]; // these bands are required to be among the channels that pass -- this is set in the input file
531  int pol_allowed[2];// which polarisations are allowed to have channels that fire (V,H)
532  int pol_required[2];// which polarisations are required to have channels that fire (V,H)
533 
534 
535 
536  double bwslice_center[5]; // center frequencies
537  double bwslice_width[5]; // 3 dB bandwidths, without overlap
538 
539 
540  double bwslice_min[5]; //minimum of each bandwidth slice
541 
542  double bwslice_max[5]; //minimum of each bandwidth slice
543  double bwmin; // minimum width of any allowed bandwidth slice
544 
545  TFile* coherent_datafile;
546  TTree* coherent_waveform_sum_tree;
547  static const unsigned int NUM_COHERENT_ANTENNAS = 9;
548  unsigned hypothesis_offsets[16][200][200][4][3]; // Time bin offsets for each hypothesis - [center_phi_sector_index][phi_angle_index][theta_angle_index][phi_sector_index][layer_index]
549  vector< vector< vector <double> > > hypothesis_angles; // Time bin offsets for each hypothesis - [center_phi_sector_index][phi_angle_index][theta_angle_index][phi_sector_index][layer_index]
550  //unsigned antenna_indices[16][9]; // These are the indices of the antennas used for a given hypothesis' center phi center index - [center_phi_sector-index][which of the nine]
551  vector< vector <int> > vdifferent_offsets;
552  vector< vector <double> > vdifferent_angles;
553 
554  void calculate_all_offsets(void); // This function creates offsets for coherent sum trigger
555  void getDifferentOffsets();
556  void printDifferentOffsets();
557  void calculate_single_offset(const unsigned center_phi_sector_index, const double angle_phi, const double angle_theta, double hypothesis_offset[][3]);
558  void calculate_single_offset(const unsigned center_phi_sector_index, const unsigned index_phi, const unsigned index_theta, double hypothesis_offset[][3]);
559  unsigned cwst_event_number;
560  unsigned cwst_center_phi_sector;
561  double cwst_rms_noise;
562  double cwst_actual_rms;
563  double cwst_threshold;
564  unsigned cwst_window_start;
565  unsigned cwst_window_end;
566  double cwst_deg_theta;
567  double cwst_deg_phi;
568  double cwst_actual_deg_theta;
569  double cwst_actual_deg_phi;
570  Vector cwst_rf_direction;
571  Vector cwst_0th_sector_position;
572  double cwst_timesteps[HALFNFOUR];
573  RX cwst_RXs[48];
574  RX cwst_aligned_wfms[9];
575  //vector <double>* cwst_whole_wfms[NUM_COHERENT_ANTENNAS];
576  //vector <double>* cwst_wfms[NUM_COHERENT_ANTENNAS];
577  //vector <double>* cwst_aligned_wfms[NUM_COHERENT_ANTENNAS];
578  vector <double> cwst_summed_wfm;
579  vector <double> cwst_power_of_summed_wfm;
580  double cwst_power;
581  void fill_coherent_waveform_sum_tree(unsigned inu, unsigned center_phi_sector, Settings* settings1, double rms_noise, double actual_rms, unsigned window_start, unsigned window_end, double deg_theta, double deg_phi, double actual_deg_theta, double actual_deg_phi, vector <double>& summed_wfm, vector <double>& power_of_summed_wfm, double power);
582  void GetPayload(Settings*, Balloon*);
583  double VNOISE_ANITALITE[NPHI_MAX]; // noise for each antenna, for the anita-lite trigger configuration.
584  double INCLINE_TOPTHREE; // cant angle of top three layers of antennas
585  double INCLINE_NADIR; // cant angle of nadir (bottom) layer of antennas
586  double LIVETIME;
587 
588  double SIGMA_THETA; // resolution on the polar angle of the signal
589 
590  double extraCableDelays[2][48];
591 #ifdef ANITA_UTIL_EXISTS
592  RFSignal *fSignalChainResponseDigitizerTuffs[2][3][16][7]; // 0:VPOL, 1:HPOL ---- 0:TOP, 1:MIDDLE, 2:BOTTOM------- 0:configA, 1:configB, 2:configC, 3:configG, 4:configO, 5:configP, 6:configK
593  RFSignal *fSignalChainResponseTriggerTuffs[2][3][16][7]; // same as for DigitizerTuffs
594  void readImpulseResponseDigitizer(Settings *settings1);
595  void readImpulseResponseTrigger(Settings *settings1);
596  void calculateImpulseResponsesRatios(Settings *settings1);
597  void readTuffResponseDigitizer(Settings *settings1);
598  void readTuffResponseTrigger(Settings *settings1);
599  void readTriggerEfficiencyScanPulser(Settings *settings1);
600  void readNoiseFromFlight(Settings *settings1);
601  void getQuickTrigNoiseFromFlight(Settings *settings1, double justNoise[HALFNFOUR], int ipol, int iant, int ituff);
602  TGraph *RayleighFits[2][48];
603  Int_t numFreqs;
604  Double_t *freqs;
605  TGraph *gPulseAtAmpa;
606  RFSignal *fSignalChainResponseDigitizer[2][3][16]; // 0:VPOL, 1:HPOL ---- 0:TOP, 1:MIDDLE, 2:BOTTOM
607  RFSignal *fSignalChainResponseTrigger[2][3][16]; // 0:VPOL, 1:HPOL ---- 0:TOP, 1:MIDDLE, 2:BOTTOM
608 #endif
609  void calculateDelaysForEfficiencyScan();
610 
611  void GetPhasesFromFFT(double *tmp_fftvhz, double *phases);
612  void FromTimeDomainToIcemcArray(double *vsignalarray, double vhz[NFREQ]);
613 
614 
615  Double_t fTimes[HALFNFOUR];
616  Double_t fSignalChainResponseA3DigitizerFreqDomain[2][3][16][400];
617  Double_t fSignalChainResponseDigitizerFreqDomain[2][3][16][7][400];
618  Double_t fSignalChainResponseTriggerFreqDomain[2][3][16][7][400];
619  Double_t fRatioTriggerToA3DigitizerFreqDomain[2][3][16][7][400];
620  Double_t fRatioDigitizerToA3DigitizerFreqDomain[2][3][16][7][400];
621  Double_t deltaT;
622 
623  // Trigger efficiency scan parameters
624  Int_t trigEffScanPhi; // central phi sector of trigger efficiency scan
625  Double_t trigEffScanAtt[5]; // attenuations to apply to central and adjecent antennas
626  Double_t trigEffScanPhiDelay[5]; // delays between phi sectors
627  Double_t trigEffScanRingDelay[3]; // delays between rings
628  Int_t trigEffScanApplyRingDelay[5]; // to which phi sectors apply ring delays
629  Int_t trigEffScanRingsUsed[3]; // to which rings apply scan
630  Double_t trigEffScanPulseAtAmpa[HALFNFOUR];
631  Double_t trigEffScanPulseAtAmpaUpsampled[NFOUR];
632  Double_t trigEffScanAmplitudeAtAmpa[NFREQ];
633  Double_t trigEffScanPulseAtSurf[250][HALFNFOUR];
634  int TUFFstatus[3];
635  int ntuffs;
636 
637 }; //class Anita
638 
639 
640 
641 
642 #endif //ICEMC_ANITA_HH
double total_diodeinput_1_allantennas[48][HALFNFOUR]
this is across all antennas, just the full band
Definition: anita.hh:173
int noiseeventcounter
counts which event we&#39;re on so we go in order
Definition: anita.hh:310
unsigned int realTime_tr_min
min realtime from the turf rate file
Definition: anita.hh:145
double total_diodeinput_2_allantennas[48][HALFNFOUR]
needs comment
Definition: anita.hh:174
TH1F * hsignals[5]
s/n (max diode output/mean diode output) for vertical polarization in each band
Definition: anita.hh:278
static const int NBANDS_MAX
max number of bands
Definition: anita.hh:50
double peak_v_banding_rfcm[2][5]
peak V in e/h polarization after rfcm&#39;s and banding
Definition: anita.hh:229
int nnoiseevents
total number of noise events we&#39;re choosing from
Definition: anita.hh:309
double timedomain_output_corrected_forplotting[2][6][HALFNFOUR]
this is just for writing out to the following tree
Definition: anita.hh:213
double rms_rfcm_e_single_event
This is in Volts, not mV!
Definition: anita.hh:261
static const int NPOL
number of polarizations
Definition: anita.hh:51
Float_t threshScanScaler[2][48][npointThresh]
scalers from threshold scan
Definition: anita.hh:162
Double_t fakeThresholds[2][48]
Fake thresholds (coming from converting fake scalers to thresholds)
Definition: anita.hh:152
double LAYER_VPOSITION[Anita::NLAYERS_MAX]
position of layers in z relative to vertical center of the payload
Definition: anita.hh:81
unsigned int realTime_turfrate
realtime from the turf rate file
Definition: anita.hh:144
int GetRxTriggerNumbering(int ilayer, int ifold)
get antenna number based on which layer and position it is
Definition: anita.cc:208
double THETA_ZENITH[NLAYERS_MAX]
how the antenna is tilted in theta (in radians with 0=up)
Definition: anita.hh:75
double peak_rx_signalonly[2]
peak voltage in e/h polarization received by the antenna
Definition: anita.hh:230
double vmmhz_banding[NFREQ]
V/m/MHz after banding.
Definition: anita.hh:258
double total_diodeinput_1_inanita[5][HALFNFOUR]
this is the waveform that is input to the tunnel diode in the first (LCP or vertical) polarization ...
Definition: anita.hh:170
TTree * tdata
writing data out for the analysers
Definition: anita.hh:273
This is a wrapper class for an RF Signal.
Definition: RFSignal.h:12
void Initialize(Settings *settings1, ofstream &foutput, int inu, TString outputdir)
initialize a bunch of stuff
Definition: anita.cc:249
double SIMON_DELTA_R[NLAYERS_MAX][NPHI_MAX]
measurements by Simon used in analysis ANITA-2
Definition: anita.hh:64
UShort_t scalers[2][48]
scalers as read from the surf file: first index is pol, second is antenna number (only working for An...
Definition: anita.hh:151
int number_all_antennas
this keeps count of the number of antennas for use with timing calculations, etc. ...
Definition: anita.hh:48
int PERCENTBW
percent bandwidth
Definition: anita.hh:124
Reads in and stores input settings for the run.
Definition: Settings.h:37
double peak_rx_rfcm_lab[2]
peaks of the previous arrays
Definition: anita.hh:235
double PHI_EACHLAYER[NLAYERS_MAX][NPHI_MAX]
phi of the center of each antenna on each layer
Definition: anita.hh:70
double PHI_OFFSET[NLAYERS_MAX]
antenna offset in phi for each layer (radians)
Definition: anita.hh:74
double total_diodeinput_2_inanita[5][HALFNFOUR]
this is the waveform that is input to the tunnel diode in the second (RCP or horizontal) polarization...
Definition: anita.hh:171
This class is a 3-vector that represents a position on the Earth&#39;s surface.
Definition: position.hh:26
int NBANDS
number of frequency sub-bands (not counting full band)
Definition: anita.hh:122
int iminbin[5]
this is the minimum bin to start
Definition: anita.hh:225
UShort_t thresholds[2][48]
thresholds as read from the surf file: first index is pol, second is antenna number (only working for...
Definition: anita.hh:150
unsigned int realTime_tr_max
max realtime from the turf rate file
Definition: anita.hh:146
unsigned int realTime_surf_max
max realtime from the surf file
Definition: anita.hh:149
double timedomain_output_inanita[2][5][HALFNFOUR]
this is just for writing out to the following tree
Definition: anita.hh:177
TTree * tgaryanderic
writing data out for the analysers
Definition: anita.hh:274
double rms_lab[2]
rms noise at lab chip
Definition: anita.hh:266
Vector ANTENNA_POSITION_START[2][NLAYERS_MAX][NPHI_MAX]
antenna positions from Kurt&#39;s measurements
Definition: anita.hh:62
Double_t fakeScalers[2][48]
Fake scalers (coming from converting threhsolds during flight to scalers using threshold scan) ...
Definition: anita.hh:154
double RRX[Anita::NLAYERS_MAX]
radius that the antenna sits from the axis of the payload (feedpoint)
Definition: anita.hh:87
Contains everything about positions within payload and signals it sees for each event, in both the trigger and signal paths.
Definition: anita.hh:32
double rms_rfcm[2]
rms noise just after rfcm&#39;s
Definition: anita.hh:265
double peak_rx_rfcm_signalonly[2]
peak voltage in e/h polarization received by the antenna
Definition: anita.hh:233
static const int NLAYERS_MAX
max number of layers (in smex design, it&#39;s 4)
Definition: anita.hh:59
double FREQ_HIGH
highest frequency
Definition: anita.hh:313
Vector antenna_positions[2][NLAYERS_MAX *NPHI_MAX]
these are the antenna positions in space in a coordinate system where x=north and y=west and the orig...
Definition: anita.hh:67
double ston[5]
signal to noise;
Definition: anita.hh:223
double FREQ_LOW
lowest frequency
Definition: anita.hh:312
int GetRx(int ilayer, int ifold)
get antenna number based on which layer and position it is
Definition: anita.cc:197
double THERMALNOISE_FACTOR
factor to multiply thermal noise for error analysis
Definition: anita.hh:90
int channels_passing[2][5]
channels passing. This is reset for every antenna for every event
Definition: anita.hh:241
double timedomain_output_allantennas[2][48][HALFNFOUR]
this is across all antennas, just the full band
Definition: anita.hh:216
int inu
Neutrino number.
Definition: anita.hh:78
double SIMON_DELTA_PHI[NLAYERS_MAX][NPHI_MAX]
measurements by Simon used in analysis ANITA-2
Definition: anita.hh:65
Double_t deadTime
fractional deadTime
Definition: anita.hh:143
double peak_rx_rfcm[2]
peak voltage in e/h polarization received by the antenna
Definition: anita.hh:231
Handles everything related to balloon positions, payload orientation over the course of a flight...
Definition: balloon.hh:30
int l2trig_anita4lr_forgaryanderic[16][HALFNFOUR]
when it passes 2/3
Definition: anita.hh:202
double vmmhz_banding_rfcm[NFREQ]
V/m/MHz after banding and rfcms.
Definition: anita.hh:259
Double_t fakeThresholds2[2][48]
Fake thresholds 2 (coming from converting flight scalers to thresholds)
Definition: anita.hh:153
This class represents a three-vector. Operators are overloaded to provide for the familiar operations...
Definition: vector.hh:27
Double_t deltaTPhaseCentre[2][NLAYERS_MAX][NPHI_MAX]
Relative to photogrammetry + ring offset.
Definition: anita.hh:88
Float_t threshScanThresh[2][48][npointThresh]
adc thresholds from threshold scan
Definition: anita.hh:161
double ANTENNA_DOWN[NLAYERS_MAX][NPHI_MAX]
down angles of antennas from Kurt&#39;s measurements
Definition: anita.hh:63
static const int NPHI_MAX
max number of antennas around in phi (in smex, 16)
Definition: anita.hh:61
unsigned int realTime_surf_min
min realtime from the surf file
Definition: anita.hh:148
Definition: rx.hpp:23
double signal_vpol_inanita[5][HALFNFOUR]
this is the signal waveform in the vertical polarization, before converting to LCP, RCP where applicable
Definition: anita.hh:127
double LAYER_PHIPOSITION[Anita::NLAYERS_MAX]
phi corresponding to the position of each "layer" on the "payload"
Definition: anita.hh:86
double NOTCH_MIN
low edge of notch filter. This is set in the input file
Definition: anita.hh:315
int maxbin_fortotal[5]
when it sums the noise and signal together it shortens the waveform
Definition: anita.hh:227
double total_vpol_inanita[5][HALFNFOUR]
this is the sum of the signal and noise in the vertical polarization, before converting to LCP...
Definition: anita.hh:129
int NRX_PHI[NLAYERS_MAX]
number of antennas around in each layer. (radians)
Definition: anita.hh:69
Ice thicknesses and water depth.
Definition: icemodel.hh:103
unsigned int realTime_surf
realtime from the surf file
Definition: anita.hh:147
int channels_passing_justNoise[2][5]
channels passing. This is reset for every antenna for every event
Definition: anita.hh:242
double LAYER_HPOSITION[Anita::NLAYERS_MAX]
distance in horizontal plane between center axis of the "payload" and each "layer".
Definition: anita.hh:85