CrossCorrelator.h
1 /* -*- C++ -*-.*********************************************************************************************
2  Author: Ben Strutt
3  Email: b.strutt.12@ucl.ac.uk
4 
5  Description:
6  A Cross Correlator to interact with the ROOTified ANITA-3 data and do some interferometry.
7 ***********************************************************************************************************/
8 
9 #ifndef CROSSCORRELATOR_H
10 #define CROSSCORRELATOR_H
11 
12 // Ryan things
13 #include "UsefulAnitaEvent.h"
14 #include "AnitaEventCalibrator.h"
15 #include "AnitaGeomTool.h"
16 #include "UsefulAdu5Pat.h"
17 
18 // #include "FFTtools.h"
19 #include "FancyFFTs.h"
20 
21 // My things
22 #include "RootTools.h"
23 
24 // ROOT things
25 #include "TGraph.h"
26 #include "TH2D.h"
27 #include "TThread.h"
28 
29 // standard c++ things
30 #include <iostream>
31 
32 // Number of phi-sectors to cross correlate between
33 #define DELTA_PHI_SECT 2
34 
35 // Offline reconstruction definitions
36 #define NUM_COMBOS 336
37 #define NUM_THREADS 4
38 
39 // Typical number of samples in waveform
40 #define NUM_SAMPLES 256
41 #define UPSAMPLE_FACTOR 40
42 #define NOMINAL_SAMPLING_DELTAT (1./2.6f)
43 #define PAD_FACTOR 2
44 #define GETNUMFREQS(n)((n)/2+1)
45 
46 // Image definitions
47 #define NUM_BINS_THETA 100
48 #define NUM_BINS_PHI 15
49 #define THETA_RANGE 150
50 #define PHI_RANGE 22.5
51 
52 #define NUM_BINS_THETA_ZOOM 100
53 #define NUM_BINS_PHI_ZOOM 100
54 // #define NUM_BINS_THETA_ZOOM 200
55 // #define NUM_BINS_PHI_ZOOM 200
56 // #define NUM_BINS_THETA_ZOOM 60
57 // #define NUM_BINS_PHI_ZOOM 60
58 #define ZOOM_BIN_SIZE_PHI 0.2
59 #define ZOOM_BIN_SIZE_THETA 0.2
60 // #define ZOOM_BIN_SIZE_PHI 0.05
61 // #define ZOOM_BIN_SIZE_THETA 0.05
62 #define THETA_RANGE_ZOOM (NUM_BINS_THETA_ZOOM*ZOOM_BIN_SIZE_THETA)
63 #define PHI_RANGE_ZOOM (NUM_BINS_PHI_ZOOM*ZOOM_BIN_SIZE_PHI)
64 
65 // #define NUM_BINS_PHI_ZOOM_TOTAL 7200
66 // #define NUM_BINS_THETA_ZOOM_TOTAL 3000
67 #define NUM_BINS_PHI_ZOOM_TOTAL 7269
68 #define NUM_BINS_THETA_ZOOM_TOTAL 3069
69 // #define NUM_BINS_PHI_ZOOM_TOTAL 7229
70 // #define NUM_BINS_THETA_ZOOM_TOTAL 3029
71 
72 // Anita Geometry definitions, shouldn't really be here
73 #define NUM_POL AnitaPol::kNotAPol
74 #define NUM_RING AnitaRing::kNotARing
75 #define DEGREES_IN_CIRCLE 360
76 
77 #define MAX_NUM_PEAKS 2
78 #define PEAK_PHI_DEG_RANGE 10
79 #define PEAK_THETA_DEG_RANGE 10
80 
81 #define SPEED_OF_LIGHT 2.99792458e8
82 #define SPEED_OF_LIGHT_NS 0.299792458
83 
84 #define ALL_PHI_TRIGS 0xffff
85 
86 
87 
95 
96 public:
97 
101  enum mapMode_t{
102  kGlobal,
103  kTriggered,
104  kNumMapModes
105  };
106 
111  kZoomedOut,
112  kZoomedIn,
113  kNumZoomModes
114  };
115 
123  struct threadArgs{
124  Long_t threadInd;
126  };
127 
128  CrossCorrelator();
130 
131  void initializeVariables();
132  void printInfo();
133 
134  void getNormalizedInterpolatedTGraphs(UsefulAnitaEvent* realEvent, AnitaPol::AnitaPol_t pol);
135  void simple260MHzSatelliteNotch(AnitaPol::AnitaPol_t pol, Int_t ant);
136  void simple370MHzSatelliteNotch(AnitaPol::AnitaPol_t pol, Int_t ant);
137  void simpleNotch(AnitaPol::AnitaPol_t pol, Int_t ant, Double_t notchLowEdgeMHz, Double_t notchHighEdgeMHz);
138 
139  void renormalizeFourierDomain(AnitaPol::AnitaPol_t pol, Int_t ant);
140 
141  TGraph* interpolateWithStartTimeAndZeroMean(TGraph* grIn, Double_t startTime, Double_t dt, Int_t nSamp);
142  void doFFTs(AnitaPol::AnitaPol_t pol);
143  void correlateEvent(UsefulAnitaEvent* realEvent);
144  void correlateEvent(UsefulAnitaEvent* realEvent, AnitaPol::AnitaPol_t pol);
145  void reconstructEvent(UsefulAnitaEvent* usefulEvent, Int_t numFinePeaks=MAX_NUM_PEAKS, Int_t numCoarsePeaks=MAX_NUM_PEAKS);
146  void findPeakValues(AnitaPol::AnitaPol_t pol, Int_t numPeaks, Double_t* peakValues,
147  Double_t* phiDegs, Double_t* thetaDegs);
148 
149 
150  void getMaxCorrelationTimeValue(AnitaPol::AnitaPol_t pol, Int_t combo,Double_t& time, Double_t& value);
151  void getMaxCorrelationTimeValue(AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2, Double_t& time, Double_t& value);
152  void getMaxUpsampledCorrelationTimeValue(AnitaPol::AnitaPol_t pol, Int_t combo, Double_t& time, Double_t& value);
153  void getMaxUpsampledCorrelationTimeValue(AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2, Double_t& time, Double_t& value);
154 
155 
156 
157  void doAllCrossCorrelationsThreaded(AnitaPol::AnitaPol_t pol);
158  void doUpsampledCrossCorrelationsThreaded(AnitaPol::AnitaPol_t pol, Int_t phiSector);
159 
160 
161  Double_t getDeltaTExpected(AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2,
162  Double_t phiWave, Double_t thetaWave);
163  // Double_t getDeltaTExpectedFast(AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2,
164  // Int_t phiIndex, Int_t thetaIndex);
165 
166  Double_t relativeOffAxisDelay(AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2, Double_t phiDeg);
167  Double_t singleAntennaOffAxisDelay(Double_t deltaPhiDeg);
168 
169 
170  Bool_t useCombo(Int_t ant1, Int_t ant2, Int_t phiSector, Int_t deltaPhiSect);
171  void fillCombosToUse();
174 
175 
176  void fillDeltaTLookup();
177  Double_t getBin0PhiDeg();
178 
179 
180 
181 
182 
183 
184 
185 
186  void getCoarsePeakInfo(AnitaPol::AnitaPol_t pol, Int_t peakIndex, Double_t& value,
187  Double_t& phiDeg, Double_t& thetaDeg);
188  void getFinePeakInfo(AnitaPol::AnitaPol_t pol, Int_t peakIndex, Double_t& value,
189  Double_t& phiDeg, Double_t& thetaDeg);
190 
191 
192 
193  Double_t getInterpolatedUpsampledCorrelationValue(AnitaPol::AnitaPol_t pol, Int_t combo, Double_t deltaT);
194 
195  TH2D* getMap(AnitaPol::AnitaPol_t pol, Double_t& peakValue,
196  Double_t& peakPhiDeg, Double_t& peakThetaDeg,
197  UShort_t l3TrigPattern=ALL_PHI_TRIGS);
198 
199 
200  TH2D* getZoomMap(AnitaPol::AnitaPol_t pol);
201 
202  void reconstruct(AnitaPol::AnitaPol_t pol, Double_t& imagePeak,
203  Double_t& peakPhiDeg, Double_t& peakThetaDeg);
204  void reconstructZoom(AnitaPol::AnitaPol_t pol,
205  Double_t& imagePeak, Double_t& peakPhiDeg,
206  Double_t& peakThetaDeg, Double_t zoomCenterPhiDeg=0, Double_t zoomCenterThetaDeg=0);
207 
208  TH2D* makeGlobalImage(AnitaPol::AnitaPol_t pol, Double_t& imagePeak,
209  Double_t& peakPhiDeg, Double_t& peakThetaDeg);
210  TH2D* makeGlobalImage(AnitaPol::AnitaPol_t pol);
211 
212  TH2D* makeTriggeredImage(AnitaPol::AnitaPol_t pol, Double_t& imagePeak, Double_t& peakPhiDeg,
213  Double_t& peakThetaDeg, UShort_t l3TrigPattern);
214 
215  TH2D* makeZoomedImage(AnitaPol::AnitaPol_t pol, UShort_t l3TrigPattern,
216  Double_t zoomCenterPhiDeg, Double_t zoomCenterThetaDeg);
217  TH2D* makeZoomedImage(AnitaPol::AnitaPol_t pol, Double_t& imagePeak, Double_t& peakPhiDeg,
218  Double_t& peakThetaDeg, UShort_t l3TrigPattern, Double_t zoomCenterPhiDeg,
219  Double_t zoomCenterThetaDeg);
220  TH2D* makeZoomedImage(AnitaPol::AnitaPol_t pol, Double_t& imagePeak, Double_t& peakPhiDeg,
221  Double_t& peakThetaDeg, Double_t zoomCenterPhiDeg, Double_t zoomCenterThetaDeg);
222 
223  Int_t getPhiSectorOfAntennaClosestToPhiDeg(AnitaPol::AnitaPol_t pol, Double_t phiDeg);
224  TGraph* makeCoherentlySummedWaveform(AnitaPol::AnitaPol_t pol, Double_t phiDeg,
225  Double_t thetaDeg, Int_t maxDeltaPhiSect, Double_t& snr);
226  TGraph* makeUpsampledCoherentlySummedWaveform(AnitaPol::AnitaPol_t pol, Double_t phiDeg,
227  Double_t thetaDeg, Int_t maxDeltaPhiSect, Double_t& snr);
228  TGraph* makeCoherentWorker(AnitaPol::AnitaPol_t pol, Double_t phiDeg, Double_t thetaDeg,
229  Int_t maxDeltaPhiSect, Double_t& snr, Int_t nSamp);
230  static void* doSomeCrossCorrelationsThreaded(void* voidPtrArgs);
231  static void* doSomeUpsampledCrossCorrelationsThreaded(void* voidPtrArgs);
232  static void* makeSomeOfImageThreaded(void* voidPtrArgs);
233  static void* makeSomeOfZoomImageThreaded(void* voidPtrArgs);
234 
235  void deleteAllWaveforms(AnitaPol::AnitaPol_t pol);
236 
237  TGraph* getCrossCorrelationGraph(AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2);
238  TGraph* getUpsampledCrossCorrelationGraph(AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2);
239  TGraph* getCrossCorrelationGraphWorker(Int_t numSamps, AnitaPol::AnitaPol_t pol,
240  Int_t ant1, Int_t ant2);
241  static Int_t directlyInsertGeometry(TString pathToLindasFile, AnitaPol::AnitaPol_t pol);
243 
244  TString mapModeNames[kNumMapModes];
245  TString zoomModeNames[kNumZoomModes];
246 
247  // Double_t interpPreFactors[NUM_POL][NUM_COMBOS][NUM_BINS_THETA][NUM_PHI*NUM_BINS_PHI]; //!< The interpolation factor for neighbouring samples
248  Double_t interpPreFactors[NUM_POL][NUM_COMBOS][NUM_PHI*NUM_BINS_PHI][NUM_BINS_THETA];
249  // Int_t offsetLows[NUM_POL][NUM_COMBOS][NUM_BINS_THETA][NUM_PHI*NUM_BINS_PHI]; //!< The interpolation factor for neighbouring samples
250  Int_t offsetLows[NUM_POL][NUM_COMBOS][NUM_PHI*NUM_BINS_PHI][NUM_BINS_THETA];
251 
252  Double_t crossCorrelations[NUM_POL][NUM_COMBOS][NUM_SAMPLES*PAD_FACTOR];
253  Double_t coarseMap[NUM_POL][NUM_BINS_PHI*NUM_PHI][NUM_BINS_THETA];
254 
255  std::set<std::vector<int> >::iterator comboSetIterator[NUM_BINS_THETA][NUM_BINS_PHI*NUM_PHI];
256 
257  Double_t partBAsZoom[NUM_POL][NUM_COMBOS][NUM_BINS_THETA_ZOOM_TOTAL];
258  Double_t part21sZoom[NUM_POL][NUM_COMBOS][NUM_BINS_PHI_ZOOM_TOTAL];
259 
260  Double_t crossCorrelationsUpsampled[NUM_POL][NUM_COMBOS][NUM_SAMPLES*PAD_FACTOR*UPSAMPLE_FACTOR*PAD_FACTOR];
261  Double_t fineMap[NUM_POL][NUM_BINS_THETA_ZOOM][NUM_BINS_PHI_ZOOM];
262 
263  std::complex<Double_t> fftsPadded[NUM_POL][NUM_SEAVEYS][GETNUMFREQS(NUM_SAMPLES*PAD_FACTOR*UPSAMPLE_FACTOR)];
264 
265  std::complex<Double_t> ffts[NUM_POL][NUM_SEAVEYS][GETNUMFREQS(NUM_SAMPLES*PAD_FACTOR)];
266  TGraph* grs[NUM_POL][NUM_SEAVEYS];
267  TGraph* grsResampled[NUM_POL][NUM_SEAVEYS];
268  Double_t interpRMS[NUM_POL][NUM_SEAVEYS];
269  Double_t interpRMS2[NUM_POL][NUM_SEAVEYS];
270  Int_t comboIndices[NUM_SEAVEYS][NUM_SEAVEYS];
271 
272  UInt_t eventNumber[NUM_POL];
273  UInt_t lastEventNormalized[NUM_POL];
275  Double_t correlationDeltaT;
276  Int_t numSamples;
278  Int_t numCombos;
279 
280  std::vector<Int_t> comboToAnt1s;
281  std::vector<Int_t> comboToAnt2s;
282  std::vector<Int_t> combosToUseGlobal[NUM_PHI];
283 
284  std::vector<Double_t> rArray[NUM_POL];
285  std::vector<Double_t> phiArrayDeg[NUM_POL];
286  std::vector<Double_t> zArray[NUM_POL];
287 
288  Double_t coarseMapPeakValues[NUM_POL][MAX_NUM_PEAKS];
289  Double_t coarseMapPeakPhiDegs[NUM_POL][MAX_NUM_PEAKS];
290  Double_t coarseMapPeakThetaDegs[NUM_POL][MAX_NUM_PEAKS];
291 
292  Double_t fineMapPeakValues[NUM_POL][MAX_NUM_PEAKS];
293  Double_t fineMapPeakPhiDegs[NUM_POL][MAX_NUM_PEAKS];
294  Double_t fineMapPeakThetaDegs[NUM_POL][MAX_NUM_PEAKS];
295 
296 
297  Double_t zoomedThetaWaves[NUM_BINS_THETA_ZOOM_TOTAL];
298  Double_t zoomedTanThetaWaves[NUM_BINS_THETA_ZOOM_TOTAL];
299  Double_t zoomedCosThetaWaves[NUM_BINS_THETA_ZOOM_TOTAL];
300  Double_t zoomedPhiWaveLookup[NUM_BINS_PHI_ZOOM_TOTAL];
301  Double_t zoomedCosPartLookup[NUM_POL][NUM_SEAVEYS][NUM_BINS_PHI_ZOOM_TOTAL];
302  Double_t offAxisDelays[NUM_POL][NUM_COMBOS][NUM_BINS_PHI_ZOOM_TOTAL];
303 
304  Double_t thetaWaves[NUM_BINS_THETA];
305  Double_t phiWaveLookup[NUM_BINS_PHI*NUM_PHI];
306 
307  AnitaPol::AnitaPol_t threadPol;
310  Double_t threadImagePeak[NUM_THREADS];
311  Double_t threadPeakPhiDeg[NUM_THREADS];
312  Double_t threadPeakThetaDeg[NUM_THREADS];
313 
314  std::vector<TThread*> mapThreads;
315  std::vector<TThread*> corrThreads;
316  std::vector<TThread*> upsampledCorrThreads;
317 
321  Double_t maxDPhiDeg;
323 
324 private:
325 
326  std::vector<threadArgs> threadArgsVec;
327 
328  Double_t aftForeOffset;
329  Double_t minThetaDegZoom;
330  Double_t minPhiDegZoom;
331  Double_t zoomPhiMin;
332  Double_t zoomThetaMin;
333 
334 
335 };
336 #endif
TH2D * makeGlobalImage(AnitaPol::AnitaPol_t pol, Double_t &imagePeak, Double_t &peakPhiDeg, Double_t &peakThetaDeg)
Creates an interferometric map using plane wave deltaTs and antenna pairs from all phi-sectors...
Double_t singleAntennaOffAxisDelay(Double_t deltaPhiDeg)
Get the off-axis delay for an off boresight angle.
Int_t numSamplesUpsampled
Number of samples in waveform after padding and up sampling.
void findPeakValues(AnitaPol::AnitaPol_t pol, Int_t numPeaks, Double_t *peakValues, Double_t *phiDegs, Double_t *thetaDegs)
Goes through the coarseMap and finds the top N values.
TString zoomModeNames[kNumZoomModes]
Maps text to the zoomMode_t enum, used for histogram names/titles.
void fillCombosToUse()
Creates vectors of antenna combo indices and puts them in the combosToUseGlobal map.
void deleteAllWaveforms(AnitaPol::AnitaPol_t pol)
Deletes the waveform TGraphs in memory and removes dangling pointers.
UInt_t lastEventNormalized[NUM_POL]
Prevents cross-correlation of the same event twice.
Double_t fineMap[NUM_POL][NUM_BINS_THETA_ZOOM][NUM_BINS_PHI_ZOOM]
Internal storage for the finely binned map.
A class to take in UsefulAnitaEvents and get interferometric maps with a single function.
Int_t comboIndices[NUM_SEAVEYS][NUM_SEAVEYS]
Array mapping ant1+ant2 to combo index.
Int_t offsetLows[NUM_POL][NUM_COMBOS][NUM_PHI *NUM_BINS_PHI][NUM_BINS_THETA]
The interpolation factor for neighbouring samples.
std::vector< TThread * > upsampledCorrThreads
TThreads for doing upsampled cross correlations.
Double_t threadImagePeak[NUM_THREADS]
Store image peaks found by different threads.
static void * doSomeCrossCorrelationsThreaded(void *voidPtrArgs)
Static member function which generates the coarsely binned set of cross correlations from the FFTs he...
TGraph * getCrossCorrelationGraphWorker(Int_t numSamps, AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2)
Called by wrapper functions. Turns internal correlation arrays into TGraphs to be seen by humans...
Int_t kDeltaPhiSect
Specifies how many phi-sectors around peak use in reconstruction.
TGraph * getUpsampledCrossCorrelationGraph(AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2)
Turns internal upsampled correlation arrays into TGraphs to be seen by humans.
std::vector< Double_t > rArray[NUM_POL]
Vector of antenna radial positions.
std::vector< TThread * > corrThreads
TThreads for doing cross correlations.
Double_t zoomedPhiWaveLookup[NUM_BINS_PHI_ZOOM_TOTAL]
Cached phi for zoomed image.
Int_t threadPhiSector
phi-sector to use in thread functions.
TGraph * grs[NUM_POL][NUM_SEAVEYS]
Raw waveforms obtained from the UsefulAnitaEvent.
void reconstructEvent(UsefulAnitaEvent *usefulEvent, Int_t numFinePeaks=MAX_NUM_PEAKS, Int_t numCoarsePeaks=MAX_NUM_PEAKS)
Reconstruct event.
Double_t coarseMapPeakThetaDegs[NUM_POL][MAX_NUM_PEAKS]
Stores the peak theta (degrees) of the interally stored map.
Double_t coarseMap[NUM_POL][NUM_BINS_PHI *NUM_PHI][NUM_BINS_THETA]
Internal storage for the coarsely binned map.
~CrossCorrelator()
Destructor.
TH2D * getZoomMap(AnitaPol::AnitaPol_t pol)
Gets an actual histogram of the zoomed in map.
TGraph * grsResampled[NUM_POL][NUM_SEAVEYS]
Evenly resampled TGraphs.
void do5PhiSectorCombinatorics()
Function to index all possible antenna pairs for use in reconstuction.
TString mapModeNames[kNumMapModes]
Maps text to the mapMode_t enum, used for histogram names/titles.
TH2D * getMap(AnitaPol::AnitaPol_t pol, Double_t &peakValue, Double_t &peakPhiDeg, Double_t &peakThetaDeg, UShort_t l3TrigPattern=ALL_PHI_TRIGS)
Gets an actual histogram of the zoomed in map.
Int_t kDoSimpleSatelliteFiltering
Does a simple 52MHz wide notch at 260 if flag is greater than 0.
void printInfo()
Prints some summary information about the CrossCorrelator to stdout.
Double_t threadPeakPhiDeg[NUM_THREADS]
Store phi of image peaks found by different threads.
void correlateEvent(UsefulAnitaEvent *realEvent)
Correlate the event.
Int_t kUseOffAxisDelay
Flag for whether or not to apply off axis delay to deltaT expected.
static void * makeSomeOfZoomImageThreaded(void *voidPtrArgs)
Static member function which fills the interferometric maps.
Int_t getPhiSectorOfAntennaClosestToPhiDeg(AnitaPol::AnitaPol_t pol, Double_t phiDeg)
Finds the phi-sector closest to a particular phi direction.
Double_t part21sZoom[NUM_POL][NUM_COMBOS][NUM_BINS_PHI_ZOOM_TOTAL]
Yet more geometric caching.
Double_t interpRMS[NUM_POL][NUM_SEAVEYS]
RMS of interpolated TGraphs.
UInt_t eventNumber[NUM_POL]
For tracking event number.
void reconstruct(AnitaPol::AnitaPol_t pol, Double_t &imagePeak, Double_t &peakPhiDeg, Double_t &peakThetaDeg)
Wrapper function which launches the threaded functions, which fill the interferometric maps...
std::vector< TThread * > mapThreads
TThreads for doing interferometric map making.
std::complex< Double_t > ffts[NUM_POL][NUM_SEAVEYS][GETNUMFREQS(NUM_SAMPLES *PAD_FACTOR)]
FFTs of evenly resampled waveforms.
void getFinePeakInfo(AnitaPol::AnitaPol_t pol, Int_t peakIndex, Double_t &value, Double_t &phiDeg, Double_t &thetaDeg)
Gets the results from the fine reconstruction.
UInt_t threadL3TrigPattern
l3TrigPattern to use in thread functions.
Double_t zoomedCosPartLookup[NUM_POL][NUM_SEAVEYS][NUM_BINS_PHI_ZOOM_TOTAL]
Cached part of the deltaT calculation.
std::complex< Double_t > fftsPadded[NUM_POL][NUM_SEAVEYS][GETNUMFREQS(NUM_SAMPLES *PAD_FACTOR *UPSAMPLE_FACTOR)]
FFTs of evenly resampled waveforms, padded with zeros so that the inverse fourier transform is interp...
Double_t offAxisDelays[NUM_POL][NUM_COMBOS][NUM_BINS_PHI_ZOOM_TOTAL]
Off-axis delays for fine binned images.
static void * makeSomeOfImageThreaded(void *voidPtrArgs)
Static member function which fills the interferometric maps.
CrossCorrelator()
Constructor.
zoomMode_t
Flag to pass to CrossCorrelator when making a map telling it whether to reconstruct all arrival direc...
Double_t crossCorrelations[NUM_POL][NUM_COMBOS][NUM_SAMPLES *PAD_FACTOR]
Cross correlations.
void renormalizeFourierDomain(AnitaPol::AnitaPol_t pol, Int_t ant)
Scales the fft such that the inverse fft would have mean=0 and rms=1. For use after notching...
Double_t zoomedThetaWaves[NUM_BINS_THETA_ZOOM_TOTAL]
Cached theta for zoomed image.
void doAllCrossCorrelationsThreaded(AnitaPol::AnitaPol_t pol)
Wrapper function which launches the threads for generating all the cross correlations.
TGraph * getCrossCorrelationGraph(AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2)
Turns internal correlation arrays into TGraphs to be seen by humans.
TH2D * makeTriggeredImage(AnitaPol::AnitaPol_t pol, Double_t &imagePeak, Double_t &peakPhiDeg, Double_t &peakThetaDeg, UShort_t l3TrigPattern)
Creates an interferometric map using plane wave deltaTs and l3Triggered pairs from all phi-sectors...
CrossCorrelator * ptr
Pointer to the CrossCorrelator.
Double_t getDeltaTExpected(AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2, Double_t phiWave, Double_t thetaWave)
Function to calculate the time taken by a plane wave to cross the payload.
void simple370MHzSatelliteNotch(AnitaPol::AnitaPol_t pol, Int_t ant)
Applies a 40MHz wide notch centered at 370 MHz to filter another satellite frequency.
std::vector< Int_t > combosToUseGlobal[NUM_PHI]
Depends on L3 trigger for global image.
Double_t interpRMS2[NUM_POL][NUM_SEAVEYS]
RMS of interpolated TGraphs with extra zero padding.
Double_t correlationDeltaT
nominalSamplingDeltaT/UPSAMPLE_FACTOR, deltaT of for interpolation.
Double_t partBAsZoom[NUM_POL][NUM_COMBOS][NUM_BINS_THETA_ZOOM_TOTAL]
Yet more geometric caching.
Double_t getBin0PhiDeg()
Single function to get the angle of the first bin of the interferometric histogram.
void doFFTs(AnitaPol::AnitaPol_t pol)
Takes FFTs of the normalized, evenly resampled waveforms and puts them in memory. ...
Long_t threadInd
The thread index.
Double_t fineMapPeakValues[NUM_POL][MAX_NUM_PEAKS]
Stores the peak of the interally stored map.
void fillDeltaTLookup()
Fills in an array of cached deltaTs between antenna pairs as a function of arrival direction...
std::set< std::vector< int > >::iterator comboSetIterator[NUM_BINS_THETA][NUM_BINS_PHI *NUM_PHI]
Pointer to a vector of combo indices (actually an iterator over a set, but you know what I mean)...
Int_t kOnlyThisCombo
For debugging, only fill histograms with one particular antenna pair.
std::vector< Int_t > comboToAnt1s
Vector mapping combo index to ant1.
TGraph * makeCoherentlySummedWaveform(AnitaPol::AnitaPol_t pol, Double_t phiDeg, Double_t thetaDeg, Int_t maxDeltaPhiSect, Double_t &snr)
Creates the coherently summed waveform from the FFTs held in memory.
AnitaPol::AnitaPol_t threadPol
Polarization to use in thread functions.
std::vector< Double_t > zArray[NUM_POL]
Vector of antenna heights.
void getCoarsePeakInfo(AnitaPol::AnitaPol_t pol, Int_t peakIndex, Double_t &value, Double_t &phiDeg, Double_t &thetaDeg)
Gets the results from the coarse reconstruction.
std::vector< Int_t > comboToAnt2s
Vector mapping combo index to ant2.
TGraph * interpolateWithStartTimeAndZeroMean(TGraph *grIn, Double_t startTime, Double_t dt, Int_t nSamp)
Creates an interpolated TGraph with zero mean.
Double_t coarseMapPeakValues[NUM_POL][MAX_NUM_PEAKS]
Stores the peak of the interally stored map.
Int_t numSamples
Number of samples in waveform after padding.
TH2D * initializeNewCombinatorics()
static Int_t directlyInsertGeometry(TString pathToLindasFile, AnitaPol::AnitaPol_t pol)
Used to insert phase center geometry files from Linda.
Double_t relativeOffAxisDelay(AnitaPol::AnitaPol_t pol, Int_t ant1, Int_t ant2, Double_t phiDeg)
Get the relative off-axis delay between an antenna pair.
TH2D * makeZoomedImage(AnitaPol::AnitaPol_t pol, UShort_t l3TrigPattern, Double_t zoomCenterPhiDeg, Double_t zoomCenterThetaDeg)
Creates an interferometric map using plane wave deltaTs centered around a particular phi/theta...
Double_t coarseMapPeakPhiDegs[NUM_POL][MAX_NUM_PEAKS]
Stores the peak phi (degrees) of the interally stored map.
void simpleNotch(AnitaPol::AnitaPol_t pol, Int_t ant, Double_t notchLowEdgeMHz, Double_t notchHighEdgeMHz)
Applies a simple notch between the given frequencies.
Container required to get threading to work inside a class, includes the thread index and the pointer...
Int_t numCombos
Number of possible antenna pairs, counted during initialization. Should equal NUM_COMBOS.
void getNormalizedInterpolatedTGraphs(UsefulAnitaEvent *realEvent, AnitaPol::AnitaPol_t pol)
Makes evenly re-sampled, normalized waveform graphs from the UsefulAnitaEvent.
void initializeVariables()
Workhorse function to set internal variables.
void getMaxUpsampledCorrelationTimeValue(AnitaPol::AnitaPol_t pol, Int_t combo, Double_t &time, Double_t &value)
Get the maximum upsampled correlation time and value from a polarization and antenna combo index...
Double_t phiWaveLookup[NUM_BINS_PHI *NUM_PHI]
Cached phi for image.
static void * doSomeUpsampledCrossCorrelationsThreaded(void *voidPtrArgs)
Static member function which generates the finely binned set of cross correlations from the FFTs held...
void insertPhotogrammetryGeometry()
Inserts the photogrammetry geometry into the CrossCorrelator internals AND the AnitaEventCalibrator i...
Double_t nominalSamplingDeltaT
ANITA-3 => 1./2.6 ns, deltaT for evenly resampling.
Double_t interpPreFactors[NUM_POL][NUM_COMBOS][NUM_PHI *NUM_BINS_PHI][NUM_BINS_THETA]
The interpolation factor for neighbouring samples.
Double_t thetaWaves[NUM_BINS_THETA]
Cached theta for image.
TGraph * makeUpsampledCoherentlySummedWaveform(AnitaPol::AnitaPol_t pol, Double_t phiDeg, Double_t thetaDeg, Int_t maxDeltaPhiSect, Double_t &snr)
Creates the coherently summed waveform from the zero padded FFTs held in memory.
void doUpsampledCrossCorrelationsThreaded(AnitaPol::AnitaPol_t pol, Int_t phiSector)
Static member function which generates the finely binned set of cross correlations from the FFTs held...
Double_t zoomedTanThetaWaves[NUM_BINS_THETA_ZOOM_TOTAL]
Cached tan(theta) for zoomed image.
Double_t maxDPhiDeg
Variable for testing how wide an off axis angle is used in reconstruction.
Double_t threadPeakThetaDeg[NUM_THREADS]
Store theta of image peaks found by different threads.
mapMode_t
Flag to pass to CrossCorrelator when making a map telling it whether to use all phi-sectors or trigge...
TGraph * makeCoherentWorker(AnitaPol::AnitaPol_t pol, Double_t phiDeg, Double_t thetaDeg, Int_t maxDeltaPhiSect, Double_t &snr, Int_t nSamp)
Worker function to create the coherently summed waveform from either the regular ffts or the padded f...
void getMaxCorrelationTimeValue(AnitaPol::AnitaPol_t pol, Int_t combo, Double_t &time, Double_t &value)
Get the maximum correlation time and value from a polarization and antenna combo index.
std::vector< Double_t > phiArrayDeg[NUM_POL]
Vector of antenna azimuth positions.
void reconstructZoom(AnitaPol::AnitaPol_t pol, Double_t &imagePeak, Double_t &peakPhiDeg, Double_t &peakThetaDeg, Double_t zoomCenterPhiDeg=0, Double_t zoomCenterThetaDeg=0)
Wrapper function which launches the threaded functions, which fill the zoomed maps.
void simple260MHzSatelliteNotch(AnitaPol::AnitaPol_t pol, Int_t ant)
Applies a 52MHz wide notch centered at 260 MHz to filter the most problematic satellite frequency...
Double_t crossCorrelationsUpsampled[NUM_POL][NUM_COMBOS][NUM_SAMPLES *PAD_FACTOR *UPSAMPLE_FACTOR *PAD_FACTOR]
Upsampled cross correlations.
Bool_t useCombo(Int_t ant1, Int_t ant2, Int_t phiSector, Int_t deltaPhiSect)
This function encodes whether a pair of antennas should be used in a particular phi sector...
Double_t fineMapPeakThetaDegs[NUM_POL][MAX_NUM_PEAKS]
Stores the peak theta (degrees) of the interally stored map.
Double_t getInterpolatedUpsampledCorrelationValue(AnitaPol::AnitaPol_t pol, Int_t combo, Double_t deltaT)
Linearly interpolates between upsampled correlation points.
Double_t zoomedCosThetaWaves[NUM_BINS_THETA_ZOOM_TOTAL]
Cached cos(theta) for zoomed image.
Double_t fineMapPeakPhiDegs[NUM_POL][MAX_NUM_PEAKS]
Stores the peak phi (degrees) of the interally stored map.