Commit 1bf17790cf4abe1e6660ed1d4e966873a7c9f8bb
1 parent
a2954be5
removed tscalc parameter from ctlike
Showing
3 changed files
with
16 additions
and
21 deletions
src/ctlike/ctlike.cpp
| ... | ... | @@ -245,23 +245,24 @@ void ctlike::run(void) |
| 245 | 245 | // Store Npred |
| 246 | 246 | double npred = m_obs.npred(); |
| 247 | 247 | |
| 248 | - // Optionally perform TS computation | |
| 249 | - if (m_tscalc) { | |
| 250 | 248 | |
| 249 | + // Store models for which TS should be computed | |
| 250 | + std::vector<std::string> ts_srcs; | |
| 251 | + GModels models_orig = m_obs.models(); | |
| 252 | + for (int i = 0; i < models_orig.size(); ++i) { | |
| 253 | + GModel* model = models_orig[i]; | |
| 254 | + if (model->tscalc()) { | |
| 255 | + ts_srcs.push_back(model->name()); | |
| 256 | + } | |
| 257 | + } | |
| 258 | + | |
| 259 | + // Compute TS values if requested | |
| 260 | + if (ts_srcs.size()) { | |
| 261 | + | |
| 251 | 262 | // Store original maximum likelihood and models |
| 252 | 263 | double logL_src = m_logL; |
| 253 | - GModels models_orig = m_obs.models(); | |
| 254 | - | |
| 255 | - // Store models for which TS should be computed | |
| 256 | - std::vector<std::string> ts_srcs; | |
| 257 | 264 | GModels models = m_obs.models(); |
| 258 | - for (int i = 0; i < models.size(); ++i) { | |
| 259 | - GModel* model = models[i]; | |
| 260 | - if (model->tscalc()) { | |
| 261 | - ts_srcs.push_back(model->name()); | |
| 262 | - } | |
| 263 | - } | |
| 264 | - | |
| 265 | + | |
| 265 | 266 | // Loop over stored models, remove source and refit |
| 266 | 267 | for (int i = 0; i < ts_srcs.size(); ++i) { |
| 267 | 268 | models.remove(ts_srcs[i]); |
| ... | ... | @@ -271,11 +272,10 @@ void ctlike::run(void) |
| 271 | 272 | models_orig[ts_srcs[i]]->ts(ts); |
| 272 | 273 | models = models_orig; |
| 273 | 274 | } |
| 274 | - | |
| 275 | + | |
| 275 | 276 | // Restore best fit values |
| 276 | 277 | m_obs.models(models_orig); |
| 277 | - | |
| 278 | - } // endif: did optional TS computation | |
| 278 | + } | |
| 279 | 279 | |
| 280 | 280 | // Compute number of observed events in all observations |
| 281 | 281 | double num_events = 0.0; |
| ... | ... | @@ -416,7 +416,6 @@ void ctlike::get_parameters(void) |
| 416 | 416 | |
| 417 | 417 | // Get other parameters |
| 418 | 418 | m_refit = (*this)["refit"].boolean(); |
| 419 | - m_tscalc = (*this)["tscalc"].boolean(); | |
| 420 | 419 | m_apply_edisp = (*this)["edisp"].boolean(); |
| 421 | 420 | |
| 422 | 421 | // Optionally read ahead parameters so that they get correctly |
| ... | ... | @@ -546,7 +545,6 @@ void ctlike::init_members(void) |
| 546 | 545 | m_outmdl.clear(); |
| 547 | 546 | m_obs.clear(); |
| 548 | 547 | m_refit = false; |
| 549 | - m_tscalc = false; | |
| 550 | 548 | m_max_iter = 100; // Set maximum number of iterations |
| 551 | 549 | m_max_stall = 10; // Set maximum number of stalls |
| 552 | 550 | m_logL = 0.0; |
| ... | ... | @@ -570,7 +568,6 @@ void ctlike::copy_members(const ctlike& app) |
| 570 | 568 | { |
| 571 | 569 | // Copy attributes |
| 572 | 570 | m_refit = app.m_refit; |
| 573 | - m_tscalc = app.m_tscalc; | |
| 574 | 571 | m_outmdl = app.m_outmdl; |
| 575 | 572 | m_obs = app.m_obs; |
| 576 | 573 | m_max_iter = app.m_max_iter; | ... | ... |
src/ctlike/ctlike.hpp
src/ctlike/ctlike.par
| ... | ... | @@ -21,7 +21,6 @@ infile, f, a, "events.fits",,, "Event list, counts cube or observation definitio |
| 21 | 21 | stat, s, h, "POISSON",,, "Optimization statistics" |
| 22 | 22 | edisp, b, h, no,,, "Apply energy dispersion?" |
| 23 | 23 | refit, b, h, no,,, "Do refitting?" |
| 24 | -tscalc, b, h, no,,, "Compute TS values?" | |
| 25 | 24 | caldb, s, a, "dummy",,, "Calibration database" |
| 26 | 25 | irf, s, a, "cta_dummy_irf",,, "Instrument response function" |
| 27 | 26 | srcmdl, f, a, "$CTOOLS/share/models/crab.xml",,, "Source model" | ... | ... |