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) {
372 value = std::exp(wgt_left * std::log(value_left) +
373 wgt_right * std::log(value_right));
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()) {
501const double&
GArf::at(
const int& index,
const int& col)
const
504 if (index < 0 || index >=
size()) {
507 if (col < 0 || col >=
columns()) {
522void 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) {
XSPEC Auxiliary Response File class definition.
Exception handler interface definition.
Filename class interface definition.
FITS binary table class definition.
FITS table float column class interface definition.
FITS table short integer column class interface definition.
FITS table abstract base class interface definition.
FITS file class interface definition.
Auxiliary Response File class.
int column_index(const std::string &colname) const
Returns index of additional vector column.
GFitsHeader m_header
FITS header cards.
GArf & operator=(const GArf &arf)
Assignment operator.
void read(const GFits &fits)
Read Auxiliary Response File.
void save(const GFilename &filename, const bool &clobber=false) const
Save Auxiliary Response File.
int size(void) const
Return number of spectral bins.
GArf(void)
Void constructor.
GArf & operator*=(const double &scale)
Scale Auxiliary Response File values.
double & operator[](const int &index)
Return content of spectral bin.
double & at(const int &index)
Return content of spectral bin.
GArf & operator/=(const double &scale)
Divide Auxiliary Response File values.
const GEbounds & ebounds(void) const
Return energy boundaries.
void set_logetrue(void)
Set true energy node array.
void append(const std::string &name, const std::vector< double > &column)
Append additional column to spectrum.
virtual ~GArf(void)
Destructor.
GEbounds m_ebounds
Energy boundaries.
GNodeArray m_logetrue
Log10 energies in TeV.
std::string print(const GChatter &chatter=NORMAL) const
Print Auxiliary Response File.
GArf * clone(void) const
Clone object.
void init_members(void)
Initialise class members.
std::vector< double > m_specresp
Spectral response.
GArf & operator-=(const GArf &arf)
Subtract Auxiliary Response File.
void copy_members(const GArf &pha)
Copy class members.
void write(GFits &fits) const
Write Auxiliary Response File.
std::vector< std::vector< double > > m_coldata
Additional column data.
int columns(void) const
Return number of additional columns.
void clear(void)
Clear object.
const GFilename & filename(void) const
Return file name.
void free_members(void)
Delete class members.
std::vector< std::string > m_colnames
Additional column names.
double & operator()(const int &index, const int &col)
Return content of additional columns.
GFilename m_filename
Filename of origin.
GArf & operator+=(const GArf &arf)
Add Auxiliary Response File.
void load(const GFilename &filename)
Load Auxiliary Response File.
Energy boundaries container class.
const GEnergy & emax(void) const
Return maximum energy of all intervals.
void append(const GEnergy &emin, const GEnergy &emax)
Append energy interval.
int size(void) const
Return number of energy boundaries.
void clear(void)
Clear energy boundaries.
GEnergy elogmean(const int &index) const
Returns logarithmic mean energy for a given energy interval.
const GEnergy & emin(void) const
Return minimum energy of all intervals.
Class that handles energies in a unit independent way.
double keV(void) const
Return energy in keV.
double log10TeV(void) const
Return log10 of energy in TeV.
std::string print(const GChatter &chatter=NORMAL) const
Print energy.
std::string url(void) const
Return Uniform Resource Locator (URL)
void clear(void)
Clear file name.
const GFitsHeader & header(void) const
Return extension header.
const std::string & extname(void) const
Return extension name.
GFitsHeaderCard & card(const int &cardno)
Return header card.
Abstract interface for FITS table column.
virtual double real(const int &row, const int &inx=0) const =0
void unit(const std::string &unit)
Set column unit.
void nrows(const int &nrows)
Set number of rows in column.
Abstract interface for FITS table.
bool contains(const std::string &colname) const
Checks the presence of a column in table.
GFitsTableCol * append(const GFitsTableCol &column)
Append column to the table.
const int & ncols(void) const
Return number of columns in table.
void saveto(const GFilename &filename, const bool &clobber=false)
Saves to specified FITS file.
bool contains(const int &extno) const
Check if HDU exists in FITS file.
GFitsHDU * append(const GFitsHDU &hdu)
Append HDU to FITS file.
void close(void)
Close FITS file.
void remove(const int &extno)
Remove HDU from FITS file.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
void set_value(const double &value) const
Set indices and weighting factors for interpolation.
const int & inx_right(void) const
Returns right node index.
const int & inx_left(void) const
Returns left node index.
void reserve(const int &num)
Reserves space for nodes in node array.
const double & wgt_right(void) const
Returns right node weight.
const double & wgt_left(void) const
Returns left node weight.
void clear(void)
Clear node array.
void append(const double &node)
Append one node to array.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
std::string tolower(const std::string &s)
Convert string to lower case.
std::string strip_whitespace(const std::string &arg)
Strip leading and trailing whitespace from string.
const std::string extname_arf