AntarcticaMapPlotter.h
1 /* -*- C++ -*-.*********************************************************************************************
2  Author: Ben Strutt
3  Email: b.strutt.12@ucl.ac.uk
4 
5  Description:
6  Antarctica canvas for plotting locations on the continent class
7 ************************************************************************************************************/
8 
9 
10 #ifndef ANTARCTICAMAPPLOTTER_H
11 #define ANTARCTICAMAPPLOTTER_H
12 
13 #include "TCanvas.h"
14 #include "TH2D.h"
15 #include "TMath.h"
16 #include "TROOT.h"
17 #include "TImage.h"
18 #include "TGraph.h"
19 
20 #include <iostream>
21 #include <map>
22 
29 class AntarcticaMapPlotter : public TNamed{
30 
31 public:
32 
34  AntarcticaMapPlotter(TString name, TString title, Int_t nBinsX, Int_t nBinsY);
36 
37  void addHistogram(TString name, TString title, Int_t nBinsX, Int_t nBinsY);
38  void addTGraph(TString name, TString title, Int_t n=0, Double_t* latitude=NULL, Double_t* longitude=NULL);
39 
40  Int_t setCurrentHistogram(TString name);
41  void DrawHist(TString opt);
42  TH2D* getCurrentHistogram();
43 
44 
45  // Int_t GetN();
46  // void SetPoint(Int_t n, Double_t latitude, Double_t longitude);
47  Int_t Fill(Double_t latitude, Double_t longitude, Double_t weight=1);
48 
49  Int_t setCurrentTGraph(TString name);
50  void DrawTGraph(TString opt);
51  TGraph* getCurrentTGraph();
52 
53 
54 private:
55 
56  // Image scaling factors
57  Double_t TrueScaleLat;
58  // Double_t CentralMeridian; //!< ????
59  Double_t RadiusOfEarth;
60  Double_t xOffest;
61  Double_t yOffset;
62  Double_t scale;
63  Double_t xSize;
64  Double_t ySize;
65 
66  // PNG of antarctica
67  TImage *img;
68 
69  void getRelXYFromLatLong(Double_t latitude, Double_t longitude,Double_t &x, Double_t &y);
70  void initializeInternals();
71 
72  TH2D* hCurrent;
73  TGraph* grCurrent;
74 
75  std::map<TString, TH2D*> hists;
76  std::map<TString, TGraph*> grs;
77 
78  ClassDef(AntarcticaMapPlotter,2);
79 };
80 
81 
82 
83 
84 
85 
86 #endif //ANTARCTICAMAPPLOTTER_H
TH2D * getCurrentHistogram()
Return pointer to current histogram.
void DrawTGraph(TString opt)
Draws the canvas, image and histogram.
Int_t setCurrentTGraph(TString name)
Sets the current histrogram pointer* hCurrent.
TGraph * getCurrentTGraph()
Return pointer to current TGraph.
void DrawHist(TString opt)
Draws the canvas, image and histogram.
Class to plot reconstructed events onto a picture of Antarctica.
Int_t Fill(Double_t latitude, Double_t longitude, Double_t weight=1)
How to fill the histogram, converts latitude and longitude into x/y bins first.
Int_t setCurrentHistogram(TString name)
Sets the current histogram pointer* hCurrent.
void addHistogram(TString name, TString title, Int_t nBinsX, Int_t nBinsY)
Creates a new histogram to go in the internal map and sets it as the current histogram.
void addTGraph(TString name, TString title, Int_t n=0, Double_t *latitude=NULL, Double_t *longitude=NULL)
Creates a new graph to go in the internal map and sets it as the current histogram.
AntarcticaMapPlotter()
Constructor.
~AntarcticaMapPlotter()
Destructor.