Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ChanTrigger Class Reference

Class that handles the channel trigger. More...

#include <ChanTrigger.h>

Public Member Functions

 ChanTrigger ()
 Channel trigger constructur.
 
void InitializeEachBand (Anita *anita1)
 Initialize trigger bands. More...
 
void ApplyAntennaGain (Settings *settings1, Anita *anita1, Balloon *bn1, Screen *panel1, int ant, Vector &n_eplane, Vector &n_hplane, Vector &n_normal)
 Apply the antenna gain. More...
 
void TriggerPath (Settings *settings1, Anita *anita1, int ant, Balloon *bn1)
 Apply trigger path. More...
 
void DigitizerPath (Settings *settings1, Anita *anita1, int ant, Balloon *bn1)
 Apply digitizer path. More...
 
void TimeShiftAndSignalFluct (Settings *settings1, Anita *anita1, int ilayer, int ifold, double volts_rx_rfcm_lab_e_all[48][512], double volts_rx_rfcm_lab_h_all[48][512])
 Time shift and fluctuate signal. More...
 
void L1Trigger (Anita *anita1, double timedomain_output_1[5][Anita::NFOUR], double timedomain_output_2[5][Anita::NFOUR], double powerthreshold[2][5], int *channels_passing_e_forglob, int *channels_passing_h_forglob, int &npass)
 The L1 trigger of the Anita trigger scheme. More...
 
double getRate ()
 Returns the thisrate variable value (in MHz) More...
 
double rateToThreshold (double rate, int band)
 Calculates the trigger threshold for an antenna via a fit from the "singles" rate and band identifier. More...
 
void WhichBandsPass (Settings *settings1, Anita *anita1, GlobalTrigger *globaltrig1, Balloon *bn1, int ilayer, int ifold, double dangle, double emfrac, double hadfrac, double thresholds[2][5])
 Which bands passes the trigger. More...
 
void WhichBandsPassTrigger1 (Settings *settings1, Anita *anita1, GlobalTrigger *globaltrig1, Balloon *bn1, int ilayer, int ifold, double thresholds[2][5])
 Which bands passes the trigger (for trigger scheme 0 and 1) More...
 
void WhichBandsPassTrigger2 (Settings *settings1, Anita *anita1, GlobalTrigger *globaltrig1, Balloon *bn1, int ilayer, int ifold, double dangle, double emfrac, double hadfrac, double thresholds[2][5])
 Which bands passes the trigger (for trigger scheme larger than 2) More...
 
void GetThresholds (Settings *settings1, Anita *anita1, int ilayer, double thresholds[2][5])
 Sets the threshold values based on which payload and where the antenna is located physically. More...
 
void DiodeConvolution (Settings *settings1, Anita *anita1, GlobalTrigger *globaltrig1, int ilayer, int ifold, double mindiodeconvl[5], double onediodeconvl[5], double psignal[5][Anita::NFOUR], double timedomain_output[5][Anita::NFOUR], double timedomain_output_justNoise[5][Anita::NFOUR], int ibinshift, int ipol, double thresholds[2][5])
 Apply the diode convolution. More...
 
void addToChannelSums (Settings *settings1, Anita *anita1, int ibw, int k)
 Increment the volts in each band. More...
 
void applyImpulseResponseDigitizer (Settings *settings1, Anita *anita1, int nPoints, int ant, double *x, double y[512], bool pol)
 Apply impulse response to digitizer path. More...
 
void applyImpulseResponseTrigger (Settings *settings1, Anita *anita1, int ant, double y[512], double *vhz, bool pol)
 Apply impulse response to trigger path. More...
 
void getNoiseFromFlight (Settings *settings1, Anita *anita1, int ant, bool also_digi=true)
 Add noise from ANITA-3 flight to the time domain waveforms. More...
 
void injectImpulseAfterAntenna (Anita *anita1, int ant)
 Inject pulse after the antenna (used for trigger efficiency scans) More...
 
TGraph * getPulserAtAMPA (Anita *anita1, int ant)
 Get time domain graph of pulse at AMPA (used for trigger efficiency scans) More...
 
void saveTriggerWaveforms (Anita *anita1, double sig0[48], double sig1[48], double noise0[48], double noise1[48])
 Save signal and noise waveforms at trigger. More...
 
void saveDigitizerWaveforms (Anita *anita1, double sig0[48], double sig1[48], double noise0[48], double noise1[48])
 Save signal and noise waveforms at digitizer. More...
 
void injectImpulseAtSurf (Anita *anita1, double volts_triggerPath_e[Anita::HALFNFOUR], double volts_triggerPath_h[Anita::HALFNFOUR], int ant)
 Inject pulse at the surf (used for trigger efficiency scans) More...
 
void calculateCW (Anita *anita1, double frequency, double phase, double amplitude)
 Add CW. More...
 
double applyButterworthFilter (double ff, double ampl, int notchStatus[3])
 Apply Butterworth Filter. More...
 

Static Public Member Functions

static void ConvertEHtoLREfield (double, double, double &, double &)
 Convert E and H to left and right e field. More...
 
static void ConvertEHtoLREnergy (double, double, double &, double &)
 Convert E and H to left and right energy. More...
 
static double GetNoise (Settings *settings1, double altitude_bn, double geoid, double theta, double bw, double temp)
 Get Noise. More...
 
static double FindPeak (double *waveform, int n)
 Find peak voltage of a waveform. More...
 
static int IsItUnmasked (unsigned short surfTrigBandMask[9][2], int ibw, int ilayer, int ifold, int ipol)
 Returns whether the indicated antenna and band are "masked". More...
 

Public Attributes

double vhz_rx [2][5][Anita::NFREQ]
 Array of amplitudes in the Fourier domain (V/Hz) after the antenna gain. Indeces stand for [ipol][iband][ifreq].
 
double volts_rx_forfft [2][5][Anita::HALFNFOUR]
 Array of time domain after the antenna gain. Indeces stand for [ipol][iband][itime].
 
vector< int > flag_e [5]
 Which bands pass trigger e.
 
vector< int > flag_h [5]
 Which bands pass trigger h.
 
double bwslice_volts_pol0 [5]
 Sum voltage for each slice in bandwidth for the lcp polarization.
 
double bwslice_volts_pol1 [5]
 Sum voltage for each slice in bandwidth for the rcp polarization.
 
double bwslice_energy_pol0 [5]
 Square the sum of voltage for each slice in bandwidth for the 0th polarization.
 
double bwslice_energy_pol1 [5]
 Square the sum of voltage for each slice in bandwidth for the 1st polarization.
 
double bwslice_volts_pol0_em [5]
 Component of the voltage that comes from the em shower for 0th polarization.
 
double bwslice_volts_pol1_em [5]
 Component of the voltage that comes from the em shower for 1st polarization.
 
double bwslice_volts_pole [5]
 Sum voltage for each slice in bandwidth for the e polarization.
 
double bwslice_energy_pole [5]
 Square the sum of voltage for each slice in bandwidth for e polarization. The 5th element is the full band.
 
double bwslice_volts_polh [5]
 Sum voltage for each slice in bandwidth for the h polarization.
 
double bwslice_energy_polh [5]
 Square the sum of voltage for each slice in bandwidth for h polarization. The 5th element is the full band.
 
double volts_rx_rfcm_lab [2][Anita::HALFNFOUR]
 For digitizer path, time domain voltage vs. time after rx, rfcm's and lab.
 
double volts_rx_rfcm_lab_all [2][48][Anita::HALFNFOUR]
 For digitizer path, time domain voltage vs. time after rx, rfcm's and lab.
 
double volts_rx_rfcm [2][Anita::HALFNFOUR]
 For digitizer path, time domain voltage vs. time after rx, rfcm's.
 
double justNoise_digPath [2][Anita::HALFNFOUR]
 For digitizer path, time domain noise from flight.
 
double justNoise_trigPath [2][Anita::HALFNFOUR]
 For trigger path, time domain noise from flight.
 
double cw_digPath [2][Anita::HALFNFOUR]
 For digitizer path, time domain cw.
 
double justSig_trigPath [2][Anita::HALFNFOUR]
 Just signal in trigger path.
 
double justSig_digPath [2][Anita::HALFNFOUR]
 Just signal in trigger path.
 
double signal_eachband [2][Anita::NBANDS_MAX]
 Signal in each band.
 
double threshold_eachband [2][Anita::NBANDS_MAX]
 Threshold in each band.
 
double noise_eachband [2][Anita::NBANDS_MAX]
 Noise in each band.
 
int passes_eachband [2][Anita::NBANDS_MAX]
 Whether the signal passes or not each band.
 
vector< double > vsignal_eachband [2]
 Signal in each band.
 
vector< double > vthreshold_eachband [2]
 Threshold in each band.
 
vector< double > vnoise_eachband [2]
 Noise in each band.
 
vector< int > vpasses_eachband [2]
 Whether the signal passes or not each band.
 
double v_banding_rfcm [2][5][Anita::NFREQ]
 This is Volts/m as a function of frequency after rfcm's and banding.
 
double v_banding_rfcm_forfft [2][5][HALFNFOUR]
 Starts out as V/s vs. freq after banding, rfcm, after fft it is V vs. t.
 
double vm_banding_rfcm_forfft [2][5][HALFNFOUR]
 Tunnel diode input (signal + noise)
 
double vm_banding_rfcm_forfft_justNoise [2][5][HALFNFOUR]
 Tunnel diode input (just noise)
 
double v_banding_rfcm_forfft_temp [2][5][HALFNFOUR]
 Use for the averaging over 10 neighboring bins.
 
double integral_vmmhz
 Electric field integral.
 
int unwarned
 Whether we have warned the user about resetting thresholds when they are beyond the measured bounds.
 

Detailed Description

Class that handles the channel trigger.

Definition at line 18 of file ChanTrigger.h.

Collaboration diagram for ChanTrigger:
Collaboration graph
[legend]

Member Function Documentation

void ChanTrigger::addToChannelSums ( Settings settings1,
Anita anita1,
int  ibw,
int  k 
)

Increment the volts in each band.

This increments the bwslice_volts_...'s at each frequency

Parameters
settings1:: Settings - simulation settings
anita1:: Anita - anita payload object
ibw:: int - which band
k:: int - frequency bin

Definition at line 1200 of file ChanTrigger.cc.

void ChanTrigger::ApplyAntennaGain ( Settings settings1,
Anita anita1,
Balloon bn1,
Screen panel1,
int  ant,
Vector n_eplane,
Vector n_hplane,
Vector n_normal 
)

Apply the antenna gain.

Loop through all points in the screen, and apply the antenna gain to each point All the waveforms are then summed with screen point weights and delay volts_rx_forfft = time domain waveforms after antenna gain vhz_rx = amplitude in Fourier domain after antenna gain

Parameters
settings1:: Settings - the simulation settings
anita1:: Anita - anita object
bn1:: Balloon - balloon object
panel1:: Screen - screen object
ant:: int- antenna number
n_eplane:: Vector
n_hplane:: Vector
n_normal:: Vector

Definition at line 743 of file ChanTrigger.cc.

double ChanTrigger::applyButterworthFilter ( double  ff,
double  ampl,
int  notchStatus[3] 
)

Apply Butterworth Filter.

This is an approximation of the notch filters flown during ANITA4

Parameters
ff:: frequenzy in Hz
ampl:: amplitude
filters:: array of three integers indicating notch status (on/off)
Returns
frequency domain amplitude scaled by the filter

Definition at line 1545 of file ChanTrigger.cc.

void ChanTrigger::applyImpulseResponseDigitizer ( Settings settings1,
Anita anita1,
int  nPoints,
int  ant,
double *  x,
double  y[512],
bool  pol 
)

Apply impulse response to digitizer path.

This can only work when FFTtools is also linked

Parameters
settings1:: Settings - simulation settings
anita1:: Anita - anita payload object
nPoints:: int - number of points in time domain
ant:: int - antenna number
x:: double* - time values
y:: double[512] - output voltages
pol:: bool - which polarization
void ChanTrigger::applyImpulseResponseTrigger ( Settings settings1,
Anita anita1,
int  ant,
double  y[512],
double *  vhz,
bool  pol 
)

Apply impulse response to trigger path.

This can only work when FFTtools is also linked

Parameters
settings1:: Settings - simulation settings
anita1:: Anita - anita payload object
ant:: int - antenna number
y:: double[512] - output voltages
vhz:: double* - amplitude in Fourier domain
pol:: bool - which polarization
void ChanTrigger::calculateCW ( Anita anita1,
double  frequency,
double  phase,
double  amplitude 
)

Add CW.

Add CW in time domain

Parameters
anita1:: Anita - anita payload object
frequencyat which to simulate cw
phase
amplitude
void ChanTrigger::ConvertEHtoLREfield ( double  e_component,
double  h_component,
double &  lcp_component,
double &  rcp_component 
)
static

Convert E and H to left and right e field.

Convert E and H to left and right e field

Parameters
e_component:: double -
h_component:: double -
lcp_component:: double - referenced lcp component
rcp_component:: double - referenced rcp component

Definition at line 39 of file ChanTrigger.cc.

void ChanTrigger::ConvertEHtoLREnergy ( double  e_component,
double  h_component,
double &  lcp_component,
double &  rcp_component 
)
static

Convert E and H to left and right energy.

Convert E and H to left and right energy

Parameters
e_component:: double -
h_component:: double -
lcp_component:: double - referenced lcp component
rcp_component:: double - referenced rcp component

Definition at line 45 of file ChanTrigger.cc.

void ChanTrigger::DigitizerPath ( Settings settings1,
Anita anita1,
int  ant,
Balloon bn1 
)

Apply digitizer path.

Apply digitizer path to each channel volts_rx_rfcm_lab = time domain waveforms after digitizer path vhz_rx_rfcm_lab_e = amplitude in Fourier domain after digitizer path

Parameters
settings1:: Settings - the simulation settings
anita1:: Anita - anita object
ant:: int - antenna number

Definition at line 1005 of file ChanTrigger.cc.

void ChanTrigger::DiodeConvolution ( Settings settings1,
Anita anita1,
GlobalTrigger globaltrig1,
int  ilayer,
int  ifold,
double  mindiodeconvl[5],
double  onediodeconvl[5],
double  psignal[5][Anita::NFOUR],
double  timedomain_output[5][Anita::NFOUR],
double  timedomain_output_justNoise[5][Anita::NFOUR],
int  ibinshift,
int  ipol,
double  thresholds[2][5] 
)

Apply the diode convolution.

Parameters
settings1:: Settings - simulation settings
anita1:: Anita - anita object
globaltrig1:: GlobalTrigger - global trigger object
ilayer:: int - layer number
ifold:: int - phi sector
mindiodeconvl:: double[5]
onediodeconvl:: double[5]
psignal:: double[5][NFOUR]
timedomain_output:: double[5][NFOUR]
ibinshift:: int
ipol:: int - which polarization
thresholds:: double[2][5] - relative power thresholds for each pol and band

Definition at line 546 of file ChanTrigger.cc.

double ChanTrigger::FindPeak ( double *  waveform,
int  n 
)
static

Find peak voltage of a waveform.

Parameters
waveform:: double* - waveform
n:: int - number of points in waveform

Definition at line 1185 of file ChanTrigger.cc.

double ChanTrigger::GetNoise ( Settings settings1,
double  altitude_bn,
double  geoid,
double  theta,
double  bw,
double  temp 
)
static

Get Noise.

Parameters
settings1:: Settings - the simulation settings
altitude_bn:: double - altitude of the balloon
geoid:: double -
bw:: double -
theta:: double -
temp:: double -

Definition at line 1474 of file ChanTrigger.cc.

void ChanTrigger::getNoiseFromFlight ( Settings settings1,
Anita anita1,
int  ant,
bool  also_digi = true 
)

Add noise from ANITA-3 flight to the time domain waveforms.

Rayleigh distribution parameters of ANITA-3 thermal noise are read in anita.cc This function generates random noise using amplitude of Rayleigh distributions. This can only work when FFTtools is also linked

Parameters
anita1:: Anita - anita payload object
pol:: int - which polarization
ant:: int - which antennta
also_digi:: bool - also fill in digitizer
TGraph* ChanTrigger::getPulserAtAMPA ( Anita anita1,
int  ant 
)

Get time domain graph of pulse at AMPA (used for trigger efficiency scans)

Pulser waveform is read in anita.cc

Parameters
anita1:: Anita - anita payload object
ant:: int - which antennta
double ChanTrigger::getRate ( )

Returns the thisrate variable value (in MHz)

Todo:
Refactor the class so that this function is either deprecated or "thisrate" is implemented differently.

Definition at line 1296 of file ChanTrigger.cc.

void ChanTrigger::GetThresholds ( Settings settings1,
Anita anita1,
int  ilayer,
double  thresholds[2][5] 
)

Sets the threshold values based on which payload and where the antenna is located physically.

The nadir antennas had a separate threshold from the other antennas due to the way that they were "OR"'d between their two neighbors.

Todo:
Deprecate in favor of the more robust boost::multi_array or the more specialized PayloadArray class. Both have multi-index access to the same items.

Definition at line 1529 of file ChanTrigger.cc.

void ChanTrigger::InitializeEachBand ( Anita anita1)

Initialize trigger bands.

Initialize trigger bands

Parameters
anita1:: Anita - anita object

Definition at line 711 of file ChanTrigger.cc.

void ChanTrigger::injectImpulseAfterAntenna ( Anita anita1,
int  ant 
)

Inject pulse after the antenna (used for trigger efficiency scans)

Pulser waveform is read in anita.cc THIS FUNCTION IS ONLY USED WITH THE OLD TRIGGER IMPULSE RESPONSE

Parameters
anita1:: Anita - anita payload object
ant:: int - which antennta
void ChanTrigger::injectImpulseAtSurf ( Anita anita1,
double  volts_triggerPath_e[Anita::HALFNFOUR],
double  volts_triggerPath_h[Anita::HALFNFOUR],
int  ant 
)

Inject pulse at the surf (used for trigger efficiency scans)

Pulser waveforms are read in anita.cc volts_triggerPath_e/h is substituded with pulser waveform + noise This can only work when FFTtools is also linked

Parameters
anita1:: Anita - anita payload object
ant:: int - which antennta
volts_triggerPath_e:: double[NFOUR] - time domain waveform at surf
volts_triggerPath_h:: double[NFOUR] - time domain waveform at surf
int ChanTrigger::IsItUnmasked ( unsigned short  surfTrigBandMask[9][2],
int  ibw,
int  ilayer,
int  ifold,
int  ipol 
)
static

Returns whether the indicated antenna and band are "masked".

Only works for Anita-1 and 2

Parameters
surfTrigBandMask:: unsigned short [9][2] - surf masks
ibw:: int - which band
ilayer:: int - layer number
ifold:: int - phi sector
ipol:: int - pol number
Returns
whether the channel and band are masked or not

Definition at line 1339 of file ChanTrigger.cc.

void ChanTrigger::L1Trigger ( Anita anita1,
double  timedomain_output_1[5][Anita::NFOUR],
double  timedomain_output_2[5][Anita::NFOUR],
double  powerthreshold[2][5],
int *  channels_passing_e_forglob,
int *  channels_passing_h_forglob,
int &  npass 
)

The L1 trigger of the Anita trigger scheme.

Parameters
anita1:: Anita - anita payload object
timedomain_output_1:: double [4][NFOUR] - time domain output for each band e
timedomain_output_2:: double [4][NFOUR] - time domain output for each band h
powerthreshold:: double[2][5] - relative power thresholds for each pol and each band
channels_passing_e_forglob:: double* - array of channels passing the L1 trigger for e (used in the GlobalTrigger class)
channels_passing_h_forglob:: double* - array of channels passing the L1 trigger for h (used in the GlobalTrigger class)
npass:: &int - number of bands passing the L1 trigger

Definition at line 1377 of file ChanTrigger.cc.

double ChanTrigger::rateToThreshold ( double  rate,
int  band 
)

Calculates the trigger threshold for an antenna via a fit from the "singles" rate and band identifier.

This code is stolen from Stephen's AnitaHardwareTrigger in his Aesop software

Parameters
rateis the desired singles rate, in MHz.
bandranges from 0 to 3
Returns
trigger threshold, in units of Diode Output / Average Diode Output The output is good for all antennas, and the curves are good fits in the region ~1 MHz to 25 MHz. The curves look like they should continue beyond that range as well.
Todo:
The hard-coded values should be explained and the band dependence should be more explicit, because the actual bands can be modified elsewhere in the code and this function won't be changed unless the user specifically knows to.

Definition at line 1303 of file ChanTrigger.cc.

void ChanTrigger::saveDigitizerWaveforms ( Anita anita1,
double  sig0[48],
double  sig1[48],
double  noise0[48],
double  noise1[48] 
)

Save signal and noise waveforms at digitizer.

Parameters
anita1:: Anita - anita payload object
sig:: double[2][NFOUR/2] - output
noise:: double[2][NFOUR/2] - output

Definition at line 1953 of file ChanTrigger.cc.

void ChanTrigger::saveTriggerWaveforms ( Anita anita1,
double  sig0[48],
double  sig1[48],
double  noise0[48],
double  noise1[48] 
)

Save signal and noise waveforms at trigger.

Parameters
anita1:: Anita - anita payload object
sig:: double[2][NFOUR/2] - output
noise:: double[2][NFOUR/2] - output

Definition at line 1943 of file ChanTrigger.cc.

void ChanTrigger::TimeShiftAndSignalFluct ( Settings settings1,
Anita anita1,
int  ilayer,
int  ifold,
double  volts_rx_rfcm_lab_e_all[48][512],
double  volts_rx_rfcm_lab_h_all[48][512] 
)

Time shift and fluctuate signal.

Apply time delays to each channel and add thermal noise

Parameters
settings1:: Settings - the simulation settings
anita1:: Anita - anita object
ilayer:: int - payload layer
ifold:: int - payload phi sector
volts_rx_rfcm_lab_e_all:: double [48][512] - time domain waveform for each channel (VPOL)
volts_rx_rfcm_lab_h_all:: double [48][512] - time domain waveform for each channel (HPOL)

Definition at line 1146 of file ChanTrigger.cc.

void ChanTrigger::TriggerPath ( Settings settings1,
Anita anita1,
int  ant,
Balloon bn1 
)

Apply trigger path.

Apply trigger path to each channel v_banding_rfcm_forfft = time domain waveforms after trigger path v_banding_rfcm = amplitude in Fourier domain after trigger path

Parameters
settings1:: Settings - the simulation settings
anita1:: Anita - anita object
ant:: int - antenna number

Definition at line 871 of file ChanTrigger.cc.

void ChanTrigger::WhichBandsPass ( Settings settings1,
Anita anita1,
GlobalTrigger globaltrig1,
Balloon bn1,
int  ilayer,
int  ifold,
double  dangle,
double  emfrac,
double  hadfrac,
double  thresholds[2][5] 
)

Which bands passes the trigger.

Parameters
settings1:: Settings - simulation settings
anita1:: Anita - anita object
globaltrig1:: GlobalTrigger - global trigger object
bn1:: Balloon - balloon object
ilayer:: int - layer number
ifold:: int - phi sector
dangle:: int -
emfrac:: double - electromagnetic fraction of the shower
hadfrac:: double - hadronic fraction of the shower
thresholds:: double [2][5] - relative power thresholds for each pol and band

Definition at line 54 of file ChanTrigger.cc.

void ChanTrigger::WhichBandsPassTrigger1 ( Settings settings1,
Anita anita1,
GlobalTrigger globaltrig1,
Balloon bn1,
int  ilayer,
int  ifold,
double  thresholds[2][5] 
)

Which bands passes the trigger (for trigger scheme 0 and 1)

Parameters
settings1:: Settings - simulation settings
anita1:: Anita - anita object
globaltrig1:: GlobalTrigger - global trigger object
bn1:: Balloon - balloon object
ilayer:: int - layer number
ifold:: int - phi sector
thresholds:: double [2][5] - relative power thresholds for each pol and band

Definition at line 103 of file ChanTrigger.cc.

void ChanTrigger::WhichBandsPassTrigger2 ( Settings settings1,
Anita anita1,
GlobalTrigger globaltrig1,
Balloon bn1,
int  ilayer,
int  ifold,
double  dangle,
double  emfrac,
double  hadfrac,
double  thresholds[2][5] 
)

Which bands passes the trigger (for trigger scheme larger than 2)

Parameters
settings1:: Settings - simulation settings
anita1:: Anita - anita object
globaltrig1:: GlobalTrigger - global trigger object
bn1:: Balloon - balloon object
ilayer:: int - layer number
ifold:: int - phi sector
dangle:: int -
emfrac:: double - electromagnetic fraction of the shower
hadfrac:: double - hadronic fraction of the shower
thresholds:: double [2][5] - relative power thresholds for each pol and band

Definition at line 285 of file ChanTrigger.cc.


The documentation for this class was generated from the following files: