11 #ifdef ANITA_UTIL_EXISTS 38 double GaintoHeight(
double gain,
double freq,
double nmedium_receiver);
40 void setTrigRequirement(
int WHICH);
53 static const int NFREQ=128;
57 static const int NTRIG=5;
58 static const int NANTENNAS_MAX=2000;
60 static const int NTRIGGERLAYERS_MAX=3;
97 void initializeFixedPowerThresholds(ofstream &foutput);
98 void readVariableThresholds(
Settings *settings1);
99 void readAmplification();
100 void getDiodeDataAndAttenuation(
Settings *settings1, TString outputdir);
101 void getPulserData();
104 void MakeArrayforFFT(
double *vsignalarray_e,
double *vsignal_e_forfft,
double phasedelay,
bool useconstantdelay);
106 void GetArrayFromFFT(
double *tmp_fftvhz,
double *vhz_rx);
108 int Match(
int ilayer,
int ifold,
int rx_minarrivaltime);
109 int getLabAttn(
int NPOINTS_LAB,
double *freqlab,
double *labattn);
111 void labAttn(
double *vhz);
113 void calculate_antenna_positions(
Settings *settings1,
double pitch,
double roll,
double phi_spin,
Vector n_north,
Vector n_east);
118 static const int NFOUR=1024;
119 static const int HALFNFOUR=512;
131 double timedomainsignal_rfcm[HALFNFOUR];
132 double timedomainsignal_lab[HALFNFOUR];
134 TTree *turfratechain;
139 UShort_t phiTrigMask;
140 UShort_t phiTrigMaskH;
142 UShort_t l1TrigMaskH;
160 static const int npointThresh = 1640;
163 Float_t minadcthresh[2][48];
164 Float_t maxadcthresh[2][48];
166 void setphiTrigMaskAnita3(UInt_t realTime_flightdata);
167 void setphiTrigMask(UInt_t realTime_flightdata);
168 void setTimeDependentThresholds(UInt_t realTime_flightdata);
179 double time_trig[HALFNFOUR];
180 double weight_inanita;
181 int arrayofhits_inanita[3][16][2][HALFNFOUR];
188 int arrayofhits_forgaryanderic[3][16][2][HALFNFOUR];
191 int l1trig_anita3and4_inanita[2][16][HALFNFOUR];
195 int l1trig_anita4lr_inanita[3][16][HALFNFOUR];
197 int l1trig_anita4lr_forgaryanderic[3][16][HALFNFOUR];
200 int l2trig_anita4lr_inanita[16][3][HALFNFOUR];
204 int l3type0trig_anita4lr_inanita[16][HALFNFOUR];
205 int l3trig_anita4lr_inanita[16][HALFNFOUR];
207 int l3type0trig_anita4lr_forgaryanderic[16][HALFNFOUR];
208 int l3type1trig_anita4lr_forgaryanderic[16][HALFNFOUR];
220 int flag_e_inanita[5][HALFNFOUR];
221 int flag_h_inanita[5][HALFNFOUR];
222 double dangle_inanita,emfrac_inanita,hadfrac_inanita;
244 int l1_passing_allantennas[48];
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);
253 double avgfreq_rfcm[NFREQ];
254 double avgfreq_rfcm_lab[NFREQ];
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];
289 double cumulat_prob[9];
290 double cumulat_prob_plus1[9];
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];
301 double phases[5][HALFNFOUR];
306 double integral_vmmhz_foranita;
323 double freq_forfft[NFOUR];
324 double freq_forplotting[NFOUR/4];
325 double freq_forfft_long[2*NFOUR];
326 double freq_forplotting_long[NFOUR/2];
327 double time[NFOUR/2];
328 double time_long[NFOUR];
330 double time_centered[NFOUR/2];
331 double freqdomain_rfcm_banding[5][HALFNFOUR/2];
332 double freqdomain_rfcm_banding_long[5][HALFNFOUR];
334 double freqdomain_rfcm[HALFNFOUR/2];
335 double freqdomain_rfcm_long[HALFNFOUR];
337 double freqdomain_rfcm_theory[HALFNFOUR/2];
338 double avgfreqdomain_lab[HALFNFOUR/2];
339 double avgfreqdomain_lab_long[HALFNFOUR];
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];
354 void getDiodeModel();
355 void setDiodeRMS(
Settings *settings1, TString outputdir);
359 int idelaybeforepeak[5];
361 double diode_real[5][NFOUR];
362 double fdiode_real[5][NFOUR];
365 void myconvlv(
double *timedomain_forconvl,
const int NFOUR,
double *fdiode,
double &maxdiodeconvl,
double &onediodeconvl,
double *power_noise,
double *diodeconv);
368 void GetArrivalTimesBoresights(
const Vector rf_direction[NLAYERS_MAX][NPHI_MAX]);
370 void GetArrivalTimesBoresights(
const Vector rf_direction[NLAYERS_MAX][NPHI_MAX],
Balloon *bn1,
Settings *settings1);
372 int rx_minarrivaltime;
373 double arrival_times[2][NLAYERS_MAX*
NPHI_MAX];
375 static int SurfChanneltoBand(
int isurf);
376 int AntennaWaveformtoSurf(
int ilayer,
int ifold);
377 static int AntennaNumbertoSurfNumber(
int ilayer,
int ifold);
378 static int GetAntennaNumber(
int ilayer,
int ifold);
379 static int GetLayer(
int rx);
380 static int GetIfold(
int rx);
381 static int GetSurfChannel(
int antenna,
int ibw,
int ipol);
382 static int WhichBand(
int ibw,
int ipol);
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();
391 int count_getnoisewaveforms;
394 static const int NPOINTS_BANDS=601;
396 double freq_bands[5][NPOINTS_BANDS];
397 double attn_bands[5][NPOINTS_BANDS];
398 double bandsattn[5][NPOINTS_BANDS];
400 double correl_banding[5][NPOINTS_BANDS];
401 double correl_lab[NPOINTS_BANDS];
405 static const int NPOINTS_AMPL=58;
406 double freq_ampl[NANTENNAS_MAX][NPOINTS_AMPL];
407 double ampl[NANTENNAS_MAX][NPOINTS_AMPL];
408 double ampl_notdb[NANTENNAS_MAX][NPOINTS_AMPL];
409 double noisetemp[NANTENNAS_MAX][NPOINTS_AMPL];
412 static const int NPOINTS_NOISE=2000;
419 double probability[5];
420 double bwslice_enoise[5];
421 double bwslice_fwhmnoise[5];
422 double bwslice_rmsdiode[2][5];
423 double bwslice_meandiode[5];
424 double bwslice_vrms[5];
425 double bwslice_dioderms_fullband_allchan[2][48][7];
426 double bwslice_diodemean_fullband_allchan[2][48][7];
427 double freq_noise[5][NPOINTS_NOISE];
432 double powerthreshold[5];
433 double powerthreshold_nadir[5];
438 double minsignalstrength;
440 double INTEGRATIONTIME;
441 static const int nsamp=100;
447 double TRIG_TIMESTEP;
448 unsigned N_STEPS_PHI;
449 unsigned N_STEPS_THETA;
451 static const unsigned N_SUMMED_PHI_SECTORS = 4;
452 static const unsigned N_SUMMED_LAYERS = 3;
456 double energythreshold;
457 double MIN_PHI_HYPOTHESIS;
458 double MAX_PHI_HYPOTHESIS;
459 double MIN_THETA_HYPOTHESIS;
460 double MAX_THETA_HYPOTHESIS;
468 static const int NTRIGPHISECTORS=16;
471 static const int NPOINTS_GAIN =131;
472 double gainv_measured[NPOINTS_GAIN];
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];
478 double gain_angle[4][NPOINTS_GAIN][7];
488 double flare[4][NFREQ];
489 double gain[2][NFREQ];
491 int GetBeamWidths(
Settings *settings1);
492 void Set_gain_angle(
Settings *settings1,
double nmedium_receiver);
493 double Get_gain_angle(
int gain_type,
int k,
double hitangle);
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);
498 double reference_angle[7];
500 double inv_angle_bin_size[6];
502 double scalef2[NFREQ], scalef1[NFREQ];
503 double vvGaintoHeight[NFREQ], hhGaintoHeight[NFREQ], hvGaintoHeight[NFREQ], vhGaintoHeight[NFREQ];
505 double diffraction[2][89][NFREQ];
506 void SetDiffraction();
507 double GetDiffraction(
int ilayer,
double zenith_angle,
int ifreq);
511 static const int NPOINTS_LAB=272;
513 double freqlab[NPOINTS_LAB];
515 double labattn[NPOINTS_LAB];
525 int antennatosurf[32];
528 double bwslice_thresholds[5];
529 int bwslice_allowed[5];
530 int bwslice_required[5];
536 double bwslice_center[5];
537 double bwslice_width[5];
540 double bwslice_min[5];
542 double bwslice_max[5];
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];
549 vector< vector< vector <double> > > hypothesis_angles;
551 vector< vector <int> > vdifferent_offsets;
552 vector< vector <double> > vdifferent_angles;
554 void calculate_all_offsets(
void);
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;
568 double cwst_actual_deg_theta;
569 double cwst_actual_deg_phi;
571 Vector cwst_0th_sector_position;
572 double cwst_timesteps[HALFNFOUR];
574 RX cwst_aligned_wfms[9];
578 vector <double> cwst_summed_wfm;
579 vector <double> cwst_power_of_summed_wfm;
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);
584 double INCLINE_TOPTHREE;
585 double INCLINE_NADIR;
590 double extraCableDelays[2][48];
591 #ifdef ANITA_UTIL_EXISTS 592 RFSignal *fSignalChainResponseDigitizerTuffs[2][3][16][7];
593 RFSignal *fSignalChainResponseTriggerTuffs[2][3][16][7];
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];
605 TGraph *gPulseAtAmpa;
606 RFSignal *fSignalChainResponseDigitizer[2][3][16];
607 RFSignal *fSignalChainResponseTrigger[2][3][16];
609 void calculateDelaysForEfficiencyScan();
611 void GetPhasesFromFFT(
double *tmp_fftvhz,
double *phases);
612 void FromTimeDomainToIcemcArray(
double *vsignalarray,
double vhz[NFREQ]);
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];
624 Int_t trigEffScanPhi;
625 Double_t trigEffScanAtt[5];
626 Double_t trigEffScanPhiDelay[5];
627 Double_t trigEffScanRingDelay[3];
628 Int_t trigEffScanApplyRingDelay[5];
629 Int_t trigEffScanRingsUsed[3];
630 Double_t trigEffScanPulseAtAmpa[HALFNFOUR];
631 Double_t trigEffScanPulseAtAmpaUpsampled[NFOUR];
632 Double_t trigEffScanAmplitudeAtAmpa[NFREQ];
633 Double_t trigEffScanPulseAtSurf[250][HALFNFOUR];
642 #endif //ICEMC_ANITA_HH double total_diodeinput_1_allantennas[48][HALFNFOUR]
this is across all antennas, just the full band
int noiseeventcounter
counts which event we're on so we go in order
unsigned int realTime_tr_min
min realtime from the turf rate file
double total_diodeinput_2_allantennas[48][HALFNFOUR]
needs comment
TH1F * hsignals[5]
s/n (max diode output/mean diode output) for vertical polarization in each band
static const int NBANDS_MAX
max number of bands
double peak_v_banding_rfcm[2][5]
peak V in e/h polarization after rfcm's and banding
int nnoiseevents
total number of noise events we're choosing from
double timedomain_output_corrected_forplotting[2][6][HALFNFOUR]
this is just for writing out to the following tree
double rms_rfcm_e_single_event
This is in Volts, not mV!
static const int NPOL
number of polarizations
Float_t threshScanScaler[2][48][npointThresh]
scalers from threshold scan
Double_t fakeThresholds[2][48]
Fake thresholds (coming from converting fake scalers to thresholds)
double LAYER_VPOSITION[Anita::NLAYERS_MAX]
position of layers in z relative to vertical center of the payload
unsigned int realTime_turfrate
realtime from the turf rate file
int GetRxTriggerNumbering(int ilayer, int ifold)
get antenna number based on which layer and position it is
double THETA_ZENITH[NLAYERS_MAX]
how the antenna is tilted in theta (in radians with 0=up)
double peak_rx_signalonly[2]
peak voltage in e/h polarization received by the antenna
double vmmhz_banding[NFREQ]
V/m/MHz after banding.
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 ...
TTree * tdata
writing data out for the analysers
This is a wrapper class for an RF Signal.
void Initialize(Settings *settings1, ofstream &foutput, int inu, TString outputdir)
initialize a bunch of stuff
double SIMON_DELTA_R[NLAYERS_MAX][NPHI_MAX]
measurements by Simon used in analysis ANITA-2
UShort_t scalers[2][48]
scalers as read from the surf file: first index is pol, second is antenna number (only working for An...
int number_all_antennas
this keeps count of the number of antennas for use with timing calculations, etc. ...
int PERCENTBW
percent bandwidth
Reads in and stores input settings for the run.
double peak_rx_rfcm_lab[2]
peaks of the previous arrays
double PHI_EACHLAYER[NLAYERS_MAX][NPHI_MAX]
phi of the center of each antenna on each layer
double PHI_OFFSET[NLAYERS_MAX]
antenna offset in phi for each layer (radians)
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...
This class is a 3-vector that represents a position on the Earth's surface.
int NBANDS
number of frequency sub-bands (not counting full band)
int iminbin[5]
this is the minimum bin to start
UShort_t thresholds[2][48]
thresholds as read from the surf file: first index is pol, second is antenna number (only working for...
unsigned int realTime_tr_max
max realtime from the turf rate file
unsigned int realTime_surf_max
max realtime from the surf file
double timedomain_output_inanita[2][5][HALFNFOUR]
this is just for writing out to the following tree
TTree * tgaryanderic
writing data out for the analysers
double rms_lab[2]
rms noise at lab chip
Vector ANTENNA_POSITION_START[2][NLAYERS_MAX][NPHI_MAX]
antenna positions from Kurt's measurements
Double_t fakeScalers[2][48]
Fake scalers (coming from converting threhsolds during flight to scalers using threshold scan) ...
double RRX[Anita::NLAYERS_MAX]
radius that the antenna sits from the axis of the payload (feedpoint)
Contains everything about positions within payload and signals it sees for each event, in both the trigger and signal paths.
double rms_rfcm[2]
rms noise just after rfcm's
double peak_rx_rfcm_signalonly[2]
peak voltage in e/h polarization received by the antenna
static const int NLAYERS_MAX
max number of layers (in smex design, it's 4)
double FREQ_HIGH
highest frequency
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...
double ston[5]
signal to noise;
double FREQ_LOW
lowest frequency
int GetRx(int ilayer, int ifold)
get antenna number based on which layer and position it is
double THERMALNOISE_FACTOR
factor to multiply thermal noise for error analysis
int channels_passing[2][5]
channels passing. This is reset for every antenna for every event
double timedomain_output_allantennas[2][48][HALFNFOUR]
this is across all antennas, just the full band
double SIMON_DELTA_PHI[NLAYERS_MAX][NPHI_MAX]
measurements by Simon used in analysis ANITA-2
Double_t deadTime
fractional deadTime
double peak_rx_rfcm[2]
peak voltage in e/h polarization received by the antenna
Handles everything related to balloon positions, payload orientation over the course of a flight...
int l2trig_anita4lr_forgaryanderic[16][HALFNFOUR]
when it passes 2/3
double vmmhz_banding_rfcm[NFREQ]
V/m/MHz after banding and rfcms.
Double_t fakeThresholds2[2][48]
Fake thresholds 2 (coming from converting flight scalers to thresholds)
This class represents a three-vector. Operators are overloaded to provide for the familiar operations...
Double_t deltaTPhaseCentre[2][NLAYERS_MAX][NPHI_MAX]
Relative to photogrammetry + ring offset.
Float_t threshScanThresh[2][48][npointThresh]
adc thresholds from threshold scan
double ANTENNA_DOWN[NLAYERS_MAX][NPHI_MAX]
down angles of antennas from Kurt's measurements
static const int NPHI_MAX
max number of antennas around in phi (in smex, 16)
unsigned int realTime_surf_min
min realtime from the surf file
double signal_vpol_inanita[5][HALFNFOUR]
this is the signal waveform in the vertical polarization, before converting to LCP, RCP where applicable
double LAYER_PHIPOSITION[Anita::NLAYERS_MAX]
phi corresponding to the position of each "layer" on the "payload"
double NOTCH_MIN
low edge of notch filter. This is set in the input file
int maxbin_fortotal[5]
when it sums the noise and signal together it shortens the waveform
double total_vpol_inanita[5][HALFNFOUR]
this is the sum of the signal and noise in the vertical polarization, before converting to LCP...
int NRX_PHI[NLAYERS_MAX]
number of antennas around in each layer. (radians)
Ice thicknesses and water depth.
unsigned int realTime_surf
realtime from the surf file
int channels_passing_justNoise[2][5]
channels passing. This is reset for every antenna for every event
double LAYER_HPOSITION[Anita::NLAYERS_MAX]
distance in horizontal plane between center axis of the "payload" and each "layer".