Commit 7beb74896febdcc903fab4f3e35d659ddd550ee0

Authored by knodlseder
1 parent c6eef768

add optimizer statistics parameter and methods

include/GObservation.hpp
... ... @@ -75,7 +75,6 @@ public:
75 75 virtual std::string instrument(void) const = 0;
76 76 virtual GObservation* clone(void) const = 0;
77 77  
78   -
79 78 // Virtual methods
80 79 virtual double model(const GModels& models,const GInstDir& obsDir,
81 80 const GEnergy& obsEng, const GTime& obsTime,
... ... @@ -87,6 +86,7 @@ public:
87 86 void roi(const GRoi& roi) { m_roi=roi.clone(); return; }
88 87 void ebounds(const GEbounds& ebounds) { m_ebounds=ebounds; return; }
89 88 void gti(const GGti& gti) { m_gti=gti; return; }
  89 + void statistics(const std::string& statistics);
90 90 std::string obsname(void) const { return m_obsname; }
91 91 GTime tstart(void) const { return m_gti.tstart(); }
92 92 GTime tstop(void) const { return m_gti.tstop(); }
... ... @@ -96,6 +96,7 @@ public:
96 96 GEbounds* ebounds(void) { return &m_ebounds; }
97 97 GGti* gti(void) { return &m_gti; }
98 98 GEvents* events(void) const { return m_events; }
  99 + std::string statistics(void) const { return m_statistics; }
99 100  
100 101 protected:
101 102 // Protected methods
... ... @@ -173,11 +174,11 @@ protected:
173 174  
174 175 // Protected data area
175 176 std::string m_obsname; //!< Name of observation
176   - //std::string m_instrument; //!< Instrument name
177 177 GEbounds m_ebounds; //!< Energy boundaries used for analysis
178 178 GGti m_gti; //!< Good time intervals used for analysis
179 179 GRoi* m_roi; //!< Pointer to region of interest used for analysis
180 180 GEvents* m_events; //!< Pointer to events
  181 + std::string m_statistics; //!< Optimizer statistics (default=poisson)
181 182  
182 183 private:
183 184 };
... ...
src/obs/GObservation.cpp
... ... @@ -26,6 +26,7 @@
26 26 #include "GObservation.hpp"
27 27 #include "GModelSpatialPtsrc.hpp"
28 28 #include "GIntegral.hpp"
  29 +#include "GTools.hpp"
29 30  
30 31 /* __ Method name definitions ____________________________________________ */
31 32 #define G_MODEL "GObservation::model(GModels&, GPointing&, GInstDir&, GEnergy&, GTime&, GVector*) const"
... ... @@ -253,6 +254,34 @@ double GObservation::npred(const GModels&amp; models, GVector* gradient) const
253 254 }
254 255  
255 256  
  257 +/***********************************************************************//**
  258 + * @brief Set optimizer statistics for observation
  259 + *
  260 + * @param[in] statistics Optimizer statistics.
  261 + *
  262 + * Set the optimizer statistics for this observation.
  263 + *
  264 + * @todo Throw an exception if an invalid statistics has been specified.
  265 + ***************************************************************************/
  266 +void GObservation::statistics(const std::string& statistics)
  267 +{
  268 + // Check for Poisson statistics
  269 + if (toupper(statistics) == "POISSON")
  270 + m_statistics = "Poisson";
  271 +
  272 + // Check for Gaussian statistics
  273 + else if (toupper(statistics) == "GAUSSIAN")
  274 + m_statistics = "Gaussian";
  275 +
  276 + // Otherwise default to Poisson statistics
  277 + else
  278 + m_statistics = "Poisson";
  279 +
  280 + // Return
  281 + return;
  282 +}
  283 +
  284 +
256 285 /*==========================================================================
257 286 = =
258 287 = Private methods =
... ... @@ -268,8 +297,9 @@ void GObservation::init_members(void)
268 297 m_obsname.clear();
269 298 m_ebounds.clear();
270 299 m_gti.clear();
271   - m_roi = NULL;
272   - m_events = NULL;
  300 + m_roi = NULL;
  301 + m_events = NULL;
  302 + m_statistics = "Poisson";
273 303  
274 304 // Return
275 305 return;
... ... @@ -286,9 +316,10 @@ void GObservation::init_members(void)
286 316 void GObservation::copy_members(const GObservation& obs)
287 317 {
288 318 // Copy attributes
289   - m_obsname = obs.m_obsname;
290   - m_ebounds = obs.m_ebounds;
291   - m_gti = obs.m_gti;
  319 + m_obsname = obs.m_obsname;
  320 + m_ebounds = obs.m_ebounds;
  321 + m_gti = obs.m_gti;
  322 + m_statistics = obs.m_statistics;
292 323  
293 324 // Clone members that exist
294 325 m_roi = (obs.m_roi != NULL) ? obs.m_roi->clone() : NULL;
... ... @@ -804,6 +835,7 @@ std::ostream&amp; operator&lt;&lt; (std::ostream&amp; os, const GObservation&amp; obs)
804 835 os << " Energy range ..............: " << std::fixed
805 836 << obs.m_ebounds.emin().MeV() << " - "
806 837 << obs.m_ebounds.emax().MeV() << " MeV" << std::endl;
  838 + os << " Optimizer statistics ......: " << obs.m_statistics << std::endl;
807 839  
808 840 // Add event list to stream
809 841 if (obs.m_events != NULL)
... ...