G12Sat.cxx
1 
9 #include "G12Sat.h"
10 #include "AnitaPacketUtil.h"
11 #include <iostream>
12 #include <fstream>
13 #include <cstring>
14 
15 #include "TPad.h"
16 #include "TEllipse.h"
17 #include "TLine.h"
18 #include "TLatex.h"
19 #include "TMath.h"
20 #include "TMarker.h"
21 
22 ClassImp(G12Sat);
23 
25 {
26  //Default Constructor
27 }
28 
30  //Default Destructor
31 }
32 
33 G12Sat::G12Sat(Int_t trun,
34  UInt_t trealTime,
35  GpsG12SatStruct_t *gpsStruct)
36 {
37  simplePacketCheck(&(gpsStruct->gHdr),PACKET_GPS_G12_SAT);
38 
39  run=trun;
40  realTime=trealTime;
41  payloadTime=gpsStruct->unixTime;
42  numSats=gpsStruct->numSats;
43  for(int i=0;i<MAX_SATS;i++) {
44  prn[i]=gpsStruct->sat[i].prn;
45  elevation[i]=gpsStruct->sat[i].elevation;
46  snr[i]=gpsStruct->sat[i].snr;
47  flag[i]=gpsStruct->sat[i].flag;
48  azimuth[i]=gpsStruct->sat[i].azimuth;
49  }
50 
51 }
52 
53 void G12Sat::getCirclePlot(TPad *padSat)
54 {
55  padSat->cd();
56  TEllipse *lippy = new TEllipse();
57  lippy->SetFillColor(0);
58  lippy->SetFillStyle(0);
59  lippy->DrawEllipse(0.5,0.5,0.45*TMath::Cos(TMath::DegToRad()*10),0,0,360,0);
60  lippy->DrawEllipse(0.5,0.5,0.45*TMath::Cos(TMath::DegToRad()*20),0,0,360,0);
61  lippy->DrawEllipse(0.5,0.5,0.45*TMath::Cos(TMath::DegToRad()*30),0,0,360,0);
62  lippy->DrawEllipse(0.5,0.5,0.45*TMath::Cos(TMath::DegToRad()*40),0,0,360,0);
63  lippy->DrawEllipse(0.5,0.5,0.45*TMath::Cos(TMath::DegToRad()*50),0,0,360,0);
64  lippy->DrawEllipse(0.5,0.5,0.45*TMath::Cos(TMath::DegToRad()*60),0,0,360,0);
65  lippy->DrawEllipse(0.5,0.5,0.45*TMath::Cos(TMath::DegToRad()*70),0,0,360,0);
66  lippy->DrawEllipse(0.5,0.5,0.45*TMath::Cos(TMath::DegToRad()*80),0,0,360,0);
67  lippy->DrawEllipse(0.5,0.5,0.45*TMath::Cos(TMath::DegToRad()*90),0,0,360,0);
68 
69  TLine *liney = new TLine();
70  liney->SetLineStyle(1);
71  liney->DrawLineNDC(0.03,0.5,0.97,0.5);
72  liney->DrawLineNDC(0.5,0.03,0.5,0.97);
73 
74  TLatex *texy = new TLatex();
75  texy->SetTextSize(0.08);
76  texy->DrawTextNDC(0.02,0.93,"G12");
77 
78  TMarker *satty = new TMarker();
79  for(int i=0;i<(int)numSats;i++) {
80  if(snr[i]<30)
81  satty->SetMarkerColor(kRed);
82  else if(snr[i]<40)
83  satty->SetMarkerColor(kOrange);
84  else
85  satty->SetMarkerColor(kGreen);
86  satty->SetMarkerStyle(29);
87  satty->SetMarkerSize(2.5);
88  Double_t r=0.45*TMath::Cos(TMath::DegToRad()*elevation[i]);
89  Double_t x=0.5+r*TMath::Cos(TMath::DegToRad()*azimuth[i]);
90  Double_t y=0.5+r*TMath::Sin(TMath::DegToRad()*azimuth[i]);
91  // std::cout << x << "\t" << y << std::endl;
92  satty->DrawMarker(x,y);
93  }
94 
95 }
~G12Sat()
Destructor.
Definition: G12Sat.cxx:29
UChar_t snr[12]
SNR of visible satellites.
Definition: G12Sat.h:40
UInt_t numSats
Number of satellites visible.
Definition: G12Sat.h:37
G12Sat – The satellite data from the G12.
Definition: G12Sat.h:24
G12 Satellite Info – Telemetered.
Int_t run
Run number assigned offline.
Definition: G12Sat.h:34
UInt_t realTime
Time in unixtime.
Definition: G12Sat.h:35
G12Sat()
Default constructor.
Definition: G12Sat.cxx:24
UInt_t payloadTime
Time in unixtime.
Definition: G12Sat.h:36
void getCirclePlot(TPad *padSat)
Fills the TPad with a 2D azimuth-elevation plot.
Definition: G12Sat.cxx:53
GpsG12SatStruct_t – Yes.
UChar_t elevation[12]
Elevation of visible satellites.
Definition: G12Sat.h:39
UChar_t prn[12]
PRN of visible satellites.
Definition: G12Sat.h:38
UShort_t azimuth[12]
Azimuth of visible satellites.
Definition: G12Sat.h:42
UChar_t flag[12]
Usability flag of satellites.
Definition: G12Sat.h:41
int simplePacketCheck(GenericHeader_t *gHdr, PacketCode_t code)
simplePacketCheck – utility function