Commit 531864e08dd39deba2b755b9e771470c6bbe8147
1 parent
6e38071f
clear up code
Showing
1 changed file
with
27 additions
and
21 deletions
src/ctlike/ctlike.cpp
| @@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
| 20 | #ifdef HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #endif | 22 | #endif |
| 23 | -#include <stdio.h> | 23 | +#include <cstdio> |
| 24 | #include "ctlike.hpp" | 24 | #include "ctlike.hpp" |
| 25 | #include "GTools.hpp" | 25 | #include "GTools.hpp" |
| 26 | 26 | ||
| @@ -241,22 +241,26 @@ void ctlike::optimize_lm(void) | @@ -241,22 +241,26 @@ void ctlike::optimize_lm(void) | ||
| 241 | 241 | ||
| 242 | 242 | ||
| 243 | /***********************************************************************//** | 243 | /***********************************************************************//** |
| 244 | - * @brief Load unbinned observation | 244 | + * @brief Load unbinned observation and append to observations contained |
| 245 | * | 245 | * |
| 246 | * @param[in] evfile Events file name. | 246 | * @param[in] evfile Events file name. |
| 247 | ***************************************************************************/ | 247 | ***************************************************************************/ |
| 248 | void ctlike::unbinned(const std::string& evfile) | 248 | void ctlike::unbinned(const std::string& evfile) |
| 249 | { | 249 | { |
| 250 | - // Declare observations | ||
| 251 | - GCTAObservation run; | ||
| 252 | - run.statistics(m_stat); | 250 | + // Declare CTA observation |
| 251 | + GCTAObservation obs; | ||
| 253 | 252 | ||
| 253 | + // Set statistics | ||
| 254 | + obs.statistics(m_stat); | ||
| 254 | 255 | ||
| 255 | - // Load data and response and set ROI, energy range and time range | ||
| 256 | - // for analysis | ||
| 257 | - run.load_unbinned(evfile); | ||
| 258 | - run.response(m_irf, m_caldb); | ||
| 259 | - m_obs.append(run); | 256 | + // Load data |
| 257 | + obs.load_unbinned(evfile); | ||
| 258 | + | ||
| 259 | + // Set reponse | ||
| 260 | + obs.response(m_irf, m_caldb); | ||
| 261 | + | ||
| 262 | + // Append observation to contained | ||
| 263 | + m_obs.append(obs); | ||
| 260 | 264 | ||
| 261 | // Return | 265 | // Return |
| 262 | return; | 266 | return; |
| @@ -264,24 +268,26 @@ void ctlike::unbinned(const std::string& evfile) | @@ -264,24 +268,26 @@ void ctlike::unbinned(const std::string& evfile) | ||
| 264 | 268 | ||
| 265 | 269 | ||
| 266 | /***********************************************************************//** | 270 | /***********************************************************************//** |
| 267 | - * @brief Load binned observation | 271 | + * @brief Load binned observation and append to observations contained |
| 268 | * | 272 | * |
| 269 | * @param[in] cntmap Counts map file name. | 273 | * @param[in] cntmap Counts map file name. |
| 270 | ***************************************************************************/ | 274 | ***************************************************************************/ |
| 271 | void ctlike::binned(const std::string& cntmap) | 275 | void ctlike::binned(const std::string& cntmap) |
| 272 | { | 276 | { |
| 273 | - // Declare observations | ||
| 274 | - GCTAObservation run; | ||
| 275 | - run.statistics(m_stat); | 277 | + // Declare CTA observation |
| 278 | + GCTAObservation obs; | ||
| 279 | + | ||
| 280 | + // Set statistics | ||
| 281 | + obs.statistics(m_stat); | ||
| 276 | 282 | ||
| 277 | - // Load binned CTA observation | ||
| 278 | - run.load_binned(cntmap); | 283 | + // Load data |
| 284 | + obs.load_binned(cntmap); | ||
| 279 | 285 | ||
| 280 | - // Set response | ||
| 281 | - run.response(m_irf, m_caldb); | 286 | + // Set reponse |
| 287 | + obs.response(m_irf, m_caldb); | ||
| 282 | 288 | ||
| 283 | - // Append observation to container | ||
| 284 | - m_obs.append(run); | 289 | + // Append observation to contained |
| 290 | + m_obs.append(obs); | ||
| 285 | 291 | ||
| 286 | // Return | 292 | // Return |
| 287 | return; | 293 | return; |
| @@ -307,7 +313,7 @@ void ctlike::init_members(void) | @@ -307,7 +313,7 @@ void ctlike::init_members(void) | ||
| 307 | m_outmdl.clear(); | 313 | m_outmdl.clear(); |
| 308 | m_models.clear(); | 314 | m_models.clear(); |
| 309 | m_obs.clear(); | 315 | m_obs.clear(); |
| 310 | - m_max_iter = 100; | 316 | + m_max_iter = 100; // Set maximum number of iterations to 100 |
| 311 | m_logL = 0.0; | 317 | m_logL = 0.0; |
| 312 | m_opt = NULL; | 318 | m_opt = NULL; |
| 313 | 319 |