ROOT
v6-20
Reference Guide
FITS_tutorial6.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_FITS
3
/// \notebook
4
///
5
/// Open a FITS file whose primary array represents
6
/// a spectrum table (flux vs wavelength) and dump its columns
7
///
8
/// \macro_code
9
/// \macro_output
10
///
11
/// \author Claudi Martinez
12
13
void
FITS_tutorial6()
14
{
15
// We open a table from a FITS file
16
// and dump its columns.
17
18
TString
dir =
gROOT
->GetTutorialDir();
19
20
//Open the table
21
TFITSHDU
hdu(dir +
"/fitsio/sample4.fits[1]"
);
22
23
// Show columns
24
const
auto
nColumns = hdu.GetTabNColumns();
25
printf(
"The table has %d columns:\n"
, nColumns);
26
for
(
auto
i :
ROOT::TSeqI
(nColumns)) {
27
printf(
" - Column %d: %s\n"
, i, hdu.GetColumnName(i).Data());
28
}
29
}
gROOT
#define gROOT
Definition:
TROOT.h:415
ROOT::TSeq
A pseudo container class which is a generator of indices.
Definition:
TSeq.hxx:66
TFITSHDU
FITS file interface class.
Definition:
TFITS.h:34
TString
Basic string class.
Definition:
TString.h:131
tutorials
fitsio
FITS_tutorial6.C
ROOT v6-20 - Reference Guide Generated on Fri Apr 1 2022 00:23:40 (GVA Time) using Doxygen 1.9.4