NoiseMonitor.h
1 #ifndef NOISE_MONITOR_H
2 #define NOISE_MONITOR_H
3 
4 #include "AnitaConventions.h"
5 #include "TString.h"
6 #include "TObject.h"
7 #include <map>
8 
10 class FilterStrategy;
11 class TFile;
12 class TTree;
13 class TProfile2D;
14 
20 class NoiseMonitor {
21 
22  public:
23 
24  // The default timescale in seconds (bin width)
25  enum {
26  defaultTimeScaleSeconds = 10
27  };
28 
30  NoiseMonitor(UInt_t hash);
31 
32  virtual ~NoiseMonitor();
33  double getRMS(AnitaPol::AnitaPol_t pol, Int_t ant, UInt_t realTime);
34 
35  const TProfile2D* getProfile(AnitaPol::AnitaPol_t pol, int run){
36  getProfilesFromFileRun(run);
37  return fCurrent.get(pol);
38  }
39 
40 
46  class ProfPair{
47  public:
48  ProfPair() : H(NULL), V(NULL), fStartTime(0), fEndTime(0) {}
49  const TProfile2D* get(AnitaPol::AnitaPol_t pol) const{
50  return pol == AnitaPol::kHorizontal ? H : V;
51  }
52  void set(const TProfile2D* h, const TProfile2D* v);
53  void set(const ProfPair& other);
54  double startTime(){return fStartTime;}
55  double endTime(){return fEndTime;}
56  private:
57  TProfile2D* H;
58  TProfile2D* V;
59  double fStartTime;
60  double fEndTime;
61 
62  };
63 
64  protected:
65 
66  FilterStrategy* fFilterStrat;
67  const char* fRmsDir;
68  TFile* fFile; // Pointer to currently opened file
69  // std::map<int, TFile*> fFiles; /// map of run to opened TFiles
70  // std::map<int, ProfPair> fRunProfiles; /// map of run to pair of TProfiles (H/V)
71 
72  ProfPair fCurrent; //
73  UInt_t fHash;
74 
75  // void findProfilesInMemoryFromTime(UInt_t realTime); // from map in memory
76  // void findProfilesInMemoryFromRun(Int_t run); // from map in memory
77  void getProfilesFromFileRun(int run); // search for file
78  void getProfilesFromFileTime(UInt_t realTime); // search for file
79  void makeProfiles(int run); // last resort, make them from scratch (generates a file)
80  void getRmsDirEnv();
81  TString getHistName(AnitaPol::AnitaPol_t pol, int run);
82 
83 
84 
85  static UInt_t makeStratHashFromDesc(const FilterStrategy* fs);
86  TString getFileName(int run);
87 
88 };
89 
90 #endif //NOISE_MONITOR_H
virtual ~NoiseMonitor()
NoiseMonitor(FilterStrategy *fs)
A filter strategy defines the sets of filters that are used and provides some introspection abilities...
void getProfilesFromFileTime(UInt_t realTime)
Horizontal Polarisation.
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.