Change request #1455
Adapt GResponse interface to allow proper handling of the energy dispersion
Status: | Closed | Start date: | 04/01/2015 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | 1.0.0 | |||
Duration: |
Description
The proper handling of the energy dispersion requires in GModelSky::npred
(or below) an integration over the true photon energy. As the energy dispersion is part of the response, and the dispersion itself is not exposed in the abstract GResponse
interface, the energy dispersion integration needs to be done within the GResponse
class. This implies that instead of passing true energy (and time) to the GResponse::npred
method via
GResponse::npred(const GSource& source, const GObservation& obs) const;
one should pass observed energy and time, i.e.
GResponse::npred(const GModelSky& model, const GEnergy& obsEng, const GTime& obsTime, const GObservation& obs) const;
The
GResponse::npred
will then perform the integration over true energy and energy dispersion.
Recurrence
No recurrence.
History
#1 Updated by Knödlseder Jürgen almost 10 years ago
The underlying question is also of how to split the model evaluation (i.e. GObservation::model
) and the Npred computation (i.e. GObservation::npred
) between the GObservation
, GModelSky
and GResponse
classes. The current split does not seem to be consistent between model and Npred computation, and maybe clear interfaces could be found by doing a more clean split.
Doing computations in the model requires carrying GObservation
information in the GModelSky
methods. For Npred, the only method in GModelSky
that is currently used is GModelSky::npred
and the reason for having this method in GModelSky
is that a different implementation of this method is needed for data space models (i.e. no convolution with the response). So this looks fine.
Doing GObservation::npred(GModel&)
in GObservation
(and the time and energy integrations) seems not really required. The integration over the data space could also be done in GModel
. This would probably provide a clearer interface.
#2 Updated by Knödlseder Jürgen almost 10 years ago
The GResponse
methods
virtual double irf(const GEvent& event, const GPhoton& photon, const GObservation& obs) const = 0; virtual double npred(const GPhoton& photon, const GObservation& obs) const = 0;are not really required by any code in GammaLib, although they are used in the response computations. Nevertheless, these are not the central methods used in the
GModelSky
response computations. The relevant methods arevirtual double irf(const GEvent& event, const GSource& source, const GObservation& obs) const; virtual double npred(const GSource& source, const GObservation& obs) const;which are the variants where the photon gets replaced by a
GSource
object. In that way, spatial model information is piped to the response classes that can be used for efficient response computation.#3 Updated by Knödlseder Jürgen almost 10 years ago
The solution will be a refactoring of the response code by removing most of the former virtual methods and by introducing a convolve()
method that performs the convolution of a sky model with the IRF. In addition, a nroi()
method will be added that replaces the former npred()
methods. The time and energy integration that actually exists in the GModelSky
class will then be moved to the GResponse
classes. Eventually, a base implementation of convolve()
can exist in GResponse
that provides the time and energy integration, but we may also think about changing the integration order to benefit from the energy independence (and time independence) of most spatial models.
class GResponse : public GBase {
public:
// Constructors and destructors
GResponse(void);
GResponse(const GResponse& rsp);
virtual ~GResponse(void);
// Operators
virtual GResponse& operator=(const GResponse& rsp);
// Pure virtual methods
virtual void clear(void) = 0;
virtual GResponse* clone(void) const = 0;
virtual std::string classname(void) const = 0;
virtual bool use_edisp(void) const = 0;
virtual bool use_tdisp(void) const = 0;
virtual double irf(const GEvent& event,
const GPhoton& photon,
const GObservation& obs) const = 0;
virtual double convolve(const GModelSky& model,
const GEvent& event,
const GObservation& obs) const = 0;
virtual double nroi(const GModelSky& model,
const GEnergy& obsEng,
const GTime& obsTime,
const GObservation& obs) const = 0;
virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
#4 Updated by Knödlseder Jürgen almost 10 years ago
- Assigned To set to Knödlseder Jürgen
- Target version set to 1.0.0
- % Done changed from 0 to 50
Refactoring of the code has been done to comply to the new interface. We now can continue with the modification of GModelSky
so that all the integrations are done by a CTA specific convolution method.
#5 Updated by Knödlseder Jürgen almost 10 years ago
- Status changed from New to Closed
- % Done changed from 50 to 100
Done and merged into devel
.