GOnOffBin.hpp

Martin Pierrick, 06/23/2013 03:14 PM

Download (5.16 KB)

 
1
/***************************************************************************
2
 *                GOnOffBin.hpp - ON-OFF measurement class                 *
3
 * ----------------------------------------------------------------------- *
4
 *  copyright (C) 2009-2013 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 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 GOnOffBin.hpp
23
 * @brief ON-OFF measurement interface definition.
24
 * @author Pierrick Martin
25
 */
26

    
27
#ifndef GONOFFBIN_HPP
28
#define GONOFFBIN_HPP
29

    
30
/* __ Includes ___________________________________________________________ */
31
#include <string>
32
#include "GBase.hpp"
33

    
34
/* __ Forward declarations _______________________________________________ */
35
class GSkyRegion;
36
class GSkyRegions;
37
class GEnergy;
38
class GObservation;
39

    
40

    
41
/***********************************************************************//**
42
* @class GOnOffBin
43
*
44
* @brief ON-OFF measurement class.
45
*
46
* This class holds all low level information about an ON-OFF measurement,
47
* such as counts or acceptances for given ON and OFF regions. Higher level
48
* information such as fluxes is obtained from a subsequent fitting stage.
49
*
50
* This is a basic element in the implementation of classical data analysis
51
* methods for TeV data from existing Cherenkov telescopes such as H.E.S.S.,
52
* VERITAS, or MAGIC. Spectral or morphological analyses are performed on
53
* arrays of such a class.
54
*
55
* The class is built on the assumption that there is only one ON region but 
56
* multiple OFF regions that are thus stored in a sky region container.
57
*
58
* Note : The sky regions and energy members must be created for each 
59
* instance of GOnOffBin and not just be pointers to the objects passed
60
* on instantiation, because the latter may be erased/overwritten in a loop
61
* over observation runs when filling the GOnOffBin array.
62
***************************************************************************/
63
class GOnOffBin : public GBase {
64
        
65
public:
66
    // Constructors and destructors
67
    GOnOffBin(void);
68
        explicit GOnOffBin(const GObservation& obs, const GSkyRegion& on, const GSkyRegions& off, const GEnergy emin, const GEnergy emax);
69
    GOnOffBin(const GOnOffBin& bin);
70
        ~GOnOffBin(void);
71
        
72
    // Operators
73
    virtual GOnOffBin& operator= (const GOnOffBin& bin);
74
        
75
    // Basic methods
76
        void            clear(void);
77
    GOnOffBin*      clone(void) const;
78
    std::string     type(void) const;
79
    std::string     print(const GChatter& chatter = NORMAL) const;
80
        
81
        // Specific methods
82
        GEnergy*        emin(void) const { return m_emin; }
83
        GEnergy*        emax(void) const { return m_emax; }
84
        GSkyRegion*     onregion(void) const { return m_onreg; } 
85
        GSkyRegions*    offregion(void) const { return m_offreg; }
86
        const double    alpha(void) const { return m_alpha; }
87
        const double    onacc(void) const { return m_onacc; }
88
        const double    offacc(void) const { return m_offacc; }
89
        const double    ontime(void) const { return m_ontime; }
90
        const double    offtime(void) const { return m_offtime; }
91
        const int       oncts(void) const { return m_oncts; }
92
        const int       offcts(void) const { return m_offcts; }
93
        
94
protected:
95
    // Protected methods
96
    void init_members(void);
97
    void copy_members(const GOnOffBin& bin);
98
    void free_members(void);
99
        
100
        // Protected members
101
        std::string    m_obsid;       //!< Observation identifier
102
        int            m_oncts;       //!< Number of counts in ON region
103
        int            m_offcts;      //!< Number of counts in OFF region
104
        double         m_onacc;       //!< Acceptance in ON region
105
        double         m_offacc;      //!< Acceptance in OFF region
106
        double         m_ontime;      //!< Exposure time in ON region
107
        double         m_offtime;     //!< Exposure time in OFF region
108
        double         m_alpha;       //!< Ratio of ON/OFF acceptances
109
        std::string    m_method;      //!< Method used for background estimation
110
        GSkyRegion*    m_onreg        //!< ON sky region object
111
        GSkyRegions*   m_offreg       //!< OFF sky regions container
112
        GEnergy*       m_emin         //!< Lower energy bound
113
        GEnergy*       m_emax         //!< Upper energy bound
114
};
115

    
116
#endif /* GONOFFBIN_HPP */