TH2DAntarctica.h
1 #ifndef TH2D_ANTARCTICA_H
2 #define TH2D_ANTARCTICA_H
3 
4 #include "TProfile2D.h"
5 #include "TH2D.h"
6 #include "AntarcticaBackground.h"
7 #include "UsefulAdu5Pat.h"
8 
9 
57 #define GF(var_type, internal_var_decl, FunctionName) \
58  var_type Get##FunctionName() const \
59  { \
60  internal_var_decl f##FunctionName = getBackground()->Get##FunctionName(); \
61  return f##FunctionName; \
62  }
63 
64 #define SF(var_type, FunctionName, forceRescale) \
65  void Set##FunctionName(var_type use##FunctionName) \
66  { \
67  getBackground()->Set##FunctionName(use##FunctionName); \
68  if(forceRescale){ \
69  RescaleBackground(); \
70  } \
71  }
72 
73 
74 
75 
76 
78 
79 
80 
81 
87 class TProfile2DAntarctica : public TProfile2D {
88  public:
89  TProfile2DAntarctica(Int_t nx=-1, Int_t ny=-1);
90  TProfile2DAntarctica(const char* name, const char* title, Int_t nx=-1, Int_t ny=-1);
91 
92  // This constructor sets x.size()-1 bins along the x-axis
93  // with the first bin LOWER edge at x[0],
94  // and the last bin UPPER edge at x.last() same for y.
95  TProfile2DAntarctica(const char* name, const char* title, const std::vector<Double_t>& x, const std::vector<Double_t>& y);
96  virtual ~TProfile2DAntarctica(){
97  if(fAntarcticaBackground){
98  delete fAntarcticaBackground;
99  fAntarcticaBackground = NULL;
100  }
101  }
102 
103  virtual void Draw(Option_t* opt="");
104  virtual Int_t Fill(Double_t lon, Double_t lat, Double_t val=1);
105 
106  void UnZoom(){getBackground()->UnZoom();} //*MENU
107 
108  GF(bool,bool,GrayScale)
109  SF(bool,GrayScale, false) //*TOGGLE *GETTER=GetGrayScale
110  GF(bool,bool,ShowBases)
111  SF(bool,ShowBases, false) //*TOGGLE *GETTER=GetShowBases
112  GF(bool,bool,ToolTip);
113  SF(bool,ToolTip, false) //*TOGGLE *GETTER=GetToolTip
114 
115  GF(int,,Coarseness)
116  SF(int,Coarseness, false) //*MENU *ARGS={useCoarseness=>fCoarseness}
117 
118  GF(bool,bool,Rampdem)
119  SF(bool,Rampdem,true) //*TOGGLE *GETTER=GetRampdem
120  GF(bool,bool,Bed)
121  SF(bool,Bed,true) //*TOGGLE *GETTER=GetBed
122  GF(bool,bool,Icemask)
123  SF(bool,Icemask,true) //*TOGGLE *GETTER=GetIcemask
124  GF(bool,bool,Surface)
125  SF(bool,Surface,true) //*TOGGLE *GETTER=GetSurface
126  GF(bool,bool,Thickness)
127  SF(bool,Thickness,true) //*TOGGLE *GETTER=GetThickness
128  GF(bool,bool,Grid)
129  SF(bool,Grid,false) //*TOGGLE *GETTER=GetGrid
130 
131  void SetGridDivisions(Int_t deltaLon, Int_t deltaLat){
132  getBackground()->SetGridDivisions(deltaLon, deltaLat);
133  } // *MENU* *ARGS={deltaLat=>fDeltaLon, deltaLon=>fDeltaLat}
134 
135  virtual void ExecuteEvent(int event, int px, int py);
136  void FillRandomly(Int_t nTimes = 5000); //*MENU
137  void ResetColorAxis(); //*MENU
138  Bool_t GetShowBackgroundColorAxis() const {return getBackground()->GetShowColorAxis();}
139  void ShowBackgroundColorAxis(Bool_t b){getBackground()->SetShowColorAxis(b);} //*TOGGLE *GETTER=GetShowBackgroundColorAxis
140  void ResetBackgroundColorAxis(){getBackground()->ResetColorAxis();} //*MENU
141  void RescaleBackground() const {getBackground()->scale(GetMinimum(), GetMaximum());} //*MENU
142  virtual void SetMaximum(Double_t maximum = -1111) { fMaximum = maximum; RescaleBackground();} //*MENU*
143  virtual void SetMinimum(Double_t minimum = -1111) { fMinimum = minimum; RescaleBackground();} //*MENU*
144  virtual TAxis* GetXaxis();
145  virtual TAxis* GetYaxis();
146  TGraphAntarctica* findLocalMaxima() const;
147 
148  void setAcceptStereographic(bool accept) { accept_stereographic = accept ; } //*TOGGLE *GETTER=getAcceptStereographic
149  bool getAcceptStereographic() const { return accept_stereographic; }
150 
151  private:
152  mutable AntarcticaBackground* fAntarcticaBackground;
153  mutable int fCoarseness;
154  mutable int fDeltaLat;
155  mutable int fDeltaLon;
156 
157  bool accept_stereographic;
158 
159  AntarcticaBackground* getBackground() const{
160  if(!fAntarcticaBackground){
161  fAntarcticaBackground = new AntarcticaBackground();
162  }
163  return fAntarcticaBackground;
164  }
165  ClassDef(TProfile2DAntarctica, 2);
166 
167 };
168 
169 
170 
171 
172 
173 
174 
175 
176 
183 class TH2DAntarctica : public TH2D {
184  public:
185  TH2DAntarctica(Int_t nx=-1, Int_t ny=-1);
186  TH2DAntarctica(const char* name, const char* title, Int_t nx=-1, Int_t ny=-1);
187 
188  // This constructor sets x.size()-1 bins along the x-axis
189  // with the first bin LOWER edge at x[0],
190  // and the last bin UPPER edge at x.last() same for y.
191  TH2DAntarctica(const char* name, const char* title, const std::vector<Double_t>& x, const std::vector<Double_t>& y);
192  virtual ~TH2DAntarctica(){
193  if(fAntarcticaBackground){
194  delete fAntarcticaBackground;
195  fAntarcticaBackground = NULL;
196  }
197  }
198 
199  virtual void Draw(Option_t* opt="");
200  virtual Int_t Fill(Double_t lon, Double_t lat, Double_t val=1);
201 
211  Int_t FillWithErrorContours(Double_t lon, Double_t lat, Double_t phi, Double_t theta, Double_t snr, Double_t ll_thresh, UsefulAdu5Pat upat, Double_t dist_thresh=0);
212  Int_t FillWithErrorContours(Double_t lon, Double_t lat, Double_t phi, Double_t theta, Double_t sigmaPhi, Double_t sigmaTheta, Double_t ll_thresh, UsefulAdu5Pat upat, Double_t dist_thresh=0);
213 
214  void UnZoom(){getBackground()->UnZoom();} //*MENU
215 
216  GF(bool,bool,GrayScale)
217  SF(bool,GrayScale,false) //*TOGGLE *GETTER=GetGrayScale
218  GF(bool,bool,ShowBases)
219  SF(bool,ShowBases,false) //*TOGGLE *GETTER=GetShowBases
220  GF(bool,bool,ToolTip);
221  SF(bool,ToolTip,false) //*TOGGLE *GETTER=GetToolTip
222 
223  GF(int,,Coarseness)
224  SF(int,Coarseness,false) //*MENU *ARGS={useCoarseness=>fCoarseness}
225 
226  GF(bool,bool,Rampdem)
227  SF(bool,Rampdem,true) //*TOGGLE *GETTER=GetRampdem
228  GF(bool,bool,Bed)
229  SF(bool,Bed,true) //*TOGGLE *GETTER=GetBed
230  GF(bool,bool,Icemask)
231  SF(bool,Icemask,true) //*TOGGLE *GETTER=GetIcemask
232  GF(bool,bool,Surface)
233  SF(bool,Surface,true) //*TOGGLE *GETTER=GetSurface
234  GF(bool,bool,Thickness)
235  SF(bool,Thickness,true) //*TOGGLE *GETTER=GetThickness
236  GF(bool,bool,Grid)
237  SF(bool,Grid,false) //*TOGGLE *GETTER=GetGrid
238 
239  void SetGridDivisions(Int_t deltaLon, Int_t deltaLat){
240  getBackground()->SetGridDivisions(deltaLon, deltaLat);
241  } // *MENU* *ARGS={deltaLat=>fDeltaLon, deltaLon=>fDeltaLat}
242 
243  virtual void ExecuteEvent(int event, int px, int py);
244  void FillRandomly(Int_t nTimes = 5000); //*MENU
245  void ResetColorAxis(); //*MENU
246  Bool_t GetShowBackgroundColorAxis() const {return getBackground()->GetShowColorAxis();}
247  void ShowBackgroundColorAxis(Bool_t b){getBackground()->SetShowColorAxis(b);} //*TOGGLE *GETTER=GetShowBackgroundColorAxis
248  void ResetBackgroundColorAxis(){getBackground()->ResetColorAxis();} //*MENU
249  void RescaleBackground() const {getBackground()->scale(GetMinimum(), GetMaximum());} //*MENU
250  virtual void SetMaximum(Double_t maximum = -1111) { fMaximum = maximum; RescaleBackground();} //*MENU*
251  virtual void SetMinimum(Double_t minimum = -1111) { fMinimum = minimum; RescaleBackground();} //*MENU*
252 
253  void setAcceptStereographic(bool accept) { accept_stereographic = accept ; } //*TOGGLE *GETTER=getAcceptStereographic
254  bool getAcceptStereographic() const { return accept_stereographic; }
255 
256  virtual TAxis* GetXaxis();
257  virtual TAxis* GetYaxis();
258  TGraphAntarctica* findLocalMaxima() const;
259 
260  private:
261  mutable AntarcticaBackground* fAntarcticaBackground;
262  mutable int fCoarseness;
263  mutable int fDeltaLat;
264  mutable int fDeltaLon;
265 
266  bool accept_stereographic;
267 
268  AntarcticaBackground* getBackground() const{
269  if(!fAntarcticaBackground){
270  fAntarcticaBackground = new AntarcticaBackground();
271  }
272  return fAntarcticaBackground;
273  }
274  ClassDef(TH2DAntarctica, 2);
275 
276 };
277 
278 
279 
280 #endif
void FillRandomly(Int_t nTimes=5000)
void FillRandomly(Int_t nTimes=5000)
Int_t FillWithErrorContours(Double_t lon, Double_t lat, Double_t phi, Double_t theta, Double_t snr, Double_t ll_thresh, UsefulAdu5Pat upat, Double_t dist_thresh=0)
void scale(double newMin, double newMax)
Does not persist in ROOT!
void ResetColorAxis(bool trigger_redraw=false)
As UsefulAnitaEvent is to RawAnitaEvent, UsefulAdu5Pat is to Adu5Pat. Well not quite as useful but yo...
Definition: UsefulAdu5Pat.h:39