TGraphAntarctica.h
1 /* -*- C++ -*-.*********************************************************************************************
2  Author: Ben Strutt
3  Email: strutt@physics.ucla.edu
4 
5  Description:
6  Class to greatly simplify the drawing of pretty TGraph of Antarctica.
7  It is intended as a partial replacement to AntarcticaMapPlotter in anitaAnalysisTools.
8  Uses the new and improved RampdemReader to do the hard coordinate conversion.
9 ***********************************************************************************************************/
10 
11 #ifndef TGRAPHANTARCTICA_H
12 #define TGRAPHANTARCTICA_H
13 
14 #include "TGraph.h"
15 #include "RampdemReader.h"
16 #include "TGraphEditor.h"
17 #include "AntarcticaBackground.h"
18 #include "TChain.h"
19 #include "TCut.h"
20 #include "BaseList.h"
21 #include "AntarcticaGeometry.h" // AntarcticCoord
22 
35 class TGraphAntarctica : public TGraph {
36 
37 
38 public:
39 
40  enum {
41  defaultGpsTreeStride = 10000
42  };
43 
44  // static members
45  static TGraphAntarctica* makeGpsGraph(int firstRun, int lastRun, int gpsTreeStride=defaultGpsTreeStride, bool quiet=true);
46 
47  // boring constructors
48  TGraphAntarctica() : TGraph() {init();}
49  explicit TGraphAntarctica(Int_t n) : TGraph(n) {init();}
50  TGraphAntarctica(Int_t n, const Int_t *x, const Int_t *y) : TGraph(n, x, y) {init();}
51  TGraphAntarctica(Int_t n, const Float_t *x, const Float_t *y) : TGraph(n, x, y) {init();}
52  TGraphAntarctica(Int_t n, const Double_t *x, const Double_t *y) : TGraph(n, x, y) {init();}
53  explicit TGraphAntarctica(const TGraph &gr) : TGraph(gr) {init();}
54 
55  // interesting constructors
56  TGraphAntarctica(TChain* chain, TString lonSelector="longitude", TString latSelector="latitude", TCut cut = "");
57  TGraphAntarctica(TTree* tree, TString lonSelector="longitude", TString latSelector="latitude", TCut cut = "");
58 
59  explicit TGraphAntarctica(const TVectorF &vx, const TVectorF &vy) : TGraph(vx, vy) {init();}
60 
61  explicit TGraphAntarctica(const TVectorD &vx, const TVectorD &vy) : TGraph(vx, vy) {init();}
62  explicit TGraphAntarctica(const TH1 *h) : TGraph(h){init();}
63 
64  explicit TGraphAntarctica(const TF1 *f, Option_t *option="") : TGraph(f, option){init();}
65 
66  explicit TGraphAntarctica(const char *filename, const char *format="%lg %lg", Option_t *option="") : TGraph(filename, format, option) {init();}
68  TGraphAntarctica(const BaseList::path& p, UInt_t interpTime = 0);
69 
70 
71  virtual void SetPoint(Int_t i, Double_t lon, Double_t lat);
72  virtual void SetPoint(Int_t i, const AntarcticCoord& coord);
73  virtual void SetPointEastingNorthing(Int_t i, Double_t easting, Double_t northing);
74 
75  Double_t* GetEasting(){return GetX();}
76  Double_t* GetNorthing(){return GetY();}
77  void Draw(Option_t* opt = "");
78  void ExecuteEvent(Int_t event, Int_t x, Int_t y);
79 
80  virtual TAxis* GetXaxis();
81  virtual TAxis* GetYaxis();
82 
83  ClassDef(TGraphAntarctica,1)
84 
85 private:
86 
87  mutable AntarcticaBackground* fBackground;
88 
90  if(!fBackground){
91  fBackground = new AntarcticaBackground();
92  }
93  return fBackground;
94  }
95 
96  void init();
97  Bool_t doneConversion; // convert initial array from lat/lon to easting northing
98  void convertArrays();
99 
100  TString fToolTipExtraTextFormat;
101 
102 };
103 
104 
105 
106 
107 
108 
109 
110 #endif
static TGraphAntarctica * makeGpsGraph(int firstRun, int lastRun, int gpsTreeStride=defaultGpsTreeStride, bool quiet=true)
void ExecuteEvent(Int_t event, Int_t x, Int_t y)
ClassDef(TGraphAntarctica, 1) private AntarcticaBackground * getBackground() const
Don't persist.
virtual void SetPointEastingNorthing(Int_t i, Double_t easting, Double_t northing)
virtual void SetPoint(Int_t i, Double_t lon, Double_t lat)