1 #include "TGraphAntarctica.h" 3 #include "TVirtualPad.h" 5 #include "AnitaDataset.h" 6 #include "TVirtualPad.h" 18 TString makeSanitizedName(
const char* name){
19 TString sanitizedName(name);
23 sanitizedName.ReplaceAll(
" ",
"_");
24 sanitizedName.ReplaceAll(
"-",
"_");
25 sanitizedName.ReplaceAll(
"(",
"");
26 sanitizedName.ReplaceAll(
")",
"");
27 sanitizedName.ReplaceAll(
")",
"");
28 sanitizedName.ReplaceAll(
";",
"");
29 sanitizedName.ReplaceAll(
".",
"");
44 Double_t easting, northing;
46 TGraph::SetPoint(i, easting, northing);
59 TGraph::SetPoint(i, stereo.x, stereo.y);
77 if (!quiet) std::cout <<
"makeGpsGraph(): starting..." << std::endl;
80 gpsTreeStride = gpsTreeStride <= 0 ? defaultGpsTreeStride : gpsTreeStride;
84 for(
int run=firstRun; run<=lastRun; run++){
85 if (AnitaVersion::get() == 3) {
86 if (run > 256 && run < 264) {
87 std::cout <<
"makeGpsGraph(): In ANITA3 runs 257 through 263 are broken, skipping to 264..." << std::endl;
93 if (!quiet) std::cout <<
"makeGpsGraph(): starting run" << run <<
" - d.N()=" << d.
N() << std::endl;
94 for(
int entry=0; entry < d.
N(); entry+=gpsTreeStride){
95 if (!quiet) std::cout <<
"makeGpsGraph(): run:" << run <<
" entry:" << entry << std::endl;
108 TGraphAntarctica::TGraphAntarctica(TChain* chain, TString lonSelector, TString latSelector, TCut cut) : TGraph(){
110 TString command = lonSelector +
":" + latSelector;
112 const int n = chain->Draw(command, cut,
"goff");
114 Double_t* lons = chain->GetV1();
115 Double_t* lats = chain->GetV2();
117 for(
int i=0; i < n; i++){
125 TGraphAntarctica::TGraphAntarctica(TTree* tree, TString lonSelector, TString latSelector, TCut cut) : TGraph(){
127 TString command = lonSelector +
":" + latSelector;
129 const int n = tree->Draw(command, cut,
"goff");
131 Double_t* lons = tree->GetV1();
132 Double_t* lats = tree->GetV2();
134 for(
int i=0; i < n; i++){
150 TGraphAntarctica::TGraphAntarctica(
const BaseList::path& p, UInt_t interpSeconds){
152 if(interpSeconds == 0){
153 for(UInt_t i=0; i < p.
ps.size(); i++){
158 UInt_t time = p.ts.at(0);
159 while(time < p.ts.back()){
160 SetPoint(GetN(), p.getPosition(time));
161 time += interpSeconds;
165 SetNameTitle(makeSanitizedName(p.getName()), p.getName());
171 void TGraphAntarctica::Draw(Option_t* option){
173 TString opt = option;
177 opt = opt.Length() == 0 ?
"p" : opt;
179 Bool_t drawAntarctica =
false;
183 gROOT->MakeDefCanvas();
185 TList* prims = gPad->GetListOfPrimitives();
188 if(opt.Contains(
"same")){
189 opt.ReplaceAll(
"same",
"");
190 drawAntarctica =
false;
194 else if(opt.Contains(
"a")){
195 opt.ReplaceAll(
"a",
"");
196 drawAntarctica =
true;
201 if(prims->GetEntries() <= 1){
202 drawAntarctica =
true;
211 for(
int i=0; i < prims->GetEntries(); i++){
212 TString primName = prims->At(i)->GetName();
213 if(primName.Contains(AntarcticaBackground::getDefaultName())){
226 void TGraphAntarctica::init(){
228 doneConversion =
false;
241 void TGraphAntarctica::convertArrays(){
243 for(Int_t i=0; i < GetN(); i++){
248 doneConversion =
true;
265 const char* extraText = fTitle.Length() > 0 ? fTitle.Data() : NULL;
266 fBackground->updateToolTip(event, x, y, extraText);
269 TGraph::ExecuteEvent(event, x, y);
277 SetNameTitle(makeSanitizedName(b.getName()), b.getName());
308 TAxis* TGraphAntarctica::GetXaxis(){
311 return b->GetXaxis();
314 return fHistogram->GetXaxis();
318 TAxis* TGraphAntarctica::GetYaxis(){
321 return b->GetYaxis();
324 return fHistogram->GetYaxis();
336 TGraph::SetPoint(i, easting, northing);
static TGraphAntarctica * makeGpsGraph(int firstRun, int lastRun, int gpsTreeStride=defaultGpsTreeStride, bool quiet=true)
Adu5Pat – The ADU5 Position and Attitude Data.
Float_t latitude
In degrees.
int getEntry(int entryNumber)
void ExecuteEvent(Int_t event, Int_t x, Int_t y)
Float_t longitude
In degrees.
ClassDef(TGraphAntarctica, 1) private AntarcticaBackground * getBackground() const
Don't persist.
virtual void SetPointEastingNorthing(Int_t i, Double_t easting, Double_t northing)
Adu5Pat * gps(bool force_reload=false)
static void LonLatToEastingNorthing(Double_t lon, Double_t lat, Double_t &easting, Double_t &northing)
std::vector< AntarcticCoord > ps
true for flight, false for traverse
virtual void SetPoint(Int_t i, Double_t lon, Double_t lat)