Skip to content
Snippets Groups Projects
Commit d75a15f2 authored by Rene Brun's avatar Rene Brun
Browse files

From Claudi Martinez:

add new tutorial


git-svn-id: http://root.cern.ch/svn/root/trunk@34697 27541ba8-7e3a-0410-8455-c3a389f83636
parent 7c1d0f9b
No related branches found
No related tags found
No related merge requests found
// Open a FITS file whose primary array represents
// a spectrum (flux vs wavelength)
void FITS_tutorial4()
{
printf("\n\n--------------------------------\n");
printf("WELCOME TO FITS tutorial #4 !!!!\n");
printf("--------------------------------\n");
printf("We're gonna open a FITS file that contains the\n");
printf("primary HDU and a little data table.\n");
printf("The data table is extension #1 and it has 2 rows.\n");
printf("We want to read only the rows that have the column\n");
printf("named DATAMAX greater than 2e-15 (there's only 1\n");
printf("matching row)\n");
printf("Data copyright: NASA\n\n");
if (!gROOT->IsBatch()) {
printf("Press ENTER to start..."); getchar();
}
//Open the table extension number 1)
TFITSHDU *hdu = new TFITSHDU("sample2.fits[1][DATAMAX > 2e-15]");
if (hdu == 0) {
printf("ERROR: could not access the HDU\n"); return;
}
printf("Press ENTER to see information about the table's columns..."); getchar();
hdu->Print("T");
printf("\n\n........................................\n");
printf("Press ENTER to see full table contents (maybe you should resize\n");
printf("this window as large as possible before)..."); getchar();
hdu->Print("T+");
printf("\n\n........................................\n");
printf("Press ENTER to get only the DATAMAX value of the matched row..."); getchar();
TVectorD *v = hdu->GetTabRealVectorColumn("DATAMAX");
printf("%lg\n", (*v)[0]);
printf("Does the matched row have DATAMAX > 2e-15? :-)\n");
//Clean up
delete v;
delete hdu;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment