Commit a635f9117d0af2c9764af88e7db43910867ec8ab

Authored by Michael Mayer
1 parent eb131e63

Added tscalc parameter to GModel and use it to write GModelSky to file

include/GModel.hpp
... ... @@ -163,6 +163,7 @@ protected:
163 163 std::vector<std::string> m_ids; //!< Identifiers to which model applies
164 164 std::vector<GModelPar*> m_pars; //!< Pointers to all model parameters
165 165 bool m_has_ts; //!< Signals if TS is available
  166 + bool m_has_tscalc; //!< Signals if tscalc attribute is available
166 167 bool m_tscalc; //!< Signals if TS should be computed
167 168 double m_ts; //!< Test Statistic of the model
168 169 };
... ... @@ -304,6 +305,7 @@ inline
304 305 void GModel::tscalc(const bool& tscalc)
305 306 {
306 307 m_tscalc = tscalc;
  308 + m_has_tscalc = true;
307 309 return;
308 310 }
309 311  
... ...
src/model/GModel.cpp
... ... @@ -556,6 +556,7 @@ void GModel::init_members(void)
556 556 m_pars.clear();
557 557 m_ts = 0.0;
558 558 m_has_ts = false;
  559 + m_has_tscalc = false;
559 560 m_tscalc = false;
560 561  
561 562 // Return
... ... @@ -578,6 +579,7 @@ void GModel::copy_members(const GModel&amp; model)
578 579 m_pars = model.m_pars;
579 580 m_ts = model.m_ts;
580 581 m_has_ts = model.m_has_ts;
  582 + m_has_tscalc = model.m_has_tscalc;
581 583 m_tscalc = model.m_tscalc;
582 584  
583 585 // Return
... ...
src/model/GModelSky.cpp
... ... @@ -761,6 +761,12 @@ void GModelSky::write(GXmlElement&amp; xml) const
761 761 src->attribute("ts", gammalib::str(ts(), 3));
762 762 }
763 763  
  764 + // If tscalc parameter was available, then write it to XML
  765 + if (m_has_tscalc) {
  766 + std::string ts_calc = tscalc() ? "1" : "0";
  767 + src->attribute("tscalc", ts_calc);
  768 + }
  769 +
764 770 // Write spectral model
765 771 if (spectral() != NULL) {
766 772 GXmlElement* spec = src->element("spectrum", 0);
... ...