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