GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GLATAeff.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GLATAeff.cpp - Fermi LAT effective area *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2008-2018 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 GLATAeff.cpp
23  * @brief Fermi LAT effective area class implementation
24  * @author Juergen Knoedlseder
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include "GTools.hpp"
32 #include "GException.hpp"
33 #include "GFilename.hpp"
34 #include "GEnergy.hpp"
35 #include "GFits.hpp"
36 #include "GFitsTable.hpp"
37 #include "GFitsBinTable.hpp"
38 #include "GFitsTableCol.hpp"
39 #include "GFitsTableFloatCol.hpp"
40 #include "GLATAeff.hpp"
41 #include "GLATException.hpp"
42 
43 /* __ Method name definitions ____________________________________________ */
44 #define G_READ_AEFF "GLATAeff::read_aeff(GFitsTable&)"
45 
46 /* __ Macros _____________________________________________________________ */
47 
48 /* __ Coding definitions _________________________________________________ */
49 
50 /* __ Debug definitions __________________________________________________ */
51 
52 /* __ Constants __________________________________________________________ */
53 
54 
55 /*==========================================================================
56  = =
57  = Constructors/destructors =
58  = =
59  ==========================================================================*/
60 
61 /***********************************************************************//**
62  * @brief Void constructor
63  ***************************************************************************/
65 {
66  // Initialise class members
67  init_members();
68 
69  // Return
70  return;
71 }
72 
73 
74 /***********************************************************************//**
75  * @brief File constructor
76  *
77  * @param[in] filename FITS file name.
78  * @param[in] evtype Event type.
79  *
80  * Construct instance by loading the information from a FITS file. Both the
81  * effective area information and the efficiency factor parameters are loaded
82  * when available.
83  ***************************************************************************/
84 GLATAeff::GLATAeff(const GFilename& filename, const std::string& evtype)
85 {
86  // Initialise class members
87  init_members();
88 
89  // Load effective area from file
90  load(filename, evtype);
91 
92  // Return
93  return;
94 }
95 
96 
97 /***********************************************************************//**
98  * @brief Copy constructor
99  *
100  * @param[in] aeff Effective area.
101  ***************************************************************************/
103 {
104  // Initialise class members
105  init_members();
106 
107  // Copy members
108  copy_members(aeff);
109 
110  // Return
111  return;
112 }
113 
114 
115 /***********************************************************************//**
116  * @brief Destructor
117  ***************************************************************************/
119 {
120  // Free members
121  free_members();
122 
123  // Return
124  return;
125 }
126 
127 
128 /*==========================================================================
129  = =
130  = Operators =
131  = =
132  ==========================================================================*/
133 
134 /***********************************************************************//**
135  * @brief Assignment operator
136  *
137  * @param[in] aeff Effective area.
138  * @return Effective area.
139  ***************************************************************************/
141 {
142  // Execute only if object is not identical
143  if (this != &aeff) {
144 
145  // Free members
146  free_members();
147 
148  // Initialise private members
149  init_members();
150 
151  // Copy members
152  copy_members(aeff);
153 
154  } // endif: object was not identical
155 
156  // Return this object
157  return *this;
158 }
159 
160 
161 /***********************************************************************//**
162  * @brief Return effective area in units of cm2
163  *
164  * @param[in] logE Log10 of the true photon energy (MeV).
165  * @param[in] ctheta Cosine of zenith angle.
166  *
167  * Returns the effective area in units of cm2 for a given energy and
168  * cos(theta) angle. The effective area is bi-linearily interpolated in the
169  * log10(energy) - cos(theta) plane. The method assures that the effective
170  * area value never becomes negative.
171  ***************************************************************************/
172 double GLATAeff::operator()(const double& logE, const double& ctheta)
173 {
174  // Get effective area value
175  double aeff = (ctheta >= m_min_ctheta)
176  ? m_aeff_bins.interpolate(logE, ctheta, m_aeff) : 0.0;
177 
178  // Make sure that effective area is not negative
179  if (aeff < 0.0) {
180  aeff = 0.0;
181  }
182 
183  // Return effective area value
184  return aeff;
185 }
186 
187 
188 /***********************************************************************//**
189  * @brief Return effective area in units of cm2
190  *
191  * @param[in] logE Log10 of the true photon energy (MeV).
192  * @param[in] ctheta Cosine of zenith angle.
193  * @param[in] phi Azimuth angle.
194  *
195  * Returns the effective area in units of cm2 for a given energy, cos(theta)
196  * angle and azimuth angle. The effective area is bi-linearily interpolated
197  * in the log10(energy) - cos(theta) plane. The method assures that the
198  * effective area value never becomes negative.
199  *
200  * @todo Phi-dependence not yet implemented.
201  ***************************************************************************/
202 double GLATAeff::operator()(const double& logE, const double& ctheta,
203  const double& phi)
204 {
205  // Get effective area value
206  double aeff = (ctheta >= m_min_ctheta)
207  ? m_aeff_bins.interpolate(logE, ctheta, m_aeff) : 0.0;
208 
209  // Make sure that effective area is not negative
210  if (aeff < 0.0) {
211  aeff = 0.0;
212  }
213 
214  // Return effective area value
215  return aeff;
216 }
217 
218 
219 /*==========================================================================
220  = =
221  = Public methods =
222  = =
223  ==========================================================================*/
224 
225 /***********************************************************************//**
226  * @brief Clear effective area
227  *
228  * This method properly resets the object to an initial state.
229  ***************************************************************************/
230 void GLATAeff::clear(void)
231 {
232  // Free class members
233  free_members();
234 
235  // Initialise members
236  init_members();
237 
238  // Return
239  return;
240 }
241 
242 
243 /***********************************************************************//**
244  * @brief Clone effective area
245  *
246  * @return Pointer to deep copy of effective area.
247  ***************************************************************************/
249 {
250  return new GLATAeff(*this);
251 }
252 
253 
254 /***********************************************************************//**
255  * @brief Load effective area from FITS file
256  *
257  * @param[in] filename FITS file.
258  * @param[in] evtype Event type.
259  *
260  * This method loads the effective area information, and if available, the
261  * efficiency factors, from the FITS response file. See the GLATAeff::read
262  * method for details.
263  ***************************************************************************/
264 void GLATAeff::load(const GFilename& filename, const std::string& evtype)
265 {
266  // Open FITS file
267  GFits fits(filename);
268 
269  // Read effective area from file
270  read(fits, evtype);
271 
272  // Return
273  return;
274 }
275 
276 
277 /***********************************************************************//**
278  * @brief Save effective area into FITS file
279  *
280  * @param[in] filename FITS file.
281  * @param[in] clobber Overwrite existing file? (default: false)
282  *
283  * This method saves the effective area information, and if available, the
284  * efficiency factors, into the FITS response file. See the GLATAeff::write
285  * method for details.
286  ***************************************************************************/
287 void GLATAeff::save(const GFilename& filename, const bool& clobber)
288 {
289  // Create FITS file
290  GFits fits;
291 
292  // Write effective area into file
293  write(fits);
294 
295  // Close FITS file
296  fits.saveto(filename, clobber);
297 
298  // Return
299  return;
300 }
301 
302 
303 /***********************************************************************//**
304  * @brief Read effective area from FITS file
305  *
306  * @param[in] fits FITS file.
307  * @param[in] evtype Event type.
308  *
309  * Reads the effective area and efficiency parameter information form the
310  * FITS file. The effective area is read from the extension `EFFECTIVE AREA`
311  * (or `EFFECTIVE AREA_<evtype>` for Pass 8), the efficiency parameter
312  * information from the extension `EFFICIENCY_PARAMS` (or
313  * `EFFICIENCY_PARAMS_<evtype>` for Pass 8). If the latter extension does not
314  * exist, no efficiency parameters will be loaded.
315  *
316  * @todo Implement reading of Phi-dependence information.
317  ***************************************************************************/
318 void GLATAeff::read(const GFits& fits, const std::string& evtype)
319 {
320  // Clear instance
321  clear();
322 
323  // Store event type
324  m_evtype = evtype;
325 
326  // Set extension names
327  std::string effarea = gammalib::extname_lat_aeff;
328  std::string effparms = gammalib::extname_lat_efficiency;
329  if (!fits.contains(effarea)) {
330  effarea += "_" + m_evtype;
331  }
332  if (!fits.contains(effparms)) {
333  effparms += "_" + m_evtype;
334  }
335 
336  // Get pointer to effective area HDU
337  const GFitsTable& hdu_aeff = *fits.table(effarea);
338 
339  // Read effective area
340  read_aeff(hdu_aeff);
341 
342  // Read efficiency factors from appropriate HDU. Does nothing if the
343  // HDU does not exist.
344  if (fits.contains(effparms)) {
345  const GFitsTable& hdu_eff = *fits.table(effparms);
346  read_efficiency(hdu_eff);
347  }
348 
349  // Return
350  return;
351 }
352 
353 
354 /***********************************************************************//**
355  * @brief Write effective area into FITS file
356  *
357  * @param[in] fits FITS file.
358  *
359  * @todo Write also phi and rate HDUs if they exist.
360  ***************************************************************************/
361 void GLATAeff::write(GFits& fits) const
362 {
363  // Write effective area
364  write_aeff(fits);
365 
366  // Write efficiency factors
367  write_efficiency(fits);
368 
369  // Return
370  return;
371 }
372 
373 
374 /***********************************************************************//**
375  * @brief Signals whether efficiency factors are present
376  *
377  * Verifies whether 2 efficiency factors are present. If efficiency factors
378  * are included in the effective area FITS file, they will be automatically
379  * loaded from the file, and efficiency factor functors will be allocated.
380  * Otherwise, the functors point towards NULL.
381  *
382  * The method returns true if both efficiency factor functors exist, false
383  * otherwise.
384  ***************************************************************************/
385 bool GLATAeff::has_efficiency(void) const
386 {
387  // Return
388  return (m_eff_func1 != NULL && m_eff_func2 != NULL);
389 }
390 
391 
392 /***********************************************************************//**
393  * @brief Returns efficiency factor 1
394  *
395  * @param[in] srcEng True energy of photon.
396  *
397  * Returns the efficiency factor 1 as function of the true photon energy.
398  *
399  * If no efficiency factors are present returns 1.
400  *
401  * @todo Implement cache to save computation time if called with same energy
402  * value (happens for binned analysis for example)
403  ***************************************************************************/
404 double GLATAeff::efficiency_factor1(const GEnergy& srcEng) const
405 {
406  // Initialise factor
407  double factor = 1.0;
408 
409  // Compute efficiency factor. Note that the factor 1 uses the functor 2,
410  // following the philosophy implemented in the ScienceTools method
411  // EfficiencyFactor::getLivetimeFactors
412  if (m_eff_func2 != NULL) {
413  factor = (*m_eff_func2)(srcEng.log10MeV());
414  }
415 
416  // Return factor
417  return factor;
418 }
419 
420 
421 /***********************************************************************//**
422  * @brief Returns efficiency factor 2
423  *
424  * @param[in] srcEng True energy of photon.
425  *
426  * Returns the efficiency factor 2 as function of the true photon energy.
427  *
428  * If no efficiency factors are present returns 2.
429  *
430  * @todo Implement cache to save computation time if called with same energy
431  * value (happens for binned analysis for example)
432  ***************************************************************************/
433 double GLATAeff::efficiency_factor2(const GEnergy& srcEng) const
434 {
435  // Initialise factor
436  double factor = 0.0;
437 
438  // Compute efficiency factor. Note that the factor 2 uses the functor 1,
439  // following the philosophy implemented in the ScienceTools method
440  // EfficiencyFactor::getLivetimeFactors
441  if (m_eff_func1 != NULL) {
442  factor = (*m_eff_func1)(srcEng.log10MeV());
443  }
444 
445  // Return factor
446  return factor;
447 }
448 
449 
450 /***********************************************************************//**
451  * @brief Print effective area information
452  *
453  * @param[in] chatter Chattiness.
454  * @return String containing effective area information.
455  ***************************************************************************/
456 std::string GLATAeff::print(const GChatter& chatter) const
457 {
458  // Initialise result string
459  std::string result;
460 
461  // Continue only if chatter is not silent
462  if (chatter != SILENT) {
463 
464  // Append header
465  result.append("=== GLATAeff ===");
466 
467  // Append information
468  result.append("\n"+gammalib::parformat("Number of energy bins") +
470  result.append("\n"+gammalib::parformat("Number of cos theta bins") +
472  result.append("\n"+gammalib::parformat("Detector section")+m_evtype);
473  result.append("\n"+gammalib::parformat("Efficiency factors"));
474  if (has_efficiency()) {
475  result.append("present");
476  }
477  else {
478  result.append("absent");
479  }
480 
481  } // endif: chatter was not silent
482 
483  // Return result
484  return result;
485 }
486 
487 
488 /*==========================================================================
489  = =
490  = Private methods =
491  = =
492  ==========================================================================*/
493 
494 /***********************************************************************//**
495  * @brief Initialise class members
496  ***************************************************************************/
498 {
499  // Initialise members
500  m_evtype.clear();
501  m_aeff_bins.clear();
502  m_aeff.clear();
503  m_min_ctheta = 0.0;
504  m_eff_func1 = NULL;
505  m_eff_func2 = NULL;
506 
507  // Return
508  return;
509 }
510 
511 
512 /***********************************************************************//**
513  * @brief Copy class members
514  *
515  * @param[in] aeff Effective area.
516  ***************************************************************************/
518 {
519  // Copy attributes
520  m_evtype = aeff.m_evtype;
521  m_aeff_bins = aeff.m_aeff_bins;
522  m_aeff = aeff.m_aeff;
523  m_min_ctheta = aeff.m_min_ctheta;
524 
525  // Clone functors
526  m_eff_func1 = (aeff.m_eff_func1 != NULL) ? aeff.m_eff_func1->clone() : NULL;
527  m_eff_func2 = (aeff.m_eff_func2 != NULL) ? aeff.m_eff_func2->clone() : NULL;
528 
529  // Return
530  return;
531 }
532 
533 
534 /***********************************************************************//**
535  * @brief Delete class members
536  ***************************************************************************/
538 {
539  // Free functors
540  if (m_eff_func1 != NULL) delete m_eff_func1;
541  if (m_eff_func2 != NULL) delete m_eff_func2;
542 
543  // Signal that no functors are allocated
544  m_eff_func1 = NULL;
545  m_eff_func2 = NULL;
546 
547  // Return
548  return;
549 }
550 
551 
552 /***********************************************************************//**
553  * @brief Read effective area from FITS table
554  *
555  * @param[in] hdu FITS table.
556  *
557  * @exception GLATException::inconsistent_response
558  * Inconsistent response table encountered
559  *
560  * The effective area is converted into units of cm2.
561  ***************************************************************************/
563 {
564  // Clear array
565  m_aeff.clear();
566 
567  // Get energy and cos theta bins in response table
568  m_aeff_bins.read(hdu);
569 
570  // Set minimum cos(theta)
572 
573  // Continue only if there are effective area bins
574  int size = m_aeff_bins.size();
575  if (size > 0) {
576 
577  // Allocate arrays
578  m_aeff.reserve(size);
579 
580  // Get pointer to effective area column
581  const GFitsTableCol* ptr = hdu["EFFAREA"];
582 
583  // Check consistency of effective area table
584  int num = ptr->number();
585  if (num != size) {
587  }
588 
589  // Copy data and convert from m2 into cm2
590  for (int i = 0; i < size; ++i) {
591  m_aeff.push_back(ptr->real(0,i) * 1.0e4);
592  }
593 
594  } // endif: there were effective area bins
595 
596  // Set event type using the DETNAM keyword in the HDU
597  m_evtype = gammalib::strip_whitespace(hdu.string("DETNAM"));
598 
599  // Return
600  return;
601 }
602 
603 
604 /***********************************************************************//**
605  * @brief Write effective area into FITS file
606  *
607  * @param[in] file FITS file.
608  *
609  * This method does not write anything if the instance is empty.
610  ***************************************************************************/
611 void GLATAeff::write_aeff(GFits& file) const
612 {
613  // Continue only if there are bins
614  int size = m_aeff_bins.size();
615  if (size > 0) {
616 
617  // Create new binary table
618  GFitsBinTable aeff;
619 
620  // Set table attributes
622 
623  // Write boundaries into table
624  m_aeff_bins.write(aeff);
625 
626  // Allocate floating point vector columns
627  GFitsTableFloatCol col_aeff = GFitsTableFloatCol("EFFAREA", 1, size);
628 
629  // Fill columns, converting from cm2 into m2
630  for (int i = 0; i < size; ++i) {
631  col_aeff(0,i) = m_aeff[i] * 1.0e-4;
632  }
633 
634  // Append columns to table
635  aeff.append(col_aeff);
636 
637  // Set event type using the DETNAM keyword in the HDU
638  aeff.card("DETNAM", m_evtype, "Event type");
639 
640  // Append HDU to FITS file
641  file.append(aeff);
642 
643  } // endif: there were data to write
644 
645  // Return
646  return;
647 }
648 
649 
650 /***********************************************************************//**
651  * @brief Read efficiency factor parameters from FITS table
652  *
653  * @param[in] hdu FITS table.
654  *
655  * Reads the efficiency factor parameters from the EFFICIENCY_PARS column of
656  * the EFFICIENCY_PARAMS extension in the effective area file. Note that the
657  * column contains efficiency factor parameters for the front and back
658  * section of the LAT detector, and we read here only those factors that
659  * apply to the section for which the effective area has been defined. In
660  * that way, we keep the efficiency factors separate for each detector
661  * section, which is more precise than the handling in ScienceTools which
662  * apply average efficiency factors.
663  *
664  * This method does not read efficiency factor parameters if neither the
665  * front nor the back section of the detector has been identified.
666  ***************************************************************************/
668 {
669  // Free any existing functors
670  if (m_eff_func1 != NULL) delete m_eff_func1;
671  if (m_eff_func2 != NULL) delete m_eff_func2;
672 
673  // Signal that no functors are allocated
674  m_eff_func1 = NULL;
675  m_eff_func2 = NULL;
676 
677  // Get pointer to efficiency factors column
678  const GFitsTableCol* ptr = hdu["EFFICIENCY_PARS"];
679 
680  // Allocate vectors to hold the parameters
681  std::vector<double> par1;
682  std::vector<double> par2;
683 
684  // If we have 2 rows in the table we have a Pass 8 response and hence
685  // the table only applies to the specific event type
686  if (ptr->nrows() == 2) {
687  for (int i = 0; i < 6; ++i) {
688  par1.push_back(ptr->real(0,i));
689  par2.push_back(ptr->real(1,i));
690  }
691  }
692 
693  // ... otherwise we have an earlier response, and the front parameters
694  // are stored in the first 2 rows while the back parameters are stored
695  // in the second 2 rows
696  else {
697 
698  // If we have a front section then read the front parameters
699  if (m_evtype == "FRONT") {
700  for (int i = 0; i < 6; ++i) {
701  par1.push_back(ptr->real(0,i));
702  par2.push_back(ptr->real(1,i));
703  }
704  }
705 
706  // If we have a back section then read the back parameters
707  else if (m_evtype == "BACK") {
708  for (int i = 0; i < 6; ++i) {
709  par1.push_back(ptr->real(2,i));
710  par2.push_back(ptr->real(3,i));
711  }
712  }
713  }
714 
715  // If we have parameters, then allocate the efficiency factor
716  // functors now
717  if (par1.size() == 6) {
718  m_eff_func1 = new GLATEfficiency(par1);
719  }
720  if (par2.size() == 6) {
721  m_eff_func2 = new GLATEfficiency(par2);
722  }
723 
724  // Return
725  return;
726 }
727 
728 
729 /***********************************************************************//**
730  * @brief Write efficiency factors into FITS file
731  *
732  * @param[in] file FITS file.
733  *
734  * Writes efficiency factors into FITS file. The Pass 8 response format is
735  * used for writing the factors.
736  ***************************************************************************/
738 {
739  // Continue only if there are efficiency factors
740  if (has_efficiency()) {
741 
742  // Create binary table
743  GFitsBinTable efficiency;
744 
745  // Set table attributes
747 
748  // Allocate floating point vector columns
749  GFitsTableFloatCol col_eff = GFitsTableFloatCol("EFFICIENCY_PARS", 2, 6);
750 
751  // Get efficiency parameters
752  std::vector<double> par1 = m_eff_func1->pars();
753  std::vector<double> par2 = m_eff_func2->pars();
754 
755  // Fill columns (Pass 8 response format)
756  for (int i = 0; i < par1.size(); ++i) {
757  col_eff(0,i) = par1[i];
758  }
759  for (int i = 0; i < par2.size(); ++i) {
760  col_eff(1,i) = par2[i];
761  }
762 
763  // Append columns to table
764  efficiency.append(col_eff);
765 
766  // Append HDU to FITS file
767  file.append(efficiency);
768 
769  } // endif: there were efficiency factors
770 
771  // Return
772  return;
773 }
GLATEfficiency * m_eff_func1
Efficiency functor 1.
Definition: GLATAeff.hpp:111
int size(void) const
Return number of bins in effective area response.
Definition: GLATAeff.hpp:146
void load(const GFilename &filename, const std::string &evtype)
Load effective area from FITS file.
Definition: GLATAeff.cpp:264
void number(const int &number)
Set number of elements in column.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
Definition: GFits.cpp:472
bool contains(const int &extno) const
Check if HDU exists in FITS file.
Definition: GFits.hpp:282
GLATAeff & operator=(const GLATAeff &aeff)
Assignment operator.
Definition: GLATAeff.cpp:140
void free_members(void)
Delete class members.
Definition: GLATAeff.cpp:537
Energy value class definition.
void read(const GFitsTable &hdu)
Read response table from FITS table HDU.
double m_min_ctheta
Minimum valid cos(theta)
Definition: GLATAeff.hpp:110
const std::string extname_lat_aeff
Definition: GLATAeff.hpp:45
const std::string extname_lat_efficiency
Definition: GLATAeff.hpp:46
void nrows(const int &nrows)
Set number of rows in column.
std::vector< double > pars(void) const
Return efficiency parameters.
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.
Interface for the Fermi/LAT efficiency factor functor.
Gammalib tools definition.
FITS table float column class interface definition.
void write_efficiency(GFits &file) const
Write efficiency factors into FITS file.
Definition: GLATAeff.cpp:737
std::string print(const GChatter &chatter=NORMAL) const
Print effective area information.
Definition: GLATAeff.cpp:456
FITS file class.
Definition: GFits.hpp:63
FITS file class interface definition.
std::string strip_whitespace(const std::string &arg)
Strip leading and trailing whitespace from string.
Definition: GTools.cpp:73
GLATAeff(void)
Void constructor.
Definition: GLATAeff.cpp:64
FITS table column abstract base class definition.
GLATEfficiency * clone(void) const
Clone efficiency factor functor.
double log10MeV(void) const
Return log10 of energy in MeV.
Definition: GEnergy.cpp:423
double interpolate(const double &logE, const double &ctheta, const std::vector< double > &array)
Perform bi-linear interpolation of 2D array.
void saveto(const GFilename &filename, const bool &clobber=false)
Saves to specified FITS file.
Definition: GFits.cpp:1267
LAT exception handler interface definition.
Filename class.
Definition: GFilename.hpp:62
Abstract interface for FITS table column.
void read_aeff(const GFitsTable &hdu)
Read effective area from FITS table.
Definition: GLATAeff.cpp:562
void copy_members(const GLATAeff &aeff)
Copy class members.
Definition: GLATAeff.cpp:517
void read_efficiency(const GFitsTable &hdu)
Read efficiency factor parameters from FITS table.
Definition: GLATAeff.cpp:667
Abstract interface for FITS table.
Definition: GFitsTable.hpp:44
GChatter
Definition: GTypemaps.hpp:33
Interface for the Fermi/LAT effective area.
Definition: GLATAeff.hpp:59
void write_aeff(GFits &file) const
Write effective area into FITS file.
Definition: GLATAeff.cpp:611
double operator()(const double &logE, const double &ctheta)
Return effective area in units of cm2.
Definition: GLATAeff.cpp:172
void write(GFits &file) const
Write effective area into FITS file.
Definition: GLATAeff.cpp:361
const std::string & extname(void) const
Return extension name.
Definition: GFitsHDU.hpp:162
double efficiency_factor1(const GEnergy &srcEng) const
Returns efficiency factor 1.
Definition: GLATAeff.cpp:404
int nenergies(void) const
Return number of energies in effective area response.
Definition: GLATAeff.hpp:158
int ncostheta(void) const
Return number of cosine theta bins in effective area response.
Definition: GLATAeff.hpp:170
GLATResponseTable m_aeff_bins
Aeff energy and cos theta binning.
Definition: GLATAeff.hpp:108
#define G_READ_AEFF
Definition: GLATAeff.cpp:44
void clear(void)
Clear effective area.
Definition: GLATAeff.cpp:230
virtual double real(const int &row, const int &inx=0) const =0
FITS binary table class.
const std::string & evtype(void) const
Return event type.
Definition: GLATAeff.hpp:134
std::string string(const std::string &keyname) const
Return card value as string.
Definition: GFitsHDU.hpp:410
std::vector< double > m_aeff
Aeff array.
Definition: GLATAeff.hpp:109
Exception handler interface definition.
GFitsHDU * append(const GFitsHDU &hdu)
Append HDU to FITS file.
Definition: GFits.cpp:665
FITS binary table class definition.
double costheta_lo(const int &inx) const
Return lower bin cos theta.
GLATEfficiency * m_eff_func2
Efficiency functor 2.
Definition: GLATAeff.hpp:112
void save(const GFilename &filename, const bool &clobber=false)
Save effective area into FITS file.
Definition: GLATAeff.cpp:287
FITS table float column.
virtual ~GLATAeff(void)
Destructor.
Definition: GLATAeff.cpp:118
void read(const GFits &file, const std::string &evtype)
Read effective area from FITS file.
Definition: GLATAeff.cpp:318
void init_members(void)
Initialise class members.
Definition: GLATAeff.cpp:497
Fermi LAT effective area class definition.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
Definition: GTools.cpp:1022
std::string m_evtype
Event type.
Definition: GLATAeff.hpp:107
GLATAeff * clone(void) const
Clone effective area.
Definition: GLATAeff.cpp:248
GFitsHeaderCard & card(const int &cardno)
Return header card.
Definition: GFitsHDU.hpp:259
int size(void) const
Return number of bins in response table.
bool has_efficiency(void) const
Signals whether efficiency factors are present.
Definition: GLATAeff.cpp:385
Filename class interface definition.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
Definition: GTools.cpp:413
FITS table abstract base class interface definition.
double efficiency_factor2(const GEnergy &srcEng) const
Returns efficiency factor 2.
Definition: GLATAeff.cpp:433