test_GResponse.cpp
3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/***************************************************************************
* test_GResponse.cpp - test Response classes *
* ----------------------------------------------------------------------- *
* copyright : (C) 2008 by Jurgen Knodlseder *
* ----------------------------------------------------------------------- *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* __ Includes ___________________________________________________________ */
#include "test_GResponse.hpp"
/* __ Namespaces _________________________________________________________ */
/* __ Globals ____________________________________________________________ */
/***************************************************************************
* Test: Open *
***************************************************************************/
void test_open(void)
{
std::cout << "Test GResponse: Open PSF FITS file: ";
try {
// Open FITS file
GFits fits;
fits.open("irf/lat/aeff_Pass5_v0_front.fits");
// Get pointer towards effective area HDU
GFitsHDU* aeff = fits.hdu("EFFECTIVE AREA");
if (aeff == NULL) {
std::cout << std::endl << "TEST ERROR: Unable to find HDU <EFFECTIVE AREA>." << std::endl;
throw;
}
// Get columns
GFitsTableFltCol energ_lo = *((GFitsTableFltCol*)aeff->column("ENERG_LO"));
GFitsTableFltCol energ_hi = *((GFitsTableFltCol*)aeff->column("ENERG_HI"));
GFitsTableFltCol ctheta_lo = *((GFitsTableFltCol*)aeff->column("CTHETA_LO"));
GFitsTableFltCol ctheta_hi = *((GFitsTableFltCol*)aeff->column("CTHETA_HI"));
GFitsTableFltCol effarea = *((GFitsTableFltCol*)aeff->column("EFFAREA"));
}
catch (exception &e) {
std::cout << std::endl << "TEST ERROR: Unable to open FITS file." << std::endl;
std::cout << e.what() << std::endl;
throw;
}
std::cout << ". ok." << std::endl;
}
/***************************************************************************
* Main test function *
***************************************************************************/
int main(void)
{
// Dump header
std::cout << std::endl;
std::cout << "***************************" << std::endl;
std::cout << "* GResponse class testing *" << std::endl;
std::cout << "**************************" << std::endl;
// Execute the tests
test_open();
// Return
return 0;
}