Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
FITS_tutorial7.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_FITS
3/// \notebook
4/// Open a FITS file that contains a catalog of astronomical objects
5/// and dump some of its columns
6///
7/// \macro_code
8/// \macro_output
9///
10/// \author Elizabeth Buckley-Geer
11
12void FITS_tutorial7()
13{
14 // We are going to open a table from a FITS file
15 // and print out three columns for some of the objects.
16 // This table contains a logical data type so this tutorial tests
17 // that we can read it correctly
18
19 TString dir = gROOT->GetTutorialDir();
20
21 // Open the table
22 TFITSHDU hdu(dir + "/fitsio/sample5.fits[1]");
23
24 // Read the ra, dec, flux_g and brick_primary columns
25
26 std::unique_ptr<TVectorD> vec1(hdu.GetTabRealVectorColumn("ra"));
27 std::unique_ptr<TVectorD> vec2(hdu.GetTabRealVectorColumn("dec"));
28 std::unique_ptr<TVectorD> vec3(hdu.GetTabRealVectorColumn("flux_g"));
29 std::unique_ptr<TVectorD> vec4(hdu.GetTabRealVectorColumn("brick_primary"));
30
31 for (auto i : ROOT::TSeqI(vec1->GetLwb(), vec1->GetUpb())) {
32 const auto bp = (*vec4)[i];
33 if (bp) {
34 const auto gflux = (*vec3)[i];
35 const auto ra = (*vec1)[i];
36 const auto dec = (*vec2)[i];
37 printf("RA %f DEC %f G-FLUX %f\n", ra, dec, gflux);
38 }
39 }
40}
#define gROOT
Definition TROOT.h:406
FITS file interface class.
Definition TFITS.h:35
Basic string class.
Definition TString.h:139
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
TSeq< int > TSeqI
Definition TSeq.hxx:203