42 #define G_OPERATOR_PLUS "GArf::operator+=(GArf&)"
43 #define G_OPERATOR_MINUS "GArf::operator-=(GArf&)"
44 #define G_OPERATOR "GArf::operator[](std::string&)"
45 #define G_OPERATOR2 "GArf::operator()(std::string&, GEnergy&)"
46 #define G_AT1 "GArf::at(int&)"
47 #define G_AT2 "GArf::at(int&, int&)"
48 #define G_APPEND "GArf::append(std::string&, std::vector<double>&)"
200 std::string msg =
"Incompatible energy binning of Auxiliary "
206 for (
int i = 0; i < this->
size(); ++i) {
234 std::string msg =
"Incompatible energy binning of Auxiliary "
240 for (
int i = 0; i < this->
size(); ++i) {
260 for (
int i = 0; i < this->
size(); ++i) {
280 for (
int i = 0; i < this->
size(); ++i) {
304 std::string msg =
"Could not find additional column with name \""+
329 std::string msg =
"Could not find additional column with name \""+
356 std::string msg =
"Could not find additional column with name \""+
362 const std::vector<double>& column =
m_coldata[index];
371 if (value_left > 0.0 && value_right > 0.0) {
414 return new GArf(*
this);
431 if (index < 0 || index >=
size()) {
454 if (index < 0 || index >=
size()) {
478 if (index < 0 || index >=
size()) {
481 if (col < 0 || col >=
columns()) {
501 const double&
GArf::at(
const int& index,
const int& col)
const
504 if (index < 0 || index >=
size()) {
507 if (col < 0 || col >=
columns()) {
522 void GArf::append(
const std::string& name,
const std::vector<double>& column)
526 if (column.size() !=
size()) {
527 std::string msg =
"Size of column "+
gammalib::str(column.size())+
528 " is incompatible with size of spectrum "+
663 std::string u_specresp =
665 double c_specresp = 1.0;
666 if (u_specresp ==
"m**2" || u_specresp ==
"m^2" || u_specresp ==
"m2") {
667 c_specresp = 10000.0;
671 int num = energy_lo->
nrows();
674 for (
int i = 0; i < num; ++i) {
682 double aeff = specresp->
real(i) * c_specresp;
688 for (
int icol = 0; icol < table.
ncols(); ++icol) {
691 std::string colname(table[icol]->name());
692 if ((colname ==
"ENERG_LO") ||
693 (colname ==
"ENERG_HI") ||
694 (colname ==
"SPECRESP")) {
702 std::vector<double> coldata;
703 for (
int i = 0; i < num; ++i) {
704 coldata.push_back(column->
real(i));
763 for (
int i = 0; i < length; ++i) {
770 energy_lo.
unit(
"keV");
771 energy_hi.
unit(
"keV");
772 specresp.
unit(
"cm**2");
783 for (
int icol = 0; icol <
columns(); ++icol) {
789 for (
int i = 0; i < length; ++i) {
799 hdu.
card(
"TELESCOP",
"unknown",
"Telescope");
800 hdu.
card(
"INSTRUME",
"unknown",
"Instrument");
801 hdu.
card(
"FILTER",
"none",
"Filter");
802 hdu.
card(
"HDUCLASS",
"OGIP",
"Format conforms to OGIP standard");
803 hdu.
card(
"HDUCLAS1",
"RESPONSE",
"Extension contains response data");
804 hdu.
card(
"HDUCLAS2",
"SPECRESP",
"Extension contains an ARF");
805 hdu.
card(
"HDUVERS",
"1.1.0",
"Version of the file format");
811 (
m_header[i].keyname() ==
"TELESCOP") ||
812 (
m_header[i].keyname() ==
"INSTRUME") ||
813 (
m_header[i].keyname() ==
"FILTER")) {
843 result.append(
"=== GArf ===");
850 result.append(
" - ");
932 for (
int i = 0; i < netrue; ++i) {
964 for (
int i = 0; i <
columns(); ++i) {
GArf & operator-=(const GArf &arf)
Subtract Auxiliary Response File.
void unit(const std::string &unit)
Set column unit.
const int & ncols(void) const
Return number of columns in table.
double & operator[](const int &index)
Return content of spectral bin.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
bool contains(const int &extno) const
Check if HDU exists in FITS file.
GArf(void)
Void constructor.
void copy_members(const GArf &pha)
Copy class members.
GEbounds m_ebounds
Energy boundaries.
double & at(const int &index)
Return content of spectral bin.
void read(const GFits &fits)
Read Auxiliary Response File.
int size(void) const
Return number of energy boundaries.
void append(const GEnergy &emin, const GEnergy &emax)
Append energy interval.
GFilename m_filename
Filename of origin.
bool contains(const std::string &colname) const
Checks the presence of a column in table.
const double & wgt_left(void) const
Returns left node weight.
void nrows(const int &nrows)
Set number of rows in column.
void clear(void)
Clear node array.
void reserve(const int &num)
Reserves space for nodes in node array.
double log10TeV(void) const
Return log10 of energy in TeV.
GFitsTableCol * append(const GFitsTableCol &column)
Append column to the table.
std::vector< std::string > m_colnames
Additional column names.
FITS table float column class interface definition.
const GFitsHeader & header(void) const
Return extension header.
FITS file class interface definition.
void save(const GFilename &filename, const bool &clobber=false) const
Save Auxiliary Response File.
void set_value(const double &value) const
Set indices and weighting factors for interpolation.
std::string strip_whitespace(const std::string &arg)
Strip leading and trailing whitespace from string.
GFitsHeader m_header
FITS header cards.
void append(const std::string &name, const std::vector< double > &column)
Append additional column to spectrum.
Auxiliary Response File class.
GArf & operator/=(const double &scale)
Divide Auxiliary Response File values.
void saveto(const GFilename &filename, const bool &clobber=false)
Saves to specified FITS file.
GArf & operator=(const GArf &arf)
Assignment operator.
int column_index(const std::string &colname) const
Returns index of additional vector column.
const std::string extname_arf
void free_members(void)
Delete class members.
GArf & operator+=(const GArf &arf)
Add Auxiliary Response File.
const double & wgt_right(void) const
Returns right node weight.
std::vector< std::vector< double > > m_coldata
Additional column data.
Energy boundaries container class.
void remove(const int &extno)
Remove HDU from FITS file.
void init_members(void)
Initialise class members.
GArf & operator*=(const double &scale)
Scale Auxiliary Response File values.
std::string print(const GChatter &chatter=NORMAL) const
Print energy.
std::string print(const GChatter &chatter=NORMAL) const
Print Auxiliary Response File.
const GEnergy & emin(void) const
Return minimum energy of all intervals.
Abstract interface for FITS table column.
XSPEC Auxiliary Response File class definition.
virtual ~GArf(void)
Destructor.
GVector log(const GVector &vector)
Computes natural logarithm of vector elements.
void set_logetrue(void)
Set true energy node array.
Abstract interface for FITS table.
GEnergy elogmean(const int &index) const
Returns logarithmic mean energy for a given energy interval.
const int & inx_left(void) const
Returns left node index.
const std::string & extname(void) const
Return extension name.
void clear(void)
Clear energy boundaries.
const int & inx_right(void) const
Returns right node index.
std::string url(void) const
Return Uniform Resource Locator (URL)
void write(GFits &fits) const
Write Auxiliary Response File.
void clear(void)
Clear file name.
virtual double real(const int &row, const int &inx=0) const =0
double keV(void) const
Return energy in keV.
int columns(void) const
Return number of additional columns.
void clear(void)
Clear object.
Exception handler interface definition.
GFitsHDU * append(const GFitsHDU &hdu)
Append HDU to FITS file.
FITS binary table class definition.
std::string tolower(const std::string &s)
Convert string to lower case.
GVector exp(const GVector &vector)
Computes exponential of vector elements.
FITS table short integer column class interface definition.
const GEnergy & emax(void) const
Return maximum energy of all intervals.
double & operator()(const int &index, const int &col)
Return content of additional columns.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
void append(const double &node)
Append one node to array.
GNodeArray m_logetrue
Log10 energies in TeV.
GFitsHeaderCard & card(const int &cardno)
Return header card.
int size(void) const
Return number of spectral bins.
void load(const GFilename &filename)
Load Auxiliary Response File.
GArf * clone(void) const
Clone object.
Filename class interface definition.
const GEbounds & ebounds(void) const
Return energy boundaries.
std::vector< double > m_specresp
Spectral response.
Class that handles energies in a unit independent way.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
FITS table abstract base class interface definition.