00001
00002
00003 void FITS_tutorial4()
00004 {
00005 printf("\n\n--------------------------------\n");
00006 printf("WELCOME TO FITS tutorial #4 !!!!\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 data table is extension #1 and it has 2 rows.\n");
00011 printf("We want to read only the rows that have the column\n");
00012 printf("named DATAMAX greater than 2e-15 (there's only 1\n");
00013 printf("matching row)\n");
00014 printf("Data copyright: NASA\n\n");
00015
00016 if (!gROOT->IsBatch()) {
00017
00018 }
00019
00020
00021 TFITSHDU *hdu = new TFITSHDU("sample2.fits[1][DATAMAX > 2e-15]");
00022 if (hdu == 0) {
00023 printf("ERROR: could not access the HDU\n"); return;
00024 }
00025
00026 hdu->Print("T");
00027
00028 printf("\n\n........................................\n");
00029 printf("Press ENTER to see full table contents (maybe you should resize\n");
00030
00031 hdu->Print("T+");
00032
00033 printf("\n\n........................................\n");
00034
00035 TVectorD *v = hdu->GetTabRealVectorColumn("DATAMAX");
00036 printf("%lg\n", (*v)[0]);
00037
00038
00039 printf("Does the matched row have DATAMAX > 2e-15? :-)\n");
00040
00041
00042 delete v;
00043 delete hdu;
00044 }
00045
00046