FITS_tutorial4.C

Go to the documentation of this file.
00001 // Open a FITS file whose primary array represents
00002 // a spectrum (flux vs wavelength)
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       //printf("Press ENTER to start..."); getchar();
00018    }
00019     
00020    //Open the table extension number 1)
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    //printf("Press ENTER to see information about the table's columns..."); getchar();
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    //printf("this window as large as possible before)..."); getchar();   
00031    hdu->Print("T+");
00032    
00033    printf("\n\n........................................\n");
00034    //printf("Press ENTER to get only the DATAMAX value of the matched row..."); getchar();
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    //Clean up 
00042    delete v;  
00043    delete hdu;
00044 }
00045 
00046  

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