Commit 3922365c4e0d601e65da38a721b4a97d7980e36b
1 parent
b79eaac1
Define energy dispersion access operator.
Showing
4 changed files
with
19 additions
and
25 deletions
inst/cta/include/GCTAEdisp.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | - * GCTAEdisp.hpp - CTA energy dispersion base class * | |
| 2 | + * GCTAEdisp.hpp - Abstract CTA energy dispersion base class * | |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | 4 | * copyright (C) 2012-2013 by Juergen Knoedlseder * |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | /** |
| 22 | 22 | * @file GCTAEdisp.hpp |
| 23 | - * @brief CTA energy dispersion base class definition | |
| 23 | + * @brief Abstract CTA energy dispersion base class definition | |
| 24 | 24 | * @author Juergen Knoedlseder |
| 25 | 25 | */ |
| 26 | 26 | |
| ... | ... | @@ -50,14 +50,12 @@ public: |
| 50 | 50 | virtual ~GCTAEdisp(void); |
| 51 | 51 | |
| 52 | 52 | // Pure virtual operators |
| 53 | - /* | |
| 54 | - virtual double operator()(const double& logE, | |
| 53 | + virtual double operator()(const double& logEobs, | |
| 54 | + const double& logEsrc, | |
| 55 | 55 | const double& theta = 0.0, |
| 56 | 56 | const double& phi = 0.0, |
| 57 | 57 | const double& zenith = 0.0, |
| 58 | - const double& azimuth = 0.0, | |
| 59 | - const bool& etrue = true) const = 0; | |
| 60 | - */ | |
| 58 | + const double& azimuth = 0.0) const = 0; | |
| 61 | 59 | |
| 62 | 60 | // Operators |
| 63 | 61 | GCTAEdisp& operator=(const GCTAEdisp& edisp); | ... | ... |
inst/cta/pyext/GCTAEdisp.i
| 1 | 1 | /*************************************************************************** |
| 2 | - * GCTAEdisp.i - Energy dispersion base class * | |
| 2 | + * GCTAEdisp.i - Abstract CTA energy dispersion base class * | |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | 4 | * copyright (C) 2012-2013 by Juergen Knoedlseder * |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| ... | ... | @@ -20,20 +20,19 @@ |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | /** |
| 22 | 22 | * @file GCTAEdisp.i |
| 23 | - * @brief Energy dispersion base class definition | |
| 23 | + * @brief Abstract CTA energy dispersion base class definition | |
| 24 | 24 | * @author Juergen Knoedlseder |
| 25 | 25 | */ |
| 26 | 26 | %{ |
| 27 | 27 | /* Put headers and other declarations here that are needed for compilation */ |
| 28 | 28 | #include "GCTAEdisp.hpp" |
| 29 | -#include "GTools.hpp" | |
| 30 | 29 | %} |
| 31 | 30 | |
| 32 | 31 | |
| 33 | 32 | /***********************************************************************//** |
| 34 | 33 | * @class GCTAEdisp |
| 35 | 34 | * |
| 36 | - * @brief Abstract base class for the CTA energy dispersion | |
| 35 | + * @brief Abstract CTA energy dispersion base class | |
| 37 | 36 | ***************************************************************************/ |
| 38 | 37 | class GCTAEdisp : public GBase { |
| 39 | 38 | |
| ... | ... | @@ -44,14 +43,12 @@ public: |
| 44 | 43 | virtual ~GCTAEdisp(void); |
| 45 | 44 | |
| 46 | 45 | // Pure virtual operators |
| 47 | - /* | |
| 48 | - virtual double operator()(const double& logE, | |
| 46 | + virtual double operator()(const double& logEobs, | |
| 47 | + const double& logEsrc, | |
| 49 | 48 | const double& theta = 0.0, |
| 50 | 49 | const double& phi = 0.0, |
| 51 | 50 | const double& zenith = 0.0, |
| 52 | - const double& azimuth = 0.0, | |
| 53 | - const bool& etrue = true) const = 0; | |
| 54 | - */ | |
| 51 | + const double& azimuth = 0.0) const = 0; | |
| 55 | 52 | |
| 56 | 53 | // Pure virtual methods |
| 57 | 54 | virtual void clear(void) = 0; | ... | ... |
inst/cta/src/GCTAEdisp.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | - * GCTAEdisp.cpp - CTA energy dispersion base class * | |
| 2 | + * GCTAEdisp.cpp - Abstract CTA energy dispersion base class * | |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2012 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2012-2013 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | /** |
| 22 | 22 | * @file GCTAEdisp.hpp |
| 23 | - * @brief CTA energy dispersion base class implementation | |
| 23 | + * @brief Abstract CTA energy dispersion base class implementation | |
| 24 | 24 | * @author Juergen Knoedlseder |
| 25 | 25 | */ |
| 26 | 26 | |
| ... | ... | @@ -103,7 +103,7 @@ GCTAEdisp::~GCTAEdisp(void) |
| 103 | 103 | * @param[in] edisp Energy dispersion. |
| 104 | 104 | * @return Energy dispersion. |
| 105 | 105 | ***************************************************************************/ |
| 106 | -GCTAEdisp& GCTAEdisp::operator= (const GCTAEdisp& edisp) | |
| 106 | +GCTAEdisp& GCTAEdisp::operator=(const GCTAEdisp& edisp) | |
| 107 | 107 | { |
| 108 | 108 | // Execute only if object is not identical |
| 109 | 109 | if (this != &edisp) { | ... | ... |
inst/cta/src/GCTAResponse.cpp
| ... | ... | @@ -1963,9 +1963,6 @@ double GCTAResponse::psf_delta_max(const double& theta, |
| 1963 | 1963 | * @param[in] zenith Zenith angle of telescope pointing (radians). |
| 1964 | 1964 | * @param[in] azimuth Azimuth angle of telescope pointing (radians). |
| 1965 | 1965 | * @param[in] srcLogEng Log10 of true photon energy (E/TeV). |
| 1966 | - * | |
| 1967 | - * Dummy energy dispersion method that implements a Dirac function. Returns | |
| 1968 | - * 1 is true and observed energy are identical, 0 otherwise. | |
| 1969 | 1966 | ***************************************************************************/ |
| 1970 | 1967 | double GCTAResponse::edisp(const double& obsLogEng, |
| 1971 | 1968 | const double& theta, |
| ... | ... | @@ -1974,8 +1971,10 @@ double GCTAResponse::edisp(const double& obsLogEng, |
| 1974 | 1971 | const double& azimuth, |
| 1975 | 1972 | const double& srcLogEng) const |
| 1976 | 1973 | { |
| 1977 | - // Dirac energy dispersion | |
| 1978 | - double edisp = (obsLogEng == srcLogEng) ? 1.0 : 0.0; | |
| 1974 | + // Compute energy dispersion | |
| 1975 | + double edisp = (m_edisp != NULL) | |
| 1976 | + ? (*m_edisp)(obsLogEng, srcLogEng, theta, phi, zenith, azimuth) | |
| 1977 | + : 0.0; | |
| 1979 | 1978 | |
| 1980 | 1979 | // Return energy dispersion |
| 1981 | 1980 | return edisp; | ... | ... |