ROOT
6.07/01
Reference Guide
ROOT Home Page
Main Page
Tutorials
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
tutorials
fitsio
FITS_tutorial6.C
Go to the documentation of this file.
1
// Open a FITS file whose primary array represents
2
// a spectrum table (flux vs wavelength) and dump its columns
3
void
FITS_tutorial6
()
4
{
5
TVectorD
*
v
;
6
7
printf
(
"\n\n--------------------------------\n"
);
8
printf
(
"WELCOME TO FITS tutorial #6 !!!!\n"
);
9
printf
(
"--------------------------------\n"
);
10
printf
(
"We are going to open a table from a FITS file\n"
);
11
printf
(
"and dump its columns.\n\n"
);
12
13
TString
dir
=
gSystem
->
DirName
(__FILE__);
14
15
//Open the table
16
TFITSHDU
*hdu =
new
TFITSHDU
(dir+
"/sample4.fits[1]"
);
17
if
(hdu == 0) {
18
printf
(
"ERROR: could not access the HDU\n"
);
return
;
19
}
20
21
//Show columns
22
Int_t
nColumns = hdu->
GetTabNColumns
();
23
printf
(
"The table has %d columns:\n"
, nColumns);
24
for
(
Int_t
i = 0; i < nColumns; i++) {
25
printf
(
"...Column %d: %s\n"
, i, hdu->
GetColumnName
(i).
Data
());
26
}
27
puts(
""
);
28
29
delete
hdu;
30
}
31
32
TVectorT< Double_t >
TString
Basic string class.
Definition:
TString.h:137
Int_t
int Int_t
Definition:
RtypesCore.h:41
TSystem::DirName
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
Definition:
TSystem.cxx:980
TString::Data
const char * Data() const
Definition:
TString.h:349
TFITSHDU
FITS file interface class.
Definition:
TFITS.h:40
gSystem
R__EXTERN TSystem * gSystem
Definition:
TSystem.h:545
v
SVector< double, 2 > v
Definition:
Dict.h:5
FITS_tutorial6
void FITS_tutorial6()
Definition:
FITS_tutorial6.C:3
TFITSHDU::GetTabNColumns
Int_t GetTabNColumns() const
Definition:
TFITS.h:124
printf
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
dir
void dir(char *path=0)
Definition:
rootalias.C:30
TFITSHDU::GetColumnName
const TString & GetColumnName(Int_t colnum)
Get the name of a column given its index (column>=0).
Definition:
TFITS.cxx:1426