AnitaNoiseMachine.h
1 #ifndef ANITA_NOISE_MACHINE
2 #define ANITA_NOISE_MACHINE
3 
4 #include "AnitaConventions.h"
5 #include "AnitaNoiseSummary.h"
6 #include "AnitaEventSummary.h"
7 #include "FilteredAnitaEvent.h"
8 #include "Analyzer.h"
9 #include "UCorrelatorGUI.h"
10 #include "UCImageTools.h"
11 
12 /*=====================
13  A class to process and save information about the thermal environment*/
15 {
16  public:
17 
18  /* Constructor */
19  AnitaNoiseMachine(const int length = 60);
20 
21  const int fifoLength; //one minute of noise averaging
22 
23  bool quiet;// = true; //whether to complain about things that I randomly decided upon
24 
25  //do you want to save the interferometric maps? They are very large. Also multiple ways to save them
26  bool fillMap ; //save the min bias maps as TH2D (~18kB per event)
27  bool fillAvgMap; //save it as the average of fifoLength min bias maps (Won't work if fillMap==true)
28  bool fillArray; //save it as a double array (25% smaller, ~14kB per event)
29 
30  /* Reset */
31  void zeroInternals();
32 
33  /* makes an averaged TProfile2D out of the histograms in the mapFifo */
34  TProfile2D *getAvgMapNoiseProfile(AnitaPol::AnitaPol_t pol);
35 
36 
37  /* updates all the fifos with the current event */
38  void updateMachine(UCorrelator::Analyzer *analyzer,FilteredAnitaEvent *filtered);
39 
40 
41  /* Moves things into the summary */
42  void fillNoiseSummary(AnitaNoiseSummary *noiseSummary); //crabcrabcrab
43 
44  /* Fill the mapHistoryVal value in AnitaEventSummary (eventSummary should be mostly filled already) */
45  void fillEventSummary(AnitaEventSummary *eventSummary);
46  //crab
47 
48 
49  /* check if it is still all zeros or what */
50  bool isJustInitialized() { return fJustInitialized; };
51 
52 
53  private:
54 
55  //Makes sure the fifos start at zero
56  bool fJustInitialized;
57 
59  double lastHeading;
60 
61  //induvidual update functions which need to all be called at once so the fifos incriment properly
62  /* for building up an enormous memory block of histograms from a bunch of events, then making an average
63  also does the double array */
64  void updateAvgMapFifo(UCorrelator::Analyzer *analyzer, FilteredAnitaEvent *filtered);
65  /* for calculating rms of waveform from a minute average before event capture */
66  void updateAvgRMSFifo(FilteredAnitaEvent *filtered);
67 
68  /* fills up the history for a single source, called by fillEventSummary */
69  void setSourceMapHistoryVal(AnitaEventSummary::SourceHypothesis& source);
70 
71  //internals for time domain waveform rms fifo
72  double *rmsFifo; //where the info is saved
73  int rmsFifoPos; //where in the fifo the most recent write was
74  bool rmsFifoFillFlag ; //whether you've completely filled the fifo once
75  int rmsFifoIndex(int pol,int ringi,int poli,int pos); //so I know where to write in the 1d array
76  double rmsAvg[NUM_PHI][NUM_ANTENNA_RINGS][NUM_POLS]; //a running count of the average per channel
77 
78 
79  //internals for interferometric map fifo (probably enormous in memory so maybe make a flag)
80  TH2 **mapFifo[NUM_POLS]; //where the info is saved
81  int mapFifoPos; //where in the fifo the most recent write was
82  bool mapFifoFillFlag ; //whether you've completely filled the fifo once.
83  int mapFifoIndex();
84 
85 
86  //maybe will be more compressed
87  static const int nPhi = 180; //default in UCorrelator::AnalysisConfig, this is hard to make dynamic
88  static const int nTheta = 100; //default in UCorrelator::AnalysisConfig, this is hard to make dynamic
89  //where the quickly calculated double array is stored. should be maxDirections*nPhi*nTheta*NUM_POLS long
90  double *rollingMapAvg;
91  int rollingMapIndex(int poli,int iPhi,int iTheta);
92 
93  ClassDefNV(AnitaNoiseMachine, 5);
94 
95 };
96 /*------------------*/
97 
98 
99 #endif
AnitaNoiseMachine(const int length=60)
Default Constructor.
Common analysis format between UCorrelator and Acclaim.
This class is intended to store all the necessary data about an ANITA event for filtering and analysi...
enum AnitaPol::EAnitaPol AnitaPol_t
Polarisation enumeration.