00001
00002
00003 void FITS_tutorial2()
00004 {
00005 printf("\n\n--------------------------------\n");
00006 printf("WELCOME TO FITS tutorial #2 !!!!\n");
00007 printf("--------------------------------\n");
00008 printf("We're gonna open a FITS file that contains the\n");
00009 printf("primary HDU and a little data table.\n");
00010 printf("The primary HDU is an array of 2 rows by 2040 columns, and\n");
00011 printf("they represent a radiation spectrum. The first row contains\n");
00012 printf("the flux data, whereas the second row the wavelengths.\n");
00013 printf("Data copyright: NASA\n\n");
00014
00015 if (!gROOT->IsBatch()) {
00016
00017 }
00018
00019
00020 TFITSHDU *hdu = new TFITSHDU("sample2.fits");
00021 if (hdu == 0) {
00022 printf("ERROR: could not access the HDU\n"); return;
00023 }
00024 printf("File successfully open!\n");
00025
00026
00027
00028
00029
00030 hdu->Print("F+");
00031
00032 printf("....................................\n");
00033 printf("We are going to generate a TGraph from vectors\n");
00034
00035
00036 TVectorD *Y = hdu->GetArrayRow(0);
00037 TVectorD *X = hdu->GetArrayRow(1);
00038 TGraph *gr = new TGraph(*X,*Y);
00039
00040
00041 TCanvas *c = new TCanvas("c1", "FITS tutorial #2", 800, 800);
00042 gr->Draw("BA");
00043
00044
00045
00046 delete X;
00047 delete Y;
00048 delete hdu;
00049 }
00050
00051