GCTAPsfMap.hpp

Lu Chia-Chun, 05/15/2014 11:20 AM

Download (4.79 KB)

 
1
/***************************************************************************
2
 *           GCTAPsfMap.hpp - CTA 2D point spread function class            *
3
 * ----------------------------------------------------------------------- *
4
 *  copyright (C) 2012-2013 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 GCTAPsfMap.hpp
23
 * @brief CTA Map point spread function class definition
24
 * @author Chia-Chun Lu
25
 */
26

    
27
#ifndef GCTAPSFMAP_HPP
28
#define GCTAPSFMAP_HPP
29

    
30
/* __ Includes ___________________________________________________________ */
31
#include <string>
32
#include "GFits.hpp"
33
#include "GRan.hpp"
34
#include "GCTAPsf.hpp"
35
#include "GCTAResponseTable.hpp"
36

    
37

    
38
/***********************************************************************//**
39
 * @class GCTAPsfMap
40
 *
41
 * @brief CTA Map point spread function class
42
 *
43
 * This class implements the CTA point spread function response as function
44
 * of sky coordinate.
45
 ***************************************************************************/
46
class GCTAPsfMap : public GCTAPsf {
47

    
48
public:
49
    // Constructors and destructors
50
    GCTAPsfMap(void);
51
    GCTAPsfMap(const std::string& filename);
52
    GCTAPsfMap(const GCTAPsfMap& psf);
53
    virtual ~GCTAPsfMap(void);
54

    
55
    // Operators
56
    GCTAPsfMap& operator=(const GCTAPsfMap& psf);
57
    double operator()(const double& logE,
58
                                          const double& sky_x,
59
                                          const double& sky_y,
60
                      const bool&   etrue = true) const;
61
        // New operator definition in GCTAPsf and GCTAResponse needed
62
    // Implemented pure virtual methods
63
    void        clear(void);
64
    GCTAPsfMap*  clone(void) const;
65
    void        load(const std::string& filename);
66
    std::string filename(void) const;
67
    double      mc(GRan&         ran,
68
                   const double& logE, 
69
                   const double& sky_x = 0.0, 
70
                   const double& sky_y = 0.0,
71
                   const bool&   etrue = true) const;
72
    double      delta_max(const double& logE, 
73
                          const double& sky_x = 0.0, 
74
                          const double& sky_y = 0.0,
75
                          const bool&   etrue = true) const;
76
    std::string print(const GChatter& chatter = NORMAL) const;
77

    
78
private:
79
    // Methods
80
    void init_members(void);
81
    void copy_members(const GCTAPsfMap& psf);
82
    void free_members(void);
83
    void update(const double& logE, const double& sky_x, const double& sky_y) const;
84

    
85
    // Members
86
    std::string       m_filename;   //!< Name of Aeff response file
87
    GCTAResponseTable m_psf;        //!< PSF response table
88

    
89
    // Precomputation cache
90
    mutable double    m_par_logE;   //!< Cache energy
91
    mutable double    m_par_sky_x;  //!< Cache sky coordinate x
92
        mutable double    m_par_sky_y;  //!< Cache sky coordinate y
93
    mutable double    m_norm;       //!< Global normalization
94
    mutable double    m_norm2;      //!< Gaussian 2 normalization
95
    mutable double    m_norm3;      //!< Gaussian 3 normalization
96
    mutable double    m_sigma1;     //!< Gaussian 1 sigma
97
    mutable double    m_sigma2;     //!< Gaussian 2 sigma
98
    mutable double    m_sigma3;     //!< Gaussian 3 sigma
99
    mutable double    m_width1;     //!< Gaussian 1 width
100
    mutable double    m_width2;     //!< Gaussian 2 width
101
    mutable double    m_width3;     //!< Gaussian 3 width
102
};
103

    
104

    
105
/***********************************************************************//**
106
 * @brief Return filename
107
 *
108
 * @return Returns filename from which point spread function was loaded
109
 ***************************************************************************/
110
inline
111
std::string GCTAPsfMap::filename(void) const
112
{
113
    return m_filename;
114
}
115

    
116
#endif /* GCTAPSFMAP_HPP */