GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAResponse.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCTAResponse.hpp - CTA response abstract base class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2010-2019 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 GCTAResponse.hpp
23  * @brief CTA response abstract base class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCTARESPONSE_HPP
28 #define GCTARESPONSE_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GResponse.hpp"
33 #include "GCTAResponseCache.hpp"
34 
35 /* __ Type definitions ___________________________________________________ */
36 
37 /* __ Forward declarations _______________________________________________ */
38 class GModelSky;
39 class GEnergy;
40 class GTime;
41 class GEvent;
42 class GPhoton;
43 class GSource;
44 class GObservation;
45 class GXmlElement;
46 
47 
48 /***********************************************************************//**
49  * @class GCTAResponse
50  *
51  * @brief CTA instrument response function class
52  *
53  * This class defines the interface for the CTA response function. It
54  * provides an abstract base class to CTA response function classes.
55  ***************************************************************************/
56 class GCTAResponse : public GResponse {
57 
58 public:
59  // Constructors and destructors
60  GCTAResponse(void);
61  GCTAResponse(const GCTAResponse& rsp);
62  virtual ~GCTAResponse(void);
63 
64  // Operators
65  virtual GCTAResponse& operator=(const GCTAResponse & rsp);
66 
67  // Pure virtual methods
68  virtual void clear(void) = 0;
69  virtual GCTAResponse* clone(void) const = 0;
70  virtual std::string classname(void) const = 0;
71  virtual bool is_valid(void) const = 0;
72  virtual bool use_edisp(void) const = 0;
73  virtual bool use_tdisp(void) const = 0;
74  virtual bool apply_edisp(void) const = 0;
75  virtual void apply_edisp(const bool& apply_edisp) const = 0;
76  virtual double irf(const GEvent& event,
77  const GPhoton& photon,
78  const GObservation& obs) const = 0;
79  virtual double nroi(const GModelSky& model,
80  const GEnergy& obsEng,
81  const GTime& obsTime,
82  const GObservation& obs) const = 0;
83  virtual GEbounds ebounds(const GEnergy& obsEng) const = 0;
84  virtual void read(const GXmlElement& xml) = 0;
85  virtual void write(GXmlElement& xml) const = 0;
86  virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
87 
88  // Implemeted methods
89  virtual double irf(const GEvent& event,
90  const GSource& source,
91  const GObservation& obs) const;
92  virtual void remove_response_cache(const std::string& name);
93 
94 protected:
95  // Protected methods
96  void init_members(void);
97  void copy_members(const GCTAResponse& rsp);
98  void free_members(void);
99 
100  // Pure virtual protected methods
101  virtual double irf_ptsrc(const GEvent& event,
102  const GSource& source,
103  const GObservation& obs) const = 0;
104  virtual double irf_radial(const GEvent& event,
105  const GSource& source,
106  const GObservation& obs) const = 0;
107  virtual double irf_elliptical(const GEvent& event,
108  const GSource& source,
109  const GObservation& obs) const = 0;
110  virtual double irf_diffuse(const GEvent& event,
111  const GSource& source,
112  const GObservation& obs) const = 0;
113 
114  // Implemented protected methods
115  virtual double irf_composite(const GEvent& event,
116  const GSource& source,
117  const GObservation& obs) const;
118 
119  // Protected members
120  bool m_use_irf_cache; //!< Control usage of irf cache
121  bool m_use_nroi_cache; //!< Control usage of nroi cache
122 
123  // Cache for irf(GEvent&, GSource&, GObservation&) and
124  // nroi(GModelSky&, GEnergy&, GTime&, GEnergy&, GTime&, GObservation&)
125  // computations
128 };
129 
130 #endif /* GCTARESPONSE_HPP */
virtual void remove_response_cache(const std::string &name)
Remove response cache for model.
virtual bool is_valid(void) const =0
GCTAResponseCache m_irf_cache
GCTAResponseCache m_nroi_cache
Abstract interface for the event classes.
Definition: GEvent.hpp:71
XML element node class.
Definition: GXmlElement.hpp:47
virtual bool apply_edisp(void) const =0
CTA response cache class definition.
Time class.
Definition: GTime.hpp:54
void copy_members(const GCTAResponse &rsp)
Copy class members.
virtual double irf_radial(const GEvent &event, const GSource &source, const GObservation &obs) const =0
virtual double nroi(const GModelSky &model, const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const =0
virtual GCTAResponse * clone(void) const =0
Clones object.
void init_members(void)
Initialise class members.
bool m_use_nroi_cache
Control usage of nroi cache.
Class that handles photons.
Definition: GPhoton.hpp:47
virtual GCTAResponse & operator=(const GCTAResponse &rsp)
Assignment operator.
virtual ~GCTAResponse(void)
Destructor.
Energy boundaries container class.
Definition: GEbounds.hpp:60
virtual void clear(void)=0
Clear object.
virtual bool use_tdisp(void) const =0
void free_members(void)
Delete class members.
GChatter
Definition: GTypemaps.hpp:33
virtual double irf_ptsrc(const GEvent &event, const GSource &source, const GObservation &obs) const =0
Abstract observation base class.
virtual std::string classname(void) const =0
Return class name.
virtual void read(const GXmlElement &xml)=0
CTA instrument response function class.
GCTAResponse(void)
Void constructor.
Abstract response base class definition.
virtual double irf_composite(const GEvent &event, const GSource &source, const GObservation &obs) const
Return instrument response to composite source.
Sky model class.
Definition: GModelSky.hpp:120
virtual GEbounds ebounds(const GEnergy &obsEng) const =0
virtual bool use_edisp(void) const =0
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
bool m_use_irf_cache
Control usage of irf cache.
virtual double irf(const GEvent &event, const GPhoton &photon, const GObservation &obs) const =0
virtual void write(GXmlElement &xml) const =0
virtual double irf_elliptical(const GEvent &event, const GSource &source, const GObservation &obs) const =0
CTA response cache class.
Abstract instrument response base class.
Definition: GResponse.hpp:67
Class that handles gamma-ray sources.
Definition: GSource.hpp:53
virtual double irf_diffuse(const GEvent &event, const GSource &source, const GObservation &obs) const =0
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48