Commit fb15d981e6d29dd83608880cab5fdb3c9ddd27f2

Authored by knodlseder
1 parent 94d82238

add refit and stat parameters

src/ctlike/ctlike.cpp
... ... @@ -152,6 +152,8 @@ void ctlike::get_parameters(void)
152 152 {
153 153 // Get standard parameters
154 154 m_method = toupper(par("method")->value());
  155 + m_stat = toupper(par("stat")->value());
  156 + m_refit = par("refit")->boolean();
155 157 m_caldb = par("caldb")->value();
156 158 m_irf = par("irf")->value();
157 159 m_srcmdl = par("srcmdl")->value();
... ... @@ -179,8 +181,8 @@ void ctlike::optimize_lm(void)
179 181 {
180 182 // Allocate optimizer. The logger is only passed to the optimizer
181 183 // constructor if optimizer logging is requested.
182   - GOptimizerLM* opt = (logExplicit()) ? new GOptimizerLM(log)
183   - : new GOptimizerLM();
  184 + GOptimizerLM* opt = (logTerse()) ? new GOptimizerLM(log)
  185 + : new GOptimizerLM();
184 186  
185 187 // Assign optimizer
186 188 m_opt = opt;
... ... @@ -189,7 +191,7 @@ void ctlike::optimize_lm(void)
189 191 opt->max_iter(m_max_iter);
190 192  
191 193 // Write Header for optimization and indent for optimizer logging
192   - if (logExplicit()) {
  194 + if (logTerse()) {
193 195 log << std::endl;
194 196 log.header1("Maximum likelihood optimisation");
195 197 log.indent(1);
... ... @@ -198,6 +200,10 @@ void ctlike::optimize_lm(void)
198 200 // Perform LM optimization
199 201 m_obs.optimize(*m_opt);
200 202  
  203 + // Optionally refit
  204 + if (m_refit)
  205 + m_obs.optimize(*m_opt);
  206 +
201 207 // Get models back
202 208 m_models = *(m_obs.models());
203 209  
... ... @@ -236,6 +242,7 @@ void ctlike::unbinned(const std::string&amp; evfile)
236 242 {
237 243 // Declare observations
238 244 GCTAObservation run;
  245 + run.statistics(m_stat);
239 246  
240 247 // DUMMY: Setup ROI covered by data. This is needed since actual test
241 248 // data do not contain any ROI informations.
... ... @@ -282,6 +289,7 @@ void ctlike::binned(const std::string&amp; cntmap)
282 289 {
283 290 // Declare observations
284 291 GCTAObservation run;
  292 + run.statistics(m_stat);
285 293  
286 294 // Load binned CTA observation
287 295 run.load_binned(cntmap);
... ...
src/ctlike/ctlike.hpp
... ... @@ -55,6 +55,8 @@ protected:
55 55  
56 56 // User parameters
57 57 std::string m_method; //!< Likelihood fitting method (binned/unbinned)
  58 + std::string m_stat; //!< Optimisation statistics (poisson/gaussian)
  59 + bool m_refit; //!< Refitting
58 60 std::string m_caldb; //!< Calibration database
59 61 std::string m_irf; //!< Instrument response functions
60 62 std::string m_srcmdl; //!< Source model XML file
... ...
src/ctlike/ctlike.par
... ... @@ -26,6 +26,8 @@ cntmap, f, a, &quot;test/data/run_00006028_cntmap.fits.gz&quot;,,, &quot;Counts map&quot;
26 26 # General parameters
27 27 #===================
28 28 method, s, a, "UNBINNED",,, "Maximum likelihood method"
  29 +stat, s, a, "POISSON",,, "Optimization statistics"
  30 +refit, b, a, no,,, "Do refitting?"
29 31 caldb, s, a, "test/irf",,, "Calibration database"
30 32 irf, s, a, "kb_E_50h_v3",,, "Instrument response function"
31 33 srcmdl, f, a, "test/data/source1.xml",,, "Source model"
... ...