GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GLATResponseTable.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GLATResponseTable.cpp - Fermi/LAT Response table class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2008-2013 by Juergen Knoedlseder *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GLATResponseTable.cpp
23  * @brief Fermi/LAT response table class implementation
24  * @author Juergen Knoedlseder
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include "GLATResponseTable.hpp"
32 #include "GTools.hpp"
33 #include "GException.hpp"
34 #include "GFitsTableFloatCol.hpp"
35 
36 /* __ Method name definitions ____________________________________________ */
37 #define G_READ "GLATResponseTable::read(GFitsTable&)"
38 #define G_INDEX "GLATResponseTable::index(int&, int&)"
39 #define G_ENERGY "GLATResponseTable::energy(int&)"
40 #define G_ENERGY_LO "GLATResponseTable::energy_lo(int&)"
41 #define G_ENERGY_HI "GLATResponseTable::energy_hi(int&)"
42 #define G_COSTHETA_LO "GLATResponseTable::costheta_lo(int&)"
43 #define G_COSTHETA_HI "GLATResponseTable::costheta_hi(int&)"
44 
45 /* __ Macros _____________________________________________________________ */
46 
47 /* __ Coding definitions _________________________________________________ */
48 
49 /* __ Debug definitions __________________________________________________ */
50 
51 /* __ Constants __________________________________________________________ */
52 
53 
54 /*==========================================================================
55  = =
56  = Constructors/destructors =
57  = =
58  ==========================================================================*/
59 
60 /***********************************************************************//**
61  * @brief Void constructor
62  ***************************************************************************/
64 {
65  // Initialise class members
66  init_members();
67 
68  // Return
69  return;
70 }
71 
72 
73 /***********************************************************************//**
74  * @brief Copy constructor
75  *
76  * @param table Response table.
77  ***************************************************************************/
79 {
80  // Initialise class members
81  init_members();
82 
83  // Copy members
84  copy_members(table);
85 
86  // Return
87  return;
88 }
89 
90 
91 /***********************************************************************//**
92  * @brief Destructor
93  ***************************************************************************/
95 {
96  // Free members
97  free_members();
98 
99  // Return
100  return;
101 }
102 
103 
104 /*==========================================================================
105  = =
106  = Operators =
107  = =
108  ==========================================================================*/
109 
110 /***********************************************************************//**
111  * @brief Assignment operator
112  *
113  * @param table Response table.
114  * @return Response table.
115  ***************************************************************************/
117 {
118  // Execute only if object is not identical
119  if (this != &table) {
120 
121  // Free members
122  free_members();
123 
124  // Initialise private members
125  init_members();
126 
127  // Copy members
128  copy_members(table);
129 
130  } // endif: object was not identical
131 
132  // Return this object
133  return *this;
134 }
135 
136 
137 /*==========================================================================
138  = =
139  = Public methods =
140  = =
141  ==========================================================================*/
142 
143 /***********************************************************************//**
144  * @brief Clear instance
145  *
146  * This method properly resets the object to an initial state.
147  ***************************************************************************/
149 {
150  // Free class members
151  free_members();
152 
153  // Initialise members
154  init_members();
155 
156  // Return
157  return;
158 }
159 
160 
161 /***********************************************************************//**
162  * @brief Clone instance
163  ***************************************************************************/
165 {
166  return new GLATResponseTable(*this);
167 }
168 
169 
170 /***********************************************************************//**
171  * @brief Read response table from FITS table HDU
172  *
173  * @param[in] hdu Response table HDU.
174  *
175  * The response table definition is assumed to be stored in 4 vector columns
176  * with names
177  * ENERG_LO (energy bins lower boundary)
178  * ENERG_HI (energy bins upper boundary)
179  * CTHETA_LO (cos theta bins lower boundary)
180  * CTHETA_HI (cos theta bins upper boundary)
181  ***************************************************************************/
183 {
184  // Clear instance
185  clear();
186 
187  // Get pointers to table columns
188  const GFitsTableCol* energy_lo = hdu["ENERG_LO"];
189  const GFitsTableCol* energy_hi = hdu["ENERG_HI"];
190  const GFitsTableCol* ctheta_lo = hdu["CTHETA_LO"];
191  const GFitsTableCol* ctheta_hi = hdu["CTHETA_HI"];
192 
193  // Extract number of bins
194  m_energy_num = energy_lo->number();
195  m_ctheta_num = ctheta_lo->number();
196 
197  // Allocate memory
198  if (m_energy_num > 0) {
199  m_energy_lo = new double[m_energy_num];
200  m_energy_hi = new double[m_energy_num];
201  }
202  if (m_ctheta_num > 0) {
203  m_ctheta_lo = new double[m_ctheta_num];
204  m_ctheta_hi = new double[m_ctheta_num];
205  }
206 
207  // Transfer data
208  for (int i = 0; i < m_energy_num; ++i) {
209  m_energy_lo[i] = energy_lo->real(0,i);
210  m_energy_hi[i] = energy_hi->real(0,i);
211  }
212  for (int i = 0; i < m_ctheta_num; ++i) {
213  m_ctheta_lo[i] = ctheta_lo->real(0,i);
214  m_ctheta_hi[i] = ctheta_hi->real(0,i);
215  }
216 
217  // Set energy nodes (log10 of energy)
218  if (m_energy_num > 0) {
219  double *logE = new double[m_energy_num];
220  for (int i = 0; i < m_energy_num; ++i) {
221  logE[i] = 0.5 * (log10(m_energy_lo[i]) + log10(m_energy_hi[i]));
222 //ST method logE[i] = log10(sqrt(m_energy_lo[i]*m_energy_hi[i]));
223  m_energy.push_back(std::pow(10.0, logE[i]));
224  }
225  m_logE.nodes(m_energy_num, logE);
226  delete [] logE;
227  }
228 
229  // Set cos theta nodes
230  if (m_ctheta_num > 0) {
231  double *ctheta = new double[m_ctheta_num];
232  for (int i = 0; i < m_ctheta_num; ++i) {
233  ctheta[i] = 0.5 * (m_ctheta_lo[i] + m_ctheta_hi[i]);
234  }
235  m_ctheta.nodes(m_ctheta_num, ctheta);
236  delete [] ctheta;
237  }
238 
239  // Return
240  return;
241 }
242 
243 
244 /***********************************************************************//**
245  * @brief Write response table into FITS table
246  *
247  * @param[in] hdu Fits table HDU.
248  ***************************************************************************/
250 {
251  // Allocate floating point vector columns
252  GFitsTableFloatCol col_energy_lo = GFitsTableFloatCol("ENERG_LO", 1, m_energy_num);
253  GFitsTableFloatCol col_energy_hi = GFitsTableFloatCol("ENERG_HI", 1, m_energy_num);
254  GFitsTableFloatCol col_ctheta_lo = GFitsTableFloatCol("CTHETA_LO", 1, m_ctheta_num);
255  GFitsTableFloatCol col_ctheta_hi = GFitsTableFloatCol("CTHETA_HI", 1, m_ctheta_num);
256 
257  // Set column values
258  for (int i = 0; i < m_energy_num; ++i) {
259  col_energy_lo(0,i) = m_energy_lo[i];
260  col_energy_hi(0,i) = m_energy_hi[i];
261  }
262  for (int i = 0; i < m_ctheta_num; ++i) {
263  col_ctheta_lo(0,i) = m_ctheta_lo[i];
264  col_ctheta_hi(0,i) = m_ctheta_hi[i];
265  }
266 
267  // Append columns to boundary table
268  hdu.append(col_energy_lo);
269  hdu.append(col_energy_hi);
270  hdu.append(col_ctheta_lo);
271  hdu.append(col_ctheta_hi);
272 
273  // Return
274  return;
275 }
276 
277 
278 /***********************************************************************//**
279  * @brief Return table index
280  *
281  * @param[in] ie Energy bin (starting from 0)
282  * @param[in] ic cos theta bin (starting from 0)
283  *
284  * @exception GException::out_of_range
285  * Energy or cos theta bin index out of range
286  *
287  * Computes table index from energy and cos theta bin indices.
288  ***************************************************************************/
289 int GLATResponseTable::index(const int& ie, const int& ic) const
290 {
291  // Optionally check if the index is valid
292  #if defined(G_RANGE_CHECK)
293  if (ie < 0 || ie >= m_energy_num ||
294  ic < 0 || ic >= m_ctheta_num) {
295  throw GException::out_of_range(G_INDEX, ie, ic,
297  }
298  #endif
299 
300  // Compute index
301  int index = ic * m_energy_num + ie;
302 
303  // Return index
304  return index;
305 }
306 
307 
308 /***********************************************************************//**
309  * @brief Return mean energy of bin (units: MeV)
310  *
311  * @param[in] ie Index of energy bin (starting from 0)
312  *
313  * @exception GException::out_of_range
314  * Energy bin index out of range
315  *
316  * The mean energy is actually computed from the logarithmic average of
317  * lower and upper boundaries:
318  * \f$E=10^{0.5 \times (\log{E_{\rm min}} + \log{E_{\rm max}})}\f$
319  * Note that this energy is stored in the m_energy array, hence to convert
320  * to MeV we simply have to the it to the power of 10.
321  *
322  * @todo Store also linear energies to avoid conversion.
323  ***************************************************************************/
324 double GLATResponseTable::energy(const int& ie) const
325 {
326  // Optionally check if the index is valid
327  #if defined(G_RANGE_CHECK)
328  if (ie < 0 || ie >= m_energy_num) {
330  }
331  #endif
332 
333  // Determine mean energy of bin
334  //double mean = 0.5 * (log10(m_energy_lo[ie]) + log10(m_energy_hi[ie]));
335  //double mean = m_logE[ie];
336  //double energy = pow(10.0, mean);
337 
338  // Return mean energy
339  return (m_energy[ie]);
340 }
341 
342 
343 /***********************************************************************//**
344  * @brief Set indices and weighting for bi-linear interpolation of 2D array
345  *
346  * @param[in] logE Base 10 logarithm of the energy (MeV).
347  * @param[in] ctheta Cosine of zenith angle.
348  *
349  * Bi-linear interpolation is performed in log10 of energy and in cos theta.
350  ***************************************************************************/
351 void GLATResponseTable::set(const double& logE, const double& ctheta)
352 {
353  // Flag no change of values
354  bool change = false;
355 
356  // Set energy interpolation
357  if (logE != m_last_energy) {
358  m_logE.set_value(logE);
359  m_last_energy = logE;
360  change = true;
361  }
362 
363  // Set cos(theta) interpolation
364  if (ctheta != m_last_ctheta) {
365  m_ctheta.set_value(ctheta);
366  m_last_ctheta = ctheta;
367  change = true;
368  }
369 
370  // If change occured then update interpolation indices and weighting
371  // factors
372  if (change) {
373 
374  // Set array indices for bi-linear interpolation
375  int inx_ctheta_left = m_ctheta.inx_left() * m_energy_num;
376  int inx_ctheta_right = m_ctheta.inx_right() * m_energy_num;
377  m_inx1 = m_logE.inx_left() + inx_ctheta_left;
378  m_inx2 = m_logE.inx_left() + inx_ctheta_right;
379  m_inx3 = m_logE.inx_right() + inx_ctheta_left;
380  m_inx4 = m_logE.inx_right() + inx_ctheta_right;
381 
382  // Set weighting factors for bi-linear interpolation
387 
388  } // endif: logE or ctheta changed
389 
390  // Return
391  return;
392 }
393 
394 
395 /***********************************************************************//**
396  * @brief Perform bi-linear interpolation of 2D array
397  *
398  * @param[in] logE Base 10 logarithm of the energy (MeV).
399  * @param[in] ctheta Cosine of zenith angle.
400  * @param[in] array Array to be interpolated.
401  *
402  * Bi-linear interpolation is performed in log10 of energy and in cos theta.
403  * The array is stored in a std::vector object with the logE axis varying
404  * more rapidely.
405  ***************************************************************************/
406 double GLATResponseTable::interpolate(const double& logE,
407  const double& ctheta,
408  const std::vector<double>& array)
409 {
410  // Set interpolation indices and weights
411  set(logE, ctheta);
412 
413  // Perform bi-linear interpolation
414  double value = m_wgt1 * array[m_inx1] +
415  m_wgt2 * array[m_inx2] +
416  m_wgt3 * array[m_inx3] +
417  m_wgt4 * array[m_inx4];
418 
419  // Return bi-linear interpolated value
420  return value;
421 }
422 
423 
424 /***********************************************************************//**
425  * @brief Perform bi-linear interpolation of 3D array
426  *
427  * @param[in] logE Base 10 logarithm of the energy (MeV).
428  * @param[in] ctheta Cosine of zenith angle.
429  * @param[in] array Array to be interpolated.
430  * @param[in] offset Offset if 3D array in 1st dimension.
431  * @param[in] size Size of 3D array in 1st dimension.
432  *
433  * Bi-linear interpolation is performed in log10 of energy and in cos theta.
434  * The array is stored in a std::vector object.
435  ***************************************************************************/
436 double GLATResponseTable::interpolate(const double& logE,
437  const double& ctheta,
438  const std::vector<double>& array,
439  const int& offset,
440  const int& size)
441 {
442  // Set interpolation indices and weights
443  set(logE, ctheta);
444 
445  // Perform bi-linear interpolation
446  double value = m_wgt1 * array[m_inx1*size+offset] +
447  m_wgt2 * array[m_inx2*size+offset] +
448  m_wgt3 * array[m_inx3*size+offset] +
449  m_wgt4 * array[m_inx4*size+offset];
450 
451  // Return bi-linear interpolated value
452  return value;
453 }
454 
455 
456 /***********************************************************************//**
457  * @brief Return lower bin energy (units: MeV)
458  *
459  * @param[in] inx Index of energy bin (starting from 0)
460  *
461  * @exception GException::out_of_range
462  * Energy bin index out of range
463  ***************************************************************************/
464 double GLATResponseTable::energy_lo(const int& inx) const
465 {
466  // Optionally check if the index is valid
467  #if defined(G_RANGE_CHECK)
468  if (inx < 0 || inx >= m_energy_num) {
470  }
471  #endif
472 
473  // Return mean energy
474  return m_energy_lo[inx];
475 }
476 
477 
478 /***********************************************************************//**
479  * @brief Return upper bin energy (units: MeV)
480  *
481  * @param[in] inx Index of energy bin (starting from 0)
482  *
483  * @exception GException::out_of_range
484  * Energy bin index out of range
485  ***************************************************************************/
486 double GLATResponseTable::energy_hi(const int& inx) const
487 {
488  // Optionally check if the index is valid
489  #if defined(G_RANGE_CHECK)
490  if (inx < 0 || inx >= m_energy_num) {
492  }
493  #endif
494 
495  // Return mean energy
496  return m_energy_hi[inx];
497 }
498 
499 
500 /***********************************************************************//**
501  * @brief Return lower bin cos theta
502  *
503  * @param[in] inx Index of cos theta bin (starting from 0)
504  *
505  * @exception GException::out_of_range
506  * Cos theta bin index out of range
507  ***************************************************************************/
508 double GLATResponseTable::costheta_lo(const int& inx) const
509 {
510  // Optionally check if the index is valid
511  #if defined(G_RANGE_CHECK)
512  if (inx < 0 || inx >= m_ctheta_num) {
514  }
515  #endif
516 
517  // Return mean energy
518  return m_ctheta_lo[inx];
519 }
520 
521 
522 /***********************************************************************//**
523  * @brief Return upper bin cos theta
524  *
525  * @param[in] inx Index of cos theta bin (starting from 0)
526  *
527  * @exception GException::out_of_range
528  * Cos theta bin index out of range
529  ***************************************************************************/
530 double GLATResponseTable::costheta_hi(const int& inx) const
531 {
532  // Optionally check if the index is valid
533  #if defined(G_RANGE_CHECK)
534  if (inx < 0 || inx >= m_ctheta_num) {
536  }
537  #endif
538 
539  // Return mean energy
540  return m_ctheta_hi[inx];
541 }
542 
543 
544 /***********************************************************************//**
545  * @brief Return indices of 4 corners used for interpolation
546  ***************************************************************************/
547 std::vector<int> GLATResponseTable::indices(void) const
548 {
549  // Define vector
550  std::vector<int> incides;
551 
552  // Push indices on vector
553  incides.push_back(m_inx1);
554  incides.push_back(m_inx2);
555  incides.push_back(m_inx3);
556  incides.push_back(m_inx4);
557 
558  // Return vector
559  return incides;
560 }
561 
562 
563 /***********************************************************************//**
564  * @brief Return energies of 4 corners used for interpolation
565  ***************************************************************************/
566 std::vector<double> GLATResponseTable::energies(void) const
567 {
568  // Define vector
569  std::vector<double> energies;
570 
571  // Push energies on vector
572  if (m_energy_num > 0) {
573  energies.push_back(m_energy[m_logE.inx_left()]);
574  energies.push_back(m_energy[m_logE.inx_left()]);
575  energies.push_back(m_energy[m_logE.inx_right()]);
576  energies.push_back(m_energy[m_logE.inx_right()]);
577  }
578 
579  // Return vector
580  return energies;
581 }
582 
583 
584 /***********************************************************************//**
585  * @brief Return weights of 4 corners used for interpolation
586  ***************************************************************************/
587 std::vector<double> GLATResponseTable::weights(void) const
588 {
589  // Define vector
590  std::vector<double> weights;
591 
592  // Push indices on vector
593  weights.push_back(m_wgt1);
594  weights.push_back(m_wgt2);
595  weights.push_back(m_wgt3);
596  weights.push_back(m_wgt4);
597 
598  // Return vector
599  return weights;
600 }
601 
602 
603 /***********************************************************************//**
604  * @brief Print response table information
605  *
606  * @param[in] chatter Chattiness (defaults to NORMAL).
607  * @return String containing response table information.
608  ***************************************************************************/
609 std::string GLATResponseTable::print(const GChatter& chatter) const
610 {
611  // Initialise result string
612  std::string result;
613 
614  // Continue only if chatter is not silent
615  if (chatter != SILENT) {
616 
617  // Append header
618  result.append("=== GLATResponseTable ===");
619 
620  // Append information
621  result.append("\n"+gammalib::parformat("Number of energy bins") +
623  result.append("\n"+gammalib::parformat("Number of cos theta bins") +
625 
626  } // endif: chatter was not silent
627 
628  // Return result
629  return result;
630 }
631 
632 
633 /*==========================================================================
634  = =
635  = Private methods =
636  = =
637  ==========================================================================*/
638 
639 /***********************************************************************//**
640  * @brief Initialise class members
641  ***************************************************************************/
643 {
644  // Initialise members
645  m_energy_num = 0;
646  m_ctheta_num = 0;
647  m_energy.clear();
648  m_logE.clear();
649  m_ctheta.clear();
650  m_energy_lo = NULL;
651  m_energy_hi = NULL;
652  m_ctheta_lo = NULL;
653  m_ctheta_hi = NULL;
654  m_last_energy = -1.0;
655  m_last_ctheta = -1.0;
656  m_inx1 = 0;
657  m_inx2 = 0;
658  m_inx3 = 0;
659  m_inx4 = 0;
660  m_wgt1 = 0.0;
661  m_wgt2 = 0.0;
662  m_wgt3 = 0.0;
663  m_wgt4 = 0.0;
664 
665  // Return
666  return;
667 }
668 
669 
670 /***********************************************************************//**
671  * @brief Copy class members
672  *
673  * @param[in] table Response table.
674  ***************************************************************************/
676 {
677  // Copy number of bins
678  m_energy_num = table.m_energy_num;
679  m_ctheta_num = table.m_ctheta_num;
680  m_energy = table.m_energy;
681  m_logE = table.m_logE;
682  m_ctheta = table.m_ctheta;
685  m_inx1 = table.m_inx1;
686  m_inx2 = table.m_inx2;
687  m_inx3 = table.m_inx3;
688  m_inx4 = table.m_inx4;
689  m_wgt1 = table.m_wgt1;
690  m_wgt2 = table.m_wgt2;
691  m_wgt3 = table.m_wgt3;
692  m_wgt4 = table.m_wgt4;
693 
694  // Copy energy bins
695  if (m_energy_num > 0) {
696  m_energy_lo = new double[m_energy_num];
697  m_energy_hi = new double[m_energy_num];
698  for (int i=0; i < m_energy_num; ++i) {
699  m_energy_lo[i] = table.m_energy_lo[i];
700  m_energy_hi[i] = table.m_energy_hi[i];
701  }
702  }
703 
704  // Copy cos theta bins
705  if (m_ctheta_num > 0) {
706  m_ctheta_lo = new double[m_ctheta_num];
707  m_ctheta_hi = new double[m_ctheta_num];
708  for (int i=0; i < m_ctheta_num; ++i) {
709  m_ctheta_lo[i] = table.m_ctheta_lo[i];
710  m_ctheta_hi[i] = table.m_ctheta_hi[i];
711  }
712  }
713 
714  // Return
715  return;
716 }
717 
718 
719 /***********************************************************************//**
720  * @brief Delete class members
721  ***************************************************************************/
723 {
724  // Free memory
725  if (m_energy_lo != NULL) delete [] m_energy_lo;
726  if (m_energy_hi != NULL) delete [] m_energy_hi;
727  if (m_ctheta_lo != NULL) delete [] m_ctheta_lo;
728  if (m_ctheta_hi != NULL) delete [] m_ctheta_hi;
729 
730  // Signal that memory is free
731  m_energy_lo = NULL;
732  m_energy_hi = NULL;
733  m_ctheta_lo = NULL;
734  m_ctheta_hi = NULL;
735 
736  // Return
737  return;
738 }
int m_ctheta_num
Number of cos theta bins in table.
void number(const int &number)
Set number of elements in column.
double costheta_hi(const int &inx) const
Return upper bin cos theta.
void read(const GFitsTable &hdu)
Read response table from FITS table HDU.
#define G_INDEX
double m_wgt4
Weighting factor 4.
std::vector< double > energies(void) const
Return energies of 4 corners used for interpolation.
const double & wgt_left(void) const
Returns left node weight.
Definition: GNodeArray.hpp:260
void clear(void)
Clear node array.
Definition: GNodeArray.cpp:235
Fermi-LAT response table class definition.
void clear(void)
Clear instance.
GFitsTableCol * append(const GFitsTableCol &column)
Append column to the table.
Definition: GFitsTable.hpp:147
void write(GFitsTable &hdu) const
Write response table into FITS table.
GNodeArray m_logE
Energy nodes (log10 mean energy)
GLATResponseTable(void)
Void constructor.
Gammalib tools definition.
FITS table float column class interface definition.
void set_value(const double &value) const
Set indices and weighting factors for interpolation.
Definition: GNodeArray.cpp:580
void init_members(void)
Initialise class members.
GNodeArray m_ctheta
cos(theta) nodes
#define G_ENERGY
double m_last_ctheta
Last requested cos(theta) for interpolation.
virtual ~GLATResponseTable(void)
Destructor.
double interpolate(const double &logE, const double &ctheta, const std::vector< double > &array)
Perform bi-linear interpolation of 2D array.
double energy_hi(const int &inx) const
Return upper bin energy (units: MeV)
void free_members(void)
Delete class members.
std::string print(const GChatter &chatter=NORMAL) const
Print response table information.
const double & wgt_right(void) const
Returns right node weight.
Definition: GNodeArray.hpp:275
const int & nenergies(void) const
Return number of energies in response table.
#define G_COSTHETA_HI
GLATResponseTable * clone(void) const
Clone instance.
#define G_COSTHETA_LO
Abstract interface for FITS table column.
Interface for the Fermi LAT Response table class.
void copy_members(const GLATResponseTable &table)
Copy class members.
const int & ncostheta(void) const
Return number of cosine theta bins in response table.
Abstract interface for FITS table.
Definition: GFitsTable.hpp:44
#define G_ENERGY_HI
GChatter
Definition: GTypemaps.hpp:33
const int & inx_left(void) const
Returns left node index.
Definition: GNodeArray.hpp:231
GLATResponseTable & operator=(const GLATResponseTable &table)
Assignment operator.
int m_energy_num
Number of energy bins in table.
#define G_ENERGY_LO
void nodes(const int &num, const double *array)
Set node array.
Definition: GNodeArray.cpp:325
const int & inx_right(void) const
Returns right node index.
Definition: GNodeArray.hpp:245
double * m_ctheta_lo
cos(theta) bins lower boundary
double * m_energy_hi
Energy bins upper boundary (MeV)
std::vector< double > m_energy
Energy nodes (MeV)
void set(const double &logE, const double &ctheta)
Set indices and weighting for bi-linear interpolation of 2D array.
int index(const int &ie, const int &ic) const
Return table index.
virtual double real(const int &row, const int &inx=0) const =0
double m_wgt1
Weighting factor 1.
GVector pow(const GVector &vector, const double &power)
Computes tanh of vector elements.
Definition: GVector.cpp:1332
Exception handler interface definition.
double costheta_lo(const int &inx) const
Return lower bin cos theta.
FITS table float column.
double * m_energy_lo
Energy bins lower boundary (MeV)
double m_wgt2
Weighting factor 2.
double energy_lo(const int &inx) const
Return lower bin energy (units: MeV)
double * m_ctheta_hi
cos(theta) bins upper boundary
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
Definition: GTools.cpp:1022
double energy(const int &ie) const
Return mean energy of bin (units: MeV)
double m_last_energy
Last requested energy for interpolation.
std::vector< double > weights(void) const
Return weights of 4 corners used for interpolation.
GVector log10(const GVector &vector)
Computes base10 logarithm of vector elements.
Definition: GVector.cpp:1205
std::vector< int > indices(void) const
Return indices of 4 corners used for interpolation.
double m_wgt3
Weighting factor 3.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
Definition: GTools.cpp:413