Commit c70385ab6287a1842d7ff3e7314b10e42370d99f

Authored by cvs2git
1 parent 70d3ef0e

This commit was manufactured by cvs2svn to create tag 'GammaLib-00-04-00'.

Sprout from master 2010-06-11 13:52:58 UTC knodlseder 'Update to version 0.4'
Delete:
    include/GData.hpp
    include/GLATEventAtom.hpp
    include/GLATEventBin.hpp
    include/GLATEventCube.hpp
    include/GLATEventList.hpp
    include/GLATObservation.hpp
    include/GLATResponse.hpp
    include/GLATResponseTable.hpp
    pyext/GData.i
    src/obs/GData.cpp
    src/obs/GData_iterator.cpp
    src/obs/GData_optimizer.cpp
    src/support/GTools.hpp
    test/test_GData.cpp
    test/test_GData.hpp
    test/test_GModel.hpp
    test/test_GOptimizer.cpp
    test/test_GOptimizer.hpp
    test/test_GResponse.cpp
    test/test_GResponse.hpp
include/GData.hpp deleted
1 -/***************************************************************************  
2 - * GData.hpp - Data container class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -/**  
14 - * @file GData.hpp  
15 - * @brief GData container class interface definition.  
16 - * @author J. Knodlseder  
17 - */  
18 -  
19 -#ifndef GDATA_HPP  
20 -#define GDATA_HPP  
21 -  
22 -/* __ Includes ___________________________________________________________ */  
23 -#include <iostream>  
24 -#include "GObservation.hpp"  
25 -#include "GEvent.hpp"  
26 -#include "GOptimizer.hpp"  
27 -#include "GOptimizerFunction.hpp"  
28 -#include "GModels.hpp"  
29 -  
30 -  
31 -/***********************************************************************//**  
32 - * @class GData  
33 - *  
34 - * @brief GData container class interface defintion.  
35 - ***************************************************************************/  
36 -class GData {  
37 -  
38 - // I/O friends  
39 - friend std::ostream& operator<< (std::ostream& os, const GData& data);  
40 -  
41 -public:  
42 - // Constructors and destructors  
43 - GData();  
44 - GData(const GData& data);  
45 - virtual ~GData();  
46 -  
47 - // Operators  
48 - GData& operator= (const GData& data);  
49 -  
50 - // Methods  
51 - void add(GObservation &obs);  
52 - void models(const GModels& models) { m_models=models; return; }  
53 - int elements(void) const { return m_num; }  
54 - GObservation* observation(int index) const;  
55 - GModels* models(void) { return &m_models; }  
56 - void optimize(GOptimizer& opt);  
57 -  
58 - // Event iterator  
59 - class iterator {  
60 - friend class GData;  
61 - public:  
62 - iterator();  
63 - iterator(GData *data);  
64 - ~iterator() { return; }  
65 - iterator& operator++(void); // Prefix  
66 - iterator operator++(int junk); // Postfix  
67 - bool operator==(const iterator& it) const  
68 - { return ((m_index == it.m_index) && (m_event == it.m_event)); }  
69 - bool operator!=(const iterator& it) const  
70 - { return ((m_index != it.m_index) || (m_event != it.m_event)); }  
71 - GEvent& operator*(void) { return *m_event; }  
72 - GEvent* operator->(void) { return &(*m_event); }  
73 - protected:  
74 - int m_index; //!< Actual observation index [0,m_num-1]  
75 - GEvents::iterator m_event; //!< Iterator on actual event  
76 - GEvents::iterator m_end; //!< Iterator on observation end  
77 - GObservation* m_obs; //!< Pointer to actual observation  
78 - GData* m_data; //!< Pointer to GData object  
79 - };  
80 - iterator begin(void);  
81 - iterator end(void);  
82 -  
83 - // Optimizer  
84 - class optimizer : public GOptimizerFunction {  
85 - public:  
86 - optimizer();  
87 - optimizer(GData *data);  
88 - optimizer(const optimizer& fct);  
89 - ~optimizer();  
90 - optimizer& operator= (const optimizer& fct);  
91 - void eval(const GOptimizerPars& pars);  
92 - double* value(void) { return &m_value; }  
93 - GVector* gradient(void) { return m_gradient; }  
94 - GSparseMatrix* covar(void) { return m_covar; }  
95 - protected:  
96 - void init_members(void);  
97 - void copy_members(const optimizer& fct);  
98 - void free_members(void);  
99 - double m_value; //!< Function value  
100 - GVector* m_gradient; //!< Pointer to gradient vector  
101 - GSparseMatrix* m_covar; //!< Pointer to covariance matrix  
102 - GData* m_data; //!< Pointer to GData object  
103 - };  
104 -  
105 -protected:  
106 - // Protected methods  
107 - void init_members(void);  
108 - void copy_members(const GData& data);  
109 - void free_members(void);  
110 -  
111 - // Protected data area  
112 - int m_num; //!< Number of observations  
113 - GObservation** m_obs; //!< Pointers to observations  
114 - GModels m_models; //!< Models  
115 -  
116 -};  
117 -  
118 -#endif /* GDATA_HPP */  
include/GLATEventAtom.hpp deleted
1 -/***************************************************************************  
2 - * GLATEventAtom.hpp - LAT event atom class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -/**  
14 - * @file GLATEventAtom.hpp  
15 - * @brief GLATEventAtom class interface definition.  
16 - * @author J. Knodlseder  
17 - */  
18 -  
19 -#ifndef GLATEVENTATOM_HPP  
20 -#define GLATEVENTATOM_HPP  
21 -  
22 -/* __ Includes ___________________________________________________________ */  
23 -#include "GEventAtom.hpp"  
24 -#include "GModels.hpp"  
25 -#include "GVector.hpp"  
26 -  
27 -  
28 -/***********************************************************************//**  
29 - * @class GLATEventAtom  
30 - *  
31 - * @brief GLATEventAtom class interface defintion.  
32 - ***************************************************************************/  
33 -class GLATEventAtom : public GEventAtom {  
34 -  
35 - // Friend classes  
36 - friend class GLATEventList;  
37 -  
38 -public:  
39 - // Constructors and destructors  
40 - GLATEventAtom();  
41 - GLATEventAtom(const GLATEventAtom& atom);  
42 - virtual ~GLATEventAtom();  
43 -  
44 - // Operators  
45 - GLATEventAtom& operator= (const GLATEventAtom& atom);  
46 -  
47 - // Methods  
48 - double model(GModels& models);  
49 - double model(GModels& models, GVector* gradient);  
50 -  
51 -protected:  
52 - // Protected methods  
53 - void init_members(void);  
54 - void copy_members(const GLATEventAtom& atom);  
55 - void free_members(void);  
56 - GLATEventAtom* clone(void) const;  
57 -  
58 - // LAT data format attributes  
59 - float m_theta; //!< Zenith angle in instrument system  
60 - float m_phi; //!< Azimuth angle in instrument system  
61 - float m_zenith_angle; //!< Zenith angle in Earth system  
62 - float m_earth_azimuth_angle; //!< Azimuth angle in Earth system  
63 - long m_event_id; //!< ID number of original event  
64 - long m_run_id; //!< Run number of original event  
65 - short m_recon_version; //!< Version of event reconstruction software  
66 - short m_calib_version[3]; //!< Version of calibration tables for ACD, CAL  
67 - short m_event_class; //!< Event class: 0, 1, 2, ...  
68 - short m_conversion_type; //!< Type of conversion: 0=Front, 1=Back  
69 - double m_livetime; //!< Accumulated livetime since mission start  
70 - double* m_difrsp; //!< Diffuse response components  
71 -  
72 - // Other attributes  
73 - int m_num_difrsp; //!< Number of diffuse model components  
74 -};  
75 -  
76 -#endif /* GLATEVENTATOM_HPP */  
include/GLATEventBin.hpp deleted
1 -/***************************************************************************  
2 - * GLATEventBin.hpp - LAT event bin class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -/**  
14 - * @file GLATEventBin.hpp  
15 - * @brief GLATEventBin class interface definition.  
16 - * @author J. Knodlseder  
17 - */  
18 -  
19 -#ifndef GLATEVENTBIN_HPP  
20 -#define GLATEVENTBIN_HPP  
21 -  
22 -/* __ Includes ___________________________________________________________ */  
23 -#include "GEventBin.hpp"  
24 -#include "GModels.hpp"  
25 -#include "GVector.hpp"  
26 -  
27 -  
28 -/***********************************************************************//**  
29 - * @class GLATEventBin  
30 - *  
31 - * @brief GLATEventBin class interface defintion.  
32 - ***************************************************************************/  
33 -class GLATEventBin : public GEventBin {  
34 -  
35 - // Friend classes  
36 - friend class GLATEventCube;  
37 -  
38 - // I/O friends  
39 - friend std::ostream& operator<< (std::ostream& os, const GLATEventBin& bin);  
40 -  
41 -public:  
42 - // Constructors and destructors  
43 - GLATEventBin();  
44 - GLATEventBin(const GLATEventBin& bin);  
45 - virtual ~GLATEventBin();  
46 -  
47 - // Operators  
48 - GLATEventBin& operator= (const GLATEventBin& bin);  
49 -  
50 - // Methods  
51 - double counts(void) const { return *m_counts; }  
52 - double model(GModels& models);  
53 - double model(GModels& models, GVector* gradient);  
54 - GSkyDir* dir(void) { return m_dir; }  
55 - double* energy(void) { return m_energy; }  
56 - double* time(void) { return m_time; }  
57 -  
58 -protected:  
59 - // Protected methods  
60 - void init_members(void);  
61 - void copy_members(const GLATEventBin& bin);  
62 - void free_members(void);  
63 - GLATEventBin* clone(void) const;  
64 -  
65 - // Protected data area (defines all LAT specific event attributes)  
66 - double* m_counts; //!< Pointer to number of counts  
67 - double* m_time; //!< Pointer to bin time  
68 - GSkyDir* m_dir; //!< Pointer to bin direction  
69 - double* m_energy; //!< Pointer to bin energy  
70 -  
71 -};  
72 -  
73 -#endif /* GLATEVENTBIN_HPP */  
include/GLATEventCube.hpp deleted
1 -/***************************************************************************  
2 - * GLATEventCube.hpp - LAT event cube class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright : (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -/**  
14 - * @file GLATEventCube.hpp  
15 - * @brief GLATEventCube class interface definition.  
16 - * @author J. Knodlseder  
17 - */  
18 -  
19 -#ifndef GLATEVENTCUBE_HPP  
20 -#define GLATEVENTCUBE_HPP  
21 -  
22 -/* __ Includes ___________________________________________________________ */  
23 -#include "GEventCube.hpp"  
24 -#include "GLATEventBin.hpp"  
25 -#include "GEbounds.hpp"  
26 -#include "GFits.hpp"  
27 -  
28 -  
29 -/***********************************************************************//**  
30 - * @class GLATEventCube  
31 - *  
32 - * @brief GLATEventCube class interface defintion.  
33 - ***************************************************************************/  
34 -class GLATEventCube : public GEventCube {  
35 -  
36 - // Friend classes  
37 - friend class GLATObservation;  
38 -  
39 - // I/O friends  
40 - friend std::ostream& operator<< (std::ostream& os, const GLATEventCube& cube);  
41 -  
42 -public:  
43 - // Constructors and destructors  
44 - GLATEventCube();  
45 - GLATEventCube(const GLATEventCube& cube);  
46 - virtual ~GLATEventCube();  
47 -  
48 - // Operators  
49 - GLATEventCube& operator= (const GLATEventCube& cube);  
50 -  
51 - // Methods  
52 - void load(const std::string& filename);  
53 - GLATEventBin* pointer(int index);  
54 - int number(void) const;  
55 - int ebins(void) const { return m_ebins; }  
56 - int pixels(void) const { return m_pixels; }  
57 -  
58 -protected:  
59 - // Protected methods  
60 - void init_members(void);  
61 - void copy_members(const GLATEventCube& cube);  
62 - void free_members(void);  
63 - GLATEventCube* clone(void) const;  
64 - void load_cntmap(GFitsHDU* hdu);  
65 - void load_ebds(GFitsHDU* hdu);  
66 -  
67 - // Protected data area  
68 - GLATEventBin m_bin; //!< Actual energy bin  
69 - int m_nx; //!< Number of pixels in x  
70 - int m_ny; //!< Number of pixels in y  
71 - int m_pixels; //!< Number of pixels in x and y  
72 - int m_ebins; //!< Number of energy bins  
73 - double* m_counts; //!< Pointer to counts array  
74 - double* m_energies; //!< Pointer to energies  
75 - double m_time; //!< Event cube mean time  
76 - GSkyDir* m_dirs; //!< Pointer to sky directions  
77 - GEbounds m_ebds; //!< Energy boundaries  
78 -  
79 -private:  
80 -};  
81 -  
82 -#endif /* GLATEVENTCUBE_HPP */  
include/GLATEventList.hpp deleted
1 -/***************************************************************************  
2 - * GLATEventList.hpp - LAT Event list class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright : (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -/**  
14 - * @file GLATEventList.hpp  
15 - * @brief GLATEventList class interface definition.  
16 - * @author J. Knodlseder  
17 - */  
18 -  
19 -#ifndef GLATEVENTLIST_HPP  
20 -#define GLATEVENTLIST_HPP  
21 -  
22 -/* __ Includes ___________________________________________________________ */  
23 -#include "GEventList.hpp"  
24 -#include "GLATEventAtom.hpp"  
25 -#include "GFits.hpp"  
26 -  
27 -  
28 -/***********************************************************************//**  
29 - * @class GLATEventList  
30 - *  
31 - * @brief GLATEventList class interface defintion.  
32 - ***************************************************************************/  
33 -class GLATEventList : public GEventList {  
34 -  
35 - // I/O friends  
36 - friend std::ostream& operator<< (std::ostream& os, const GLATEventList& list);  
37 -  
38 -public:  
39 - // Constructors and destructors  
40 - GLATEventList();  
41 - GLATEventList(const GLATEventList& list);  
42 - virtual ~GLATEventList();  
43 -  
44 - // Operators  
45 - GLATEventList& operator= (const GLATEventList& list);  
46 -  
47 - // Methods  
48 - void load(const std::string& filename);  
49 - GLATEventAtom* pointer(int index);  
50 -  
51 -protected:  
52 - // Protected methods  
53 - void init_members(void);  
54 - void copy_members(const GLATEventList& list);  
55 - void free_members(void);  
56 - GLATEventList* clone(void) const;  
57 - void load_ft1(GFitsHDU* hdu);  
58 - void load_events(GFitsHDU* hdu);  
59 - void load_ds_keys(GFitsHDU* hdu);  
60 -  
61 - // Diffuse response information  
62 - int m_num_difrsp; //!< Number of diffuse response models  
63 - std::string* m_difrsp_label; //!< Diffuse response model labels  
64 -  
65 - // Data selection information  
66 - int m_ds_num; //!< Number of data selection keys  
67 - std::string* m_ds_type; //!< Data selection types  
68 - std::string* m_ds_unit; //!< Data selection units  
69 - std::string* m_ds_value; //!< Data selection values  
70 - std::string* m_ds_reference; //!< Data selection references  
71 -  
72 -private:  
73 -};  
74 -  
75 -#endif /* GLATEVENTLIST_HPP */  
include/GLATObservation.hpp deleted
1 -/***************************************************************************  
2 - * GLATObservation.hpp - LAT Observation class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright : (C) 2008 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -/**  
14 - * @file GLATObservation.hpp  
15 - * @brief GLATObservation class interface definition.  
16 - * @author J. Knodlseder  
17 - */  
18 -  
19 -#ifndef GLATOBSERVATION_HPP  
20 -#define GLATOBSERVATION_HPP  
21 -  
22 -/* __ Includes ___________________________________________________________ */  
23 -#include "GObservation.hpp"  
24 -  
25 -  
26 -/***********************************************************************//**  
27 - * @class GLATObservation  
28 - *  
29 - * @brief Interface for the LAT observation classes.  
30 - ***************************************************************************/  
31 -class GLATObservation : public GObservation {  
32 -  
33 - // I/O friends  
34 - friend std::ostream& operator<< (std::ostream& os, const GLATObservation& obs);  
35 -  
36 -public:  
37 - // Constructors and destructors  
38 - GLATObservation();  
39 -// GLATObservation(const std::string& ft1name, const std::string& ft2name);  
40 - GLATObservation(const GLATObservation& obs);  
41 - virtual ~GLATObservation();  
42 -  
43 - // Operators  
44 - GLATObservation& operator= (const GLATObservation& obs);  
45 -  
46 - // Methods  
47 - void load_unbinned(const std::string& ft1name,  
48 - const std::string& ft2name,  
49 - const std::string& ltcube_name);  
50 - void load_binned(const std::string& cntmap_name,  
51 - const std::string& expmap_name,  
52 - const std::string& ltcube_name);  
53 -  
54 -protected:  
55 - // Protected methods  
56 - void init_members(void);  
57 - void copy_members(const GLATObservation& obs);  
58 - void free_members(void);  
59 - GLATObservation* clone(void) const;  
60 -  
61 - // Protected data area  
62 -};  
63 -  
64 -#endif /* GLATOBSERVATION_HPP */  
include/GLATResponse.hpp deleted
1 -/***************************************************************************  
2 - * GLATResponse.hpp - GLAST LAT Response class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright : (C) 2008 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -/**  
14 - * @file GLATResponse.hpp  
15 - * @brief GLATResponse class interface definition.  
16 - * @author J. Knodlseder  
17 - */  
18 -  
19 -#ifndef GLATRESPONSE_HPP  
20 -#define GLATRESPONSE_HPP  
21 -  
22 -/* __ Includes ___________________________________________________________ */  
23 -#include "GNodeArray.hpp"  
24 -#include "GVector.hpp"  
25 -#include "GSkyDir.hpp"  
26 -#include "GResponse.hpp"  
27 -#include "GLATResponseTable.hpp"  
28 -#include "GFits.hpp"  
29 -#include "GFitsHDU.hpp"  
30 -  
31 -  
32 -/***********************************************************************//**  
33 - * @class GLATResponse  
34 - *  
35 - * @brief Interface for the GLAST LAT instrument response function classes.  
36 - ***************************************************************************/  
37 -class GLATResponse : public GResponse {  
38 -  
39 -public:  
40 - // Constructors and destructors  
41 - GLATResponse();  
42 - GLATResponse(const GLATResponse& rsp);  
43 - ~GLATResponse();  
44 -  
45 - // Operators  
46 - GLATResponse& operator= (const GLATResponse & rsp);  
47 -  
48 - // IRF Methods  
49 - double irf(const GSkyDir& obsDir, const double& obsEng,  
50 - const GSkyDir& srcDir, const double& srcEng,  
51 - const GSkyDir& instPntDir, const double& instPosAng,  
52 - const double& time);  
53 -  
54 - // Aeff Methods  
55 - double aeff(const GSkyDir& obsDir, const double& obsEng,  
56 - const GSkyDir& srcDir, const double& srcEng,  
57 - const GSkyDir& instPntDir, const double& instPosAng,  
58 - const double& time);  
59 - double aeff(const double& logE, const double& ctheta);  
60 - void aeff_ctheta_min(const double& ctheta);  
61 - double aeff_ctheta_min(void) const;  
62 -  
63 - // PSF Methods  
64 - double psf(const GSkyDir& obsDir, const double& obsEng,  
65 - const GSkyDir& srcDir, const double& srcEng,  
66 - const GSkyDir& instPntDir, const double& instPosAng,  
67 - const double& time);  
68 - double psf(const double& delta, const double& logE, const double& ctheta);  
69 - GVector psf(const GVector& delta, const double& logE, const double& ctheta);  
70 -  
71 - // Edisp Methods  
72 - double edisp(const GSkyDir& obsDir, const double& obsEng,  
73 - const GSkyDir& srcDir, const double& srcEng,  
74 - const GSkyDir& instPntDir, const double& instPosAng,  
75 - const double& time);  
76 -  
77 - // Other Methods  
78 - void set_caldb(const std::string& caldb);  
79 - void load(const std::string& rspname, const std::string& rsptype);  
80 - void save(const std::string& rspname) const;  
81 - GLATResponse* clone(void) const;  
82 -  
83 -private:  
84 - // Private Effective Area methods  
85 - void aeff_init(void);  
86 - void aeff_append(GFits& file) const;  
87 - void aeff_init_members(void);  
88 - void aeff_copy_members(const GLATResponse& rsp);  
89 - void aeff_free_members(void);  
90 -  
91 - // Private PSF methods  
92 - void psf_init(void);  
93 - void psf_append(GFits& file) const;  
94 - double psf_scale(const double& energy) const;  
95 - double psf_scale_log(const double& logE) const;  
96 - double psf_base_value(const double& u, const double& gamma) const;  
97 - GVector psf_base_vector(const GVector& u, const double& gamma) const;  
98 - void psf_init_members(void);  
99 - void psf_copy_members(const GLATResponse& rsp);  
100 - void psf_free_members(void);  
101 -  
102 - // Private energy dissipation methods  
103 - void edisp_init(void);  
104 - void edisp_append(GFits& file) const;  
105 - void edisp_init_members(void);  
106 - void edisp_copy_members(const GLATResponse& rsp);  
107 - void edisp_free_members(void);  
108 -  
109 - // Other private methods  
110 - void init_members(void);  
111 - void copy_members(const GLATResponse& rsp);  
112 - void free_members(void);  
113 - GVector get_fits_vector(const GFitsHDU* hdu, const std::string& colname, int row = 0);  
114 -  
115 - // Private Aeff data  
116 - GLATResponseTable m_aeff_bins; //!< Aeff energy and cos theta binning  
117 - double* m_aeff; //!< Aeff array  
118 - double m_aeff_ctheta_min; //!< Minimum valid cos(theta)  
119 -  
120 - // Private PSF data  
121 - GLATResponseTable m_psf_bins; //!< PSF energy and cos theta binning  
122 - GNodeArray m_psf_angle; //!< PSF vector binning  
123 - double m_psf_angle_max; //!< PSF maximum angular distance covered  
124 - double* m_psf; //!< PSF vector array  
125 - double* m_norm; //!< PSF normalization array  
126 - double* m_sigma; //!< PSF sigma array  
127 -  
128 - // Private Edisp data  
129 - GLATResponseTable m_edisp_bins; //!< Edisp energy and cos theta binning  
130 -  
131 - // Other private data  
132 - std::string m_rsptype; //!< Response type ('front','back')  
133 - int m_section; //!< PSF section (0=front, 1=back)  
134 -  
135 -};  
136 -  
137 -#endif /* GLATRESPONSE_HPP */  
include/GLATResponseTable.hpp deleted
1 -/***************************************************************************  
2 - * GLATResponseTable.hpp - GLAST LAT Response table class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright : (C) 2008 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -/**  
14 - * @file GLATResponseTable.hpp  
15 - * @brief GLATResponseTable class definition.  
16 - * @author J. Knodlseder  
17 - */  
18 -  
19 -#ifndef GLATRESPONSETABLE_HPP  
20 -#define GLATRESPONSETABLE_HPP  
21 -  
22 -/* __ Includes ___________________________________________________________ */  
23 -#include "GNodeArray.hpp"  
24 -#include "GFitsHDU.hpp"  
25 -  
26 -  
27 -/***********************************************************************//**  
28 - * @class GLATResponseTable  
29 - *  
30 - * @brief Interface for the GLAST LAT instrument response table classe.  
31 - ***************************************************************************/  
32 -class GLATResponseTable {  
33 -  
34 -public:  
35 - // Constructors and destructors  
36 - GLATResponseTable();  
37 - GLATResponseTable(const GLATResponseTable& table);  
38 - ~GLATResponseTable();  
39 -  
40 - // Operators  
41 - GLATResponseTable& operator= (const GLATResponseTable & table);  
42 -  
43 - // Methods  
44 - void load(const GFitsHDU* hdu);  
45 - void save(GFitsHDU* hdu) const;  
46 - int index(const int& ie, const int& ic) const;  
47 - double interpolate(const double& logE, const double& ctheta,  
48 - const double* array);  
49 - double interpolate(const double& logE, const double& ctheta,  
50 - const double* array, const int& offset,  
51 - const int& size);  
52 - double energy(const int& ie) const;  
53 - int num_energy(void) const { return m_energy_num; }  
54 - int num_ctheta(void) const { return m_ctheta_num; }  
55 - double energy_lo(const int& inx) const { return m_energy_lo[inx]; }  
56 - double energy_hi(const int& inx) const { return m_energy_hi[inx]; }  
57 - double ctheta_lo(const int& inx) const { return m_ctheta_lo[inx]; }  
58 - double ctheta_hi(const int& inx) const { return m_ctheta_hi[inx]; }  
59 -  
60 -private:  
61 - // Methods  
62 - void init_members(void);  
63 - void copy_members(const GLATResponseTable& table);  
64 - void free_members(void);  
65 -  
66 - // Table nodes  
67 - int m_energy_num; //!< Number of energy bins in table  
68 - int m_ctheta_num; //!< Number of cos theta bins in table  
69 - double* m_energy_lo; //!< Energy bins lower boundary (MeV)  
70 - double* m_energy_hi; //!< Energy bins upper boundary (MeV)  
71 - double* m_ctheta_lo; //!< cos(theta) bins lower boundary  
72 - double* m_ctheta_hi; //!< cos(theta) bins upper boundary  
73 - GNodeArray m_energy; //!< Energy nodes  
74 - GNodeArray m_ctheta; //!< cos(theta) nodes  
75 -  
76 - // Bi-linear interpolation data  
77 - double m_last_energy; //!< Last requested energy for interpolation  
78 - double m_last_ctheta; //!< Last requested cos(theta) for interpolation  
79 - int m_inx1; //!< Index 1  
80 - int m_inx2; //!< Index 2  
81 - int m_inx3; //!< Index 3  
82 - int m_inx4; //!< Index 4  
83 - double m_wgt1; //!< Weighting factor 1  
84 - double m_wgt2; //!< Weighting factor 2  
85 - double m_wgt3; //!< Weighting factor 3  
86 - double m_wgt4; //!< Weighting factor 4  
87 -};  
88 -  
89 -#endif /* GLATRESPONSETABLE_HPP */  
pyext/GData.i deleted
1 -/***************************************************************************  
2 - * GData.i - Data class SWIG interface *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright : (C) 2008 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -/**  
14 - * @file GData.i  
15 - * @brief GData class SWIG file.  
16 - * @author J. Knodlseder  
17 - */  
18 -%{  
19 -/* Put headers and other declarations here that are needed for compilation */  
20 -#include "GData.hpp"  
21 -%}  
22 -  
23 -  
24 -/***********************************************************************//**  
25 - * @class GData  
26 - *  
27 - * @brief Interface for the data class.  
28 - ***************************************************************************/  
29 -class GData {  
30 -public:  
31 - // Constructors and destructors  
32 - GData();  
33 - GData(const GData& data);  
34 - virtual ~GData();  
35 -  
36 - // Methods  
37 -};  
src/obs/GData.cpp deleted
1 -/***************************************************************************  
2 - * GData.cpp - Data class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - * ----------------------------------------------------------------------- *  
13 - ***************************************************************************/  
14 -/**  
15 - * @file GData.cpp  
16 - * @brief GData class implementation.  
17 - * @author J. Knodlseder  
18 - */  
19 -  
20 -/* __ Includes ___________________________________________________________ */  
21 -#include <iostream>  
22 -#include "GException.hpp"  
23 -#include "GData.hpp"  
24 -  
25 -/* __ Method name definitions ____________________________________________ */  
26 -#define G_ADD "GData::add(GObservation&)"  
27 -#define G_COPY_MEMBERS "GData::copy_members(const GData&)"  
28 -#define G_OBSERVATION "GData::observation(int) const"  
29 -  
30 -/* __ Macros _____________________________________________________________ */  
31 -  
32 -/* __ Coding definitions _________________________________________________ */  
33 -  
34 -/* __ Debug definitions __________________________________________________ */  
35 -  
36 -  
37 -/*==========================================================================  
38 - = =  
39 - = GData constructors/destructors =  
40 - = =  
41 - ==========================================================================*/  
42 -  
43 -/***********************************************************************//**  
44 - * @brief Constructor  
45 - ***************************************************************************/  
46 -GData::GData()  
47 -{  
48 - // Initialise class members for clean destruction  
49 - init_members();  
50 -  
51 - // Return  
52 - return;  
53 -}  
54 -  
55 -  
56 -/***********************************************************************//**  
57 - * @brief Copy constructor  
58 - *  
59 - * @param data GData instance which should be used for construction  
60 - ***************************************************************************/  
61 -GData::GData(const GData& data)  
62 -{  
63 - // Initialise class members for clean destruction  
64 - init_members();  
65 -  
66 - // Copy members  
67 - copy_members(data);  
68 -  
69 - // Return  
70 - return;  
71 -}  
72 -  
73 -  
74 -/***********************************************************************//**  
75 - * @brief Destructor  
76 - ***************************************************************************/  
77 -GData::~GData()  
78 -{  
79 - // Free members  
80 - free_members();  
81 -  
82 - // Return  
83 - return;  
84 -}  
85 -  
86 -  
87 -/*==========================================================================  
88 - = =  
89 - = GData operators =  
90 - = =  
91 - ==========================================================================*/  
92 -  
93 -/***********************************************************************//**  
94 - * @brief Assignment operator  
95 - *  
96 - * @param[in] data GData instance to be assigned  
97 - ***************************************************************************/  
98 -GData& GData::operator= (const GData& data)  
99 -{  
100 - // Execute only if object is not identical  
101 - if (this != &data) {  
102 -  
103 - // Free members  
104 - free_members();  
105 -  
106 - // Initialise private members for clean destruction  
107 - init_members();  
108 -  
109 - // Copy members  
110 - copy_members(data);  
111 -  
112 - } // endif: object was not identical  
113 -  
114 - // Return this object  
115 - return *this;  
116 -}  
117 -  
118 -  
119 -/*==========================================================================  
120 - = =  
121 - = GData public methods =  
122 - = =  
123 - ==========================================================================*/  
124 -  
125 -/***********************************************************************//**  
126 - * @brief Add observation to data  
127 - ***************************************************************************/  
128 -void GData::add(GObservation& obs)  
129 -{  
130 - // Allocate new observation pointers  
131 - GObservation** new_obs = new GObservation*[m_num+1];  
132 - if (new_obs == NULL)  
133 - throw GException::mem_alloc(G_ADD, m_num+1);  
134 -  
135 - // If we have already observation pointers then copy them over to the  
136 - // new pointer array  
137 - if (m_num > 0) {  
138 - for (int i = 0; i < m_num; ++i)  
139 - new_obs[i] = m_obs[i];  
140 - }  
141 -  
142 - // Create a copy of the observation that should be added and store the  
143 - // pointer to this copy as last element of the pointer array  
144 - new_obs[m_num] = obs.clone();  
145 -  
146 - // Release old pointer array  
147 - if (m_obs != NULL) delete [] m_obs;  
148 -  
149 - // Attach new pointer array to this object  
150 - m_obs = new_obs;  
151 -  
152 - // Increment number of observations  
153 - m_num++;  
154 -  
155 - // Return  
156 - return;  
157 -}  
158 -  
159 -  
160 -/***********************************************************************//**  
161 - * @brief Returns pointer on observation  
162 - *  
163 - * @param[in] index Index of observation (0,1,2,...)  
164 - ***************************************************************************/  
165 -GObservation* GData::observation(int index) const  
166 -{  
167 - // If index is outside boundary then throw an error  
168 - if (index < 0 || index >= m_num)  
169 - throw GException::out_of_range(G_OBSERVATION, index, 0, m_num-1);  
170 -  
171 - // Return observation pointer  
172 - return m_obs[index];  
173 -}  
174 -  
175 -  
176 -/***********************************************************************//**  
177 - * @brief Optimize model parameters using optimizer  
178 - *  
179 - * @param[in] opt Optimiser to be used for  
180 - ***************************************************************************/  
181 -void GData::optimize(GOptimizer& opt)  
182 -{  
183 - // Set optimizer function  
184 - GData::optimizer fct(this);  
185 -  
186 - // Optimise model parameters  
187 - m_models = opt(fct, m_models);  
188 -  
189 - // Return  
190 - return;  
191 -}  
192 -  
193 -  
194 -/***********************************************************************//**  
195 - * @brief Get iterator for first observation and event  
196 - *  
197 - * Any empty observations (NULL pointer) or observations with 0 events are  
198 - * skipped.  
199 - ***************************************************************************/  
200 -GData::iterator GData::begin(void)  
201 -{  
202 - // Allocate iterator object  
203 - GData::iterator iter(this);  
204 -  
205 - // Get first valid observation  
206 - if (iter.m_data != NULL) {  
207 - while (iter.m_index < iter.m_data->m_num) {  
208 - if (iter.m_data->m_obs[iter.m_index] != NULL) {  
209 - iter.m_obs = iter.m_data->m_obs[iter.m_index];  
210 - break;  
211 - }  
212 - }  
213 - }  
214 -  
215 - // Initialise event iterator  
216 - if (iter.m_obs != NULL) {  
217 - iter.m_event = iter.m_obs->events()->begin();  
218 - iter.m_end = iter.m_obs->events()->end();  
219 - }  
220 -  
221 - // Return  
222 - return iter;  
223 -}  
224 -  
225 -  
226 -/***********************************************************************//**  
227 - * @brief Get iterator after last observation and event  
228 - ***************************************************************************/  
229 -GData::iterator GData::end(void)  
230 -{  
231 - // Allocate iterator object  
232 - GData::iterator iter(this);  
233 -  
234 - // Set obeservation number beyond last observation  
235 - iter.m_index = iter.m_data->m_num;  
236 - iter.m_obs = NULL;  
237 -  
238 - // Return  
239 - return iter;  
240 -}  
241 -  
242 -  
243 -/*==========================================================================  
244 - = =  
245 - = GData private methods =  
246 - = =  
247 - ==========================================================================*/  
248 -  
249 -/***********************************************************************//**  
250 - * @brief Initialise class members  
251 - ***************************************************************************/  
252 -void GData::init_members(void)  
253 -{  
254 - // Initialise members  
255 - m_num = 0;  
256 - m_obs = NULL;  
257 - m_models = GModels();  
258 -  
259 - // Return  
260 - return;  
261 -}  
262 -  
263 -  
264 -/***********************************************************************//**  
265 - * @brief Copy class members  
266 - *  
267 - * @param[in] data GData instance from which members should be copied  
268 - *  
269 - * Copy observations from a GData object into the present object by invoking  
270 - * the observation clone method of each observation.  
271 - ***************************************************************************/  
272 -void GData::copy_members(const GData& data)  
273 -{  
274 - // Copy attributes  
275 - m_num = data.m_num;  
276 - m_models = data.m_models;  
277 -  
278 - // Copy observations  
279 - if (m_num > 0) {  
280 - m_obs = new GObservation*[m_num];  
281 - if (m_obs == NULL)  
282 - throw GException::mem_alloc(G_COPY_MEMBERS, m_num);  
283 - for (int i = 0; i < m_num; ++i) {  
284 - if (data.m_obs[i] != NULL)  
285 - m_obs[i] = (data.m_obs[i])->clone();  
286 - else  
287 - m_obs[i] = NULL;  
288 - }  
289 - }  
290 -  
291 - // Return  
292 - return;  
293 -}  
294 -  
295 -  
296 -/***********************************************************************//**  
297 - * @brief Delete class members  
298 - ***************************************************************************/  
299 -void GData::free_members(void)  
300 -{  
301 - // Free memory  
302 - if (m_obs != NULL) {  
303 - for (int i = 0; i < m_num; ++i) {  
304 - if (m_obs[i] != NULL) delete m_obs[i];  
305 - }  
306 - delete [] m_obs;  
307 - }  
308 -  
309 - // Mark memory as free  
310 - m_obs = NULL;  
311 -  
312 - // Return  
313 - return;  
314 -}  
315 -  
316 -  
317 -/*==========================================================================  
318 - = =  
319 - = GData friends =  
320 - = =  
321 - ==========================================================================*/  
322 -  
323 -/***********************************************************************//**  
324 - * @brief Output operator  
325 - *  
326 - * @param[in] os Output stream into which the data will be dumped  
327 - * @param[in] data Data to be dumped  
328 - ***************************************************************************/  
329 -std::ostream& operator<< (std::ostream& os, const GData& data)  
330 -{  
331 - // Put header in stream  
332 - os << "=== GData ===" << std::endl;  
333 - os << " Number of observations ....: " << data.m_num << std::endl;  
334 -  
335 - // Put observations in stream  
336 - for (int i = 0; i < data.m_num; ++i)  
337 - os << *(data.m_obs[i]);  
338 -  
339 - // Add models to stream  
340 - os << data.m_models;  
341 -  
342 - // Return output stream  
343 - return os;  
344 -}  
345 -  
346 -  
347 -/*==========================================================================  
348 - = =  
349 - = Other functions used by GData =  
350 - = =  
351 - ==========================================================================*/  
src/obs/GData_iterator.cpp deleted
1 -/***************************************************************************  
2 - * GData_iterator.cpp - Iterator class of data class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - * ----------------------------------------------------------------------- *  
13 - ***************************************************************************/  
14 -/**  
15 - * @file GData_iterator.cpp  
16 - * @brief GData::iterator class implementation.  
17 - * @author J. Knodlseder  
18 - */  
19 -  
20 -/* __ Includes ___________________________________________________________ */  
21 -#include "GData.hpp"  
22 -  
23 -/* __ Method name definitions ____________________________________________ */  
24 -  
25 -/* __ Macros _____________________________________________________________ */  
26 -  
27 -/* __ Coding definitions _________________________________________________ */  
28 -  
29 -/* __ Debug definitions __________________________________________________ */  
30 -  
31 -  
32 -/*==========================================================================  
33 - = =  
34 - = GData::iterator constructors/destructors =  
35 - = =  
36 - ==========================================================================*/  
37 -  
38 -/***********************************************************************//**  
39 - * @brief Void iterator constructor  
40 - ***************************************************************************/  
41 -GData::iterator::iterator()  
42 -{  
43 - // Initialise iterator  
44 - m_data = NULL;  
45 - m_index = 0;  
46 - m_obs = NULL;  
47 - m_event = GEvents::iterator();  
48 - m_end = GEvents::iterator();  
49 -  
50 - // Return  
51 - return;  
52 -}  
53 -  
54 -  
55 -/***********************************************************************//**  
56 - * @brief Iterator constructor based on specific GData object  
57 - ***************************************************************************/  
58 -GData::iterator::iterator(GData *data)  
59 -{  
60 - // Initialise iterator  
61 - m_data = data;  
62 - m_index = 0;  
63 - m_obs = NULL;  
64 - m_event = GEvents::iterator();  
65 - m_end = GEvents::iterator();  
66 -  
67 - // Return  
68 - return;  
69 -}  
70 -  
71 -  
72 -  
73 -/*==========================================================================  
74 - = =  
75 - = GData::iterator operators =  
76 - = =  
77 - ==========================================================================*/  
78 -  
79 -/***********************************************************************//**  
80 - * @brief Iterator prefix operator  
81 - *  
82 - * The iterator skips any empty observations (i.e. NULL observation pointer)  
83 - * and all observations with 0 events.  
84 - ***************************************************************************/  
85 -GData::iterator& GData::iterator::operator++(void)  
86 -{  
87 - // Only iterate if we have a valid data pointer  
88 - if (m_data != NULL) {  
89 -  
90 - // Increment event iterator  
91 - m_event++;  
92 -  
93 - // If end of observation is reached then set iterator to first event of  
94 - // next valid observation  
95 - if (m_event == m_end) {  
96 -  
97 - // Find next valid observation  
98 - while (m_index < m_data->m_num) {  
99 -  
100 - // Go to next observation  
101 - m_index++;  
102 -  
103 - // If we still have an observation then set now the iterator  
104 - // to the first event from this observation ...  
105 - if (m_index < m_data->m_num) {  
106 -  
107 - // Get next observation. Skip if empty  
108 - m_obs = m_data->m_obs[m_index];  
109 - if (m_obs == NULL)  
110 - continue;  
111 -  
112 - // Skip observation if it contains no events  
113 - if (m_obs->events() == NULL)  
114 - continue;  
115 -  
116 - // Set iterator to first event of current observation. Exit  
117 - // only if we have events in that observation  
118 - m_event = m_obs->events()->begin();  
119 - m_end = m_obs->events()->end();  
120 - if (m_event != m_end)  
121 - break;  
122 -  
123 - } // endif: we still had an observation  
124 -  
125 - } // endwhile: searched for next valid observation  
126 -  
127 - // If observations are exhausted then set iterator to signal the end  
128 - if (m_index >= m_data->m_num) {  
129 - m_index = m_data->m_num;  
130 - m_obs = NULL;  
131 - m_event = GEvents::iterator();  
132 - m_end = GEvents::iterator();  
133 - }  
134 -  
135 - } // endif: end of observation has been reached  
136 - } // endif: we had a valid data pointer  
137 -  
138 - // Return  
139 - return *this;  
140 -}  
141 -  
142 -  
143 -/***********************************************************************//**  
144 - * @brief Iterator postfix operator  
145 - ***************************************************************************/  
146 -GData::iterator GData::iterator::operator++(int junk)  
147 -{  
148 - // Save actual iterator  
149 - GData::iterator actual = *this;  
150 -  
151 - // Increment using prefix iterator  
152 - ++(*this);  
153 -  
154 - // Return actual iterator  
155 - return actual;  
156 -}  
157 -  
158 -  
159 -/*==========================================================================  
160 - = =  
161 - = GData::iterator public methods =  
162 - = =  
163 - ==========================================================================*/  
164 -  
165 -/*==========================================================================  
166 - = =  
167 - = GData::iterator private methods =  
168 - = =  
169 - ==========================================================================*/  
170 -  
171 -/*==========================================================================  
172 - = =  
173 - = GData::iterator friends =  
174 - = =  
175 - ==========================================================================*/  
176 -  
177 -/*==========================================================================  
178 - = =  
179 - = Other functions used by GData::iterator =  
180 - = =  
181 - ==========================================================================*/  
src/obs/GData_optimizer.cpp deleted
1 -/***************************************************************************  
2 - * GData_optimizer.cpp - Optimizer class of data class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - * ----------------------------------------------------------------------- *  
13 - ***************************************************************************/  
14 -/**  
15 - * @file GData_optimizer.cpp  
16 - * @brief GData::optimizer class implementation.  
17 - * @author J. Knodlseder  
18 - */  
19 -  
20 -/* __ Includes ___________________________________________________________ */  
21 -#include "GData.hpp"  
22 -  
23 -/* __ Method name definitions ____________________________________________ */  
24 -  
25 -/* __ Macros _____________________________________________________________ */  
26 -  
27 -/* __ Coding definitions _________________________________________________ */  
28 -  
29 -/* __ Debug definitions __________________________________________________ */  
30 -#define G_EVAL_TIMING 1  
31 -  
32 -/* __ Prototypes _________________________________________________________ */  
33 -  
34 -  
35 -/*==========================================================================  
36 - = =  
37 - = GData::optimizer constructors/destructors =  
38 - = =  
39 - ==========================================================================*/  
40 -  
41 -/***********************************************************************//**  
42 - * @brief Constructor  
43 -***************************************************************************/  
44 -GData::optimizer::optimizer(void) : GOptimizerFunction()  
45 -{  
46 - // Initialise iterator  
47 - init_members();  
48 -  
49 - // Return  
50 - return;  
51 -}  
52 -  
53 -  
54 -/***********************************************************************//**  
55 - * @brief Constructor based on specific GData object  
56 - ***************************************************************************/  
57 -GData::optimizer::optimizer(GData *data) : GOptimizerFunction()  
58 -{  
59 - // Initialise iterator  
60 - init_members();  
61 -  
62 - // Set data object  
63 - m_data = data;  
64 -  
65 - // Return  
66 - return;  
67 -}  
68 -  
69 -  
70 -  
71 -/***********************************************************************//**  
72 - * @brief Copy constructor  
73 - *  
74 - * @param data GData instance which should be used for construction  
75 - ***************************************************************************/  
76 -GData::optimizer::optimizer(const optimizer& fct) : GOptimizerFunction(fct)  
77 -{  
78 - // Initialise class members for clean destruction  
79 - init_members();  
80 -  
81 - // Copy members  
82 - copy_members(fct);  
83 -  
84 - // Return  
85 - return;  
86 -}  
87 -  
88 -  
89 -/***********************************************************************//**  
90 - * @brief Destructor  
91 - ***************************************************************************/  
92 -GData::optimizer::~optimizer()  
93 -{  
94 - // Free members  
95 - free_members();  
96 -  
97 - // Return  
98 - return;  
99 -}  
100 -  
101 -  
102 -/*==========================================================================  
103 - = =  
104 - = GData::optimizer operators =  
105 - = =  
106 - ==========================================================================*/  
107 -  
108 -/***********************************************************************//**  
109 - * @brief Assignment operator  
110 - *  
111 - * @param[in] data GData instance to be assigned  
112 - ***************************************************************************/  
113 -GData::optimizer& GData::optimizer::operator= (const optimizer& fct)  
114 -{  
115 - // Execute only if object is not identical  
116 - if (this != &fct) {  
117 -  
118 - // Copy base class members  
119 - this->GOptimizerFunction::operator=(fct);  
120 -  
121 - // Free members  
122 - free_members();  
123 -  
124 - // Initialise private members for clean destruction  
125 - init_members();  
126 -  
127 - // Copy members  
128 - copy_members(fct);  
129 -  
130 - } // endif: object was not identical  
131 -  
132 - // Return this object  
133 - return *this;  
134 -}  
135 -  
136 -  
137 -/*==========================================================================  
138 - = =  
139 - = GData::optimizer public methods =  
140 - = =  
141 - ==========================================================================*/  
142 -  
143 -/***********************************************************************//**  
144 - * @brief Evaluate function  
145 - ***************************************************************************/  
146 -void GData::optimizer::eval(const GOptimizerPars& pars)  
147 -{  
148 - // Timing measurement  
149 - #if G_EVAL_TIMING  
150 - clock_t t_start = clock();  
151 - #endif  
152 -  
153 - // Allocate pointers for temporary memory  
154 - int* inx = NULL;  
155 - double* values = NULL;  
156 -  
157 - // Single loop for common exit point  
158 - do {  
159 - // Get number of parameters  
160 - int npars = pars.npars();  
161 - int nfree = pars.nfree();  
162 -  
163 - // Fall through if we have no free parameters  
164 - if (npars < 1)  
165 - continue;  
166 -  
167 - // Free old memory  
168 - if (m_gradient != NULL) delete m_gradient;  
169 - if (m_covar != NULL) delete m_covar;  
170 -  
171 - // Initialise value, gradient vector and curvature matrix  
172 - m_value = 0.0;  
173 - m_gradient = new GVector(npars);  
174 - m_covar = new GSparseMatrix(npars,npars);  
175 -  
176 - // Allocate some working arrays  
177 - GVector grad(npars);  
178 - m_covar->stack_init(npars,10000);  
179 - inx = new int[npars];  
180 - values = new double[npars];  
181 -  
182 - // Iterate over all data bins  
183 - GData::iterator end = m_data->end();  
184 - for (GData::iterator bin = m_data->begin(); bin != end; ++bin) {  
185 -  
186 - // Get number of counts in bin  
187 - double data = bin->counts();  
188 -  
189 - // Get model and derivative  
190 - double model = bin->model((GModels&)pars, &grad);  
191 -  
192 - // Skip bin if model is empty  
193 - if (model <= 0.0)  
194 - continue;  
195 -  
196 - // Create index array of non-zero derivatives  
197 - int ndev = 0;  
198 - for (int i = 0; i < npars; ++i) {  
199 - if (grad(i) != 0.0) {  
200 - inx[ndev] = i;  
201 - ndev++;  
202 - }  
203 - }  
204 -  
205 - // Update Poissonian statistics  
206 - m_value -= data * log(model) - model;  
207 -  
208 - // Skip bin now if there are no non-zero derivatives  
209 - if (ndev < 1)  
210 - continue;  
211 -  
212 - // Update gradient vector and curvature matrix. To avoid unneccessary  
213 - // computation we distinguish the case where data>0 and data=0. The  
214 - // second case requires much less computation since it does not  
215 - // contribute to the covariance matrix ...  
216 - if (data > 0.0) {  
217 -  
218 - // Pre computation  
219 - double fb = data / model;  
220 - double fc = (1.0 - fb);  
221 - double fa = fb / model;  
222 -  
223 - // Loop over columns  
224 - for (int jdev = 0; jdev < ndev; ++jdev) {  
225 -  
226 - // Initialise computation  
227 - register int jpar = inx[jdev];  
228 - double g = grad(jpar);  
229 - double fa_i = fa * g;  
230 -  
231 - // Update gradient  
232 - (*m_gradient)(jpar) += fc * g;  
233 -  
234 - // Loop over rows  
235 - register int* ipar = inx;  
236 - for (register int idev = 0; idev < ndev; ++idev, ++ipar)  
237 - values[idev] = fa_i * grad(*ipar);  
238 -  
239 - // Add column to matrix  
240 - m_covar->add_col(values, inx, ndev, jpar);  
241 - }  
242 - }  
243 -  
244 - // ... handle now data=0  
245 - else {  
246 - register int* ipar = inx;  
247 - for (register int idev = 0; idev < ndev; ++idev, ++ipar)  
248 - (*m_gradient)(*ipar) += grad(*ipar);  
249 - }  
250 -  
251 - } // endfor: iterated over all data bins  
252 -  
253 - // Release stack  
254 - m_covar->stack_destroy();  
255 -  
256 - } while(0); // endwhile: main loop  
257 -  
258 - // Free temporary memory  
259 - if (values != NULL) delete [] values;  
260 - if (inx != NULL) delete [] inx;  
261 -  
262 - // Timing measurement  
263 - #if G_EVAL_TIMING  
264 - double t_elapse = (double)(clock() - t_start) / (double)CLOCKS_PER_SEC;  
265 - std::cout << "GData::optimizer::eval: CPU usage = "  
266 - << t_elapse << " sec" << std::endl;  
267 - #endif  
268 -  
269 - // Return  
270 - return;  
271 -}  
272 -  
273 -  
274 -/*==========================================================================  
275 - = =  
276 - = GData::optimizer private methods =  
277 - = =  
278 - ==========================================================================*/  
279 -  
280 -/***********************************************************************//**  
281 - * @brief Initialise class members  
282 - ***************************************************************************/  
283 -void GData::optimizer::init_members(void)  
284 -{  
285 - // Initialise members  
286 - m_value = 0.0;  
287 - m_gradient = NULL;  
288 - m_covar = NULL;  
289 - m_data = NULL;  
290 -  
291 - // Return  
292 - return;  
293 -}  
294 -  
295 -  
296 -/***********************************************************************//**  
297 - * @brief Copy class members  
298 - *  
299 - * @param[in] fct GData::optimizer members to be copied.  
300 - ***************************************************************************/  
301 -void GData::optimizer::copy_members(const optimizer& fct)  
302 -{  
303 - // Copy attributes  
304 - m_value = fct.m_value;  
305 -  
306 - // Copy gradient if it exists  
307 - if (fct.m_gradient != NULL)  
308 - m_gradient = new GVector(*fct.m_gradient);  
309 -  
310 - // Copy covariance matrix if it exists  
311 - if (fct.m_covar != NULL)  
312 - m_covar = new GSparseMatrix(*fct.m_covar);  
313 -  
314 - // Return  
315 - return;  
316 -}  
317 -  
318 -  
319 -/***********************************************************************//**  
320 - * @brief Delete class members  
321 - ***************************************************************************/  
322 -void GData::optimizer::free_members(void)  
323 -{  
324 - // Free members  
325 - if (m_gradient != NULL) delete m_gradient;  
326 - if (m_covar != NULL) delete m_covar;  
327 -  
328 - // Signal free pointers  
329 - m_gradient = NULL;  
330 - m_covar = NULL;  
331 -  
332 - // Return  
333 - return;  
334 -}  
335 -  
336 -  
337 -/*==========================================================================  
338 - = =  
339 - = GData::optimizer friends =  
340 - = =  
341 - ==========================================================================*/  
342 -  
343 -/*==========================================================================  
344 - = =  
345 - = Other functions used by GData::optimizer =  
346 - = =  
347 - ==========================================================================*/  
src/support/GTools.hpp deleted
1 -/***************************************************************************  
2 - * GTools.hpp - GammaLib tools *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright (C) 2008-2010 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -/**  
14 - * @file GTools.hpp  
15 - * @brief Gammalib tools definition  
16 - * @author J. Knodlseder  
17 - */  
18 -  
19 -#ifndef GTOOLS_HPP  
20 -#define GTOOLS_HPP  
21 -  
22 -/* __ Includes ___________________________________________________________ */  
23 -  
24 -/* __ Namespaces _________________________________________________________ */  
25 -  
26 -/* __ Constants __________________________________________________________ */  
27 -const double pi = 3.141592653589793238462643383279502884197;  
28 -const double twopi = 6.283185307179586476925286766559005768394;  
29 -const double fourpi = 12.56637061435917295385057353311801153679;  
30 -const double pihalf = 1.570796326794896619231321691639751442099;  
31 -const double inv_pihalf = 0.6366197723675813430755350534900574;  
32 -const double inv_sqrt4pi = 0.2820947917738781434740397257803862929220;  
33 -const double deg2rad = 0.0174532925199432954743717;  
34 -const double rad2deg = 57.295779513082322864647722;  
35 -const double ln2 = 0.6931471805599453094172321214581766;  
36 -const double ln10 = 2.3025850929940456840179914546843642;  
37 -const double inv_ln2 = 1.4426950408889634073599246810018921;  
38 -const double onethird = 1.0/3.0;  
39 -const double twothird = 2.0/3.0;  
40 -const double fourthird = 4.0/3.0;  
41 -  
42 -/* __ Prototypes ________________________________________________________ */  
43 -std::string strip_whitespace(const std::string& arg);  
44 -std::string str(const int& value);  
45 -std::string str(const float& value);  
46 -std::string str(const double& value);  
47 -std::string toupper(const std::string& s);  
48 -std::string tolower(const std::string& s);  
49 -double modulo(double v1, double v2);  
50 -  
51 -#endif /* GTOOLS_HPP */  
test/test_GData.cpp deleted
1 -/***************************************************************************  
2 - * test_GData.cpp - test GData class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -  
14 -/* __ Includes ___________________________________________________________ */  
15 -#include <stdlib.h>  
16 -#include "test_GData.hpp"  
17 -#include "GModelPar.hpp"  
18 -  
19 -/* __ Namespaces _________________________________________________________ */  
20 -  
21 -/* __ Globals ____________________________________________________________ */  
22 -  
23 -  
24 -/***************************************************************************  
25 - * Test: LAT unbinned observation handling *  
26 - ***************************************************************************/  
27 -void test_lat_unbinned(void)  
28 -{  
29 - // Write header  
30 - std::cout << "Test LAT unbinned data handling: ";  
31 -  
32 - // Declare observations  
33 - GData data;  
34 - GLATObservation obs;  
35 -  
36 - // Load unbinned LAT observation  
37 - try {  
38 - obs.load_unbinned("data/lat/ft1.fits.gz", "data/lat/ft2.fits.gz", "");  
39 - }  
40 - catch (std::exception &e) {  
41 - std::cout << std::endl << "TEST ERROR: Unable to load LAT observation."  
42 - << std::endl;  
43 - std::cout << e.what() << std::endl;  
44 - throw;  
45 - }  
46 - std::cout << ".";  
47 -//std::cout << obs << std::endl;  
48 -  
49 - // Add observation (twice) to data  
50 - try {  
51 - data.add(obs);  
52 - data.add(obs);  
53 - }  
54 - catch (std::exception &e) {  
55 - std::cout << std::endl << "TEST ERROR: Unable to add LAT observation to data."  
56 - << std::endl;  
57 - std::cout << e.what() << std::endl;  
58 - throw;  
59 - }  
60 - std::cout << ".";  
61 -  
62 - // Loop over all events in GData using iterators  
63 - try {  
64 - int num = 0;  
65 - for (GData::iterator event = data.begin(); event != data.end(); ++event) {  
66 -// std::cout << *event << std::endl;  
67 -// std::cout << event->test() << std::endl;  
68 - num++;  
69 - }  
70 - if (num != 4038) {  
71 - std::cout << std::endl <<  
72 - "TEST ERROR: Wrong number of iterations in GData::iterator."  
73 - << std::endl;  
74 - throw;  
75 - }  
76 - }  
77 - catch (std::exception &e) {  
78 - std::cout << std::endl << "TEST ERROR: Unable to iterate GData." << std::endl;  
79 - std::cout << e.what() << std::endl;  
80 - throw;  
81 - }  
82 - std::cout << ".";  
83 -  
84 - // Loop over all events using iterator  
85 - try {  
86 - int num = 0;  
87 - GLATEventList *ptr = (GLATEventList*)obs.events();  
88 - for (GLATEventList::iterator event = ptr->begin(); event != ptr->end(); ++event) {  
89 -// std::cout << *event << std::endl;  
90 - num++;  
91 - }  
92 - if (num != 2019) {  
93 - std::cout << std::endl <<  
94 - "TEST ERROR: Wrong number of iterations in GLATEventList::iterator."  
95 - << std::endl;  
96 - throw;  
97 - }  
98 - }  
99 - catch (std::exception &e) {  
100 - std::cout << std::endl << "TEST ERROR: Unable to iterate GLATEventList." << std::endl;  
101 - std::cout << e.what() << std::endl;  
102 - throw;  
103 - }  
104 - std::cout << ".";  
105 -  
106 - // Plot final test success  
107 - std::cout << " ok." << std::endl;  
108 -  
109 -//GLATEventList *ptr = (GLATEventList*)obs.events();  
110 -//std::cout << obs << std::endl;  
111 -//std::cout << *ptr << std::endl;  
112 -  
113 - // Exit test  
114 - return;  
115 -  
116 -}  
117 -  
118 -  
119 -/***************************************************************************  
120 - * Test: LAT binned observation handling *  
121 - ***************************************************************************/  
122 -void test_lat_binned(void)  
123 -{  
124 - // Write header  
125 - std::cout << "Test LAT binned data handling: ";  
126 -  
127 - // Declare observations  
128 - GData data;  
129 - GLATObservation obs;  
130 -  
131 - // Load LAT binned observation  
132 - try {  
133 - obs.load_binned("data/lat/cntmap.fits.gz", "", "");  
134 - }  
135 - catch (std::exception &e) {  
136 - std::cout << std::endl << "TEST ERROR: Unable to load binned LAT observation."  
137 - << std::endl;  
138 - std::cout << e.what() << std::endl;  
139 - throw;  
140 - }  
141 - std::cout << ".";  
142 -  
143 - // Reload LAT binned observation from srcmap  
144 - try {  
145 - obs.load_binned("data/lat/srcmap.fits.gz", "", "");  
146 - }  
147 - catch (std::exception &e) {  
148 - std::cout << std::endl << "TEST ERROR: Unable to reload binned LAT observation."  
149 - << std::endl;  
150 - std::cout << e.what() << std::endl;  
151 - throw;  
152 - }  
153 - std::cout << ".";  
154 -  
155 - // Add observation (twice) to data  
156 - try {  
157 - data.add(obs);  
158 - data.add(obs);  
159 - }  
160 - catch (std::exception &e) {  
161 - std::cout << std::endl << "TEST ERROR: Unable to add LAT observation to data."  
162 - << std::endl;  
163 - std::cout << e.what() << std::endl;  
164 - throw;  
165 - }  
166 - std::cout << ".";  
167 -  
168 - // Loop over all events in GData using iterators  
169 - try {  
170 - int num = 0;  
171 - int sum = 0;  
172 - for (GData::iterator event = data.begin(); event != data.end(); ++event) {  
173 - num++;  
174 - sum += (int)event->counts();  
175 - }  
176 - if (sum != 2718 || num != 400000) {  
177 - std::cout << std::endl <<  
178 - "TEST ERROR: Wrong number of iterations in GData::iterator."  
179 - << std::endl;  
180 - throw;  
181 - }  
182 - }  
183 - catch (std::exception &e) {  
184 - std::cout << std::endl << "TEST ERROR: Unable to iterate GData." << std::endl;  
185 - std::cout << e.what() << std::endl;  
186 - throw;  
187 - }  
188 - std::cout << ".";  
189 -  
190 - // Loop over all events using iterator  
191 - try {  
192 - int num = 0;  
193 - int sum = 0;  
194 - GLATEventCube *ptr = (GLATEventCube*)obs.events();  
195 - for (GLATEventCube::iterator event = ptr->begin(); event != ptr->end(); ++event) {  
196 -// std::cout << *((GLATEventBin*)&(*event));  
197 - num++;  
198 - sum += (int)event->counts();  
199 - }  
200 - if (sum != 1359 || num != 200000) {  
201 - std::cout << std::endl <<  
202 - "TEST ERROR: Wrong number of iterations in GLATEventCube::iterator."  
203 - << std::endl;  
204 - throw;  
205 - }  
206 - }  
207 - catch (std::exception &e) {  
208 - std::cout << std::endl << "TEST ERROR: Unable to iterate GLATEventCube." << std::endl;  
209 - std::cout << e.what() << std::endl;  
210 - throw;  
211 - }  
212 - std::cout << ".";  
213 -  
214 - // Plot final test success  
215 - std::cout << " ok." << std::endl;  
216 -  
217 - // Exit test  
218 - return;  
219 -  
220 -}  
221 -  
222 -  
223 -/***************************************************************************  
224 - * Main test function *  
225 - ***************************************************************************/  
226 -int main(void)  
227 -{  
228 - // Dump header  
229 - std::cout << std::endl;  
230 - std::cout << "***********************" << std::endl;  
231 - std::cout << "* GData class testing *" << std::endl;  
232 - std::cout << "***********************" << std::endl;  
233 -  
234 - // Execute the tests  
235 - test_lat_unbinned();  
236 - test_lat_binned();  
237 -  
238 - // Return  
239 - return 0;  
240 -}  
test/test_GData.hpp deleted
1 -/***************************************************************************  
2 - * test_GData.hpp - test GData classe *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright : (C) 2008 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -  
14 -#ifndef TEST_GDATA_HPP  
15 -#define TEST_GDATA_HPP  
16 -  
17 -/* __ Includes ___________________________________________________________ */  
18 -#include "GammaLib.hpp"  
19 -#include <iostream> // cout, cerr  
20 -#include <stdexcept> // std::exception  
21 -//#include <math.h>  
22 -  
23 -#endif /* TEST_GDATA_HPP */  
test/test_GModel.hpp deleted
1 -/***************************************************************************  
2 - * test_GModel.hpp - test GModel class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -  
14 -#ifndef TEST_GMODEL_HPP  
15 -#define TEST_GMODEL_HPP  
16 -  
17 -/* __ Includes ___________________________________________________________ */  
18 -#include "GammaLib.hpp"  
19 -#include <iostream> // cout, cerr  
20 -#include <stdexcept> // std::exception  
21 -//#include <math.h>  
22 -  
23 -#endif /* TEST_GMODEL_HPP */  
test/test_GOptimizer.cpp deleted
1 -/***************************************************************************  
2 - * test_GOptimizer.cpp - test GOptimizer class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -  
14 -/* __ Includes ___________________________________________________________ */  
15 -#include <stdlib.h>  
16 -#include "test_GOptimizer.hpp"  
17 -  
18 -/* __ Namespaces _________________________________________________________ */  
19 -  
20 -/* __ Globals ____________________________________________________________ */  
21 -  
22 -  
23 -/***************************************************************************  
24 - * Test: Optimizer *  
25 - ***************************************************************************/  
26 -void test_optimizer(void)  
27 -{  
28 - // Write header  
29 - std::cout << "Test GOptimizer: ";  
30 -  
31 - // Number of observations in data  
32 - int nobs = 1;  
33 -  
34 - // Setup GData for optimizing  
35 - GData data;  
36 - GLATObservation obs;  
37 - try {  
38 - obs.load_binned("data/lat/cntmap.fits.gz", "", "");  
39 - for (int i = 0; i < nobs; ++i)  
40 - data.add(obs);  
41 - }  
42 - catch (std::exception &e) {  
43 - std::cout << std::endl  
44 - << "TEST ERROR: Unable setup GData for optimizing."  
45 - << std::endl;  
46 - std::cout << e.what() << std::endl;  
47 - throw;  
48 - }  
49 - std::cout << ".";  
50 -//std::cout << data << std::endl;  
51 -  
52 - // Setup GModels for optimizing  
53 - GModelSpatialPtsrc point_source;  
54 - GModelSpectralPlaw power_law;  
55 - GModel crab;  
56 - GModels models;  
57 - try {  
58 - GSkyDir dir;  
59 - dir.radec_deg(83.6331, +22.0145);  
60 - point_source = GModelSpatialPtsrc(dir);  
61 - power_law = GModelSpectralPlaw(1.0e-7, -2.1);  
62 - crab = GModel(point_source, power_law);  
63 - crab.name("Crab");  
64 - models.add(crab);  
65 - data.models(models);  
66 - }  
67 - catch (std::exception &e) {  
68 - std::cout << std::endl  
69 - << "TEST ERROR: Unable setup GModels for optimizing."  
70 - << std::endl;  
71 - std::cout << e.what() << std::endl;  
72 - throw;  
73 - }  
74 - std::cout << ".";  
75 -//std::cout << models << std::endl;  
76 -  
77 - // Setup parameters for optimizing  
78 - GOptimizerPars pars;  
79 - try {  
80 - pars = GOptimizerPars(models);  
81 - }  
82 - catch (std::exception &e) {  
83 - std::cout << std::endl  
84 - << "TEST ERROR: Unable setup GOptimizerPars for optimizing."  
85 - << std::endl;  
86 - std::cout << e.what() << std::endl;  
87 - throw;  
88 - }  
89 - std::cout << ".";  
90 -//std::cout << pars << std::endl;  
91 -  
92 - // Time simple GData iterator  
93 - double t_elapse;  
94 - try {  
95 - clock_t t_start = clock();  
96 - int num = 0;  
97 - int sum = 0;  
98 - for (GData::iterator event = data.begin(); event != data.end(); ++event) {  
99 - num++;  
100 - sum += (int)event->counts();  
101 - }  
102 - t_elapse = double(clock() - t_start)/double(CLOCKS_PER_SEC);  
103 - }  
104 - catch (std::exception &e) {  
105 - std::cout << std::endl  
106 - << "TEST ERROR: Unable to iterate GData."  
107 - << std::endl;  
108 - std::cout << e.what() << std::endl;  
109 - throw;  
110 - }  
111 - std::cout << "." << std::endl;  
112 - std::cout << " - Reference time for GData::iterator: " << t_elapse << std::endl;  
113 -  
114 - // Setup LM optimizer  
115 - GOptimizerLM opt;  
116 - try {  
117 - data.optimize(opt);  
118 - }  
119 - catch (std::exception &e) {  
120 - std::cout << std::endl  
121 - << "TEST ERROR: Unable setup optimizer."  
122 - << std::endl;  
123 - std::cout << e.what() << std::endl;  
124 - throw;  
125 - }  
126 - std::cout << ".";  
127 -//std::cout << opt << std::endl;  
128 -std::cout << data << std::endl;  
129 -  
130 - // Plot final test success  
131 - std::cout << " ok." << std::endl;  
132 -  
133 - // Exit test  
134 - return;  
135 -  
136 -}  
137 -  
138 -  
139 -/***************************************************************************  
140 - * Main test function *  
141 - ***************************************************************************/  
142 -int main(void)  
143 -{  
144 - // Dump header  
145 - std::cout << std::endl;  
146 - std::cout << "****************************" << std::endl;  
147 - std::cout << "* GOptimizer class testing *" << std::endl;  
148 - std::cout << "****************************" << std::endl;  
149 -  
150 - // Execute the tests  
151 - test_optimizer();  
152 -  
153 - // Return  
154 - return 0;  
155 -}  
test/test_GOptimizer.hpp deleted
1 -/***************************************************************************  
2 - * test_GOptimizer.hpp - test GOptimizer class *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright (C) 2009 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -  
14 -#ifndef TEST_GOPTIMIZER_HPP  
15 -#define TEST_GOPTIMIZER_HPP  
16 -  
17 -/* __ Includes ___________________________________________________________ */  
18 -#include "GammaLib.hpp"  
19 -#include <iostream> // cout, cerr  
20 -#include <stdexcept> // std::exception  
21 -  
22 -#endif /* TEST_GOPTIMIZER_HPP */  
test/test_GResponse.cpp deleted
1 -/***************************************************************************  
2 - * test_GResponse.cpp - test Response classes *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright : (C) 2008 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -  
14 -/* __ Includes ___________________________________________________________ */  
15 -#include <stdlib.h>  
16 -#include <iostream>  
17 -#include "test_GResponse.hpp"  
18 -  
19 -/* __ Namespaces _________________________________________________________ */  
20 -  
21 -/* __ Globals ____________________________________________________________ */  
22 -  
23 -  
24 -/***************************************************************************  
25 - * Test: LAT Response *  
26 - ***************************************************************************/  
27 -void test_lat_response(void)  
28 -{  
29 - // Remove FITS file  
30 - system("rm -rf test_rsp.fits");  
31 -  
32 - std::cout << "Test GLATResponse: Open PSF FITS file: ";  
33 - try {  
34 - // Get HANDOFF Response  
35 - GLATResponse rsp;  
36 - rsp.set_caldb("irf/lat");  
37 - rsp.load("Pass5_v0", "front");  
38 -  
39 - // Save response  
40 - rsp.save("test_rsp.fits");  
41 - }  
42 - catch (std::exception &e) {  
43 - std::cout << std::endl << "TEST ERROR: Unable to open FITS file." << std::endl;  
44 - std::cout << e.what() << std::endl;  
45 - throw;  
46 - }  
47 - std::cout << ". ok." << std::endl;  
48 -}  
49 -  
50 -  
51 -/***************************************************************************  
52 - * Main test function *  
53 - ***************************************************************************/  
54 -int main(void)  
55 -{  
56 - // Dump header  
57 - std::cout << std::endl;  
58 - std::cout << "***************************" << std::endl;  
59 - std::cout << "* GResponse class testing *" << std::endl;  
60 - std::cout << "***************************" << std::endl;  
61 -  
62 - // Execute the tests  
63 - test_lat_response();  
64 -  
65 - // Return  
66 - return 0;  
67 -}  
test/test_GResponse.hpp deleted
1 -/***************************************************************************  
2 - * test_GResponse.hpp - test Response classes *  
3 - * ----------------------------------------------------------------------- *  
4 - * copyright : (C) 2008 by Jurgen Knodlseder *  
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 2 of the License, or *  
10 - * (at your option) any later version. *  
11 - * *  
12 - ***************************************************************************/  
13 -  
14 -#ifndef TEST_GRESPONSE_HPP  
15 -#define TEST_GRESPONSE_HPP  
16 -  
17 -/* __ Includes ___________________________________________________________ */  
18 -#include "GammaLib.hpp"  
19 -#include <iostream> // cout, cerr  
20 -#include <stdexcept> // std::exception  
21 -//#include <math.h>  
22 -  
23 -#endif /* TEST_GRESPONSE_HPP */