earth.C

Go to the documentation of this file.
00001 {
00002   //this tutorial illustrate the special contour options
00003   //    "AITOFF"     : Draw a contour via an AITOFF projection
00004   //    "MERCATOR"   : Draw a contour via an Mercator projection
00005   //    "SINUSOIDAL" : Draw a contour via an Sinusoidal projection
00006   //    "PARABOLIC"  : Draw a contour via an Parabolic projection
00007   // 
00008   //Author: Olivier Couet (from an original macro sent by Ernst-Jan Buis)
00009     
00010    gStyle->SetPalette(1);
00011    gStyle->SetOptTitle(1);
00012    gStyle->SetOptStat(0);
00013 
00014    TCanvas *c1 = new TCanvas("c1","earth_projections",700,700);
00015    c1->Divide(2,2);
00016 
00017    TH2F *ha = new TH2F("ha","Aitoff",    180, -180, 180, 179, -89.5, 89.5);
00018    TH2F *hm = new TH2F("hm","Mercator",  180, -180, 180, 161, -80.5, 80.5);
00019    TH2F *hs = new TH2F("hs","Sinusoidal",180, -180, 180, 181, -90.5, 90.5);
00020    TH2F *hp = new TH2F("hp","Parabolic", 180, -180, 180, 181, -90.5, 90.5);
00021 
00022    TString dat = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
00023    dat.ReplaceAll("C","dat");
00024    dat.ReplaceAll("/./","/");
00025 
00026    ifstream in;
00027    in.open(dat.Data());
00028    Float_t x,y;
00029    while (1) {
00030      in >> x >> y;
00031      if (!in.good()) break;
00032      ha->Fill(x,y, 1);
00033      hm->Fill(x,y, 1);
00034      hs->Fill(x,y, 1);
00035      hp->Fill(x,y, 1);
00036    }
00037    in.close();
00038 
00039    c1->cd(1); ha->Draw("aitoff");
00040    c1->cd(2); hm->Draw("mercator");
00041    c1->cd(3); hs->Draw("sinusoidal");
00042    c1->cd(4); hp->Draw("parabolic");
00043 
00044    return c1;
00045 }

Generated on Tue Jul 5 15:44:20 2011 for ROOT_528-00b_version by  doxygen 1.5.1